ddcutil-0.8.6/0000755000175000001440000000000013230445450010152 500000000000000ddcutil-0.8.6/config/0000755000175000001440000000000013230445446011424 500000000000000ddcutil-0.8.6/config/ar-lib0000755000175000001440000001330213226776741012451 00000000000000#! /bin/sh # Wrapper for Microsoft lib.exe me=ar-lib scriptversion=2012-03-01.08; # UTC # Copyright (C) 2010-2017 Free Software Foundation, Inc. # Written by Peter Rosin . # # 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 # . # func_error message func_error () { echo "$me: $1" 1>&2 exit 1 } file_conv= # func_file_conv build_file # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv in mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin) file=`cygpath -m "$file" || echo "$file"` ;; wine) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_at_file at_file operation archive # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE # for each of them. # When interpreting the content of the @FILE, do NOT use func_file_conv, # since the user would need to supply preconverted file names to # binutils ar, at least for MinGW. func_at_file () { operation=$2 archive=$3 at_file_contents=`cat "$1"` eval set x "$at_file_contents" shift for member do $AR -NOLOGO $operation:"$member" "$archive" || exit $? done } case $1 in '') func_error "no command. Try '$0 --help' for more information." ;; -h | --h*) cat <. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ 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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ddcutil-0.8.6/config/config.guess0000755000175000001440000012646213226776741013711 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2017 Free Software Foundation, Inc. timestamp='2017-08-08' # 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: # http://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. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; 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) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # 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 ;; *: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 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/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:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) 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*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; 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:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; 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.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB 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 eval $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 ;; 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. 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 cat >&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ddcutil-0.8.6/config/config.sub0000755000175000001440000010725713226776741013355 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. timestamp='2017-04-02' # 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: # http://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. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; wasm32) basic_machine=wasm32-unknown ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -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* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -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* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; 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 ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ddcutil-0.8.6/config/install-sh0000755000175000001440000003452413226776741013372 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2016-01-11.22; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ddcutil-0.8.6/config/ltmain.sh0000644000175000001440000117077113226776734013216 00000000000000#! /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 # -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=*) 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: ddcutil-0.8.6/config/missing0000755000175000001440000001533113226776741012760 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2016-01-11.22; # UTC # Copyright (C) 1996-2017 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ddcutil-0.8.6/config/depcomp0000755000175000001440000005601713226776742012745 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2016-01-11.22; # UTC # Copyright (C) 1999-2017 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ddcutil-0.8.6/config/py-compile0000755000175000001440000001107713226776741013370 00000000000000#!/bin/sh # py-compile - Compile a Python program scriptversion=2016-01-11.22; # UTC # Copyright (C) 2000-2017 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 # . if [ -z "$PYTHON" ]; then PYTHON=python fi me=py-compile usage_error () { echo "$me: $*" >&2 echo "Try '$me --help' for more information." >&2 exit 1 } basedir= destdir= while test $# -ne 0; do case "$1" in --basedir) if test $# -lt 2; then usage_error "option '--basedir' requires an argument" else basedir=$2 fi shift ;; --destdir) if test $# -lt 2; then usage_error "option '--destdir' requires an argument" else destdir=$2 fi shift ;; -h|--help) cat <<\EOF Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." Byte compile some python scripts FILES. Use --destdir to specify any leading directory path to the FILES that you don't want to include in the byte compiled file. Specify --basedir for any additional path information you do want to be shown in the byte compiled file. Example: py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py Report bugs to . EOF exit $? ;; -v|--version) echo "$me $scriptversion" exit $? ;; --) shift break ;; -*) usage_error "unrecognized option '$1'" ;; *) break ;; esac shift done files=$* if test -z "$files"; then usage_error "no files given" fi # if basedir was given, then it should be prepended to filenames before # byte compilation. if [ -z "$basedir" ]; then pathtrans="path = file" else pathtrans="path = os.path.join('$basedir', file)" fi # if destdir was given, then it needs to be prepended to the filename to # byte compile but not go into the compiled file. if [ -z "$destdir" ]; then filetrans="filepath = path" else filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" fi $PYTHON -c " import sys, os, py_compile, imp files = '''$files''' sys.stdout.write('Byte-compiling python modules...\n') for file in files.split(): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue sys.stdout.write(file) sys.stdout.flush() if hasattr(imp, 'get_tag'): py_compile.compile(filepath, imp.cache_from_source(filepath), path) else: py_compile.compile(filepath, filepath + 'c', path) sys.stdout.write('\n')" || exit $? # this will fail for python < 1.5, but that doesn't matter ... $PYTHON -O -c " import sys, os, py_compile, imp # pypy does not use .pyo optimization if hasattr(sys, 'pypy_translation_info'): sys.exit(0) files = '''$files''' sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') for file in files.split(): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue sys.stdout.write(file) sys.stdout.flush() if hasattr(imp, 'get_tag'): py_compile.compile(filepath, imp.cache_from_source(filepath, False), path) else: py_compile.compile(filepath, filepath + 'o', path) sys.stdout.write('\n')" 2>/dev/null || : # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: ddcutil-0.8.6/m4/0000755000175000001440000000000013230445446010477 500000000000000ddcutil-0.8.6/m4/ax_path_python3.m40000644000175000001440000002306613042715053013773 00000000000000## ------------------------ -*- Autoconf -*- ## Python file handling ## From Andrew Dalke ## Updated by James Henstridge ## ------------------------ # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Modiied version of AM_PATH_PYTHON that only looks for Python 3 versions. # Uses separate variables so that AM_PATH_PYTHON can be used to find # Python 2, and AX_PATH_PYTHON3 can be use for Python 3 # # AX_PATH_PYTHON3([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([AX_PATH_PYTHON3], [ 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_LIST3], [python3 python3.3 python3.2 python3.1 python3.0 ]) AC_ARG_VAR([PYTHON3], [the Python 3 interpreter]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON3"; then AC_PATH_PROGS([PYTHON3], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON3=python3 ], [ dnl A version check is needed. if test -n "$PYTHON3"; then # If the user set $PYTHON3, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON3 version is >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON3], [$1], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_MSG_ERROR([Python3 interpreter is too old])]) am_display_PYTHON3=$PYTHON3 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_PYTHON3],[ for am_cv_pathless_PYTHON3 in _AM_PYTHON_INTERPRETER_LIST3 none; do test "$am_cv_pathless_PYTHON3" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON3], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON3. if test "$am_cv_pathless_PYTHON3" = none; then PYTHON3=: else AC_PATH_PROG([PYTHON3], [$am_cv_pathless_PYTHON3]) fi am_display_PYTHON3=$am_cv_pathless_PYTHON3 fi ]) if test "$PYTHON3" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python3 interpreter found])]) else dnl Query Python for its version number. Getting [:3] seems to be dnl the best way to do this; it's what "site.py" does in the standard dnl library. AC_CACHE_CHECK([for $am_display_PYTHON3 version], [am_cv_python_version3], [am_cv_python_version3=`$PYTHON3 -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) AC_SUBST([PYTHON3_VERSION], [$am_cv_python_version3]) 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([PYTHON3_PREFIX], ['${prefix}']) AC_SUBST([PYTHON3_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_PYTHON3 platform], [am_cv_python3_platform], [am_cv_python3_platform=`$PYTHON3 -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON3_PLATFORM], [$am_cv_python3_platform]) # Just factor out some code duplication. am_python3_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_use_sysconfig = 0 # 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_PYTHON3 script directory], [am_cv_python3_pythondir], [if test "x$prefix" = xNONE then am_py3_prefix=$ac_default_prefix else am_py3_prefix=$prefix fi am_cv_python3_pythondir=`$PYTHON3 -c " $am_python3_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py3_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py3_prefix') sys.stdout.write(sitedir)"` case $am_cv_python3_pythondir in $am_py3_prefix*) am__strip_prefix=`echo "$am_py3_prefix" | sed 's|.|.|g'` am_cv_python3_pythondir=`echo "$am_cv_python3_pythondir" | sed "s,^$am__strip_prefix,$PYTHON3_PREFIX,"` ;; *) case $am_py3_prefix in /usr|/System*) ;; *) am_cv_python3_pythondir=$PYTHON3_PREFIX/lib/python$PYTHON3_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([python3dir], [$am_cv_python3_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([pkgpython3dir], [\${python3dir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. AC_CACHE_CHECK([for $am_display_PYTHON3 extension module directory], [am_cv_python_py3execdir], [if test "x$exec_prefix" = xNONE then am_py3_exec_prefix=$am_py3_prefix else am_py3_exec_prefix=$exec_prefix fi am_cv_python3_pyexecdir=`$PYTHON3 -c " $am_python3_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py3_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py3_prefix') sys.stdout.write(sitedir)"` AC_MSG_NOTICE( [am_py3_cv_python3_pyexecdir = ${am_py3_cv_pyexecdir} ]) case $am_cv_python3_pyexecdir in $am_py3_exec_prefix*) am__strip_prefix=`echo "$am_py3_exec_prefix" | sed 's|.|.|g'` am_cv_python3_pyexecdir=`echo "$am_cv_python3_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON3_EXEC_PREFIX,"` AC_MSG_NOTICE( [Case 1: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} ]) am_cv_python3_pyexecdir=`echo "$am_cv_python3_pyexecdir" | sed "s,/python3/,/python$am_cv_python_version3/,"` AC_MSG_NOTICE( [Case 1 fixup: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} ]) ;; *) case $am_py3_exec_prefix in /usr|/System*) ;; *) am_cv_python3_pyexecdir=$PYTHON3_EXEC_PREFIX/lib/python$PYTHON3_VERSION/site-packages AC_MSG_NOTICE( [Case 2b: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} ]) ;; esac ;; esac ]) AC_SUBST([py3execdir], [$am_cv_python3_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpy3execdir], [\${py3execdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION_RANGE(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_RANGE], [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])]) ddcutil-0.8.6/m4/ax_pkg_swig.m40000664000175000001440000001515313014535131013161 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html # =========================================================================== # # SYNOPSIS # # AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found]) # # DESCRIPTION # # This macro searches for a SWIG installation on your system. If found, # then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is # found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd. # # You can use the optional first argument to check if the version of the # available SWIG is greater than or equal to the value of the argument. It # should have the format: N[.N[.N]] (N is a number between 0 and 999. Only # the first N is mandatory.) If the version argument is given (e.g. # 1.3.17), AX_PKG_SWIG checks that the swig package is this version number # or higher. # # As usual, action-if-found is executed if SWIG is found, otherwise # action-if-not-found is executed. # # In configure.in, use as: # # AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ]) # AX_SWIG_ENABLE_CXX # AX_SWIG_MULTI_MODULE_SUPPORT # AX_SWIG_PYTHON # # LICENSE # # Copyright (c) 2008 Sebastian Huber # Copyright (c) 2008 Alan W. Irwin # Copyright (c) 2008 Rafael Laboissiere # Copyright (c) 2008 Andrew Collier # Copyright (c) 2011 Murray Cumming # # 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, 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. #serial 11 AC_DEFUN([AX_PKG_SWIG],[ # Ubuntu has swig 2.0 as /usr/bin/swig2.0 AC_PATH_PROGS([SWIG],[swig swig2.0]) if test -z "$SWIG" ; then m4_ifval([$3],[$3],[:]) elif test -n "$1" ; then AC_MSG_CHECKING([SWIG version]) [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] AC_MSG_RESULT([$swig_version]) if test -n "$swig_version" ; then # Calculate the required version number components [required=$1] [required_major=`echo $required | sed 's/[^0-9].*//'`] if test -z "$required_major" ; then [required_major=0] fi [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] [required_minor=`echo $required | sed 's/[^0-9].*//'`] if test -z "$required_minor" ; then [required_minor=0] fi [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] [required_patch=`echo $required | sed 's/[^0-9].*//'`] if test -z "$required_patch" ; then [required_patch=0] fi # Calculate the available version number components [available=$swig_version] [available_major=`echo $available | sed 's/[^0-9].*//'`] if test -z "$available_major" ; then [available_major=0] fi [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] [available_minor=`echo $available | sed 's/[^0-9].*//'`] if test -z "$available_minor" ; then [available_minor=0] fi [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] [available_patch=`echo $available | sed 's/[^0-9].*//'`] if test -z "$available_patch" ; then [available_patch=0] fi # Convert the version tuple into a single number for easier comparison. # Using base 100 should be safe since SWIG internally uses BCD values # to encode its version number. required_swig_vernum=`expr $required_major \* 10000 \ \+ $required_minor \* 100 \+ $required_patch` available_swig_vernum=`expr $available_major \* 10000 \ \+ $available_minor \* 100 \+ $available_patch` if test $available_swig_vernum -lt $required_swig_vernum; then AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.]) SWIG='' m4_ifval([$3],[$3],[]) else AC_MSG_CHECKING([for SWIG library]) SWIG_LIB=`$SWIG -swiglib` AC_MSG_RESULT([$SWIG_LIB]) m4_ifval([$2],[$2],[]) fi else AC_MSG_WARN([cannot determine SWIG version]) SWIG='' m4_ifval([$3],[$3],[]) fi fi AC_SUBST([SWIG_LIB]) ]) ddcutil-0.8.6/m4/ax_prog_doxygen.m40000644000175000001440000005004213032550072014046 00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html # =========================================================================== # # SYNOPSIS # # DX_INIT_DOXYGEN(PROJECT-NAME, [DOXYFILE-PATH], [OUTPUT-DIR], ...) # DX_DOXYGEN_FEATURE(ON|OFF) # DX_DOT_FEATURE(ON|OFF) # DX_HTML_FEATURE(ON|OFF) # DX_CHM_FEATURE(ON|OFF) # DX_CHI_FEATURE(ON|OFF) # DX_MAN_FEATURE(ON|OFF) # DX_RTF_FEATURE(ON|OFF) # DX_XML_FEATURE(ON|OFF) # DX_PDF_FEATURE(ON|OFF) # DX_PS_FEATURE(ON|OFF) # # DESCRIPTION # # The DX_*_FEATURE macros control the default setting for the given # Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for # generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML # help (for MS users), 'CHI' for generating a seperate .chi file by the # .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate # output formats. The environment variable DOXYGEN_PAPER_SIZE may be # specified to override the default 'a4wide' paper size. # # By default, HTML, PDF and PS documentation is generated as this seems to # be the most popular and portable combination. MAN pages created by # Doxygen are usually problematic, though by picking an appropriate subset # and doing some massaging they might be better than nothing. CHM and RTF # are specific for MS (note that you can't generate both HTML and CHM at # the same time). The XML is rather useless unless you apply specialized # post-processing to it. # # The macros mainly control the default state of the feature. The use can # override the default by specifying --enable or --disable. The macros # ensure that contradictory flags are not given (e.g., # --enable-doxygen-html and --enable-doxygen-chm, # --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each # feature will be automatically disabled (with a warning) if the required # programs are missing. # # Once all the feature defaults have been specified, call DX_INIT_DOXYGEN # with the following parameters: a one-word name for the project for use # as a filename base etc., an optional configuration file name (the # default is '$(srcdir)/Doxyfile', the same as Doxygen's default), and an # optional output directory name (the default is 'doxygen-doc'). To run # doxygen multiple times for different configuration files and output # directories provide more parameters: the second, forth, sixth, etc # parameter are configuration file names and the third, fifth, seventh, # etc parameter are output directories. No checking is done to catch # duplicates. # # Automake Support # # The DX_RULES substitution can be used to add all needed rules to the # Makefile. Note that this is a substitution without being a variable: # only the @DX_RULES@ syntax will work. # # The provided targets are: # # doxygen-doc: Generate all doxygen documentation. # # doxygen-run: Run doxygen, which will generate some of the # documentation (HTML, CHM, CHI, MAN, RTF, XML) # but will not do the post processing required # for the rest of it (PS, PDF). # # doxygen-ps: Generate doxygen PostScript documentation. # # doxygen-pdf: Generate doxygen PDF documentation. # # Note that by default these are not integrated into the automake targets. # If doxygen is used to generate man pages, you can achieve this # integration by setting man3_MANS to the list of man pages generated and # then adding the dependency: # # $(man3_MANS): doxygen-doc # # This will cause make to run doxygen and generate all the documentation. # # The following variable is intended for use in Makefile.am: # # DX_CLEANFILES = everything to clean. # # Then add this variable to MOSTLYCLEANFILES. # # LICENSE # # Copyright (c) 2009 Oren Ben-Kiki # Copyright (c) 2015 Olaf Mandel # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 20 ## ----------## ## Defaults. ## ## ----------## DX_ENV="" AC_DEFUN([DX_FEATURE_doc], ON) AC_DEFUN([DX_FEATURE_dot], OFF) AC_DEFUN([DX_FEATURE_man], OFF) AC_DEFUN([DX_FEATURE_html], ON) AC_DEFUN([DX_FEATURE_chm], OFF) AC_DEFUN([DX_FEATURE_chi], OFF) AC_DEFUN([DX_FEATURE_rtf], OFF) AC_DEFUN([DX_FEATURE_xml], OFF) AC_DEFUN([DX_FEATURE_pdf], ON) AC_DEFUN([DX_FEATURE_ps], ON) ## --------------- ## ## Private macros. ## ## --------------- ## # DX_ENV_APPEND(VARIABLE, VALUE) # ------------------------------ # Append VARIABLE="VALUE" to DX_ENV for invoking doxygen and add it # as a substitution (but not a Makefile variable). The substitution # is skipped if the variable name is VERSION. AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])dnl m4_if([$1], [VERSION], [], [AC_SUBST([$1], [$2])dnl AM_SUBST_NOTMAKE([$1])])dnl ]) # DX_DIRNAME_EXPR # --------------- # Expand into a shell expression prints the directory part of a path. AC_DEFUN([DX_DIRNAME_EXPR], [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) # DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) # ------------------------------------- # Expands according to the M4 (static) status of the feature. AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) # DX_REQUIRE_PROG(VARIABLE, PROGRAM) # ---------------------------------- # Require the specified program to be found for the DX_CURRENT_FEATURE to work. AC_DEFUN([DX_REQUIRE_PROG], [ AC_PATH_TOOL([$1], [$2]) if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) fi ]) # DX_TEST_FEATURE(FEATURE) # ------------------------ # Expand to a shell expression testing whether the feature is active. AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) # DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) # ------------------------------------------------- # Verify that a required features has the right state before trying to turn on # the DX_CURRENT_FEATURE. AC_DEFUN([DX_CHECK_DEPEND], [ test "$DX_FLAG_$1" = "$2" \ || AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, requires, contradicts) doxygen-DX_CURRENT_FEATURE]) ]) # DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) # ---------------------------------------------------------- # Turn off the DX_CURRENT_FEATURE if the required feature is off. AC_DEFUN([DX_CLEAR_DEPEND], [ test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) ]) # DX_FEATURE_ARG(FEATURE, DESCRIPTION, # CHECK_DEPEND, CLEAR_DEPEND, # REQUIRE, DO-IF-ON, DO-IF-OFF) # -------------------------------------------- # Parse the command-line option controlling a feature. CHECK_DEPEND is called # if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), # otherwise CLEAR_DEPEND is called to turn off the default state if a required # feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional # requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and # DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. AC_DEFUN([DX_ARG_ABLE], [ AC_DEFUN([DX_CURRENT_FEATURE], [$1]) AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) AC_ARG_ENABLE(doxygen-$1, [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], [--enable-doxygen-$1]), DX_IF_FEATURE([$1], [don't $2], [$2]))], [ case "$enableval" in #( y|Y|yes|Yes|YES) AC_SUBST([DX_FLAG_$1], 1) $3 ;; #( n|N|no|No|NO) AC_SUBST([DX_FLAG_$1], 0) ;; #( *) AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) ;; esac ], [ AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) $4 ]) if DX_TEST_FEATURE([$1]); then $5 : fi if DX_TEST_FEATURE([$1]); then $6 : else $7 : fi ]) ## -------------- ## ## Public macros. ## ## -------------- ## # DX_XXX_FEATURE(DEFAULT_STATE) # ----------------------------- AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])]) AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) # DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR], ...) # -------------------------------------------------------------- # PROJECT also serves as the base name for the documentation files. # The default CONFIG-FILE is "$(srcdir)/Doxyfile" and OUTPUT-DOC-DIR is # "doxygen-doc". # More arguments are interpreted as interleaved CONFIG-FILE and # OUTPUT-DOC-DIR values. AC_DEFUN([DX_INIT_DOXYGEN], [ # Files: AC_SUBST([DX_PROJECT], [$1]) AC_SUBST([DX_CONFIG], ['ifelse([$2], [], [$(srcdir)/Doxyfile], [$2])']) AC_SUBST([DX_DOCDIR], ['ifelse([$3], [], [doxygen-doc], [$3])']) m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2, [AC_SUBST([DX_CONFIG]m4_eval(DX_i[/2]), 'm4_default_nblank_quoted(m4_argn(DX_i, $@), [$(srcdir)/Doxyfile])')])])dnl m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 5, m4_count($@,), 2, [AC_SUBST([DX_DOCDIR]m4_eval([(]DX_i[-1)/2]), 'm4_default_nblank_quoted(m4_argn(DX_i, $@), [doxygen-doc])')])])dnl m4_define([DX_loop], m4_dquote(m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2, [, m4_eval(DX_i[/2])])], [])))dnl # Environment variables used inside doxygen.cfg: DX_ENV_APPEND(SRCDIR, $srcdir) DX_ENV_APPEND(PROJECT, $DX_PROJECT) DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) # Doxygen itself: DX_ARG_ABLE(doc, [generate any doxygen documentation], [], [], [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) DX_REQUIRE_PROG([DX_PERL], perl)], [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) # Dot for graphics: DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [DX_REQUIRE_PROG([DX_DOT], dot)], [DX_ENV_APPEND(HAVE_DOT, YES) DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], [DX_ENV_APPEND(HAVE_DOT, NO)]) # Man pages generation: DX_ARG_ABLE(man, [generate doxygen manual pages], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [], [DX_ENV_APPEND(GENERATE_MAN, YES)], [DX_ENV_APPEND(GENERATE_MAN, NO)]) # RTF file generation: DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [], [DX_ENV_APPEND(GENERATE_RTF, YES)], [DX_ENV_APPEND(GENERATE_RTF, NO)]) # XML file generation: DX_ARG_ABLE(xml, [generate doxygen XML documentation], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [], [DX_ENV_APPEND(GENERATE_XML, YES)], [DX_ENV_APPEND(GENERATE_XML, NO)]) # (Compressed) HTML help generation: DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [DX_REQUIRE_PROG([DX_HHC], hhc)], [DX_ENV_APPEND(HHC_PATH, $DX_HHC) DX_ENV_APPEND(GENERATE_HTML, YES) DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) # Seperate CHI file generation. DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file], [DX_CHECK_DEPEND(chm, 1)], [DX_CLEAR_DEPEND(chm, 1)], [], [DX_ENV_APPEND(GENERATE_CHI, YES)], [DX_ENV_APPEND(GENERATE_CHI, NO)]) # Plain HTML pages generation: DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], [], [DX_ENV_APPEND(GENERATE_HTML, YES)], [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) # PostScript file generation: DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [DX_REQUIRE_PROG([DX_LATEX], latex) DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) DX_REQUIRE_PROG([DX_DVIPS], dvips) DX_REQUIRE_PROG([DX_EGREP], egrep)]) # PDF file generation: DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], [DX_CHECK_DEPEND(doc, 1)], [DX_CLEAR_DEPEND(doc, 1)], [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) DX_REQUIRE_PROG([DX_EGREP], egrep)]) # LaTeX generation for PS and/or PDF: if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then DX_ENV_APPEND(GENERATE_LATEX, YES) else DX_ENV_APPEND(GENERATE_LATEX, NO) fi # Paper size for PS and/or PDF: AC_ARG_VAR(DOXYGEN_PAPER_SIZE, [a4wide (default), a4, letter, legal or executive]) case "$DOXYGEN_PAPER_SIZE" in #( "") AC_SUBST(DOXYGEN_PAPER_SIZE, "") ;; #( a4wide|a4|letter|legal|executive) DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) ;; #( *) AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) ;; esac # Rules: AS_IF([[test $DX_FLAG_html -eq 1]], [[DX_SNIPPET_html="## ------------------------------- ## ## Rules specific for HTML output. ## ## ------------------------------- ## DX_CLEAN_HTML = \$(DX_DOCDIR)/html]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/html]])[ "]], [[DX_SNIPPET_html=""]]) AS_IF([[test $DX_FLAG_chi -eq 1]], [[DX_SNIPPET_chi=" DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).chi]])["]], [[DX_SNIPPET_chi=""]]) AS_IF([[test $DX_FLAG_chm -eq 1]], [[DX_SNIPPET_chm="## ------------------------------ ## ## Rules specific for CHM output. ## ## ------------------------------ ## DX_CLEAN_CHM = \$(DX_DOCDIR)/chm]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/chm]])[\ ${DX_SNIPPET_chi} "]], [[DX_SNIPPET_chm=""]]) AS_IF([[test $DX_FLAG_man -eq 1]], [[DX_SNIPPET_man="## ------------------------------ ## ## Rules specific for MAN output. ## ## ------------------------------ ## DX_CLEAN_MAN = \$(DX_DOCDIR)/man]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/man]])[ "]], [[DX_SNIPPET_man=""]]) AS_IF([[test $DX_FLAG_rtf -eq 1]], [[DX_SNIPPET_rtf="## ------------------------------ ## ## Rules specific for RTF output. ## ## ------------------------------ ## DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/rtf]])[ "]], [[DX_SNIPPET_rtf=""]]) AS_IF([[test $DX_FLAG_xml -eq 1]], [[DX_SNIPPET_xml="## ------------------------------ ## ## Rules specific for XML output. ## ## ------------------------------ ## DX_CLEAN_XML = \$(DX_DOCDIR)/xml]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/xml]])[ "]], [[DX_SNIPPET_xml=""]]) AS_IF([[test $DX_FLAG_ps -eq 1]], [[DX_SNIPPET_ps="## ----------------------------- ## ## Rules specific for PS output. ## ## ----------------------------- ## DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps]])[ DX_PS_GOAL = doxygen-ps doxygen-ps: \$(DX_CLEAN_PS) ]m4_foreach([DX_i], [DX_loop], [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ \$(DX_LATEX) refman.tex; \\ \$(DX_MAKEINDEX) refman.idx; \\ \$(DX_LATEX) refman.tex; \\ countdown=5; \\ while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ refman.log > /dev/null 2>&1 \\ && test \$\$countdown -gt 0; do \\ \$(DX_LATEX) refman.tex; \\ countdown=\`expr \$\$countdown - 1\`; \\ done; \\ \$(DX_DVIPS) -o ../\$(PACKAGE).ps refman.dvi ]])["]], [[DX_SNIPPET_ps=""]]) AS_IF([[test $DX_FLAG_pdf -eq 1]], [[DX_SNIPPET_pdf="## ------------------------------ ## ## Rules specific for PDF output. ## ## ------------------------------ ## DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf]])[ DX_PDF_GOAL = doxygen-pdf doxygen-pdf: \$(DX_CLEAN_PDF) ]m4_foreach([DX_i], [DX_loop], [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ \$(DX_PDFLATEX) refman.tex; \\ \$(DX_MAKEINDEX) refman.idx; \\ \$(DX_PDFLATEX) refman.tex; \\ countdown=5; \\ while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ refman.log > /dev/null 2>&1 \\ && test \$\$countdown -gt 0; do \\ \$(DX_PDFLATEX) refman.tex; \\ countdown=\`expr \$\$countdown - 1\`; \\ done; \\ mv refman.pdf ../\$(PACKAGE).pdf ]])["]], [[DX_SNIPPET_pdf=""]]) AS_IF([[test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1]], [[DX_SNIPPET_latex="## ------------------------------------------------- ## ## Rules specific for LaTeX (shared for PS and PDF). ## ## ------------------------------------------------- ## DX_V_LATEX = \$(_DX_v_LATEX_\$(V)) _DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY)) _DX_v_LATEX_0 = @echo \" LATEX \" \$][@; DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex]dnl m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ \$(DX_DOCDIR]DX_i[)/latex]])[ "]], [[DX_SNIPPET_latex=""]]) AS_IF([[test $DX_FLAG_doc -eq 1]], [[DX_SNIPPET_doc="## --------------------------------- ## ## Format-independent Doxygen rules. ## ## --------------------------------- ## ${DX_SNIPPET_html}\ ${DX_SNIPPET_chm}\ ${DX_SNIPPET_man}\ ${DX_SNIPPET_rtf}\ ${DX_SNIPPET_xml}\ ${DX_SNIPPET_ps}\ ${DX_SNIPPET_pdf}\ ${DX_SNIPPET_latex}\ DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V)) _DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY)) _DX_v_DXGEN_0 = @echo \" DXGEN \" \$<; .PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL) .INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) doxygen-run:]m4_foreach([DX_i], [DX_loop], [[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag]])[ doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) ]m4_foreach([DX_i], [DX_loop], [[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag: \$(DX_CONFIG]DX_i[) \$(pkginclude_HEADERS) \$(A""M_V_at)rm -rf \$(DX_DOCDIR]DX_i[) \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR]DX_i[) \$(DX_DOXYGEN) \$(DX_CONFIG]DX_i[) \$(A""M_V_at)echo Timestamp >\$][@ ]])dnl [DX_CLEANFILES = \\] m4_foreach([DX_i], [DX_loop], [[ \$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\ ]])dnl [ -r \\ \$(DX_CLEAN_HTML) \\ \$(DX_CLEAN_CHM) \\ \$(DX_CLEAN_CHI) \\ \$(DX_CLEAN_MAN) \\ \$(DX_CLEAN_RTF) \\ \$(DX_CLEAN_XML) \\ \$(DX_CLEAN_PS) \\ \$(DX_CLEAN_PDF) \\ \$(DX_CLEAN_LATEX)"]], [[DX_SNIPPET_doc=""]]) AC_SUBST([DX_RULES], ["${DX_SNIPPET_doc}"])dnl AM_SUBST_NOTMAKE([DX_RULES]) #For debugging: #echo DX_FLAG_doc=$DX_FLAG_doc #echo DX_FLAG_dot=$DX_FLAG_dot #echo DX_FLAG_man=$DX_FLAG_man #echo DX_FLAG_html=$DX_FLAG_html #echo DX_FLAG_chm=$DX_FLAG_chm #echo DX_FLAG_chi=$DX_FLAG_chi #echo DX_FLAG_rtf=$DX_FLAG_rtf #echo DX_FLAG_xml=$DX_FLAG_xml #echo DX_FLAG_pdf=$DX_FLAG_pdf #echo DX_FLAG_ps=$DX_FLAG_ps #echo DX_ENV=$DX_ENV ]) ddcutil-0.8.6/m4/ax_python_env.m40000644000175000001440000000662113042715053013542 00000000000000 # AX_PYTHON_ENV(PYTHON_BIN, VAR_NAME) # --------------------------------------------------------------------------- AC_DEFUN([AX_PYTHON_ENV], [ AC_ARG_VAR( [PY2_EXTRA_LDFLAGS], [override additional Python 2 linker flags from disutils.sysconfig() ] )dnl AC_ARG_VAR( [PY2_EXTRA_LIBS], [override additional Python 2 libraries from disutils.sysconfig()] )dnl AC_ARG_VAR( [PY3_EXTRA_LDFLAGS], [override additional Python 3 linker flags from distutils.sysconfig() ] )dnl AC_ARG_VAR( [PY3_EXTRA_LIBS], [override additional Python 3 libraries from distutils.sysconfig()] )dnl python=$1 dnl AC_MSG_NOTICE( [=====> Macro ax_python_env, python=$python]) dnl AC_MSG_CHECKING(python version) pyver=`$python -c "import sys; print( sys.version_info.major)"` dnl AC_MSG_NOTICE( [ pyver = $pyver]) AC_MSG_NOTICE( [=====> Macro ax_python_env, python=$python, pyver=$pyver]) # # libraries which must be linked in when embedding # dnl AS_IF( [test 0$pyver == 2 -a -z "$PY2_EXTRA_LIBS" -o 0$pyver == 3 -a -z "$PY3_EXTRA_LIBS" ], [ dnl AC_MSG_NOTICE([Not preset]) AC_MSG_CHECKING(Python $pyver extra libraries) extra_ldflags=`$python -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` AC_MSG_RESULT( [$extra_ldflags] ) AS_IF( [ test 0$pyver -eq 2 ], [ dnl AC_MSG_NOTICE( [pyver == 2] ) AS_IF( [test -z "$PY2_EXTRA_LIBS"], [ dnl AC_MSG_NOTICE( [Setting PY2_EXTRA_LIBS] ) PY2_EXTRA_LIBS=$extra_ldflags ]) ], [ dnl AC_MSG_NOTICE([pyver == 3]) AS_IF( [test -z "$PY3_EXTRA_LIBS"], [ dnl AC_MSG_NOTICE( [Setting PY3_EXTRA_LIBS] ) PY3_EXTRA_LIBS=$extra_ldflags ]) ]) dnl ],[ dnl AC_MSG_NOTICE([ _EXTRA_LIBS preset]) dnl ]) # # linking flags when embedding # AC_MSG_CHECKING(Python $pyver extra linking flags) link_flags=`$python -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LINKFORSHARED'))"` AC_MSG_RESULT( [$link_flags] ) AS_IF( [ test 0$pyver -eq 2 ], [ dnl AC_MSG_NOTICE( [pyver == 2] ) AS_IF( [test -z "$PY2_EXTRA_LDFLAGS"], [ dnl AC_MSG_NOTICE( [Setting PY2_EXTRA_LDFLAGS] ) PY2_EXTRA_LDFLAGS=$link_flags ]) ], [ dnl AC_MSG_NOTICE([pyver == 3]) AS_IF( [test -z "$PY3_EXTRA_LDFLAGS"], [ dnl AC_MSG_NOTICE( [Setting PY3_EXTRA_LDFLAGS] ) PY3_EXTRA_LDFLAGS=$link_flags ]) ]) # # /usr package exec directory # # should this be precious? what should variable name be? AC_MSG_CHECKING(Python $pyver /usr extension directory) exec_dir=`$python -c "import sys; \ import distutils.sysconfig; \ result = distutils.sysconfig.get_python_lib(1,0); \ sys.stdout.write(result)"` AC_MSG_RESULT( [$exec_dir] ) AS_IF( [ test 0$pyver -eq 2 ], [ dnl AC_MSG_NOTICE( [pyver == 2] ) AS_IF( [test -z "$usr_py2execdir"], [ dnl AC_MSG_NOTICE( [Setting usr_py2execdir] ) usr_py2execdir=$exec_dir ]) ], [ dnl AC_MSG_NOTICE([pyver == 3]) AS_IF( [test -z "$usr_py3execdir"], [ dnl AC_MSG_NOTICE( [Setting usr_py3execdir] ) usr_py3execdir=$exec_dir ]) ]) vname=alt_py${pyver}execdir eval $vname=$exec_dir ]) ddcutil-0.8.6/m4/flm_prog_try_doxygen.m40000644000175000001440000000212313015564437015122 00000000000000# FLM_PROG_TRY_DOXYGEN(["quiet"]) # ------------------------------ # FLM_PROG_TRY_DOXYGEN tests for an existing doxygen source # documentation program. It sets or uses the environment # variable DOXYGEN. # # If no arguments are given to this macro, and no doxygen # program can be found, it prints a warning message to STDOUT # and to the config.log file. If the "quiet" argument is passed, # then only the normal "check" line is displayed. Any other # argument is considered by autoconf to be an error at expansion # time. # # Makes the DOXYGEN variable precious to Autoconf. You can # use the DOXYGEN variable in your Makefile.in files with # @DOXYGEN@. # # Author: John Calcote # Modified: 2009-08-30 # License: AllPermissive # AC_DEFUN([FLM_PROG_TRY_DOXYGEN], [AC_ARG_VAR([DOXYGEN], [Doxygen source doc generation program])dnl AC_CHECK_PROGS([DOXYGEN], [doxygen]) m4_if([$1],, [if test -z "$DOXYGEN"; then AC_MSG_WARN([doxygen not found - continuing without Doxygen support]) fi], [$1], [quiet],, [m4_fatal([Invalid option '$1' in $0])]) ])# FLM_PROG_TRY_DOXYGEN ddcutil-0.8.6/m4/introspection.m40000664000175000001440000000673613014535131013566 00000000000000dnl -*- mode: autoconf -*- dnl Copyright 2009 Johan Dahlin dnl dnl This file is free software; the author(s) gives unlimited dnl permission to copy and/or distribute it, with or without dnl modifications, as long as this notice is preserved. dnl # serial 1 m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL], [ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first AC_BEFORE([LT_INIT],[$0])dnl setup libtool first dnl enable/disable introspection m4_if([$2], [require], [dnl enable_introspection=yes ],[dnl AC_ARG_ENABLE(introspection, AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]], [Enable introspection for this build]),, [enable_introspection=auto]) ])dnl AC_MSG_CHECKING([for gobject-introspection]) dnl presence/version checking AS_CASE([$enable_introspection], [no], [dnl found_introspection="no (disabled, use --enable-introspection to enable)" ],dnl [yes],[dnl PKG_CHECK_EXISTS([gobject-introspection-1.0],, AC_MSG_ERROR([gobject-introspection-1.0 is not installed])) PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME])) ],dnl [auto],[dnl PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no) dnl Canonicalize enable_introspection enable_introspection=$found_introspection ],dnl [dnl AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@]) ])dnl AC_MSG_RESULT([$found_introspection]) INTROSPECTION_SCANNER= INTROSPECTION_COMPILER= INTROSPECTION_GENERATE= INTROSPECTION_GIRDIR= INTROSPECTION_TYPELIBDIR= if test "x$found_introspection" = "xyes"; then INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection fi AC_SUBST(INTROSPECTION_SCANNER) AC_SUBST(INTROSPECTION_COMPILER) AC_SUBST(INTROSPECTION_GENERATE) AC_SUBST(INTROSPECTION_GIRDIR) AC_SUBST(INTROSPECTION_TYPELIBDIR) AC_SUBST(INTROSPECTION_CFLAGS) AC_SUBST(INTROSPECTION_LIBS) AC_SUBST(INTROSPECTION_MAKEFILE) AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes") ]) dnl Usage: dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version]) AC_DEFUN([GOBJECT_INTROSPECTION_CHECK], [ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1]) ]) dnl Usage: dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version]) AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE], [ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require]) ]) ddcutil-0.8.6/m4/libtool.m40000644000175000001440000112530613226776734012351 00000000000000# 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 ddcutil-0.8.6/m4/ltoptions.m40000644000175000001440000003426213226776734012737 00000000000000# 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])]) ddcutil-0.8.6/m4/ltsugar.m40000644000175000001440000001044013226776734012355 00000000000000# 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 ]) ddcutil-0.8.6/m4/ltversion.m40000644000175000001440000000127313226776734012725 00000000000000# 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) ]) ddcutil-0.8.6/m4/lt~obsolete.m40000644000175000001440000001377413226776734013263 00000000000000# 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])]) ddcutil-0.8.6/Makefile.am0000644000175000001440000001226213227277774012153 00000000000000# to automatically update libtool script if it becomes out of date LIBTOOL_DEPS = @LIBTOOL_DEPS@ # From autoconf manual: # ... if you use aclocal from Automake to generate aclocal.m4, you must also # set ACLOCAL_AMFLAGS = -I dir in your top-level Makefile.am. # Due to a limitation in the Autoconf implementation of autoreconf, these # include directives currently must be set on a single line in Makefile.am, # without any backslash-newlines # Introspection does this. ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} EXTRA_DIST = README.md NEWS.md # if ENABLE_GOBJECT_COND DISTCHECK_CONFIGURE_FLAGS = --enable-introspection EXTRA_DIST += m4/introspection.m4 # endif if USE_DOXYGEN DOXYDIR = docs endif # doc_DATA = AUTHORS COPYING NEWS.md README.md ChangeLog SUBDIRS = src man data $(DOXYDIR) if ENABLE_SHARED_LIB_COND pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = ddcutil.pc # cmakedir = $(datadir)/cmake/Modules # cmake_DATA = FindDDCUtil.cmake # EXTRA_DIST += FindDDCUtil.cmake endif if ENABLE_SHARED_LIB_COND libddcdocdir = $(datarootdir)/doc/libddcutil # libddcdoc_DATA = AUTHORS endif # Too many false positives: # alpha.clone.CloneChecker # alpha.deadcode.UnreachableCode # alpha.core.CastToStruct # Copied and adapted from colord # is calling autogen.sh within this file dangerous? clang: $(MAKE) clean; \ rm -rf clang; \ scan-build --use-analyzer=/usr/bin/clang \ -o clang-report \ ./autogen.sh \ --disable_gobject_api \ --enable-cffi \ --enable-cython \ ; \ scan-build --use-analyzer=/usr/bin/clang \ -o clang-report \ -enable-checker alpha.core.CastSize \ -enable-checker alpha.core.BoolAssignment \ -enable-checker alpha.core.Conversion \ -enable-checker alpha.core.SizeofPtr \ make # $(foreach v, $(.VARIABLES), @echo "$v = $$v") show: @echo "---> Show variables" @echo "Set by AM_PATH_PYTHON:" @echo " PYTHON = $(PYTHON) " @echo " PYTHON_PREFIX = $(PYTHON_PREFIX) " @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX) " @echo " pythondir = $(pythondir) " @echo " pkgpythondir = $(pkgpythondir) " @echo " pyexecdir = $(pyexecdir) " @echo " pkgpyexecdir = $(pkgpyexecdir) " @echo "" @echo "Explicitly set:" @echo " PYTHONDIR = $(PYTHONDIR) " @echo " PKGPYTHONDIR = $(PKGPYTHONDIR) " @echo " PYEXECDIR = $(PYEXECDIR) " @echo " PKGPYEXECDIR = $(PKGPYEXECDIR) " @echo "" @echo "Set by AX_PYTHON:" @echo " PYTHON_BIN = $(PYTHON_BIN), @PYTHON_BIN@ " @echo " PYTHON_INCLUDE_DIR = $(PYTHON_INCLUDE_DIR) " @echo " PYTHON_LIB = $(PYTHON_LIB) " @echo "" @echo "Set by AX_PYTHON_DEVEL:" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS), @PYTHON_CPPFLAGS@ " @echo " PYTHON_LIBS = $(PYTHON_LIBS) " @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS) " @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) " @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo "" @echo "Set by AX_SWIG_PYTHON:" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS), @AX_SWIG_PYTHON_CPPFLAGS@" @echo " AX_SWIG_PYTHON_OPT = $(AS_SWIG_PYTHON_OPT)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo "" @echo "Set by AX_PKG_SWIG:" @echo " SWIG = $(SWIG), @SWIG@" @echo " SWIG_LIB = $(SWIG_LIB)" @echo "" @echo "Set by PKG_CHECK_MODULES:" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS), @PYTHON_CFLAGS@)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " GLIB_CFLAGS = $(GLIB_CFLAGS) " @echo " GLIB_LIBS = $(GLIB_LIBS)" @echo " UDEV_CFLAGS = $(UDEV_CFLAGS)" @echo " UDEV_LIBS = $(UDEV_LIBS)" @echo " SYSTEMD_CFLAGS = $(SYSTEMD_CFLAGS)" @echo " SYSTEMD_LIBS = $(SYSTEMD_LIBS)" @echo " LIBUSB_CFLAGS = $(LIBUSB_CFLAGS)" @echo " LIBUSB_LIBS = $(LIBUSB_LIBS)" @echo " GOBJECT_CFLAGS = $(GOBJECT_CFLAGS)" @echo " GOBJECT_LIBS = $(GOBJECT_LIBS)" @echo "" @echo "Addtional:" @echo " prefix = $(prefix)" @echo " exec_prefix = $(exec_prefix)" @echo " libdir = $(libdir)" @echo " libexecdir = $(libexecdir)" @echo " top_srcdir = $(top_srcdir)" @echo " srcdir = $(srcdir)" @echo " pythondir = $(pythondir)" @echo " pyexecdir = $(pyexecdir)" .PHONY: clang show install-data-local: @echo "(install-data-local):" @echo " docdir = $(docdir)" # rpmarch=`$(RPM) --showrc | grep "^build arc" | \ # sed 's/\(.*: \)\(.*\)/\2/'`; \ # echo "$$rpmarch" ;\ #test -z "obs/$$rpmarch" || \ # ( mv obs/$$rpmarch/* . && rm -rf /obs/$$rpmarch ) #rm -rf obs/$(distdir) ddcutil-0.8.6/configure0000755000175000001440000237200613230166410012007 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for ddcutil 0.8.6. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -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: rockowitz@minsoft.com 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='ddcutil' PACKAGE_TARNAME='ddcutil' PACKAGE_VERSION='0.8.6' PACKAGE_STRING='ddcutil 0.8.6' PACKAGE_BUGREPORT='rockowitz@minsoft.com' PACKAGE_URL='' ac_unique_file="src/util/coredefs.h" # 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 REQUIRED_PACKAGES ENABLE_CFFI_FALSE ENABLE_CFFI_TRUE ENABLE_CYTHON_FALSE ENABLE_CYTHON_TRUE HAVE_PYTHON3_FALSE HAVE_PYTHON3_TRUE ENABLE_PYTHON_SWIG_FALSE ENABLE_PYTHON_SWIG_TRUE py2execdir PY3_EXECDIR PY2_EXECDIR PYEXECDIR ENABLE_PY3_FALSE ENABLE_PY3_TRUE ENABLE_PY2_FALSE ENABLE_PY2_TRUE SWIG_LIB SWIG PY2_LIBS PY2_CFLAGS pkgpyexecdir pyexecdir pkgpythondir pythondir PYTHON_PLATFORM PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON PY3_EXTRA_LIBS PY3_EXTRA_LDFLAGS PY2_EXTRA_LIBS PY2_EXTRA_LDFLAGS PY3_LIBS PY3_CFLAGS pkgpy3execdir py3execdir pkgpython3dir python3dir PYTHON3_PLATFORM PYTHON3_EXEC_PREFIX PYTHON3_PREFIX PYTHON3_VERSION PYTHON3 ZLIB_LIBS ZLIB_CFLAGS GOBJECT_LIBS GOBJECT_CFLAGS HAVE_INTROSPECTION_FALSE HAVE_INTROSPECTION_TRUE INTROSPECTION_MAKEFILE INTROSPECTION_LIBS INTROSPECTION_CFLAGS INTROSPECTION_TYPELIBDIR INTROSPECTION_GIRDIR INTROSPECTION_GENERATE INTROSPECTION_COMPILER INTROSPECTION_SCANNER HAVE_DOCBASE_FALSE HAVE_DOCBASE_TRUE DOCBASE_INSTALL_DOCS USE_DOXYGEN_FALSE USE_DOXYGEN_TRUE DX_RULES PAPER_SIZE DOXYGEN_PAPER_SIZE GENERATE_LATEX DX_PDFLATEX DX_FLAG_pdf DX_EGREP DX_DVIPS DX_MAKEINDEX DX_LATEX DX_FLAG_ps DX_FLAG_html GENERATE_CHI DX_FLAG_chi GENERATE_HTMLHELP GENERATE_HTML HHC_PATH DX_HHC DX_FLAG_chm GENERATE_XML DX_FLAG_xml GENERATE_RTF DX_FLAG_rtf GENERATE_MAN DX_FLAG_man DOT_PATH HAVE_DOT DX_DOT DX_FLAG_dot PERL_PATH DX_PERL DX_DOXYGEN DX_FLAG_doc PROJECT SRCDIR DX_ENV DX_DOCDIR DX_CONFIG DX_PROJECT DOXYGEN XRANDR_LIBS XRANDR_CFLAGS USE_X11_COND_FALSE USE_X11_COND_TRUE LIBX11_LIBS LIBX11_CFLAGS USE_LIBDRM_COND_FALSE USE_LIBDRM_COND_TRUE LIBDRM_LIBS LIBDRM_CFLAGS LIBUSB_LIBS LIBUSB_CFLAGS UDEV_LIBS UDEV_CFLAGS GLIB_LIBS GLIB_CFLAGS LIBOBJS USE_API_COND_FALSE USE_API_COND_TRUE ENABLE_FORCE_SUSE_COND_FALSE ENABLE_FORCE_SUSE_COND_TRUE ENABLE_FAILSIM_COND_FALSE ENABLE_FAILSIM_COND_TRUE ENABLE_GOBJECT_COND_FALSE ENABLE_GOBJECT_COND_TRUE ENABLE_CALLGRAPH_COND_FALSE ENABLE_CALLGRAPH_COND_TRUE INCLUDE_TESTCASES_COND_FALSE INCLUDE_TESTCASES_COND_TRUE ENABLE_DOXYGEN_COND_FALSE ENABLE_DOXYGEN_COND_TRUE ENABLE_USB_FLAG ENABLE_USB_COND_FALSE ENABLE_USB_COND_TRUE ENABLE_CFFO_COND_FALSE ENABLE_CFFO_COND_TRUE ENABLE_CYTHON_COND_FALSE ENABLE_CYTHON_COND_TRUE ENABLE_SWIG_COND_FALSE ENABLE_SWIG_COND_TRUE ENABLE_SHARED_LIB_FLAG ENABLE_SHARED_LIB_COND_FALSE ENABLE_SHARED_LIB_COND_TRUE ADL_HEADER_DIR HAVE_ADL_COND_FALSE HAVE_ADL_COND_TRUE DEBIAN_DISTRIBUTION DEBIAN_RELEASE LT_AGE LT_REVISION LT_CURRENT LIBTOOL_DEPS CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB 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 PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC ac_ct_AR AR AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM DBG target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_static enable_shared with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_adl_headers enable_lib enable_swig enable_cython enable_cffi enable_usb enable_drm enable_x11 enable_doxygen enable_testcases enable_callgraph enable_gobject_api enable_failsim enable_force_suse enable_use_api enable_doxygen_doc enable_doxygen_dot enable_doxygen_man enable_doxygen_rtf enable_doxygen_xml enable_doxygen_chm enable_doxygen_chi enable_doxygen_html enable_doxygen_ps enable_doxygen_pdf enable_introspection ' ac_precious_vars='build_alias host_alias target_alias DBG CC CFLAGS LDFLAGS LIBS CPPFLAGS PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR LT_SYS_LIBRARY_PATH CPP GLIB_CFLAGS GLIB_LIBS UDEV_CFLAGS UDEV_LIBS LIBUSB_CFLAGS LIBUSB_LIBS LIBDRM_CFLAGS LIBDRM_LIBS LIBX11_CFLAGS LIBX11_LIBS XRANDR_CFLAGS XRANDR_LIBS DOXYGEN DOXYGEN_PAPER_SIZE GOBJECT_CFLAGS GOBJECT_LIBS ZLIB_CFLAGS ZLIB_LIBS PYTHON3 PY3_CFLAGS PY3_LIBS PY2_EXTRA_LDFLAGS PY2_EXTRA_LIBS PY3_EXTRA_LDFLAGS PY3_EXTRA_LIBS PYTHON PY2_CFLAGS PY2_LIBS PY2_EXECDIR PY3_EXECDIR' # 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 ddcutil 0.8.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --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/ddcutil] --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 ddcutil 0.8.6:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-lib=[yes/no] Build shared library and clients[default=yes] --enable-swig=[no/yes] Build SWIG interface[default=no] --enable-cython=[no/yes] Build cython interface[default=no] --enable-cffi=[no/yes] Build cffi interface[default=no] --enable-usb=[yes/no] Support USB connected displays[default=yes] --enable-drm=[yes/no] Use DRM in diagnostics[default=yes] --enable-x11=[yes/no] Use X11 in diagnostics[default=yes] --enable-doxygen=[no/yes] Build API documentation using Doxygen (if it is installed)[default=no] --enable-testcases=[no/yes] Include test cases [default=no] --enable-callgraph=[no/yes] Create .expand files for static call graph[default=no] --enable-gobject-api=[no/yes] Build gobject related files, typelib[default=no] --enable-failsim=[no/yes] Build with failure simulation[default=no] --enable-force-suse=[no/yes] Force SUSE target directories[default=no] --enable-internal-api-use=[no/yes] Use ddcutil API internally[default=no] --disable-doxygen-doc don't generate any doxygen documentation --enable-doxygen-dot generate graphics for doxygen documentation --enable-doxygen-man generate doxygen manual pages --enable-doxygen-rtf generate doxygen RTF documentation --enable-doxygen-xml generate doxygen XML documentation --enable-doxygen-chm generate doxygen compressed HTML help documentation --enable-doxygen-chi generate doxygen seperate compressed HTML help index file --disable-doxygen-html don't generate doxygen plain HTML documentation --disable-doxygen-ps don't generate doxygen PostScript documentation --disable-doxygen-pdf don't generate doxygen PDF documentation --enable-introspection=[no/auto/yes] Enable introspection for this build 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-adl-headers=DIR Directory containing ADL header files Some influential environment variables: DBG Turn on script debugging messages(0/1) 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 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 LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config GLIB_LIBS linker flags for GLIB, overriding pkg-config UDEV_CFLAGS C compiler flags for UDEV, overriding pkg-config UDEV_LIBS linker flags for UDEV, overriding pkg-config LIBUSB_CFLAGS C compiler flags for LIBUSB, overriding pkg-config LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config LIBDRM_CFLAGS C compiler flags for LIBDRM, overriding pkg-config LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config LIBX11_CFLAGS C compiler flags for LIBX11, overriding pkg-config LIBX11_LIBS linker flags for LIBX11, overriding pkg-config XRANDR_CFLAGS C compiler flags for XRANDR, overriding pkg-config XRANDR_LIBS linker flags for XRANDR, overriding pkg-config DOXYGEN Doxygen source doc generation program DOXYGEN_PAPER_SIZE a4wide (default), a4, letter, legal or executive GOBJECT_CFLAGS C compiler flags for GOBJECT, overriding pkg-config GOBJECT_LIBS linker flags for GOBJECT, overriding pkg-config ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config ZLIB_LIBS linker flags for ZLIB, overriding pkg-config PYTHON3 the Python 3 interpreter PY3_CFLAGS C compiler flags for PY3, overriding pkg-config PY3_LIBS linker flags for PY3, overriding pkg-config PY2_EXTRA_LDFLAGS override additional Python 2 linker flags from disutils.sysconfig() PY2_EXTRA_LIBS override additional Python 2 libraries from disutils.sysconfig() PY3_EXTRA_LDFLAGS override additional Python 3 linker flags from distutils.sysconfig() PY3_EXTRA_LIBS override additional Python 3 libraries from distutils.sysconfig() PYTHON the Python interpreter PY2_CFLAGS C compiler flags for PY2, overriding pkg-config PY2_LIBS linker flags for PY2, overriding pkg-config PY2_EXECDIR Python 2 C extension directory PY3_EXECDIR Python 3 C extension directory 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 ddcutil configure 0.8.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_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_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t # ac_fn_c_check_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 rockowitz@minsoft.com ## ## ------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by ddcutil $as_me 0.8.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: debug messages enabled" >&5 $as_echo "$as_me: debug messages enabled" >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: debug messages disabled" >&5 $as_echo "$as_me: debug messages disabled" >&6;} fi ac_aux_dir= for ac_dir in config "$srcdir"/config; 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 config \"$srcdir\"/config" "$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" # removed from list: package/debian/changelog ac_config_files="$ac_config_files Makefile src/Makefile src/util/Makefile src/usb_util/Makefile src/base/Makefile src/vcp/Makefile src/i2c/Makefile src/adl/Makefile src/usb/Makefile src/ddc/Makefile src/test/Makefile src/cmdline/Makefile src/app_sysenv/Makefile src/swig/Makefile src/cython/Makefile src/cffi/Makefile src/gobject_api/Makefile src/sample_clients/Makefile man/Makefile data/Makefile docs/Makefile docs/doxygen/Makefile ddcutil.pc" # AC_DEFINE_UNQUOTED([DDCUTIL_MAJOR_VERSION], [$ddcutil_major_version], [ddcutil major version]) am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='ddcutil' VERSION='0.8.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # 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='\' DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 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 if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" 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 lib "link -lib" 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} { $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 $as_echo_n "checking the archiver ($AR) interface... " >&6; } if ${am_cv_ar_interface+:} 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 am_cv_ar_interface=ar cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int some_variable = 0; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 $as_echo "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # 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__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) as_fn_error $? "could not determine $AR interface" "$LINENO" 5 ;; esac 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 required_packages= 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 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 case $ac_cv_prog_cc_stdc in #( no) : ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" 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_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { $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 : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } if ${ac_cv_prog_cc_stdc+:} false; then : $as_echo_n "(cached) " >&6 fi case $ac_cv_prog_cc_stdc in #( no) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; #( '') : { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac 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-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=no fi enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # 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: ### ### Version specification ### # libtool versioning - applies to libddcutil # # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details # # increment; # CURRENT If the API or ABI interface has changed (reset REVISION to 0) # REVISION If the API and ABI remains the same, but bugs are fixed. # AGE backward compatibility (i.e. number of releases prior to current # for which this release is backward compatible) # # Alternative comments: # # Here are a set of rules to help you update your library version # information: # # 1. Start with version information of `0:0:0' for each libtool library. # 2. Update the version information only immediately before a public # release of your software. More frequent updates are unnecessary, and # only guarantee that the current interface number gets larger faster. # 3. If the library source code has changed at all since the last update, # then increment revision (`c:r:a' becomes `c:r+1:a'). # 4. If any interfaces have been added, removed, or changed since the last # update, increment current, and set revision to 0. # 5. If any interfaces have been added since the last public release, then # increment age. # 6. If any interfaces have been removed since the last public release, # then set age to 0. # # The LT_... values are used to create the argument for the --version-info parm. # Note that this parm is processed differently depending on operating system. # For Linux, the second and third fields in the shared object name's suffix are # taken directly from the command line, while the first is calculated as current-age. # For example, if LT_CURRENT=13, LT_REVISION=4, LT_AGE=4, the geneated parm # is --version-info "13:1:4", and the generated SO name looks like xxx.so.9.4.1 LT_CURRENT=0 LT_REVISION=0 LT_AGE=0 DEBIAN_RELEASE=1 DEBIAN_DISTRIBUTION=xenial ### ### Recognize command options for configure script ### ### Documented options { $as_echo "$as_me:${as_lineno-$LINENO}: Checking configure command options... " >&5 $as_echo "$as_me: Checking configure command options... " >&6;} # Check whether --with-adl-headers was given. if test "${with_adl_headers+set}" = set; then : withval=$with_adl_headers; adl_header_dir=$withval else adl_header_dir= fi { $as_echo "$as_me:${as_lineno-$LINENO}: adl_header_dir = $adl_header_dir" >&5 $as_echo "$as_me: adl_header_dir = $adl_header_dir" >&6;} if test -n "$adl_header_dir"; then : $as_echo "#define HAVE_ADL 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: adl... enabled " >&5 $as_echo "$as_me: adl... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: adl... disabled " >&5 $as_echo "$as_me: adl... disabled " >&6;} fi if test -n "$adl_header_dir" ; then HAVE_ADL_COND_TRUE= HAVE_ADL_COND_FALSE='#' else HAVE_ADL_COND_TRUE='#' HAVE_ADL_COND_FALSE= fi ADL_HEADER_DIR=$adl_header_dir # Check whether --enable-lib was given. if test "${enable_lib+set}" = set; then : enableval=$enable_lib; enable_lib=${enableval} else enable_lib=yes fi if test "x$enable_lib" == "xyes" ; then ENABLE_SHARED_LIB_COND_TRUE= ENABLE_SHARED_LIB_COND_FALSE='#' else ENABLE_SHARED_LIB_COND_TRUE='#' ENABLE_SHARED_LIB_COND_FALSE= fi if test "x$enable_lib" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: lib... enabled " >&5 $as_echo "$as_me: lib... enabled " >&6;} ENABLE_SHARED_LIB_FLAG=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: lib... disabled " >&5 $as_echo "$as_me: lib... disabled " >&6;} ENABLE_SHARED_LIB_FLAG=0 fi # Check whether --enable-swig was given. if test "${enable_swig+set}" = set; then : enableval=$enable_swig; enable_swig=${enableval} else enable_swig=no fi if test "x$enable_swig" == "xyes" ; then ENABLE_SWIG_COND_TRUE= ENABLE_SWIG_COND_FALSE='#' else ENABLE_SWIG_COND_TRUE='#' ENABLE_SWIG_COND_FALSE= fi if test "x$enable_swig" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: swig... enabled " >&5 $as_echo "$as_me: swig... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: swig... disabled " >&5 $as_echo "$as_me: swig... disabled " >&6;} fi # Check whether --enable-cython was given. if test "${enable_cython+set}" = set; then : enableval=$enable_cython; enable_cython=${enableval} else enable_cython=no fi if test "x$enable_cython" == "xyes" ; then ENABLE_CYTHON_COND_TRUE= ENABLE_CYTHON_COND_FALSE='#' else ENABLE_CYTHON_COND_TRUE='#' ENABLE_CYTHON_COND_FALSE= fi if test "x$enable_cython" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: cython... enabled " >&5 $as_echo "$as_me: cython... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: cython... disabled " >&5 $as_echo "$as_me: cython... disabled " >&6;} fi # Check whether --enable-cffi was given. if test "${enable_cffi+set}" = set; then : enableval=$enable_cffi; enable_cffi=${enableval} else enable_cffi=no fi if test "x$enable_cffi" == "xyes" ; then ENABLE_CFFO_COND_TRUE= ENABLE_CFFO_COND_FALSE='#' else ENABLE_CFFO_COND_TRUE='#' ENABLE_CFFO_COND_FALSE= fi if test "x$enable_cffi" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: cffi... enabled " >&5 $as_echo "$as_me: cffi... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: cffi... disabled " >&5 $as_echo "$as_me: cffi... disabled " >&6;} fi # Check whether --enable-usb was given. if test "${enable_usb+set}" = set; then : enableval=$enable_usb; enable_usb=${enableval} else enable_usb=yes fi if test "x$enable_usb" == "xyes" ; then ENABLE_USB_COND_TRUE= ENABLE_USB_COND_FALSE='#' else ENABLE_USB_COND_TRUE='#' ENABLE_USB_COND_FALSE= fi if test "x$enable_usb" == "xyes"; then : $as_echo "#define USE_USB 1" >>confdefs.h ENABLE_USB_FLAG=1 { $as_echo "$as_me:${as_lineno-$LINENO}: usb... enabled " >&5 $as_echo "$as_me: usb... enabled " >&6;} else ENABLE_USB_FLAG=0 { $as_echo "$as_me:${as_lineno-$LINENO}: usb... disabled " >&5 $as_echo "$as_me: usb... disabled " >&6;} fi # Check whether --enable-drm was given. if test "${enable_drm+set}" = set; then : enableval=$enable_drm; enable_drm=${enableval} else enable_drm=yes fi if test "x$enable_drm" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: drm... enabled (provisional) " >&5 $as_echo "$as_me: drm... enabled (provisional) " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: drm... disabled " >&5 $as_echo "$as_me: drm... disabled " >&6;} fi # Check whether --enable-x11 was given. if test "${enable_x11+set}" = set; then : enableval=$enable_x11; enable_x11=${enableval} else enable_x11=yes fi if test "x$enable_x11" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: x11... enabled " >&5 $as_echo "$as_me: x11... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: x11... disabled " >&5 $as_echo "$as_me: x11... disabled " >&6;} fi # Check whether --enable-doxygen was given. if test "${enable_doxygen+set}" = set; then : enableval=$enable_doxygen; enable_doxygen=${enableval} else enable_doxygen=no fi if test "x$enable_doxygen" == "xyes" ; then ENABLE_DOXYGEN_COND_TRUE= ENABLE_DOXYGEN_COND_FALSE='#' else ENABLE_DOXYGEN_COND_TRUE='#' ENABLE_DOXYGEN_COND_FALSE= fi if test "x$enable_doxygen" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: doxygen... enabled " >&5 $as_echo "$as_me: doxygen... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: doxygen... disabled " >&5 $as_echo "$as_me: doxygen... disabled " >&6;} fi ### Private options # Check whether --enable-testcases was given. if test "${enable_testcases+set}" = set; then : enableval=$enable_testcases; include_testcases=${enableval} else include_testcases=no fi if test "x$include_testcases" == "xyes" ; then INCLUDE_TESTCASES_COND_TRUE= INCLUDE_TESTCASES_COND_FALSE='#' else INCLUDE_TESTCASES_COND_TRUE='#' INCLUDE_TESTCASES_COND_FALSE= fi if test "x$include_testcases" == "xyes"; then : $as_echo "#define INCLUDE_TESTCASES 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: testcases... enabled " >&5 $as_echo "$as_me: testcases... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: testcases... disabled " >&5 $as_echo "$as_me: testcases... disabled " >&6;} fi # Check whether --enable-callgraph was given. if test "${enable_callgraph+set}" = set; then : enableval=$enable_callgraph; enable_callgraph=${enableval} else enable_callgraph=no fi if test "x$enable_callgraph" == "xyes" ; then ENABLE_CALLGRAPH_COND_TRUE= ENABLE_CALLGRAPH_COND_FALSE='#' else ENABLE_CALLGRAPH_COND_TRUE='#' ENABLE_CALLGRAPH_COND_FALSE= fi if test "x$enable_callgraph" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: callgraph... enabled " >&5 $as_echo "$as_me: callgraph... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: callgraph... disabled " >&5 $as_echo "$as_me: callgraph... disabled " >&6;} fi # Check whether --enable-gobject-api was given. if test "${enable_gobject_api+set}" = set; then : enableval=$enable_gobject_api; enable_gobject=${enableval} else enable_gobject=no fi if test "x$enable_gobject" == "xyes" ; then ENABLE_GOBJECT_COND_TRUE= ENABLE_GOBJECT_COND_FALSE='#' else ENABLE_GOBJECT_COND_TRUE='#' ENABLE_GOBJECT_COND_FALSE= fi if test "x$enable_gobject" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: gobject-api... enabled " >&5 $as_echo "$as_me: gobject-api... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: gobject-api... disabled " >&5 $as_echo "$as_me: gobject-api... disabled " >&6;} fi # Check whether --enable-failsim was given. if test "${enable_failsim+set}" = set; then : enableval=$enable_failsim; enable_failsim=${enableval} else enable_failsim=no fi if test "x$enable_failsim" == "xyes" ; then ENABLE_FAILSIM_COND_TRUE= ENABLE_FAILSIM_COND_FALSE='#' else ENABLE_FAILSIM_COND_TRUE='#' ENABLE_FAILSIM_COND_FALSE= fi if test "x$enable_failsim" == "xyes"; then : $as_echo "#define ENABLE_FAILSIM 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: failsim..... enabled " >&5 $as_echo "$as_me: failsim..... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: failsim..... disabled " >&5 $as_echo "$as_me: failsim..... disabled " >&6;} fi # Check whether --enable-force-suse was given. if test "${enable_force_suse+set}" = set; then : enableval=$enable_force_suse; enable_force_suse=${enableval} else enable_force_suse=no fi if test "x$enable_force_suse" == "xyes" ; then ENABLE_FORCE_SUSE_COND_TRUE= ENABLE_FORCE_SUSE_COND_FALSE='#' else ENABLE_FORCE_SUSE_COND_TRUE='#' ENABLE_FORCE_SUSE_COND_FALSE= fi if test "x$enable_force_suse" == "xyes"; then : $as_echo "#define ENABLE_FORCE_SUSE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: force-suse..... enabled " >&5 $as_echo "$as_me: force-suse..... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: force-suse..... disabled " >&5 $as_echo "$as_me: force-suse..... disabled " >&6;} fi # Check whether --enable-use-api was given. if test "${enable_use_api+set}" = set; then : enableval=$enable_use_api; enable_use_api=${enableval} else enable_use_api=no fi if test "x$enable_use_api" == "xyes" ; then USE_API_COND_TRUE= USE_API_COND_FALSE='#' else USE_API_COND_TRUE='#' USE_API_COND_FALSE= fi if test "x$enable_use_api" == "xyes"; then : $as_echo "#define USE_API 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: use-api..... enabled " >&5 $as_echo "$as_me: use-api..... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: use-api..... disabled " >&5 $as_echo "$as_me: use-api..... disabled " >&6;} fi ### ### Checks for typedefs, structures, and compiler characteristics. ### { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) $as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac ### ### Checks for standard 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 ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi for ac_func in clock_gettime memset nl_langinfo stpcpy strchr strdup strerror strrchr strtol 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 { $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 dld; 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" else as_fn_error $? "unable to find the dlopen() function" "$LINENO" 5 fi ### ### Checks for header files. ### for ac_header in fcntl.h langinfo.h libintl.h limits.h stdint.h stdlib.h string.h sys/ioctl.h termios.h unistd.h wchar.h dlfcn.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 ### ### Required library tests ### pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 $as_echo_n "checking for GLIB... " >&6; } if test -n "$GLIB_CFLAGS"; then pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.32\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.32") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.32" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GLIB_LIBS"; then pkg_cv_GLIB_LIBS="$GLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= 2.32\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.32") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.32" 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 GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.32" 2>&1` else GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.32" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GLIB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (glib-2.0 >= 2.32) were not met: $GLIB_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 GLIB_CFLAGS and GLIB_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 GLIB_CFLAGS and GLIB_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 GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS GLIB_LIBS=$pkg_cv_GLIB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi required_packages="$required_packages glib-2.0 >= 2.32" pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 $as_echo_n "checking for UDEV... " >&6; } if test -n "$UDEV_CFLAGS"; then pkg_cv_UDEV_CFLAGS="$UDEV_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev\""; } >&5 ($PKG_CONFIG --exists --print-errors "libudev") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$UDEV_LIBS"; then pkg_cv_UDEV_LIBS="$UDEV_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev\""; } >&5 ($PKG_CONFIG --exists --print-errors "libudev") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev" 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 UDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libudev" 2>&1` else UDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libudev" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$UDEV_PKG_ERRORS" >&5 libudev_found=0 { $as_echo "$as_me:${as_lineno-$LINENO}: The package providing libudev.h varies by Linux distribution and release. " >&5 $as_echo "$as_me: The package providing libudev.h varies by Linux distribution and release. " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: It may be a udev specific package, e.g. libudev-dev, libudev-devel " >&5 $as_echo "$as_me: It may be a udev specific package, e.g. libudev-dev, libudev-devel " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: or it may be part of systemd, e.g systemd-devel " >&5 $as_echo "$as_me: or it may be part of systemd, e.g systemd-devel " >&6;} as_fn_error $? "libudev not found " "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } libudev_found=0 { $as_echo "$as_me:${as_lineno-$LINENO}: The package providing libudev.h varies by Linux distribution and release. " >&5 $as_echo "$as_me: The package providing libudev.h varies by Linux distribution and release. " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: It may be a udev specific package, e.g. libudev-dev, libudev-devel " >&5 $as_echo "$as_me: It may be a udev specific package, e.g. libudev-dev, libudev-devel " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: or it may be part of systemd, e.g systemd-devel " >&5 $as_echo "$as_me: or it may be part of systemd, e.g systemd-devel " >&6;} as_fn_error $? "libudev not found " "$LINENO" 5 else UDEV_CFLAGS=$pkg_cv_UDEV_CFLAGS UDEV_LIBS=$pkg_cv_UDEV_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } libudev_found=1 fi required_packages="$required_packages xrandr x11" ### ### Optional library tests ### ### libusb if test "x$enable_usb" == "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5 $as_echo_n "checking for LIBUSB... " >&6; } if test -n "$LIBUSB_CFLAGS"; then pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.15\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.15") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0 >= 1.0.15" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBUSB_LIBS"; then pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb-1.0 >= 1.0.15\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.15") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb-1.0 >= 1.0.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 LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libusb-1.0 >= 1.0.15" 2>&1` else LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb-1.0 >= 1.0.15" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUSB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libusb-1.0 >= 1.0.15) were not met: $LIBUSB_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 LIBUSB_CFLAGS and LIBUSB_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 LIBUSB_CFLAGS and LIBUSB_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 LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } libusb_found=yes fi else { $as_echo "$as_me:${as_lineno-$LINENO}: usb disabled, not checking for libusb " >&5 $as_echo "$as_me: usb disabled, not checking for libusb " >&6;} fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: LIBUSB_CFLAGS: $LIBUSB_CFLAGS " >&5 $as_echo "$as_me: LIBUSB_CFLAGS: $LIBUSB_CFLAGS " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: LIBUSB_LIBS: $LIBUSB_LIBS " >&5 $as_echo "$as_me: LIBUSB_LIBS: $LIBUSB_LIBS " >&6;} fi ### libdrm if test "x$enable_drm" == "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM" >&5 $as_echo_n "checking for LIBDRM... " >&6; } if test -n "$LIBDRM_CFLAGS"; then pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 2.4.67\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdrm >= 2.4.67") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= 2.4.67" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBDRM_LIBS"; then pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= 2.4.67\""; } >&5 ($PKG_CONFIG --exists --print-errors "libdrm >= 2.4.67") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= 2.4.67" 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 LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdrm >= 2.4.67" 2>&1` else LIBDRM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdrm >= 2.4.67" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBDRM_PKG_ERRORS" >&5 libdrm_found=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdrm >= 2.4.67 not found. Forcing --disable-drm" >&5 $as_echo "$as_me: WARNING: libdrm >= 2.4.67 not found. Forcing --disable-drm" >&2;} enable_drm=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } libdrm_found=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdrm >= 2.4.67 not found. Forcing --disable-drm" >&5 $as_echo "$as_me: WARNING: libdrm >= 2.4.67 not found. Forcing --disable-drm" >&2;} enable_drm=no else LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } libdrm_found=yes fi else { $as_echo "$as_me:${as_lineno-$LINENO}: drm disabled, not checking for libdrm " >&5 $as_echo "$as_me: drm disabled, not checking for libdrm " >&6;} fi if test "x$enable_drm" == "xyes" ; then USE_LIBDRM_COND_TRUE= USE_LIBDRM_COND_FALSE='#' else USE_LIBDRM_COND_TRUE='#' USE_LIBDRM_COND_FALSE= fi if test "x$enable_drm" == "xyes"; then : $as_echo "#define USE_LIBDRM 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: drm... enabled " >&5 $as_echo "$as_me: drm... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: drm... disabled " >&5 $as_echo "$as_me: drm... disabled " >&6;} fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: LIBDRM_CFLAGS: $LIBDRM_CFLAGS " >&5 $as_echo "$as_me: LIBDRM_CFLAGS: $LIBDRM_CFLAGS " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: LIBDRM_LIBS: $LIBDRM_LIBS " >&5 $as_echo "$as_me: LIBDRM_LIBS: $LIBDRM_LIBS " >&6;} fi ### X11 if test "x$enable_x11" == "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBX11" >&5 $as_echo_n "checking for LIBX11... " >&6; } if test -n "$LIBX11_CFLAGS"; then pkg_cv_LIBX11_CFLAGS="$LIBX11_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 ($PKG_CONFIG --exists --print-errors "x11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBX11_CFLAGS=`$PKG_CONFIG --cflags "x11" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBX11_LIBS"; then pkg_cv_LIBX11_LIBS="$LIBX11_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 ($PKG_CONFIG --exists --print-errors "x11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBX11_LIBS=`$PKG_CONFIG --libs "x11" 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 LIBX11_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11" 2>&1` else LIBX11_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBX11_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (x11) were not met: $LIBX11_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 LIBX11_CFLAGS and LIBX11_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 LIBX11_CFLAGS and LIBX11_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 LIBX11_CFLAGS=$pkg_cv_LIBX11_CFLAGS LIBX11_LIBS=$pkg_cv_LIBX11_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi if test "x$enable_x11" == "xyes" ; then USE_X11_COND_TRUE= USE_X11_COND_FALSE='#' else USE_X11_COND_TRUE='#' USE_X11_COND_FALSE= fi if test "x$enable_x11" == "xyes"; then : $as_echo "#define USE_X11 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: x11... enabled " >&5 $as_echo "$as_me: x11... enabled " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: x11... disabled " >&5 $as_echo "$as_me: x11... disabled " >&6;} fi if test "x$enable_x11" == "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRANDR" >&5 $as_echo_n "checking for XRANDR... " >&6; } if test -n "$XRANDR_CFLAGS"; then pkg_cv_XRANDR_CFLAGS="$XRANDR_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xrandr\""; } >&5 ($PKG_CONFIG --exists --print-errors "xrandr") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XRANDR_CFLAGS=`$PKG_CONFIG --cflags "xrandr" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$XRANDR_LIBS"; then pkg_cv_XRANDR_LIBS="$XRANDR_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xrandr\""; } >&5 ($PKG_CONFIG --exists --print-errors "xrandr") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XRANDR_LIBS=`$PKG_CONFIG --libs "xrandr" 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 XRANDR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xrandr" 2>&1` else XRANDR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xrandr" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$XRANDR_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (xrandr) were not met: $XRANDR_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 XRANDR_CFLAGS and XRANDR_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 XRANDR_CFLAGS and XRANDR_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 XRANDR_CFLAGS=$pkg_cv_XRANDR_CFLAGS XRANDR_LIBS=$pkg_cv_XRANDR_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: LIBX11_CFLAGS: $LIBX11_CFLAGS " >&5 $as_echo "$as_me: LIBX11_CFLAGS: $LIBX11_CFLAGS " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: LIBX11_LIBS: $LIBX11_LIBS " >&5 $as_echo "$as_me: LIBX11_LIBS: $LIBX11_LIBS " >&6;} fi ### DOXYGEN if test "x$enable_doxygen" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Checking for Doxygen..." >&5 $as_echo "$as_me: Checking for Doxygen..." >&6;} for ac_prog in doxygen 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_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DOXYGEN"; then ac_cv_prog_DOXYGEN="$DOXYGEN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DOXYGEN="$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 DOXYGEN=$ac_cv_prog_DOXYGEN if test -n "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 $as_echo "$DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DOXYGEN" && break done if test -z "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found - continuing without Doxygen support" >&5 $as_echo "$as_me: WARNING: doxygen not found - continuing without Doxygen support" >&2;} fi if test -n $DOXYGEN; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Calling dx_init_doxygen..." >&5 $as_echo "$as_me: Calling dx_init_doxygen..." >&6;} # Files: DX_PROJECT=ddcutil DX_CONFIG='$(srcdir)/Doxyfile' DX_DOCDIR='doxygen-doc' # Environment variables used inside doxygen.cfg: DX_ENV="$DX_ENV SRCDIR='$srcdir'" SRCDIR=$srcdir DX_ENV="$DX_ENV PROJECT='$DX_PROJECT'" PROJECT=$DX_PROJECT DX_ENV="$DX_ENV VERSION='$PACKAGE_VERSION'" # Doxygen itself: # Check whether --enable-doxygen-doc was given. if test "${enable_doxygen_doc+set}" = set; then : enableval=$enable_doxygen_doc; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_doc=1 ;; #( n|N|no|No|NO) DX_FLAG_doc=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-doc" "$LINENO" 5 ;; esac else DX_FLAG_doc=1 fi if test "$DX_FLAG_doc" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}doxygen", so it can be a program name with args. set dummy ${ac_tool_prefix}doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_DX_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_DX_DOXYGEN="$DX_DOXYGEN" # 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_DX_DOXYGEN="$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 DX_DOXYGEN=$ac_cv_path_DX_DOXYGEN if test -n "$DX_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOXYGEN" >&5 $as_echo "$DX_DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_DOXYGEN"; then ac_pt_DX_DOXYGEN=$DX_DOXYGEN # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_DX_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_DOXYGEN in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_DOXYGEN="$ac_pt_DX_DOXYGEN" # 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_DX_DOXYGEN="$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_DX_DOXYGEN=$ac_cv_path_ac_pt_DX_DOXYGEN if test -n "$ac_pt_DX_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOXYGEN" >&5 $as_echo "$ac_pt_DX_DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_DOXYGEN" = x; then DX_DOXYGEN="" 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 DX_DOXYGEN=$ac_pt_DX_DOXYGEN fi else DX_DOXYGEN="$ac_cv_path_DX_DOXYGEN" fi if test "$DX_FLAG_doc$DX_DOXYGEN" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found - will not generate any doxygen documentation" >&5 $as_echo "$as_me: WARNING: doxygen not found - will not generate any doxygen documentation" >&2;} DX_FLAG_doc=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args. set dummy ${ac_tool_prefix}perl; 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_DX_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_PERL in [\\/]* | ?:[\\/]*) ac_cv_path_DX_PERL="$DX_PERL" # 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_DX_PERL="$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 DX_PERL=$ac_cv_path_DX_PERL if test -n "$DX_PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PERL" >&5 $as_echo "$DX_PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_PERL"; then ac_pt_DX_PERL=$DX_PERL # Extract the first word of "perl", so it can be a program name with args. set dummy perl; 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_DX_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_PERL in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_PERL="$ac_pt_DX_PERL" # 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_DX_PERL="$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_DX_PERL=$ac_cv_path_ac_pt_DX_PERL if test -n "$ac_pt_DX_PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PERL" >&5 $as_echo "$ac_pt_DX_PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_PERL" = x; then DX_PERL="" 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 DX_PERL=$ac_pt_DX_PERL fi else DX_PERL="$ac_cv_path_DX_PERL" fi if test "$DX_FLAG_doc$DX_PERL" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl not found - will not generate any doxygen documentation" >&5 $as_echo "$as_me: WARNING: perl not found - will not generate any doxygen documentation" >&2;} DX_FLAG_doc=0 fi : fi if test "$DX_FLAG_doc" = 1; then DX_ENV="$DX_ENV PERL_PATH='$DX_PERL'" PERL_PATH=$DX_PERL : else : fi # Dot for graphics: # Check whether --enable-doxygen-dot was given. if test "${enable_doxygen_dot+set}" = set; then : enableval=$enable_doxygen_dot; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_dot=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-dot requires doxygen-dot" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_dot=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-dot" "$LINENO" 5 ;; esac else DX_FLAG_dot=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_dot=0 fi if test "$DX_FLAG_dot" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dot", so it can be a program name with args. set dummy ${ac_tool_prefix}dot; 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_DX_DOT+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_DOT in [\\/]* | ?:[\\/]*) ac_cv_path_DX_DOT="$DX_DOT" # 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_DX_DOT="$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 DX_DOT=$ac_cv_path_DX_DOT if test -n "$DX_DOT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOT" >&5 $as_echo "$DX_DOT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_DOT"; then ac_pt_DX_DOT=$DX_DOT # Extract the first word of "dot", so it can be a program name with args. set dummy dot; 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_DX_DOT+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_DOT in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_DOT="$ac_pt_DX_DOT" # 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_DX_DOT="$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_DX_DOT=$ac_cv_path_ac_pt_DX_DOT if test -n "$ac_pt_DX_DOT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOT" >&5 $as_echo "$ac_pt_DX_DOT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_DOT" = x; then DX_DOT="" 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 DX_DOT=$ac_pt_DX_DOT fi else DX_DOT="$ac_cv_path_DX_DOT" fi if test "$DX_FLAG_dot$DX_DOT" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dot not found - will not generate graphics for doxygen documentation" >&5 $as_echo "$as_me: WARNING: dot not found - will not generate graphics for doxygen documentation" >&2;} DX_FLAG_dot=0 fi : fi if test "$DX_FLAG_dot" = 1; then DX_ENV="$DX_ENV HAVE_DOT='YES'" HAVE_DOT=YES DX_ENV="$DX_ENV DOT_PATH='`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'`'" DOT_PATH=`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'` : else DX_ENV="$DX_ENV HAVE_DOT='NO'" HAVE_DOT=NO : fi # Man pages generation: # Check whether --enable-doxygen-man was given. if test "${enable_doxygen_man+set}" = set; then : enableval=$enable_doxygen_man; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_man=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-man requires doxygen-man" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_man=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-man" "$LINENO" 5 ;; esac else DX_FLAG_man=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_man=0 fi if test "$DX_FLAG_man" = 1; then : fi if test "$DX_FLAG_man" = 1; then DX_ENV="$DX_ENV GENERATE_MAN='YES'" GENERATE_MAN=YES : else DX_ENV="$DX_ENV GENERATE_MAN='NO'" GENERATE_MAN=NO : fi # RTF file generation: # Check whether --enable-doxygen-rtf was given. if test "${enable_doxygen_rtf+set}" = set; then : enableval=$enable_doxygen_rtf; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_rtf=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-rtf requires doxygen-rtf" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_rtf=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-rtf" "$LINENO" 5 ;; esac else DX_FLAG_rtf=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_rtf=0 fi if test "$DX_FLAG_rtf" = 1; then : fi if test "$DX_FLAG_rtf" = 1; then DX_ENV="$DX_ENV GENERATE_RTF='YES'" GENERATE_RTF=YES : else DX_ENV="$DX_ENV GENERATE_RTF='NO'" GENERATE_RTF=NO : fi # XML file generation: # Check whether --enable-doxygen-xml was given. if test "${enable_doxygen_xml+set}" = set; then : enableval=$enable_doxygen_xml; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_xml=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-xml requires doxygen-xml" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_xml=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-xml" "$LINENO" 5 ;; esac else DX_FLAG_xml=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_xml=0 fi if test "$DX_FLAG_xml" = 1; then : fi if test "$DX_FLAG_xml" = 1; then DX_ENV="$DX_ENV GENERATE_XML='YES'" GENERATE_XML=YES : else DX_ENV="$DX_ENV GENERATE_XML='NO'" GENERATE_XML=NO : fi # (Compressed) HTML help generation: # Check whether --enable-doxygen-chm was given. if test "${enable_doxygen_chm+set}" = set; then : enableval=$enable_doxygen_chm; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_chm=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-chm requires doxygen-chm" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_chm=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-chm" "$LINENO" 5 ;; esac else DX_FLAG_chm=0 test "$DX_FLAG_doc" = "1" || DX_FLAG_chm=0 fi if test "$DX_FLAG_chm" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}hhc", so it can be a program name with args. set dummy ${ac_tool_prefix}hhc; 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_DX_HHC+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_HHC in [\\/]* | ?:[\\/]*) ac_cv_path_DX_HHC="$DX_HHC" # 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_DX_HHC="$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 DX_HHC=$ac_cv_path_DX_HHC if test -n "$DX_HHC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_HHC" >&5 $as_echo "$DX_HHC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_HHC"; then ac_pt_DX_HHC=$DX_HHC # Extract the first word of "hhc", so it can be a program name with args. set dummy hhc; 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_DX_HHC+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_HHC in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_HHC="$ac_pt_DX_HHC" # 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_DX_HHC="$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_DX_HHC=$ac_cv_path_ac_pt_DX_HHC if test -n "$ac_pt_DX_HHC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_HHC" >&5 $as_echo "$ac_pt_DX_HHC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_HHC" = x; then DX_HHC="" 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 DX_HHC=$ac_pt_DX_HHC fi else DX_HHC="$ac_cv_path_DX_HHC" fi if test "$DX_FLAG_chm$DX_HHC" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&5 $as_echo "$as_me: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&2;} DX_FLAG_chm=0 fi : fi if test "$DX_FLAG_chm" = 1; then DX_ENV="$DX_ENV HHC_PATH='$DX_HHC'" HHC_PATH=$DX_HHC DX_ENV="$DX_ENV GENERATE_HTML='YES'" GENERATE_HTML=YES DX_ENV="$DX_ENV GENERATE_HTMLHELP='YES'" GENERATE_HTMLHELP=YES : else DX_ENV="$DX_ENV GENERATE_HTMLHELP='NO'" GENERATE_HTMLHELP=NO : fi # Seperate CHI file generation. # Check whether --enable-doxygen-chi was given. if test "${enable_doxygen_chi+set}" = set; then : enableval=$enable_doxygen_chi; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_chi=1 test "$DX_FLAG_chm" = "1" \ || as_fn_error $? "doxygen-chi requires doxygen-chi" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_chi=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-chi" "$LINENO" 5 ;; esac else DX_FLAG_chi=0 test "$DX_FLAG_chm" = "1" || DX_FLAG_chi=0 fi if test "$DX_FLAG_chi" = 1; then : fi if test "$DX_FLAG_chi" = 1; then DX_ENV="$DX_ENV GENERATE_CHI='YES'" GENERATE_CHI=YES : else DX_ENV="$DX_ENV GENERATE_CHI='NO'" GENERATE_CHI=NO : fi # Plain HTML pages generation: # Check whether --enable-doxygen-html was given. if test "${enable_doxygen_html+set}" = set; then : enableval=$enable_doxygen_html; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_html=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-html requires doxygen-html" "$LINENO" 5 test "$DX_FLAG_chm" = "0" \ || as_fn_error $? "doxygen-html contradicts doxygen-html" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_html=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-html" "$LINENO" 5 ;; esac else DX_FLAG_html=1 test "$DX_FLAG_doc" = "1" || DX_FLAG_html=0 test "$DX_FLAG_chm" = "0" || DX_FLAG_html=0 fi if test "$DX_FLAG_html" = 1; then : fi if test "$DX_FLAG_html" = 1; then DX_ENV="$DX_ENV GENERATE_HTML='YES'" GENERATE_HTML=YES : else test "$DX_FLAG_chm" = 1 || DX_ENV="$DX_ENV GENERATE_HTML='NO'" GENERATE_HTML=NO : fi # PostScript file generation: # Check whether --enable-doxygen-ps was given. if test "${enable_doxygen_ps+set}" = set; then : enableval=$enable_doxygen_ps; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_ps=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-ps requires doxygen-ps" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_ps=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-ps" "$LINENO" 5 ;; esac else DX_FLAG_ps=1 test "$DX_FLAG_doc" = "1" || DX_FLAG_ps=0 fi if test "$DX_FLAG_ps" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}latex", so it can be a program name with args. set dummy ${ac_tool_prefix}latex; 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_DX_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_LATEX="$DX_LATEX" # 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_DX_LATEX="$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 DX_LATEX=$ac_cv_path_DX_LATEX if test -n "$DX_LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_LATEX" >&5 $as_echo "$DX_LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_LATEX"; then ac_pt_DX_LATEX=$DX_LATEX # Extract the first word of "latex", so it can be a program name with args. set dummy latex; 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_DX_LATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_LATEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_LATEX="$ac_pt_DX_LATEX" # 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_DX_LATEX="$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_DX_LATEX=$ac_cv_path_ac_pt_DX_LATEX if test -n "$ac_pt_DX_LATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_LATEX" >&5 $as_echo "$ac_pt_DX_LATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_LATEX" = x; then DX_LATEX="" 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 DX_LATEX=$ac_pt_DX_LATEX fi else DX_LATEX="$ac_cv_path_DX_LATEX" fi if test "$DX_FLAG_ps$DX_LATEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: latex not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: latex not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args. set dummy ${ac_tool_prefix}makeindex; 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_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # 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_DX_MAKEINDEX="$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 DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX if test -n "$DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5 $as_echo "$DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_MAKEINDEX"; then ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX # Extract the first word of "makeindex", so it can be a program name with args. set dummy makeindex; 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_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # 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_DX_MAKEINDEX="$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_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX if test -n "$ac_pt_DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5 $as_echo "$ac_pt_DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_MAKEINDEX" = x; then DX_MAKEINDEX="" 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 DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX fi else DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX" fi if test "$DX_FLAG_ps$DX_MAKEINDEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dvips", so it can be a program name with args. set dummy ${ac_tool_prefix}dvips; 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_DX_DVIPS+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_DVIPS in [\\/]* | ?:[\\/]*) ac_cv_path_DX_DVIPS="$DX_DVIPS" # 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_DX_DVIPS="$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 DX_DVIPS=$ac_cv_path_DX_DVIPS if test -n "$DX_DVIPS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DVIPS" >&5 $as_echo "$DX_DVIPS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_DVIPS"; then ac_pt_DX_DVIPS=$DX_DVIPS # Extract the first word of "dvips", so it can be a program name with args. set dummy dvips; 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_DX_DVIPS+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_DVIPS in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_DVIPS="$ac_pt_DX_DVIPS" # 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_DX_DVIPS="$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_DX_DVIPS=$ac_cv_path_ac_pt_DX_DVIPS if test -n "$ac_pt_DX_DVIPS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DVIPS" >&5 $as_echo "$ac_pt_DX_DVIPS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_DVIPS" = x; then DX_DVIPS="" 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 DX_DVIPS=$ac_pt_DX_DVIPS fi else DX_DVIPS="$ac_cv_path_DX_DVIPS" fi if test "$DX_FLAG_ps$DX_DVIPS" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args. set dummy ${ac_tool_prefix}egrep; 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_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_DX_EGREP="$DX_EGREP" # 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_DX_EGREP="$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 DX_EGREP=$ac_cv_path_DX_EGREP if test -n "$DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5 $as_echo "$DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_EGREP"; then ac_pt_DX_EGREP=$DX_EGREP # Extract the first word of "egrep", so it can be a program name with args. set dummy egrep; 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_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # 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_DX_EGREP="$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_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP if test -n "$ac_pt_DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5 $as_echo "$ac_pt_DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_EGREP" = x; then DX_EGREP="" 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 DX_EGREP=$ac_pt_DX_EGREP fi else DX_EGREP="$ac_cv_path_DX_EGREP" fi if test "$DX_FLAG_ps$DX_EGREP" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&5 $as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&2;} DX_FLAG_ps=0 fi : fi if test "$DX_FLAG_ps" = 1; then : else : fi # PDF file generation: # Check whether --enable-doxygen-pdf was given. if test "${enable_doxygen_pdf+set}" = set; then : enableval=$enable_doxygen_pdf; case "$enableval" in #( y|Y|yes|Yes|YES) DX_FLAG_pdf=1 test "$DX_FLAG_doc" = "1" \ || as_fn_error $? "doxygen-pdf requires doxygen-pdf" "$LINENO" 5 ;; #( n|N|no|No|NO) DX_FLAG_pdf=0 ;; #( *) as_fn_error $? "invalid value '$enableval' given to doxygen-pdf" "$LINENO" 5 ;; esac else DX_FLAG_pdf=1 test "$DX_FLAG_doc" = "1" || DX_FLAG_pdf=0 fi if test "$DX_FLAG_pdf" = 1; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pdflatex", so it can be a program name with args. set dummy ${ac_tool_prefix}pdflatex; 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_DX_PDFLATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_PDFLATEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_PDFLATEX="$DX_PDFLATEX" # 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_DX_PDFLATEX="$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 DX_PDFLATEX=$ac_cv_path_DX_PDFLATEX if test -n "$DX_PDFLATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PDFLATEX" >&5 $as_echo "$DX_PDFLATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_PDFLATEX"; then ac_pt_DX_PDFLATEX=$DX_PDFLATEX # Extract the first word of "pdflatex", so it can be a program name with args. set dummy pdflatex; 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_DX_PDFLATEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_PDFLATEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_PDFLATEX="$ac_pt_DX_PDFLATEX" # 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_DX_PDFLATEX="$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_DX_PDFLATEX=$ac_cv_path_ac_pt_DX_PDFLATEX if test -n "$ac_pt_DX_PDFLATEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PDFLATEX" >&5 $as_echo "$ac_pt_DX_PDFLATEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_PDFLATEX" = x; then DX_PDFLATEX="" 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 DX_PDFLATEX=$ac_pt_DX_PDFLATEX fi else DX_PDFLATEX="$ac_cv_path_DX_PDFLATEX" fi if test "$DX_FLAG_pdf$DX_PDFLATEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&5 $as_echo "$as_me: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&2;} DX_FLAG_pdf=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args. set dummy ${ac_tool_prefix}makeindex; 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_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # 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_DX_MAKEINDEX="$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 DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX if test -n "$DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5 $as_echo "$DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_MAKEINDEX"; then ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX # Extract the first word of "makeindex", so it can be a program name with args. set dummy makeindex; 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_DX_MAKEINDEX+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_MAKEINDEX in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # 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_DX_MAKEINDEX="$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_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX if test -n "$ac_pt_DX_MAKEINDEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5 $as_echo "$ac_pt_DX_MAKEINDEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_MAKEINDEX" = x; then DX_MAKEINDEX="" 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 DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX fi else DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX" fi if test "$DX_FLAG_pdf$DX_MAKEINDEX" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&5 $as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&2;} DX_FLAG_pdf=0 fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args. set dummy ${ac_tool_prefix}egrep; 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_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_DX_EGREP="$DX_EGREP" # 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_DX_EGREP="$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 DX_EGREP=$ac_cv_path_DX_EGREP if test -n "$DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5 $as_echo "$DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_DX_EGREP"; then ac_pt_DX_EGREP=$DX_EGREP # Extract the first word of "egrep", so it can be a program name with args. set dummy egrep; 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_DX_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_DX_EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # 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_DX_EGREP="$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_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP if test -n "$ac_pt_DX_EGREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5 $as_echo "$ac_pt_DX_EGREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_DX_EGREP" = x; then DX_EGREP="" 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 DX_EGREP=$ac_pt_DX_EGREP fi else DX_EGREP="$ac_cv_path_DX_EGREP" fi if test "$DX_FLAG_pdf$DX_EGREP" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PDF documentation" >&5 $as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PDF documentation" >&2;} DX_FLAG_pdf=0 fi : fi if test "$DX_FLAG_pdf" = 1; then : else : fi # LaTeX generation for PS and/or PDF: if test "$DX_FLAG_ps" = 1 || test "$DX_FLAG_pdf" = 1; then DX_ENV="$DX_ENV GENERATE_LATEX='YES'" GENERATE_LATEX=YES else DX_ENV="$DX_ENV GENERATE_LATEX='NO'" GENERATE_LATEX=NO fi # Paper size for PS and/or PDF: case "$DOXYGEN_PAPER_SIZE" in #( "") DOXYGEN_PAPER_SIZE="" ;; #( a4wide|a4|letter|legal|executive) DX_ENV="$DX_ENV PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" PAPER_SIZE=$DOXYGEN_PAPER_SIZE ;; #( *) as_fn_error $? "unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" "$LINENO" 5 ;; esac # Rules: if test $DX_FLAG_html -eq 1; then : DX_SNIPPET_html="## ------------------------------- ## ## Rules specific for HTML output. ## ## ------------------------------- ## DX_CLEAN_HTML = \$(DX_DOCDIR)/html\\ \$(DX_DOCDIR)/html " else DX_SNIPPET_html="" fi if test $DX_FLAG_chi -eq 1; then : DX_SNIPPET_chi=" DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi\\ \$(DX_DOCDIR)/\$(PACKAGE).chi" else DX_SNIPPET_chi="" fi if test $DX_FLAG_chm -eq 1; then : DX_SNIPPET_chm="## ------------------------------ ## ## Rules specific for CHM output. ## ## ------------------------------ ## DX_CLEAN_CHM = \$(DX_DOCDIR)/chm\\ \$(DX_DOCDIR)/chm\ ${DX_SNIPPET_chi} " else DX_SNIPPET_chm="" fi if test $DX_FLAG_man -eq 1; then : DX_SNIPPET_man="## ------------------------------ ## ## Rules specific for MAN output. ## ## ------------------------------ ## DX_CLEAN_MAN = \$(DX_DOCDIR)/man\\ \$(DX_DOCDIR)/man " else DX_SNIPPET_man="" fi if test $DX_FLAG_rtf -eq 1; then : DX_SNIPPET_rtf="## ------------------------------ ## ## Rules specific for RTF output. ## ## ------------------------------ ## DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf\\ \$(DX_DOCDIR)/rtf " else DX_SNIPPET_rtf="" fi if test $DX_FLAG_xml -eq 1; then : DX_SNIPPET_xml="## ------------------------------ ## ## Rules specific for XML output. ## ## ------------------------------ ## DX_CLEAN_XML = \$(DX_DOCDIR)/xml\\ \$(DX_DOCDIR)/xml " else DX_SNIPPET_xml="" fi if test $DX_FLAG_ps -eq 1; then : DX_SNIPPET_ps="## ----------------------------- ## ## Rules specific for PS output. ## ## ----------------------------- ## DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps\\ \$(DX_DOCDIR)/\$(PACKAGE).ps DX_PS_GOAL = doxygen-ps doxygen-ps: \$(DX_CLEAN_PS) \$(DX_DOCDIR)/\$(PACKAGE).ps: \$(DX_DOCDIR)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR)/latex; \\ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ \$(DX_LATEX) refman.tex; \\ \$(DX_MAKEINDEX) refman.idx; \\ \$(DX_LATEX) refman.tex; \\ countdown=5; \\ while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ refman.log > /dev/null 2>&1 \\ && test \$\$countdown -gt 0; do \\ \$(DX_LATEX) refman.tex; \\ countdown=\`expr \$\$countdown - 1\`; \\ done; \\ \$(DX_DVIPS) -o ../\$(PACKAGE).ps refman.dvi " else DX_SNIPPET_ps="" fi if test $DX_FLAG_pdf -eq 1; then : DX_SNIPPET_pdf="## ------------------------------ ## ## Rules specific for PDF output. ## ## ------------------------------ ## DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf\\ \$(DX_DOCDIR)/\$(PACKAGE).pdf DX_PDF_GOAL = doxygen-pdf doxygen-pdf: \$(DX_CLEAN_PDF) \$(DX_DOCDIR)/\$(PACKAGE).pdf: \$(DX_DOCDIR)/\$(PACKAGE).tag \$(DX_V_LATEX)cd \$(DX_DOCDIR)/latex; \\ rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ \$(DX_PDFLATEX) refman.tex; \\ \$(DX_MAKEINDEX) refman.idx; \\ \$(DX_PDFLATEX) refman.tex; \\ countdown=5; \\ while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ refman.log > /dev/null 2>&1 \\ && test \$\$countdown -gt 0; do \\ \$(DX_PDFLATEX) refman.tex; \\ countdown=\`expr \$\$countdown - 1\`; \\ done; \\ mv refman.pdf ../\$(PACKAGE).pdf " else DX_SNIPPET_pdf="" fi if test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1; then : DX_SNIPPET_latex="## ------------------------------------------------- ## ## Rules specific for LaTeX (shared for PS and PDF). ## ## ------------------------------------------------- ## DX_V_LATEX = \$(_DX_v_LATEX_\$(V)) _DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY)) _DX_v_LATEX_0 = @echo \" LATEX \" \$@; DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex\\ \$(DX_DOCDIR)/latex " else DX_SNIPPET_latex="" fi if test $DX_FLAG_doc -eq 1; then : DX_SNIPPET_doc="## --------------------------------- ## ## Format-independent Doxygen rules. ## ## --------------------------------- ## ${DX_SNIPPET_html}\ ${DX_SNIPPET_chm}\ ${DX_SNIPPET_man}\ ${DX_SNIPPET_rtf}\ ${DX_SNIPPET_xml}\ ${DX_SNIPPET_ps}\ ${DX_SNIPPET_pdf}\ ${DX_SNIPPET_latex}\ DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V)) _DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY)) _DX_v_DXGEN_0 = @echo \" DXGEN \" \$<; .PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL) .INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) doxygen-run: \$(DX_DOCDIR)/\$(PACKAGE).tag doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) \$(DX_DOCDIR)/\$(PACKAGE).tag: \$(DX_CONFIG) \$(pkginclude_HEADERS) \$(A""M_V_at)rm -rf \$(DX_DOCDIR) \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR) \$(DX_DOXYGEN) \$(DX_CONFIG) \$(A""M_V_at)echo Timestamp >\$@ DX_CLEANFILES = \\ \$(DX_DOCDIR)/doxygen_sqlite3.db \\ \$(DX_DOCDIR)/\$(PACKAGE).tag \\ -r \\ \$(DX_CLEAN_HTML) \\ \$(DX_CLEAN_CHM) \\ \$(DX_CLEAN_CHI) \\ \$(DX_CLEAN_MAN) \\ \$(DX_CLEAN_RTF) \\ \$(DX_CLEAN_XML) \\ \$(DX_CLEAN_PS) \\ \$(DX_CLEAN_PDF) \\ \$(DX_CLEAN_LATEX)" else DX_SNIPPET_doc="" fi DX_RULES="${DX_SNIPPET_doc}" #For debugging: #echo DX_FLAG_doc=$DX_FLAG_doc #echo DX_FLAG_dot=$DX_FLAG_dot #echo DX_FLAG_man=$DX_FLAG_man #echo DX_FLAG_html=$DX_FLAG_html #echo DX_FLAG_chm=$DX_FLAG_chm #echo DX_FLAG_chi=$DX_FLAG_chi #echo DX_FLAG_rtf=$DX_FLAG_rtf #echo DX_FLAG_xml=$DX_FLAG_xml #echo DX_FLAG_pdf=$DX_FLAG_pdf #echo DX_FLAG_ps=$DX_FLAG_ps #echo DX_ENV=$DX_ENV if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Set by dx_init_doxygen:" >&5 $as_echo "$as_me: Set by dx_init_doxygen:" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: DOXYGEN: $DOXYGEN " >&5 $as_echo "$as_me: DOXYGEN: $DOXYGEN " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: dx_DOT_FEATURE: $ " >&5 $as_echo "$as_me: dx_DOT_FEATURE: $ " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: dx_FEATURE_doc $ON " >&5 $as_echo "$as_me: dx_FEATURE_doc $ON " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: dx_DOXYGEN_FEATURE: $ " >&5 $as_echo "$as_me: dx_DOXYGEN_FEATURE: $ " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: dx_HTML_FEATURE: $ " >&5 $as_echo "$as_me: dx_HTML_FEATURE: $ " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: dx_FLAG_html: $DX_FLAG_HTML " >&5 $as_echo "$as_me: dx_FLAG_html: $DX_FLAG_HTML " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: dx_PDF_FEATURE: $ " >&5 $as_echo "$as_me: dx_PDF_FEATURE: $ " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: DX_PROJECT: $DX_PROJECT " >&5 $as_echo "$as_me: DX_PROJECT: $DX_PROJECT " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: DX_CONFIG: $DX_CONFIG " >&5 $as_echo "$as_me: DX_CONFIG: $DX_CONFIG " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: DX_DOCDIR: $DX_DOCDIR " >&5 $as_echo "$as_me: DX_DOCDIR: $DX_DOCDIR " >&6;} fi ac_config_files="$ac_config_files docs/doxygen/doxyfile" else { $as_echo "$as_me:${as_lineno-$LINENO}: doxygen not found" >&5 $as_echo "$as_me: doxygen not found" >&6;} enable_doxygen=no fi else { $as_echo "$as_me:${as_lineno-$LINENO}: doxygen disabled, not checking for Doxygen" >&5 $as_echo "$as_me: doxygen disabled, not checking for Doxygen" >&6;} fi if test "x$enable_doxygen" == "xyes"; then USE_DOXYGEN_TRUE= USE_DOXYGEN_FALSE='#' else USE_DOXYGEN_TRUE='#' USE_DOXYGEN_FALSE= fi if test -z "$USE_DOXYGEN_TRUE"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: USE_DOXYGEN is set" >&5 $as_echo "$as_me: USE_DOXYGEN is set" >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: USE_DOXYGEN not set" >&5 $as_echo "$as_me: USE_DOXYGEN not set" >&6;} fi ### DOC-BASE for ac_prog in install-docs 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_DOCBASE_INSTALL_DOCS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DOCBASE_INSTALL_DOCS"; then ac_cv_prog_DOCBASE_INSTALL_DOCS="$DOCBASE_INSTALL_DOCS" # 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_DOCBASE_INSTALL_DOCS="$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 DOCBASE_INSTALL_DOCS=$ac_cv_prog_DOCBASE_INSTALL_DOCS if test -n "$DOCBASE_INSTALL_DOCS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOCBASE_INSTALL_DOCS" >&5 $as_echo "$DOCBASE_INSTALL_DOCS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DOCBASE_INSTALL_DOCS" && break done if test -n "$DOCBASE_INSTALL_DOCS"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: doc-base execuable found" >&5 $as_echo "$as_me: doc-base execuable found" >&6;} ac_config_files="$ac_config_files docs/ddcutil-c-api" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doc-base not installed - continuing without doc-base support" >&5 $as_echo "$as_me: WARNING: doc-base not installed - continuing without doc-base support" >&2;} fi if test -n "$DOCBASE_INSTALL_DOCS"; then HAVE_DOCBASE_TRUE= HAVE_DOCBASE_FALSE='#' else HAVE_DOCBASE_TRUE='#' HAVE_DOCBASE_FALSE= fi ### GObject # Vestigial. GObject interface no longer being developed. # Check whether --enable-introspection was given. if test "${enable_introspection+set}" = set; then : enableval=$enable_introspection; else enable_introspection=auto fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-introspection" >&5 $as_echo_n "checking for gobject-introspection... " >&6; } case $enable_introspection in #( no) : found_introspection="no (disabled, use --enable-introspection to enable)" ;; #( yes) : if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : else as_fn_error $? "gobject-introspection-1.0 is not installed" "$LINENO" 5 fi if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 1.30.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 1.30.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then found_introspection=yes else as_fn_error $? "You need to have gobject-introspection >= 1.30.0 installed to build ddcutil" "$LINENO" 5 fi ;; #( auto) : if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-introspection-1.0 >= 1.30.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-introspection-1.0 >= 1.30.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then found_introspection=yes else found_introspection=no fi enable_introspection=$found_introspection ;; #( *) : as_fn_error $? "invalid argument passed to --enable-introspection, should be one of [no/auto/yes]" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $found_introspection" >&5 $as_echo "$found_introspection" >&6; } INTROSPECTION_SCANNER= INTROSPECTION_COMPILER= INTROSPECTION_GENERATE= INTROSPECTION_GIRDIR= INTROSPECTION_TYPELIBDIR= if test "x$found_introspection" = "xyes"; then INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0` INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0` INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0` INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)" INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0` INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0` INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection fi if test "x$found_introspection" = "xyes"; then HAVE_INTROSPECTION_TRUE= HAVE_INTROSPECTION_FALSE='#' else HAVE_INTROSPECTION_TRUE='#' HAVE_INTROSPECTION_FALSE= fi if test "x$found_introspection" = xyes; then HAVE_INTROSPECTION_TRUE= HAVE_INTROSPECTION_FALSE='#' else HAVE_INTROSPECTION_TRUE='#' HAVE_INTROSPECTION_FALSE= fi if test "x$enable_gobject" == "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOBJECT" >&5 $as_echo_n "checking for GOBJECT... " >&6; } if test -n "$GOBJECT_CFLAGS"; then pkg_cv_GOBJECT_CFLAGS="$GOBJECT_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-2.0 >= 2.14\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-2.0 >= 2.14") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GOBJECT_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= 2.14" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GOBJECT_LIBS"; then pkg_cv_GOBJECT_LIBS="$GOBJECT_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gobject-2.0 >= 2.14\""; } >&5 ($PKG_CONFIG --exists --print-errors "gobject-2.0 >= 2.14") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GOBJECT_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= 2.14" 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 GOBJECT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gobject-2.0 >= 2.14" 2>&1` else GOBJECT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gobject-2.0 >= 2.14" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GOBJECT_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (gobject-2.0 >= 2.14) were not met: $GOBJECT_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 GOBJECT_CFLAGS and GOBJECT_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 GOBJECT_CFLAGS and GOBJECT_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 GOBJECT_CFLAGS=$pkg_cv_GOBJECT_CFLAGS GOBJECT_LIBS=$pkg_cv_GOBJECT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi ### Library if test "x$enable_lib" == "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZLIB" >&5 $as_echo_n "checking for ZLIB... " >&6; } if test -n "$ZLIB_CFLAGS"; then pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$ZLIB_LIBS"; then pkg_cv_ZLIB_LIBS="$ZLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib" 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 ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1` else ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$ZLIB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (zlib) were not met: $ZLIB_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 ZLIB_CFLAGS and ZLIB_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 ZLIB_CFLAGS and ZLIB_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 ZLIB_CFLAGS=$pkg_cv_ZLIB_CFLAGS ZLIB_LIBS=$pkg_cv_ZLIB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi ### Python and SWIG if test "x$enable_swig" == "xyes" || test "x$enable_cython" == "xyes" || test "x$enable_cffi" == "xyes" ; then : { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG, Cython, or CFFI enabled, checking for Python and SWIG... " >&5 $as_echo "$as_me: SWIG, Cython, or CFFI enabled, checking for Python and SWIG... " >&6;} # Python 3 { $as_echo "$as_me:${as_lineno-$LINENO}: Calling ax_path_python3 for Python 3... " >&5 $as_echo "$as_me: Calling ax_path_python3 for Python 3... " >&6;} if test -n "$PYTHON3"; then # If the user set $PYTHON3, use it and don't search something else. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON3 version is >= 3.1" >&5 $as_echo_n "checking whether $PYTHON3 version is >= 3.1... " >&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.1'.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: $PYTHON3 -c "$prog"" >&5 ($PYTHON3 -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 $? "Python3 interpreter is too old" "$LINENO" 5 fi am_display_PYTHON3=$PYTHON3 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.1" >&5 $as_echo_n "checking for a Python interpreter with version >= 3.1... " >&6; } if ${am_cv_pathless_PYTHON3+:} false; then : $as_echo_n "(cached) " >&6 else for am_cv_pathless_PYTHON3 in python3 python3.3 python3.2 python3.1 python3.0 none; do test "$am_cv_pathless_PYTHON3" = 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.1'.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_PYTHON3 -c "$prog"" >&5 ($am_cv_pathless_PYTHON3 -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_PYTHON3" >&5 $as_echo "$am_cv_pathless_PYTHON3" >&6; } # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON3. if test "$am_cv_pathless_PYTHON3" = none; then PYTHON3=: else # Extract the first word of "$am_cv_pathless_PYTHON3", so it can be a program name with args. set dummy $am_cv_pathless_PYTHON3; 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_PYTHON3+:} false; then : $as_echo_n "(cached) " >&6 else case $PYTHON3 in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON3="$PYTHON3" # 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_PYTHON3="$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 PYTHON3=$ac_cv_path_PYTHON3 if test -n "$PYTHON3"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON3" >&5 $as_echo "$PYTHON3" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi am_display_PYTHON3=$am_cv_pathless_PYTHON3 fi if test "$PYTHON3" = :; then python_found3=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON3 version" >&5 $as_echo_n "checking for $am_display_PYTHON3 version... " >&6; } if ${am_cv_python_version3+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_python_version3=`$PYTHON3 -c "import sys; sys.stdout.write(sys.version[:3])"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version3" >&5 $as_echo "$am_cv_python_version3" >&6; } PYTHON3_VERSION=$am_cv_python_version3 PYTHON3_PREFIX='${prefix}' PYTHON3_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON3 platform" >&5 $as_echo_n "checking for $am_display_PYTHON3 platform... " >&6; } if ${am_cv_python3_platform+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_python3_platform=`$PYTHON3 -c "import sys; sys.stdout.write(sys.platform)"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python3_platform" >&5 $as_echo "$am_cv_python3_platform" >&6; } PYTHON3_PLATFORM=$am_cv_python3_platform # Just factor out some code duplication. am_python3_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_use_sysconfig = 0 # 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_PYTHON3 script directory" >&5 $as_echo_n "checking for $am_display_PYTHON3 script directory... " >&6; } if ${am_cv_python3_pythondir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$prefix" = xNONE then am_py3_prefix=$ac_default_prefix else am_py3_prefix=$prefix fi am_cv_python3_pythondir=`$PYTHON3 -c " $am_python3_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py3_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py3_prefix') sys.stdout.write(sitedir)"` case $am_cv_python3_pythondir in $am_py3_prefix*) am__strip_prefix=`echo "$am_py3_prefix" | sed 's|.|.|g'` am_cv_python3_pythondir=`echo "$am_cv_python3_pythondir" | sed "s,^$am__strip_prefix,$PYTHON3_PREFIX,"` ;; *) case $am_py3_prefix in /usr|/System*) ;; *) am_cv_python3_pythondir=$PYTHON3_PREFIX/lib/python$PYTHON3_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python3_pythondir" >&5 $as_echo "$am_cv_python3_pythondir" >&6; } python3dir=$am_cv_python3_pythondir pkgpython3dir=\${python3dir}/$PACKAGE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON3 extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON3 extension module directory... " >&6; } if ${am_cv_python_py3execdir+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$exec_prefix" = xNONE then am_py3_exec_prefix=$am_py3_prefix else am_py3_exec_prefix=$exec_prefix fi am_cv_python3_pyexecdir=`$PYTHON3 -c " $am_python3_setup_sysconfig if can_use_sysconfig: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py3_prefix'}) else: from distutils import sysconfig sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py3_prefix') sys.stdout.write(sitedir)"` { $as_echo "$as_me:${as_lineno-$LINENO}: am_py3_cv_python3_pyexecdir = ${am_py3_cv_pyexecdir} " >&5 $as_echo "$as_me: am_py3_cv_python3_pyexecdir = ${am_py3_cv_pyexecdir} " >&6;} case $am_cv_python3_pyexecdir in $am_py3_exec_prefix*) am__strip_prefix=`echo "$am_py3_exec_prefix" | sed 's|.|.|g'` am_cv_python3_pyexecdir=`echo "$am_cv_python3_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON3_EXEC_PREFIX,"` { $as_echo "$as_me:${as_lineno-$LINENO}: Case 1: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} " >&5 $as_echo "$as_me: Case 1: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} " >&6;} am_cv_python3_pyexecdir=`echo "$am_cv_python3_pyexecdir" | sed "s,/python3/,/python$am_cv_python_version3/,"` { $as_echo "$as_me:${as_lineno-$LINENO}: Case 1 fixup: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} " >&5 $as_echo "$as_me: Case 1 fixup: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} " >&6;} ;; *) case $am_py3_exec_prefix in /usr|/System*) ;; *) am_cv_python3_pyexecdir=$PYTHON3_EXEC_PREFIX/lib/python$PYTHON3_VERSION/site-packages { $as_echo "$as_me:${as_lineno-$LINENO}: Case 2b: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} " >&5 $as_echo "$as_me: Case 2b: am_cv_python3_pyexecdir = ${am_cv_python3_pyexecdir} " >&6;} ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_py3execdir" >&5 $as_echo "$am_cv_python_py3execdir" >&6; } py3execdir=$am_cv_python3_pyexecdir pkgpy3execdir=\${py3execdir}/$PACKAGE python3_found=yes fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Set by ax_path_python3 for python3: " >&5 $as_echo "$as_me: Set by ax_path_python3 for python3: " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: python3_found = $python3_found " >&5 $as_echo "$as_me: python3_found = $python3_found " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON3 = $PYTHON3 " >&5 $as_echo "$as_me: PYTHON3 = $PYTHON3 " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON3_VERSION = $PYTHON3_VERSION " >&5 $as_echo "$as_me: PYTHON3_VERSION = $PYTHON3_VERSION " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON3_PREFIX = $PYTHON3_PREFIX " >&5 $as_echo "$as_me: PYTHON3_PREFIX = $PYTHON3_PREFIX " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON3_EXEC_PREFIX = $PYTHON3_EXEC_PREFIX " >&5 $as_echo "$as_me: PYTHON3_EXEC_PREFIX = $PYTHON3_EXEC_PREFIX " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: python3dir = $python3dir " >&5 $as_echo "$as_me: python3dir = $python3dir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pkgpython3dir = $pkgpython3dir " >&5 $as_echo "$as_me: pkgpython3dir = $pkgpython3dir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: py3execdir = $py3execdir " >&5 $as_echo "$as_me: py3execdir = $py3execdir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pkgpy3execdir = $pkgpy3execdir " >&5 $as_echo "$as_me: pkgpy3execdir = $pkgpy3execdir " >&6;} fi if test "x$python3_found" == "xyes" ; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Looking for Python 3 pkgconfig information... " >&5 $as_echo "$as_me: Looking for Python 3 pkgconfig information... " >&6;} pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PY3" >&5 $as_echo_n "checking for PY3... " >&6; } if test -n "$PY3_CFLAGS"; then pkg_cv_PY3_CFLAGS="$PY3_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\$PYTHON3_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "python-$PYTHON3_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PY3_CFLAGS=`$PKG_CONFIG --cflags "python-$PYTHON3_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PY3_LIBS"; then pkg_cv_PY3_LIBS="$PY3_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\$PYTHON3_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "python-$PYTHON3_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PY3_LIBS=`$PKG_CONFIG --libs "python-$PYTHON3_VERSION" 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 PY3_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-$PYTHON3_VERSION" 2>&1` else PY3_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-$PYTHON3_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PY3_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Building without Python 3 support" >&5 $as_echo "$as_me: WARNING: Building without Python 3 support" >&2;} python3_found="no" enable_py3="no" 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}: WARNING: Building without Python 3 support" >&5 $as_echo "$as_me: WARNING: Building without Python 3 support" >&2;} python3_found="no" enable_py3="no" else PY3_CFLAGS=$pkg_cv_PY3_CFLAGS PY3_LIBS=$pkg_cv_PY3_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } enable_py3="yes" if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: PY3_CFLAGS = $PY3_CFLAGS " >&5 $as_echo "$as_me: PY3_CFLAGS = $PY3_CFLAGS " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PY3_LIBS = $PY3_LIBS " >&5 $as_echo "$as_me: PY3_LIBS = $PY3_LIBS " >&6;} fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: Skipping check for Python3 pkgconfig " >&5 $as_echo "$as_me: Skipping check for Python3 pkgconfig " >&6;} fi if test "x$enable_py3" == "xyes" ; then : python=$PYTHON3 pyver=`$python -c "import sys; print( sys.version_info.major)"` { $as_echo "$as_me:${as_lineno-$LINENO}: =====> Macro ax_python_env, python=$python, pyver=$pyver" >&5 $as_echo "$as_me: =====> Macro ax_python_env, python=$python, pyver=$pyver" >&6;} # # libraries which must be linked in when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python $pyver extra libraries" >&5 $as_echo_n "checking Python $pyver extra libraries... " >&6; } extra_ldflags=`$python -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $extra_ldflags " >&5 $as_echo "$extra_ldflags " >&6; } if test 0$pyver -eq 2 ; then : if test -z "$PY2_EXTRA_LIBS"; then : PY2_EXTRA_LIBS=$extra_ldflags fi else if test -z "$PY3_EXTRA_LIBS"; then : PY3_EXTRA_LIBS=$extra_ldflags fi fi # # linking flags when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python $pyver extra linking flags" >&5 $as_echo_n "checking Python $pyver extra linking flags... " >&6; } link_flags=`$python -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LINKFORSHARED'))"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $link_flags " >&5 $as_echo "$link_flags " >&6; } if test 0$pyver -eq 2 ; then : if test -z "$PY2_EXTRA_LDFLAGS"; then : PY2_EXTRA_LDFLAGS=$link_flags fi else if test -z "$PY3_EXTRA_LDFLAGS"; then : PY3_EXTRA_LDFLAGS=$link_flags fi fi # # /usr package exec directory # # should this be precious? what should variable name be? { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python $pyver /usr extension directory" >&5 $as_echo_n "checking Python $pyver /usr extension directory... " >&6; } exec_dir=`$python -c "import sys; \ import distutils.sysconfig; \ result = distutils.sysconfig.get_python_lib(1,0); \ sys.stdout.write(result)"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $exec_dir " >&5 $as_echo "$exec_dir " >&6; } if test 0$pyver -eq 2 ; then : if test -z "$usr_py2execdir"; then : usr_py2execdir=$exec_dir fi else if test -z "$usr_py3execdir"; then : usr_py3execdir=$exec_dir fi fi vname=alt_py${pyver}execdir eval $vname=$exec_dir { $as_echo "$as_me:${as_lineno-$LINENO}: PY3_EXTRA_LDFLAGS: $PY3_EXTRA_LDFLAGS" >&5 $as_echo "$as_me: PY3_EXTRA_LDFLAGS: $PY3_EXTRA_LDFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PY3_EXTRA_LIBS $PY3_EXTRA_LIBS" >&5 $as_echo "$as_me: PY3_EXTRA_LIBS $PY3_EXTRA_LIBS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: usr_py3execdir: $usr_py3execdir" >&5 $as_echo "$as_me: usr_py3execdir: $usr_py3execdir" >&6;} fi # Python 2 { $as_echo "$as_me:${as_lineno-$LINENO}: Calling am_path_python for Python 2... " >&5 $as_echo "$as_me: Calling am_path_python for Python 2... " >&6;} 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 >= 2.6" >&5 $as_echo_n "checking whether $PYTHON version is >= 2.6... " >&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, '2.6'.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 >= 2.6" >&5 $as_echo_n "checking for a Python interpreter with version >= 2.6... " >&6; } if ${am_cv_pathless_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else for am_cv_pathless_PYTHON in python python2 python3 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, '2.6'.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 python_found=no 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; sys.stdout.write(sys.version[:3])"` 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 python_found=yes fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Set by am_path_python: " >&5 $as_echo "$as_me: Set by am_path_python: " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: python_found = $python_found " >&5 $as_echo "$as_me: python_found = $python_found " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON = $PYTHON " >&5 $as_echo "$as_me: PYTHON = $PYTHON " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON_VERSION = $PYTHON_VERSION " >&5 $as_echo "$as_me: PYTHON_VERSION = $PYTHON_VERSION " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON_PREFIX = $PYTHON_PREFIX " >&5 $as_echo "$as_me: PYTHON_PREFIX = $PYTHON_PREFIX " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PYTHON_EXEC_PREFIX = $PYTHON_EXEC_PREFIX " >&5 $as_echo "$as_me: PYTHON_EXEC_PREFIX = $PYTHON_EXEC_PREFIX " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pythondir = $pythondir " >&5 $as_echo "$as_me: pythondir = $pythondir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pkgpythondir = $pkgpythondir " >&5 $as_echo "$as_me: pkgpythondir = $pkgpythondir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pyexecdir = $pyexecdir " >&5 $as_echo "$as_me: pyexecdir = $pyexecdir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pkgpyexecdir = $pkgpyexecdir " >&5 $as_echo "$as_me: pkgpyexecdir = $pkgpyexecdir " >&6;} fi if test "x$python_found" == "xyes"; then : 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.0'.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}: No Python 2.x found" >&5 $as_echo "$as_me: No Python 2.x found" >&6;} python_found = "no" fi fi if test "x$python_found" == "xyes" ; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Looking for Python2 pkgconfig information... " >&5 $as_echo "$as_me: Looking for Python2 pkgconfig information... " >&6;} pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PY2" >&5 $as_echo_n "checking for PY2... " >&6; } if test -n "$PY2_CFLAGS"; then pkg_cv_PY2_CFLAGS="$PY2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\$PYTHON_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "python-$PYTHON_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PY2_CFLAGS=`$PKG_CONFIG --cflags "python-$PYTHON_VERSION" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PY2_LIBS"; then pkg_cv_PY2_LIBS="$PY2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-\$PYTHON_VERSION\""; } >&5 ($PKG_CONFIG --exists --print-errors "python-$PYTHON_VERSION") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PY2_LIBS=`$PKG_CONFIG --libs "python-$PYTHON_VERSION" 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 PY2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-$PYTHON_VERSION" 2>&1` else PY2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-$PYTHON_VERSION" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PY2_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Building without Python 2 support" >&5 $as_echo "$as_me: WARNING: Building without Python 2 support" >&2;} python2_found="no" enable_py2="no" 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}: WARNING: Building without Python 2 support" >&5 $as_echo "$as_me: WARNING: Building without Python 2 support" >&2;} python2_found="no" enable_py2="no" else PY2_CFLAGS=$pkg_cv_PY2_CFLAGS PY2_LIBS=$pkg_cv_PY2_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } enable_py2="yes" if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Set by pkg_check_modules: " >&5 $as_echo "$as_me: Set by pkg_check_modules: " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PY2_CFLAGS = $PY2_CFLAGS " >&5 $as_echo "$as_me: PY2_CFLAGS = $PY2_CFLAGS " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PY2_LIBS = $PY2_LIBS " >&5 $as_echo "$as_me: PY2_LIBS = $PY2_LIBS " >&6;} fi PY2_CFLAGS=$PY2_CFLAGS PY2_LIBS=$PY2_LIBS fi else { $as_echo "$as_me:${as_lineno-$LINENO}: Skipping check for Python2 pkgconfig " >&5 $as_echo "$as_me: Skipping check for Python2 pkgconfig " >&6;} fi if test "x$enable_py2" == "xyes" ; then : python=$PYTHON pyver=`$python -c "import sys; print( sys.version_info.major)"` { $as_echo "$as_me:${as_lineno-$LINENO}: =====> Macro ax_python_env, python=$python, pyver=$pyver" >&5 $as_echo "$as_me: =====> Macro ax_python_env, python=$python, pyver=$pyver" >&6;} # # libraries which must be linked in when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python $pyver extra libraries" >&5 $as_echo_n "checking Python $pyver extra libraries... " >&6; } extra_ldflags=`$python -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $extra_ldflags " >&5 $as_echo "$extra_ldflags " >&6; } if test 0$pyver -eq 2 ; then : if test -z "$PY2_EXTRA_LIBS"; then : PY2_EXTRA_LIBS=$extra_ldflags fi else if test -z "$PY3_EXTRA_LIBS"; then : PY3_EXTRA_LIBS=$extra_ldflags fi fi # # linking flags when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python $pyver extra linking flags" >&5 $as_echo_n "checking Python $pyver extra linking flags... " >&6; } link_flags=`$python -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LINKFORSHARED'))"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $link_flags " >&5 $as_echo "$link_flags " >&6; } if test 0$pyver -eq 2 ; then : if test -z "$PY2_EXTRA_LDFLAGS"; then : PY2_EXTRA_LDFLAGS=$link_flags fi else if test -z "$PY3_EXTRA_LDFLAGS"; then : PY3_EXTRA_LDFLAGS=$link_flags fi fi # # /usr package exec directory # # should this be precious? what should variable name be? { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python $pyver /usr extension directory" >&5 $as_echo_n "checking Python $pyver /usr extension directory... " >&6; } exec_dir=`$python -c "import sys; \ import distutils.sysconfig; \ result = distutils.sysconfig.get_python_lib(1,0); \ sys.stdout.write(result)"` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $exec_dir " >&5 $as_echo "$exec_dir " >&6; } if test 0$pyver -eq 2 ; then : if test -z "$usr_py2execdir"; then : usr_py2execdir=$exec_dir fi else if test -z "$usr_py3execdir"; then : usr_py3execdir=$exec_dir fi fi vname=alt_py${pyver}execdir eval $vname=$exec_dir { $as_echo "$as_me:${as_lineno-$LINENO}: PY2_EXTRA_LDFLAGS: $PY2_EXTRA_LDFLAGS" >&5 $as_echo "$as_me: PY2_EXTRA_LDFLAGS: $PY2_EXTRA_LDFLAGS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PY2_EXTRA_LIBS $PY3_EXTRA_LIBS" >&5 $as_echo "$as_me: PY2_EXTRA_LIBS $PY3_EXTRA_LIBS" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: usr_py2execdir: $usr_py2execdir" >&5 $as_echo "$as_me: usr_py2execdir: $usr_py2execdir" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: alt_py2execdir: $alt_py2execdir" >&5 $as_echo "$as_me: alt_py2execdir: $alt_py2execdir" >&6;} fi # SWIG if test "x$enable_py2" == "xyes" -o "x$enable_py3" == "xyes"; then : enable_some_python="yes" fi { $as_echo "$as_me:${as_lineno-$LINENO}: enable_some_python: $enable_some_python " >&5 $as_echo "$as_me: enable_some_python: $enable_some_python " >&6;} if test "x$enable_swig" == "xyes" ; then : if test "x$enable_some_python" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Calling ax_pkg_swig... " >&5 $as_echo "$as_me: Calling ax_pkg_swig... " >&6;} # Ubuntu has swig 2.0 as /usr/bin/swig2.0 for ac_prog in swig swig2.0 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_path_SWIG+:} false; then : $as_echo_n "(cached) " >&6 else case $SWIG in [\\/]* | ?:[\\/]*) ac_cv_path_SWIG="$SWIG" # 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_SWIG="$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 SWIG=$ac_cv_path_SWIG if test -n "$SWIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 $as_echo "$SWIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$SWIG" && break done if test -z "$SWIG" ; then swig_found=no elif test -n "1.3.21" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5 $as_echo_n "checking SWIG version... " >&6; } swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 $as_echo "$swig_version" >&6; } if test -n "$swig_version" ; then # Calculate the required version number components required=1.3.21 required_major=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_major" ; then required_major=0 fi required=`echo $required | sed 's/[0-9]*[^0-9]//'` required_minor=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_minor" ; then required_minor=0 fi required=`echo $required | sed 's/[0-9]*[^0-9]//'` required_patch=`echo $required | sed 's/[^0-9].*//'` if test -z "$required_patch" ; then required_patch=0 fi # Calculate the available version number components available=$swig_version available_major=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_major" ; then available_major=0 fi available=`echo $available | sed 's/[0-9]*[^0-9]//'` available_minor=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_minor" ; then available_minor=0 fi available=`echo $available | sed 's/[0-9]*[^0-9]//'` available_patch=`echo $available | sed 's/[^0-9].*//'` if test -z "$available_patch" ; then available_patch=0 fi # Convert the version tuple into a single number for easier comparison. # Using base 100 should be safe since SWIG internally uses BCD values # to encode its version number. required_swig_vernum=`expr $required_major \* 10000 \ \+ $required_minor \* 100 \+ $required_patch` available_swig_vernum=`expr $available_major \* 10000 \ \+ $available_minor \* 100 \+ $available_patch` if test $available_swig_vernum -lt $required_swig_vernum; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 1.3.21 is required. You have $swig_version." >&5 $as_echo "$as_me: WARNING: SWIG version >= 1.3.21 is required. You have $swig_version." >&2;} SWIG='' swig_found=no else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5 $as_echo_n "checking for SWIG library... " >&6; } SWIG_LIB=`$SWIG -swiglib` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5 $as_echo "$SWIG_LIB" >&6; } swig_found=yes fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 $as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} SWIG='' swig_found=no fi fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Set by ax_pkg_swig: " >&5 $as_echo "$as_me: Set by ax_pkg_swig: " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: swig_found = $swig_found " >&5 $as_echo "$as_me: swig_found = $swig_found " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG = $SWIG " >&5 $as_echo "$as_me: SWIG = $SWIG " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG_LIB = $SWIG_LIB " >&5 $as_echo "$as_me: SWIG_LIB = $SWIG_LIB " >&6;} fi if test "x$swig_found" == "xyes" -a "x$enable_some_python" == "xyes"; then : python_and_swig_found="yes" else python_and_swig_found="no" fi { $as_echo "$as_me:${as_lineno-$LINENO}: python_and_swig_found = $python_and_swig_found " >&5 $as_echo "$as_me: python_and_swig_found = $python_and_swig_found " >&6;} if test "x$enable_swig" == "xyes" -a "x$python_and_swig_found" != "xyes" ; then : as_fn_error $? "--enable-swig requires some version of Python elif its development package; then : and SWIG " "$LINENO" 5 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: Skipping SWIG check" >&5 $as_echo "$as_me: Skipping SWIG check" >&6;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG disabled, skipping checks for Python and SWIG..." >&5 $as_echo "$as_me: SWIG disabled, skipping checks for Python and SWIG..." >&6;} fi if test x"$enable_py2" = xyes; then ENABLE_PY2_TRUE= ENABLE_PY2_FALSE='#' else ENABLE_PY2_TRUE='#' ENABLE_PY2_FALSE= fi if test -z "$ENABLE_PY2_TRUE"; then : $as_echo "#define ENABLE_PY2 1" >>confdefs.h fi if test x"$enable_py3" = xyes; then ENABLE_PY3_TRUE= ENABLE_PY3_FALSE='#' else ENABLE_PY3_TRUE='#' ENABLE_PY3_FALSE= fi if test -z "$ENABLE_PY3_TRUE"; then : $as_echo "#define ENABLE_PY3 1" >>confdefs.h fi if test "x$enable_swig" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: Building with Python bindings" >&5 $as_echo "$as_me: Building with Python bindings" >&6;} if test "x$swig_found" == "xyes" -a "x$python_found" == "xyes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: pythondir = $pythondir " >&5 $as_echo "$as_me: pythondir = $pythondir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pkgpythondir = $pkgpythondir " >&5 $as_echo "$as_me: pkgpythondir = $pkgpythondir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pyexecdir = $pyexecdir " >&5 $as_echo "$as_me: pyexecdir = $pyexecdir " >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: pkgpyexecdir = $pkgpyexecdir " >&5 $as_echo "$as_me: pkgpyexecdir = $pkgpyexecdir " >&6;} : PYEXECDIR=$pyexecdir ac_config_files="$ac_config_files src/swig/pylocal" ac_config_files="$ac_config_files src/swig/set_pylocal_exec" fi if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: PY2_EXECDIR = $PY2_EXECDIR" >&5 $as_echo "$as_me: PY2_EXECDIR = $PY2_EXECDIR" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: PY3_EXECDIR = $PY3_EXECDIR" >&5 $as_echo "$as_me: PY3_EXECDIR = $PY3_EXECDIR" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: py2execdir = $py2execdir" >&5 $as_echo "$as_me: py2execdir = $py2execdir" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: py3execdir = $py3execdir" >&5 $as_echo "$as_me: py3execdir = $py3execdir" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: usr_py2execdir = $usr_py2execdir" >&5 $as_echo "$as_me: usr_py2execdir = $usr_py2execdir" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: usr_py3execdir = $usr_py3execdir" >&5 $as_echo "$as_me: usr_py3execdir = $usr_py3execdir" >&6;} fi if test -z "$PY2_EXECDIR" ; then : PY2_EXECDIR=${usr_py2execdir} fi if test -z "$PY3_EXECDIR" ; then : PY3_EXECDIR=${usr_py3execdir} fi py2execdir=$PY2_EXECDIR py3execdir=$PY3_EXECDIR if test 0$DBG -ne 0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: ====================== Wolf 8" >&5 $as_echo "$as_me: ====================== Wolf 8" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: py2execdir = $py2execdir" >&5 $as_echo "$as_me: py2execdir = $py2execdir" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: py3execdir = $py3execdir" >&5 $as_echo "$as_me: py3execdir = $py3execdir" >&6;} fi py2execdir=$py2execdir py3execdir=$py3execdir fi if test x$enable_swig == xyes; then ENABLE_PYTHON_SWIG_TRUE= ENABLE_PYTHON_SWIG_FALSE='#' else ENABLE_PYTHON_SWIG_TRUE='#' ENABLE_PYTHON_SWIG_FALSE= fi if test x$enable_py3 == xyes; then HAVE_PYTHON3_TRUE= HAVE_PYTHON3_FALSE='#' else HAVE_PYTHON3_TRUE='#' HAVE_PYTHON3_FALSE= fi if test x$enable_cython == xyes; then ENABLE_CYTHON_TRUE= ENABLE_CYTHON_FALSE='#' else ENABLE_CYTHON_TRUE='#' ENABLE_CYTHON_FALSE= fi if test x$enable_cffi == xyes; then ENABLE_CFFI_TRUE= ENABLE_CFFI_FALSE='#' else ENABLE_CFFI_TRUE='#' ENABLE_CFFI_FALSE= fi REQUIRED_PACKAGES=$required_packages ### Opsys variability { $as_echo "$as_me:${as_lineno-$LINENO}: checking target OS using /etc/os-release " >&5 $as_echo_n "checking target OS using /etc/os-release ... " >&6; } if grep suse /etc/os-release > /dev/null; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: target is SUSE" >&5 $as_echo "target is SUSE" >&6; } docdir=\${datarootdir}/doc/packages/\${PACKAGE_TARNAME} { $as_echo "$as_me:${as_lineno-$LINENO}: ..Forcing docdir to ${docdir} " >&5 $as_echo "$as_me: ..Forcing docdir to ${docdir} " >&6;} else { $as_echo "$as_me:${as_lineno-$LINENO}: result: target is not SUSE " >&5 $as_echo "target is not SUSE " >&6; } fi ### ### Generate output ### cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_ADL_COND_TRUE}" && test -z "${HAVE_ADL_COND_FALSE}"; then as_fn_error $? "conditional \"HAVE_ADL_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_SHARED_LIB_COND_TRUE}" && test -z "${ENABLE_SHARED_LIB_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_SHARED_LIB_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_SWIG_COND_TRUE}" && test -z "${ENABLE_SWIG_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_SWIG_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CYTHON_COND_TRUE}" && test -z "${ENABLE_CYTHON_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CYTHON_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CFFO_COND_TRUE}" && test -z "${ENABLE_CFFO_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CFFO_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_USB_COND_TRUE}" && test -z "${ENABLE_USB_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_USB_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DOXYGEN_COND_TRUE}" && test -z "${ENABLE_DOXYGEN_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DOXYGEN_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INCLUDE_TESTCASES_COND_TRUE}" && test -z "${INCLUDE_TESTCASES_COND_FALSE}"; then as_fn_error $? "conditional \"INCLUDE_TESTCASES_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CALLGRAPH_COND_TRUE}" && test -z "${ENABLE_CALLGRAPH_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CALLGRAPH_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_GOBJECT_COND_TRUE}" && test -z "${ENABLE_GOBJECT_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_GOBJECT_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_FAILSIM_COND_TRUE}" && test -z "${ENABLE_FAILSIM_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_FAILSIM_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_FORCE_SUSE_COND_TRUE}" && test -z "${ENABLE_FORCE_SUSE_COND_FALSE}"; then as_fn_error $? "conditional \"ENABLE_FORCE_SUSE_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_API_COND_TRUE}" && test -z "${USE_API_COND_FALSE}"; then as_fn_error $? "conditional \"USE_API_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LIBDRM_COND_TRUE}" && test -z "${USE_LIBDRM_COND_FALSE}"; then as_fn_error $? "conditional \"USE_LIBDRM_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_X11_COND_TRUE}" && test -z "${USE_X11_COND_FALSE}"; then as_fn_error $? "conditional \"USE_X11_COND\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_DOXYGEN_TRUE}" && test -z "${USE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"USE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DOCBASE_TRUE}" && test -z "${HAVE_DOCBASE_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOCBASE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PY2_TRUE}" && test -z "${ENABLE_PY2_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PY2\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PY3_TRUE}" && test -z "${ENABLE_PY3_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PY3\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PYTHON_SWIG_TRUE}" && test -z "${ENABLE_PYTHON_SWIG_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PYTHON_SWIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PYTHON3_TRUE}" && test -z "${HAVE_PYTHON3_FALSE}"; then as_fn_error $? "conditional \"HAVE_PYTHON3\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CYTHON_TRUE}" && test -z "${ENABLE_CYTHON_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CYTHON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CFFI_TRUE}" && test -z "${ENABLE_CFFI_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CFFI\" 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 ddcutil $as_me 0.8.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ ddcutil config.status 0.8.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # 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_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' 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" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/util/Makefile") CONFIG_FILES="$CONFIG_FILES src/util/Makefile" ;; "src/usb_util/Makefile") CONFIG_FILES="$CONFIG_FILES src/usb_util/Makefile" ;; "src/base/Makefile") CONFIG_FILES="$CONFIG_FILES src/base/Makefile" ;; "src/vcp/Makefile") CONFIG_FILES="$CONFIG_FILES src/vcp/Makefile" ;; "src/i2c/Makefile") CONFIG_FILES="$CONFIG_FILES src/i2c/Makefile" ;; "src/adl/Makefile") CONFIG_FILES="$CONFIG_FILES src/adl/Makefile" ;; "src/usb/Makefile") CONFIG_FILES="$CONFIG_FILES src/usb/Makefile" ;; "src/ddc/Makefile") CONFIG_FILES="$CONFIG_FILES src/ddc/Makefile" ;; "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;; "src/cmdline/Makefile") CONFIG_FILES="$CONFIG_FILES src/cmdline/Makefile" ;; "src/app_sysenv/Makefile") CONFIG_FILES="$CONFIG_FILES src/app_sysenv/Makefile" ;; "src/swig/Makefile") CONFIG_FILES="$CONFIG_FILES src/swig/Makefile" ;; "src/cython/Makefile") CONFIG_FILES="$CONFIG_FILES src/cython/Makefile" ;; "src/cffi/Makefile") CONFIG_FILES="$CONFIG_FILES src/cffi/Makefile" ;; "src/gobject_api/Makefile") CONFIG_FILES="$CONFIG_FILES src/gobject_api/Makefile" ;; "src/sample_clients/Makefile") CONFIG_FILES="$CONFIG_FILES src/sample_clients/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "docs/doxygen/Makefile") CONFIG_FILES="$CONFIG_FILES docs/doxygen/Makefile" ;; "ddcutil.pc") CONFIG_FILES="$CONFIG_FILES ddcutil.pc" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "docs/doxygen/doxyfile") CONFIG_FILES="$CONFIG_FILES docs/doxygen/doxyfile" ;; "docs/ddcutil-c-api") CONFIG_FILES="$CONFIG_FILES docs/ddcutil-c-api" ;; "src/swig/pylocal") CONFIG_FILES="$CONFIG_FILES src/swig/pylocal" ;; "src/swig/set_pylocal_exec") CONFIG_FILES="$CONFIG_FILES src/swig/set_pylocal_exec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options 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 static libraries. build_old_libs=$enable_static # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ddcutil $VERSION ============= libtool version ${LT_CURRENT}:${LT_REVISION}:${LT_AGE} prefix: ${prefix} datarootdir: ${datarootdir} datadir: ${datadir} docdir: ${docdir} mandir: ${mandir} adl_header_dir: ${adl_header_dir} enable_lib: ${enable_lib} enable_swig: ${enable_swig} enable_cython: ${enable_cython} enable_cffi: ${enable_cffi} enable_gobject ${enable_gobject} enable_usb: ${enable_usb} enable_drm: ${enable_drm} enable_x11: ${enable_x11} enable_doxygen: ${enable_doxygen} enable_failsim: ${enable_failsim} enable_use_api: ${enable_use_api} include_testcases: ${include_testcases} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} " >&5 $as_echo " ddcutil $VERSION ============= libtool version ${LT_CURRENT}:${LT_REVISION}:${LT_AGE} prefix: ${prefix} datarootdir: ${datarootdir} datadir: ${datadir} docdir: ${docdir} mandir: ${mandir} adl_header_dir: ${adl_header_dir} enable_lib: ${enable_lib} enable_swig: ${enable_swig} enable_cython: ${enable_cython} enable_cffi: ${enable_cffi} enable_gobject ${enable_gobject} enable_usb: ${enable_usb} enable_drm: ${enable_drm} enable_x11: ${enable_x11} enable_doxygen: ${enable_doxygen} enable_failsim: ${enable_failsim} enable_use_api: ${enable_use_api} include_testcases: ${include_testcases} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} " >&6; } ddcutil-0.8.6/configure.ac0000644000175000001440000011215713225105025012362 00000000000000# # ddcutil configure script # # Copyright 2014-2017 Sanford Rockowitz # # 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, see . dnl Note on comments: dnl Macro names in comments are written in lower case to avoid processing as actual macros ### ### Initial Setup ### AC_PREREQ([2.69]) m4_define([ddcutil_major_version], [0]) m4_define([ddcutil_minor_version], [8]) dnl temp micro version for development m4_define([ddcutil_micro_version], [6]) m4_define([ddcutil_version], [ddcutil_major_version.ddcutil_minor_version.ddcutil_micro_version]) dnl causes VERSION to be set in config.h AC_INIT([ddcutil], [ddcutil_version], [rockowitz@minsoft.com]) AC_ARG_VAR(DBG, [Turn on script debugging messages(0/1)]) dnl AC_MSG_NOTICE([DBG = |$DBG|]) AS_IF( [test 0$DBG -ne 0], AC_MSG_NOTICE([debug messages enabled]), AC_MSG_NOTICE([debug messages disabled]) ) dnl dnl uncomment the following line to enable debug messages from configure: dnl debug_config=yes dnl AS_IF( [ test -n "$debug_config"], dnl AC_MSG_NOTICE( [debug messages enabled ] ), dnl AC_MSG_NOTICE( [debug messages disabled] ) dnl ) AC_CONFIG_AUX_DIR(config) dnl sanity check: check for a unique file in source directory: AC_CONFIG_SRCDIR([src/util/coredefs.h]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) # removed from list: package/debian/changelog AC_CONFIG_FILES([ Makefile src/Makefile src/util/Makefile src/usb_util/Makefile src/base/Makefile src/vcp/Makefile src/i2c/Makefile src/adl/Makefile src/usb/Makefile src/ddc/Makefile src/test/Makefile src/cmdline/Makefile src/app_sysenv/Makefile src/swig/Makefile src/cython/Makefile src/cffi/Makefile src/gobject_api/Makefile src/sample_clients/Makefile man/Makefile data/Makefile docs/Makefile docs/doxygen/Makefile ddcutil.pc ], ) dnl AC_CONFIG_FILES(package/upload_obsrpm, [chmod +x package/upload_obsrpm] ) dnl dnl AC_CONFIG_FILES(package/build_dpkg, [chmod +x package/build_dpkg] ) dnl dnl cannot chmod on build_dpkg, upload_obsrpm, since they will not exist within dpkg build environment dnl not working, why? # AC_DEFINE_UNQUOTED([DDCUTIL_MAJOR_VERSION], [$ddcutil_major_version], [ddcutil major version]) dnl removed -Werror from AM_INIT_AUTOMAKE to allow compilation to proceed AM_INIT_AUTOMAKE([1.11 -Wall -Wno-extra-portability foreign subdir-objects]) dnl AM_SILENT_RULES defined as of automake 1.11, so don't need to test for macro's existence AM_SILENT_RULES([yes]) AM_PROG_AR dnl explicitly initialize pkg-config in case first call to pkg_check_modules is within an if test: PKG_PROG_PKG_CONFIG required_packages= AC_PROG_CC dnl This is an obsolescent macro that checks that the C compiler supports the -c and -o options together. dnl Note that, since Automake 1.14, the AC_PROG_CC is rewritten to implement such checks itself, and thus dnl the explicit use of AM_PROG_CC_C_O should no longer be required. dnl included in case running Automake 1.13, which is the case for SuSE 13.2 dnl but causes warning: macro 'AM_PROG_CC_C_0' not found in library on SUSE if included: dnl AM_PROG_CC_C_0 dnl but on Suse 13.2 w automake 1.13.4, get msg that dnl warning: warning: compiling 'base/common.c' in subdir requires 'AM_PROG_CC_C_O' in 'configure.ac' dnl needed for OBS AC_PROG_CC_STDC dnl AC_PROG_LIBTOOL, AM_PROG_LIBTOOL are deprecated names for older versions of LT_INIT dnl adds support for --enable/disable -static/shared, -with/without-pic configure flags LT_INIT([disable-static]) dnl Automatically update libtool script if it becomes out of date: AC_SUBST([LIBTOOL_DEPS]) ### ### Version specification ### # libtool versioning - applies to libddcutil # # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details # # increment; # CURRENT If the API or ABI interface has changed (reset REVISION to 0) # REVISION If the API and ABI remains the same, but bugs are fixed. # AGE backward compatibility (i.e. number of releases prior to current # for which this release is backward compatible) # # Alternative comments: # # Here are a set of rules to help you update your library version # information: # # 1. Start with version information of `0:0:0' for each libtool library. # 2. Update the version information only immediately before a public # release of your software. More frequent updates are unnecessary, and # only guarantee that the current interface number gets larger faster. # 3. If the library source code has changed at all since the last update, # then increment revision (`c:r:a' becomes `c:r+1:a'). # 4. If any interfaces have been added, removed, or changed since the last # update, increment current, and set revision to 0. # 5. If any interfaces have been added since the last public release, then # increment age. # 6. If any interfaces have been removed since the last public release, # then set age to 0. # # The LT_... values are used to create the argument for the --version-info parm. # Note that this parm is processed differently depending on operating system. # For Linux, the second and third fields in the shared object name's suffix are # taken directly from the command line, while the first is calculated as current-age. # For example, if LT_CURRENT=13, LT_REVISION=4, LT_AGE=4, the geneated parm # is --version-info "13:1:4", and the generated SO name looks like xxx.so.9.4.1 dnl Temporarily leave all fields 0 until first public release. LT_CURRENT=0 LT_REVISION=0 LT_AGE=0 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) dnl for debian/changelog - should do it some other way DEBIAN_RELEASE=1 DEBIAN_DISTRIBUTION=xenial AC_SUBST(DEBIAN_RELEASE) AC_SUBST(DEBIAN_DISTRIBUTION) ### ### Recognize command options for configure script ### ### Documented options AC_MSG_NOTICE( [Checking configure command options...] ) dnl *** configure option: --with-adl-headers AC_ARG_WITH([adl-headers], [ AS_HELP_STRING([--with-adl-headers=DIR], [Directory containing ADL header files]) ], [adl_header_dir=$withval], [adl_header_dir=[]]) AC_MSG_NOTICE([adl_header_dir = $adl_header_dir]) AS_IF( [test -n "$adl_header_dir"], AC_DEFINE( [HAVE_ADL], [1], [If defined, ADL headers are present. Build with ADL support.]) AC_MSG_NOTICE( [adl... enabled] ) , AC_MSG_NOTICE( [adl... disabled] ) ) AM_CONDITIONAL([HAVE_ADL_COND], [test -n "$adl_header_dir"] ) AC_SUBST([ADL_HEADER_DIR], [$adl_header_dir]) dnl *** configure option: --enable-lib AC_ARG_ENABLE([lib], [ AS_HELP_STRING([--enable-lib=@<:@yes/no@:>@], [Build shared library and clients@<:@default=yes@:>@] )], [enable_lib=${enableval}], [enable_lib=yes] ) dnl Set flag for automake.am: AM_CONDITIONAL([ENABLE_SHARED_LIB_COND], [test "x$enable_lib" == "xyes"] ) dnl ENABLE_SHARED_LIB_FLAG used in package/ddcutil_spec.in AS_IF([test "x$enable_lib" == "xyes"], AC_MSG_NOTICE( [lib... enabled] ) AC_SUBST(ENABLE_SHARED_LIB_FLAG, 1) , AC_MSG_NOTICE( [lib... disabled] ) AC_SUBST(ENABLE_SHARED_LIB_FLAG, 0) ) dnl Were we building SWIG support for more than Python, there would need to be 2 configuration option, dnl one to control SWIG and one to enable the Python bindings. dnl Since that day is far off, we have just 1 option to enable SWIG for Python dnl *** configure option: --enable-swig AC_ARG_ENABLE([swig], [ AS_HELP_STRING( [--enable-swig=@<:@no/yes@:>@], [Build SWIG interface@<:@default=no@:>@] )], [enable_swig=${enableval}], [enable_swig=no] ) dnl Set flag for automake.am: AM_CONDITIONAL([ENABLE_SWIG_COND], [test "x$enable_swig" == "xyes"] ) AS_IF([test "x$enable_swig" == "xyes"], AC_MSG_NOTICE( [swig... enabled] ), AC_MSG_NOTICE( [swig... disabled] ) ) dnl *** configure option: --enable-cython AC_ARG_ENABLE([cython], [ AS_HELP_STRING( [--enable-cython=@<:@no/yes@:>@], [Build cython interface@<:@default=no@:>@] )], [enable_cython=${enableval}], [enable_cython=no] ) dnl Set flag for automake.am: AM_CONDITIONAL([ENABLE_CYTHON_COND], [test "x$enable_cython" == "xyes"] ) AS_IF([test "x$enable_cython" == "xyes"], AC_MSG_NOTICE( [cython... enabled] ), AC_MSG_NOTICE( [cython... disabled] ) ) dnl *** configure option: --enable-cffi AC_ARG_ENABLE([cffi], [ AS_HELP_STRING( [--enable-cffi=@<:@no/yes@:>@], [Build cffi interface@<:@default=no@:>@] )], [enable_cffi=${enableval}], [enable_cffi=no] ) dnl Set flag for automake.am: AM_CONDITIONAL([ENABLE_CFFO_COND], [test "x$enable_cffi" == "xyes"] ) AS_IF([test "x$enable_cffi" == "xyes"], AC_MSG_NOTICE( [cffi... enabled] ), AC_MSG_NOTICE( [cffi... disabled] ) ) dnl TODO: Review dnl copied from tschoonj configure.ac snippet: https://gist.github.com/tschoonj/6441999 dnl #default behavior is to install the python bindings into subfolders of $prefix dnl #however, this may require the user to set the PYTHONPATH environment variable dnl #in order to avoid this, invoke configure with the --enable-python-integration option dnl AC_ARG_ENABLE([python-integration],[AS_HELP_STRING([--enable-python-integration],[install the python bindings in the interpreters site-packages folder])],[enable_python_integration=$enableval],[enable_python_integration=check]) dnl *** configure option: --enable-usb AC_ARG_ENABLE([usb], [ AS_HELP_STRING( [--enable-usb=@<:@yes/no@:>@], [Support USB connected displays@<:@default=yes@:>@] )], [enable_usb=${enableval}], [enable_usb=yes] ) AM_CONDITIONAL([ENABLE_USB_COND], [test "x$enable_usb" == "xyes"] ) dnl ENABLE_USB_FLAG used in package/ddcutil.apec.in AS_IF([test "x$enable_usb" == "xyes"], AC_DEFINE( [USE_USB], [1], [If defined, use usb.]) AC_SUBST( ENABLE_USB_FLAG, [1] ) AC_MSG_NOTICE( [usb... enabled] ) , AC_SUBST( ENABLE_USB_FLAG, [0] ) AC_MSG_NOTICE( [usb... disabled] ) ) dnl *** configure option: --enable-drm AC_ARG_ENABLE([drm], [ AS_HELP_STRING( [--enable-drm=@<:@yes/no@:>@], [Use DRM in diagnostics@<:@default=yes@:>@] )], [enable_drm=${enableval}], [enable_drm=yes] ) AS_IF([test "x$enable_drm" == "xyes"], AC_MSG_NOTICE( [drm... enabled (provisional) ] ) , AC_MSG_NOTICE( [drm... disabled] ) ) dnl *** configure option: --enable-x11 AC_ARG_ENABLE([x11], [ AS_HELP_STRING( [--enable-x11=@<:@yes/no@:>@], [Use X11 in diagnostics@<:@default=yes@:>@] )], [enable_x11=${enableval}], [enable_x11=yes] ) AS_IF([test "x$enable_x11" == "xyes"], AC_MSG_NOTICE( [x11... enabled] ) , AC_MSG_NOTICE( [x11... disabled] ) ) dnl *** configure option: --enable-doxygen AC_ARG_ENABLE([doxygen], [ AS_HELP_STRING( [--enable-doxygen=@<:@no/yes@:>@], [Build API documentation using Doxygen (if it is installed)@<:@default=no@:>@] )], [enable_doxygen=${enableval}], [enable_doxygen=no] ) AM_CONDITIONAL([ENABLE_DOXYGEN_COND], [test "x$enable_doxygen" == "xyes"] ) AS_IF([test "x$enable_doxygen" == "xyes"], AC_MSG_NOTICE( [doxygen... enabled] ) , AC_MSG_NOTICE( [doxygen... disabled] ) ) ### Private options dnl *** configure option: --enable-testcases AC_ARG_ENABLE([testcases], [ AS_HELP_STRING( [--enable-testcases=@<:@no/yes@:>@], [Include test cases @<:@default=no@:>@] )], [include_testcases=${enableval}], [include_testcases=no] ) AM_CONDITIONAL([INCLUDE_TESTCASES_COND], [test "x$include_testcases" == "xyes"] ) AS_IF([test "x$include_testcases" == "xyes"], AC_DEFINE( [INCLUDE_TESTCASES], [1], [If defined, build with test cases.]) AC_MSG_NOTICE( [testcases... enabled] ) , AC_MSG_NOTICE( [testcases... disabled] ) ) dnl *** configure option: --enable-callgraph AC_ARG_ENABLE([callgraph], [ AS_HELP_STRING( [--enable-callgraph=@<:@no/yes@:>@], [Create .expand files for static call graph@<:@default=no@:>@] )], [enable_callgraph=${enableval}], [enable_callgraph=no] ) AM_CONDITIONAL([ENABLE_CALLGRAPH_COND], [test "x$enable_callgraph" == "xyes"] ) AS_IF([test "x$enable_callgraph" == "xyes"], AC_MSG_NOTICE( [callgraph... enabled] ), AC_MSG_NOTICE( [callgraph... disabled] ) ) dnl GObject implementation has been mothballed. dnl TODO: delete or comment out this section dnl *** configure option: --enable-gobject-api AC_ARG_ENABLE([gobject-api], [ AS_HELP_STRING( [--enable-gobject-api=@<:@no/yes@:>@], [Build gobject related files, typelib@<:@default=no@:>@] )], [enable_gobject=${enableval}], [enable_gobject=no] ) AM_CONDITIONAL([ENABLE_GOBJECT_COND], [test "x$enable_gobject" == "xyes"] ) AS_IF([test "x$enable_gobject" == "xyes"], AC_MSG_NOTICE( [gobject-api... enabled] ), AC_MSG_NOTICE( [gobject-api... disabled] ) ) dnl *** configure option: --enable-failsim AC_ARG_ENABLE([failsim], [ AS_HELP_STRING( [--enable-failsim=@<:@no/yes@:>@], [Build with failure simulation@<:@default=no@:>@] )], [enable_failsim=${enableval}], [enable_failsim=no] ) AM_CONDITIONAL([ENABLE_FAILSIM_COND], [test "x$enable_failsim" == "xyes"] ) AS_IF( [test "x$enable_failsim" == "xyes"], AC_DEFINE( [ENABLE_FAILSIM], [1], [If defined, enable failsim.]) AC_MSG_NOTICE( [failsim..... enabled] ) , AC_MSG_NOTICE( [failsim..... disabled] ) ) dnl *** configure option: --enable-force-suse AC_ARG_ENABLE([force-suse], [ AS_HELP_STRING( [--enable-force-suse=@<:@no/yes@:>@], [Force SUSE target directories@<:@default=no@:>@] )], [enable_force_suse=${enableval}], [enable_force_suse=no] ) AM_CONDITIONAL([ENABLE_FORCE_SUSE_COND], [test "x$enable_force_suse" == "xyes"] ) AS_IF( [test "x$enable_force_suse" == "xyes"], AC_DEFINE( [ENABLE_FORCE_SUSE], [1], [If defined, force SUSE target directories.]) AC_MSG_NOTICE( [force-suse..... enabled] ) , AC_MSG_NOTICE( [force-suse..... disabled] ) ) dnl *** configure option: --enable-internal-api-use AC_ARG_ENABLE([use-api], [ AS_HELP_STRING( [--enable-internal-api-use=@<:@no/yes@:>@], [Use ddcutil API internally@<:@default=no@:>@] )], [enable_use_api=${enableval}], [enable_use_api=no] ) AM_CONDITIONAL([USE_API_COND], [test "x$enable_use_api" == "xyes"] ) AS_IF( [test "x$enable_use_api" == "xyes"], AC_DEFINE( [USE_API], [1], [If defined, use ddcutil APIs internally.]) AC_MSG_NOTICE( [use-api..... enabled] ) , AC_MSG_NOTICE( [use-api..... disabled] ) ) dnl Note to self: use autoheader to regenerate config.h.in whenever new defines added ### ### Checks for typedefs, structures, and compiler characteristics. ### AC_CHECK_HEADER_STDBOOL AC_C_INLINE AC_C_BIGENDIAN AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT8_T ### ### Checks for standard library functions. ### AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_STRERROR_R AC_CHECK_FUNCS([clock_gettime memset nl_langinfo stpcpy strchr strdup strerror strrchr strtol]) dnl The dlopen() function is in the C library for *BSD and in dnl libdl on GLIBC-based systems AC_SEARCH_LIBS([dlopen], [dl dld], [], [ AC_MSG_ERROR([unable to find the dlopen() function]) ]) ### ### Checks for header files. ### AC_CHECK_HEADERS([fcntl.h langinfo.h libintl.h limits.h stdint.h stdlib.h string.h sys/ioctl.h termios.h unistd.h wchar.h dlfcn.h]) dnl i2c-dev.h is in linux-headers dnl i2c-dev.h not found: dnl AC_CHECK_HEADERS([i2c-dev.h]) ### ### Required library tests ### dnl Notes on pkg_check_modules: dnl 1) appends to xxx_CFLAGS and xxx_LIBS the output of pkg-config --cflags|--lib dnl 2) if no action-if-false branch defined, pkg_check_modules terminates execution if not found dnl was 2.36, can we drop this to 2.14 to allow for Debian 7.0 dnl 9/2017: need >= 2.32 for g_thread_...() functions PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.32) required_packages="$required_packages glib-2.0 >= 2.32" dnl Not currently used dnl PKG_CHECK_MODULES(OSINFO, libosinfo-1.0 >= 0.1, [libosinfo_found=yes], [libosinfo_found=no]) PKG_CHECK_MODULES(UDEV, libudev, [libudev_found=1], [libudev_found=0 AC_MSG_NOTICE( [The package providing libudev.h varies by Linux distribution and release.] ) AC_MSG_NOTICE( [It may be a udev specific package, e.g. libudev-dev, libudev-devel] ) AC_MSG_NOTICE( [or it may be part of systemd, e.g systemd-devel] ) AC_MSG_ERROR( [libudev not found] ) ] ) required_packages="$required_packages xrandr x11" dnl how to handle libudev? punt for now dnl disabled because systemd_util.c no longer needed: dnl PKG_CHECK_MODULES(SYSTEMD, libsystemd) ### ### Optional library tests ### dnl TODO: use consistent pattern ### libusb dnl know that 1.0.8 fails, 1.0.20 works AS_IF([test "x$enable_usb" == "xyes"], [ PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.15, [libusb_found=yes] ) ], [ AC_MSG_NOTICE( [usb disabled, not checking for libusb] ) ] ) dnl Logically, these debug messages belong within the $enable_usb test, but the dnl nested brackests make the code hard to read. It's LISP all over again. AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [LIBUSB_CFLAGS: $LIBUSB_CFLAGS] ) AC_MSG_NOTICE( [LIBUSB_LIBS: $LIBUSB_LIBS] ) ]) ### libdrm AS_IF([test "x$enable_drm" == "xyes"], [ PKG_CHECK_MODULES(LIBDRM, libdrm >= 2.4.67, [libdrm_found=yes], [libdrm_found=no AC_MSG_WARN( [libdrm >= 2.4.67 not found. Forcing --disable-drm]) enable_drm=no ] ) ], [ AC_MSG_NOTICE( [drm disabled, not checking for libdrm] ) ] ) AM_CONDITIONAL([USE_LIBDRM_COND], [test "x$enable_drm" == "xyes"] ) AS_IF([test "x$enable_drm" == "xyes"], AC_DEFINE([USE_LIBDRM], [1], [Use libdrm]) AC_MSG_NOTICE( [drm... enabled] ) , AC_MSG_NOTICE( [drm... disabled] ) ) AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [LIBDRM_CFLAGS: $LIBDRM_CFLAGS] ) AC_MSG_NOTICE( [LIBDRM_LIBS: $LIBDRM_LIBS] ) ]) ### X11 dnl PKG_CHECK_MODULES(XRANDR, xrandr) dnl PKG_CHECK_MODULES(X11, x11) AS_IF([test "x$enable_x11" == "xyes"], [ PKG_CHECK_MODULES(LIBX11, x11) ]) AM_CONDITIONAL([USE_X11_COND], [test "x$enable_x11" == "xyes"] ) AS_IF([test "x$enable_x11" == "xyes"], AC_DEFINE([USE_X11], [1], [Use X11]) AC_MSG_NOTICE( [x11... enabled] ) , AC_MSG_NOTICE( [x11... disabled] ) ) AS_IF([test "x$enable_x11" == "xyes"], [ PKG_CHECK_MODULES(XRANDR, xrandr) ]) dnl Note cflags and libs, but don't need to use in makefiles AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [LIBX11_CFLAGS: $LIBX11_CFLAGS] ) AC_MSG_NOTICE( [LIBX11_LIBS: $LIBX11_LIBS] ) ]) ### DOXYGEN dnl AC_MSG_NOTICE([Start of DOXYGEN]) dnl AS_IF( [test "x$enable_doxygen" == "xyes"], dnl AC_MSG_NOTICE( [doxygen... enabled] ) dnl , dnl AC_MSG_NOTICE( [doxygen... disabled] ) dnl ) AS_IF([test "x$enable_doxygen" == "xyes"], [ dnl checks for doxygen program, sets or uses environment variable DOXYGEN AC_MSG_NOTICE([Checking for Doxygen...]) FLM_PROG_TRY_DOXYGEN AS_IF( [test -n $DOXYGEN], [ AC_MSG_NOTICE([Calling dx_init_doxygen...]) DX_PDF_FEATURE(ON) DX_HTML_FEATURE(ON) DX_INIT_DOXYGEN(ddcutil) AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE([Set by dx_init_doxygen:]) AC_MSG_NOTICE([ DOXYGEN: $DOXYGEN ]) AC_MSG_NOTICE([ dx_DOT_FEATURE: $DX_DOT_FEATURE ]) AC_MSG_NOTICE([ dx_FEATURE_doc $DX_FEATURE_doc ]) AC_MSG_NOTICE([ dx_DOXYGEN_FEATURE: $DX_DOXYGEN_FEATURE ]) AC_MSG_NOTICE([ dx_HTML_FEATURE: $DX_HTML_FEATURE ]) AC_MSG_NOTICE([ dx_FLAG_html: $DX_FLAG_HTML ]) AC_MSG_NOTICE([ dx_PDF_FEATURE: $DX_PDF_FEATURE ]) AC_MSG_NOTICE([ DX_PROJECT: $DX_PROJECT ]) AC_MSG_NOTICE([ DX_CONFIG: $DX_CONFIG ]) AC_MSG_NOTICE([ DX_DOCDIR: $DX_DOCDIR ]) ]) AC_CONFIG_FILES( [docs/doxygen/doxyfile] ) ] , [ AC_MSG_NOTICE([doxygen not found]) enable_doxygen=no ] ) ] , [ AC_MSG_NOTICE([doxygen disabled, not checking for Doxygen]) ] ) dnl AC_MSG_NOTICE([enable_doxygen = ${enable_doxygen}]) dnl AM_CONDITIONAL( [HAVE_DOXYGEN], [test -n "$DOXYGEN"] ) dnl AM_CONDITIONAL( [USE_DOXYGEN], [test -n "$DOXYGEN" -a "x$enable_doxygen" == "xyes"]) AM_CONDITIONAL( [USE_DOXYGEN], [test "x$enable_doxygen" == "xyes"]) AM_COND_IF([USE_DOXYGEN], AC_MSG_NOTICE([USE_DOXYGEN is set]) , AC_MSG_NOTICE([USE_DOXYGEN not set]) ) ### DOC-BASE dnl n. doc-base is Debain specific dnl doc-base doesn't have pc file. AC_CHECK_PROGS( [DOCBASE_INSTALL_DOCS], [install-docs]) AS_IF( [test -n "$DOCBASE_INSTALL_DOCS"], AC_MSG_NOTICE([doc-base execuable found]) AC_CONFIG_FILES([docs/ddcutil-c-api]), AC_MSG_WARN([doc-base not installed - continuing without doc-base support]) ) AM_CONDITIONAL( [HAVE_DOCBASE], [test -n "$DOCBASE_INSTALL_DOCS"]) ### GObject # Vestigial. GObject interface no longer being developed. m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [GOBJECT_INTROSPECTION_CHECK([1.30.0])]) AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = xyes) AS_IF([test "x$enable_gobject" == "xyes"], [ PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.14) ], ) ### Library AS_IF([test "x$enable_lib" == "xyes"], [ PKG_CHECK_MODULES(ZLIB, zlib) ], ) ### Python and SWIG dnl Locate SWIG and PYTHON in case we need them dnl Python integration is a mess. See for example: dnl https://tschoonj.github.io/blog/2013/09/04/building-libtool-modules-python-bindings/ dnl https://gist.github.com/tschoonj/6441999 dnl https://lists.ubuntu.com/archives/ubuntu-devel/2009-February/027439.html dnl https://bugzilla.redhat.com/show_bug.cgi?id=533920 dnl Some of the issues: dnl - Python 3 is a distint language from Python 2, yet AM_PYTHON treats it as an upwardly dnl compatible version Python 2. dnl - How to build for multiple version fo Python 2 and Python 3? dnl - Debian (and derivatives such as Ubuntu) have modified the directory scheme. dnl Directory names end with dist-packags instead of site-packages. dnl But this is incompletely implemented. sysconfig.get_path() returns names dnl ending with site-package on python 3 dnl - sys.path is built using calls to site.get_site_packages(). But this function dnl hardcodes the paths. There is no reference to sysconfig.get_path() or dnl distusils.sysconfig_get_python_lib(). So code that relies on the latter functions dnl can return a library that is not in sys.path dnl - Where do local extensions to the distribution version of Python belong? dnl In a ditrectory under /usr/local or under /usr? dnl - pkg-config names can vary. dnl Fedora 25: python and python2 refer to current Python2 dnl python3, python-3.5, python-3.5m refer to current Python 3 dnl openSUSE 42.2: dnl python3 not defined, python-3.4 refers to current Python 3 dnl So need to know the version number of Python 3 to construct a name dnl to pass to pkg-config AS_IF( [ test "x$enable_swig" == "xyes" || test "x$enable_cython" == "xyes" || test "x$enable_cffi" == "xyes" ], [ AC_MSG_NOTICE( [SWIG, Cython, or CFFI enabled, checking for Python and SWIG...] ) # Python 3 AC_MSG_NOTICE( [Calling ax_path_python3 for Python 3...] ) AX_PATH_PYTHON3(3.1, [python3_found=yes], [python_found3=no]) AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [Set by ax_path_python3 for python3:] ) AC_MSG_NOTICE( [ python3_found = $python3_found] ) AC_MSG_NOTICE( [ PYTHON3 = $PYTHON3] ) AC_MSG_NOTICE( [ PYTHON3_VERSION = $PYTHON3_VERSION] ) AC_MSG_NOTICE( [ PYTHON3_PREFIX = $PYTHON3_PREFIX] ) AC_MSG_NOTICE( [ PYTHON3_EXEC_PREFIX = $PYTHON3_EXEC_PREFIX] ) AC_MSG_NOTICE( [ python3dir = $python3dir] ) AC_MSG_NOTICE( [ pkgpython3dir = $pkgpython3dir] ) AC_MSG_NOTICE( [ py3execdir = $py3execdir] ) AC_MSG_NOTICE( [ pkgpy3execdir = $pkgpy3execdir] ) ]) AS_IF( [test "x$python3_found" == "xyes" ], [ AC_MSG_NOTICE( [Looking for Python 3 pkgconfig information...] ) PKG_CHECK_MODULES([PY3], [python-$PYTHON3_VERSION], [ enable_py3="yes" AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [ PY3_CFLAGS = $PY3_CFLAGS ]) AC_MSG_NOTICE( [ PY3_LIBS = $PY3_LIBS ]) ]) dnl PY3_CFLAGS and PY3_LIBS are precious, no need to AC_SUBST() AC_SUBST(PY3_CFLAGS) AC_SUBST(PY3_LIBS) ],[ AC_MSG_WARN([Building without Python 3 support]) python3_found="no" enable_py3="no" ]) ],[ AC_MSG_NOTICE( [Skipping check for Python3 pkgconfig] ) ]) AS_IF( [test "x$enable_py3" == "xyes" ], [ AX_PYTHON_ENV($PYTHON3) AC_MSG_NOTICE([PY3_EXTRA_LDFLAGS: $PY3_EXTRA_LDFLAGS]) AC_MSG_NOTICE([PY3_EXTRA_LIBS $PY3_EXTRA_LIBS]) AC_MSG_NOTICE([usr_py3execdir: $usr_py3execdir]) dnl AC_SUBST() unnecessary, precious variables AC_SUBST(PY3_EXTRA_LDFLAGS) AC_SUBST(PY3_EXTRA_LIBS) ]) # Python 2 AC_MSG_NOTICE( [Calling am_path_python for Python 2...] ) AM_PATH_PYTHON(2.6, [python_found=yes], [python_found=no]) AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [Set by am_path_python:] ) AC_MSG_NOTICE( [ python_found = $python_found] ) AC_MSG_NOTICE( [ PYTHON = $PYTHON] ) AC_MSG_NOTICE( [ PYTHON_VERSION = $PYTHON_VERSION] ) AC_MSG_NOTICE( [ PYTHON_PREFIX = $PYTHON_PREFIX] ) AC_MSG_NOTICE( [ PYTHON_EXEC_PREFIX = $PYTHON_EXEC_PREFIX] ) AC_MSG_NOTICE( [ pythondir = $pythondir] ) AC_MSG_NOTICE( [ pkgpythondir = $pkgpythondir] ) AC_MSG_NOTICE( [ pyexecdir = $pyexecdir] ) AC_MSG_NOTICE( [ pkgpyexecdir = $pkgpyexecdir] ) ]) AS_IF( [ test "x$python_found" == "xyes"], [ AM_PYTHON_CHECK_VERSION($PYTHON, [3.0], [ AC_MSG_NOTICE( [No Python 2.x found]) python_found = "no" ]) ]) AS_IF( [test "x$python_found" == "xyes" ], [ AC_MSG_NOTICE( [Looking for Python2 pkgconfig information...] ) PKG_CHECK_MODULES([PY2], [python-$PYTHON_VERSION], [ enable_py2="yes" AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [Set by pkg_check_modules: ] ) AC_MSG_NOTICE( [ PY2_CFLAGS = $PY2_CFLAGS ] ) AC_MSG_NOTICE( [ PY2_LIBS = $PY2_LIBS ] ) ]) dnl unnecessary, precious AC_SUBST(PY2_CFLAGS, $PY2_CFLAGS) AC_SUBST(PY2_LIBS, $PY2_LIBS) ],[ AC_MSG_WARN([Building without Python 2 support]) python2_found="no" enable_py2="no" ]) ],[ AC_MSG_NOTICE( [Skipping check for Python2 pkgconfig] ) ]) AS_IF( [test "x$enable_py2" == "xyes" ], [ AX_PYTHON_ENV($PYTHON) AC_MSG_NOTICE([PY2_EXTRA_LDFLAGS: $PY2_EXTRA_LDFLAGS]) AC_MSG_NOTICE([PY2_EXTRA_LIBS $PY3_EXTRA_LIBS]) AC_MSG_NOTICE([usr_py2execdir: $usr_py2execdir]) AC_MSG_NOTICE([alt_py2execdir: $alt_py2execdir]) dnl precious variables AC_SUBST(PY2_EXTRA_LDFLAGS) AC_SUBST(PY2_EXTRA_LIBS) ]) # SWIG dnl enable_py2=no dnl enable_py3=no dnl AC_MSG_NOTICE( [enable_py2: $enable_py2" ]) dnl AC_MSG_NOTICE( [enable_py3: $enable_py3" ]) AS_IF( [ test "x$enable_py2" == "xyes" -o "x$enable_py3" == "xyes"], enable_some_python="yes" ) AC_MSG_NOTICE( [ enable_some_python: $enable_some_python ]) AS_IF( [ test "x$enable_swig" == "xyes" ], [ AS_IF( [test "x$enable_some_python" == "xyes"], [ AC_MSG_NOTICE( [Calling ax_pkg_swig...] ) dnl ax_pkg_swig respects SWIG_LIB, but overrides SWIG, so don't expose the possibility of overriding dnl AC_ARG_VAR(SWIG, [swig executable]) dnl AC_ARG_VAR(SWIG_LIB, [linker flags for swig]) dnl AC_MSG_NOTICE( [Before ax_pkg_swig:] ) dnl AC_MSG_NOTICE( [ SWIG = $SWIG ] ) dnl AC_MSG_NOTICE( [ SWIG_LIB = $SWIG_LIB ]) AX_PKG_SWIG(1.3.21, [swig_found=yes], [swig_found=no]) AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [Set by ax_pkg_swig:] ) AC_MSG_NOTICE( [ swig_found = $swig_found] ) AC_MSG_NOTICE( [ SWIG = $SWIG ] ) AC_MSG_NOTICE( [ SWIG_LIB = $SWIG_LIB ]) ]) dnl AX_SWIG_MULTI_MODULE_SUPPORT dnl dnl n.b. will fail if python2 not installed dnl dnl AX_PYTHON_DEVEL Calls AC_PATH_PROG() to find $PYTHON, fails if python not found dnl dnl PYTHON_SITE_PKG_EXEC set only in _alt version: dnl AS_IF( [test "x$python_found" == "xyes" ], [ dnl AC_MSG_NOTICE( [Calling ax_python_devel for informational purposes...]) dnl AX_PYTHON_DEVEL dnl AS_IF( [test 0$DBG -ne 0], [ dnl AC_MSG_NOTICE( [From ax_python_devel or ac_python_devel_alt.. ] ) dnl AC_MSG_NOTICE( [ PYTHON_CPPFLAGS = $PYTHON_CPPFLAGS ] ) dnl AC_MSG_NOTICE( [ PYTHON_SITE_PKG = $PYTHON_SITE_PKG ] ) dnl AC_MSG_NOTICE( [From ax_python_devel only ... ] ) dnl AC_MSG_NOTICE( [ PYTHON_LIBS = $PYTHON_LIBS ] ) dnl AC_MSG_NOTICE( [ PYTHON_EXTRA_LDFLAGS = $PYTHON_EXTRA_LDFLAGS ] ) dnl AC_MSG_NOTICE( [ PYTHON_EXTRA_LIBS = $PYTHON_EXTRA_LIBS ] ) dnl AC_MSG_NOTICE( [From ax_python_devel_alt only ... ] ) dnl AC_MSG_NOTICE( [ PYTHON_LDFLAGS = $PYTHON_LDFLAGS ] ) dnl AC_MSG_NOTICE( [ PYTHON_SITE_PKG_EXEC = $PYTHON_SITE_PKG_EXEC ] ) dnl AC_MSG_NOTICE( [ PYTHON_CFLAGS = $PYTHON_CFLAGS] ) dnl ]) dnl ]) dnl dnl n. AX_SWIG_PYTHON does AC_REQUIRE of AX_PKG_SWIG, AX_PYTHON_DEVEL dnl dnl AC_MSG_NOTICE( [Calling ax_swig_python...] ) dnl AX_SWIG_PYTHON dnl AS_IF( [test 0$DBG -ne 0], [ dnl AC_MSG_NOTICE( [ Set by ax_swig_python:] ) dnl AC_MSG_NOTICE( [ AX_SWIG_PYTHON_CPPFLAGS = $AX_SWIG_PYTHON_CPPFLAGS ] ) dnl AC_MSG_NOTICE( [ AX_SWIG_PYTHON_OPT = $AX_SWIG_PYTHON_OPT ] ) dnl AC_MSG_NOTICE( [ AX_SWIG_PYTHON_LIBS = $AX_SWIG_PYTHON_LIBS ] ) dnl ]) AS_IF([ test "x$swig_found" == "xyes" -a "x$enable_some_python" == "xyes"], [ python_and_swig_found="yes"], [ python_and_swig_found="no"] ) AC_MSG_NOTICE( [python_and_swig_found = $python_and_swig_found ]) AS_IF([test "x$enable_swig" == "xyes" -a "x$python_and_swig_found" != "xyes" ] , AC_MSG_ERROR( [--enable-swig requires some version of Python, its development package, and SWIG] ) ) ], []) ],[ AC_MSG_NOTICE([Skipping SWIG check]) ]) ], [ AC_MSG_NOTICE( [SWIG disabled, skipping checks for Python and SWIG...]) ]) AM_CONDITIONAL([ENABLE_PY2], [test x"$enable_py2" = xyes]) AM_COND_IF([ENABLE_PY2], [AC_DEFINE([ENABLE_PY2], [1], [Python2 is enabled])]) AM_CONDITIONAL([ENABLE_PY3], [test x"$enable_py3" = xyes]) AM_COND_IF([ENABLE_PY3], [AC_DEFINE([ENABLE_PY3], [1], [Python3 is enabled])]) dnl AC_MSG_NOTICE([prefix = ${prefix}]) dnl AC_MSG_NOTICE(ac_default_[prefix = ${ac_default_prefix}]) dnl AX_FIX_PYTHON_PATH($PYTHON, [pyexecdir], $pyexecdir, $prefix) if test "x$enable_swig" = "xyes" ; then AC_MSG_NOTICE([Building with Python bindings]) dnl if test "x$enable_python_integration" = xyes ; then dnl pythondir=$PYTHON_SITE_PKG dnl pyexecdir=$PYTHON_SITE_PKG_EXEC dnl fi dnl AC_SUBST(PYTHONDIR, $pythondir) dnl AC_SUBST(PKGPYTHONDIR, $pkgpythondir) dnl AC_SUBST(PYEXECDIR, $pyexecdir) dnl AC_SUBST(PKGPYEXECDIR, $pkgpyexecdir) AS_IF([ test "x$swig_found" == "xyes" -a "x$python_found" == "xyes"], AC_MSG_NOTICE( [pythondir = $pythondir] ) AC_MSG_NOTICE( [pkgpythondir = $pkgpythondir] ) AC_MSG_NOTICE( [pyexecdir = $pyexecdir] ) AC_MSG_NOTICE( [pkgpyexecdir = $pkgpyexecdir] ) : AC_SUBST(PYEXECDIR,$pyexecdir) AC_CONFIG_FILES( [src/swig/pylocal] ) AC_CONFIG_FILES( [src/swig/set_pylocal_exec] ) ) AC_ARG_VAR([PY2_EXECDIR], [Python 2 C extension directory]) AC_ARG_VAR([PY3_EXECDIR], [Python 3 C extension directory]) AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [PY2_EXECDIR = $PY2_EXECDIR]) AC_MSG_NOTICE( [PY3_EXECDIR = $PY3_EXECDIR]) AC_MSG_NOTICE( [py2execdir = $py2execdir]) AC_MSG_NOTICE( [py3execdir = $py3execdir]) AC_MSG_NOTICE( [usr_py2execdir = $usr_py2execdir]) AC_MSG_NOTICE( [usr_py3execdir = $usr_py3execdir]) ]) AS_IF( [ test -z "$PY2_EXECDIR" ], [ PY2_EXECDIR=${usr_py2execdir} ] ) AS_IF( [ test -z "$PY3_EXECDIR" ], [ PY3_EXECDIR=${usr_py3execdir} ] ) py2execdir=$PY2_EXECDIR py3execdir=$PY3_EXECDIR AS_IF( [test 0$DBG -ne 0], [ AC_MSG_NOTICE( [====================== Wolf 8]) AC_MSG_NOTICE( [py2execdir = $py2execdir]) AC_MSG_NOTICE( [py3execdir = $py3execdir]) ]) AC_SUBST(py2execdir, $py2execdir) AC_SUBST(py3execdir, $py3execdir) fi AM_CONDITIONAL([ENABLE_PYTHON_SWIG],[test x$enable_swig == xyes]) dnl temporary crude flag: AM_CONDITIONAL([HAVE_PYTHON3], [test x$enable_py3 == xyes]) dnl temporary crude flag: AM_CONDITIONAL([ENABLE_CYTHON],[test x$enable_cython == xyes]) AM_CONDITIONAL([ENABLE_CFFI], [test x$enable_cffi == xyes]) dnl AC_MSG_NOTICE([======================== required_packages: $required_packages]) AC_SUBST(REQUIRED_PACKAGES,$required_packages) ### Opsys variability dnl Fails: if building in OBS, SUSE is in /proc/version, even when building for Fedora dnl TODO: do not modify if explicitly set dnl AC_MSG_NOTICE([Original docdir: ${docdir}]) dnl AS_IF( [ grep SUSE /proc/version ], [ dnl AC_MSG_NOTICE( [IS SUSE]) dnl docdir=\${datarootdir}/doc/packages/\${PACKAGE_TARNAME} dnl ], [ dnl AC_MSG_NOTICE( [NOT SUSE] ) dnl ] ) dnl AC_MSG_NOTICE([======> Tests for SUSE target:]) dnl test using [ grep SUSE /proc/version ] dnl always tests true on OBS, i.e reports the OS on which the build system is running, not the target os dnl test using [ ls -d /usr/share/doc/packages ] dnl always tests true on OBS dnl test using [test "x$enable_force_suse" == "xyes"], i.e. enable-force_suse parm passed to configure dnl works dnl test using [ grep suse /etc/os-release ] dnl successfully detects target OS when run on OBS dnl test using [lsb-release -i | grep SUSE ] dnl on OBS, command not found AC_MSG_CHECKING( [target OS using /etc/os-release] ) AS_IF( [ grep suse /etc/os-release > /dev/null], [ AC_MSG_RESULT( [target is SUSE]) docdir=\${datarootdir}/doc/packages/\${PACKAGE_TARNAME} AC_MSG_NOTICE( [..Forcing docdir to ${docdir}] ) ], [ AC_MSG_RESULT( [target is not SUSE ] ) ] ) ### ### Generate output ### AC_OUTPUT dnl a brief summary AC_MSG_RESULT([ ddcutil $VERSION ============= libtool version ${LT_CURRENT}:${LT_REVISION}:${LT_AGE} prefix: ${prefix} datarootdir: ${datarootdir} datadir: ${datadir} docdir: ${docdir} mandir: ${mandir} adl_header_dir: ${adl_header_dir} enable_lib: ${enable_lib} enable_swig: ${enable_swig} enable_cython: ${enable_cython} enable_cffi: ${enable_cffi} enable_gobject ${enable_gobject} enable_usb: ${enable_usb} enable_drm: ${enable_drm} enable_x11: ${enable_x11} enable_doxygen: ${enable_doxygen} enable_failsim: ${enable_failsim} enable_use_api: ${enable_use_api} include_testcases: ${include_testcases} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} ]) ddcutil-0.8.6/aclocal.m40000644000175000001440000017631313230166404011744 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- dnl serial 11 (pkg-config-0.29.1) dnl 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 # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Copyright (C) 2011-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_AR([ACT-IF-FAIL]) # ------------------------- # Try to determine the archiver interface, and trigger the ar-lib wrapper # if it is needed. If the detection of archiver interface fails, run # ACT-IF-FAIL (default is to abort configure with a proper error message). AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([ar-lib])dnl AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) : ${AR=ar} AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], [AC_LANG_PUSH([C]) am_cv_ar_interface=ar AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a ]) AC_LANG_POP([C])]) case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # 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__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) m4_default([$1], [AC_MSG_ERROR([could not determine $AR interface])]) ;; esac AC_SUBST([AR])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_COND_IF -*- Autoconf -*- # Copyright (C) 2008-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_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-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_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 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 dnl python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 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. Getting [:3] seems to be dnl the best way to do this; it's what "site.py" does in the standard dnl library. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) 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-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_path_python3.m4]) m4_include([m4/ax_pkg_swig.m4]) m4_include([m4/ax_prog_doxygen.m4]) m4_include([m4/ax_python_env.m4]) m4_include([m4/flm_prog_try_doxygen.m4]) m4_include([m4/introspection.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]) ddcutil-0.8.6/Makefile.in0000644000175000001440000010715713230171236012150 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 = ddcutil.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = src man data docs am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/ddcutil.pc.in $(top_srcdir)/config/ar-lib \ $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \ $(top_srcdir)/config/missing AUTHORS COPYING ChangeLog \ config/ar-lib config/compile config/config.guess \ config/config.sub config/depcomp config/install-sh \ config/ltmain.sh config/missing config/py-compile DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ # to automatically update libtool script if it becomes out of date LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ # From autoconf manual: # ... if you use aclocal from Automake to generate aclocal.m4, you must also # set ACLOCAL_AMFLAGS = -I dir in your top-level Makefile.am. # Due to a limitation in the Autoconf implementation of autoreconf, these # include directives currently must be set on a single line in Makefile.am, # without any backslash-newlines # Introspection does this. ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} EXTRA_DIST = README.md NEWS.md m4/introspection.m4 # if ENABLE_GOBJECT_COND DISTCHECK_CONFIGURE_FLAGS = --enable-introspection # endif @USE_DOXYGEN_TRUE@DOXYDIR = docs # doc_DATA = AUTHORS COPYING NEWS.md README.md ChangeLog SUBDIRS = src man data $(DOXYDIR) @ENABLE_SHARED_LIB_COND_TRUE@pkgconfigdir = $(libdir)/pkgconfig @ENABLE_SHARED_LIB_COND_TRUE@pkgconfig_DATA = ddcutil.pc # cmakedir = $(datadir)/cmake/Modules # cmake_DATA = FindDDCUtil.cmake # EXTRA_DIST += FindDDCUtil.cmake @ENABLE_SHARED_LIB_COND_TRUE@libddcdocdir = $(datarootdir)/doc/libddcutil all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @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: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 ddcutil.pc: $(top_builddir)/config.status $(srcdir)/ddcutil.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _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) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-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-data-local 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-pkgconfigDATA install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-pkgconfigDATA .PRECIOUS: Makefile # libddcdoc_DATA = AUTHORS # Too many false positives: # alpha.clone.CloneChecker # alpha.deadcode.UnreachableCode # alpha.core.CastToStruct # Copied and adapted from colord # is calling autogen.sh within this file dangerous? clang: $(MAKE) clean; \ rm -rf clang; \ scan-build --use-analyzer=/usr/bin/clang \ -o clang-report \ ./autogen.sh \ --disable_gobject_api \ --enable-cffi \ --enable-cython \ ; \ scan-build --use-analyzer=/usr/bin/clang \ -o clang-report \ -enable-checker alpha.core.CastSize \ -enable-checker alpha.core.BoolAssignment \ -enable-checker alpha.core.Conversion \ -enable-checker alpha.core.SizeofPtr \ make # $(foreach v, $(.VARIABLES), @echo "$v = $$v") show: @echo "---> Show variables" @echo "Set by AM_PATH_PYTHON:" @echo " PYTHON = $(PYTHON) " @echo " PYTHON_PREFIX = $(PYTHON_PREFIX) " @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX) " @echo " pythondir = $(pythondir) " @echo " pkgpythondir = $(pkgpythondir) " @echo " pyexecdir = $(pyexecdir) " @echo " pkgpyexecdir = $(pkgpyexecdir) " @echo "" @echo "Explicitly set:" @echo " PYTHONDIR = $(PYTHONDIR) " @echo " PKGPYTHONDIR = $(PKGPYTHONDIR) " @echo " PYEXECDIR = $(PYEXECDIR) " @echo " PKGPYEXECDIR = $(PKGPYEXECDIR) " @echo "" @echo "Set by AX_PYTHON:" @echo " PYTHON_BIN = $(PYTHON_BIN), @PYTHON_BIN@ " @echo " PYTHON_INCLUDE_DIR = $(PYTHON_INCLUDE_DIR) " @echo " PYTHON_LIB = $(PYTHON_LIB) " @echo "" @echo "Set by AX_PYTHON_DEVEL:" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS), @PYTHON_CPPFLAGS@ " @echo " PYTHON_LIBS = $(PYTHON_LIBS) " @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS) " @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS) " @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo "" @echo "Set by AX_SWIG_PYTHON:" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS), @AX_SWIG_PYTHON_CPPFLAGS@" @echo " AX_SWIG_PYTHON_OPT = $(AS_SWIG_PYTHON_OPT)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo "" @echo "Set by AX_PKG_SWIG:" @echo " SWIG = $(SWIG), @SWIG@" @echo " SWIG_LIB = $(SWIG_LIB)" @echo "" @echo "Set by PKG_CHECK_MODULES:" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS), @PYTHON_CFLAGS@)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " GLIB_CFLAGS = $(GLIB_CFLAGS) " @echo " GLIB_LIBS = $(GLIB_LIBS)" @echo " UDEV_CFLAGS = $(UDEV_CFLAGS)" @echo " UDEV_LIBS = $(UDEV_LIBS)" @echo " SYSTEMD_CFLAGS = $(SYSTEMD_CFLAGS)" @echo " SYSTEMD_LIBS = $(SYSTEMD_LIBS)" @echo " LIBUSB_CFLAGS = $(LIBUSB_CFLAGS)" @echo " LIBUSB_LIBS = $(LIBUSB_LIBS)" @echo " GOBJECT_CFLAGS = $(GOBJECT_CFLAGS)" @echo " GOBJECT_LIBS = $(GOBJECT_LIBS)" @echo "" @echo "Addtional:" @echo " prefix = $(prefix)" @echo " exec_prefix = $(exec_prefix)" @echo " libdir = $(libdir)" @echo " libexecdir = $(libexecdir)" @echo " top_srcdir = $(top_srcdir)" @echo " srcdir = $(srcdir)" @echo " pythondir = $(pythondir)" @echo " pyexecdir = $(pyexecdir)" .PHONY: clang show install-data-local: @echo "(install-data-local):" @echo " docdir = $(docdir)" # rpmarch=`$(RPM) --showrc | grep "^build arc" | \ # sed 's/\(.*: \)\(.*\)/\2/'`; \ # echo "$$rpmarch" ;\ #test -z "obs/$$rpmarch" || \ # ( mv obs/$$rpmarch/* . && rm -rf /obs/$$rpmarch ) #rm -rf obs/$(distdir) # 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: ddcutil-0.8.6/config.h.in0000664000175000001440000001333013230166640012120 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* If defined, enable failsim. */ #undef ENABLE_FAILSIM /* If defined, force SUSE target directories. */ #undef ENABLE_FORCE_SUSE /* Python2 is enabled */ #undef ENABLE_PY2 /* Python3 is enabled */ #undef ENABLE_PY3 /* If defined, ADL headers are present. Build with ADL support. */ #undef HAVE_ADL /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_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_LANGINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_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 you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* 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_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_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_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* If defined, build with test cases. */ #undef INCLUDE_TESTCASES /* 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 /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* If defined, use ddcutil APIs internally. */ #undef USE_API /* Use libdrm */ #undef USE_LIBDRM /* If defined, use usb. */ #undef USE_USB /* Use X11 */ #undef USE_X11 /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT8_T /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to 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 /* Define to `int' if does not define. */ #undef ssize_t /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef uint16_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef uint8_t ddcutil-0.8.6/ddcutil.pc.in0000644000175000001440000000050613203271475012460 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE@ Description: Control display settings URL: http://www.ddcutil.com Version: @VERSION@ Requires: @REQUIRED_PACKAGES@ # Libs and Cflags not needed since using default locations Libs: -L${libdir} -lddcutil Cflags: -I${includedir} ddcutil-0.8.6/AUTHORS0000644000175000001440000000005212630214264011137 00000000000000Sanford Rockowitz ddcutil-0.8.6/COPYING0000644000175000001440000004325412303542700011131 00000000000000 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. ddcutil-0.8.6/ChangeLog0000644000175000001440000000035513203271475011653 00000000000000A summary of the changes for each ddcutil release can be found on the website, at http://www.ddcutil.com/release_notes. For detailed change information, consult the log in the git repository at https://www.github.com/rockowitz/ddcutil.ddcutil-0.8.6/README.md0000644000175000001440000000503213203547510011351 00000000000000ddcutil ======= ddcutil is a program for querying and changing monitor settings, such as brightness and color levels. ddcutil uses DDC/CI to communicate with monitors implementing MCCS (Monitor Control Command Set) over I2C. Normally, the video driver for the monitor exposes the I2C channel as devices named /dev/i2c-n. There is also psupport for monitors (such as Apple Cinema and Eizo ColorEdge) that implement MCCS using a USB connection. A particular use case for ddcutil is as part of color profile management. Monitor calibration is relative to the monitor color settings currently in effect, e.g. red gain. ddcutil allows color related settings to be saved at the time a monitor is calibrated, and then restored when the calibration is applied. For detailed instructions on building and using ddcutil, see the website: www.ddcutil.com. In particular, for information on building ddcutil, see www.ddcutil.com/building. Once ddcutil is installed, online help is also available. Use the --help option or see the man page: ~~~: ddcutil --help man 1 ddcutil ~~~ ## Feedback Needed Many aspects of ddcutil can vary from system to system. In particular: - The build environment can vary. - I2C implementation can vary with card, monitor, and driver. - There is variation in MCCS interpretation. - I2C is an inherently unreliable protocol, requiring retry management. Given the wide variability, it is not possible to test all combinations. Some questions that arise: - Were changes required to build ddcutil? - Does it work with given card, driver, and monitor? I'm not particularly concerned with older monitors whose MCCS version is unspecified (i.e. is less than 2.0). On the other hand, I'm very interested in how ddcutil handles monitors implementing MCCS V3.0, as the V3.0 specific code has not been tested. In particular, does ddcutil properly read Table type features? - What features should be added? Command `ddcutil interrogate` collects maximal information about the installation environment, video card and driver, and monitor capabilities. I'd appreciate it if you could redirect its output to a file and send the file to me. This will help to document the variability of monitor DDC/CI implementations, diagnose problems, and identify features that should be implemented. ### Installation Diagnostics If ddcutil is successfully built but execution fails, command `ddcutil environment` probes the I2C environment and may provide clues as to the problem. ## Author Sanford Rockowitz ddcutil-0.8.6/NEWS.md0000644000175000001440000000066713203271475011205 00000000000000ddcutil ======= The [ddcutil website](http://www.ddcutil.com) is the primary location of information for ddcutil users. Recent announcements can be found on the [home page](http://www.ddcutil.com). Earlier announcements are located at [prior announcements](http://www.ddcutil.prior_announcements). Detailed information about user-visible changes for each release are located at [release notes](http://www.ddcutil.com/release_notes). ddcutil-0.8.6/src/0000755000175000001440000000000013230445447010747 500000000000000ddcutil-0.8.6/src/app_ddcutil/0000755000175000001440000000000013230445447013237 500000000000000ddcutil-0.8.6/src/app_ddcutil/main.c0000644000175000001440000007451113224277406014260 00000000000000/* main.c * * Program mainline * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * ddcutil standalone application mainline */ /** \cond */ #include #include #include #include #include #include #include #include #include #include #include "util/data_structures.h" #include "util/error_info.h" #include "util/failsim.h" #include "util/sysfs_util.h" /** \endcond */ #include "base/adl_errors.h" #include "base/base_init.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/displays.h" #include "base/linux_errno.h" #include "base/parms.h" #include "base/sleep.h" #include "base/status_code_mgt.h" #include "vcp/parse_capabilities.h" #include "vcp/vcp_feature_codes.h" #include "i2c/i2c_bus_core.h" #include "i2c/i2c_do_io.h" #include "ddc/ddc_try_stats.h" #include "adl/adl_shim.h" #include "usb/usb_displays.h" #include "ddc/ddc_displays.h" #include "ddc/ddc_multi_part_io.h" #include "ddc/ddc_output.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_read_capabilities.h" #include "ddc/ddc_services.h" #include "ddc/ddc_vcp_version.h" #include "ddc/ddc_vcp.h" #include "cmdline/cmd_parser_aux.h" // for parse_feature_id_or_subset(), should it be elsewhere? #include "cmdline/cmd_parser.h" #include "cmdline/parsed_cmd.h" #include "app_ddcutil/app_dumpload.h" #include "app_ddcutil/app_getvcp.h" #include "app_ddcutil/app_setvcp.h" #include "app_sysenv/query_sysenv.h" #ifdef USE_USB #include "app_sysenv/query_sysenv_usb.h" #endif #ifdef INCLUDE_TESTCASES #include "test/testcases.h" #endif #ifdef USE_API #include "public/ddcutil_c_api.h" #endif // // Initialization and Statistics // // static long start_time_nanos; static void reset_stats() { ddc_reset_stats_main(); } static void report_stats(DDCA_Stats_Type stats) { ddc_report_stats_main(stats, 0); // Report the elapsed time in ddc_report_stats_main(). // The start time used there is that at the time of stats initialization, // which is slightly later than start_time_nanos, but the difference is // less than a tenth of a millisecond. Using that start time allows for // elapsed time to be used from library functions. // puts(""); // long elapsed_nanos = cur_realtime_nanosec() - start_time_nanos; // printf("Elapsed milliseconds (nanoseconds): %10ld (%10ld)\n", // elapsed_nanos / (1000*1000), // elapsed_nanos); } // TODO: refactor // originally just displayed capabilities, now returns parsed capabilities as well // these actions should be separated Parsed_Capabilities * perform_get_capabilities_by_display_handle(Display_Handle * dh) { bool debug = false; Parsed_Capabilities * pcap = NULL; char * capabilities_string; Error_Info * ddc_excp = get_capabilities_string(dh, &capabilities_string); Public_Status_Code psc = ERRINFO_STATUS(ddc_excp); assert( (ddc_excp && psc!=0) || (!ddc_excp && psc==0) ); if (ddc_excp) { switch(psc) { case DDCRC_REPORTED_UNSUPPORTED: // should not happen case DDCRC_DETERMINED_UNSUPPORTED: printf("Unsupported request\n"); break; case DDCRC_RETRIES: f0printf(FOUT, "Unable to get capabilities for monitor on %s. Maximum DDC retries exceeded.\n", dh_repr(dh)); break; default: f0printf(FOUT, "(%s) !!! Unable to get capabilities for monitor on %s\n", __func__, dh_repr(dh)); DBGMSG("Unexpected status code: %s", psc_desc(psc)); } // errinfo_free(ddc_excp); ERRINFO_FREE_WITH_REPORT(ddc_excp, debug || report_freed_exceptions); } else { assert(capabilities_string); // pcap is always set, but may be damaged if there was a parsing error pcap = parse_capabilities_string(capabilities_string); DDCA_Output_Level output_level = get_output_level(); if (output_level <= DDCA_OL_TERSE) { f0printf(FOUT, "%s capabilities string: %s\n", (dh->dref->io_path.io_mode == DDCA_IO_USB) ? "Synthesized unparsed" : "Unparsed", capabilities_string); } else { if (dh->dref->io_path.io_mode == DDCA_IO_USB) pcap->raw_value_synthesized = true; // report_parsed_capabilities(pcap, dh->dref->io_path.io_mode); // io_mode no longer needed report_parsed_capabilities(pcap); // free_parsed_capabilities(pcap); } } DBGMSF(debug, "Returning: %p", pcap); return pcap; } void probe_display_by_dh(Display_Handle * dh) { bool debug = false; DBGMSF(debug, "Starting. dh=%s", dh_repr(dh)); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; f0printf(FOUT, "\nMfg id: %s, model: %s, sn: %s\n", dh->dref->pedid->mfg_id, dh->dref->pedid->model_name, dh->dref->pedid->serial_ascii); f0printf(FOUT, "\nCapabilities for display on %s\n", dref_short_name_t(dh->dref)); DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); // not needed, message causes confusing messages if get_vcp_version fails but get_capabilities succeeds // if (vspec.major < 2) { // printf("VCP (aka MCCS) version for display is less than 2.0. Output may not be accurate.\n"); // } // reports capabilities, and if successful returns Parsed_Capabilities Parsed_Capabilities * pcaps = perform_get_capabilities_by_display_handle(dh); // how to pass this information down into app_show_vcp_subset_values_by_display_handle()? bool table_reads_possible = parsed_capabilities_may_support_table_commands(pcaps); f0printf(FOUT, "\nMay support table reads: %s\n", bool_repr(table_reads_possible)); // *** VCP Feature Scan *** // printf("\n\nScanning all VCP feature codes for display %d\n", dispno); f0printf(FOUT, "\nScanning all VCP feature codes for display %s\n", dh_repr(dh) ); Byte_Bit_Flags features_seen = bbf_create(); app_show_vcp_subset_values_by_display_handle( dh, VCP_SUBSET_SCAN, FSF_SHOW_UNSUPPORTED, features_seen); if (pcaps) { f0printf(FOUT, "\n\nComparing declared capabilities to observed features...\n"); Byte_Bit_Flags features_declared = parsed_capabilities_feature_ids(pcaps, /*readable_only=*/true); char * s0 = bbf_to_string(features_declared, NULL, 0); f0printf(FOUT, "\nReadable features declared in capabilities string: %s\n", s0); free(s0); Byte_Bit_Flags caps_not_seen = bbf_subtract(features_declared, features_seen); Byte_Bit_Flags seen_not_caps = bbf_subtract(features_seen, features_declared); f0printf(FOUT, "\nMCCS (VCP) version reported by capabilities: %s\n", format_vspec(pcaps->parsed_mccs_version)); f0printf(FOUT, "MCCS (VCP) version reported by feature 0xDf: %s\n", format_vspec(vspec)); if (!vcp_version_eq(pcaps->parsed_mccs_version, vspec)) f0printf(FOUT, "Versions do not match!!!\n"); if (bbf_count_set(caps_not_seen) > 0) { f0printf(FOUT, "\nFeatures declared as readable capabilities but not found by scanning:\n"); for (int code = 0; code < 256; code++) { if (bbf_is_set(caps_not_seen, code)) { VCP_Feature_Table_Entry * vfte = vcp_find_feature_by_hexid_w_default(code); char * feature_name = get_version_sensitive_feature_name(vfte, pcaps->parsed_mccs_version); f0printf(FOUT, " Feature x%02x - %s\n", code, feature_name); } } } else f0printf(FOUT, "\nAll readable features declared in capabilities were found by scanning.\n"); if (bbf_count_set(seen_not_caps) > 0) { f0printf(FOUT, "\nFeatures found by scanning but not declared as capabilities:\n"); for (int code = 0; code < 256; code++) { if (bbf_is_set(seen_not_caps, code)) { VCP_Feature_Table_Entry * vfte = vcp_find_feature_by_hexid_w_default(code); char * feature_name = get_version_sensitive_feature_name(vfte, vspec); f0printf(FOUT, " Feature x%02x - %s\n", code, feature_name); } } } else f0printf(FOUT, "\nAll features found by scanning were declared in capabilities.\n"); bbf_free(features_declared); bbf_free(caps_not_seen); bbf_free(seen_not_caps); free_parsed_capabilities(pcaps); } else { f0printf(FOUT, "\n\nUnable to read or parse capabilities.\n"); f0printf(FOUT, "Skipping comparison of declared capabilities to observed features\n"); } bbf_free(features_seen); puts(""); // get VCP 0B DDCA_Single_Vcp_Value * valrec; int color_temp_increment = 0; int color_temp_units = 0; ddc_excp = get_vcp_value( dh, 0x0b, // color temperature increment, DDCA_NON_TABLE_VCP_VALUE, &valrec); psc = ERRINFO_STATUS(ddc_excp); if (psc == 0) { if (debug) f0printf(FOUT, "Value returned for feature x0b: %s\n", summarize_single_vcp_value(valrec) ); color_temp_increment = valrec->val.c.cur_val; ddc_excp = get_vcp_value( dh, 0x0c, // color temperature request DDCA_NON_TABLE_VCP_VALUE, &valrec); psc = ERRINFO_STATUS(ddc_excp); if (psc == 0) { if (debug) f0printf(FOUT, "Value returned for feature x0c: %s\n", summarize_single_vcp_value(valrec) ); color_temp_units = valrec->val.c.cur_val; int color_temp = 3000 + color_temp_units * color_temp_increment; f0printf(FOUT, "Color temperature increment (x0b) = %d degrees Kelvin\n", color_temp_increment); f0printf(FOUT, "Color temperature request (x0c) = %d\n", color_temp_units); f0printf(FOUT, "Requested color temperature = (3000 deg Kelvin) + %d * (%d degrees Kelvin)" " = %d degrees Kelvin\n", color_temp_units, color_temp_increment, color_temp); } } if (psc != 0) { f0printf(FOUT, "Unable to calculate color temperature from VCP features x0B and x0C\n"); // errinfo_free(ddc_excp); ERRINFO_FREE_WITH_REPORT(ddc_excp, debug || report_freed_exceptions); } // get VCP 14 // report color preset DBGMSF(debug, "Done."); } void probe_display_by_dref(Display_Ref * dref) { Display_Handle * dh = NULL; Public_Status_Code psc = ddc_open_display(dref, CALLOPT_ERR_MSG, &dh); if (psc != 0) { f0printf(FOUT, "Unable to open display %s, status code %s", dref_short_name_t(dref), psc_desc(psc) ); } else { probe_display_by_dh(dh); ddc_close_display(dh); } } // // Mainline // /** **ddcutil** program mainline. * * @param argc number of command line arguments * @param argv pointer to array of argument strings * * @retval EXIT_SUCCESS normal exit * @retval EXIT_FAILURE an error occurred */ int main(int argc, char *argv[]) { #ifdef OBSOLETE // For aborting out of shared library jmp_buf abort_buf; int jmprc = setjmp(abort_buf); if (jmprc) { fprintf(stderr, "Aborting. Internal status code = %d\n", jmprc); exit(EXIT_FAILURE); } register_jmp_buf(&abort_buf); #endif // set_trace_levels(TRC_ADL); // uncomment to enable tracing during initialization init_base_services(); // so tracing related modules are initialized Parsed_Cmd * parsed_cmd = parse_command(argc, argv); if (!parsed_cmd) { exit(EXIT_FAILURE); } if (parsed_cmd->timestamp_trace) // timestamps on debug and trace messages? dbgtrc_show_time = true; // extern in core.h report_freed_exceptions = parsed_cmd->report_freed_exceptions; // extern in core.h set_trace_levels(parsed_cmd->trace); if (parsed_cmd->traced_functions) { for (int ndx = 0; ndx < ntsa_length(parsed_cmd->traced_functions); ndx++) add_traced_function(parsed_cmd->traced_functions[ndx]); } if (parsed_cmd->traced_files) { for (int ndx = 0; ndx < ntsa_length(parsed_cmd->traced_files); ndx++) add_traced_file(parsed_cmd->traced_files[ndx]); } #ifdef ENABLE_FAILSIM fsim_set_name_to_number_funcs( status_name_to_modulated_number, status_name_to_unmodulated_number); if (parsed_cmd->failsim_control_fn) { bool ok = fsim_load_control_file(parsed_cmd->failsim_control_fn); if (!ok) { fprintf(stderr, "Error loading failure simulation control file %s.\n", parsed_cmd->failsim_control_fn); exit(EXIT_FAILURE); } fsim_report_error_table(0); } #endif init_ddc_services(); // n. initializes start timestamp // overrides setting in init_ddc_services(): i2c_set_io_strategy(DEFAULT_I2C_IO_STRATEGY); set_verify_setvcp(parsed_cmd->verify_setvcp); #ifndef HAVE_ADL if ( is_module_loaded_using_sysfs("fglrx") ) { fprintf(stdout, "WARNING: AMD proprietary video driver fglrx is loaded,"); fprintf(stdout, "but this copy of ddcutil was built without fglrx support."); } #endif int main_rc = EXIT_FAILURE; Call_Options callopts = CALLOPT_NONE; i2c_force_slave_addr_flag = parsed_cmd->force_slave_addr; if (parsed_cmd->flags & CMD_FLAG_FORCE) callopts |= CALLOPT_FORCE; set_output_level(parsed_cmd->output_level); report_ddc_errors = parsed_cmd->ddcdata; // TMI: // if (show_recoverable_errors) // parsed_cmd->stats = true; if (parsed_cmd->output_level >= DDCA_OL_VERBOSE) { show_reporting(); f0printf( FOUT, "%.*s%-*s%s\n", 0,"", 28, "Force I2C slave address:", bool_repr(i2c_force_slave_addr_flag)); f0puts("\n", FOUT); } // n. MAX_MAX_TRIES checked during command line parsing if (parsed_cmd->max_tries[0] > 0) { #ifdef USE_API ddca_set_max_tries(DDCA_WRITE_ONLY_TRIES, parsed_cmd->max_tries[0]); #else ddc_set_max_write_only_exchange_tries(parsed_cmd->max_tries[0]); #endif } if (parsed_cmd->max_tries[1] > 0) { #ifdef USE_API ddca_set_max_tries(DDCA_WRITE_READ_TRIES, parsed_cmd->max_tries[1]); #else ddc_set_max_write_read_exchange_tries(parsed_cmd->max_tries[1]); #endif } if (parsed_cmd->max_tries[2] > 0) { #ifdef USE_API ddca_set_max_tries(DDCA_MULTI_PART_TRIES, parsed_cmd->max_tries[2]); #else ddc_set_max_multi_part_read_tries(parsed_cmd->max_tries[2]); ddc_set_max_multi_part_write_tries(parsed_cmd->max_tries[2]); #endif } if (parsed_cmd->sleep_strategy >= 0) set_sleep_strategy(parsed_cmd->sleep_strategy); int threshold = DISPLAY_CHECK_ASYNC_NEVER; if (parsed_cmd->async) threshold = DISPLAY_CHECK_ASYNC_THRESHOLD; ddc_set_async_threshold(threshold); if (parsed_cmd->cmd_id == CMDID_LISTVCP) { vcp_list_feature_codes(stdout); main_rc = EXIT_SUCCESS; } else if (parsed_cmd->cmd_id == CMDID_VCPINFO) { bool ok = true; DDCA_MCCS_Version_Spec vcp_version_any = {0,0}; VCP_Feature_Set fset = create_feature_set_from_feature_set_ref( // &feature_set_ref, parsed_cmd->fref, vcp_version_any, false); // force if (!fset) { ok = false; } else { if (parsed_cmd->output_level <= DDCA_OL_TERSE) report_feature_set(fset, 0); else { int ct = get_feature_set_size(fset); int ndx = 0; for (;ndx < ct; ndx++) { VCP_Feature_Table_Entry * pentry = get_feature_set_entry(fset, ndx); report_vcp_feature_table_entry(pentry, 0); } } } if (ok) { main_rc = EXIT_SUCCESS; } else { // printf("Unrecognized VCP feature code or group: %s\n", val); main_rc = EXIT_FAILURE; } } #ifdef INCLUDE_TESTCASES else if (parsed_cmd->cmd_id == CMDID_LISTTESTS) { show_test_cases(); main_rc = EXIT_SUCCESS; } #endif // start of commands that actually access monitors else if (parsed_cmd->cmd_id == CMDID_DETECT) { ddc_ensure_displays_detected(); ddc_report_displays(DDC_REPORT_ALL_DISPLAYS, 0); } #ifdef INCLUDE_TESTCASES else if (parsed_cmd->cmd_id == CMDID_TESTCASE) { int testnum; bool ok = true; int ct = sscanf(parsed_cmd->args[0], "%d", &testnum); if (ct != 1) { f0printf(FOUT, "Invalid test number: %s\n", parsed_cmd->args[0]); ok = false; } else { ddc_ensure_displays_detected(); if (!parsed_cmd->pdid) parsed_cmd->pdid = create_dispno_display_identifier(1); // default monitor ok = execute_testcase(testnum, parsed_cmd->pdid); } main_rc = (ok) ? EXIT_SUCCESS : EXIT_FAILURE; } #endif else if (parsed_cmd->cmd_id == CMDID_LOADVCP) { ddc_ensure_displays_detected(); char * fn = strdup( parsed_cmd->args[0] ); // DBGMSG("Processing command loadvcp. fn=%s", fn ); Display_Handle * dh = NULL; bool ok = true; if (parsed_cmd->pdid) { Display_Ref * dref = get_display_ref_for_display_identifier( parsed_cmd->pdid, callopts | CALLOPT_ERR_MSG); if (!dref) ok = false; else { ddc_open_display(dref, callopts | CALLOPT_ERR_MSG, &dh); // rc == 0 iff dh, removed CALLOPT_ERR_ABORT if (!dh) ok = false; } } if (ok) ok = loadvcp_by_file(fn, dh); // if we opened the display, we close it if (dh) ddc_close_display(dh); free(fn); main_rc = (ok) ? EXIT_SUCCESS : EXIT_FAILURE; } else if (parsed_cmd->cmd_id == CMDID_ENVIRONMENT) { dup2(1,2); // redirect stderr to stdout ddc_ensure_displays_detected(); // *** NEEDED HERE ??? *** f0printf(FOUT, "The following tests probe the runtime environment using multiple overlapping methods.\n"); query_sysenv(); main_rc = EXIT_SUCCESS; } else if (parsed_cmd->cmd_id == CMDID_USBENV) { #ifdef USE_USB dup2(1,2); // redirect stderr to stdout ddc_ensure_displays_detected(); // *** NEEDED HERE ??? *** f0printf(FOUT, "The following tests probe for USB connected monitors.\n"); // DBGMSG("Exploring USB runtime environment...\n"); query_usbenv(); main_rc = EXIT_SUCCESS; #else f0printf(FOUT, "ddcutil was not built with support for USB connected monitors\n"); main_rc = EXIT_FAILURE; #endif } else if (parsed_cmd->cmd_id == CMDID_CHKUSBMON) { #ifdef USE_USB // DBGMSG("Processing command chkusbmon...\n"); bool is_monitor = check_usb_monitor( parsed_cmd->args[0] ); main_rc = (is_monitor) ? EXIT_SUCCESS : EXIT_FAILURE; #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else if (parsed_cmd->cmd_id == CMDID_INTERROGATE) { dup2(1,2); // redirect stderr to stdout // set_ferr(FOUT); // ensure that all messages are collected - made unnecessary by dup2() f0printf(FOUT, "Setting output level verbose...\n"); set_output_level(DDCA_OL_VERBOSE); f0printf(FOUT, "Setting maximum retries...\n"); f0printf(FOUT, "Forcing --stats...\n"); parsed_cmd->stats_types = DDCA_STATS_ALL; f0printf(FOUT, "Forcing --force-slave-address..\n"); i2c_force_slave_addr_flag = true; f0printf(FOUT, "This command will take a while to run...\n\n"); ddc_set_max_write_read_exchange_tries(MAX_MAX_TRIES); ddc_set_max_multi_part_read_tries(MAX_MAX_TRIES); ddc_ensure_displays_detected(); // *** ??? query_sysenv(); #ifdef USE_USB // 7/2017: disable, USB attached monitors are rare, and this just // clutters the output f0printf(FOUT, "\nSkipping USB environment exploration.\n"); f0printf(FOUT, "Issue command \"ddcutil usbenvironment --verbose\" if there are any USB attached monitors.\n"); // query_usbenv(); #endif f0printf(FOUT, "\nStatistics for environment exploration:\n"); report_stats(DDCA_STATS_ALL); reset_stats(); f0printf(FOUT, "\n*** Detected Displays ***\n"); /* int display_ct = */ ddc_report_displays(DDC_REPORT_ALL_DISPLAYS, 0 /* logical depth */); // printf("Detected: %d displays\n", display_ct); // not needed f0printf(FOUT, "\nStatistics for display detection:\n"); report_stats(DDCA_STATS_ALL); reset_stats(); f0printf(FOUT, "Setting output level normal Table features will be skipped...\n"); set_output_level(DDCA_OL_NORMAL); GPtrArray * all_displays = ddc_get_all_displays(); for (int ndx=0; ndx < all_displays->len; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); assert( memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0); if (dref->dispno < 0) { f0printf(FOUT, "\nSkipping invalid display on %s\n", dref_short_name_t(dref)); } else { f0printf(FOUT, "\nProbing display %d\n", dref->dispno); probe_display_by_dref(dref); f0printf(FOUT, "\nStatistics for probe of display %d:\n", dref->dispno); report_stats(DDCA_STATS_ALL); } reset_stats(); } f0printf(FOUT, "\nDisplay scanning complete.\n"); main_rc = EXIT_SUCCESS; } // *** Commands that require Display Identifier *** else { if (!parsed_cmd->pdid) parsed_cmd->pdid = create_dispno_display_identifier(1); // default monitor // assert(parsed_cmd->pdid); // returns NULL if not a valid display: Call_Options callopts = CALLOPT_ERR_MSG; // emit error messages if (parsed_cmd->flags & CMD_FLAG_FORCE) callopts |= CALLOPT_FORCE; // If --nodetect and --bus options were specified,skip scan for all devices. // --nodetect option not needed, just do it // n. useful even if not much speed up, since avoids cluttering stats // with all the failures during detect Display_Ref * dref = NULL; if (parsed_cmd->pdid->id_type == DISP_ID_BUSNO && parsed_cmd->nodetect) { // if (parsed_cmd->pdid->id_type == DISP_ID_BUSNO) { int busno = parsed_cmd->pdid->busno; // is this really a monitor? I2C_Bus_Info * businfo = detect_single_bus(busno); if ( businfo && (businfo->flags & I2C_BUS_ADDR_0X50) ) { dref = create_bus_display_ref(busno); dref->dispno = -1; // should use some other value for unassigned vs invalid dref->pedid = businfo->edid; // needed? // dref->pedid = i2c_get_parsed_edid_by_busno(parsed_cmd->pdid->busno); dref->detail2 = businfo; dref->flags |= DREF_DDC_IS_MONITOR_CHECKED; dref->flags |= DREF_DDC_IS_MONITOR; dref->flags |= DREF_TRANSIENT; if (!initial_checks_by_dref(dref)) { f0printf(FOUT, "DDC communication failed for monitor on I2C bus /dev/i2c-%d\n", busno); free_display_ref(dref); dref = NULL; } // DBGMSG("Synthetic Display_Ref"); } else { f0printf(FOUT, "No monitor detected on I2C bus /dev/i2c-%d\n", busno); } } else { ddc_ensure_displays_detected(); dref = get_display_ref_for_display_identifier(parsed_cmd->pdid, callopts); } if (dref) { Display_Handle * dh = NULL; callopts |= CALLOPT_ERR_MSG; // removed CALLOPT_ERR_ABORT ddc_open_display(dref, callopts, &dh); if (dh) { if (// parsed_cmd->cmd_id == CMDID_CAPABILITIES || parsed_cmd->cmd_id == CMDID_GETVCP || parsed_cmd->cmd_id == CMDID_READCHANGES ) { DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); if (vspec.major < 2 && get_output_level() >= DDCA_OL_NORMAL) { f0printf(FOUT, "VCP (aka MCCS) version for display is undetected or less than 2.0. " "Output may not be accurate.\n"); } } switch(parsed_cmd->cmd_id) { case CMDID_CAPABILITIES: { Parsed_Capabilities * pcaps = perform_get_capabilities_by_display_handle(dh); main_rc = (pcaps) ? EXIT_SUCCESS : EXIT_FAILURE; free(pcaps); break; } case CMDID_GETVCP: { Feature_Set_Flags flags = 0x00; // DBGMSG("parsed_cmd->flags: 0x%04x", parsed_cmd->flags); if (parsed_cmd->flags & CMD_FLAG_SHOW_UNSUPPORTED) flags |= FSF_SHOW_UNSUPPORTED; if (parsed_cmd->flags & CMD_FLAG_FORCE) flags |= FSF_FORCE; if (parsed_cmd->flags & CMD_FLAG_NOTABLE) flags |= FSF_NOTABLE; // char * s0 = feature_set_flag_names(flags); // DBGMSG("flags: 0x%04x - %s", flags, s0); // free(s0); Public_Status_Code psc = app_show_feature_set_values_by_display_handle( dh, parsed_cmd->fref, // parsed_cmd->show_unsupported, // parsed_cmd->force, flags ); main_rc = (psc==0) ? EXIT_SUCCESS : EXIT_FAILURE; } break; case CMDID_SETVCP: if (parsed_cmd->argct % 2 != 0) { f0printf(FOUT, "SETVCP command requires even number of arguments\n"); main_rc = EXIT_FAILURE; } else { main_rc = EXIT_SUCCESS; int argNdx; // Public_Status_Code rc = 0; Error_Info * ddc_excp; for (argNdx=0; argNdx < parsed_cmd->argct; argNdx+= 2) { ddc_excp = app_set_vcp_value( dh, parsed_cmd->args[argNdx], parsed_cmd->args[argNdx+1], parsed_cmd->flags & CMD_FLAG_FORCE); // rc = ERRINFO_STATUS(ddc_excp); if (ddc_excp) { // errinfo_free(ddc_excp); ERRINFO_FREE_WITH_REPORT(ddc_excp, report_freed_exceptions); main_rc = EXIT_FAILURE; // ??? break; } } } break; case CMDID_SAVE_SETTINGS: if (parsed_cmd->argct != 0) { f0printf(FOUT, "SCS command takes no arguments\n"); main_rc = EXIT_FAILURE; } else if (dh->dref->io_path.io_mode == DDCA_IO_USB) { f0printf(FOUT, "SCS command not supported for USB devices\n"); main_rc = EXIT_FAILURE; } else { main_rc = EXIT_SUCCESS; Error_Info * ddc_excp = save_current_settings(dh); if (ddc_excp) { f0printf(FOUT, "Save current settings failed. rc=%s\n", psc_desc(ddc_excp->status_code)); if (ddc_excp->status_code == DDCRC_RETRIES) f0printf(FOUT, " Try errors: %s", errinfo_causes_string(ddc_excp) ); errinfo_report(ddc_excp, 0); // ** ALTERNATIVE **/ errinfo_free(ddc_excp); // ERRINFO_FREE_WITH_REPORT(ddc_excp, report_exceptions); main_rc = EXIT_FAILURE; } } break; case CMDID_DUMPVCP: { Public_Status_Code psc = dumpvcp_as_file(dh, (parsed_cmd->argct > 0) ? parsed_cmd->args[0] : NULL ); main_rc = (psc==0) ? EXIT_SUCCESS : EXIT_FAILURE; break; } case CMDID_READCHANGES: // DBGMSG("Case CMDID_READCHANGES"); // report_parsed_cmd(parsed_cmd,0); app_read_changes_forever(dh); break; case CMDID_PROBE: probe_display_by_dh(dh); break; default: break; } ddc_close_display(dh); } if (dref->flags & DREF_TRANSIENT) free_display_ref(dref); } } if (parsed_cmd->stats_types != DDCA_STATS_NONE && parsed_cmd->cmd_id != CMDID_INTERROGATE) { report_stats(parsed_cmd->stats_types); // report_timestamp_history(); // debugging function } // DBGMSG("Done"); return main_rc; } ddcutil-0.8.6/src/app_ddcutil/app_dumpload.c0000644000175000001440000001551113214507757016000 00000000000000/* app_dumpload.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * */ /** \cond */ #include #include #include #include #include // PATH_MAX, NAME_MAX #include #include #include #include #include #include #include "util/error_info.h" #include "util/file_util.h" #include "util/glib_util.h" #include "util/report_util.h" /** \endcond */ #include "base/core.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "vcp/vcp_feature_values.h" #include "i2c/i2c_bus_core.h" #include "ddc/ddc_displays.h" #include "ddc/ddc_dumpload.h" #include "ddc/ddc_edid.h" #include "ddc/ddc_output.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_read_capabilities.h" #include "ddc/ddc_vcp.h" #include "app_ddcutil/app_dumpload.h" // Filename creation // TODO: generalize, get default dir following XDG settings #define USER_VCP_DATA_DIR ".local/share/icc" /** Uses the identifiers in an EDID and a timestamp to create a VCP filename. * * \param edid pointer to parsed edid * \param time_millis timestamp to use * \param buf buffer in which to return filename * \param bufsz buffer size */ char * create_simple_vcp_fn_by_edid( Parsed_Edid * edid, time_t time_millis, char * buf, int bufsz) { assert(edid); if (bufsz == 0 || buf == NULL) { bufsz = 128; buf = calloc(1, bufsz); } char timestamp_text[30]; format_timestamp(time_millis, timestamp_text, 30); snprintf(buf, bufsz, "%s-%s-%s.vcp", edid->model_name, edid->serial_ascii, timestamp_text ); str_replace_char(buf, ' ', '_'); // convert blanks to underscores // DBGMSG("Returning %s", buf ); return buf; } char * create_simple_vcp_fn_by_display_handle( Display_Handle * dh, time_t time_millis, char * buf, int bufsz) { // Parsed_Edid* edid = ddc_get_parsed_edid_by_display_handle(dh); Parsed_Edid * edid = dh->dref->pedid; assert(edid); return create_simple_vcp_fn_by_edid(edid, time_millis, buf, bufsz); } /* Executes the DUMPVCP command, writing the output to a file. * * Arguments: * dh display handle * filename name of file to write to, * if NULL, the file name is generated * * Returns: * status code */ Public_Status_Code dumpvcp_as_file(Display_Handle * dh, char * filename) { bool debug = false; DBGMSF(debug, "Starting"); char fqfn[PATH_MAX] = {0}; Public_Status_Code psc = 0; Dumpload_Data * data = NULL; psc = dumpvcp_as_dumpload_data(dh, &data); if (psc == 0) { GPtrArray * strings = convert_dumpload_data_to_string_array(data); if (!filename) { time_t time_millis = data->timestamp_millis; char simple_fn_buf[NAME_MAX+1]; create_simple_vcp_fn_by_display_handle( dh, time_millis, simple_fn_buf, sizeof(simple_fn_buf)); snprintf(fqfn, PATH_MAX, "/home/%s/%s/%s", getlogin(), USER_VCP_DATA_DIR, simple_fn_buf); // DBGMSG("fqfn=%s ", fqfn ); filename = fqfn; // control with MsgLevel? f0printf(FOUT, "Writing file: %s\n", filename); } free_dumpload_data(data); FILE * output_fp = fopen(filename, "w+"); if (!output_fp) { int errsv = errno; f0printf(FERR, "Unable to open %s for writing: %s\n", fqfn, strerror(errno)); psc = -errsv; } else { int ct = strings->len; int ndx; for (ndx=0; ndx= DDCA_OL_VERBOSE); bool ok = false; Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; Dumpload_Data * pdata = read_vcp_file(fn); if (!pdata) { // Redundant, read_vcp_file() issues message: // f0printf(FERR, "Unable to load VCP data from file: %s\n", fn); } else { if (verbose) { f0printf(FOUT, "Loading VCP settings for monitor \"%s\", sn \"%s\" from file: %s\n", pdata->model, pdata->serial_ascii, fn); rpt_push_output_dest(FOUT); report_dumpload_data(pdata, 0); rpt_pop_output_dest(); } ddc_excp = loadvcp_by_dumpload_data(pdata, dh); if (ddc_excp) { psc = ddc_excp->status_code; // errinfo_free(ddc_excp); ERRINFO_FREE_WITH_REPORT(ddc_excp, debug || report_freed_exceptions); } free_dumpload_data(pdata); ok = (psc == 0); } DBGMSF(debug, "Returning: %s", bool_repr(ok)); return ok; } ddcutil-0.8.6/src/app_ddcutil/app_setvcp.c0000644000175000001440000001424613214367452015477 00000000000000/* app_setvcp.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * */ /** \cond */ #include #include #include /** \endcond */ #include "base/core.h" #include "base/ddc_errno.h" #include "vcp/vcp_feature_codes.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp.h" #include "ddc/ddc_vcp_version.h" // // Set VCP value // /* Converts a VCP feature value from string form to internal form. * * Currently only handles values in range 0..255. * * Arguments: * string_value * parsed_value location where to return result * * Returns: * true if conversion successful, false if not */ bool parse_vcp_value(char * string_value, long* parsed_value) { assert(string_value); bool ok = true; char buf[20]; strupper(string_value); if (*string_value == 'X' ) { snprintf(buf, 20, "0%s", string_value); string_value = buf; // DBGMSG("Adjusted value: |%s|", string_value); } else if (*(string_value + strlen(string_value)-1) == 'H') { int newlen = strlen(string_value)-1; snprintf(buf, 20, "0x%.*s", newlen, string_value); string_value = buf; // DBGMSG("Adjusted value: |%s|", string_value); } char * endptr = NULL; errno = 0; long longtemp = strtol(string_value, &endptr, 0 ); // allow 0xdd for hex values int errsv = errno; // printf("errno=%d, new_value=|%s|, &new_value=%p, longtemp = %ld, endptr=0x%02x\n", // errsv, new_value, &new_value, longtemp, *endptr); if (*endptr || errsv != 0) { printf("Not a number: %s\n", string_value); ok = false; } else if (longtemp < 0 || longtemp > 255) { printf("Number must be in range 0..255 (for now at least): %ld\n", longtemp); ok = false; } else { *parsed_value = longtemp; ok = true; } return ok; } /* Parses the Set VCP arguments passed and sets the new value. * * Arguments: * dh display handle * feature feature id (as string) * new_value new feature value (as string) * force * retry_history if non-null, collects retryable errors * * Returns: * 0 success * -EINVAL invalid setvcp arguments, feature not writable * from put_vcp_by_display_ref() */ // TODO: consider moving value parsing to command parser Error_Info * app_set_vcp_value( Display_Handle * dh, char * feature, char * new_value, bool force) { bool debug = false; DBGMSF(debug,"Starting"); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; long longtemp; Byte hexid; VCP_Feature_Table_Entry * entry = NULL; bool good_value = false; DDCA_Single_Vcp_Value vrec; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); bool ok = any_one_byte_hex_string_to_byte_in_buf(feature, &hexid); if (!ok) { f0printf(FOUT, "Unrecognized VCP feature code: %s\n", feature); psc = DDCL_UNKNOWN_FEATURE; goto bye; } entry = vcp_find_feature_by_hexid(hexid); if (!entry && ( force || hexid >= 0xe0) ) // assume force for mfg specific codes entry = vcp_create_dummy_feature_for_hexid(hexid); if (!entry) { f0printf(FOUT, "Unrecognized VCP feature code: %s\n", feature); psc = DDCL_UNKNOWN_FEATURE; goto bye; } if (!is_feature_writable_by_vcp_version(entry, vspec)) { char * feature_name = get_version_sensitive_feature_name(entry, vspec); f0printf(FOUT, "Feature %s (%s) is not writable\n", feature, feature_name); psc = DDCL_INVALID_OPERATION; goto bye; } if (is_feature_table_by_vcp_version(entry, vspec)) { Byte * value_bytes; int bytect = hhs_to_byte_array(new_value, &value_bytes); if (bytect < 0) { // bad hex string good_value = false; } else { good_value = true; vrec.opcode = entry->code; vrec.value_type = DDCA_TABLE_VCP_VALUE; vrec.val.t.bytect = bytect; vrec.val.t.bytes = value_bytes; } } else { // the usual non-table case good_value = parse_vcp_value(new_value, &longtemp); if (good_value) { vrec.opcode = entry->code; vrec.value_type = DDCA_NON_TABLE_VCP_VALUE; vrec.val.c.cur_val = longtemp; } } if (!good_value) { f0printf(FOUT, "Invalid VCP value: %s\n", new_value); // what is better status code? psc = -EINVAL; goto bye; } ddc_excp = set_vcp_value(dh, &vrec); psc = ERRINFO_STATUS(ddc_excp); // *** TEMP FOR TESTING *** // if (vrec.val.c.cur_val == 25) { // DBGMSG("Forcing DDC_VERIFY"); // psc = DDCRC_VERIFY; // } if (psc != 0) { switch(psc) { case DDCRC_VERIFY: f0printf(FOUT, "Verification failed for feature %02x\n", entry->code); break; default: // Is this proper error message? f0printf(FOUT, "Setting value failed for feature %02x. rc=%s\n", entry->code, psc_desc(psc)); if (psc == DDCRC_RETRIES) f0printf(FOUT, " Try errors: %s\n", errinfo_causes_string(ddc_excp)); } } bye: if (entry && (entry->vcp_global_flags & DDCA_SYNTHETIC) ) { free_synthetic_vcp_entry(entry); } DBGMSF(debug, "Returning: %s", psc_desc(psc)); return ddc_excp; } ddcutil-0.8.6/src/app_ddcutil/app_getvcp.c0000644000175000001440000003333513224277417015465 00000000000000/* app_getvcp.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ /** \cond */ #include #include #include #include #include #include #include "util/error_info.h" #include "util/string_util.h" #include "util/report_util.h" /** \endcond */ #ifdef USE_USB #include "usb_util/hiddev_reports.h" #include "usb_util/hiddev_util.h" #endif #include "base/core.h" #include "base/ddc_errno.h" #include "base/sleep.h" #include "base/vcp_version.h" #include "vcp/vcp_feature_codes.h" #include "i2c/i2c_bus_core.h" #include "ddc/ddc_output.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp_version.h" #include "ddc/ddc_vcp.h" #include "app_ddcutil/app_getvcp.h" /* Shows a single VCP value specified by its feature table entry. * * Arguments: * dh handle of open display * entry hex feature id * * Returns: * status code 0 = normal * DDCL_INVALID_OPERATION - feature is deprecated or write-only * from get_formatted_value_for_feature_table_entry() */ Public_Status_Code app_show_single_vcp_value_by_feature_table_entry( Display_Handle * dh, VCP_Feature_Table_Entry * entry) { bool debug = false; DBGMSF(debug, "Starting. Getting feature 0x%02x for %s", entry->code, dh_repr(dh) ); DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); Public_Status_Code psc = 0; Byte feature_id = entry->code; if (!is_feature_readable_by_vcp_version(entry, vspec)) { char * feature_name = get_version_sensitive_feature_name(entry, vspec); DDCA_Version_Feature_Flags vflags = get_version_sensitive_feature_flags(entry, vspec); if (vflags & DDCA_DEPRECATED) printf("Feature %02x (%s) is deprecated in MCCS %d.%d\n", feature_id, feature_name, vspec.major, vspec.minor); else printf("Feature %02x (%s) is not readable\n", feature_id, feature_name); psc = DDCL_INVALID_OPERATION; } if (psc == 0) { char * formatted_value = NULL; psc = get_formatted_value_for_feature_table_entry( dh, entry, false, /* suppress_unsupported */ true, /* prefix_value_with_feature_code */ &formatted_value, stdout); /* msg_fh */ if (formatted_value) { printf("%s\n", formatted_value); free(formatted_value); } } DBGMSF(debug, "Done. Returning: %s", psc_desc(psc)); return psc; } /* Shows a single VCP value specified by its feature id. * * Arguments: * dh handle of open display * feature_id hex feature id * force attempt to show value even if feature_id not in feature table * * Returns: * status code 0 = success * DDCL_UNKNOWN_FEATURE feature_id not in feature table and !force * from app_show_single_vcp_value_by_feature_table_entry() */ Public_Status_Code app_show_single_vcp_value_by_feature_id( Display_Handle * dh, Byte feature_id, bool force) { bool debug = false; DBGMSF(debug, "Starting. Getting feature 0x%02x for %s, force=%s", feature_id, dh_repr(dh), bool_repr(force) ); Public_Status_Code psc = 0; VCP_Feature_Table_Entry * entry = NULL; entry = vcp_find_feature_by_hexid(feature_id); if (!entry && (force || feature_id >= 0xe0)) { // don't require force if manufacturer specific code entry = vcp_create_dummy_feature_for_hexid(feature_id); } if (!entry) { printf("Unrecognized VCP feature code: 0x%02x\n", feature_id); // gsc = modulate_rc(-EINVAL, RR_ERRNO); psc = DDCL_UNKNOWN_FEATURE; } else { psc = app_show_single_vcp_value_by_feature_table_entry(dh, entry); } DBGMSF(debug, "Done. Returning: %s", psc_desc(psc)); return psc; } /* Shows the VCP values for all features in a VCP feature subset. * * Arguments: * dh display handle * subset_id feature subset * show_unsupported report unsupported values * features_seen if non-null, collect list of features found * * Returns: * status code from show_vcp_values() */ Public_Status_Code app_show_vcp_subset_values_by_display_handle( Display_Handle * dh, VCP_Feature_Subset subset_id, // bool show_unsupported, // deprecated Feature_Set_Flags flags, Byte_Bit_Flags features_seen) { // DBGMSG("Starting. subset=%d ", subset ); GPtrArray * collector = NULL; Public_Status_Code psc = show_vcp_values(dh, subset_id, collector, flags, features_seen); return psc; } #ifdef UNUSED /* Shows the VCP values for all features in a VCP feature subset. * * Arguments: * pdisp display reference * subset_id feature subset * collector accumulates output * show_unsupported * * Returns: * nothing */ void app_show_vcp_subset_values_by_display_ref( Display_Ref * dref, VCP_Feature_Subset subset_id, bool show_unsupported) { // DBGMSG("Starting. subset=%d ", subset ); // need to ensure that bus info initialized bool validDisp = true; if (dref->ddc_io_mode == DDC_IO_DEVI2C) { // Is this needed? or checked by openDisplay? Bus_Info * bus_info = i2c_get_bus_info(dref->busno); if (!bus_info || !(bus_info->flags & I2C_BUS_ADDR_0X37) ) { printf("Address 0x37 not detected on bus %d. I2C communication not available.\n", dref->busno ); validDisp = false; } } else { validDisp = true; // already checked } if (validDisp) { GPtrArray * collector = NULL; Display_Handle * pDispHandle = ddc_open_display(dref, EXIT_IF_FAILURE); show_vcp_values(pDispHandle, subset_id, collector, show_unsupported); ddc_close_display(pDispHandle); } } #endif /* Shows the VCP values for all features indicated by a Feature_Set_Ref * * Arguments: * dh display handle * fsref feature set reference * show_unsupported report unsupported values (applies if not a single feature feature set) * force applies if is a single feature feature set * * Returns: * status code from app_show_single_vcp_value_by_feature_id() or * app_show_subset_values_by_display_handle() */ Public_Status_Code app_show_feature_set_values_by_display_handle( Display_Handle * dh, Feature_Set_Ref * fsref, // bool show_unsupported, // bool force, Feature_Set_Flags flags ) { bool debug = false; // bool show_unsupported = flags & FSF_SHOW_UNSUPPORTED; if (debug) { char * s0 = feature_set_flag_names(flags); DBGMSG("Starting. flags: %s, dh: %s", s0, dh_repr(dh)); dbgrpt_feature_set_ref(fsref,1); free(s0); } Public_Status_Code psc = 0; if (fsref->subset == VCP_SUBSET_SINGLE_FEATURE) { #ifdef OLD psc = app_show_single_vcp_value_by_feature_id( dh, fsref->specific_feature, force); #endif psc = app_show_single_vcp_value_by_feature_id( dh, fsref->specific_feature, flags&FSF_FORCE); } else { psc = app_show_vcp_subset_values_by_display_handle( dh, fsref->subset, // show_unsupported, flags, NULL); } return psc; } // // Watch for changed VCP values // void reset_vcp_x02(Display_Handle * dh) { Error_Info * ddc_excp = set_nontable_vcp_value(dh, 0x02, 0x01); if (ddc_excp) { DBGMSG("set_nontable_vcp_value_by_display_handle() returned %s", errinfo_summary(ddc_excp) ); errinfo_free(ddc_excp); } else DBGMSG("reset feature x02 (new control value) successful"); } bool new_control_values_exist(Display_Handle * dh) { bool debug = true; Parsed_Nontable_Vcp_Response * p_nontable_response = NULL; // DBGMSF(debug, "VCP version: %d.%d", vspec.major, vspec.minor); bool result = false; Error_Info * ddc_excp = get_nontable_vcp_value( dh, 0x02, &p_nontable_response); if (ddc_excp) { DBGMSG("get_nontable_vcp_value() returned %s", errinfo_summary(ddc_excp) ); errinfo_free(ddc_excp); } else if (p_nontable_response->sl == 0x01) { DBGMSF(debug, "No new control values found"); free(p_nontable_response); } else { DBGMSG("New control values exist. x02 value: 0x%02x", p_nontable_response->sl); free(p_nontable_response); p_nontable_response = NULL; result = true; } return result; } /** Gets the ID of the next changed feature from VCP feature x52, * then reads and displays the value of that feature. * * \param dh #Display_Handle * \return id of changed feature, 0x00 if none */ Byte show_changed_feature(Display_Handle * dh) { Parsed_Nontable_Vcp_Response * p_nontable_response = NULL; Byte changed_feature = 0x00; Error_Info * ddc_excp = get_nontable_vcp_value( dh, 0x52, &p_nontable_response); // psc = (ddc_excp) ? ddc_excp->psc : 0; if (ddc_excp) { DBGMSG("get_nontable_vcp_value() for VCP feature x52 returned %s", errinfo_summary(ddc_excp) ); errinfo_free(ddc_excp); } else { changed_feature = p_nontable_response->sl; free(p_nontable_response); if (changed_feature) app_show_single_vcp_value_by_feature_id(dh, changed_feature, false); } return changed_feature; } /* Checks for VCP feature changes by: * - reading feature x02 to check if changes exist, * - querying feature x52 for the id of a changed feature * - reading the value of the changed feature. * * If the VCP version is 2.1 or less a single feature is * read from x52. For VCP version 3.0 and 2.2, x52 is a * FIFO queue of changed features. * * Finally, 1 is written to feature x02 as a reset. * * Arguments: * dh display handle */ void app_read_changes(Display_Handle * dh) { bool debug = false; DBGMSF(debug, "Starting"); int MAX_CHANGES = 20; // read 02h // xff: no user controls // x01: no new control values // x02: new control values exist /* Per the 3.0 and 2.2 specs, feature x52 is a FIFO to be read until value x00 indicates empty * What apparently happens on 2.1 (U3011) is that each time feature x02 is reset with value x01 * the subsequent read of feature x02 returns x02 (new control values exists) until the queue * of changes is flushed */ DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); if (new_control_values_exist(dh)) { if ( vcp_version_le(vspec, VCP_SPEC_V21) ) { show_changed_feature(dh); } else { // x52 is a FIFO int ctr = 0; for (;ctr < MAX_CHANGES; ctr++) { Byte cur_feature = show_changed_feature(dh); if (cur_feature == 0x00) { DBGMSG("No more changed features found"); break; } } if (ctr == MAX_CHANGES) { DBGMSG("Reached loop guard value MAX_CHANGES (%d)", MAX_CHANGES); } } reset_vcp_x02(dh); } } #ifdef USE_USB void app_read_changes_usb(Display_Handle * dh) { bool debug = true; DBGMSF(debug, "Starting"); // bool new_values_found = false; assert(dh->dref->io_path.io_mode == DDCA_IO_USB); int fd = dh->fh; int flaguref = HIDDEV_FLAG_UREF; struct hiddev_usage_ref uref; int rc = ioctl(fd, HIDIOCSFLAG, &flaguref); if (rc < 0) { REPORT_IOCTL_ERROR("HIDIOCSFLAG", errno); return; } ssize_t ct = read(fd, &uref, sizeof(uref)); if (ct < 0) { int errsv = errno; // report the error printf("(%s) read failed, errno=%d\n", __func__, errsv); } else if (ct > 0) { rpt_vstring(1, "Read new value:"); if (ct < sizeof(uref)) { rpt_vstring(1, "Short read"); } else { report_hiddev_usage_ref(&uref, 1); rpt_vstring(1, "New value: 0x%04x (%d)", uref.value, uref.value); } } else { DBGMSF(debug, "tick"); } } #endif /* Infinite loop watching for VCP feature changes reported by the display. * * Arguments: * dh display handle * * Returns: * does not return - halts with program termination */ void app_read_changes_forever(Display_Handle * dh) { bool debug = true; printf("Watching for VCP feature changes on display %s\n", dh_repr(dh)); printf("Type ^C to exit...\n"); // show version here instead of in called function to declutter debug output: DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); DBGMSF(debug, "VCP version: %d.%d", vspec.major, vspec.minor); while(true) { #ifdef USE_USB if (dh->dref->io_path.io_mode == DDCA_IO_USB) app_read_changes_usb(dh); else #endif app_read_changes(dh); sleep_millis( 2500); } } ddcutil-0.8.6/src/app_ddcutil/app_dumpload.h0000644000175000001440000000242713230445447016002 00000000000000/* app_dumpload.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * */ #ifndef APP_DUMPLOAD_H_ #define APP_DUMPLOAD_H_ #include #include bool loadvcp_by_file(const char * fn, Display_Handle * dh); Public_Status_Code dumpvcp_as_file(Display_Handle * dh, char * optional_filename); #ifdef OLD bool dumpvcp_as_file_old(Display_Handle * dh, char * optional_filename); #endif #endif /* APP_DUMPLOAD_H_ */ ddcutil-0.8.6/src/app_ddcutil/app_getvcp.h0000644000175000001440000000374713230445447015473 00000000000000/* app_getvcp.h * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f */ #ifndef APP_GETVCP_H_ #define APP_GETVCP_H_ /** \cond */ #include /** \endcond */ #include "base/displays.h" #include "base/feature_sets.h" #include "base/status_code_mgt.h" Public_Status_Code app_show_single_vcp_value_by_feature_table_entry( Display_Handle * dh, VCP_Feature_Table_Entry * entry); Public_Status_Code app_show_single_vcp_value_by_feature_id( Display_Handle * dh, Byte feature_id, bool force); Public_Status_Code app_show_vcp_subset_values_by_display_handle( Display_Handle * dh, VCP_Feature_Subset subset, // bool show_unsupported, Feature_Set_Flags flags, Byte_Bit_Flags features_seen); Public_Status_Code app_show_feature_set_values_by_display_handle( Display_Handle * dh, Feature_Set_Ref * fsref, // bool show_unsupported, // bool force, Feature_Set_Flags flags); void app_read_changes(Display_Handle * dh); void app_read_changes_forever(Display_Handle * dh); #endif /* APP_GETVCP_H_ */ ddcutil-0.8.6/src/app_ddcutil/app_setvcp.h0000644000175000001440000000234713230445447015502 00000000000000/* app_setvcp.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * */ #ifndef APP_SETVCP_H_ #define APP_SETVCP_H_ #include "../util/error_info.h" #include "base/displays.h" #include "base/status_code_mgt.h" Error_Info * app_set_vcp_value( Display_Handle * dh, char * feature, char * new_value, bool force); #endif /* APP_SETVCP_H_ */ ddcutil-0.8.6/src/libmain/0000755000175000001440000000000013230445446012361 500000000000000ddcutil-0.8.6/src/libmain/ddcutil_c_api.c0000644000175000001440000015527613227350667015256 00000000000000/* ddcutil_c_api.c * * * Copyright (C) 2015-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * **ddcutil** C API implementation */ #include /** \cond */ #include #include #include /** \endcond */ #include "util/data_structures.h" #include "util/error_info.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/udev_util.h" #include "base/build_info.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/displays.h" #include "base/base_init.h" #include "base/execution_stats.h" #include "base/parms.h" #include "vcp/vcp_feature_codes.h" #include "vcp/parse_capabilities.h" #include "vcp/parsed_capabilities_feature.h" #include "vcp/vcp_feature_values.h" #include "adl/adl_shim.h" #include "ddc/ddc_async.h" #include "ddc/ddc_displays.h" #include "ddc/ddc_dumpload.h" #include "ddc/ddc_edid.h" #include "ddc/ddc_multi_part_io.h" #include "ddc/ddc_output.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_read_capabilities.h" #include "ddc/ddc_services.h" #include "ddc/ddc_vcp_version.h" #include "ddc/ddc_vcp.h" #include "public/ddcutil_c_api.h" #define WITH_DR(ddca_dref, action) \ do { \ if (!library_initialized) \ return DDCL_UNINITIALIZED; \ DDCA_Status psc = 0; \ Display_Ref * dref = (Display_Ref *) ddca_dref; \ if (dref == NULL || memcmp(dref->marker, DISPLAY_REF_MARKER, 4) != 0 ) { \ psc = DDCL_ARG; \ } \ else { \ (action); \ } \ return psc; \ } while(0); #define WITH_DH(_ddca_dh_, _action_) \ do { \ if (!library_initialized) \ return DDCL_UNINITIALIZED; \ DDCA_Status psc = 0; \ Display_Handle * dh = (Display_Handle *) _ddca_dh_; \ if ( !dh || memcmp(dh->marker, DISPLAY_HANDLE_MARKER, 4) != 0 ) { \ psc = DDCL_ARG; \ } \ else { \ (_action_); \ } \ return psc; \ } while(0); static inline bool valid_display_handle(Display_Handle * dh) { return (dh && memcmp(dh->marker, DISPLAY_HANDLE_MARKER, 4) == 0); } static inline bool valid_display_ref(Display_Ref * dref) { return (dref && memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0); } // // Library Build Information // DDCA_Ddcutil_Version_Spec ddca_ddcutil_version(void) { static DDCA_Ddcutil_Version_Spec vspec = {255,255,255}; static bool vspec_init = false; if (!vspec_init) { int ct = sscanf(BUILD_VERSION, "%hhu.%hhu.%hhu", &vspec.major, &vspec.minor, &vspec.micro); assert(ct == 3); vspec_init = true; } // DBGMSG("Returning: %d.%d.%d", vspec.major, vspec.minor, vspec.micro); return vspec; } /* Returns the ddcutil version as a string in the form "major.minor.micro". */ const char * ddca_ddcutil_version_string(void) { return BUILD_VERSION; } /* Indicates whether the ddcutil library was built with ADL support. . */ bool ddca_built_with_adl(void) { #ifdef HAVE_ADL return true; #else return false; #endif } /* Indicates whether the ddcutil library was built with support for USB connected monitors. . */ bool ddca_built_with_usb(void) { #ifdef USE_USB return true; #else return false; #endif } /* Indicates whether ADL successfully initialized. * (e.g. fglrx driver not found) * * @return true/false */ bool ddca_adl_is_available(void) { return adlshim_is_available(); } // Alternative to individual ddca_built_with...() functions. // conciseness vs documentatbility // how to document bits? should doxygen doc be in header instead? uint8_t ddca_build_options(void) { uint8_t result = 0x00; #ifdef HAVE_ADL result |= DDCA_BUILT_WITH_ADL; #endif #ifdef USE_USB result |= DDCA_BUILT_WITH_USB; #endif #ifdef FAILSIM_ENABLED result |= DDCA_BUILT_WITH_FAILSIM; #endif return result; } // // Initialization // static bool library_initialized = false; /** Initializes the ddcutil library module. * * It is not an error if this function is called more than once. */ void __attribute__ ((constructor)) _ddca_init(void) { // Note: Until init_msg_control() is called within init_base_services(), // FOUT is null, so DBGMSG() causes a segfault bool debug = false; if (!library_initialized) { init_base_services(); init_ddc_services(); set_output_level(DDCA_OL_NORMAL); report_ddc_errors = false; library_initialized = true; DBGMSF(debug, "library initialization executed"); } else { DBGMSF(debug, "library was already initialized"); } } #ifdef WRONG /** Template for callback function registered with ddca_register_abort_func() */ typedef void (*DDCA_Abort_Func)(DDCA_Status status_code); static jmp_buf abort_buf; static DDCA_Abort_Func abort_func = NULL; // PROBLEM: If abort_func() returns, some function gets 0 as it's return value, // which causes unpredictable behavior /** Register a function to be called when an internal abort occurs in libddcutil. * * @param[in] func callback function */ void ddca_register_abort_func(DDCA_Abort_Func func) { DBGMSG("func=%p", func); abort_func = func; int jmprc = setjmp(abort_buf); if (jmprc) { Public_Status_Code status_code = global_to_public_status_code(jmprc); if (abort_func) abort_func(status_code); fprintf(stderr, "Aborting. Internal status code = %d\n", jmprc); exit(EXIT_FAILURE); } DBGMSG("Calling register_jmp_buf()..."); register_jmp_buf(&abort_buf); } #endif #ifdef OBSOLETE void ddca_register_jmp_buf(jmp_buf* jb) { register_jmp_buf(jb); } DDCA_Global_Failure_Information * ddca_get_global_failure_information() { // return NULL if !global_failure_information.info_set_fg, or always return pointer // i.e. is it better if caller checks for NULL or checks info_set_fg? // return &global_failure_information; return (global_failure_information.info_set_fg) ? &global_failure_information : NULL; } #endif // // Status Code Management // #ifdef OLD static Global_Status_ Code ddca_to_global_status_code(DDCA_Status ddca_status) { return global_to_public_status_code(ddca_status); } // should be static, but not currently used, if static get warning DDCA_Status global_to_ddca_status_code(Global_Status_ Code gsc) { return global_to_public_status_code(gsc); } #endif char * ddca_rc_name(DDCA_Status status_code) { char * result = NULL; // Global_ Status_Code gsc = ddca_to_global_ status_code(status_code); // Status_Code_Info * code_info = find_global_status_code_info(gsc); Status_Code_Info * code_info = find_status_code_info(status_code); if (code_info) result = code_info->name; return result; } char * ddca_rc_desc(DDCA_Status status_code) { char * result = "unknown status code"; // Global_ Status_Code gsc = ddca_to_global_status_code(status_code); // Status_Code_Info * code_info = find_global_status_code_info(gsc); Status_Code_Info * code_info = find_status_code_info(status_code); if (code_info) result = code_info->description; return result; } // // Message Control // // Redirects output that normally would go to STDOUT void ddca_set_fout(FILE * fout) { // DBGMSG("Starting. fout=%p", fout); // if (!library_initialized) // _ddca_init(); set_fout(fout); } void ddca_set_fout_to_default(void) { // if (!library_initialized) // _ddca_init(); set_fout_to_default(); } // Redirects output that normally would go to STDERR void ddca_set_ferr(FILE * ferr) { // if (!library_initialized) // _ddca_init(); set_ferr(ferr); } void ddca_set_ferr_to_default(void) { // if (!library_initialized) // _ddca_init(); set_ferr_to_default(); } DDCA_Output_Level ddca_get_output_level(void) { return get_output_level(); } void ddca_set_output_level( DDCA_Output_Level newval) { set_output_level(newval); } char * ddca_output_level_name(DDCA_Output_Level val) { return output_level_name(val); } void ddca_enable_report_ddc_errors(bool onoff) { // global variable in core.c: report_ddc_errors = onoff; } bool ddca_is_report_ddc_errors_enabled(void) { return report_ddc_errors; } // // Global Settings // int ddca_max_max_tries(void) { return MAX_MAX_TRIES; } int ddca_get_max_tries(DDCA_Retry_Type retry_type) { int result = 0; switch(retry_type) { case (DDCA_WRITE_ONLY_TRIES): result = ddc_get_max_write_only_exchange_tries(); break; case (DDCA_WRITE_READ_TRIES): result = ddc_get_max_write_read_exchange_tries(); break; case (DDCA_MULTI_PART_TRIES): result = ddc_get_max_multi_part_read_tries(); break; } return result; } DDCA_Status ddca_set_max_tries( DDCA_Retry_Type retry_type, int max_tries) { DDCA_Status rc = 0; if (max_tries < 1 || max_tries > MAX_MAX_TRIES) rc = -EINVAL; else { switch(retry_type) { case (DDCA_WRITE_ONLY_TRIES): ddc_set_max_write_only_exchange_tries(max_tries); break; case (DDCA_WRITE_READ_TRIES): ddc_set_max_write_read_exchange_tries(max_tries); break; case (DDCA_MULTI_PART_TRIES): ddc_set_max_multi_part_read_tries(max_tries); ddc_set_max_multi_part_write_tries(max_tries); // TODO: Separate constant break; } } return rc; } void ddca_enable_verify(bool onoff) { set_verify_setvcp(onoff); } bool ddca_is_verify_enabled() { return get_verify_setvcp(); } // TODO: Add functions to access ddcutil's runtime error statistics #ifdef FUTURE /** Gets the I2C timeout in milliseconds for the specified timeout class. * @param timeout_type timeout type * @return timeout in milliseconds */ int ddca_get_timeout_millis( DDCA_Timeout_Type timeout_type) { return 0; // *** UNIMPLEMENTED *** } /** Sets the I2C timeout in milliseconds for the specified timeout class * @param timeout_type timeout class * @param millisec timeout to set, in milliseconds */ void ddca_set_timeout_millis( DDCA_Timeout_Type timeout_type, int millisec) { // *** UNIMPLEMENTED } #endif // // Statistics // void ddca_reset_stats(void) { ddc_reset_stats_main(); } // TODO: Functions that return stats in data structures void ddca_show_stats(DDCA_Stats_Type stats_types, int depth) { ddc_report_stats_main( stats_types, // stats to show depth); // logical indentation depth } // // Display Identifiers // DDCA_Status ddca_create_dispno_display_identifier( int dispno, DDCA_Display_Identifier* p_did) { Display_Identifier* did = create_dispno_display_identifier(dispno); *p_did = did; DBGMSG("Done. *p_did = %p", *p_did); return 0; } DDCA_Status ddca_create_busno_display_identifier( int busno, DDCA_Display_Identifier* p_did) { Display_Identifier* did = create_busno_display_identifier(busno); *p_did = did; return 0; } DDCA_Status ddca_create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex, DDCA_Display_Identifier* p_did) { Display_Identifier* did = create_adlno_display_identifier(iAdapterIndex, iDisplayIndex); *p_did = did; return 0; } DDCA_Status ddca_create_mfg_model_sn_display_identifier( const char* mfg_id, const char* model_name, const char* serial_ascii, DDCA_Display_Identifier* p_did ) { *p_did = NULL; DDCA_Status rc = 0; // break up the invalid argument tests for clarity // At least 1 argument must be specified if ( ( !mfg_id || strlen(mfg_id) == 0) && ( !model_name || strlen(model_name) == 0) && ( !serial_ascii || strlen(serial_ascii) == 0) ) rc = -EINVAL; // check if any arguments are too long else if ( (model_name && strlen(model_name) >= EDID_MODEL_NAME_FIELD_SIZE) || (mfg_id && strlen(mfg_id) >= EDID_MFG_ID_FIELD_SIZE) || (serial_ascii && strlen(serial_ascii) >= EDID_SERIAL_ASCII_FIELD_SIZE) ) rc = -EINVAL; else { *p_did = create_mfg_model_sn_display_identifier( mfg_id, model_name, serial_ascii); } return rc; } DDCA_Status ddca_create_edid_display_identifier( const Byte * edid, DDCA_Display_Identifier * p_did) // 128 byte EDID { *p_did = NULL; DDCA_Status rc = 0; if (edid == NULL) { rc = -EINVAL; *p_did = NULL; } else { *p_did = create_edid_display_identifier(edid); } return rc; } DDCA_Status ddca_create_usb_display_identifier( int bus, int device, DDCA_Display_Identifier* p_did) { Display_Identifier* did = create_usb_display_identifier(bus, device); *p_did = did; return 0; } DDCA_Status ddca_create_usb_hiddev_display_identifier( int hiddev_devno, DDCA_Display_Identifier* p_did) { Display_Identifier* did = create_usb_hiddev_display_identifier(hiddev_devno); *p_did = did; return 0; } DDCA_Status ddca_free_display_identifier( DDCA_Display_Identifier did) { DBGMSG("Starting. did=%p", did); DDCA_Status rc = 0; Display_Identifier * pdid = (Display_Identifier *) did; if (pdid == NULL || memcmp(pdid->marker, DISPLAY_IDENTIFIER_MARKER, 4) != 0 ) { rc = DDCL_ARG; } else { free_display_identifier(pdid); } return rc; } // static char did_work_buf[100]; char * ddca_did_repr(DDCA_Display_Identifier ddca_did) { DBGMSG("Starting. ddca_did=%p", ddca_did); char * result = NULL; Display_Identifier * pdid = (Display_Identifier *) ddca_did; if (pdid != NULL && memcmp(pdid->marker, DISPLAY_IDENTIFIER_MARKER, 4) == 0 ) { #ifdef OLD char * did_type_name = display_id_type_name(pdid->id_type); switch (pdid->id_type) { case(DISP_ID_BUSNO): snprintf(did_work_buf, 100, "Display Id Type: %s, bus=/dev/i2c-%d", did_type_name, pdid->busno); break; case(DISP_ID_ADL): snprintf(did_work_buf, 100, "Display Id Type: %s, adlno=%d.%d", did_type_name, pdid->iAdapterIndex, pdid->iDisplayIndex); break; case(DISP_ID_MONSER): snprintf(did_work_buf, 100, "Display Id Type: %s, mfg=%s, model=%s, sn=%s", did_type_name, pdid->mfg_id, pdid->model_name, pdid->serial_ascii); break; case(DISP_ID_EDID): { char * hs = hexstring(pdid->edidbytes, 128); snprintf(did_work_buf, 100, "Display Id Type: %s, edid=%8s...%8s", did_type_name, hs, hs+248); free(hs); break; } case(DISP_ID_DISPNO): snprintf(did_work_buf, 100, "Display Id Type: %s, dispno=%d", did_type_name, pdid->dispno); break; case DISP_ID_USB: snprintf(did_work_buf, 100, "Display Id Type: %s, usb bus:device=%d.%d", did_type_name, pdid->usb_bus, pdid->usb_device);; break; case DISP_ID_HIDDEV: snprintf(did_work_buf, 100, "Display Id Type: %s, hiddev_devno=%d", did_type_name, pdid->hiddev_devno); break; } // switch result = did_work_buf; #endif result = did_repr(pdid); } DBGMSG("Done. Returning: %p", result); return result; } // // Display References // DDCA_Status ddca_create_display_ref( DDCA_Display_Identifier did, DDCA_Display_Ref* ddca_dref) { bool debug = false; DBGMSF(debug, "Starting. did=%p, ddca_dref=%p", did, ddca_dref); if (ddca_dref) DBGMSF(debug," *ddca_dref=%p", *ddca_dref); DDCA_Status rc = 0; if (!library_initialized) { rc = DDCL_UNINITIALIZED; goto bye; } ddc_ensure_displays_detected(); Display_Identifier * pdid = (Display_Identifier *) did; if (!pdid || memcmp(pdid->marker, DISPLAY_IDENTIFIER_MARKER, 4) != 0 || !ddca_dref) { rc = -EINVAL; } else { Display_Ref* dref = get_display_ref_for_display_identifier(pdid, CALLOPT_ERR_MSG); if (debug) DBGMSG("get_display_ref_for_display_identifier() returned %p", dref); if (dref) *ddca_dref = dref; else rc = DDCRC_INVALID_DISPLAY; } bye: DBGMSF(debug, "Done. Returning: %d", rc); if (rc == 0) DBGMSF(debug," *ddca_dref=%p", *ddca_dref); return rc; } DDCA_Status ddca_free_display_ref(DDCA_Display_Ref ddca_dref) { WITH_DR(ddca_dref, { if (dref->flags & DREF_TRANSIENT) free_display_ref(dref); } ); } // static char dref_work_buf[100]; char * ddca_dref_repr(DDCA_Display_Ref ddca_dref){ bool debug = false; DBGMSF(debug, "Starting. ddca_dref = %p", ddca_dref); char * result = NULL; Display_Ref * dref = (Display_Ref *) ddca_dref; if (dref != NULL && memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0 ) { #ifdef TOO_MUCH_WORK char * dref_type_name = io_mode_name(dref->ddc_io_mode); switch (dref->ddc_io_mode) { case(DISP_ID_BUSNO): snprintf(dref_work_buf, 100, "Display Ref Type: %s, bus=/dev/i2c-%d", dref_type_name, dref->io_path.i2c_busno); break; case(DISP_ID_ADL): snprintf(dref_work_buf, 100, "Display Ref Type: %s, adlno=%d.%d", dref_type_name, dref->io_path.adlno.iAdapterIndex, dref->io_path.adlno.iDisplayIndex); break; } *repr = did_work_buf; #endif // result = dref_short_name(dref); result = dref_repr_t(dref); } DBGMSF(debug, "Done. Returning: %s", result); return result; } void ddca_report_display_ref( DDCA_Display_Ref ddca_dref, int depth) { bool debug = false; DBGMSF(debug, "Starting. ddca_dref = %p, depth=%d", ddca_dref, depth); Display_Ref * dref = (Display_Ref *) ddca_dref; rpt_vstring(depth, "DDCA_Display_Ref at %p:", dref); dbgrpt_display_ref(dref, depth+1); } DDCA_Status ddca_open_display( DDCA_Display_Ref ddca_dref, DDCA_Display_Handle * p_dh) { if (!library_initialized) return DDCL_UNINITIALIZED; ddc_ensure_displays_detected(); DDCA_Status rc = 0; *p_dh = NULL; // in case of error Display_Ref * dref = (Display_Ref *) ddca_dref; if (dref == NULL || memcmp(dref->marker, DISPLAY_REF_MARKER, 4) != 0 ) { rc = -EINVAL; } else { Display_Handle* dh = NULL; rc = ddc_open_display(dref, CALLOPT_ERR_MSG, &dh); if (rc == 0) *p_dh = dh; } return rc; } DDCA_Status ddca_close_display(DDCA_Display_Handle ddca_dh) { if (!library_initialized) return DDCL_UNINITIALIZED; DDCA_Status rc = 0; Display_Handle * dh = (Display_Handle *) ddca_dh; // if (dh == NULL || memcmp(dh->marker, DISPLAY_HANDLE_MARKER, 4) != 0 ) { if (!valid_display_handle(dh)) { rc = DDCL_ARG; } else { // TODO: ddc_close_display() needs an action if failure parm, // should return status code ddc_close_display(dh); rc = 0; // is this what to do? } return rc; } char * ddca_dh_repr(DDCA_Display_Handle ddca_dh) { char * repr = NULL; Display_Handle * dh = (Display_Handle *) ddca_dh; if (valid_display_handle(dh)) repr = dh_repr(dh); return repr; } DDCA_Status ddca_get_mccs_version( DDCA_Display_Handle ddca_dh, DDCA_MCCS_Version_Spec* p_spec) { if (!library_initialized) return DDCL_UNINITIALIZED; DDCA_Status rc = 0; Display_Handle * dh = (Display_Handle *) ddca_dh; if (dh == NULL || memcmp(dh->marker, DISPLAY_HANDLE_MARKER, 4) != 0 ) { rc = DDCL_ARG; p_spec->major = 0; p_spec->minor = 0; } else { // need to call function, may not yet be set DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); p_spec->major = vspec.major; p_spec->minor = vspec.minor; rc = 0; } return rc; } DDCA_Status ddca_get_mccs_version_id( DDCA_Display_Handle ddca_dh, DDCA_MCCS_Version_Id* p_id) { DDCA_MCCS_Version_Spec vspec; DDCA_Status rc = ddca_get_mccs_version(ddca_dh, &vspec); if (rc == 0) { DDCA_MCCS_Version_Id version_id = mccs_version_spec_to_id(vspec); *p_id = version_id; } else { *p_id = DDCA_VNONE; } return rc; } char * ddca_mccs_version_id_name(DDCA_MCCS_Version_Id version_id) { return vcp_version_id_name(version_id); } char * ddca_mccs_version_id_desc(DDCA_MCCS_Version_Id version_id) { return format_vcp_version_id(version_id); } #ifdef OLD // or should this return status code? DDCA_Display_Info_List * ddca_get_displays_old() { ddc_ensure_displays_detected(); // PROGRAM_LOGIC_ERROR("---> pseudo failure"); Display_Info_List * info_list = ddc_get_valid_displays(); int true_ct = 0; // number of valid displays for (int ndx = 0; ndx < info_list->ct; ndx++) { Display_Info drec = info_list->info_recs[ndx]; if (drec.dispno != -1) // ignore invalid displays true_ct++; } int reqd_size = offsetof(DDCA_Display_Info_List,info) + true_ct * sizeof(DDCA_Display_Info); DDCA_Display_Info_List * result_list = calloc(1,reqd_size); result_list->ct = true_ct; // DBGMSG("sizeof(DDCA_Display_Info) = %d, sizeof(Display_Info_List) = %d, reqd_size=%d, true_ct=%d, offsetof(DDCA_Display_Info_List,info) = %d", // sizeof(DDCA_Display_Info), sizeof(DDCA_Display_Info_List), reqd_size, true_ct, offsetof(DDCA_Display_Info_List,info)); int true_ctr = 0; for (int ndx = 0; ndx < info_list->ct; ndx++) { Display_Info drec = info_list->info_recs[ndx]; if (drec.dispno != -1) { DDCA_Display_Info * curinfo = &result_list->info[true_ctr++]; memcpy(curinfo->marker, DDCA_DISPLAY_INFO_MARKER, 4); curinfo->dispno = drec.dispno; Display_Ref * dref = drec.dref; #ifdef OLD curinfo->io_mode = dref->io_path.io_mode; curinfo->i2c_busno = dref->io_path.i2c_busno; curinfo->iAdapterIndex = dref->io_path.adlno.iAdapterIndex; curinfo->iDisplayIndex = dref->io_path.adlno.iDisplayIndex; curinfo->usb_bus = dref->usb_bus; curinfo->usb_device = dref->usb_device; #endif curinfo->path.io_mode = dref->io_path.io_mode; switch (dref->io_path.io_mode) { case DDCA_IO_DEVI2C: curinfo->path.i2c_busno = dref->io_path.i2c_busno; break; case DDCA_IO_ADL: curinfo->path.adlno.iAdapterIndex = dref->io_path.adlno.iAdapterIndex; curinfo->path.adlno.iDisplayIndex = dref->io_path.adlno.iDisplayIndex; break; case DDCA_IO_USB: curinfo->usb_bus = dref->usb_bus; curinfo->usb_device = dref->usb_device; curinfo->path.hiddev_devno = dref->io_path.hiddev_devno; break; } curinfo->edid_bytes = drec.edid->bytes; // or should these be memcpy'd instead of just pointers, can edid go away? curinfo->mfg_id = drec.edid->mfg_id; curinfo->model_name = drec.edid->model_name; curinfo->sn = drec.edid->serial_ascii; curinfo->ddca_dref = dref; } } free_display_info_list(info_list); // DBGMSG("Returning %p", result_list); return result_list; } #endif // or should this return status code? DDCA_Display_Info_List * ddca_get_display_info_list(void) { bool debug = false; // PROGRAM_LOGIC_ERROR("Pseudo failure"); ddc_ensure_displays_detected(); GPtrArray * all_displays = ddc_get_all_displays(); int true_ct = 0; // number of valid displays for (int ndx = 0; ndx < all_displays->len; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); if (dref->dispno != -1) // ignore invalid displays true_ct++; } int reqd_size = offsetof(DDCA_Display_Info_List,info) + true_ct * sizeof(DDCA_Display_Info); DDCA_Display_Info_List * result_list = calloc(1,reqd_size); result_list->ct = true_ct; DBGMSF(debug, "sizeof(DDCA_Display_Info) = %d, sizeof(Display_Info_List) = %d, reqd_size=%d, true_ct=%d, offsetof(DDCA_Display_Info_List,info) = %d", sizeof(DDCA_Display_Info), sizeof(DDCA_Display_Info_List), reqd_size, true_ct, offsetof(DDCA_Display_Info_List,info)); int true_ctr = 0; for (int ndx = 0; ndx < all_displays->len; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); if (dref->dispno != -1) { DDCA_Display_Info * curinfo = &result_list->info[true_ctr++]; memcpy(curinfo->marker, DDCA_DISPLAY_INFO_MARKER, 4); curinfo->dispno = dref->dispno; // TODO: simplify curinfo->path = dref->io_path; #ifdef OLD curinfo->path.io_mode = dref->io_path.io_mode; // n. usb_bus, usb_device initialized to 0 by calloc switch (dref->io_path.io_mode) { case DDCA_IO_DEVI2C: curinfo->path.path.i2c_busno = dref->io_path.path.i2c_busno; break; case DDCA_IO_ADL: curinfo->path.path.adlno.iAdapterIndex = dref->io_path.path.adlno.iAdapterIndex; curinfo->path.path.adlno.iDisplayIndex = dref->io_path.path.adlno.iDisplayIndex; break; case DDCA_IO_USB: curinfo->usb_bus = dref->usb_bus; curinfo->usb_device = dref->usb_device; curinfo->path.path.hiddev_devno = dref->io_path.path.hiddev_devno; break; } #endif if (dref->io_path.io_mode == DDCA_IO_USB) { curinfo->usb_bus = dref->usb_bus; curinfo->usb_device = dref->usb_device; } curinfo->edid_bytes = dref->pedid->bytes; // or should these be memcpy'd instead of just pointers, can edid go away? curinfo->mfg_id = dref->pedid->mfg_id; curinfo->model_name = dref->pedid->model_name; curinfo->sn = dref->pedid->serial_ascii; curinfo->dref = dref; } } DBGMSF(debug, "Done. Returning %p", result_list); return result_list; } static void ddca_free_display_info(DDCA_Display_Info * info_rec) { // All pointers in DDCA_Display_Info are to permanently allocated // data structures. Nothing to free. if (info_rec && memcmp(info_rec->marker, DDCA_DISPLAY_INFO_MARKER, 4) == 0) { info_rec->marker[3] = 'x'; // free(info_rec); } } void ddca_free_display_info_list(DDCA_Display_Info_List * dlist) { if (dlist) { for (int ndx = 0; ndx < dlist->ct; ndx++) { ddca_free_display_info(&dlist->info[ndx]); } free(dlist); } } void ddca_report_display_info( DDCA_Display_Info * dinfo, int depth) { bool debug = false; DBGMSF(debug, "Starting. dinfo=%p, depth=%d", dinfo, depth); assert(dinfo); assert(memcmp(dinfo->marker, DDCA_DISPLAY_INFO_MARKER, 4) == 0); int d0 = depth; int d1 = depth+1; int d2 = depth+2; rpt_vstring(d0, "Display number: %d", dinfo->dispno); rpt_vstring(d1, "IO mode: %s", io_mode_name(dinfo->path.io_mode)); switch(dinfo->path.io_mode) { case (DDCA_IO_DEVI2C): rpt_vstring(d1, "I2C bus number: %d", dinfo->path.path.i2c_busno); break; case (DDCA_IO_ADL): rpt_vstring(d1, "ADL adapter.display: %d.%d", dinfo->path.path.adlno.iAdapterIndex, dinfo->path.path.adlno.iDisplayIndex); break; case (DDCA_IO_USB): rpt_vstring(d1, "USB bus.device: %d.%d", dinfo->usb_bus, dinfo->usb_device); rpt_vstring(d1, "USB hiddev number: %d", dinfo->path.path.hiddev_devno); break; } // char * edidstr = hexstring(dinfo->edid_bytes, 128); rpt_vstring(d1, "Mfg Id: %s", dinfo->mfg_id); rpt_vstring(d1, "Model: %s", dinfo->model_name); rpt_vstring(d1, "Serial number: %s", dinfo->sn); // rpt_vstring(d1, "EDID: %s", edidstr); rpt_vstring(d1, "EDID:"); rpt_hex_dump(dinfo->edid_bytes, 128, d2); rpt_vstring(d1, "dref: %p", dinfo->dref); // free(edidstr); DBGMSF(debug, "Done"); } void ddca_report_display_info_list( DDCA_Display_Info_List * dlist, int depth) { bool debug = false; DBGMSF(debug, "Starting. dlist=%p, depth=%d", dlist, depth); int d1 = depth+1; rpt_vstring(depth, "Found %d displays", dlist->ct); for (int ndx=0; ndxct; ndx++) { ddca_report_display_info(&dlist->info[ndx], d1); } } DDCA_Status ddca_get_edid_by_display_ref( DDCA_Display_Ref ddca_dref, uint8_t** p_bytes) { DDCA_Status rc = 0; *p_bytes = NULL; if (!library_initialized) { rc = DDCL_UNINITIALIZED; goto bye; } Display_Ref * dref = (Display_Ref *) ddca_dref; // if (dref == NULL || memcmp(dref->marker, DISPLAY_REF_MARKER, 4) != 0 ) { if ( !valid_display_ref(dref) ) { rc = DDCL_ARG; goto bye; } // Parsed_Edid* edid = ddc_get_parsed_edid_by_display_ref(dref); Parsed_Edid * edid = dref->pedid; assert(edid); *p_bytes = edid->bytes; bye: return rc; } #ifdef OLD // or return a struct? DDCA_Status ddca_get_feature_flags_by_vcp_version( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Version_Feature_Flags * flags) { DDCA_Status rc = 0; DDCA_MCCS_Version_Spec vspec = mccs_version_id_to_spec(mccs_version_id); VCP_Feature_Table_Entry * pentry = vcp_find_feature_by_hexid(feature_code); if (!pentry) { *flags = 0; rc = DDCL_ARG; } else { DDCA_Version_Feature_Flags vflags = get_version_specific_feature_flags(pentry, vspec); *flags = 0; // TODO handle subvariants REWORK if (vflags & VCP2_RO) *flags |= DDCA_RO; if (vflags & VCP2_WO) *flags |= DDCA_WO; if (vflags & VCP2_RW) *flags |= DDCA_RW; if (vflags & VCP2_CONT) *flags |= DDCA_CONTINUOUS; #ifdef OLD if (pentry->flags & VCP_TYPE_V2NC_V3T) { if (vspec.major < 3) *flags |= DDCA_SIMPLE_NC; else *flags |= DDCA_TABLE; } #endif else if (vflags & DDCA_TABLE) *flags |= DDCA_TABLE; else if (vflags & VCP2_NC) { if (vspec.major < 3) *flags |= DDCA_SIMPLE_NC; else { // TODO: In V3, some features use combination of high and low bytes // for now, mark all as simple *flags |= DDCA_SIMPLE_NC; // alt: DDCT_COMPLEX_NC } } } return rc; } #endif DDCA_Status ddca_get_feature_info_by_vcp_version( DDCA_Vcp_Feature_Code feature_code, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Version_Feature_Info** p_info) { bool debug = false; DBGMSF(debug, "Starting. feature_code=0x%02x, mccs_version_id=%d", feature_code, mccs_version_id); DDCA_Status psc = 0; *p_info = NULL; // DDCA_MCCS_Version_Spec vspec = mccs_version_id_to_spec(mccs_version_id); // or should this be a version sensitive call? DDCA_Version_Feature_Info * info = get_version_feature_info( feature_code, mccs_version_id, false, // with_default true); // false => version specific, true=> version sensitive if (!info) psc = DDCL_ARG; else *p_info = info; DBGMSF(debug, "Returning:%d, *p_info=%p", psc, *p_info); return psc; } DDCA_Status ddca_get_feature_info_by_display( DDCA_Display_Handle ddca_dh, // needed because in rare cases feature info is MCCS version dependent DDCA_Vcp_Feature_Code feature_code, DDCA_Version_Feature_Info ** p_info) { WITH_DH( ddca_dh, { DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(ddca_dh); // DDCT_MCCS_Version_Spec vspec2; // = {vspec.major, vspec.minor}; // vspec2.major = vspec.major; // vspec2.minor = vspec.minor; DDCA_MCCS_Version_Id version_id = mccs_version_spec_to_id(vspec); psc = ddca_get_feature_info_by_vcp_version(feature_code, version_id, p_info); } ); } DDCA_Status ddca_free_feature_info( DDCA_Version_Feature_Info * info) { DDCA_Status rc = 0; if (info) { if (memcmp(info->marker, VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER, 4) != 0 ) { rc = DDCL_ARG; } else { free_version_feature_info(info); } } return rc; } // static char default_feature_name_buffer[40]; char * ddca_get_feature_name(DDCA_Vcp_Feature_Code feature_code) { // do we want get_feature_name()'s handling of mfg specific and unrecognized codes? char * result = get_feature_name_by_id_only(feature_code); // snprintf(default_feature_name_buffer, sizeof(default_feature_name_buffer), "VCP Feature 0x%02x", feature_code); // return default_feature_name_buffer; return result; } // // Display Inquiry // DDCA_Status ddca_get_simple_sl_value_table( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Feature_Value_Entry** pvalue_table) { bool debug = false; DDCA_Status rc = 0; *pvalue_table = NULL; DDCA_MCCS_Version_Spec vspec = mccs_version_id_to_spec(mccs_version_id); DBGMSF(debug, "feature_code = 0x%02x, mccs_version_id=%d, vspec=%d.%d", feature_code, mccs_version_id, vspec.major, vspec.minor); VCP_Feature_Table_Entry * pentry = vcp_find_feature_by_hexid(feature_code); if (!pentry) { *pvalue_table = NULL; rc = DDCRC_NOT_FOUND; } else { DDCA_MCCS_Version_Spec vspec2 = {vspec.major, vspec.minor}; DDCA_Version_Feature_Flags vflags = get_version_sensitive_feature_flags(pentry, vspec2); if (!(vflags & DDCA_SIMPLE_NC)) { *pvalue_table = NULL; rc = -EINVAL; } else { DDCA_Feature_Value_Entry * table = get_version_specific_sl_values(pentry, vspec2); DDCA_Feature_Value_Entry * table2 = (DDCA_Feature_Value_Entry*) table; // identical definitions *pvalue_table = table2; rc = 0; } } DBGMSF(debug, "Done. *pvalue_table=%p, returning %s", *pvalue_table, psc_desc(rc)); return rc; } // typedef void * Feature_Value_Table; // temp // or: DDCA_Status ddca_get_simple_nc_feature_value_name( DDCA_Display_Handle ddca_dh, // needed because value lookup mccs version dependent DDCA_Vcp_Feature_Code feature_code, uint8_t feature_value, char** p_feature_name) { WITH_DH(ddca_dh, { // this should be a function in vcp_feature_codes: char * feature_name = NULL; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); DDCA_Feature_Value_Entry * feature_value_entries = NULL; psc = ddca_get_simple_sl_value_table(feature_code, mccs_version_spec_to_id(vspec), &feature_value_entries); if (psc == 0) { feature_name = get_feature_value_name(feature_value_entries, feature_value); if (feature_name == NULL) psc = DDCRC_NOT_FOUND; // correct handling for value not found? else *p_feature_name = feature_name; } } ); } DDCA_Status ddca_get_simple_nc_feature_value_name0( DDCA_Display_Handle ddca_dh, // needed because value lookup mccs version dependent DDCA_Vcp_Feature_Code feature_code, uint8_t feature_value, char** p_feature_name) { WITH_DH(ddca_dh, { // this should be a function in vcp_feature_codes: char * feature_name = NULL; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); DDCA_Feature_Value_Entry * feature_value_entries = find_feature_values(feature_code, vspec); if (feature_value_entries == NULL) { psc = DDCL_ARG; } else { feature_name = get_feature_value_name(feature_value_entries, feature_value); if (feature_name == NULL) psc = DDCL_ARG; // correct handling for value not found? else *p_feature_name = feature_name; } } ); } /** Gets the value of a non-table VCP feature. * * \param ddca_dh handle of open display * \param feature_code VCP feature code * \param response pointer to existing #DDCA_Non_Table_Value_Response that is filled in * \return status code */ static DDCA_Status ddca_get_nontable_vcp_value_old( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Non_Table_Value_Response * response) { Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { Parsed_Nontable_Vcp_Response * code_info; ddc_excp = get_nontable_vcp_value( dh, feature_code, &code_info); psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); // DBGMSG(" get_nontable_vcp_value() returned %s", gsc_desc(gsc)); if (psc == 0) { response->feature_code = code_info->vcp_code; // response->cur_value = code_info->cur_value; // response->max_value = code_info->max_value; response->val.nc.mh = code_info->mh; response->val.nc.ml = code_info->ml; response->val.nc.sh = code_info->sh; response->val.nc.sl = code_info->sl; free(code_info); } // else psc = global_to_public_status_code(gsc); } ); } DDCA_Status ddca_get_nontable_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Non_Table_Value * valrec) { DDCA_Non_Table_Value_Response response; DDCA_Status rc = 0; rc = ddca_get_nontable_vcp_value_old(ddca_dh, feature_code, &response); if (rc == 0) { valrec->mh = response.val.nc.mh; valrec->ml = response.val.nc.ml; valrec->sh = response.val.nc.sh; valrec->sl = response.val.nc.sl; } return rc; } // Partial code for getting formatted value // //Parsed_Vcp_Response pvr; //pvr.response_type = NON_TABLE_VCP_VALUE; //pvr.non_table_response = response; // //Single_Vcp_Value * valrec = // create_single_vcp_value_by_parsed_vcp_response( // feature_code, // *pvr); // //bool ok = vcp_format_feature_detail( // VCP_Feature_Table_Entry * vcp_entry, // DDCA_MCCS_Version_Spec vcp_version, // Single_Vcp_Value * valrec, //#ifdef OLD // Parsed_Vcp_Response * raw_data, //#endif // char * * aformatted_data // ) // // untested DDCA_Status ddca_get_table_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, int * value_len, Byte** value_bytes) { Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { Buffer * p_table_bytes = NULL; ddc_excp = get_table_vcp_value(dh, feature_code, &p_table_bytes); psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); if (psc == 0) { assert(p_table_bytes); // avoid coverity warning int len = p_table_bytes->len; *value_len = len; *value_bytes = malloc(len); memcpy(*value_bytes, p_table_bytes->bytes, len); buffer_free(p_table_bytes, __func__); } } ); } // alt static DDCA_Status ddca_get_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type call_type, // why is this needed? look it up from dh and feature_code DDCA_Single_Vcp_Value ** pvalrec) { Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { bool debug = false; DBGMSF(debug, "Starting. ddca_dh=%p, feature_code=0x%02x, call_type=%d, pvalrec=%p", ddca_dh, feature_code, call_type, pvalrec); *pvalrec = NULL; ddc_excp = get_vcp_value(dh, feature_code, call_type, pvalrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); DBGMSF(debug, "*pvalrec=%p", *pvalrec); } ); } static DDCA_Vcp_Value_Type_Parm get_value_type_parm( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type_Parm default_value) { bool debug = false; DBGMSF(debug, "Starting. ddca_dh=%p, feature_code=0x%02x, default_value=%d", ddca_dh, feature_code, default_value); DDCA_Vcp_Value_Type_Parm result = default_value; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(ddca_dh); VCP_Feature_Table_Entry * pentry = vcp_find_feature_by_hexid(feature_code); if (pentry) { DDCA_Version_Feature_Flags flags = get_version_sensitive_feature_flags(pentry, vspec); // Version_Feature_Flags flags = feature_info->internal_feature_flags; // n. will default to NON_TABLE_VCP_VALUE if not a known code result = (flags & DDCA_TABLE) ? DDCA_TABLE_VCP_VALUE : DDCA_NON_TABLE_VCP_VALUE; } DBGMSF(debug, "Returning %d", result); return result; } DDCA_Status ddca_get_any_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type_Parm call_type, DDCA_Any_Vcp_Value ** pvalrec) { bool debug = false; DBGMSF(debug, "Starting. ddca_dh=%p, feature_code=0x%02x, call_type=%d, pvalrec=%p", ddca_dh, feature_code, call_type, pvalrec); *pvalrec = NULL; DDCA_Status rc = DDCL_ARG; if (call_type == DDCA_UNSET_VCP_VALUE_TYPE_PARM) { call_type = get_value_type_parm(ddca_dh, feature_code, DDCA_UNSET_VCP_VALUE_TYPE_PARM); } if (call_type != DDCA_UNSET_VCP_VALUE_TYPE_PARM) { DDCA_Single_Vcp_Value * valrec2 = NULL; rc = ddca_get_vcp_value(ddca_dh, feature_code, call_type, &valrec2); if (rc == 0) { #ifdef OLD DDCA_Any_Vcp_Value * valrec = calloc(1, sizeof(DDCA_Any_Vcp_Value)); valrec->opcode = valrec2->opcode; valrec->value_type = valrec2->value_type; if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { valrec->val.c_nc.mh = valrec2->val.nc.mh; valrec->val.c_nc.ml = valrec2->val.nc.ml; valrec->val.c_nc.sh = valrec2->val.nc.sh; valrec->val.c_nc.sl = valrec2->val.nc.sl; } else { // DDCA_TABLE_VCP_VALUE valrec->val.t.bytect = valrec2->val.t.bytect; valrec->val.t.bytes = valrec2->val.t.bytes; } free(valrec2); #endif DDCA_Any_Vcp_Value * valrec = single_vcp_value_to_any_vcp_value(valrec2); *pvalrec = valrec; } } DBGMSF(debug, "Done. Returning %s, *pvalrec=%p", psc_desc(rc), *pvalrec); return rc; } DDCA_Status ddca_start_get_any_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type_Parm call_type, DDCA_Notification_Func callback_func) { bool debug = true; DBGMSF(debug, "Starting. ddca_dh=%p, feature_code=0x%02x, call_type=%d", ddca_dh, feature_code, call_type); DDCA_Status rc = DDCL_ARG; if (call_type == DDCA_UNSET_VCP_VALUE_TYPE_PARM) { call_type = get_value_type_parm(ddca_dh, feature_code, DDCA_UNSET_VCP_VALUE_TYPE_PARM); } if (call_type != DDCA_UNSET_VCP_VALUE_TYPE_PARM) { Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { ddc_excp = start_get_vcp_value(dh, feature_code, call_type, callback_func); rc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); } ); } DBGMSF(debug, "Done. Returning %s", psc_desc(rc)); return rc; } DDCA_Status ddca_get_formatted_vcp_value( DDCA_Display_Handle * ddca_dh, DDCA_Vcp_Feature_Code feature_code, char** p_formatted_value) { Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { *p_formatted_value = NULL; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); // DDCA_MCCS_Version_Id version_id = mccs_version_spec_to_id(vspec); VCP_Feature_Table_Entry * pentry = vcp_find_feature_by_hexid(feature_code); if (!pentry) { #ifdef ALT DDCA_Version_Feature_Info * feature_info = get_version_specific_feature_info( feature_code, true, // with_default version_id); assert(feature_info); if (!feature_info) { #endif psc = DDCL_ARG; } else { DDCA_Version_Feature_Flags flags = get_version_sensitive_feature_flags(pentry, vspec); // Version_Feature_Flags flags = feature_info->internal_feature_flags; // n. will default to NON_TABLE_VCP_VALUE if not a known code DDCA_Vcp_Value_Type call_type = (flags & DDCA_TABLE) ? DDCA_TABLE_VCP_VALUE : DDCA_NON_TABLE_VCP_VALUE; DDCA_Single_Vcp_Value * pvalrec; ddc_excp = get_vcp_value(dh, feature_code, call_type, &pvalrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); if (psc == 0) { bool ok = vcp_format_feature_detail( pentry, vspec, pvalrec, p_formatted_value ); if (!ok) { psc = DDCL_OTHER; // ** WRONG CODE *** assert(!p_formatted_value); } } } } ) } DDCA_Status ddca_set_single_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Single_Vcp_Value * valrec) { Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { ddc_excp = set_vcp_value(dh, valrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); } ); } DDCA_Status ddca_set_continuous_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, int new_value) { #ifdef OLD WITH_DH(ddca_dh, { status_code = set_nontable_vcp_value(dh, feature_code, new_value); // psc = global_to_public_status_code(gsc); } ); #endif DDCA_Single_Vcp_Value valrec; valrec.opcode = feature_code; valrec.value_type = DDCA_NON_TABLE_VCP_VALUE; valrec.val.c.cur_val = new_value; return ddca_set_single_vcp_value(ddca_dh, &valrec); } DDCA_Status ddca_set_simple_nc_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, Byte new_value) { return ddca_set_continuous_vcp_value(ddca_dh, feature_code, new_value); } DDCA_Status ddca_set_raw_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, Byte hi_byte, Byte lo_byte) { return ddca_set_continuous_vcp_value(ddca_dh, feature_code, hi_byte << 8 | lo_byte); } // // Monitor Capabilities // DDCA_Status ddca_get_capabilities_string( DDCA_Display_Handle ddca_dh, char** pcaps) { bool debug = false; Error_Info * ddc_excp = NULL; WITH_DH(ddca_dh, { char * p_cap_string = NULL; ddc_excp = get_capabilities_string(dh, &p_cap_string); psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); if (psc == 0) { // make copy to ensure caller does not muck around in ddcutil's // internal data structures *pcaps = strdup(p_cap_string); DBGMSF(debug, "*pcaps=%p", *pcaps); } } ); } DDCA_Status ddca_parse_capabilities_string( char * capabilities_string, DDCA_Capabilities ** p_parsed_capabilities) { bool debug = false; DBGMSF(debug, "Starting. capabilities_string: |%s|", capabilities_string); DDCA_Status psc = DDCL_OTHER; // DDCL_BAD_DATA? DBGMSF(debug, "psc initialized to %s", psc_desc(psc)); DDCA_Capabilities * result = NULL; // need to control messages? Parsed_Capabilities * pcaps = parse_capabilities_string(capabilities_string); if (pcaps) { if (debug) { DBGMSG("Parsing succeeded. "); report_parsed_capabilities(pcaps); DBGMSG("Convert to DDCA_Capabilities..."); } result = calloc(1, sizeof(DDCA_Capabilities)); memcpy(result->marker, DDCA_CAPABILITIES_MARKER, 4); result->unparsed_string= strdup(capabilities_string); // needed? result->version_spec = pcaps->parsed_mccs_version; // n. needen't set vcp_code_ct if !pcaps, calloc() has done it if (pcaps->vcp_features) { result->vcp_code_ct = pcaps->vcp_features->len; result->vcp_codes = calloc(result->vcp_code_ct, sizeof(DDCA_Cap_Vcp)); // DBGMSF(debug, "allocate %d bytes at %p", result->vcp_code_ct * sizeof(DDCA_Cap_Vcp), result->vcp_codes); for (int ndx = 0; ndx < result->vcp_code_ct; ndx++) { DDCA_Cap_Vcp * cur_cap_vcp = &result->vcp_codes[ndx]; // DBGMSF(debug, "cur_cap_vcp = %p", &result->vcp_codes[ndx]); memcpy(cur_cap_vcp->marker, DDCA_CAP_VCP_MARKER, 4); Capabilities_Feature_Record * cur_cfr = g_ptr_array_index(pcaps->vcp_features, ndx); // DBGMSF(debug, "Capabilities_Feature_Record * cur_cfr = %p", cur_cfr); assert(memcmp(cur_cfr->marker, CAPABILITIES_FEATURE_MARKER, 4) == 0); // if (debug) // show_capabilities_feature(cur_cfr, result->version_spec); cur_cap_vcp->feature_code = cur_cfr->feature_id; // DBGMSF(debug, "cur_cfr = %p, feature_code - 0x%02x", cur_cfr, cur_cfr->feature_id); // cur_cap_vcp->raw_values = strdup(cur_cfr->value_string); // TODO: get values from Byte_Bit_Flags cur_cfr->bbflags #ifdef OLD_BVA Byte_Value_Array bva = cur_cfr->values; if (bva) { cur_cap_vcp->value_ct = bva_length(bva); cur_cap_vcp->values = bva_bytes(bva); // makes copy of bytes } #endif if (cur_cfr->bbflags) { cur_cap_vcp->value_ct = bbf_count_set(cur_cfr->bbflags); cur_cap_vcp->values = calloc(1, cur_cap_vcp->value_ct); bbf_to_bytes(cur_cfr->bbflags, cur_cap_vcp->values, cur_cap_vcp->value_ct); } } } psc = 0; free_parsed_capabilities(pcaps); } *p_parsed_capabilities = result; DBGMSF(debug, "Done. Returning: %d", psc); return psc; } void ddca_free_parsed_capabilities( DDCA_Capabilities * pcaps) { bool debug = false; if (pcaps) { assert(memcmp(pcaps->marker, DDCA_CAPABILITIES_MARKER, 4) == 0); free(pcaps->unparsed_string); DBGMSF(debug, "vcp_code_ct = %d", pcaps->vcp_code_ct); for (int ndx = 0; ndx < pcaps->vcp_code_ct; ndx++) { DDCA_Cap_Vcp * cur_vcp = &pcaps->vcp_codes[ndx]; assert(memcmp(cur_vcp->marker, DDCA_CAP_VCP_MARKER, 4) == 0); free(cur_vcp->values); cur_vcp->marker[3] = 'x'; } pcaps->marker[3] = 'x'; free(pcaps); } } void ddca_report_parsed_capabilities( DDCA_Capabilities * pcaps, int depth) { bool debug = false; DBGMSF(debug, "Starting"); assert(pcaps && memcmp(pcaps->marker, DDCA_CAPABILITIES_MARKER, 4) == 0); int d1 = depth+1; int d2 = depth+2; int d3 = depth+3; // rpt_structure_loc("DDCA_Capabilities", pcaps, depth); rpt_label( d1, "Capabilities:"); rpt_vstring(d1, "unparsed string: %s", pcaps->unparsed_string); rpt_vstring(d1, "VCP version: %d.%d", pcaps->version_spec.major, pcaps->version_spec.minor); rpt_vstring(d1, "VCP codes:"); for (int code_ndx = 0; code_ndx < pcaps->vcp_code_ct; code_ndx++) { DDCA_Cap_Vcp * cur_vcp = &pcaps->vcp_codes[code_ndx]; assert( memcmp(cur_vcp->marker, DDCA_CAP_VCP_MARKER, 4) == 0); rpt_vstring(d2, "Feature code: 0x%02x", cur_vcp->feature_code); if (cur_vcp->value_ct > 0) { char * hs = hexstring(cur_vcp->values, cur_vcp->value_ct); rpt_vstring(d3, "Values: %s", hs); free(hs); } } } DDCA_Status ddca_get_profile_related_values( DDCA_Display_Handle ddca_dh, char** pprofile_values_string) { WITH_DH(ddca_dh, { bool debug = false; DBGMSF(debug, "Before dumpvcp_to_string_by_display_handle(), pprofile_values_string=%p, *pprofile_values_string=%p", pprofile_values_string, *pprofile_values_string); psc = dumpvcp_as_string(dh, pprofile_values_string); DBGMSF(debug, "After dumpvcp_to_string_by_display_handle(), pprofile_values_string=%p, *pprofile_values_string=%p", pprofile_values_string, *pprofile_values_string); DBGMSF(debug, "*pprofile_values_string = |%s|", *pprofile_values_string); } ); } // TODO: handle display as optional argument DDCA_Status ddca_set_profile_related_values( char * profile_values_string) { Error_Info * ddc_excp = loadvcp_by_string(profile_values_string, NULL); Public_Status_Code psc = (ddc_excp) ? ddc_excp->status_code : 0; errinfo_free(ddc_excp); return psc; } // // Reports // int ddca_report_active_displays(int depth) { // return ddc_report_active_displays(depth); return ddc_report_displays(DDC_REPORT_VALID_DISPLAYS_ONLY, 0); } // CFFI DDCA_Status ddca_pass_callback( Simple_Callback_Func func, int parm ) { DBGMSG("parm=%d", parm); int callback_rc = func(parm+2); DBGMSG("returning %d", callback_rc); return callback_rc; } ddcutil-0.8.6/src/public/0000755000175000001440000000000013230445446012224 500000000000000ddcutil-0.8.6/src/public/ddcutil_types.h0000644000175000001440000004475313230445447015207 00000000000000/* ddcutil_types.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file ddcutil_types.h * @brief File ddcutil_types.h contains type declarations for the C API. * * API function declarations are specified in a separate file, ddcutil_c_api.h. * The reason for this split is that the type declarations are used throughout the * **ddcutil** implementation, whereas the function declarations are only referenced * within the code that implements the API. */ #ifndef DDCUTIL_TYPES_H_ #define DDCUTIL_TYPES_H_ /** \cond */ // #include // #include // used only in obsolete DDCA_Global_Failure_Information #include // for uint8_t, unit16_t /** \endcond */ // // Status Code // /** * **ddcutil** Status Code * * Most public **ddcutil** functions return a status code. * These status codes have 3 sources: * - Linux * - ADL (AMD Display Library) * - **ddcutil** itself * * These multiple status code sources are consolidated by "modulating" * the raw values into non-overlapping ranges. * - Linux errno values are returned as negative numbers (e.g. -EIO) * - ADL values are modulated by 2000 (i.e., 2000 subtracted from negative ADL status codes, * or added to positive ADL status codes) * - ddcutil errors are always in the -3000 range * * In summary: * - 0 always indicates a normal successful status * - Positive values (possible with ADL) represent qualified success of some sort * - Negative values indicate an error condition. */ typedef int DDCA_Status; // // Build Information // //! ddcutil version //! typedef struct { uint8_t major; uint8_t minor; uint8_t micro; } DDCA_Ddcutil_Version_Spec; // // Global Settings // #ifdef OBSOLETE //! Failure information filled in at the time of a program abort, //! before longjmp() is called. typedef struct { bool info_set_fg; char funcname[64]; int lineno; char fn[PATH_MAX]; int status; } DDCA_Global_Failure_Information; #endif // // I2C Protocol Control // //! I2C timeout types //! typedef enum{ DDCA_TIMEOUT_STANDARD, /**< Normal retry interval */ DDCA_TIMEOUT_TABLE_RETRY /**< Special timeout for Table reads and writes */ } DDCA_Timeout_Type; //! I2C retry limit types // typedef enum{ DDCA_WRITE_ONLY_TRIES, /**< Maximum write-only operation tries */ DDCA_WRITE_READ_TRIES, /**< Maximum read-write operation tries */ DDCA_MULTI_PART_TRIES /**< Maximum multi-part operation tries */ } DDCA_Retry_Type; // // Message Control // //! Output Level //! //! Values assigned to constants allow them to be or'd in bit flags. //! //! Values are ascending in order of verbosity //! typedef enum { DDCA_OL_TERSE =0x04, /**< Brief output */ DDCA_OL_NORMAL =0x08, /**< Normal output */ DDCA_OL_VERBOSE=0x10 /**< Verbose output */ } DDCA_Output_Level; // // Performance statistics // //! Used as values to specify a single statistics type, and as //! bitflags to select statistics types. typedef enum { DDCA_STATS_NONE = 0x00, ///< no statistics DDCA_STATS_TRIES = 0x01, ///< retry statistics DDCA_STATS_ERRORS = 0x02, ///< error statistics DDCA_STATS_CALLS = 0x04, ///< system calls DDCA_STATS_ELAPSED = 0x08, ///< total elapsed time DDCA_STATS_ALL = 0xFF ///< indicates all statistics types } DDCA_Stats_Type; // // Display Specification // /** \defgroup api_display_spec API Display Specification */ /** @name Display Specification Monitors are referenced in 3 different ways depending on contexts: 1) A #DDCA_Display_Identifier contains criteria for selecting a monitor, typically as entered by a user. These may directly identify a monitor (e.g. by I2C bus number), or entail a search (e.g. EDID). Resolving a #DDCA_Display_Identifier resolves to a #DDCA_Display_Ref. 2) #DDCA_Display_Ref indicates the operating system path to a display. It can be an I2C identifier,an ADL identifier, or a USB identifier. For Display_Identifiers containing an I2C bus number or ADL adapter.display numbers, the translation from DDCA_Display_Identifier to DDCA_Display_Ref is direct. Otherwise, a search of detected monitors must be performed. Opening a #DDCA_Display_Ref results in a #DDCA_Display_Handle. 3) A #DDCA_Display_Handle references a display that has been "opened". This is used for most function calls performing an operation on a display. For I2C and USB connected displays, an operating system open is performed when creating DDCA_Display_Handle from a DDCA_Display_Ref. DDCA_Display_Handle then contains the open file handle. For ADL displays, no actual open is performed when creating a DDCA_Display_Handle from a DDCA_Display_Ref. The adapter number.device number pair are simply copied. \ingroup api_display_spec */ ///@{ /** Opaque display identifier * * A **DDCA_Display_Identifier** holds the criteria for selecting a display, * typically as specified by the user. * * It can take several forms: * - the display number assigned by **dccutil** * - an I2C bus number * - an ADL (adapter index, display index) pair * - a USB (bus number, device number) pair * - an EDID * - manufacturer, model, and serial number strings * * \ingroup api_display_spec * */ typedef void * DDCA_Display_Identifier; /** Opaque display reference. * * A **DDCA_Display_Ref** references a display using the identifiers by which it is accessed * in Linux. It takes one of three forms: * - an I2C bus number * - an ADL (adapter index, display index) pair * - a USB (bus number, device number pair) * * \ingroup api_display_spec */ typedef void * DDCA_Display_Ref; /** Opaque display handle * * A **DDCA_Display_Handle** represents an open display on which actions can be performed. * * \ingroup api_display_spec */ typedef void * DDCA_Display_Handle; ///@} /** ADL adapter number/display number pair, which identifies a display */ typedef struct { int iAdapterIndex; /**< adapter number */ int iDisplayIndex; /**< display number */ } DDCA_Adlno; // uses -1,-1 for unset // // Display Information // /** Indicates how a display is accessed */ typedef enum { DDCA_IO_DEVI2C, /**< Use DDC to communicate with a /dev/i2c-n device */ DDCA_IO_ADL, /**< Use ADL API */ DDCA_IO_USB /**< Use USB reports for a USB connected monitor */ } DDCA_IO_Mode; /** Describes a display's physical access mode and the location identifiers for that mode */ typedef struct { DDCA_IO_Mode io_mode; ///< physical access mode union { int i2c_busno; ///< I2C bus number DDCA_Adlno adlno; ///< ADL iAdapterIndex/iDisplayIndex pair int hiddev_devno; ///* USB hiddev device number } path; } DDCA_IO_Path; #define DDCA_DISPLAY_INFO_MARKER "DDIN" /** Describes one monitor detected by ddcutil. */ typedef struct { char marker[4]; ///< always "DDIN" int dispno; ///< ddcutil assigned display number DDCA_IO_Path path; ///< physical access path to display int usb_bus; ///< USB bus number, if USB connection int usb_device; ///< USB device number, if USB connection // or should these be actual character/byte arrays instead of pointers? const char * mfg_id; ///< 3 character manufacturer id, from EDID const char * model_name; ///< model name, from EDID const char * sn; ///< ASCII serial number string from EDID const uint8_t * edid_bytes; ///< raw bytes (128) of first EDID block DDCA_Display_Ref dref; ///< opaque display reference } DDCA_Display_Info; /** Collection of #DDCA_Display_Info */ typedef struct { int ct; ///< number of records DDCA_Display_Info info[]; ///< array whose size is determined by ct } DDCA_Display_Info_List; // // VCP Feature Information // // Both DDCA_MCCS_Version_Spec and DDCA_MCCS_Version_Id exist for historical reasons. // DDCA_MCCS_Version_Spec is the form in which the version number is returned from a // GETVCP of feature xDF. This form is used throughout much of ddcutil. // DDCA_MCCS_Version_Id reflects the fact that there are a small number of versions // and simplifies program logic that varies among versions. /** MCCS Version in binary form */ typedef struct { uint8_t major; /**< major version number */ uint8_t minor; /*** minor version number */ } DDCA_MCCS_Version_Spec; /** @name version_id * Ids for MCCS/VCP versions, reflecting the fact that * there is a smaill set of valid version values. */ ///@{ // in sync w constants MCCS_V.. in vcp_feature_codes.c /** MCCS (VCP) Feature Version IDs */ typedef enum { DDCA_VNONE = 0, /**< As query, match any MCCS version, as response, version unknown */ DDCA_V10 = 1, /**< MCCS v1.0 */ DDCA_V20 = 2, /**< MCCS v2.0 */ DDCA_V21 = 4, /**< MCCS v2.1 */ DDCA_V30 = 8, /**< MCCS v3.0 */ DDCA_V22 = 16 /**< MCCS v2.2 */ } DDCA_MCCS_Version_Id; #define DDCA_VANY DDCA_VNONE /**< For use on queries, indicates match any version */ #define DDCA_VUNK DDCA_VNONE /**< For use on responses, indicates version unknown */ ///@} /** MCCS VCP Feature Id */ typedef uint8_t DDCA_Vcp_Feature_Code; /** @name Version Feature Flags * * #DDCA_Version_Feature_Flags is a byte of flags describing attributes of a * VCP feature that can vary by MCCS version. * * @remark * Exactly 1 of #DDCA_RO, #DDCA_WO, #DDCA_RW is set. * @remark * Flags #DDCA_STD_CONT, #DDCA_COMPLEX_CONT, #DDCA_SIMPLE_NC, #DDCA_COMPLEX_NC, * #DDCA_WO_NC, #DDCA_NORMAL_TABLE, #DDCA_WO_TABLE refine the C/NC/TABLE categorization * of the VESA MCCS specification. Exactly 1 of these bits is set. */ ///@{ /** Flags specifying VCP feature attributes, which can be VCP version dependent. */ typedef uint16_t DDCA_Version_Feature_Flags; // Bits in DDCA_Version_Feature_Flags: // Exactly 1 of DDCA_RO, DDCA_WO, DDCA_RW is set #define DDCA_RO 0x0400 /**< Read only feature */ #define DDCA_WO 0x0200 /**< Write only feature */ #define DDCA_RW 0x0100 /**< Feature is both readable and writable */ #define DDCA_READABLE (DDCA_RO | DDCA_RW) /**< Feature is either RW or RO */ #define DDCA_WRITABLE (DDCA_WO | DDCA_RW) /**< Feature is either RW or WO */ // Further refine the C/NC/TABLE categorization of the MCCS spec // Exactly 1 of the following 7 bits is set #define DDCA_STD_CONT 0x0080 /**< Normal continuous feature */ #define DDCA_COMPLEX_CONT 0x0040 /**< Continuous feature with special interpretation */ #define DDCA_SIMPLE_NC 0x0020 /**< Non-continuous feature, having a defined list of values in byte SL */ #define DDCA_COMPLEX_NC 0x0010 /**< Non-continuous feature, having a complex interpretation using one or more of SL, SH, ML, MH */ // For WO NC features. There's no interpretation function or lookup table // Used to mark that the feature is defined for a version #define DDCA_WO_NC 0x0008 /**< Used internally for write-only non-continuous features */ #define DDCA_NORMAL_TABLE 0x0004 /**< Normal RW table type feature */ #define DDCA_WO_TABLE 0x0002 /**< Write only table feature */ #define DDCA_CONT (DDCA_STD_CONT|DDCA_COMPLEX_CONT) /**< Continuous feature, of any subtype */ #define DDCA_NC (DDCA_SIMPLE_NC|DDCA_COMPLEX_NC|DDCA_WO_NC) /**< Non-continuous feature of any subtype */ #define DDCA_NON_TABLE (DDCA_CONT | DDCA_NC) /**< Non-table feature of any type */ #define DDCA_TABLE (DDCA_NORMAL_TABLE | DDCA_WO_TABLE) /**< Table type feature, of any subtype */ // #define DDCA_KNOWN (DDCA_CONT | DDCA_NC | DDCA_TABLE) // *** unused *** // Additional bits: #define DDCA_DEPRECATED 0x0001 /**< Feature is deprecated in the specified VCP version */ ///@} typedef uint16_t DDCA_Global_Feature_Flags; // Bits in DDCA_Global_Feature_Flags: #define DDCA_SYNTHETIC 0x8000 typedef uint16_t DDCA_Feature_Flags; // union (DDCA_Version_Feature_Flags, DDCA_Global_Feature_Flags) /** One entry in array listing defined simple NC values. * * An entry of {0x00,NULL} terminates the list. */ typedef struct { uint8_t value_code; char * value_name; } DDCA_Feature_Value_Entry; // Makes reference to feature value table less implementation specific typedef DDCA_Feature_Value_Entry * DDCA_Feature_Value_Table; #define VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER "VSFI" /** Describes a VCP feature code, tailored for a specific VCP version */ typedef struct { char marker[4]; /**< equals VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER */ DDCA_Vcp_Feature_Code feature_code; /**< VCP feature code */ DDCA_MCCS_Version_Spec vspec; // ??? DDCA_MCCS_Version_Id version_id; // which ? char * desc; /**< feature description */ // Format_Normal_Feature_Detail_Function nontable_formatter; // Format_Table_Feature_Detail_Function table_formatter; DDCA_Feature_Value_Table sl_values; /**< valid when DDCA_SIMPLE_NC set */ // VCP_Feature_Subset vcp_subsets; // Need it? char * feature_name; /**< feature name */ DDCA_Feature_Flags feature_flags; } DDCA_Version_Feature_Info; // // Represent the Capabilities string returned by a monitor // #define DDCA_CAP_VCP_MARKER "DCVP" /** Represents one feature code in the vcp() section of the capabilities string. */ typedef struct { char marker[4]; /**< Always DDCA_CAP_VCP_MARKER */ DDCA_Vcp_Feature_Code feature_code; /**< VCP feature code */ int value_ct; /**< number of values declared */ uint8_t * values; /**< array of declared values */ } DDCA_Cap_Vcp; #define DDCA_CAPABILITIES_MARKER "DCAP" /** Represents a monitor capabilities string */ typedef struct { char marker[4]; /**< always DDCA_CAPABILITIES_MARKER */ char * unparsed_string; /**< unparsed capabilities string */ DDCA_MCCS_Version_Spec version_spec; /**< parsed mccs_ver() field */ int vcp_code_ct; /**< number of features in vcp() field */ DDCA_Cap_Vcp * vcp_codes; /**< array of pointers to structs describing each vcp code */ } DDCA_Capabilities; // // Get and set VCP feature values // /** Indicates the physical data type. At the DDC level, continuous (C) and * non-continuous (NC) features are treated identically. They share the same * DDC commands (Get VCP Feature and VCP Feature Reply) and data structure. * Table (T) features use DDC commands Table Write and Table Read, which take * different data structures. */ typedef enum { DDCA_NON_TABLE_VCP_VALUE = 1, /**< Continuous (C) or Non-Continuous (NC) value */ DDCA_TABLE_VCP_VALUE = 2, /**< Table (T) value */ } DDCA_Vcp_Value_Type; /** #DDCA_Vcp_Value_Type_Parm extends #DDCA_Vcp_Value_Type to allow for its use as a function call parameter where the type is unknown */ typedef enum { DDCA_UNSET_VCP_VALUE_TYPE_PARM = 0, /**< Unspecified */ DDCA_NON_TABLE_VCP_VALUE_PARM = 1, /**< Continuous (C) or Non-Continuous (NC) value */ DDCA_TABLE_VCP_VALUE_PARM = 2, /**< Table (T) value */ } DDCA_Vcp_Value_Type_Parm; typedef struct { uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; } DDCA_Non_Table_Value; /** Represents a single table VCP value. Consists of a count, followed by the bytes */ typedef struct { uint16_t bytect; /**< Number of bytes in value */ uint8_t bytes[]; /**< Bytes of the value */ } DDCA_Table_Value; typedef struct { DDCA_Vcp_Feature_Code opcode; /**< VCP feature code */ DDCA_Vcp_Value_Type value_type; // probably a different type would be better union { struct { uint8_t * bytes; /**< pointer to bytes of table value */ uint16_t bytect; /**< number of bytes in table value */ } t; /**< table value */ struct { uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; } c_nc; /**< continuous non-continuous, i.e. non-table, value */ } val; } DDCA_Any_Vcp_Value; #define VALREC_CUR_VAL(valrec) ( valrec->val.c_nc.sh << 8 | valrec->val.c_nc.sl ) #define VALREC_MAX_VAL(valrec) ( valrec->val.c_nc.mh << 8 | valrec->val.c_nc.ml ) // values are in sync with CMD_ constants defined in ddc_command_codes.h, unify? typedef enum { DDCA_Q_VCP_GET = 0x01, // CMD_VCP_REQUEST DDCA_Q_VCP_SET = 0x03, // CMD_VCP_SET DDCA_Q_VCP_RESET = 0x09, // CMD_VCP_RESET DDCA_Q_SAVE_SETTINGS = 0x0c, // CMD_SAVE_SETTINGS DDCA_Q_TABLE_READ = 0xe2, // CMD_TABLE_READ_REQUST DDCA_Q_TABLE_WRITE = -0xe7, // CMD_TABLE_WRITE DDCA_Q_CAPABILITIES = 0xf3, // CMD_CAPABILITIES_REQUEST } DDCA_Queued_Request_Type; typedef struct { DDCA_Queued_Request_Type request_type; DDCA_Vcp_Feature_Code vcp_code; // for DDCA_Q_SET DDCA_Non_Table_Value non_table_value; } DDCA_Queued_Request; /** Callback function to report VCP value change */ typedef void (*DDCA_Notification_Func)(DDCA_Status psc, DDCA_Any_Vcp_Value* valrec); typedef int (*Simple_Callback_Func)(int val); #endif /* DDCUTIL_TYPES_H_ */ ddcutil-0.8.6/src/public/ddcutil_c_api.h0000644000175000001440000006142513230445447015111 00000000000000/* ddcutil_c_api.h * * Public C APi for ddcutil. . * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Public C API for ddcutil */ #ifndef DDCUTIL_C_API_H_ #define DDCUTIL_C_API_H_ /** \cond */ // #include // obsolete #include #include /** \endcond */ // is this the right location? #ifdef __cplusplus extern "C" { #endif #include "ddcutil_types.h" /** @file ddcutil_c_api.h * @brief ddcutil public C API * * Function names in the public C API begin with "ddca_"\n * Typedefs, constants, etc. begin with "DDCA_". */ /* Note on "report" functions. * * Various functions with "report" in the name, e.g. ddca_report_display_ref(), * ddca_report_display_info_list(), write formatted reports to (normally) the * terminal. Sometimes, these are intended to display data structures for * debugging. Other times, they are used to format output for the ddcutil * command line program. * * The operation of these functions can be tweaked in two ways. * - The "depth" parameter is a logical indentation depth. This allows * reports that invoke other reports to indent the subreports * sensibly. At the level of the ddcutil_c_api(), one unit of * logical indentation depth translates to 3 spaces. * - The destination of reports is normally the STDOUT device. This can * be changed by calling set_fout(). */ // // Library build information // /** * Returns the ddcutil version as a struct of 3 8 bit integers. * * @return version numbers */ DDCA_Ddcutil_Version_Spec ddca_ddcutil_version(void); // ddcutil version /** * Returns the ddcutil version as a string in the form "major.minor.micro". * * @return version string. */ const char * ddca_ddcutil_version_string(void); /** Queries the options with which the **ddcutil** library was built. * * @return flags byte * * * | Defined Bit | | * |:-------| :-------------- * |#DDCA_BUILT_WITH_ADL | built with ADL support * |#DDCA_BUILT_WITH_USB | built with USB support * |#DDCA_BUILT_WITH_FAILSIM | built with failure simulation * * Defined Bits * * *
#DDCA_BUILT_WITH_ADLbuilt with ADL support
#DDCA_BUILT_WITH_USBbuilt with USB support *
#DDCA_BUILT_WITH_FAILSIM built with failure simulation *
* */ uint8_t ddca_build_options(void); // Bit ids for ddca_get_build_options() - how to make connection in doxygen? /** Build option flags * * Bit field definitions */ typedef enum { /** @brief ddcutil was built with support for AMD Display Library connected monitors */ DDCA_BUILT_WITH_ADL = 0x01, /** @brief ddcutil was built with support for USB connected monitors */ DDCA_BUILT_WITH_USB = 0x02, /** @brief ddcutil was built with support for failure simulation */ DDCA_BUILT_WITH_FAILSIM = 0x04 } DDCA_Build_Option_Flags; // // Initialization // #ifdef NOT_NEEDED /** * Initializes the ddcutil library module. * * Must be called before most other functions. * * It is not an error if this function is called more than once. */ // void __attribute__ ((constructor)) _ddca_init(void); #endif // // Status Codes // /** Returns the symbolic name for a ddcutil status code * @param status_code numeric status code * @return symbolic name, e.g. EBUSY, DDCRC_INVALID_DATA * */ char * ddca_rc_name(DDCA_Status status_code); /** Returns a description of a ddcutil status code * @param status_code numeric status code * @return explanation of status code, e.g. "device or resource busy" */ char * ddca_rc_desc(DDCA_Status status_code); // // MCCS Version Id // /** Returns the symbolic name of a #DDCA_MCCS_Version_Id, * e.g. "DDCA_V20." * * @param version_id version id value * @return symbolic name */ char * ddca_mccs_version_id_name( DDCA_MCCS_Version_Id version_id); /** Returns the descriptive name of a #DDCA_MCCS_Version_Id, * e.g. "2.0". * * @param version_id version id value * @return descriptive name */ char * ddca_mccs_version_id_desc( DDCA_MCCS_Version_Id version_id); // // Global Settings // /*** I2C is an inherently unreliable protocol. The application is responsible for retry management. The maximum number of retries can be tuned. There are 3 retry contexts: - An i2C write followed by a read. Most DDC operations are of this form. - An I2C write without a subsequent read. DDC operations to set a VCP feature value are in this category. - Some DDC operations, such as reading the capabilities string, require multiple write/read exchanges. These multi -part exchanges have a separate retry count for the entire operation. */ ///@{ /** Gets the upper limit on a max tries value that can be set. * * @return maximum max tries value allowed on set_max_tries() */ int ddca_max_max_tries(void); /** Gets the maximum number of I2C retries for the specified operation type. * @param retry_type I2C operation type * @return maximum number of retries */ int ddca_get_max_tries( DDCA_Retry_Type retry_type); /** Sets the maximum number of I2C retries for the specified operation type * @param retry_type I2C operation type * @param max_tries maximum count to set * * * * \retval EINVAL max_tries < 1 or > #ddca_get_max_tries() */ DDCA_Status ddca_set_max_tries( DDCA_Retry_Type retry_type, int max_tries); ///@} /** Controls whether VCP values are read after being set. * * \param onoff true/false */ void ddca_enable_verify(bool onoff); /** Query whether VCP values are read after being set. * \retval true values are verified after being set * \retval false values are not verified */ bool ddca_is_verify_enabled(void); // // Message Control // /** Redirects output that normally would go to STDOUT */ void ddca_set_fout( FILE * fout); /**< where to write normal messages, if NULL, suppress */ /** Redirects output that normally goes to STDOUT back to STDOUT */ void ddca_set_fout_to_default(void); /** Redirects output that normally would go to STDERR */ void ddca_set_ferr( FILE * ferr); /**< where to write error messages, If NULL, suppress */ /** Redirects output that normally goes to STDERR back to STDERR */ void ddca_set_ferr_to_default(void); /** Gets the current output level */ DDCA_Output_Level /**< current output level */ ddca_get_output_level(void); /** Sets the output level */ void ddca_set_output_level( DDCA_Output_Level newval); /**< new output level */ /** Gets the name of an output level * @param val output level id * @return output level name (do not free) */ char * ddca_output_level_name( DDCA_Output_Level val); /**< output level id */ /** Controls whether messages describing DDC protocol errors are output * @param onoff if true, errors will be issued * */ void ddca_enable_report_ddc_errors(bool onoff); /** Checks whether messages describing DDC protocol errors are output */ bool ddca_is_report_ddc_errors_enabled(void); // // Statistics // /** Resets all **ddcutil** statistics */ void ddca_reset_stats(void); /** Show execution statistics. * * \param stats bitflags of statistics types to show * \param depth logical indentation depth */ void ddca_show_stats(DDCA_Stats_Type stats, int depth); // // Display Descriptions // /** Gets a list of the detected displays. * * Displays that do not support DDC are not included. * * @return list of display summaries */ DDCA_Display_Info_List * ddca_get_display_info_list(void); /** Frees a list of detected displays. * * This function understands which fields in the list * point to permanently allocated data structures and should * not be freed. * * \param dlist pointer to #DDCA_Display_Info_List */ void ddca_free_display_info_list(DDCA_Display_Info_List * dlist); /** Presents a report on a single display. * The report is written to the current FOUT device. * * @param[in] dinfo pointer to a DDCA_Display_Info struct * @param[in] depth logical indentation depth */ void ddca_report_display_info( DDCA_Display_Info * dinfo, int depth); /** Reports on all displays in a list of displays. * The report is written to the current FOUT device * * @param[in] dlist pointer to a DDCA_Display_Info_List * @param[in] depth logical indentation depth */ void ddca_report_display_info_list( DDCA_Display_Info_List * dlist, int depth); /** Reports on all active displays. * This function hooks into the code used by command "ddcutil detect" * * @param[in] depth logical indentation depth * @return number of MCCS capable displays */ int ddca_report_active_displays( int depth); // // Display Identifier // /** Creates a display identifier using the display number assigned by ddcutil * @param[in] dispno display number * @param[out] pdid where to return display identifier handle * @retval 0 * * \ingroup api_display_spec * */ DDCA_Status ddca_create_dispno_display_identifier( int dispno, DDCA_Display_Identifier* pdid); /** Creates a display identifier using an I2C bus number * @param[in] busno I2C bus number * @param[out] pdid where to return display identifier handle * @retval 0 * * \ingroup api_display_spec */ DDCA_Status ddca_create_busno_display_identifier( int busno, DDCA_Display_Identifier* pdid); /** Creates a display identifier using an ADL (adapter index, display index) pair * @param[in] iAdapterIndex ADL adapter index * @param[in] iDisplayIndex ADL display index * @param[out] pdid where to return display identifier handle * @return status code * * \ingroup api_display_spec */ DDCA_Status ddca_create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex, DDCA_Display_Identifier* pdid); /** Creates a display identifier using some combination of the manufacturer id, * model name string and serial number string. At least 1 of the 3 must be specified. * @param mfg_id 3 letter manufacturer id * @param model model name string * @param sn serial number string * @param pdid where to return display identifier handle * @retval 0 success * @retval -EINVAL no argument specified, or argument too long * * \ingroup api_display_spec */ DDCA_Status ddca_create_mfg_model_sn_display_identifier( const char * mfg_id, const char * model, const char * sn, DDCA_Display_Identifier* pdid); /** Creates a display identifier using a 128 byte EDID * @param edid pointer to 128 byte EDID * @param pdid where to return display identifier handle * @retval 0 success * @retval -EINVAL edid==NULL * * \ingroup api_display_spec */ DDCA_Status ddca_create_edid_display_identifier( const uint8_t* edid, DDCA_Display_Identifier * pdid); // 128 byte edid /** Creates a display identifier using a USB bus number and device number * @param bus USB bus number * @param device USB device number * @param pdid where to return display identifier handle * @retval 0 success * * \ingroup api_display_spec */ DDCA_Status ddca_create_usb_display_identifier( int bus, int device, DDCA_Display_Identifier* pdid); /** Creates a display identifier using a /dev/usb/hiddev device number * @param hiddev_devno hiddev device number * @param pdid where to return display identifier handle * @retval 0 success * * \ingroup api_display_spec */ DDCA_Status ddca_create_usb_hiddev_display_identifier( int hiddev_devno, DDCA_Display_Identifier* pdid); /** Release the memory of a display identifier */ DDCA_Status ddca_free_display_identifier( DDCA_Display_Identifier did); /** Returns a string representation of a display identifier * \param[in] did display identifier * \return string representation of display identifier, NULL if invalid * * \ingroup api_display_spec */ char * ddca_did_repr( DDCA_Display_Identifier did); // // Display Reference // /** Gets a display reference for a display identifier. * Normally, this is a permanently allocated #DDCA_Display_Ref * created by monitor detection and does not need to be freed. * @param[in] did display identifier * @param[out] pdref where to return display reference * @retval 0 success * @retval -EINVAL did is not a valid display identifier handle * @retval DDCRC_INVALID_DISPLAY display not found * * \ingroup api_display_spec */ DDCA_Status ddca_create_display_ref( DDCA_Display_Identifier did, DDCA_Display_Ref* pdref); /** Frees a display reference. * @param dref display reference to free * @return status code * * \ingroup api_display_spec */ DDCA_Status ddca_free_display_ref( DDCA_Display_Ref dref); /** Returns a string representation of a display reference * @param[in] dref display reference * @return string representation of display reference, NULL if invalid * */ char * ddca_dref_repr( DDCA_Display_Ref dref); /** Writes a report on the specified display reference to the current FOUT device * @param dref display reference * @param depth logical indentation depth * * \ingroup api_display_spec */ void ddca_report_display_ref( DDCA_Display_Ref dref, int depth); // // Display Handle // /** Open a display * @param[in] ddca_dref display reference for display to open * @param[out] p_ddca_dh where to return display handle * @return status code * * \ingroup api_display_spec */ DDCA_Status ddca_open_display( DDCA_Display_Ref ddca_dref, DDCA_Display_Handle * p_ddca_dh); /** Close an open display * @param[in] ddca_dh display handle * @return DDCA status code * * \ingroup api_display_spec */ DDCA_Status ddca_close_display( DDCA_Display_Handle ddca_dh); /** Returns a string representation of a display handle. * The string is valid until the next call to this function. * * @param ddca_dh display handle * @return string representation of display handle, NULL if * argument is NULL or not a display handle * * \ingroup api_display_spec */ char * ddca_dh_repr( DDCA_Display_Handle ddca_dh); // // Monitor Capabilities // /** Retrieves the capabilities string for a monitor. * * @param[in] ddca_dh display handle * @param[out] p_caps address at which to return pointer to capabilities string. * @return status code * * It is the responsibility of the caller to free the returned string. */ DDCA_Status ddca_get_capabilities_string( DDCA_Display_Handle ddca_dh, char** p_caps); /** Parse the capabilities string. * * @param[in] capabilities_string unparsed capabilities string * @param[out] p_parsed_capabilities address at which to return pointer to newly allocated * DDCA_Capabilities struct * @return status code * * It is the responsibility of the caller to free the returned struct * using ddca_free_parsed_capabilities(). * * This function currently parses the VCP feature codes and MCCS version. * It could be extended to parse additional information such as cmds if necessary. */ DDCA_Status ddca_parse_capabilities_string( char * capabilities_string, DDCA_Capabilities ** p_parsed_capabilities); /** Frees a DDCA_Capabilities struct * * @param[in] pcaps pointer to struct to free. * Does nothing if NULL. */ void ddca_free_parsed_capabilities( DDCA_Capabilities * pcaps); /** Reports the contents of a DDCA_Capabilities struct. * * The report is written to the current FOUT location. * * This function is intended for debugging use. * * @param[in] pcaps pointer to DDCA_Capabilities struct * @param[in] depth logical indentation depth */ void ddca_report_parsed_capabilities( DDCA_Capabilities * pcaps, int depth); // // VCP Feature Information, Monitor Independent // /** Gets information for a VCP feature. * * VCP characteristics (C vs NC, RW vs RO, etc) can vary by MCCS version. * * @param[in] feature_code VCP feature code * @param[in] mccs_version_id MCCS version id, may be DDCA_VCP_VANY?? * @param[out] p_info where to return Version_Feature_Info struct * @return status code */ DDCA_Status ddca_get_feature_info_by_vcp_version( DDCA_Vcp_Feature_Code feature_code, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Version_Feature_Info** p_info); /** Gets the VCP feature name. If different MCCS versions use different names * for the feature, this function makes a best guess. * * @param[in] feature_code * @return pointer to feature name(do not free), NULL if unknown feature code */ char * ddca_get_feature_name(DDCA_Vcp_Feature_Code feature_code); /** Gets the value id/name table of the allowed values for a simple NC feature. * * @param[in] feature_code VCP feature code * @param[in] mccs_version_id MCCS version id * @param[out] p_value_table where to return pointer to array of DDCA_Feature_Value_Entry * @return status code * @retval 0 success * @retval DDCRC_NOT_FOUND unrecognized feature code * @retval -EINVAL feature not simple NC */ DDCA_Status ddca_get_simple_sl_value_table( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Feature_Value_Table * p_value_table); // DDCA_Feature_Value_Entry ** DDCA_Status ddca_get_simple_nc_feature_value_name( DDCA_Display_Handle ddca_dh, // needed because value lookup mccs version dependent DDCA_Vcp_Feature_Code feature_code, uint8_t feature_value, char** p_feature_name); DDCA_Status ddca_free_feature_info( DDCA_Version_Feature_Info * info); // // VCP Feature Information, Monitor Dependent // #ifdef UNIMPLEMENTED // Unimplemented // alt: can check status code for ddca_get_feature_info_by_display() DDCA_Status ddct_is_feature_supported( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, bool * answer); #endif // This is a convenience function. Keep? DDCA_Status ddca_get_feature_info_by_display( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Version_Feature_Info ** p_info); // // Miscellaneous Monitor Specific Functions // // TODO: keep only 1 of the 2 get_mccs_version() variants DDCA_Status ddca_get_mccs_version( DDCA_Display_Handle ddca_dh, DDCA_MCCS_Version_Spec* pspec); DDCA_Status ddca_get_mccs_version_id( DDCA_Display_Handle ddca_dh, DDCA_MCCS_Version_Id* p_id); // DDCA_Status ddca_get_edid(DDCA_Display_Handle * dh, uint8_t* edid_buffer); // edid_buffer must be >= 128 bytes // Keep? Can get from ddca_get_edid_by_display_ref() DDCA_Status ddca_get_edid_by_display_ref( DDCA_Display_Ref ddca_dref, uint8_t ** pbytes); // pointer into ddcutil data structures, do not free // // Get VCP Feature Value // void ddca_free_table_value_response( DDCA_Table_Value * table_value_response); // TODO: Choose between ddca_get_nontable_vcp_value()/ddca_get_table_vcp_value() vs ddca_get_vcp_value() /** Gets the value of a non-table VCP feature. * * @param ddca_dh display handle * @param feature_code VCP feature code * @param valrec pointer to response buffer provided by the caller, * which will be filled in * * @return external status code */ DDCA_Status ddca_get_nontable_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Non_Table_Value * valrec); /** Gets the value of a table VCP feature. * * @param ddca_dh display handle * @param feature_code VCP feature code * @param value_len address at which to return the value length * @param value_bytes address at which to return a pointer to the value bytes * * @return external status code * * @note * Implemented, but untested */ DDCA_Status ddca_get_table_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, int * value_len, uint8_t** value_bytes); // ddca_get_vcp_value() is deprecated, use ddca_get_any_vcp_value() /** Gets the value of a VCP feature. * * @param ddca_dh display handle * @param feature_code VCP feature code * @param value_type value type * @param pvalrec address at which to return a pointer to a newly * allocated Single_Vcp_Value * * @return external status code */ DDCA_Status ddca_get_any_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type_Parm value_type, DDCA_Any_Vcp_Value ** pvalrec); /** Returns a string containing a formatted representation of the VCP value * of a feature. It is the responsiblity of the caller to free this value. * @param[in] ddca_dh Display handle * @param[in] feature_code VCP feature code * @param[out] p_formatted_value Address at which to return the formatted value * @return status code, 0 if success */ DDCA_Status ddca_get_formatted_vcp_value( DDCA_Display_Handle * ddca_dh, DDCA_Vcp_Feature_Code feature_code, char** p_formatted_value); // // Set VCP value // /** Sets a continuous VCP value. * * @param ddca_dh display_handle * @param feature_code VCP feature code * @param new_value value to set (sign?) * * @return status code */ DDCA_Status ddca_set_continuous_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, int new_value); /** Sets a simple NC value, which is a single byte. * * @param ddca_dh display_handle * @param feature_code VCP feature code * @param new_value value to set * * @return status code * */ DDCA_Status ddca_set_simple_nc_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, uint8_t new_value); /** Sets a non-table VCP value by directly specifying its bytes. */ DDCA_Status ddca_set_raw_vcp_value( DDCA_Display_Handle ddca_dh, /**< Display handle */ DDCA_Vcp_Feature_Code feature_code, /**< VCP feature code */ uint8_t hi_byte, /**< High byte of value */ uint8_t lo_byte /**< Low byte of value */ ); #ifdef UNIMPLEMENTED DDCA_Status ddct_set_table_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, int value_len, uint8_t* value_bytes); #endif // // Get or set multiple values // DDCA_Status ddca_get_profile_related_values( DDCA_Display_Handle ddca_dh, char** pprofile_values_string); DDCA_Status ddca_set_profile_related_values(char * profile_values_string); // // Experimental - Not for public use // DDCA_Status ddca_start_get_any_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type_Parm call_type, DDCA_Notification_Func callback_func); /** Registers a callback function to call when a VCP value changes */ DDCA_Status ddca_register_callback( DDCA_Notification_Func func, uint8_t callback_options); // type is a placeholder DDCA_Status ddca_pass_callback( Simple_Callback_Func func, int parm ); // future: DDCA_Status ddca_queue_get_non_table_vcp_value( DDCA_Display_Handle ddca_dh, /**< Display handle */ DDCA_Vcp_Feature_Code feature_code /**< VCP feature code */ ); #ifdef __cplusplus } #endif #endif /* DDCUTIL_C_API_H_ */ ddcutil-0.8.6/src/Makefile.am0000644000175000001440000002024513226541305012721 00000000000000## Process this file with automake to produce Makefile.in SUBDIRS = util usb_util base vcp i2c adl usb ddc test app_sysenv cmdline . gobject_api swig cython cffi sample_clients MOSTLYCLEANFILES = CLEANFILES = # todo: factor out swig # todo: fails if swig/.libs doesn't exist # rm -rf swig/ddc_swig_wrap.c swig/ddc_swig.py swig/ddc_swig.pyc # Plo files in deps directories are automatically included in generated Makefiles for some reason # test -z `find . -name ".deps" -type d` || rm -rf `find . -name ".deps" -type d` # For conditionally included files, e.g. those in usb_util, make clean does not delete # the .lo files. Hence the instructions here to delete all of them # Fails: test: too many arguments: # test -z `find . -name "*lo" -type f` || rm `find . -name "*lo" -type f` clean-local: @echo "(src/Makefile) clean-local" find . -name "*plist" -type d -exec ls -ld {} \; rm -rf `find . -name "*plist" -type d` find . -name ".libs" -type d -exec ls -ld {} \; test -z `find . -name "*expand" -type f` || rm `find . -name "*expand" -type f` find . -name "*.lo" -type f -exec ls -l {} \; find . -name "*.lo" -type f -exec rm -f {} \; find . -name "*.o" -type f -exec ls -l {} \; find . -name "*.o" -type f -exec rm -f {} \; find . -name ".deps" -type d find . -name ".deps" -type d -exec ls -ld {} \; find . -path "*/.deps/*" -exec ls -l {} \; mostlyclean-local: @echo "(src/Makefile) mostlyclean-local" distclean-local: @echo "(src/Makefile) distclean-local" find . -name ".libs" -type d -exec ls -ld {} \; maintainerclean-local: @echo "(src/Makefile) maintainerclean-local" # # Execuatables # bin_PROGRAMS = \ ddcutil # # Intermediate Libraries # # Convenience library containing code shared between ddcutil executable and libddcutil shared library noinst_LTLIBRARIES = libcommon.la # Convenience library to collect code used only in ddcutil executable noinst_LTLIBRARIES += libapp.la # # Public Shared Libraries # if ENABLE_SHARED_LIB_COND lib_LTLIBRARIES = libddcutil.la # noinst_LTLIBRARIES += libhack.la endif # # Files only in ddcutil executable # ddcutil_SOURCES = \ app_ddcutil/main.c \ app_ddcutil/app_dumpload.c \ app_ddcutil/app_setvcp.c \ app_ddcutil/app_getvcp.c # it's a hack for using API calls in standalone executable if USE_API_COND ddcutil_SOURCES += \ libmain/ddcutil_c_api.c endif # # Files only in libddcutil # libddcutil_la_SOURCES = \ libmain/ddcutil_c_api.c # libhack_la_SOURCES = \ # libmain/ddcutil_c_api.c # Despite what the Autotools book says, all-local is executed aftar all, not before # So this ensures that the NEXT execution of all will compile build_info.c # removed from all-local: # touch base/build_info.c all-local: @echo "Executing hook all-local..." # Never executed: # all-hook: # @echo "Executing hook all-hook..." # touch base/build_info.c # fails # base/build_info.o: .FORCE # @echo "Executing phony rule for build_info.o" # touch base/built_info.c # # libcommon contains the source files that are # shared between ddcutil and libddcutil: # libcommon_la_SOURCES = libapp_la_SOURCES = if ENABLE_SHARED_LIB_COND include_HEADERS = \ public/ddcutil_types.h \ public/ddcutil_c_api.h endif # Notes: # 1) Without -prune option, the following line fails because list of file is archived internally, get file not found errors after remove # find $(top_distdir) -name ".deps" -exec rm -rf {} \; # 2) Piping to xargs fails on if there are no files, which occurs if "make dist" is invoked without anything having bee built. # find $(top_distdir) -name ".deps" | xargs rm # 3) Why explicit copy of .h files? # 4) find statements in src/usb_util/Makefile.am find nothing, but those here work. why? dist-hook: @echo "(src/Makefile) Executing hook dist-hook.top_distdir=$(top_distdir) distdir=$(distdir).." find . -type f | grep \.h$ | xargs -i cp --parents "{}" $(distdir) find $(distdir) -name ".deps" -prune -exec rm -rf {} \; find $(distdir) -name ".libs" -prune -exec rm -rf {} \; find $(distdir) -name "*.lo" -exec rm {} \; find $(distdir) -name "*.o" -exec rm {} \; rm -rf $(distdir)/swig/pyenv rm -rf $(distdir)/swig/__pycache__ # Header files # trying to get i2c-dev.h from /usr/include/linux causes errors # # C Pre-Processor Flags # # $(SYSTEMD_CFLAGS) removed, libsystemd not currently needed # GLIB_CFLAGS contains output of pkgconfig --cflags glib-2.0 AM_CPPFLAGS= \ $(GLIB_CFLAGS) \ $(XRANDR_CFLAGS) \ $(LIBUSB_CFLAGS) \ -I$(srcdir) \ -I$(srcdir)/public # if HAVE_ADL_COND # AM_CPPFLAGS += \ # -I@ADL_HEADER_DIR@ # endif # # Compiler flags # # AM_CFLAGS = -Wall -Werror AM_CFLAGS = -Wall # AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif # AM_CFLAGS += $(PYTHON_CPPFLAGS) ddcutil_CFLAGS = $(AM_CFLAGS) -fPIC # unnessary, will use AM_CFLAGS if xxx_CFLAGS undefined # libcommon_la_CFLAGS = $(AM_CFLAGS) # libddcutil_la_CFLAGS = $(AM_CFLAGS) # # Link the libraries # # Be careful about library ordering. # A library must be listed after any libraries that depend on it # libcommon_la_LIBADD = \ ddc/libddc.la \ i2c/libi2c.la \ adl/libadl.la \ vcp/libvcp.la \ base/libbase.la \ util/libutil.la if ENABLE_USB_COND libcommon_la_LIBADD += \ usb_util/libusbutil.la \ usb/libusb.la endif libapp_la_LIBADD = \ app_sysenv/libappsysenv.la \ cmdline/libcmdline.la if INCLUDE_TESTCASES_COND libapp_la_LIBADD += \ test/libtestcases.la endif # $(SYSTEMD_LIBS) removed from list, libsystemd not currently used libcommon_la_LIBADD += \ $(LIBX11_LIBS) \ $(XRANDR_LIBS) \ $(GLIB_LIBS) \ $(UDEV_LIBS) \ $(LIBUSB_LIBS) \ $(LIBDRM_LIBS) # libddcutil_la_LIBADD = -lz libddcutil_la_LIBADD = $(ZLIB_LIBS) libddcutil_la_LIBADD += libcommon.la # libhack_la_LIBADD = $(ZLIB_LIBS) # libhack_la_LIBADD += libcommon.la libddcutil.la libddcutil_la_LDFLAGS = # -export-dynamic not required for failsim: # if ENABLE_FAILSIM_COND # libddcutil_la_LDFLAGS += -export-dynamic # else libddcutil_la_LDFLAGS += -export-symbols-regex '^ddc[ags]_[^_]' # endif libddcutil_la_LDFLAGS += -version-info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # libddcutil_la_LDFLAGS += -init _ddca_init libddcutil_la_LDFLAGS += -pie # doesn't prevent creation of .la # try disabling to create libddcutil.a - doesnt do it libddcutil_la_LDFLAGS += --disable-static # libhack_la_LDFLAGS = $(libddcutil_la_LDFLAGS) # # Link the executables # # ddcutil statically links libcommon, rather than using libddcutil.so # so it needs LDADD references to external libraries as well ddcutil_LDADD = \ libapp.la \ libcommon.la #needed? ddcutil_LDFLAGS = ddcutil_LDFLAGS += -pie # -export-dynamic needed for failsim ddcutil_LDFLAGS += -export-dynamic # laclient_LDADD = libddcutil.la # demo_global_settings_LDADD = libddcutil.la # demo_vcpinfo_LDADD = libddcutil.la # demo_get_set_vcp_LDADD = libddcutil.la # demo_display_selection_LDADD = libddcutil.la # laclient_LDFLAGS = -pie # demo_global_settings_LDFLAGS = -pie # demo_vcpinfo_LDFLAGS = -pie # demo_get_set_vcp_LDFLAGS = -pie # demo_display_selection_LDFLAGS = -pie # debug-install-hook: # ls -ld $(DESTDIR)$(libdir) # ls -l $(DESTDIR)$(libdir)/*la # @echo " pythondir = $(pythondir)" # @echo " pyexecdir = $(pyexecdir)" # @echo $(DESTDIR)$(libdir) install-exec-hook: @echo "(install-exec-hook) Executing..." rm -f $(DESTDIR)$(libdir)/libddcutil.la rm -f $(DESTDIR)$(libdir)/libddcutil.a # @if [ -f $(DESTDIR)$(libdir)/libddcutil.la ] ; then \ # rm $(DESTDIR)$(libdir)/libddcutil.la ; \ # fi # @if [ -f $(DESTDIR)$(libdir)/libddcutil.a ] ; then \ # rm $(DESTDIR)$(libdir)/libddcutil.a ; \ # fi # @if [ -f $(DESTDIR)$(libdir)/libddcutil.la ] ; then \ # echo "(install-exec-hook) Stripping dependency_libs from libddcutil.la" ; \ # sed -i "/dependency_libs/ s/'.*'/''/" $(DESTDIR)$(libdir)/libddcutil.la ; \ # fi # objdump -p $(DESTDIR)$(libdir)/libddcutil.so | sed -n -e's/^[[:space:]]*SONAME[[:space:]]*//p' | sed -r -e's/([0-9])\.so\./\1-/; s/\.so(\.|$)//; y/_/-/; s/(.*)/\L&/' uninstall-local: @echo "(src/Makefile:uninstall-local) Executing..." rm -f $(DESTDIR)$(libdir)/libddcutil* ddcutil-0.8.6/src/Makefile.in0000644000175000001440000015314113230171236012731 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = ddcutil$(EXEEXT) # it's a hack for using API calls in standalone executable @USE_API_COND_TRUE@am__append_1 = \ @USE_API_COND_TRUE@ libmain/ddcutil_c_api.c # AM_CFLAGS += -Wpedantic @ENABLE_CALLGRAPH_COND_TRUE@am__append_2 = -fdump-rtl-expand @ENABLE_USB_COND_TRUE@am__append_3 = \ @ENABLE_USB_COND_TRUE@ usb_util/libusbutil.la \ @ENABLE_USB_COND_TRUE@ usb/libusb.la @INCLUDE_TESTCASES_COND_TRUE@am__append_4 = \ @INCLUDE_TESTCASES_COND_TRUE@test/libtestcases.la subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__include_HEADERS_DIST) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libapp_la_DEPENDENCIES = app_sysenv/libappsysenv.la \ cmdline/libcmdline.la $(am__append_4) am_libapp_la_OBJECTS = libapp_la_OBJECTS = $(am_libapp_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 = am__DEPENDENCIES_1 = libcommon_la_DEPENDENCIES = ddc/libddc.la i2c/libi2c.la adl/libadl.la \ vcp/libvcp.la base/libbase.la util/libutil.la $(am__append_3) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libcommon_la_OBJECTS = libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) libddcutil_la_DEPENDENCIES = $(am__DEPENDENCIES_1) libcommon.la am__dirstamp = $(am__leading_dot)dirstamp am_libddcutil_la_OBJECTS = libmain/ddcutil_c_api.lo libddcutil_la_OBJECTS = $(am_libddcutil_la_OBJECTS) libddcutil_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libddcutil_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_SHARED_LIB_COND_TRUE@am_libddcutil_la_rpath = -rpath $(libdir) PROGRAMS = $(bin_PROGRAMS) am__ddcutil_SOURCES_DIST = app_ddcutil/main.c \ app_ddcutil/app_dumpload.c app_ddcutil/app_setvcp.c \ app_ddcutil/app_getvcp.c libmain/ddcutil_c_api.c @USE_API_COND_TRUE@am__objects_1 = \ @USE_API_COND_TRUE@ libmain/ddcutil-ddcutil_c_api.$(OBJEXT) am_ddcutil_OBJECTS = app_ddcutil/ddcutil-main.$(OBJEXT) \ app_ddcutil/ddcutil-app_dumpload.$(OBJEXT) \ app_ddcutil/ddcutil-app_setvcp.$(OBJEXT) \ app_ddcutil/ddcutil-app_getvcp.$(OBJEXT) $(am__objects_1) ddcutil_OBJECTS = $(am_ddcutil_OBJECTS) ddcutil_DEPENDENCIES = libapp.la libcommon.la ddcutil_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ddcutil_CFLAGS) \ $(CFLAGS) $(ddcutil_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libapp_la_SOURCES) $(libcommon_la_SOURCES) \ $(libddcutil_la_SOURCES) $(ddcutil_SOURCES) DIST_SOURCES = $(libapp_la_SOURCES) $(libcommon_la_SOURCES) \ $(libddcutil_la_SOURCES) $(am__ddcutil_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__include_HEADERS_DIST = public/ddcutil_types.h \ public/ddcutil_c_api.h HEADERS = $(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 \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = util usb_util base vcp i2c adl usb ddc test app_sysenv cmdline . gobject_api swig cython cffi sample_clients MOSTLYCLEANFILES = CLEANFILES = # # Intermediate Libraries # # Convenience library containing code shared between ddcutil executable and libddcutil shared library # Convenience library to collect code used only in ddcutil executable noinst_LTLIBRARIES = libcommon.la libapp.la # # Public Shared Libraries # @ENABLE_SHARED_LIB_COND_TRUE@lib_LTLIBRARIES = libddcutil.la # noinst_LTLIBRARIES += libhack.la # # Files only in ddcutil executable # ddcutil_SOURCES = app_ddcutil/main.c app_ddcutil/app_dumpload.c \ app_ddcutil/app_setvcp.c app_ddcutil/app_getvcp.c \ $(am__append_1) # # Files only in libddcutil # libddcutil_la_SOURCES = \ libmain/ddcutil_c_api.c # Never executed: # all-hook: # @echo "Executing hook all-hook..." # touch base/build_info.c # fails # base/build_info.o: .FORCE # @echo "Executing phony rule for build_info.o" # touch base/built_info.c # # libcommon contains the source files that are # shared between ddcutil and libddcutil: # libcommon_la_SOURCES = libapp_la_SOURCES = @ENABLE_SHARED_LIB_COND_TRUE@include_HEADERS = \ @ENABLE_SHARED_LIB_COND_TRUE@public/ddcutil_types.h \ @ENABLE_SHARED_LIB_COND_TRUE@public/ddcutil_c_api.h # Header files # trying to get i2c-dev.h from /usr/include/linux causes errors # # C Pre-Processor Flags # # $(SYSTEMD_CFLAGS) removed, libsystemd not currently needed # GLIB_CFLAGS contains output of pkgconfig --cflags glib-2.0 AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(XRANDR_CFLAGS) \ $(LIBUSB_CFLAGS) \ -I$(srcdir) \ -I$(srcdir)/public # if HAVE_ADL_COND # AM_CPPFLAGS += \ # -I@ADL_HEADER_DIR@ # endif # # Compiler flags # # AM_CFLAGS = -Wall -Werror AM_CFLAGS = -Wall $(am__append_2) # AM_CFLAGS += $(PYTHON_CPPFLAGS) ddcutil_CFLAGS = $(AM_CFLAGS) -fPIC # unnessary, will use AM_CFLAGS if xxx_CFLAGS undefined # libcommon_la_CFLAGS = $(AM_CFLAGS) # libddcutil_la_CFLAGS = $(AM_CFLAGS) # # Link the libraries # # Be careful about library ordering. # A library must be listed after any libraries that depend on it # # $(SYSTEMD_LIBS) removed from list, libsystemd not currently used libcommon_la_LIBADD = ddc/libddc.la i2c/libi2c.la adl/libadl.la \ vcp/libvcp.la base/libbase.la util/libutil.la $(am__append_3) \ $(LIBX11_LIBS) $(XRANDR_LIBS) $(GLIB_LIBS) $(UDEV_LIBS) \ $(LIBUSB_LIBS) $(LIBDRM_LIBS) libapp_la_LIBADD = app_sysenv/libappsysenv.la cmdline/libcmdline.la \ $(am__append_4) # libddcutil_la_LIBADD = -lz libddcutil_la_LIBADD = $(ZLIB_LIBS) libcommon.la # libhack_la_LIBADD = $(ZLIB_LIBS) # libhack_la_LIBADD += libcommon.la libddcutil.la # -export-dynamic not required for failsim: # if ENABLE_FAILSIM_COND # libddcutil_la_LDFLAGS += -export-dynamic # else # endif # libddcutil_la_LDFLAGS += -init _ddca_init # doesn't prevent creation of .la # try disabling to create libddcutil.a - doesnt do it libddcutil_la_LDFLAGS = -export-symbols-regex '^ddc[ags]_[^_]' \ -version-info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' -pie \ --disable-static # libhack_la_LDFLAGS = $(libddcutil_la_LDFLAGS) # # Link the executables # # ddcutil statically links libcommon, rather than using libddcutil.so # so it needs LDADD references to external libraries as well ddcutil_LDADD = \ libapp.la \ libcommon.la #needed? # -export-dynamic needed for failsim ddcutil_LDFLAGS = -pie -export-dynamic all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-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}; \ } libapp.la: $(libapp_la_OBJECTS) $(libapp_la_DEPENDENCIES) $(EXTRA_libapp_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libapp_la_OBJECTS) $(libapp_la_LIBADD) $(LIBS) libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) $(EXTRA_libcommon_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) libmain/$(am__dirstamp): @$(MKDIR_P) libmain @: > libmain/$(am__dirstamp) libmain/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) libmain/$(DEPDIR) @: > libmain/$(DEPDIR)/$(am__dirstamp) libmain/ddcutil_c_api.lo: libmain/$(am__dirstamp) \ libmain/$(DEPDIR)/$(am__dirstamp) libddcutil.la: $(libddcutil_la_OBJECTS) $(libddcutil_la_DEPENDENCIES) $(EXTRA_libddcutil_la_DEPENDENCIES) $(AM_V_CCLD)$(libddcutil_la_LINK) $(am_libddcutil_la_rpath) $(libddcutil_la_OBJECTS) $(libddcutil_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list app_ddcutil/$(am__dirstamp): @$(MKDIR_P) app_ddcutil @: > app_ddcutil/$(am__dirstamp) app_ddcutil/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) app_ddcutil/$(DEPDIR) @: > app_ddcutil/$(DEPDIR)/$(am__dirstamp) app_ddcutil/ddcutil-main.$(OBJEXT): app_ddcutil/$(am__dirstamp) \ app_ddcutil/$(DEPDIR)/$(am__dirstamp) app_ddcutil/ddcutil-app_dumpload.$(OBJEXT): \ app_ddcutil/$(am__dirstamp) \ app_ddcutil/$(DEPDIR)/$(am__dirstamp) app_ddcutil/ddcutil-app_setvcp.$(OBJEXT): app_ddcutil/$(am__dirstamp) \ app_ddcutil/$(DEPDIR)/$(am__dirstamp) app_ddcutil/ddcutil-app_getvcp.$(OBJEXT): app_ddcutil/$(am__dirstamp) \ app_ddcutil/$(DEPDIR)/$(am__dirstamp) libmain/ddcutil-ddcutil_c_api.$(OBJEXT): libmain/$(am__dirstamp) \ libmain/$(DEPDIR)/$(am__dirstamp) ddcutil$(EXEEXT): $(ddcutil_OBJECTS) $(ddcutil_DEPENDENCIES) $(EXTRA_ddcutil_DEPENDENCIES) @rm -f ddcutil$(EXEEXT) $(AM_V_CCLD)$(ddcutil_LINK) $(ddcutil_OBJECTS) $(ddcutil_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f app_ddcutil/*.$(OBJEXT) -rm -f libmain/*.$(OBJEXT) -rm -f libmain/*.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@app_ddcutil/$(DEPDIR)/ddcutil-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libmain/$(DEPDIR)/ddcutil_c_api.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< app_ddcutil/ddcutil-main.o: app_ddcutil/main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-main.o -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-main.Tpo -c -o app_ddcutil/ddcutil-main.o `test -f 'app_ddcutil/main.c' || echo '$(srcdir)/'`app_ddcutil/main.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-main.Tpo app_ddcutil/$(DEPDIR)/ddcutil-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/main.c' object='app_ddcutil/ddcutil-main.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-main.o `test -f 'app_ddcutil/main.c' || echo '$(srcdir)/'`app_ddcutil/main.c app_ddcutil/ddcutil-main.obj: app_ddcutil/main.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-main.obj -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-main.Tpo -c -o app_ddcutil/ddcutil-main.obj `if test -f 'app_ddcutil/main.c'; then $(CYGPATH_W) 'app_ddcutil/main.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/main.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-main.Tpo app_ddcutil/$(DEPDIR)/ddcutil-main.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/main.c' object='app_ddcutil/ddcutil-main.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-main.obj `if test -f 'app_ddcutil/main.c'; then $(CYGPATH_W) 'app_ddcutil/main.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/main.c'; fi` app_ddcutil/ddcutil-app_dumpload.o: app_ddcutil/app_dumpload.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-app_dumpload.o -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Tpo -c -o app_ddcutil/ddcutil-app_dumpload.o `test -f 'app_ddcutil/app_dumpload.c' || echo '$(srcdir)/'`app_ddcutil/app_dumpload.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Tpo app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/app_dumpload.c' object='app_ddcutil/ddcutil-app_dumpload.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-app_dumpload.o `test -f 'app_ddcutil/app_dumpload.c' || echo '$(srcdir)/'`app_ddcutil/app_dumpload.c app_ddcutil/ddcutil-app_dumpload.obj: app_ddcutil/app_dumpload.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-app_dumpload.obj -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Tpo -c -o app_ddcutil/ddcutil-app_dumpload.obj `if test -f 'app_ddcutil/app_dumpload.c'; then $(CYGPATH_W) 'app_ddcutil/app_dumpload.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/app_dumpload.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Tpo app_ddcutil/$(DEPDIR)/ddcutil-app_dumpload.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/app_dumpload.c' object='app_ddcutil/ddcutil-app_dumpload.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-app_dumpload.obj `if test -f 'app_ddcutil/app_dumpload.c'; then $(CYGPATH_W) 'app_ddcutil/app_dumpload.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/app_dumpload.c'; fi` app_ddcutil/ddcutil-app_setvcp.o: app_ddcutil/app_setvcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-app_setvcp.o -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Tpo -c -o app_ddcutil/ddcutil-app_setvcp.o `test -f 'app_ddcutil/app_setvcp.c' || echo '$(srcdir)/'`app_ddcutil/app_setvcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Tpo app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/app_setvcp.c' object='app_ddcutil/ddcutil-app_setvcp.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-app_setvcp.o `test -f 'app_ddcutil/app_setvcp.c' || echo '$(srcdir)/'`app_ddcutil/app_setvcp.c app_ddcutil/ddcutil-app_setvcp.obj: app_ddcutil/app_setvcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-app_setvcp.obj -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Tpo -c -o app_ddcutil/ddcutil-app_setvcp.obj `if test -f 'app_ddcutil/app_setvcp.c'; then $(CYGPATH_W) 'app_ddcutil/app_setvcp.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/app_setvcp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Tpo app_ddcutil/$(DEPDIR)/ddcutil-app_setvcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/app_setvcp.c' object='app_ddcutil/ddcutil-app_setvcp.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-app_setvcp.obj `if test -f 'app_ddcutil/app_setvcp.c'; then $(CYGPATH_W) 'app_ddcutil/app_setvcp.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/app_setvcp.c'; fi` app_ddcutil/ddcutil-app_getvcp.o: app_ddcutil/app_getvcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-app_getvcp.o -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Tpo -c -o app_ddcutil/ddcutil-app_getvcp.o `test -f 'app_ddcutil/app_getvcp.c' || echo '$(srcdir)/'`app_ddcutil/app_getvcp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Tpo app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/app_getvcp.c' object='app_ddcutil/ddcutil-app_getvcp.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-app_getvcp.o `test -f 'app_ddcutil/app_getvcp.c' || echo '$(srcdir)/'`app_ddcutil/app_getvcp.c app_ddcutil/ddcutil-app_getvcp.obj: app_ddcutil/app_getvcp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT app_ddcutil/ddcutil-app_getvcp.obj -MD -MP -MF app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Tpo -c -o app_ddcutil/ddcutil-app_getvcp.obj `if test -f 'app_ddcutil/app_getvcp.c'; then $(CYGPATH_W) 'app_ddcutil/app_getvcp.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/app_getvcp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Tpo app_ddcutil/$(DEPDIR)/ddcutil-app_getvcp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='app_ddcutil/app_getvcp.c' object='app_ddcutil/ddcutil-app_getvcp.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o app_ddcutil/ddcutil-app_getvcp.obj `if test -f 'app_ddcutil/app_getvcp.c'; then $(CYGPATH_W) 'app_ddcutil/app_getvcp.c'; else $(CYGPATH_W) '$(srcdir)/app_ddcutil/app_getvcp.c'; fi` libmain/ddcutil-ddcutil_c_api.o: libmain/ddcutil_c_api.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT libmain/ddcutil-ddcutil_c_api.o -MD -MP -MF libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Tpo -c -o libmain/ddcutil-ddcutil_c_api.o `test -f 'libmain/ddcutil_c_api.c' || echo '$(srcdir)/'`libmain/ddcutil_c_api.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Tpo libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libmain/ddcutil_c_api.c' object='libmain/ddcutil-ddcutil_c_api.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o libmain/ddcutil-ddcutil_c_api.o `test -f 'libmain/ddcutil_c_api.c' || echo '$(srcdir)/'`libmain/ddcutil_c_api.c libmain/ddcutil-ddcutil_c_api.obj: libmain/ddcutil_c_api.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ddcutil_CFLAGS) $(CFLAGS) -MT libmain/ddcutil-ddcutil_c_api.obj -MD -MP -MF libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Tpo -c -o libmain/ddcutil-ddcutil_c_api.obj `if test -f 'libmain/ddcutil_c_api.c'; then $(CYGPATH_W) 'libmain/ddcutil_c_api.c'; else $(CYGPATH_W) '$(srcdir)/libmain/ddcutil_c_api.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Tpo libmain/$(DEPDIR)/ddcutil-ddcutil_c_api.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libmain/ddcutil_c_api.c' object='libmain/ddcutil-ddcutil_c_api.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) $(ddcutil_CFLAGS) $(CFLAGS) -c -o libmain/ddcutil-ddcutil_c_api.obj `if test -f 'libmain/ddcutil_c_api.c'; then $(CYGPATH_W) 'libmain/ddcutil_c_api.c'; else $(CYGPATH_W) '$(srcdir)/libmain/ddcutil_c_api.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf libmain/.libs libmain/_libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(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)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) all-local install-binPROGRAMS: install-libLTLIBRARIES installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) 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 app_ddcutil/$(DEPDIR)/$(am__dirstamp) -rm -f app_ddcutil/$(am__dirstamp) -rm -f libmain/$(DEPDIR)/$(am__dirstamp) -rm -f libmain/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool clean-local clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -rf app_ddcutil/$(DEPDIR) libmain/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-libLTLIBRARIES @$(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-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf app_ddcutil/$(DEPDIR) libmain/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-local .MAKE: $(am__recursive_targets) install-am install-exec-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ check check-am clean clean-binPROGRAMS clean-generic \ clean-libLTLIBRARIES clean-libtool clean-local \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am dist-hook \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-local distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-exec-hook \ install-html install-html-am install-includeHEADERS \ install-info install-info-am install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-local .PRECIOUS: Makefile # todo: factor out swig # todo: fails if swig/.libs doesn't exist # rm -rf swig/ddc_swig_wrap.c swig/ddc_swig.py swig/ddc_swig.pyc # Plo files in deps directories are automatically included in generated Makefiles for some reason # test -z `find . -name ".deps" -type d` || rm -rf `find . -name ".deps" -type d` # For conditionally included files, e.g. those in usb_util, make clean does not delete # the .lo files. Hence the instructions here to delete all of them # Fails: test: too many arguments: # test -z `find . -name "*lo" -type f` || rm `find . -name "*lo" -type f` clean-local: @echo "(src/Makefile) clean-local" find . -name "*plist" -type d -exec ls -ld {} \; rm -rf `find . -name "*plist" -type d` find . -name ".libs" -type d -exec ls -ld {} \; test -z `find . -name "*expand" -type f` || rm `find . -name "*expand" -type f` find . -name "*.lo" -type f -exec ls -l {} \; find . -name "*.lo" -type f -exec rm -f {} \; find . -name "*.o" -type f -exec ls -l {} \; find . -name "*.o" -type f -exec rm -f {} \; find . -name ".deps" -type d find . -name ".deps" -type d -exec ls -ld {} \; find . -path "*/.deps/*" -exec ls -l {} \; mostlyclean-local: @echo "(src/Makefile) mostlyclean-local" distclean-local: @echo "(src/Makefile) distclean-local" find . -name ".libs" -type d -exec ls -ld {} \; maintainerclean-local: @echo "(src/Makefile) maintainerclean-local" # libhack_la_SOURCES = \ # libmain/ddcutil_c_api.c # Despite what the Autotools book says, all-local is executed aftar all, not before # So this ensures that the NEXT execution of all will compile build_info.c # removed from all-local: # touch base/build_info.c all-local: @echo "Executing hook all-local..." # Notes: # 1) Without -prune option, the following line fails because list of file is archived internally, get file not found errors after remove # find $(top_distdir) -name ".deps" -exec rm -rf {} \; # 2) Piping to xargs fails on if there are no files, which occurs if "make dist" is invoked without anything having bee built. # find $(top_distdir) -name ".deps" | xargs rm # 3) Why explicit copy of .h files? # 4) find statements in src/usb_util/Makefile.am find nothing, but those here work. why? dist-hook: @echo "(src/Makefile) Executing hook dist-hook.top_distdir=$(top_distdir) distdir=$(distdir).." find . -type f | grep \.h$ | xargs -i cp --parents "{}" $(distdir) find $(distdir) -name ".deps" -prune -exec rm -rf {} \; find $(distdir) -name ".libs" -prune -exec rm -rf {} \; find $(distdir) -name "*.lo" -exec rm {} \; find $(distdir) -name "*.o" -exec rm {} \; rm -rf $(distdir)/swig/pyenv rm -rf $(distdir)/swig/__pycache__ # laclient_LDADD = libddcutil.la # demo_global_settings_LDADD = libddcutil.la # demo_vcpinfo_LDADD = libddcutil.la # demo_get_set_vcp_LDADD = libddcutil.la # demo_display_selection_LDADD = libddcutil.la # laclient_LDFLAGS = -pie # demo_global_settings_LDFLAGS = -pie # demo_vcpinfo_LDFLAGS = -pie # demo_get_set_vcp_LDFLAGS = -pie # demo_display_selection_LDFLAGS = -pie # debug-install-hook: # ls -ld $(DESTDIR)$(libdir) # ls -l $(DESTDIR)$(libdir)/*la # @echo " pythondir = $(pythondir)" # @echo " pyexecdir = $(pyexecdir)" # @echo $(DESTDIR)$(libdir) install-exec-hook: @echo "(install-exec-hook) Executing..." rm -f $(DESTDIR)$(libdir)/libddcutil.la rm -f $(DESTDIR)$(libdir)/libddcutil.a # @if [ -f $(DESTDIR)$(libdir)/libddcutil.la ] ; then \ # rm $(DESTDIR)$(libdir)/libddcutil.la ; \ # fi # @if [ -f $(DESTDIR)$(libdir)/libddcutil.a ] ; then \ # rm $(DESTDIR)$(libdir)/libddcutil.a ; \ # fi # @if [ -f $(DESTDIR)$(libdir)/libddcutil.la ] ; then \ # echo "(install-exec-hook) Stripping dependency_libs from libddcutil.la" ; \ # sed -i "/dependency_libs/ s/'.*'/''/" $(DESTDIR)$(libdir)/libddcutil.la ; \ # fi # objdump -p $(DESTDIR)$(libdir)/libddcutil.so | sed -n -e's/^[[:space:]]*SONAME[[:space:]]*//p' | sed -r -e's/([0-9])\.so\./\1-/; s/\.so(\.|$)//; y/_/-/; s/(.*)/\L&/' uninstall-local: @echo "(src/Makefile:uninstall-local) Executing..." rm -f $(DESTDIR)$(libdir)/libddcutil* # 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: ddcutil-0.8.6/src/util/0000755000175000001440000000000013230445447011724 500000000000000ddcutil-0.8.6/src/util/Makefile.am0000644000175000001440000000300613227003111013657 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(LIBDRM_CFLAGS) AM_CFLAGS = -Wall AM_CFLAGS += -Werror # -pedantic issues warnings re code that doesn't conform to ISO C # Alas, -m modifier on sscanf is a POSIX extension, not ISO C # In combination with -Werror, causes device_util.c to fail compilation # AM_CFLAGS += -pedantic # AM_CFLAGS += -H if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand clean-local: @echo "(src/util/Makefile) clean-local" mostlyclean-local: @echo "(src/util/Makefile) mostlyclean-local" distclean-local: @echo "(src/util/Makefile) distclean-local" # Intermediate Libraries noinst_LTLIBRARIES = libutil.la libutil_la_SOURCES = \ data_structures.c \ debug_util.c \ device_id_util.c \ edid.c \ error_info.c \ file_util.c \ glib_util.c \ glib_string_util.c \ i2c_util.c \ multi_level_map.c \ output_sink.c \ report_util.c \ string_util.c \ sysfs_util.c \ subprocess_util.c \ timestamp.c \ udev_i2c_util.c \ udev_usb_util.c \ udev_util.c \ utilrpt.c # libutil_la_SOURCES += systemd_util.c if ENABLE_FAILSIM_COND libutil_la_SOURCES += failsim.c endif if USE_LIBDRM_COND libutil_la_SOURCES += libdrm_util.c endif if USE_X11_COND libutil_la_SOURCES += x11_util.c endif dist-hook: @echo "(src/util/Makefile) dist-hook" ddcutil-0.8.6/src/util/Makefile.in0000644000175000001440000006031213230171237013704 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ # -pedantic issues warnings re code that doesn't conform to ISO C # Alas, -m modifier on sscanf is a POSIX extension, not ISO C # In combination with -Werror, causes device_util.c to fail compilation # AM_CFLAGS += -pedantic # AM_CFLAGS += -H @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand # libutil_la_SOURCES += systemd_util.c @ENABLE_FAILSIM_COND_TRUE@am__append_2 = failsim.c @USE_LIBDRM_COND_TRUE@am__append_3 = libdrm_util.c @USE_X11_COND_TRUE@am__append_4 = x11_util.c subdir = src/util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libutil_la_LIBADD = am__libutil_la_SOURCES_DIST = data_structures.c debug_util.c \ device_id_util.c edid.c error_info.c file_util.c glib_util.c \ glib_string_util.c i2c_util.c multi_level_map.c output_sink.c \ report_util.c string_util.c sysfs_util.c subprocess_util.c \ timestamp.c udev_i2c_util.c udev_usb_util.c udev_util.c \ utilrpt.c failsim.c libdrm_util.c x11_util.c @ENABLE_FAILSIM_COND_TRUE@am__objects_1 = failsim.lo @USE_LIBDRM_COND_TRUE@am__objects_2 = libdrm_util.lo @USE_X11_COND_TRUE@am__objects_3 = x11_util.lo am_libutil_la_OBJECTS = data_structures.lo debug_util.lo \ device_id_util.lo edid.lo error_info.lo file_util.lo \ glib_util.lo glib_string_util.lo i2c_util.lo \ multi_level_map.lo output_sink.lo report_util.lo \ string_util.lo sysfs_util.lo subprocess_util.lo timestamp.lo \ udev_i2c_util.lo udev_usb_util.lo udev_util.lo utilrpt.lo \ $(am__objects_1) $(am__objects_2) $(am__objects_3) libutil_la_OBJECTS = $(am_libutil_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libutil_la_SOURCES) DIST_SOURCES = $(am__libutil_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(LIBDRM_CFLAGS) AM_CFLAGS = -Wall -Werror $(am__append_1) CLEANFILES = \ *expand # Intermediate Libraries noinst_LTLIBRARIES = libutil.la libutil_la_SOURCES = data_structures.c debug_util.c device_id_util.c \ edid.c error_info.c file_util.c glib_util.c glib_string_util.c \ i2c_util.c multi_level_map.c output_sink.c report_util.c \ string_util.c sysfs_util.c subprocess_util.c timestamp.c \ udev_i2c_util.c udev_usb_util.c udev_util.c utilrpt.c \ $(am__append_2) $(am__append_3) $(am__append_4) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/util/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libutil.la: $(libutil_la_OBJECTS) $(libutil_la_DEPENDENCIES) $(EXTRA_libutil_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libutil_la_OBJECTS) $(libutil_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data_structures.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_id_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error_info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failsim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glib_string_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glib_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i2c_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdrm_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multi_level_map.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output_sink.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/report_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subprocess_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysfs_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timestamp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev_i2c_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev_usb_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utilrpt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11_util.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am dist-hook distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am .PRECIOUS: Makefile clean-local: @echo "(src/util/Makefile) clean-local" mostlyclean-local: @echo "(src/util/Makefile) mostlyclean-local" distclean-local: @echo "(src/util/Makefile) distclean-local" dist-hook: @echo "(src/util/Makefile) dist-hook" # 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: ddcutil-0.8.6/src/util/data_structures.c0000644000175000001440000011326213226560172015227 00000000000000/* data_structures.c * * General purpose data structures.. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file data_structures.c * Generic data structures */ /** \cond */ #include #include #include #include #include #include // for MIN, MAX /** \endcond */ #include "string_util.h" #include "data_structures.h" // bva - Byte Value Array // // An opaque structure containing an array of bytes that // can grow dynamically. Note that the same byte can // appear multiple times. /** Creates a new **Byte_Value_Array** instance. * @return newly allocated **Byte_Value_Array**. */ Byte_Value_Array bva_create() { GByteArray * ga = g_byte_array_new(); return (Byte_Value_Array) ga; } /** Creates a new **Byte_Value_Array** instance, * containing the values from an existing instance * that satisfy the filter function. * * \param bva **Byte_Value_Array** instance * \param filter_func function that takes a byte value as an argument, * returning true if the value should be included * in the output **Byte_Value_Array** * \return new **Byte_Value_Array** */ Byte_Value_Array bva_filter(Byte_Value_Array bva, IFilter filter_func) { GByteArray * src = (GByteArray*) bva; GByteArray * result = g_byte_array_new(); for (int ndx=0; ndx < src->len; ndx++) { guint8 v = src->data[ndx]; // Byte v1 = v; if (filter_func(v)) bva_append(result,v); } return (Byte_Value_Array) result; } /** Returns the number of entries in a **Byte_Value_Array**. * * @param bva **Byte_Value_Array** instance * @return number of entries */ int bva_length(Byte_Value_Array bva) { GByteArray* ga = (GByteArray*) bva; return ga->len; } /** Adds a value to a **Byte_Value_Array**. * * @param bva **Byte_Value_Array** instance * @param item value to add */ void bva_append(Byte_Value_Array bva, Byte item) { GByteArray* ga = (GByteArray*) bva; GByteArray * ga2 = g_byte_array_append(ga, &item, 1); assert(ga2 == ga); } /** Gets a value by its index from a **Byte_Value_Array**. * * @param bva **Byte_Value_Array** instance * @param ndx index of entry * @return value * * **ndx** must be a valid value. * The only check is by assert(). */ Byte bva_get(Byte_Value_Array bva, int ndx) { GByteArray* ga = (GByteArray*) bva; assert(0 <= ndx && ndx < ga->len); guint8 v = ga->data[ndx]; Byte v1 = v; return v1; } /** Checks if a **Byte_Value_Array** contains a value. * * @param bva **Byte_Value_Array** instance * @param item value to check for * @return true/false */ bool bva_contains(Byte_Value_Array bva, Byte item) { GByteArray* ga = (GByteArray*) bva; int ndx; bool result = false; // printf("(%s) item=0x%02x, ga->len=%d\n", __func__, item, ga->len); for (ndx=0; ndx < ga->len; ndx++) { guint8 v = ga->data[ndx]; // Byte v1 = v; if (v == item) { result = true; break; } } // printf("(%s) returning %d\n", __func__, result); return result; } // Comparison function used by gba_sort() static int bva_comp_func(const void * val1, const void * val2) { const guint8 * v1 = val1; const guint8 * v2 = val2; int result = 0; if (*v1 < *v2) result = -1; else if (*v1 > *v2) result = 1; // printf("(%s) *v1=%u, *v2=%u, returning: %d\n", __func__, *v1, *v2, result); return result; } /** Sorts a **Byte_Value_Array** in ascending order * * @param bva **Byte_Value_Array** instance */ void bva_sort(Byte_Value_Array bva) { // printf("(%s) Starting", __func__); GByteArray* ga = (GByteArray*) bva; qsort(ga->data, ga->len, 1, bva_comp_func); // printf("(%s) Done", __func__); } /** Compare 2 sorted #Byte_Value_Array instances for equality. * If the same value occurs multiple times in one array, it * must occur the same number of times in the other. * * \param bva1 pointer to first instance * \param bva2 pointer to second instance * \retval true arrays are identical * \retval false arrays not identical * * \remark * If bva1 or bva2 is null, it is considered to contain 0 values. */ bool bva_sorted_eq(Byte_Value_Array bva1, Byte_Value_Array bva2) { int len1 = (bva1) ? bva_length(bva1) : 0; int len2 = (bva2) ? bva_length(bva2) : 0; bool result = true; if (len1 != len2) { result = false; } else if ( (len1+len2) > 0 ) { for (int ndx = 0; ndx < bva_length(bva1); ndx++) { if (bva_get(bva1,ndx) != bva_get(bva2,ndx)) result = false; } } return result; } /** Returns the bytes from a **Byte_Value_Array**. * * @param bva **Byte_Value_Array** instance * @return pointer to bytes within * * @remark * The length of the bytes returned must be obtained from **bva_length()**. * Alternatively, consider returning a **Buffer**. * @remark * Caller should not free the returned pointer. */ Byte * bva_bytes(Byte_Value_Array bva) { GByteArray* ga = (GByteArray*) bva; // Byte * result = calloc(ga->len, sizeof(guint8)); // memcpy(result, ga->data, ga->len); Byte * result = ga->data; return result; } /** Returns a string representation of the data in a **Byte_Value_Array. * * @param bva **Byte_Value_Array** instance * @param as_hex if true, use 2 character hex representation, * if false, use 1-3 character integer representation * @param sep separator string between values, if NULL then none * @return string representation of data, caller must free */ char * bva_as_string(Byte_Value_Array bva, bool as_hex, char * sep) { GByteArray* ga = (GByteArray*) bva; int len = ga->len; Byte * bytes = ga->data; int sepsz = (sep) ? strlen(sep) : 0; int alloc_sz = len * (3+sepsz) + 1; // slightly large, but simpler to compute char * buf = calloc(1, alloc_sz); for (int ndx = 0; ndx < len; ndx++) { char * cursep = (ndx > 0 && sep) ? sep : ""; if (as_hex) snprintf(buf + strlen(buf), alloc_sz-strlen(buf), "%s%02x", cursep, bytes[ndx]); else snprintf(buf + strlen(buf), alloc_sz-strlen(buf), "%s%d", cursep, bytes[ndx]); } return buf; } /** Destroy a **Byte_Value_Array**. * * @param bva **Byte_Value_Array** instance */ void bva_free(Byte_Value_Array bva) { GByteArray* ga = (GByteArray*) bva; g_byte_array_free(ga,TRUE); } /** Debugging function to report the contents of a **Byte_Value_Array**. * * @param bva **Byte_Value_Array** instance * @param title if non-null, line to print at start of report */ void bva_report(Byte_Value_Array bva, char * title) { if (title) printf("%s\n", title); int ct = bva_length(bva); int ndx = 0; for (; ndx < ct; ndx++) { Byte hval = bva_get(bva, ndx); printf(" %02X\n", hval); } } // Tests and sample code int egmain(int argc, char** argv) { GList* list1 = NULL; list1 = g_list_append(list1, "Hello world!"); // generates warning: // printf("The first item is '%s'\n", g_list_first(list1)->data); g_list_free(list1); GSList* list = NULL; printf("The list is now %d items long\n", g_slist_length(list)); list = g_slist_append(list, "first"); list = g_slist_append(list, "second"); printf("The list is now %d items long\n", g_slist_length(list)); g_slist_free(list); return 0; } void test_value_array() { Byte_Value_Array bva = bva_create(); bva_append(bva, 0x01); bva_append(bva, 0x02); int ndx = 0; int ct = bva_length(bva); for (;ndx < ct; ndx++) { Byte val = bva_get(bva, ndx); printf("Value[%d] = 0x%02x\n", ndx, val); } bva_free(bva); } // // bbf - ByteBitFlags - // // An opaque data structure containing 256 flags // #define BYTE_BIT_MARKER "BBFG" #define BYTE_BIT_BYTE_CT 32 // number of bytes in data structure: 256/8 #define BYTE_BIT_UNOPAQUE(unopaque_var, opaque_var) _ByteBitFlags* unopaque_var = (_ByteBitFlags*) opaque_var #define BYTE_BIT_VALIDATE(flags) assert(flags && ( memcmp(flags->marker, BYTE_BIT_MARKER, 4) == 0)) typedef struct { char marker[4]; // always BBFG char byte[BYTE_BIT_BYTE_CT]; } _ByteBitFlags; // typedef _ByteBitFlags* PByteBitFlags; static _ByteBitFlags * bbf_create_internal() { _ByteBitFlags* flags = calloc(1, sizeof(_ByteBitFlags)); memcpy(flags->marker, BYTE_BIT_MARKER, 4); return flags; } /** Creates a new **Byte_Bit_Flags** instance. * * @return opaque handle to new instance */ Byte_Bit_Flags bbf_create() { return bbf_create_internal(); } /** Destroys a **Byte_Bit_Flags** instance. * * @param bbflags instance handle */ void bbf_free(Byte_Bit_Flags bbflags) { // _ByteBitFlags* flags = (_ByteBitFlags*) bbflags; BYTE_BIT_UNOPAQUE(flags, bbflags); if (flags) { assert( memcmp(flags->marker, "BBFG",4) == 0); free(flags); } } /** Sets a flag in a **Byte_Bit_Flags** instance. * * @param bbflags instance handle * @param val number of bit to set */ void bbf_set(Byte_Bit_Flags bbflags, Byte val) { BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int flagndx = val >> 3; int shiftct = val & 0x07; Byte flagbit = 0x01 << shiftct; // printf("(%s) val=0x%02x, flagndx=%d, shiftct=%d, flagbit=0x%02x\n", // __func__, val, flagndx, shiftct, flagbit); flags->byte[flagndx] |= flagbit; } /** Tests if a flag is set in a **Byte_Bit_Flags** instance. * * @param bbflags instance handle * @param val number of bit to test * @return true/false */ bool bbf_is_set(Byte_Bit_Flags bbflags, Byte val) { BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int flagndx = val >> 3; int shiftct = val & 0x07; Byte flagbit = 0x01 << shiftct; // printf("(%s) val=0x%02x, flagndx=%d, shiftct=%d, flagbit=0x%02x\n", // __func__, val, flagndx, shiftct, flagbit); bool result = flags->byte[flagndx] & flagbit; // printf("(%s) bbflags=0x%s, val=0x%02x, returning: %d\n", // __func__, hexstring( (unsigned char *)flags->byte,32), val, result); // printf("(%s) val = 0x%02x, returning %s\n", __func__, val, bool_repr(result)); return result; } /** Subtracts one **Byte_Bit_Flags** instance from another. * A flag is set in the result if it is set in the first instance * but not in the second instance. * * @param bbflags1 handle to first instance * @param bbflags2 handle to second instance * @return newly created instance with the result */ Byte_Bit_Flags bbf_subtract(Byte_Bit_Flags bbflags1, Byte_Bit_Flags bbflags2) { BYTE_BIT_UNOPAQUE(flags1, bbflags1); BYTE_BIT_VALIDATE(flags1); BYTE_BIT_UNOPAQUE(flags2, bbflags2); BYTE_BIT_VALIDATE(flags2); _ByteBitFlags * result = bbf_create(); for (int ndx = 0; ndx < BYTE_BIT_BYTE_CT; ndx++) { result->byte[ndx] = flags1->byte[ndx] & ~flags2->byte[ndx]; } return result; } /** Returns a 64 character long hex string representing the data structure. * * @param bbflags instance handle * @param buffer buffer in which to return string * @param buflen buffer length * * @return character string representation of flags that are set * * If buffer is NULL then memory is malloc'd. It is the responsibility * of the caller to free the returned string. * * If buflen is insufficiently large an assertion fails. * * @remark * Future enhancement: Insert a separator character every n characters? */ char * bbf_repr(Byte_Bit_Flags bbflags, char * buffer, int buflen) { BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int reqd_size = (2*BYTE_BIT_BYTE_CT) /* 2 hex chars for each byte*/ + 1 /* trailing null*/ ; if (buffer) assert(buflen >= reqd_size); else buffer = malloc(reqd_size); *buffer = '\0'; int flagndx = 0; for (; flagndx < 8; flagndx++) sprintf(buffer + strlen(buffer), "%02x", flags->byte[flagndx]); return buffer; } /** Returns the number of bits set in a **Byte_Bit_Flags** * * @param bbflags instance handle * @return number of bits set (0..256) */ int bbf_count_set(Byte_Bit_Flags bbflags) { BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int result = 0; int flagndx; int bitndx; for (flagndx=0; flagndx < BYTE_BIT_BYTE_CT; flagndx++) { for (bitndx = 0; bitndx < 8; bitndx++) { unsigned char flagbit = (0x80 >> bitndx); if (flags->byte[flagndx] & flagbit) result += 1; } } // printf("(%s) returning: %d\n", __func__, result); return result; } /** Returns a string of space separated 2 character hex values * representing the bits set in the Byte_Bit_Flag, * e.g. "03 7F" if bits 0x03 and 0x7F are set * * @param bbflags instance handle * @param buffer pointer to buffer in which to return character string, * if NULL malloc a new buffer * @param buflen buffer length * * @return pointer to character string * * If a new buffer is allocated, it is the responsibility of the caller to * free the string returned. * * For complete safety in case every bit is set, buflen should be >= 768. * (2 chars for every bit (512), 255 separator characters, 1 terminating null) * If buflen in insufficiently large to contain the result, an assertion fails. */ char * bbf_to_string(Byte_Bit_Flags bbflags, char * buffer, int buflen) { // printf("(%s) Starting\n", __func__); BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int bit_set_ct = bbf_count_set(flags); int reqd_size = bit_set_ct * 2 + // char rep of bytes (bit_set_ct-1) * 1 + // separating spaces 1; // trailing null if (buffer) assert(buflen >= reqd_size); else buffer = malloc(reqd_size); char * pos = buffer; unsigned int flagno = 0; // printf("(%s) bbflags->byte=0x%s\n", __func__, hexstring(flags->byte,32)); for (flagno = 0; flagno < 256; flagno++) { Byte flg = (Byte) flagno; // printf("(%s) flagno=%d, flg=0x%02x\n", __func__, flagno, flg); if (bbf_is_set(flags, flg)) { // printf("(%s) Flag is set: %d, 0x%02x\n", __func__, flagno, flg); if (pos > buffer) { *pos = ' '; pos++; } // printf("(%s) flg=%02x\n", __func__, flg); sprintf(pos, "%02x", flg); pos += 2; // printf("(%s) pos=%p\n", __func__, pos); } } // printf("(%s) Done. Returning: %s\n", __func__, buffer); return buffer; } int bbf_to_bytes(Byte_Bit_Flags bbflags, Byte * buffer, int buflen) { // printf("(%s) Starting\n", __func__); BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int bit_set_ct = bbf_count_set(flags); assert(buflen >= bit_set_ct); unsigned int bufpos = 0; unsigned int flagno = 0; // printf("(%s) bbflags->byte=0x%s\n", __func__, hexstring(flags->byte,32)); for (flagno = 0; flagno < 256; flagno++) { Byte flg = (Byte) flagno; // printf("(%s) flagno=%d, flg=0x%02x\n", __func__, flagno, flg); if (bbf_is_set(flags, flg)) { // printf("(%s) Flag is set: %d, 0x%02x\n", __func__, flagno, flg); buffer[bufpos++] = flg; } } // printf("(%s) Done. Returning: %d\n", __func__, bupos); return bufpos; } /** Converts a **Byte_Bit_Flags** instance to a sequence of bytes whose values * correspond to the bits that are set. * The byte sequence is returned in a newly allocated **Buffer**. * * @param bbflags instance handle * @return pointer to newly allocated **Buffer** */ Buffer * bbf_to_buffer(Byte_Bit_Flags bbflags) { BYTE_BIT_UNOPAQUE(flags, bbflags); BYTE_BIT_VALIDATE(flags); int bit_set_ct = bbf_count_set(flags); Buffer * buf = buffer_new(bit_set_ct, __func__); for (unsigned int flagno = 0; flagno < 256; flagno++) { Byte flg = (Byte) flagno; // printf("(%s) flagno=%d, flg=0x%02x\n", __func__, flagno, flg); if (bbf_is_set(flags, flg)) { buffer_add(buf, flg); } } // printf("(%s) Done. Returning: %s\n", __func__, buffer); return buf; } #define BBF_ITER_MARKER "BBFI" typedef struct { char marker[4]; Byte_Bit_Flags bbflags; int lastpos; } _Byte_Bit_Flags_Iterator; /** Creates an iterator for a #Byte_Bit_Flags instance. * The iterator is an opaque object. * * \param bbflags handle to #Byte_Bit_Flags instance * \return iterator */ Byte_Bit_Flags_Iterator bbf_iter_new(Byte_Bit_Flags bbflags) { _Byte_Bit_Flags_Iterator * result = malloc(sizeof(_Byte_Bit_Flags_Iterator)); memcpy(result->marker, BBF_ITER_MARKER, 4); result->bbflags = bbflags; // TODO: save pointer to unopaque _BitByteFlags result->lastpos = -1; return result; } /** Free a #Byte_Bit_Flags_Iterator. * * \param bbf_iter handle to iterator (may be NULL) */ void bbf_iter_free(Byte_Bit_Flags_Iterator bbf_iter) { _Byte_Bit_Flags_Iterator * iter = (_Byte_Bit_Flags_Iterator *) bbf_iter; if (bbf_iter) { assert(memcmp(iter->marker, BBF_ITER_MARKER, 4) == 0); iter->marker[3] = 'x'; free(iter); } } /** Reinitializes an iterator. Sets the current position before the first * value. * * \param bbf_iter handle to iterator */ void bbf_iter_reset(Byte_Bit_Flags_Iterator bbf_iter) { _Byte_Bit_Flags_Iterator * iter = (_Byte_Bit_Flags_Iterator *) bbf_iter; assert(iter && memcmp(iter->marker, BBF_ITER_MARKER, 4) == 0); iter->lastpos = -1; } /** Returns the number of the next bit that is set. * * \param bbf_iter handle to iterator * \return number of next bit that is set */ int bbf_iter_next(Byte_Bit_Flags_Iterator bbf_iter) { _Byte_Bit_Flags_Iterator * iter = (_Byte_Bit_Flags_Iterator *) bbf_iter; assert( iter && memcmp(iter->marker, BBF_ITER_MARKER, 4) == 0); // printf("(%s) Starting. lastpos = %d\n", __func__, iter->lastpos); int result = -1; for (int ndx = iter->lastpos + 1; ndx < 256; ndx++) { if (bbf_is_set(iter->bbflags, ndx)) { result = ndx; iter->lastpos = ndx; break; } } // printf("(%s) Returning: %d\n", __func__, result); return result; } // // Cross functions bba <-> bbf // /** Tests if the bit number of every byte in a #Byte_Value_Array is set * in a #Byte_Bit_Flags, and conversely that for every bit set in the * #Byte_Bit_Flags there is a corresponding byte in the #Byte_Value_Array. * * Note it is possible that the same byte appears more than once in the * #Byte_Value_Array. * * \param bva #Byte_Value_Array to test * \param bbflags #Byte_Bit_Flags to test * \return true/false */ bool bva_bbf_same_values( Byte_Value_Array bva , Byte_Bit_Flags bbflags) { bool result = true; int item; for (item = 0; item < 256; item++) { // printf("item=%d\n", item); bool r1 = bva_contains(bva, item); bool r2 = bbf_is_set(bbflags, item); if (r1 != r2) result = false; } return result; } /** Function matching signature #Byte_Appender that adds a byte * to a #Byte_Value_Array. * * \param data_struct pointer to #Byte_Value_Array * \param val byte to append */ void bva_appender(void * data_struct, Byte val) { Byte_Value_Array bva = (Byte_Value_Array) data_struct; bva_append(bva, val); } /** Function matching signature #Byte_Appender that sets a bit in * a #Byte_Bit_Flags * * \param data_struct pointer to #Byte_Bit_Flags * \param val bit number to set */ void bbf_appender(void * data_struct, Byte val) { Byte_Bit_Flags bbf = (Byte_Bit_Flags) data_struct; assert(bbf); bbf_set(bbf, val); } /** Stores a list of bytehex values in either a **Byte_Value_Array** or a **Byte_Bit_Flags**. * * @param start starting address of hex values * @param len length of hex values * @param data_struct opague handle to either a **Byte_Value_Array** or a **Byte_Bit_Flags** * @param appender function to add a value to **data_struct** * * @return false if any input data cannot be parsed, true otherwise */ bool store_bytehex_list(char * start, int len, void * data_struct, Byte_Appender appender){ bool ok = true; char * buf = malloc(len+1); memcpy(buf, start, len); buf[len] = '\0'; char * curpos = buf; char * nexttok; Byte byteVal = 0x00; // initialization logically unnecessary, but makes compiler happy while ( (nexttok = strtok(curpos, " ")) != NULL) { if (curpos) curpos = NULL; // for all calls after first int ln = strlen(nexttok); bool hexok = false; if (ln == 2) { // normal case // byteVal = hhc_to_byte(nexttok); hexok = hhc_to_byte_in_buf(nexttok, &byteVal); } else if (ln == 1) { // on old ultrasharp connected to blackrock (pre v2), values in capabilities // string are single digits. Not clear whether to regard them as decimal or hex, // since all values are < 9. But in that case decimal and single digit hex // give the same value. char buf[2]; buf[0] = '0'; buf[1] = *nexttok; // byteVal = hhc_to_byte(buf); hexok = hhc_to_byte_in_buf(buf, &byteVal); } if (!hexok) { printf("(%s) Invalid hex value in list: %s\n", __func__, nexttok); ok = false; } // printf("(%s) byteVal=0x%02x \n", __func__, byteVal ); if (hexok) appender(data_struct, byteVal); } free(buf); // printf("(%s) Returning %s\n", __func__, bool_repr(ok)); return ok; } /** Parses a list of bytehex values and stores the result in a **Byte_Value_Array**. * * @param bva handle of **Byte_Value_Array** instance * @param start starting address of hex values * @param len length of hex values * * @return false if any input data cannot be parsed, true otherwise */ bool bva_store_bytehex_list(Byte_Value_Array bva, char * start, int len) { return store_bytehex_list(start, len, bva, bva_appender); } /** Parses a list of bytehex values and stores the result in a **Byte_Bit_Flags**. * * @param bbf handle of **Byte_Bit_Flags** instance * @param start starting address of hex values * @param len length of hex values * * @return false if any input data cannot be parsed, true otherwise */ bool bbf_store_bytehex_list(Byte_Bit_Flags bbf, char * start, int len) { return store_bytehex_list(start, len, bbf, bbf_appender); } // // Buffer with length management // bool trace_buffer_malloc_free = false; bool trace_buffer = false; // controls buffer tracing bool trace_buffer_resize = false; /** Allocates a **Buffer** instance * * @param size maximum number of bytes that buffer can hold * @param trace_msg optional trace message * * @return pointer to newly allocated instance */ Buffer * buffer_new(int size, const char * trace_msg) { int hacked_size = size+16; // try allocating extra space see if free failures go away - overruns? // printf("(%s) sizeof(Buffer)=%ld, size=%d\n", __func__, sizeof(Buffer), size); // sizeof(Buffer) == 16 Buffer * buffer = (Buffer *) malloc(sizeof(Buffer)); memcpy(buffer->marker, BUFFER_MARKER, 4); buffer->bytes = (Byte *) calloc(1, hacked_size); // hack buffer->buffer_size = size; buffer->len = 0; buffer->size_increment = 0; if (trace_buffer_malloc_free) printf("(%s) Allocated buffer. buffer=%p, buffer->bytes=%p, &buffer->bytes=%p, %s\n", __func__, (void*)buffer, buffer->bytes, (void*)&(buffer->bytes), trace_msg); return buffer; } /** Sets a size increment for the buffer, allowing it to be dynamically * resized if necessary. * * @param buf pointer to Buffer instance * @param size_increment if resizing is necessary, the buffer size will be * increased by this amount */ void buffer_set_size_increment(Buffer * buf, uint16_t size_increment) { buf->size_increment = size_increment; } /** Allocates a **Buffer** instance and sets an initial value * * @param bytes pointer to initial value * @param bytect length of initial value, the buffer size is * also set to this value * @param trace_msg optional trace message * * @return pointer to newly allocated instance * * @remark * Setting the buffer size to the initial value does not allow for * expansion, unless buffer_set_size_increment() is called */ Buffer * buffer_new_with_value(Byte * bytes, int bytect, const char * trace_msg) { Buffer* buf = buffer_new(bytect, trace_msg); buffer_put(buf, bytes, bytect); return buf; } /** Copies a Buffer. * * @param srcbuf instance to copy * @param trace_msg optional trace message * * @return newly allocated copy * * @remark * - The contents of the newly allocated Buffer is identical to * the original, but the maximum length and size increment are * not. Is this an issue? * - Not currently used. (3/2017) */ Buffer * buffer_dup(Buffer * srcbuf, const char * trace_msg) { return buffer_new_with_value(srcbuf->bytes, srcbuf->len, trace_msg); } /** Frees a Buffer instance. All memory associated with the Buffer is released. * * @param buffer pointer to Buffer instance, must be valid * @param trace_msg optional trace message */ void buffer_free(Buffer * buffer, const char * trace_msg) { if (trace_buffer_malloc_free) printf("(%s) Starting. buffer = %p\n", __func__, (void*) buffer); assert(buffer); assert(memcmp(buffer->marker, BUFFER_MARKER, 4) == 0); if (buffer->bytes) { if (trace_buffer_malloc_free) printf("(%s) Freeing buffer->bytes = %p, &buffer->bytes=%p\n", __func__, buffer->bytes, (void*)&(buffer->bytes)); free(buffer->bytes); } if (trace_buffer_malloc_free) printf("(%s) Freeing buffer = %p, %s\n", __func__, (void*)buffer, trace_msg); buffer->marker[3] = 'x'; free(buffer); if (trace_buffer_malloc_free) printf("(%s) Done\n", __func__); } /** Returns the length of the data in the Buffer. * * @param buffer pointer to Buffer instance * @return number of bytes in Buffer */ int buffer_length(Buffer * buffer) { return buffer->len; } /** Adjusts the number of bytes in a Buffer. * * @param buffer pointer to buffer instance * @param bytect new length of buffer contents, must be less that * the maximum size of the buffer */ void buffer_set_length(Buffer * buffer, int bytect) { if (trace_buffer) printf("(%s) bytect=%d, buffer_size=%d\n", __func__, bytect, buffer->buffer_size); assert (bytect <= buffer->buffer_size); buffer->len = bytect; } /** Sets the value stored in a Buffer to a range of bytes. * The buffer length is updated. * * @param buffer pointer to Buffer instance * @param bytes pointer to bytes to store in buffer * @param bytect number of bytes to store */ void buffer_put(Buffer * buffer, Byte * bytes, int bytect) { if (trace_buffer) { printf("(%s) buffer->bytes = %p, bytes=%p, bytect=%d\n", __func__, buffer->bytes, bytes, bytect); printf("(%s) cur len = %d, storing |%.*s|, bytect=%d\n", __func__, buffer->len, bytect, bytes, bytect); } assert (bytect <= buffer->buffer_size); memcpy(buffer->bytes, bytes, bytect); buffer->len = buffer->len + bytect; // printf("(%s) Returning. cur len = %d\n", __func__, buffer->len); } /** Stores a single byte at a specified offset in the buffer. * The buffer length is not updated. * * @param buf pointer to Buffer instance * @param offset offset in buffer at which to store byte * @param byte byte value to be stored * * @remark * A dangerous function. Use with care. */ void buffer_set_byte(Buffer * buf, int offset, Byte byte) { if (trace_buffer) printf("(%s) Storing 0x%02x at offset %d\n", __func__, byte, offset); assert(offset >= 0 && offset < buf->buffer_size); buf->bytes[offset] = byte; } /** Sets a range of bytes in a Buffer. * The logical length of the buffer is not updated. * * @param buf pointer to Buffer instance * @param offset offset in buffer at which to store byte * @param bytes pointer to bytes to store * @param bytect number of bytes to store */ void buffer_set_bytes(Buffer * buf, int offset, Byte * bytes, int bytect) { if (trace_buffer) printf("(%s) Storing %d bytes at offset %d, buffer_size=%d\n", __func__, bytect, offset, buf->buffer_size); assert(offset >= 0 && (offset + bytect) <= buf->buffer_size); memcpy(buf->bytes+offset, bytes, bytect); } /** Appends a sequence of bytes to the current contents of a Buffer. * The buffer length is updated. * * @param buffer pointer to the Buffer object * @param bytes pointer to the bytes to be appended * @param bytect number of bytes to append */ void buffer_append(Buffer * buffer, Byte * bytes, int bytect) { // printf("(%s) Starting. buffer=%p\n", __func__, buffer); assert( memcmp(buffer->marker, BUFFER_MARKER, 4) == 0); if (trace_buffer) { printf("(%s) cur len = %d, appending |%.*s|, bytect=%d\n", __func__, buffer->len, bytect, bytes, bytect); printf("(%s) buffer->bytes + buffer->len = %p, bytes=%p, bytect=%d\n", __func__, buffer->bytes+buffer->len, bytes, bytect); } // buffer->len + 2 + bytect .. why the + 2? int required_size = buffer->len + 2 + bytect; if (required_size > buffer->buffer_size && buffer->size_increment > 0) { int new_size = MAX(required_size, buffer->buffer_size + buffer->size_increment); if (trace_buffer_resize) printf("(%s) Resizing. old size = %d, new size = %d\n", __func__, buffer->buffer_size, new_size); buffer_extend(buffer, new_size - buffer->buffer_size); } assert(buffer->len + 2 + bytect <= buffer->buffer_size); memcpy(buffer->bytes + buffer->len, bytes, bytect); buffer->len = buffer->len + bytect; // printf("(%s) Returning. cur len = %d\n", __func__, buffer->len); } /** Appends a string to the current string in the buffer. * * @param buffer pointer to Buffer * @param str string to append * * @remark * If the buffer is not empty, checks by assert that * the last character stored is '\0'; */ void buffer_strcat(Buffer * buffer, char * str) { assert( memcmp(buffer->marker, BUFFER_MARKER, 4) == 0); if (buffer->len == 0) { buffer_append(buffer, (Byte *) str, strlen(str)+1); } else { assert(buffer->bytes[buffer->len - 1] == '\0'); buffer_set_length(buffer, buffer->len - 1); // truncate trailing \0 buffer_append(buffer, (Byte *) str, strlen(str) + 1); } } /** Appends a single byte to the current value in the buffer. * The buffer length is updated. * * @param buffer pointer to Buffer instance * @param byte value to append * * @todo Increase buffer size if necessary and size_increment > 0 */ void buffer_add(Buffer * buffer, Byte byte) { assert( memcmp(buffer->marker, BUFFER_MARKER, 4) == 0); assert(buffer->len + 1 <= buffer->buffer_size); buffer->bytes[buffer->len++] = byte; } /** Tests whether 2 Buffer instances have the same * contents. * * @param buf1 pointer to first Buffer * @param buf2 pointer to second Buffer * @return true if contents are identical, false if not * * @remark * - If both buf1==NULL and buf2==NULL, the result is true */ bool buffer_eq(Buffer* buf1, Buffer* buf2) { bool result = false; if (!buf1 && !buf2) result = true; else if (buf1 && buf2 && buf1->len == buf2->len && memcmp(buf1->bytes, buf2->bytes, buf1->len) == 0 ) result = true; return result; } /** Increases the size of a Buffer * * @param buf pointer to Buffer instance * @param addl_size number of additional bytes */ void buffer_extend(Buffer* buf, int addl_size) { int new_size = buf->buffer_size + addl_size; buf->bytes = realloc(buf->bytes, new_size); buf->buffer_size = new_size; } /** Displays all fields of the Buffer. * This is a debugging function. * * @param buffer pointer to Buffer instance * * @remark * Output is written to stdout. */ void buffer_dump(Buffer * buffer) { printf("Buffer at %p, bytes addr=%p, len=%d, max_size=%d\n", (void*)buffer, buffer->bytes, buffer->len, buffer->buffer_size); // printf(" bytes end addr=%p\n", buffer->bytes+buffer->buffer_size); if (buffer->bytes) hex_dump(buffer->bytes, buffer->len); } // // Identifier id to name and description lookup // /** Returns the name of an entry in a Value_Nmme_Title table. * * @param table pointer to table * @param val value to lookup * * @return name of value, NULL if not found */ char * vnt_name(Value_Name_Title* table, uint32_t val) { // printf("(%s) val=%d\n", __func__, val); // debug_vnt_table(table); char * result = NULL; Value_Name_Title * cur = table; for (; cur->name; cur++) { if (val == cur->value) { result = cur->name; break; } } return result; } /** Returns the title (description field) of an entry in a Value_Nmme_Title table. * * @param table pointer to table * @param val value to lookup * * @return title of value, NULL if not found */ char * vnt_title(Value_Name_Title* table, uint32_t val) { // printf("(%s) val=%d\n", __func__, val); // debug_vnt_table(table); char * result = NULL; Value_Name_Title * cur = table; for (; cur->name; cur++) { if (val == cur->value) { result = cur->title; break; } } return result; } /** Searches a Value_Name_Title_Table for a specified name or title, * and returns its id value. * * @param table a Value_Name_Title table * @param s string to search for * @param use_title if false, search name field\n * if true, search title field * @param ignore_case if true, search is case-insensitive * @param default_id value to return if not found * * @result value id */ uint32_t vnt_find_id( Value_Name_Title_Table table, const char * s, bool use_title, // if false, search by symbolic name, if true, search by title bool ignore_case, uint32_t default_id) { assert(s); uint32_t result = default_id; Value_Name_Title * cur = table; for (; cur->name; cur++) { char * comparand = (use_title) ? cur->title : cur->name; if (comparand) { int comprc = (ignore_case) ? strcasecmp(s, comparand) : strcmp( s, comparand); if (comprc == 0) { result = cur->value; break; } } } return result; } /** Interprets an integer whose bits represent named flags. * * @param flags_val value to interpret * @param bitname_table pointer to Value_Name table * @param use_title if **true**, use the **title** field of the table,\n * if **false**, use the **name** field of the table * @param sepstr if non-NULL, separator string to insert between values * * @return newly allocated character string * * @remark * - It is the responsibility of the caller to free the returned string * - If a referenced **title** field is NULL, "missing" is used as the value */ char * vnt_interpret_flags( uint32_t flags_val, Value_Name_Title_Table bitname_table, bool use_title, char * sepstr) { bool debug = false; if (debug) printf("(%s) Starting. flags_val=0x%08x, bitname_table=%p, use_title=%s, sepstr=|%s|\n", __func__, flags_val, (void*)bitname_table, bool_repr(use_title), sepstr); GString * sbuf = g_string_sized_new(200); bool first = true; Value_Name_Title * cur_entry = bitname_table; while (cur_entry->name) { if (debug) printf("(%s) cur_entry=%p, Comparing flags_val=0x%08x vs cur_entry->value = 0x%08x\n", __func__, (void*)cur_entry, flags_val, cur_entry->value); if (!flags_val && cur_entry->value == flags_val) { // special value for no bit set char * sval = (use_title) ? cur_entry->title : cur_entry->name; if (!sval) sval = "missing"; g_string_append(sbuf, sval); break; } if (flags_val & cur_entry->value) { if (first) first = false; else { if (sepstr) { g_string_append(sbuf, sepstr); } } char * sval = (use_title) ? cur_entry->title : cur_entry->name; if (!sval) { sval = "missing"; } g_string_append(sbuf, sval); } cur_entry++; } char * result = strdup(sbuf->str); g_string_free(sbuf, true); if (debug) printf("(%s) Done. Returning: |%s|\n", __func__, result); return result; } /** Shows the contents of a **Value_Name_Title table. * Output is written to stdout. * * @param table pointer to table */ void vnt_debug_table(Value_Name_Title * table) { printf("Value_Name_Title table:\n"); Value_Name_Title * cur = table; for (; cur->name; cur++) { printf(" %2d %-30s %s\n", cur->value, cur->name, cur->title); } } ddcutil-0.8.6/src/util/debug_util.c0000644000175000001440000001262713225153602014134 00000000000000/* debug_util.c * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file debug_util.c * Functions for debugging */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "string_util.h" #include "debug_util.h" /* Extracts the function name and offset from a backtrace line * * \param bt_line line returned by backtrace() * \param name_only if true, return only the name * \return string of form "name+offset" or just "name". * It is the responsibility of the caller to free this string. */ static char * extract_function(char * bt_line, bool name_only) { bool debug = false; if (debug) printf("\n(%s) bt_line = |%s|\n", __func__, bt_line); char * result = NULL; char * start = strchr(bt_line, '('); if (!start) { result = strdup("???"); } else { start++; // character after paren char * end = strchr(start, ')'); if (!end) end = bt_line + strlen(bt_line); int len = end - start; if (debug) { printf("(%s) start=%p, end=%p, len=%d\n", __func__, start, end, len); printf("(%s) extract is |%.*s|\n", __func__, len, start); } result = malloc(len+1); memcpy(result, start, len); result[len] = '\0'; } if (name_only) { char *p = strchr(result, '+'); if (p) *p = '\0'; } if (debug) printf("(%s) Returning |%s|\n", __func__, result); return result; } #ifdef OLD /** Show the call stack. * * @param stack_adjust number of initial stack frames to ignore, to hide this * function and possibly some number of immediate callers * * @remark * Note that the call stack is approximate. The underlying system function, backtrace() * relies on external symbols, so static functions will not be properly shown. */ void show_backtrace(int stack_adjust) { bool debug = false; if (debug) printf("(%s) Starting. stack_adjust = %d\n", __func__, stack_adjust); int j, nptrs; const int MAX_ADDRS = 100; void *buffer[MAX_ADDRS]; char **strings; nptrs = backtrace(buffer, MAX_ADDRS); if (debug) printf("(%s) backtrace() returned %d addresses\n", __func__, nptrs); strings = backtrace_symbols(buffer, nptrs); if (strings == NULL) { perror("backtrace_symbols unavailable"); } else { printf("Current call stack\n"); for (j = 0; j < nptrs; j++) { if (j < stack_adjust) { if (debug) printf("(%s) Suppressing %s\n", __func__, strings[j]); } else { // printf(" %s\n", strings[j]); char * s = extract_function(strings[j], true); printf(" %s\n", s); bool final = (streq(s, "main")) ? true : false; free(s); if (final) break; } } free(strings); } } #endif GPtrArray * get_backtrace(int stack_adjust) { bool debug = false; if (debug) printf("(%s) Starting. stack_adjust = %d\n", __func__, stack_adjust); GPtrArray * result = NULL; int j, nptrs; const int MAX_ADDRS = 100; void *buffer[MAX_ADDRS]; char **strings; nptrs = backtrace(buffer, MAX_ADDRS); if (debug) printf("(%s) backtrace() returned %d addresses\n", __func__, nptrs); strings = backtrace_symbols(buffer, nptrs); if (strings == NULL) { if (debug) perror("backtrace_symbols unavailable"); } else { result = g_ptr_array_sized_new(nptrs-stack_adjust); if (debug) printf("Current call stack\n"); for (j = 0; j < nptrs; j++) { if (j < stack_adjust) { if (debug) printf("(%s) Suppressing %s\n", __func__, strings[j]); } else { // printf(" %s\n", strings[j]); char * s = extract_function(strings[j], true); if (debug) printf(" %s\n", s); g_ptr_array_add(result, s); bool final = (streq(s, "main")) ? true : false; if (final) break; } } free(strings); } return result; } void show_backtrace(int stack_adjust) { GPtrArray * callstack = get_backtrace(stack_adjust); if (!callstack) { perror("backtrace_symbols unavailable"); } else { printf("Current call stack:\n"); for (int ndx = 0; ndx < callstack->len; ndx++) { printf(" %s\n", (char *) g_ptr_array_index(callstack, ndx)); } g_ptr_array_free(callstack, true); } } ddcutil-0.8.6/src/util/device_id_util.c0000644000175000001440000007747513214560635015003 00000000000000/* device_id_util.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file device_id_util.c * Lookup PCI and USB device ids */ /** \cond */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /** \endcond */ #include "file_util.h" #include "multi_level_map.h" #include "report_util.h" #include "string_util.h" #include "device_id_util.h" #ifndef MAX_PATH #define MAX_PATH 256 #endif /** Indicates ID type */ typedef enum { ID_TYPE_PCI, ID_TYPE_USB } Device_Id_Type; // keep in order with enum Device_Id_Type static char * simple_device_fn[] = { "pci.ids", "usb.ids" }; /** Finds the pci.ids or usb.ids file. * * @param id_type ID_TYPE_PCI or ID_TYPE_USB * @return fully qualified file name of device id file, * NULL if not found * * @remark * It is the responsibility of the caller to free the returned value. */ static char * devid_find_file(Device_Id_Type id_type) { bool debug = false; char * known_pci_ids_dirs[] = { "/usr/share/libosinfo/db", "/usr/share", "/usr/share/misc", "/usr/share/hwdata", NULL }; char * id_fn = simple_device_fn[id_type]; if (debug) printf("(%s) id_type=%d, id_fn = |%s|\n", __func__, id_type, id_fn); char * result = NULL; int ndx; for (ndx=0; known_pci_ids_dirs[ndx] != NULL; ndx++) { char fnbuf[MAX_PATH]; snprintf(fnbuf, MAX_PATH, "%s/%s", known_pci_ids_dirs[ndx], id_fn); if (debug) printf("(%s) Looking for |%s|\n", __func__, fnbuf); struct stat stat_buf; int rc = stat(fnbuf, &stat_buf); if (rc == 0) { result = strdup(fnbuf); break; } } if (debug) printf("(%s) id_type=%d, Returning: %s\n", __func__, id_type, result); return result; } // // Simple_Id_Table // // A simple data structure for the simple case where there is only a single // level of lookup typedef struct { ushort id; char * name; } Simple_Id_Table_Entry; typedef GPtrArray Simple_Id_Table; // array of Simple_Id_Table_Entry /* Creates a new Simple_Id_Table * * Arguments: * initial_size if > 0, size for initial allocation * * Returns: pointer to newly allocated table */ static Simple_Id_Table * create_simple_id_table(int initial_size) { Simple_Id_Table * new_table = NULL; if (initial_size > 0) new_table = g_ptr_array_sized_new(initial_size); else new_table = g_ptr_array_new(); return new_table; } /* Adds an entry to a Simple_Id_Table * * Arguments: * simple_table pointer to Simple_Id_Table * id key of entry * name value of entry */ static Simple_Id_Table_Entry * sit_add(Simple_Id_Table * simple_table, ushort id, char * name) { Simple_Id_Table_Entry * new_entry = calloc(1, sizeof(Simple_Id_Table_Entry)); new_entry->id = id; new_entry->name = strdup(name); g_ptr_array_add(simple_table, new_entry); return new_entry; } void report_simple_id_table(Simple_Id_Table * simple_table, int depth) { rpt_structure_loc("Simple ids table", simple_table, depth); for (int ndx = 0; ndx < simple_table->len; ndx++) { Simple_Id_Table_Entry * cur_entry = g_ptr_array_index(simple_table, ndx); rpt_vstring(depth+1, "0x%04x -> |%s|", cur_entry->id, cur_entry->name); } } char * get_simple_id_name(Simple_Id_Table * simple_table, ushort id) { char * result = NULL; for (int ndx = 0; ndx < simple_table->len; ndx++) { Simple_Id_Table_Entry * cur_entry = g_ptr_array_index(simple_table, ndx); if (cur_entry->id == id) { result = cur_entry->name; break; } } return result; } // // *** Global Variables *** // // stats 12/2015: // lines in pci.ids: 25,339 // vendors: 2,066 // total devices: 11,745 // subsystem: 10,974 static Multi_Level_Map * pci_vendors_mlm = {0}; static Multi_Level_Map * usb_vendors_mlm = {0}; static Simple_Id_Table * hid_descriptor_types; // tag HID static Simple_Id_Table * hid_descriptor_item_types; // tag R static Simple_Id_Table * hid_country_codes; // tag HCC - for keyboards static Multi_Level_Map * hid_usages_table; // tag HUT // // *** Input File Parsing *** // /* Parses a subrange of an array of text lines into an empty Simple_Id_Table * * Arguments: * simple_table * all_lines array of pointer to text lines to parse * segment_tag first token in lines, when this changes it indicates segment exhausted * cur_pos first line of all_lines to parse * end_pos updated with line number after last line of segment */ static void load_simple_id_segment( Simple_Id_Table * simple_table, // empty GPtrArray, will be filled in w Simple_Id_Table_Entry * GPtrArray * all_lines, // array of pointers to lines char * segment_tag, int cur_pos, int * end_pos) { bool debug = false; assert(simple_table); if (debug) { printf("(%s) Starting. curpos=%d, -> |%s|\n", __func__, cur_pos, (char *) g_ptr_array_index(all_lines,cur_pos)); } bool more = true; int linect = all_lines->len; while (more && cur_pos < linect) { char * a_line = g_ptr_array_index(all_lines, cur_pos++); rtrim_in_place(a_line); // printf("(%s) curpos=%d, a_line=|%s|\n", __func__, cur_pos-1, a_line); if ( strlen(a_line) == 0 || a_line[0] == '#') { // printf("(%s) Comment line\n", __func__); continue; } // split into tag hexvalue name char atag[40]; ushort acode; char* aname; int ct = sscanf(a_line, "%s %hx %m[^\n]", atag, &acode, &aname); // printf("(%s) ct = %d, atag=|%s|, acode=0x%08x, aname=|%s|\n", // __func__, ct, atag, acode, aname); // do something with return code to avoid coverity warning assert(ct >= 0); if (!streq(atag, segment_tag)) { // printf("(%s) Tag doesn't match\n", __func__); break; } sit_add(simple_table, acode, aname); } if (cur_pos <= linect) cur_pos--; *end_pos = cur_pos; if (debug) printf("(%s) Set end_pos = %d\n", __func__, cur_pos); } static Multi_Level_Map * load_multi_level_segment( Multi_Level_Map * header, char * segment_tag, GPtrArray * all_lines, int* curpos) { bool debug = false; int linendx = *curpos; if (debug) printf("(%s) Starting. linendx=%d, -> |%s|\n", __func__, linendx, (char *) g_ptr_array_index(all_lines,linendx)); MLM_Node * cur_nodes[8] = {NULL}; // todo: deal properly w max levels for (int ndx = 0; ndx < header->levels; ndx++) { header->level_detail[ndx].total_entries = 0; header->level_detail[ndx].cur_entry = NULL; } ushort cur_code; char * cur_name; bool more = true; while (more && linendx < all_lines->len) { char * a_line = g_ptr_array_index(all_lines, linendx++); int tabct = 0; while (a_line[tabct] == '\t') tabct++; if (strlen(rtrim_in_place(a_line+tabct)) == 0 || a_line[tabct] == '#') continue; if (tabct == 0) { char cur_tag[40]; int ct = sscanf(a_line+tabct, "%s %4hx %m[^\n]", cur_tag, &cur_code, // &header->level_detail[tabct].cur_entry->code, &cur_name); // &header->level_detail[tabct].cur_entry->name ); if (!streq(cur_tag, segment_tag)) { // more = false; // needed for continue break; // or continue? } if (ct != 3) { printf("(%s) Error processing line %d: \"%s\"\n", __func__, linendx, a_line); printf("(%s) Lines has %d fields, not 3. Ignoring\n", __func__, ct); // hex_dump(a_line+tabct, strlen(a_line+tabct)); } else { header->level_detail[tabct].total_entries++; cur_nodes[tabct] = mlm_add_node(header, NULL, cur_code, cur_name); for (int lvl = tabct+1; lvl < header->levels; lvl++) { header->level_detail[lvl].cur_entry = NULL; cur_nodes[lvl] = NULL; } // printf("Successful level 0 node added. set header->level_detail[%d].cur_entry (addr %p) to %p\n", // tabct, &(header->level_detail[tabct].cur_entry), header->level_detail[tabct].cur_entry ); // mlt_cur_entries(header); } } else { // intermediate or leaf node if (!cur_nodes[tabct-1]) { printf("Error processing line %d: \"%s\"\n", linendx-1, a_line); printf("No enclosing level %d node\n", tabct-1); // printf("(A) tabct=%d\n", tabct); // mlt_cur_entries(header); // A free(header->level_detail[tabct].cur_entry); header->level_detail[tabct].cur_entry = NULL; } else { int ct = sscanf(a_line+tabct, "%4hx %m[^\n]", &cur_code, // &header->level_detail[tabct].cur_entry->code, &cur_name); // &header->level_detail[tabct].cur_entry->name); if (ct != 2) { printf("(%s) Error reading line %d: %s\n", __func__, linendx-1, a_line); } else { header->level_detail[tabct].total_entries++; // A if (tabct < header->levels-1) // if not a leaf // A header->level_detail[tabct].cur_entry->children = g_ptr_array_sized_new(20); // A g_ptr_array_add(header->level_detail[tabct-1].cur_entry->children, header->level_detail[tabct].cur_entry); cur_nodes[tabct] = mlm_add_node(header, cur_nodes[tabct-1], cur_code, cur_name); for (int lvl = tabct+1; lvl < header->levels; lvl++) { header->level_detail[lvl].cur_entry = NULL; cur_nodes[lvl] = NULL; } } } } // intermediate or leaf node } // while loop over lines if (debug) { for (int lvlndx=0; lvlndxlevels; lvlndx++) { printf("(%s) Table %s (tag %s): total level %d (%s) nodes: %d\n", __func__, header->table_name, header->segment_tag, lvlndx, header->level_detail[lvlndx].name, header->level_detail[lvlndx].total_entries); } } *curpos = linendx; return header; } /* Find the start of the next segment in a line array, * i.e. a non-comment line that begins with a different tag * * Arguments: * lines array of pointers to lines * cur_ndx current position in line array * segment_tag first token of lines in current segment * * Returns: line number of start of next segment */ int find_next_segment_start(GPtrArray* lines, int cur_ndx, char* segment_tag) { bool debug = false; if (debug) printf("(%s) Starting cur_ndx=%d, segment_tag=|%s|\n", __func__, cur_ndx, segment_tag); for(; cur_ndx < lines->len; cur_ndx++) { char * a_line = g_ptr_array_index(lines, cur_ndx); int tabct = 0; while (a_line[tabct] == '\t') tabct++; rtrim_in_place(a_line+tabct); if (strlen(a_line+tabct) == 0 || a_line[tabct] == '#') continue; // always skip comment and blank lines if (segment_tag) { // skipping the current segment if (tabct == 0) { char atag[40]; char* rest; int ct = sscanf(a_line, "%s %m[^\n]", atag, &rest); // printf("(%s) ct = %d\n", __func__, ct); // coverity scan gets unhappy if nothing sscanf's return code is not checked. // this does something trivial with it. assert(ct >= 0); if (!streq(atag,segment_tag)) { strcpy(segment_tag, atag); free(rest); break; } } } } return cur_ndx; } int load_device_ids(Device_Id_Type id_type, GPtrArray * all_lines) { bool debug = false; int total_vendors = 0; int total_devices = 0; int total_subsys = 0; MLM_Level usb_id_levels[] = { {"vendor", 5000, 0}, {"product", 20, 0}, {"interface", 10, 0} }; MLM_Level pci_id_levels[] = { {"vendor", 10000, 0}, {"device", 20, 0}, {"subsystem", 5, 0} }; #define MAX_LEVELS 5 Multi_Level_Map * mlm = NULL; int levelct = 3; if (id_type == ID_TYPE_PCI) { mlm = mlm_create("PCI Devices", 3, pci_id_levels); } else mlm = mlm_create("USB Devices", 3, usb_id_levels); MLM_Node * cur_node[MAX_LEVELS] = {NULL}; int linect = all_lines->len; int linendx; char * a_line; bool device_ids_done = false; // end of PCI id section seen? for (linendx=0; linendxlen) { //printf("(%s) Before find_next_segment_start(), linendx=%d: |%s|\n", // __func__, linendx, (char *) g_ptr_array_index(all_lines, linendx)); linendx = find_next_segment_start(all_lines, linendx, tagbuf); // printf("(%s) Next segment starts at line %d: |%s|\n", // __func__, linendx, (char *) g_ptr_array_index(all_lines, linendx)); if (linendx >= all_lines->len) break; if ( streq(tagbuf,"HID") ) { hid_descriptor_types = create_simple_id_table(0); load_simple_id_segment(hid_descriptor_types, all_lines, tagbuf, linendx, &linendx); // printf("(%s) After HID, linendx=%d\n", __func__, linendx); // rpt_title("hid_descriptor_types: ", 0); // report_simple_ids(hid_descriptor_types, 1); } else if ( streq(tagbuf,"R") ) { hid_descriptor_item_types = create_simple_id_table(0); load_simple_id_segment(hid_descriptor_item_types, all_lines, tagbuf, linendx, &linendx); // printf("(%s) After R, linendx=%d\n", __func__, linendx); // rpt_title("hid_descriptor_item_types: ", 0); // report_simple_ids(hid_descriptor_item_types, 1); } else if ( streq(tagbuf,"HCC") ) { hid_country_codes = create_simple_id_table(0); load_simple_id_segment(hid_country_codes, all_lines, tagbuf, linendx, &linendx); // printf("(%s) After HCC, linendx=%d\n", __func__, linendx); // rpt_title("hid_country_codes: ", 0); // report_simple_ids(hid_country_codes, 1); } else if ( streq(tagbuf,"HUT") ) { #ifdef OLD hid_usages_table = mlm_create( hid_usages_table0.table_name, hid_usages_table0.levels, hid_usages_table0.level_detail); #endif MLM_Level hut_level_desc[] = { {"usage page", 20, 0}, {"usage_id", 20, 0} }; hid_usages_table = mlm_create( "HUT", 2, hut_level_desc); load_multi_level_segment(hid_usages_table, tagbuf, all_lines, &linendx); // printf("(%s) After HUT, linendx=%d\n", __func__, linendx); // rpt_title("usages table: ", 0); // report_multi_level_table(hid_usages_table, 1); } } } } /* Locates a pci.ids or usb.ids file and loads its contents into internal tables. * * Arguments: * id_type * * Returns: nothing */ static void load_id_file(Device_Id_Type id_type){ bool debug = false; if (debug) printf("(%s) id_type=%d\n", __func__, id_type); // char * id_fn = simple_device_fn[id_type]; char * device_id_fqfn = devid_find_file(id_type); if (device_id_fqfn) { // char device_id_fqfn[MAX_PATH]; // snprintf(device_id_fqfn, MAX_PATH, id_fqfn, id_fn); // ??? if (debug) printf("(%s) device_id_fqfn = %s\n", __func__, device_id_fqfn); GPtrArray * all_lines = g_ptr_array_sized_new(30000); int linect = file_getlines(device_id_fqfn, all_lines, true); if (linect > 0) { load_file_lines(id_type, all_lines); } // if (all_lines) // to do: call g_ptr_array_set_free_func(all_lines, free); g_ptr_array_free(all_lines, true); free(device_id_fqfn); } // if pci.ids or usb.ids was found return; } // // Internal Report Functions // /* Reports a device id table. * * Arguments: * id_type * * Returns: nothing */ void report_device_ids_mlm(Device_Id_Type id_type) { Multi_Level_Map * all_devices = (id_type == ID_TYPE_PCI) ? pci_vendors_mlm : usb_vendors_mlm; GPtrArray * top_level_nodes = all_devices->root; int total_vendors = 0; int total_devices = 0; int total_subsys = 0; int vctr, dctr, sctr; MLM_Node * cur_vendor; MLM_Node * cur_device; MLM_Node * cur_subsys; for (vctr=0; vctr < top_level_nodes->len; vctr++) { total_vendors++; cur_vendor = g_ptr_array_index(top_level_nodes, vctr); printf("%04x %s\n", cur_vendor->code, cur_vendor->name); if (cur_vendor->children) { for (dctr=0; dctrchildren->len; dctr++) { total_devices++; cur_device = g_ptr_array_index(cur_vendor->children, dctr); printf("\t%04x %s\n", cur_device->code, cur_device->name); if (cur_device->children) { for (sctr=0; sctrchildren->len; sctr++) { total_subsys++; cur_subsys = g_ptr_array_index(cur_device->children, sctr); if (id_type == ID_TYPE_PCI) printf("\t\t%04x %04x %s\n", cur_subsys->code>>16, cur_subsys->code&0xffff, cur_subsys->name); else printf("\t\t%04x %s\n", cur_subsys->code, cur_subsys->name); } } } } } char * level3_name = (id_type == ID_TYPE_PCI) ? "subsystems" : "interfaces"; printf("(%s) Total vendors: %d, total devices: %d, total %s: %d\n", __func__, total_vendors, total_devices, level3_name, total_subsys); } // // *** Name Lookup *** // /** Gets the names associated with a PCI device. * * @param vendor_id * @param device_id * @param subvendor_id * @param subdevice_id * @param argct if 1, vendor_id is set * if 2, vendor_id and device_id are set * if 4, vendor_id, device_id, subvendor_id, and subdevice_id are set * * @return names for the ids * * @remark * Unfortunately, both 0000 and ffff are used as ids, so these can't use them as special * arguments to indicate "not set". Hence the argct parm. */ Pci_Usb_Id_Names devid_get_pci_names( ushort vendor_id, ushort device_id, ushort subvendor_id, ushort subdevice_id, int argct) { bool debug = false; if (debug) { printf("(%s) vendor_id = %02x, device_id=%02x, subvendor_id=%02x, subdevice_id=%02x\n", __func__, vendor_id, device_id, subvendor_id, subdevice_id); } assert( argct==1 || argct==2 || argct==4); devid_ensure_initialized(); uint ids[3] = {vendor_id, device_id, subvendor_id << 16 | subdevice_id}; // only diff from usb_id_get_names int levelct = (argct == 4) ? 3 : argct; // also this Multi_Level_Names mlm_names = mlm_get_names2(pci_vendors_mlm, levelct, ids); // and this Pci_Usb_Id_Names names2; names2.vendor_name = mlm_names.names[0]; names2.device_name = mlm_names.names[1]; names2.subsys_or_interface_name = mlm_names.names[2]; if (levelct == 3 && mlm_names.levels == 2) { // couldn't find the subsystem, see if at least we can look up the subsystem vendor uint ids[1] = {subvendor_id}; Multi_Level_Names mlm_names3 = mlm_get_names2(pci_vendors_mlm, 1, ids); if (mlm_names3.levels == 1) { names2.subsys_or_interface_name = mlm_names3.names[0]; } } if (debug) { printf("(%s) names2: vendor_name=%s, device_name=%s, subsys_or_interface_name=%s\n", __func__, names2.vendor_name, names2.device_name, names2.subsys_or_interface_name); } return names2; } /** Gets the names associated with a USB device. * * @param vendor_id * @param device_id * @param interface_id * @param argct if 1, vendor_id is set * if 2, vendor_id and device_id are set * if 4, vendor_id, device_id, and interface_id are set * * @return names for the ids */ Pci_Usb_Id_Names devid_get_usb_names( ushort vendor_id, ushort device_id, ushort interface_id, int argct) { bool debug = false; if (debug) { printf("(%s) vendor_id = %02x, device_id=%02x, interface_id=%02x\n", __func__, vendor_id, device_id, interface_id); } assert( argct==1 || argct==2 || argct==3); devid_ensure_initialized(); uint ids[3] = {vendor_id, device_id, interface_id}; Multi_Level_Names mlm_names = mlm_get_names2(usb_vendors_mlm, argct, ids); Pci_Usb_Id_Names names2; names2.vendor_name = mlm_names.names[0]; names2.device_name = mlm_names.names[1]; names2.subsys_or_interface_name = mlm_names.names[2]; if (debug) { printf("(%s) names2: vendor_name=%s, device_name=%s, subsys_or_interface_name=%s\n", __func__, names2.vendor_name, names2.device_name, names2.subsys_or_interface_name); } return names2; } /** Gets the page name for a USB usage page code * * @param usage_page_code * * @return page name, NULL if invalid code * * @remark * - Is top level field in HUT entry of usb.ids * - Corresponds to names_huts() in names.c */ char * devid_usage_code_page_name(ushort usage_page_code) { devid_ensure_initialized(); // Per USB HID Usage Tables spec v1.12, section 3.0, // Usage page ID xff00..xffff are vendor defined // x0092..xfeff are reserved // We regard any value < xff00 for which lookup fails as reserved. // This allows for additional usage pages beyond x0092 to be specified // in the usb.ids file. However, usb.ids includes the line: // HUT ff Vendor specific // This is incorrect. It is treating use page code as 1 byte instead of 2. // xff is in the reserved range. It is not a vendor defined page. char * result = "Reserved"; if (usage_page_code > 0xff00) result = "Vendor-defined"; else { // ushort * args = {usage_page_code}; Multi_Level_Names names_found = mlm_get_names(hid_usages_table, /*argct=*/ 1, usage_page_code); if (names_found.levels == 1) result = names_found.names[0]; } return result; } /** Gets the name of a HID usage code * * @param usage_page_code usage page * @param usage_simple_id id within page * * @return usage id name, NULL if not found * * @remark * - First and second fields of HUT entry in usb.ids * - Corresponds to names_hutus() in names.c */ char * devid_usage_code_id_name(ushort usage_page_code, ushort usage_simple_id) { static char resultbuf[12] = {0}; bool debug = false; if (debug) { printf("(%s) usage_page_code=0x%04x, usage_simple_id=0x%04x\n", __func__, usage_page_code, usage_simple_id); } devid_ensure_initialized(); char * result = NULL; if (usage_page_code == 0x81) { snprintf(resultbuf, 10, "ENUM_%d", usage_simple_id); result = resultbuf; } else { // ushort * args = {usage_page_code, usage_simple_id}; Multi_Level_Names names_found = mlm_get_names(hid_usages_table, 2, usage_page_code, usage_simple_id); if (names_found.levels == 2) result = names_found.names[1]; } return result; } /** Gets the name of a HID usage code, specified as a single value containing * the page id in the upper 16 bits and the simple id it in the lower 16 bits. * * @param extended_usage usage value * * @return usage id name, NULL if not found */ char * devid_usage_code_name_by_extended_id(uint32_t extended_usage) { return devid_usage_code_id_name( extended_usage >> 16, extended_usage & 0xffff ); } /** Returns the name of USB HID descriptor item tag. * * @param id item tag id * * @return name of item tag, NULL if not found * * @remark * - HID documentation refers to this as item tag. * usb.ids file refers to this as item type * - The value is actually 1 byte. * - This function corresponds to names.c function names_reporttag() */ char * devid_hid_descriptor_item_type(ushort id) { devid_ensure_initialized(); char * result = NULL; result = get_simple_id_name(hid_descriptor_item_types, id); return result; } // // *** Initialization *** // /** Initializes the PCI and USB id tables. * If the tables are already initialized, does nothing. */ bool devid_ensure_initialized() { bool debug = false; if (debug) printf("(%s) Starting\n", __func__); bool ok = (pci_vendors_mlm && usb_vendors_mlm); if (!ok) { load_id_file(ID_TYPE_PCI); load_id_file(ID_TYPE_USB); ok = true; if (ok && debug) { // report_device_ids(ID_TYPE_PCI); // report_device_ids_mlm(ID_TYPE_PCI); // report_device_ids(ID_TYPE_USB); // report_device_ids_mlm(ID_TYPE_USB); } } if (debug) printf("(%s) Returning: %s\n", __func__, bool_repr(ok)); return ok; } ddcutil-0.8.6/src/util/edid.c0000644000175000001440000004137113203271475012721 00000000000000/* edid.c * * Functions for processing the EDID data structure, irrespective of how * the bytes of the EDID are obtained. * * This should be the only source module that understands the internal * structure of the EDID. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file edid.c * Functions to interpret EDID. * While the code here is generic to all EDIDs, only fields of use * to **ddcutil** are interpreted. */ /** \cond */ #include #include #include /** \endcond */ #include "report_util.h" #include "string_util.h" #include "edid.h" // Direct writes to stdout/stderr: NO #ifdef UNUSED static inline bool all_bytes_zero(Byte * bytes, int len) { for (int ndx = 0; ndx < len; ndx++) { if (bytes[ndx]) return false; } return true; } #endif /** Calculates checksum for a 128 byte EDID * * @param edid pointer to 128 byte EDID block * @return checksum byte * * Note that the checksum byte (offset 127) is itself * included in the checksum calculation. */ Byte edid_checksum(Byte * edid) { Byte checksum = 0; for (int ndx = 0; ndx < 128; ndx++) { checksum += edid[ndx]; } return checksum; } /** Unpacks the 2 byte manufacturer id field from the EDID into a 3 character * string. * * @param mfg_id_bytes address of first byte * @param result address of buffer in which to return result * @param bufsize buffer size; must be >= 4 * * @remark * Since the unpacked value is 4 bytes in length (3 characters plus a trailing '\0') * it could easily be returned on the stack. Consider. */ void parse_mfg_id_in_buffer(Byte * mfg_id_bytes, char * result, int bufsize) { assert(bufsize >= 4); result[0] = (mfg_id_bytes[0] >> 2) & 0x1f; result[1] = ((mfg_id_bytes[0] & 0x03) << 3) | ((mfg_id_bytes[1] >> 5) & 0x07); result[2] = mfg_id_bytes[1] & 0x1f; // printf("result[0] = 0x%02x\n", result[0]); // printf("result[1] = 0x%02x\n", result[1]); // printf("result[2] = 0x%02x\n", result[2]); result[0] += 64; result[1] += 64; result[2] += 64; result[3] = 0; // terminating null } /** Extracts the 3 character manufacturer id from an EDID byte array. * The id is returned with a trailing null in a buffer provided by the caller. * * @param edidbytes pointer to start of EDID * @param result buffer in which to return manufacturer ID * @param bufsize buffer size (must be >= 4) */ void get_edid_mfg_id_in_buffer(Byte* edidbytes, char * result, int bufsize) { // parse_mfg_id_in_buffer(&edidbytes[8], result, bufsize); parse_mfg_id_in_buffer(edidbytes+8, result, bufsize); } #define EDID_DESCRIPTORS_BLOCKS_START 54 #define EDID_DESCRIPTOR_BLOCK_SIZE 18 #define EDID_DESCRIPTOR_DATA_SIZE 13 #define EDID_DESCRIPTOR_BLOCK_CT 4 /** Extracts the non-timing descriptors from an EDID, i.e. * ASCII model name, serial number, and other descriptor. * The extracted values are returned as null-terminated strings. * * Note that the maximum length of these strings is 13 bytes. * * @param edidbytes pointer to 128 byte EDID * @param namebuf pointer to buffer where model name will be returned. * @param namebuf_len size of namebuf, must be >= 14 * @param snbuf pointer to buffer where serial number will be returned * @param snbuf_len size of snbuf, must be >= 14 * @param otherbuf pointer to buffer where addl descriptor will be returned * @param otherbuf_len size of otherbuf, must be >= 14 * * Buffers will be set to "Unspecified" for descriptors that are not found. * * @remark * - Use Buffers as parms instead of pointers and lengths? * - Buffer for edidbytes, and just return pointers to newly allocated memory for found strings */ static void get_edid_descriptor_strings( Byte* edidbytes, char* namebuf, int namebuf_len, char* snbuf, int snbuf_len, char* otherbuf, int otherbuf_len) { bool debug = false; assert(namebuf_len >= 14 && snbuf_len >= 14 && otherbuf_len >= 14); strcpy(namebuf, "Unspecified"); strcpy(snbuf, "Unspecified"); strcpy(otherbuf, "Unspecified"); int fields_found = 0; // 4 descriptor blocks beginning at offset 54. Each block is 18 bytes. // In each block, bytes 0-3 indicates the contents. int descriptor_ndx = 0; for (descriptor_ndx = 0; descriptor_ndx < EDID_DESCRIPTOR_BLOCK_CT; descriptor_ndx++) { Byte * descriptor = edidbytes + EDID_DESCRIPTORS_BLOCKS_START + descriptor_ndx * EDID_DESCRIPTOR_BLOCK_SIZE; if (debug) printf("(%s) full descriptor: %s\n", __func__, hexstring(descriptor, EDID_DESCRIPTOR_BLOCK_SIZE)); // test if a string descriptor if ( descriptor[0] == 0x00 && // 0x00 if not a timing descriptor descriptor[1] == 0x00 && // 0x00 if not a timing descriptor descriptor[2] == 0x00 && // 0x00 for all descriptors descriptor[4] == 0x00 ) { char * nameslot = NULL; switch(descriptor[3]) { case 0xff: nameslot = snbuf; break; // monitor serial number case 0xfe: nameslot = otherbuf; break; // arbitrary ASCII string case 0xfc: nameslot = namebuf; break; // monitor name } if (nameslot) { Byte * textstart = descriptor+5; // DBGMSF(debug, "String in descriptor: %s", hexstring(textstart, 14)); int offset = 0; while (*(textstart+offset) != 0x0a && offset < 13) { // DBGMSG("textlen=%d, char=0x%02x", textlen, *(textstart+textlen)); nameslot[offset] = *(textstart+offset); offset++; } // memcpy(nameslot, textstart, offset); nameslot[offset] = '\0'; if (debug) printf("(%s) name = %s\n", __func__, nameslot); fields_found++; } } } } /** Parses an EDID. * * @param edidbytes pointer to 128 byte EDID block * * @return pointer to newly allocated Parsed_Edid struct, * or NULL if the bytes could not be parsed. * It is the responsibility of the caller to free this memory. */ Parsed_Edid * create_parsed_edid(Byte* edidbytes) { assert(edidbytes); bool debug = false; bool ok = true; Parsed_Edid* parsed_edid = NULL; const Byte edid_header_tag[] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}; if (memcmp(edidbytes, edid_header_tag, 8) != 0) { char * hs = hexstring(edidbytes,8); if (debug) printf("(%s) Invalid initial EDID bytes: %s\n", __func__, hs); free(hs); goto bye; } if (edid_checksum(edidbytes) != 0x00) { if (debug) printf("(%s) Invalid EDID checksum: 0x%02x\n", __func__, edid_checksum(edidbytes)); goto bye; } parsed_edid = calloc(1,sizeof(Parsed_Edid)); assert(sizeof(parsed_edid->bytes) == 128); memcpy(parsed_edid->marker, EDID_MARKER_NAME, 4); memcpy(parsed_edid->bytes, edidbytes, 128); get_edid_mfg_id_in_buffer( edidbytes, parsed_edid->mfg_id, sizeof(parsed_edid->mfg_id) ); parsed_edid->model_hex = edidbytes[0x0b] << 8 | edidbytes[0x0a]; parsed_edid->serial_binary = edidbytes[0x0c] | edidbytes[0x0d] << 8 | edidbytes[0x0e] << 16 | edidbytes[0x0f] << 24; get_edid_descriptor_strings( edidbytes, parsed_edid->model_name, sizeof(parsed_edid->model_name), parsed_edid->serial_ascii, sizeof(parsed_edid->serial_ascii), parsed_edid->extra_descriptor_string, sizeof(parsed_edid->extra_descriptor_string) ); parsed_edid->year = edidbytes[17] + 1990; parsed_edid->is_model_year = edidbytes[16] == 0xff; parsed_edid->edid_version_major = edidbytes[18]; #ifdef UNNEEDED if (parsed_edid->edid_version_major != 1 && parsed_edid->edid_version_major != 2) { DBGMSF(debug, "Invalid EDID major version number: %d", parsed_edid->edid_version_major); ok = false; } #endif parsed_edid->edid_version_minor = edidbytes[19]; parsed_edid->rx = edidbytes[0x1b] << 2 | ( (edidbytes[0x19]&0b11000000)>>6 ); parsed_edid->ry = edidbytes[0x1c] << 2 | ( (edidbytes[0x19]&0b00110000)>>4 ); parsed_edid->gx = edidbytes[0x1d] << 2 | ( (edidbytes[0x19]&0b00001100)>>2 ); parsed_edid->gy = edidbytes[0x1e] << 2 | ( (edidbytes[0x19]&0b00000011)>>0 ); parsed_edid->bx = edidbytes[0x1f] << 2 | ( (edidbytes[0x1a]&0b11000000)>>6 ); parsed_edid->by = edidbytes[0x20] << 2 | ( (edidbytes[0x1a]&0b00110000)>>4 ); parsed_edid->wx = edidbytes[0x21] << 2 | ( (edidbytes[0x1a]&0b00001100)>>2 ); // parsed_edid->wy = edidbytes[0x22] << 2 | ( (edidbytes[0x1a]&0b00000011)>>0 ); // low order digits wrong, try another way parsed_edid->wy = edidbytes[0x22] * 4 + ((edidbytes[0x1a]&0b00000011)>>0); parsed_edid->video_input_definition = edidbytes[0x14]; // printf("(%s) video_input_parms_bitmap = 0x%02x\n", __func__, video_input_parms_bitmap); // parsed_edid->is_digital_input = (parsed_edid->video_input_definition & 0x80) ? true : false; parsed_edid->supported_features = edidbytes[0x18]; parsed_edid->extension_flag = edidbytes[0x7e]; if (!ok) { free(parsed_edid); parsed_edid = NULL; } bye: return parsed_edid; } /** Frees a Parsed_Edid struct. * * @param parsed_edid pointer to Parsed_Edid struct to free */ void free_parsed_edid(Parsed_Edid * parsed_edid) { assert( parsed_edid ); assert( memcmp(parsed_edid->marker, EDID_MARKER_NAME, 4)==0 ); parsed_edid->marker[3] = 'x'; // n. Parsed_Edid contains no pointers free(parsed_edid); } /** Writes EDID summary to the current report output destination. * (normally stdout, but may be changed by rpt_push_output_dest()) * * @param edid pointer to parsed edid struct * @param verbose show additional detail * @param show_raw include hex dump of EDID * @param depth logical indentation depth * * @remark * Output is written using rpt_ functions. */ void report_parsed_edid_base(Parsed_Edid * edid, bool verbose, bool show_raw, int depth) { bool debug = false; if (debug) printf("(%s) Starting. edid=%p", __func__, edid); int d1 = depth+1; int d2 = depth+2; // verbose = true; if (edid) { rpt_vstring(depth,"EDID synopsis:"); rpt_vstring(d1,"Mfg id: %s", edid->mfg_id); rpt_vstring(d1,"Model: %s", edid->model_name); rpt_vstring(d1,"Serial number: %s", edid->serial_ascii); char * title = (edid->is_model_year) ? "Model year" : "Manufacture year"; rpt_vstring(d1,"%-16s: %d", title, edid->year); rpt_vstring(d1,"EDID version: %d.%d", edid->edid_version_major, edid->edid_version_minor); if (verbose) { rpt_vstring(d1,"Product code: 0x%04x (%u)", edid->model_hex, edid->model_hex); // useless, binary serial number is typically 0x00000000 or 0x01010101 // rpt_vstring(d1,"Binary sn: %u (0x%08x)", edid->serial_binary, edid->serial_binary); rpt_vstring(d1,"Extra descriptor: %s", edid->extra_descriptor_string); char explbuf[100]; explbuf[0] = '\0'; if (edid->video_input_definition & 0x80) { strcpy(explbuf, "Digital Input"); if (edid->edid_version_major == 1 && edid->edid_version_minor >= 4) { switch (edid->video_input_definition & 0x0f) { case 0x00: strcat(explbuf, " (Digital interface not defined)"); break; case 0x01: strcat(explbuf, " (DVI)"); break; case 0x02: strcat(explbuf, " (HDMI-a)"); break; case 0x03: strcat(explbuf, " (HDMI-b"); break; case 0x04: strcat(explbuf, " (MDDI)"); break; case 0x05: strcat(explbuf, " (DisplayPort)"); break; default: strcat(explbuf, " (Invalid DVI standard)"); } } } else { strcpy(explbuf, "Analog Input"); } rpt_vstring(d1,"Video input definition: 0x%02x - %s", edid->video_input_definition, explbuf); // rpt_vstring(d1,"Video input: %s", (edid->is_digital_input) ? "Digital" : "Analog"); // end, video_input_definition interpretation rpt_vstring(d1, "Supported features:"); if (edid->supported_features & 0x80) rpt_vstring(d2, "DPMS standby"); if (edid->supported_features & 0x40) rpt_vstring(d2, "DPMS suspend"); if (edid->supported_features & 0x20) rpt_vstring(d2, "DPMS active-off"); Byte display_type = (edid->supported_features & 0x14) >> 3; // bits 4-3 if (edid->video_input_definition & 0x80) { // digital input switch(display_type) { case 0: rpt_vstring(d2, "Digital display type: RGB 4:4:4"); break; case 1: rpt_vstring(d2, "Digital display type: RGB 4:4:4 + YCrCb 4:4:4"); break; case 2: rpt_vstring(d2, "Digital display type: RGB 4:4:4 + YCrCb 4:2:2"); break; case 3: rpt_vstring(d2, "Digital display type: RGB 4:4:4 + YCrCb 4:4:4 + YCrCb 4:2:2"); break; default: // should be PROGRAM_LOGIC_ERROR, but that would violdate layering rpt_vstring(d2, "Invalid digital display type: 0x02", display_type); } } else { // analog input switch(display_type) { case 0: rpt_vstring(d2, "Analog display type: Monochrome or grayscale"); break; case 1: rpt_vstring(d2, "Analog display type: Color"); break; case 2: rpt_vstring(d2, "Analog display type: Non-RGB color"); break; case 3: rpt_vstring(d2, "Undefined analog display type"); break; default: // should be PROGRAM_LOGIC_ERROR, but that would violdate layering rpt_vstring(d2, "Invalid analog display type: 0x02", display_type); } } rpt_vstring(d2, "Standard sRGB color space: %s", (display_type & 0x02) ? "True" : "False"); // end supported_features interpretation rpt_vstring(d1,"White x,y: %.3f, %.3f", edid->wx/1024.0, edid->wy/1024.0); rpt_vstring(d1,"Red x,y: %.3f, %.3f", edid->rx/1024.0, edid->ry/1024.0); rpt_vstring(d1,"Green x,y: %.3f, %.3f", edid->gx/1024.0, edid->gy/1024.0); rpt_vstring(d1,"Blue x,y: %.3f, %.3f", edid->bx/1024.0, edid->by/1024.0); // restrict to EDID version >= 1.3? rpt_vstring(d1,"Extension blocks: %u", edid->extension_flag); // if (strlen(edid->edid_source) > 0) rpt_vstring(depth,"EDID source: %s", edid->edid_source); } if (show_raw) { rpt_vstring(depth,"EDID hex dump:"); rpt_hex_dump(edid->bytes, 128, d1); } } else { if (verbose) rpt_vstring(d1,"No EDID"); } if (debug) printf("(%s) Done.", __func__); } /** Writes a summary of an EDID to the current report output destination. * (normally stdout, but may be changed by rpt_push_output_dest()) * * @param edid pointer to parsed edid struct * @param verbose include hex dump of EDID * @param depth logical indentation depth */ void report_parsed_edid(Parsed_Edid * edid, bool verbose, int depth) { report_parsed_edid_base(edid, verbose, verbose, depth); } ddcutil-0.8.6/src/util/error_info.c0000644000175000001440000004003613215206353014151 00000000000000/* ddc_error.c * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Struct for reporting errors. * * #Error_Info provides a pseudo-exception framework that can be integrated * with more traditional status codes. Instead of returning a status code, * a C function returns a pointer to an #Error_Info instance in the case of * an error, or NULL if there is no error. Information about the cause of an * error is retained for use by higher levels in the call stack. */ /** \cond */ // #define _GNU_SOURCE // for reallocarray() in stdlib.h #include #include #include #include /** \endcond */ #include "debug_util.h" #include "glib_util.h" #include "report_util.h" #include "string_util.h" #include "error_info.h" // Validates a pointer to an #Error_Info, using asserts #define VALID_DDC_ERROR_PTR(ptr) \ assert(ptr); \ assert(memcmp(ptr->marker, ERROR_INFO_MARKER, 4) == 0); // Forward references static char * default_status_code_desc(int rc); // Constants // allows cause list to always be null terminated, even when no causes: static Error_Info * empty_list[] = {NULL}; static const int CAUSE_ALLOC_INCREMENT = 10; // Globals // status code to string functions: static ErrInfo_Status_String errinfo_desc_func = default_status_code_desc; static ErrInfo_Status_String errinfo_name_func = NULL; // // Initialization // /** Initializes the module. * * \param name_func function returning the name of a status code * \param desc_func function returning a description of a status code */ void errinfo_init( ErrInfo_Status_String name_func, ErrInfo_Status_String desc_func) { errinfo_name_func = name_func; errinfo_desc_func = desc_func; } // // Instance destruction // /** Releases a #Error_Info instance, including all instances it points to. * * \param erec pointer to #Error_Info instance, * do nothing if NULL */ void errinfo_free(Error_Info * erec){ bool debug = false; if (debug) { printf("(%s) Starting. erec=%p\n", __func__, erec); show_backtrace(2); } if (erec) { VALID_DDC_ERROR_PTR(erec); if (debug) { printf("(%s) Freeing exception: \n", __func__); errinfo_report(erec, 2); } if (erec->cause_ct > 0) { for (int ndx = 0; ndx < erec->cause_ct; ndx++) { errinfo_free(erec->causes[ndx]); } free(erec->causes); } #ifdef ALT if (erec->causes_alt) { for (int ndx = 0; ndx < erec->causes_alt->len; ndx++) { errinfo_free( g_ptr_array_index(erec->causes_alt, ndx) ); } } #endif free(erec->func); erec->marker[3] = 'x'; free(erec); } } /** Releases a #Error_Info instance, including all instances it points to. * Optionally reports the instance before freeing it. * * \param erec pointer to #Error_Info instance, * do nothing if NULL * \param report if true, report the intsance * \param func name of calling function */ void errinfo_free_with_report(Error_Info * erec, bool report, const char * func) { if (report) { rpt_vstring(0, "(%s) Freeing exception:", func); errinfo_report(erec, 1); } errinfo_free(erec); } #ifdef ALT // signature satisfying GDestroyNotify() static void ddc_error_free2(void * erec) { Error_Info* erec2 = (Error_Info *) erec; VALID_DDC_ERROR_PTR(erec2); errinfo_free(erec2); } #endif // // Instance creation // /** Sets the status code in a existing #Error_Info instance. * * \param erec pointer to instance * \param code status code */ void errinfo_set_status(Error_Info * erec, int code) { VALID_DDC_ERROR_PTR(erec); erec->status_code = code; } /** Adds a cause to an existing #Error_Info instance * * \param parent instance to which cause will be added * \param cause instance to add */ void errinfo_add_cause(Error_Info * parent, Error_Info * cause) { VALID_DDC_ERROR_PTR(parent); VALID_DDC_ERROR_PTR(cause); // printf("(%s) parent->cause_ct = %d, parent->max_causes = %d\n", // __func__, parent->cause_ct, parent->max_causes); if (parent->cause_ct == parent->max_causes) { int new_max = parent->max_causes + CAUSE_ALLOC_INCREMENT; #ifdef ALT Error_Info ** new_causes = calloc(new_max+1, sizeof(Error_Info *) ); memcpy(new_causes, parent->causes, parent->cause_ct * sizeof(Error_Info *) ); free(parent->causes); parent->causes = new_causes; #endif if (parent->causes == empty_list) { // printf("(%s) empty_list\n", __func__); parent->causes = calloc(new_max+1, sizeof(Error_Info *) ); } else { // printf("(%s) realloc\n", __func__); // works, but requires _GNU_SOURCE feature test macro: // parent->causes = reallocarray(parent->causes, new_max+1, sizeof(Error_Info*) ); void * new_causes = calloc(new_max+1, sizeof(Error_Info*) ); memcpy(new_causes, parent->causes, parent->max_causes * sizeof(Error_Info *) ); free(parent->causes); parent->causes = new_causes; } parent->max_causes = new_max; } // printf("(%s) parent->causes = %p\n", __func__, parent->causes); // printf("(%s) cause_ct=%d\n", __func__, parent->cause_ct); // printf("(%s) %p", __func__, &parent->causes[parent->cause_ct]); parent->causes[parent->cause_ct++] = cause; #ifdef ALT if (!parent->causes_alt) { parent->causes_alt = g_ptr_array_new_with_free_func(ddc_error_free2); // parent->causes_alt = g_ptr_array_new(); // *** TRANSITIONAL *** } g_ptr_array_add(parent->causes_alt, cause); #endif } /** Creates a new #Error_Info instance with the specified status code * and function name. * * \param code status code * \param func name of function generating status code * \return pointer to new instance */ Error_Info * errinfo_new(int code, const char * func) { Error_Info * erec = calloc(1, sizeof(Error_Info)); memcpy(erec->marker, ERROR_INFO_MARKER, 4); erec->status_code = code; erec->causes = empty_list; // printf("(%s) erec->causes = %p\n", __func__, erec->causes); // printf("(%s) erec->causes[0] = %p\n", __func__, erec->causes[0]); erec->func = strdup(func); // strdup to avoid constness warning, must free return erec; } /** Creates a new #Error_Info instance, including a reference to another * instance that is the cause of the current error. * * \param code status code * \param cause pointer to another #Error_Info that is included as a cause * \param func name of function creating new instance * \return pointer to new instance */ Error_Info * errinfo_new_with_cause( int code, Error_Info * cause, const char * func) { VALID_DDC_ERROR_PTR(cause); Error_Info * erec = errinfo_new(code, func); errinfo_add_cause(erec, cause); return erec; } /** Creates a new #Error_Info instance, including a reference to another * instance that is the cause of the current error. The status code * of the new instance is the same as that of the referenced instance. * * \param cause pointer to another #Error_Info that is included as a cause * \param func name of function creating new instance * \return pointer to new instance */ Error_Info * errinfo_new_chained( Error_Info * cause, const char * func) { VALID_DDC_ERROR_PTR(cause); Error_Info * erec = errinfo_new_with_cause(cause->status_code, cause, func); return erec; } /** Creates a new #Error_Info instance with a collection of * instances specified as the causes. * * \param code status code of the new instance * \param causes array of #Error_Info instances * \param cause_ct number of causes * \param func name of function creating the new #Error_Info * \return pointer to new instance */ Error_Info * errinfo_new_with_causes( int code, Error_Info ** causes, int cause_ct, const char * func) { Error_Info * result = errinfo_new(code, func); for (int ndx = 0; ndx < cause_ct; ndx++) { errinfo_add_cause(result, causes[ndx]); } return result; } #ifdef UNUSED // For creating a new Ddc_Error when the called functions // return status codes not Ddc_Errors. /** Creates a new #Error_Info instance, including references to multiple * status codes from called functions that contribute to the current error. * Each of the callee status codes is wrapped in a synthesized #Error_Info * instance that is included as a cause. * * \param status_code * \param callee_status_codes array of status codes * \param callee_status_code_ct number of status codes in **callee_status_codes** * \param callee_func name of function that returned **callee** status codes * \param func name of function generating new #Error_Info * \return pointer to new instance */ Error_Info * errinfo_new_with_callee_status_codes( int status_code, int * callee_status_codes, int callee_status_code_ct, const char * callee_func, const char * func) { Error_Info * result = errinfo_new(status_code, func); for (int ndx = 0; ndx < callee_status_code_ct; ndx++) { Error_Info * cause = errinfo_new(callee_status_codes[ndx],callee_func); errinfo_add_cause(result, cause); } return result; } #endif // // Reporting // /** Status code description function to be used if none is set * by #errinfo_init() * * \param code status code * \return description of status code * * The value returned is valid until the next call to this function * in the current thread. */ static char * default_status_code_desc(int rc) { static GPrivate status_code_key = G_PRIVATE_INIT(g_free); const int default_status_code_buffer_size = 20; char * buf = get_thread_fixed_buffer(&status_code_key, default_status_code_buffer_size); g_snprintf(buf, default_status_code_buffer_size, "%d",rc); return buf; } /** Returns a comma separated string of the status code names in the * causes of the specified #Error_Info. * Multiple consecutive identical names are replaced with a * single name and a parenthesized instance count. * * \param erec pointer to #Error_Info instance * \return comma separated string, caller is responsible for freeing */ char * errinfo_causes_string(Error_Info * erec) { // bool debug = false; // DBGMSF(debug, "history=%p, history->ct=%d", history, history->ct); GString * gs = g_string_new(NULL); if (erec) { assert(memcmp(erec->marker, ERROR_INFO_MARKER, 4) == 0); bool first = true; int ndx = 0; while (ndx < erec->cause_ct) { int this_psc = erec->causes[ndx]->status_code; int cur_ct = 1; for (int i = ndx+1; i < erec->cause_ct; i++) { if (erec->causes[i]->status_code != this_psc) break; cur_ct++; } if (first) first = false; else g_string_append(gs, ", "); if (errinfo_name_func) g_string_append(gs, errinfo_name_func(this_psc)); else { char buf[20]; snprintf(buf, 20, "%d",this_psc); buf[19] = '\0'; g_string_append(gs, buf); } if (cur_ct > 1) g_string_append_printf(gs, "(%d)", cur_ct); ndx += cur_ct; } } char * result = gs->str; g_string_free(gs, false); // DBGMSF(debug, "Done. Returning: |%s|", result); return result; } #ifdef ALT char * errinfo_causes_string_alt(Error_Info * erec) { // bool debug = false; // DBGMSF(debug, "history=%p, history->ct=%d", history, history->ct); GString * gs = g_string_new(NULL); if (erec) { assert(memcmp(erec->marker, ERROR_INFO_MARKER, 4) == 0); if (erec->causes_alt) { bool first = true; int ndx = 0; int cause_ct = erec->causes_alt->len; while (ndx < cause_ct) { Error_Info * this_cause = g_ptr_array_index( erec->causes_alt, ndx); int this_psc = this_cause->status_code; int cur_ct = 1; for (int i = ndx+1; i < cause_ct; i++) { Error_Info * next_cause = g_ptr_array_index( erec->causes_alt, i); if (next_cause->status_code != this_psc) break; cur_ct++; } if (first) first = false; else g_string_append(gs, ", "); if (errinfo_name_func) g_string_append(gs, errinfo_name_func(this_psc)); else { char buf[20]; snprintf(buf, 20, "%d",this_psc); buf[19] = '\0'; g_string_append(gs, buf); } if (cur_ct > 1) g_string_append_printf(gs, "(x%d)", cur_ct); ndx += cur_ct; } } } char * result = gs->str; g_string_free(gs, false); // DBGMSF(debug, "Done. Returning: |%s|", result); return result; } #endif /** Emits a full report of the contents of the specified #Error_Info, * using report functions. * * \param erec pointer to #Error_Info * \param depth logical indentation depth */ void errinfo_report(Error_Info * erec, int depth) { int d1 = depth+1; // rpt_vstring(depth, "Status code: %s", psc_desc(erec->psc)); // rpt_vstring(depth, "Location: %s", (erec->func) ? erec->func : "not set"); rpt_vstring(depth, "Exception in function %s: status=%s", (erec->func) ? erec->func : "not set", errinfo_desc_func(erec->status_code) ); if (erec->cause_ct > 0) { rpt_vstring(depth, "Caused by: "); for (int ndx = 0; ndx < erec->cause_ct; ndx++) { errinfo_report(erec->causes[ndx], d1); } } #ifdef ALT if (erec->causes_alt && erec->causes_alt->len > 0) { rpt_vstring(depth, "Caused by: "); for (int ndx = 0; ndx < erec->causes_alt->len; ndx++) { errinfo_report( g_ptr_array_index(erec->causes_alt,ndx), d1); } } #endif } /** Returns a string summary of the specified #Error_Info. * The returned value is valid until the next call to this function in the * current thread, and should not be freed by the caller. * * \param erec pointer to #Error_Info instance * \return string summary of error */ char * errinfo_summary(Error_Info * erec) { if (!erec) return "NULL"; VALID_DDC_ERROR_PTR(erec); static GPrivate esumm_key = G_PRIVATE_INIT(g_free); static GPrivate esumm_len_key = G_PRIVATE_INIT(g_free); char * desc = errinfo_desc_func(erec->status_code); // thread safe buffer owned by psc_desc(), do not free() gchar * buf1 = NULL; if (erec->cause_ct == 0) { #ifdef ALT if (erec->causes_alt || erec->causes_alt->len == 0) { #endif buf1 = gaux_asprintf("Ddc_Error[%s in %s]", desc, erec->func); } else { char * causes = errinfo_causes_string(erec); buf1 = gaux_asprintf("Ddc_Error[%s in %s, causes: %s]", desc, erec->func, causes); free(causes); } int required_size = strlen(buf1) + 1; char * buf = get_thread_dynamic_buffer(&esumm_key, &esumm_len_key, required_size); g_strlcpy(buf, buf1, required_size); free(buf1); return buf; } ddcutil-0.8.6/src/util/file_util.c0000644000175000001440000002000213214610176013751 00000000000000/* file_util.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "string_util.h" #include "file_util.h" /** @file file_util.c * File utility functions */ /** Reads the lines of a text file into a GPtrArray. * * @param fn file name * @param line_array pointer to GPtrArray of strings where lines will be saved * @param verbose if true, write message to stderr if unable to open file or other error * * @retval >=0: number of lines added to line_array * @retval <0 -errno * * The caller is responsible for freeing the lines added to line_array. */ int file_getlines(const char * fn, GPtrArray* line_array, bool verbose) { bool debug = false; if (debug) printf("(%s) Starting. fn=%s \n", __func__, fn ); int rc = 0; FILE * fp = fopen(fn, "r"); if (!fp) { int errsv = errno; rc = -errno; if (verbose) fprintf(stderr, "Error opening file %s: %s\n", fn, strerror(errsv)); } else { // if line == NULL && len == 0, then getline allocates buffer for line char * line = NULL; size_t len = 0; ssize_t read; int linectr = 0; errno = 0; while ((read = getline(&line, &len, fp)) != -1) { linectr++; rtrim_in_place(line); // strip trailing newline g_ptr_array_add(line_array, line); // printf("(%s) Retrieved line of length %zu: %s\n", __func__, read, line); line = NULL; // reset for next getline() call len = 0; } if (errno != 0) { // getline error? rc = -errno; if (verbose) fprintf(stderr, "Error reading file %s: %s\n", fn, strerror(-rc)); } free(line); rc = linectr; fclose(fp); } if (debug) printf("(%s) Done. returning: %d\n", __func__, rc); return rc; } /** Reads the first line of a file. * * @param fn file name * @param verbose if true, write message to stderr if unable to open file * * @retval non-NULL pointer to line read (caller responsible for freeing) * @retval NULL if error or no lines in file */ char * file_get_first_line(const char * fn, bool verbose) { FILE * fp = fopen(fn, "r"); char * single_line = NULL; if (!fp) { if (verbose) fprintf(stderr, "Error opening %s: %s\n", fn, strerror(errno)); // TODO: strerror() not thread safe } else { size_t len = 0; ssize_t read; // just one line: read = getline(&single_line, &len, fp); if (read == -1) { if (verbose) printf("Nothing to read from %s\n", fn); } else { if (strlen(single_line) > 0) single_line[strlen(single_line)-1] = '\0'; // printf("\n%s", single_line); // single_line has trailing \n } fclose(fp); } // printf("(%s) fn=|%s|, returning: |%s|\n", __func__, fn, single_line); return single_line; } /** Reads a binary file, returning it as a **GByteArray**. * * \param fn file name * \param est_size estimated size * \param verbose if open fails, write message to stderr * \return if successful, a **GByteArray** of bytes, caller is responsible for freeing * if failure, then NULL */ GByteArray * read_binary_file( char * fn, int est_size, bool verbose) { assert(fn); bool debug = false; // DBGMSG("fn=%s", fn); Byte buf[1]; GByteArray * gbarray = NULL; FILE * fp; if (!(fp = fopen(fn, "r"))) { int errsv = errno; if (verbose){ fprintf(stderr, "Error opening \"%s\", %s\n", fn, strerror(errsv)); } goto bye; } if (est_size <= 0) gbarray = g_byte_array_new(); else gbarray = g_byte_array_sized_new(est_size); // TODO: read bigger hunks size_t ct = 0; while ( (ct = fread(buf, /*size*/ 1, /*nmemb*/ 1, fp) ) > 0) { assert(ct == 1); g_byte_array_append(gbarray, buf, ct); } fclose(fp); bye: if (debug) { if (gbarray) printf("(%s) Returning GByteArray of size %d", __func__, gbarray->len); else printf("(%s) Returning NULL", __func__); } return gbarray; } /** Checks if a regular file exists. * * @param fqfn fully qualified file name * @return true/false */ bool regular_file_exists(const char * fqfn) { bool result = false; struct stat stat_buf; int rc = stat(fqfn, &stat_buf); if (rc == 0) { result = S_ISREG(stat_buf.st_mode); } return result; } /** Checks if a directory exists. * * @param fqfn fully qualified directory name * @return true/false */ bool directory_exists(const char * fqfn) { bool result = false; struct stat stat_buf; int rc = stat(fqfn, &stat_buf); if (rc == 0) { result = S_ISDIR(stat_buf.st_mode); } return result; } /** Scans list of directories to obtain file names matching a criterion * * @param dirnames null terminated array of pointers to directory names * @param filter_func tests directory entry * * @return GPtrArray of fully qualified file names * * A free function is set on the returned GPtrArray, so g_ptr_array_free() releases * all the file names * * Adapted from usbmonctl */ GPtrArray * get_filenames_by_filter(const char * dirnames[], Dirent_Filter filter_func) { // const char *hiddev_paths[] = { "/dev/", "/dev/usb/", NULL }; bool debug = false; GPtrArray * devnames = g_ptr_array_new(); g_ptr_array_set_free_func(devnames, free); char path[PATH_MAX]; for (int i = 0; dirnames[i] != NULL; i++) { struct dirent ** filelist; int count = scandir(dirnames[i], &filelist, filter_func, alphasort); if (count < 0) { assert(count == -1); fprintf(stderr, "(%s) scandir() error: %s\n", __func__, strerror(errno)); continue; } for (int j = 0; j < count; j++) { snprintf(path, PATH_MAX, "%s%s", dirnames[i], filelist[j]->d_name); g_ptr_array_add(devnames, strdup(path)); free(filelist[j]); } free(filelist); } if (debug) { printf("(%s) Found %d file names:\n", __func__, devnames->len); for (int ndx = 0; ndx < devnames->len; ndx++) printf(" %s\n", (char *) g_ptr_array_index(devnames, ndx) ); } return devnames; } /** Gets the file name for a file descriptor * * @param fd file descriptor * @param p_fn where to return a pointer to the file name * The caller is responsible for freeing this memory * * @retval 0 success * @retval -errno if error (see readlink() doc for possible error numbers */ int filename_for_fd(int fd, char** p_fn) { char * result = calloc(1, PATH_MAX+1); char workbuf[40]; int rc = 0; snprintf(workbuf, 40, "/proc/self/fd/%d", fd); ssize_t ct = readlink(workbuf, result, PATH_MAX); if (ct < 0) { rc = -errno; free(result); *p_fn = NULL; } else { assert(ct <= PATH_MAX); result[ct] = '\0'; *p_fn = result; } // printf("(%s) fd=%d, returning: %d, *pfn=%p -> |%s|\n", // __func__, fd, rc, *pfn, *pfn); return rc; } ddcutil-0.8.6/src/util/glib_util.c0000644000175000001440000002443213214610261013755 00000000000000/* glib_util.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file glib_util.c * * Functions for use with glib. */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "glib_util.h" #ifdef ALTERNATIVE // create private copy of g_hash_table_get_keys_as_array() /** * g_hash_table_get_keys_as_array: * @hash_table: a #GHashTable * @length: (out): the length of the returned array * * Retrieves every key inside @hash_table, as an array. * * The returned array is %NULL-terminated but may contain %NULL as a * key. Use @length to determine the true length if it's possible that * %NULL was used as the value for a key. * * Note: in the common case of a string-keyed #GHashTable, the return * value of this function can be conveniently cast to (gchar **). * * You should always free the return result with g_free(). In the * above-mentioned case of a string-keyed hash table, it may be * appropriate to use g_strfreev() if you call g_hash_table_steal_all() * first to transfer ownership of the keys. * * Returns: (array length=length) (transfer container): a * %NULL-terminated array containing each key from the table. * * Since: 2.40 **/ gpointer * g_hash_table_get_keys_as_array_local (GHashTable *hash_table, guint *length) { gpointer *result; guint i, j = 0; result = g_new(gpointer, hash_table->nnodes + 1); for (i = 0; i < hash_table->size; i++) { if (HASH_IS_REAL (hash_table->hashes[i])) result[j++] = hash_table->keys[i]; } g_assert_cmpint (j, ==, hash_table->nnodes); result[j] = NULL; if (length) *length = j; return result; } #endif /** Converts a doubly linked list of pointers into a null-terminated array * of pointers. * * @param glist pointer to doubly linked list * @param length where to return number of items in the allocated array, * (not including the final NULL terminating entry * * @return pointer to the newly allocated gpointer array * * @remark The pointers in the linked list are copied to the newly allocated array. * The data pointed to is not duplicated. * @remark This function is needed because glib function g_hash_table_get_keys_as_array() * does not exist in glib versions less than 2.40 */ gpointer * g_list_to_g_array(GList * glist, guint * length) { int len = 0; gpointer * result = NULL; guint ndx = 0; GList * lptr; len = g_list_length(glist); result = g_new(gpointer, len+1); for (lptr = glist; lptr!=NULL; lptr=lptr->next) { result[ndx++] = lptr->data; } result[ndx] = NULL; *length = len; return result; } /** String comparison function used by g_ptr_array_sort() * * @param a pointer to first string * @param b pointer to second string * @return -1, 0, +1 in the usual way */ gint gaux_ptr_scomp(gconstpointer a, gconstpointer b) { char ** ap = (char **) a; char ** bp = (char **) b; // printf("(%s) ap = %p -> -> %p -> |%s|\n", __func__, ap, *ap, *ap); // printf("(%s) bp = %p -> -> %p -> |%s|\n", __func__, bp, *bp, *bp); return g_ascii_strcasecmp(*ap,*bp); } /** Formats a string similarly to g_sprintf(), but allocates * a sufficiently sized buffer in which the formatted string * is returned. * * \param fmt format string * \param ... arguments * \return pointer to newly allocated string */ gchar * gaux_asprintf(gchar * fmt, ...) { char * result = NULL; va_list(args); va_start(args, fmt); // g_vasprintf(&result, fmt, args); // get implicit function declaration error gsize sz = g_printf_string_upper_bound(fmt,args); result = calloc(1,sz); va_start(args, fmt); g_vsnprintf(result, sz, fmt, args); va_end(args); return result; } GPtrArray * gaux_ptr_array_truncate(GPtrArray * gpa, int limit) { assert(gpa); bool debug = false; if (debug) printf("(%s) Starting. gpa->len=%d, limit=%d\n", __func__, gpa->len, limit); if (limit > 0) { int removect = gpa->len - limit; if (removect > 0) { g_ptr_array_remove_range(gpa, limit, removect); } } else if (limit < 0) { int removect = gpa->len + limit; if (removect > 0) { g_ptr_array_remove_range(gpa, 0, removect); } } if (debug) printf("(%s) Done. gpa->len=%d\n", __func__, gpa->len); return gpa; } // Future: GPtrArray * gaux_ptr_array_append_array( GPtrArray * dest, GPtrArray * src, GAuxDupFunc dup_func) { assert(dest); if (src) { for (int ndx = 0; ndx < src->len; ndx++) { gpointer v = g_ptr_array_index(src,ndx); if (dup_func) v = dup_func(v); g_ptr_array_add(dest, v); } } return dest; } GPtrArray * gaux_ptr_array_join( GPtrArray * gpa1, GPtrArray * gpa2, GAuxDupFunc dup_func, GDestroyNotify element_free_func) { int new_len = gpa1->len + gpa2->len; GPtrArray * dest = g_ptr_array_sized_new(new_len); if (element_free_func) g_ptr_array_set_free_func(dest,element_free_func); for (int ndx = 0; ndx < gpa1->len; ndx++) { gpointer v = g_ptr_array_index(gpa1,ndx); if (dup_func) v = dup_func(v); g_ptr_array_add(dest, v); } for (int ndx = 0; ndx < gpa2->len; ndx++) { gpointer v = g_ptr_array_index(gpa2,ndx); if (dup_func) v = dup_func(v); g_ptr_array_add(dest, v); } return dest; } GPtrArray * gaux_ptr_array_copy( GPtrArray * src, GAuxDupFunc dup_func, GDestroyNotify element_free_func) { GPtrArray * dest = g_ptr_array_sized_new(src->len); if (element_free_func) g_ptr_array_set_free_func(dest, element_free_func); for (int ndx = 0; ndx < src->len; ndx++) { gpointer v = g_ptr_array_index(src,ndx); if (dup_func) v = dup_func(v); g_ptr_array_add(dest, v); } return dest; } GPtrArray * gaux_ptr_array_from_null_terminated_array( gpointer * src, GAuxDupFunc dup_func, GDestroyNotify element_free_func) { GPtrArray * result = g_ptr_array_new(); if (dup_func) g_ptr_array_set_free_func(result, element_free_func); gpointer* p = src; while (*p) { gpointer v = (dup_func) ? dup_func(*p) : *p; g_ptr_array_add(result, v); } return result; } // // Thread utilities // /** Handles the boilerplate of obtaining a thread specific buffer that can * change size. * * If parm **bufsz_key_ptr** is NULL, the buffer is reallocated with the * specified size with each call to this function. * * If parm **bufsz_key_ptr** is non-NULL, then the buffer is reallocated * only if the requested size is larger than the current size. That is, * the buffer can grow in size but never shrink. * * \param buf_key_ptr address of a **GPrivate** used as the identifier * for the buffer * \param bufsz_key_ptr address of **GPrivate** used as an identifier for * the current buffer size * \param required_size size of buffer to allocate * \return pointer to thread specific buffer */ gchar * get_thread_dynamic_buffer( GPrivate * buf_key_ptr, GPrivate * bufsz_key_ptr, guint16 required_size) { // printf("(%s) buf_key_ptr=%p, bufsz_key_ptr=%p, required_size=%d\n", // __func__, buf_key_ptr, bufsz_key_ptr, required_size); char * buf = g_private_get(buf_key_ptr); int * bufsz_ptr = NULL; if (bufsz_key_ptr) bufsz_ptr = g_private_get(bufsz_key_ptr); // GThread * this_thread = g_thread_self(); // printf("(%s) this_thread=%p, buf=%p, bufsz_ptr=%p\n", __func__, this_thread, buf, bufsz_ptr); // if (bufsz_ptr) // printf("(%s) *bufsz_ptr = %d\n", __func__, *bufsz_ptr); // unnecessary if use g_private_replace() instead of g_private_set() // if (buf) // g_free(buf); if ( !bufsz_ptr || *bufsz_ptr < required_size) { buf = g_new(char, required_size); // printf("(%s) Calling g_private_set()\n", __func__); g_private_replace(buf_key_ptr, buf); if (bufsz_key_ptr) { if (!bufsz_ptr) { bufsz_ptr = g_new(int, 1); g_private_set(bufsz_key_ptr, bufsz_ptr); } *bufsz_ptr = required_size; } } // printf("(%s) Returning: %p\n", __func__, buf); return buf; } /** Handles the boilerplate of obtaining a thread specific fixed size buffer. * The first call to this function in a thread with a given key address * allocates the buffer. Subsequent calls in the thread for the same key * address return the same buffer. * * \param buf_key_ptr address of a **GPrivate** used as the identifier * for the buffer * \param buffer_size size of buffer to allocate * \return pointer to thread specific buffer * * \remark * When the buffer is first allocated, byte 0 is set to '\0' */ gchar * get_thread_fixed_buffer( GPrivate * buf_key_ptr, guint16 buffer_size) { // printf("(%s) buf_key_ptr=%p, buffer_size=%d\n", __func__, buf_key_ptr, buffer_size); assert(buffer_size > 0); char * buf = g_private_get(buf_key_ptr); // GThread * this_thread = g_thread_self(); // printf("(%s) this_thread=%p, buf=%p\n", __func__, this_thread, buf); if (!buf) { buf = g_new(char, buffer_size); buf[0] = '\0'; // (sort of) mark buffer as unused g_private_set(buf_key_ptr, buf); } // printf("(%s) Returning: %p\n", __func__, buf); return buf; } ddcutil-0.8.6/src/util/glib_string_util.c0000644000175000001440000000652313203271475015354 00000000000000/* glib_string_util.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file glib_string_util.c * Functions that depend on both glib_util.c and string_util.c. * * glib_string_util.c/h exists to avoid circular dependencies within * directory util. */ /** \cond */ #include #include #include #include /** \endcond */ #include "string_util.h" #include "glib_string_util.h" /** Joins a GPtrArray containing pointers to character strings * into a single string, * * @param strings GPtrArray of strings * @param sepstr if non-null, separator to insert between joined strings * * @return joined string */ char * join_string_g_ptr_array(GPtrArray* strings, char * sepstr) { bool debug = false; int ct = strings->len; if (debug) fprintf(stdout, "(%s) ct = %d\n", __func__, ct); char ** pieces = calloc(ct, sizeof(char*)); int ndx; for (ndx=0; ndx < ct; ndx++) { pieces[ndx] = g_ptr_array_index(strings,ndx); if (debug) fprintf(stdout, "(%s) pieces[%d] = %s\n", __func__, ndx, pieces[ndx]); } char * catenated = strjoin((const char**) pieces, ct, sepstr); if (debug) fprintf(stdout, "(%s) strlen(catenated)=%zd, catenated=%p, catenated=|%s|\n", __func__, strlen(catenated), catenated, catenated); #ifdef GLIB_VARIANT // GLIB variant failing when used with file. why? Null_Terminated_String_Array ntsa_pieces = g_ptr_array_to_ntsa(strings); if (debug) { DBGMSG("ntsa_pieces before call to g_strjoinv():"); null_terminated_string_array_show(ntsa_pieces); } // n. our Null_Terminated_String_Array is identical to glib's GStrv gchar sepchar = ';'; gchar * catenated2 = g_strjoinv(&sepchar, ntsa_pieces); DBGMSF(debug, "catenated2=%p", catenated2); *pstring = catenated2; assert(strcmp(catenated, catenated2) == 0); #endif return catenated; } /** Looks for a string in a **GPtrArray** of strings. * * @param haystack **GPtrArray** to search * @param needle string to search for (case sensitive) * @return index of string if found, -1 if not found * * @remark * glib function **g_ptr_array_find_with_equal_funct()** is an obvious alternative, * but it requires glib version >= 2.54 */ int gaux_string_ptr_array_find(GPtrArray * haystack, const char * needle) { int result = -1; for (int ndx = 0; ndx < haystack->len; ndx++) { if (streq(needle, g_ptr_array_index(haystack, ndx))) { result = ndx; break; } } return result; } ddcutil-0.8.6/src/util/i2c_util.c0000644000175000001440000000253613203271475013526 00000000000000/* i2c_util.c * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * I2C Utility Functions */ #include "string_util.h" #include "i2c_util.h" /** Converts a string of the form "i2c-N" to a number. * * \param name string to convert * \return extracted number, -1 if conversion fails */ int i2c_name_to_busno(char * name) { int result = -1; if (name && str_starts_with(name, "i2c-")) { int ival; bool ok = str_to_int(name+4, &ival); if (ok) result = ival; } return result; } ddcutil-0.8.6/src/util/multi_level_map.c0000644000175000001440000002302513214610353015160 00000000000000/* multi_level_map.c * * * Copyright (C) 2015-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file multi_level_map.c * Multi_Level_Map data structure */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "report_util.h" #include "multi_level_map.h" // // Data structure creation // /** Creates a new **Multi_Level_Map instance. * * @param table_name name of table * @param levels number of levels * @param level_detail pointer to array if **MLM_Level** descriptors */ Multi_Level_Map * mlm_create(char * table_name, int levels, MLM_Level* level_detail) { // printf("(%s) level_detail=%p\n", __func__, level_detail); // for (int lvlndx=0; lvlndx < levels; lvlndx++) { // report_mlm_level(level_detail+lvlndx, 1); // } Multi_Level_Map * mlm = calloc(1, sizeof(Multi_Level_Map) + levels * sizeof(MLM_Level)); mlm->table_name = strdup(table_name); mlm->levels = levels; // MLM_Level* lvldesc = level_detail; int initial_size = level_detail[0].initial_size; // printf("(%s) initial_size=%d\n", __func__, initial_size); mlm->root = g_ptr_array_sized_new(initial_size); memcpy((Byte*) &mlm->level_detail, level_detail, levels*sizeof(MLM_Level)); // report_multi_level_table(mlm,0); return mlm; } /** Adds a node to a **Multi_Level_Map**. * * @param map pointer to **Multi_Level_Map** table * @param parent pointer to parent node * if NULL, this node is a child of the root * @param key key of node * @param value value of node */ MLM_Node * mlm_add_node(Multi_Level_Map * map, MLM_Node * parent, uint key, char * value) { // printf("(%s) parent=%p, key=0x%04x, value=|%s|\n", __func__, parent, key, value); MLM_Node * new_node = calloc(1,sizeof(MLM_Node)); new_node->code = key; new_node->name = value; new_node->children = NULL; if (!parent) { new_node->level = 0; g_ptr_array_add(map->root, new_node); } else { new_node->level = parent->level+1; if (!parent->children) { int initial_size = map->level_detail[parent->level].initial_size; parent->children = g_ptr_array_sized_new(initial_size); } g_ptr_array_add(parent->children, new_node); } map->level_detail[new_node->level].total_entries += 1; return new_node; } // // Debug data structure // /** Reports on a **Multi_Level_Map** level descriptor. * @param level_desc pointer to level descriptor * @param depth logical indentation depth */ void report_mlm_level(MLM_Level * level_desc, int depth) { int d1 = depth+1; rpt_structure_loc("MLM_Level", level_desc, depth); rpt_str("name", NULL, level_desc->name, d1); rpt_int("initial_size", NULL, level_desc->initial_size, d1); rpt_int("total_entries", NULL, level_desc->total_entries, d1); } // Debugging function void mlm_cur_entries(Multi_Level_Map * mlt) { int d1 = 1; rpt_vstring(0, "Multi_Level_Table. levels=%d", mlt->levels); for (int ndx=0; ndx < mlt->levels; ndx++) { rpt_vstring(d1, " mlt->level_detail[%d].cur_entry=%p, addr of entry=%p", ndx, mlt->level_detail[ndx].cur_entry, &mlt->level_detail[ndx].cur_entry); } } static void report_mlm_node( Multi_Level_Map * header, int level, MLM_Node * entry, int depth) { // MLM_Level level_detail = header->level_detail[level]; rpt_vstring(depth, "%04x %s", entry->code, entry->name); if (entry->children) { for (int ndx=0; ndxchildren->len; ndx++) { report_mlm_node( header, level+1, g_ptr_array_index(entry->children, ndx), depth+1); } } } /** Reports the contents of a **Multi_Level_Map**. * * @param header pointer to MLM instance * @param depth logical indentation depth */ void report_multi_level_map(Multi_Level_Map * header, int depth) { int d1 = depth+1; int d2 = depth+2; rpt_structure_loc("Multi_Level_Table", header, depth); rpt_vstring(d1, "%-20s: %s", "Table", header->table_name); rpt_vstring(d1, "%-20s: %s", "Segment tag", header->segment_tag); rpt_int("Number of level 0 entries:", NULL, header->root->len, d1); for (int ndx=0; ndx < header->root->len; ndx++) { report_mlm_node( header, 0, g_ptr_array_index(header->root, ndx), d2); } } // // Data structure query // static MLM_Node * mlm_find_child(GPtrArray * nodelist, uint id) { bool debug = false; if (debug) printf("(%s) Starting, id=0x%08x\n", __func__, id); MLM_Node * result = NULL; for (int ndx = 0; ndx < nodelist->len; ndx++) { MLM_Node * cur_entry = g_ptr_array_index(nodelist, ndx); if (debug) printf("(%s) Comparing code=0x%04x, name=%s\n", __func__, cur_entry->code, cur_entry->name); if (cur_entry->code == id) { result = cur_entry; break; } } if (debug) printf("(%s) Returning %p\n", __func__, result); return result; } static void report_multi_level_names(Multi_Level_Names * mln, int depth) { int d1 = depth+1; rpt_structure_loc("Multi_Level_Names", mln, depth); rpt_int("levels", NULL, mln->levels, d1); for (int ndx = 0; ndx < mln->levels; ndx++) { rpt_str("names", NULL, mln->names[ndx], d1); } } /** Gets the names associated with the levels of a **Multi_Level_Map** path. * * @param mlm pointer to **Multi_Level_Map** table * @param levelct number of ids * @param ids pointer to array of **levelct** node ids * * @return pointer to **Multi_Level_Names** struct containing the * names for the ids at each level */ Multi_Level_Names mlm_get_names2(Multi_Level_Map * mlm, int levelct, uint* ids) { bool debug = false; assert(levelct >= 1 && levelct <= MLT_MAX_LEVELS); // pciusb_id_ensure_initialized(); // <== WHAT TO DO? if (debug) { printf("(%s) levelct=%d\n", __func__, levelct); for (int ndx = 0; ndx < levelct; ndx++) { printf(" ids[%d] = 0x%08x\n", ndx, ids[ndx]); } } Multi_Level_Names result = {0}; int argndx = 0; GPtrArray * children = mlm->root; result.levels = 0; while (argndx < levelct) { // printf("(%s) argndx=%d\n", __func__, argndx); if (!children) break; MLM_Node * level_entry = mlm_find_child(children, ids[argndx]); if (!level_entry) { break; } result.levels = argndx+1; result.names[argndx] = level_entry->name; children = level_entry->children; argndx++; } if (debug) { printf("(%s) Returning: \n", __func__); report_multi_level_names(&result, 1); } return result; } /** Variant of **mlm_get_names2()** that uses a variable argument list for * the level ids. * * @param table pointer to **Multi_Level_Map** table * @param argct number of ids * @param .. node ids, of type uint * * @return pointer to **Multi_Level_Names** struct containing the * names for the ids at each level */ Multi_Level_Names mlm_get_names(Multi_Level_Map * table, int argct, ...) { // bool debug = false; assert(argct >= 1 && argct <= MLT_MAX_LEVELS); // pciusb_id_ensure_initialized(); // <== WHAT TO DO? uint args[MLT_MAX_LEVELS]; va_list ap; int ndx; va_start(ap, argct); for (ndx=0; ndx= 1 && argct <= MLT_MAX_LEVELS); // pciusb_id_ensure_initialized(); // <== WHAT TO DO? Multi_Level_Names result = {0}; uint args[MLT_MAX_LEVELS]; va_list ap; int ndx; va_start(ap, argct); for (ndx=0; ndxroot; while (argndx < argct) { assert(children); MLM_Node * level_entry = mlm_find_child(children, args[argndx]); if (!level_entry) { result.levels = 0; // indicates not found break; } result.levels = argndx+1; result.names[argndx] = level_entry->name; children = level_entry->children; argndx++; } if (debug) { printf("(%s) Returning: \n", __func__); report_multi_level_names(&result, 1); } return result; } #endif ddcutil-0.8.6/src/util/output_sink.c0000644000175000001440000001427213101546540014373 00000000000000/* output_sink.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file output_sink.c * Alternative mechanism for output redirecton. * Not currently used (3/2017) */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "output_sink.h" #define OUTPUT_SINK_MARKER "SINK" struct Output_Sink{ char marker[4]; Output_Sink_Type sink_type; FILE * fp; GPtrArray* line_array; int cur_max_chars; char * workbuf; }; /** Creates an output sink representing stdout. * * @return output sink handle */ Output_Sink create_terminal_sink() { struct Output_Sink * psink = calloc(1, sizeof(struct Output_Sink)); memcpy(psink->marker, OUTPUT_SINK_MARKER, 4); psink->sink_type = SINK_STDOUT; psink->fp = stdout; // ?? return psink; } /** Creates an output sink representing a file. * * @param fp pointer to open file stream * @return output sink handle */ Output_Sink create_file_sink(FILE * fp) { struct Output_Sink * psink = calloc(1, sizeof(struct Output_Sink)); memcpy(psink->marker, OUTPUT_SINK_MARKER, 4); psink->sink_type = SINK_FILE; psink->fp = fp; return psink; } /** Creates an in-memory output sink. * * @param initial_line_ct initially allocate space for this many lines * @param estimated_max_chars estimated maximum line length * @return output sink handle */ Output_Sink create_memory_sink(int initial_line_ct, int estimated_max_chars) { struct Output_Sink * psink = calloc(1, sizeof(struct Output_Sink)); memcpy(psink->marker, OUTPUT_SINK_MARKER, 4); psink->sink_type = SINK_MEMORY; psink->line_array = g_ptr_array_sized_new(initial_line_ct); g_ptr_array_set_free_func(psink->line_array, free); psink->cur_max_chars = estimated_max_chars; psink->workbuf = calloc(estimated_max_chars+1, sizeof(char)); return psink; } /** Writes to an output sink in a printf() like manner. * * @param sink Output_Sink handle * @param format printf() format string * @param ... printf() arguments */ int printf_sink(Output_Sink sink, const char * format, ...) { struct Output_Sink * psink = (struct Output_Sink*) sink; assert(psink && memcmp(psink->marker, OUTPUT_SINK_MARKER, 4) == 0); int rc = 0; va_list(args); va_start(args, format); switch(psink->sink_type) { case (SINK_STDOUT): // rc = vprintf(format, args); // break; case (SINK_FILE): rc = vfprintf(psink->fp, format, args); if (rc < 0) rc = -errno; break; case (SINK_MEMORY): { bool done = false; while (!done) { rc = vsnprintf(psink->workbuf, psink->cur_max_chars, format, args); if (rc > psink->cur_max_chars) { // if work buffer was too small, reallocate and retry free(psink->workbuf); psink->cur_max_chars = rc + 1; psink->workbuf = calloc( (psink->cur_max_chars)+1, sizeof(char)); } else done = true; }; if (rc < 0) rc = -errno; else g_ptr_array_add(psink->line_array, strdup(psink->workbuf)); break; } } va_end(args); return rc; } /** Reads the current contents of an in-memory Output_Sink. * * @param sink Output_Sink handle * @return pointer to GPtrArray of strings * * @remark * Note thsi returns a pointer into the Output_Sink data structure. */ GPtrArray * read_sink(Output_Sink sink) { struct Output_Sink * psink = (struct Output_Sink *) sink; assert(psink && memcmp(psink->marker, OUTPUT_SINK_MARKER, 4) == 0); assert(psink->sink_type == SINK_MEMORY); return psink->line_array; } /** Closes an Output_Sink. * * If a file output sink, the underlying file is closed. * * If an in-memory output sink, all memory associated with the * sink is freed. (UNIMPLEMENTED) * * @param sink handle to Output_Sink * * @remark * - For symmetry, if this function closes a file sink, * create_sink should probably open the file. */ int close_sink(Output_Sink sink) { struct Output_Sink * psink = (struct Output_Sink *) sink; assert(psink && memcmp(psink->marker, OUTPUT_SINK_MARKER, 4) == 0); int rc = 0; switch(psink->sink_type) { case (SINK_STDOUT): break; case (SINK_FILE): rc = fclose(psink->fp); if (rc < 0) rc = -errno; break; case (SINK_MEMORY): g_ptr_array_free(psink->line_array, true); psink->line_array = NULL; break; } psink->marker[3] = 'x'; free(psink); return rc; } #ifdef ORIGINAL_IDEA // What I really need are curried functions. typedef int (*VCP_Emitter)(const char * format, ...); static FILE * vcp_file_emitter_fp = NULL; int vcp_file_emitter(const char * format, ...) { assert(vcp_file_emitter_fp); va_list(args); va_start(args, format); int rc = vfprintf(vcp_file_emitter_fp, format, args); va_end(args); return rc; } static GPtrArray* vcp_garray_emitter_array = NULL; int vcp_garray_emitter(const char * format, ...) { assert(vcp_garray_emitter_array); va_list(args); va_start(args, format); char buf[400]; vsnprintf(buf, 400, format, args); g_ptr_array_add(vcp_garray_emitter_array, strdup(buf)); } #endif ddcutil-0.8.6/src/util/report_util.c0000644000175000001440000005107713203271475014370 00000000000000/* report_util.c * * Functions for creating messages in a stardardized format, with flexible * indentation. It is particularly used for tracing data structures. * * This source file maintains state in static variables so is not thread safe. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file report_util.c * Report utility functions * * TODO: describe * - indentation depth * - indentation stack * - destination stack */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "coredefs.h" #include "file_util.h" #include "string_util.h" #include "report_util.h" #define DEFAULT_INDENT_SPACES_PER_DEPTH 3 #define INDENT_SPACES_STACK_SIZE 16 static int indent_spaces_stack[INDENT_SPACES_STACK_SIZE]; static int indent_spaces_stack_pos = -1; #define OUTPUT_DEST_STACK_SIZE 8 static FILE* output_dest_stack[OUTPUT_DEST_STACK_SIZE]; static int output_dest_stack_pos = -1; // work around for fact that can't initialize the initial stack entry to stdout static FILE* alt_initial_output_dest = NULL; static bool initial_output_dest_changed = false; // // Indentation // // Functions that allow for temporarily changing the number of // indentation spaces per logical indentation depth. // 10/16/15: not currently used void rpt_push_indent(int new_spaces_per_depth) { assert(indent_spaces_stack_pos < INDENT_SPACES_STACK_SIZE-1); indent_spaces_stack[++indent_spaces_stack_pos] = new_spaces_per_depth; } void rpt_pop_indent() { if (indent_spaces_stack_pos >= 0) indent_spaces_stack_pos--; } void rpt_reset_indent_stack() { indent_spaces_stack_pos = -1; } /** Given a logical indentation depth, returns the number of spaces * of indentation to be used. * * @param depth logical indentation depth * @return number of indentation spaces */ int rpt_get_indent(int depth) { int spaces_ct = DEFAULT_INDENT_SPACES_PER_DEPTH; if (indent_spaces_stack_pos >= 0) spaces_ct = indent_spaces_stack[indent_spaces_stack_pos]; return depth * spaces_ct; } // Functions that allow for temporarily changing the output destination. /** Sets the output destination to be used for report functions. * The current output destination is saved on the output destination stack. * * @param new_dest new output destination */ void rpt_push_output_dest(FILE* new_dest) { assert(output_dest_stack_pos < OUTPUT_DEST_STACK_SIZE-1); output_dest_stack[++output_dest_stack_pos] = new_dest; } /** Pops the output destination stack, and sets the output destination * to be used for report functions to the new top of the stack. */ void rpt_pop_output_dest() { if (output_dest_stack_pos >= 0) output_dest_stack_pos--; } /** Clears the output destination stack. * The output destination to be used for report functions to the default (stdout). */ void rpt_reset_output_dest_stack() { output_dest_stack_pos = -1; } /** Gets the current output destination. * * @return current output destination */ FILE * rpt_cur_output_dest() { // special handling for unpushed case because can't statically initialize // output_dest_stack[0] to stdout FILE * result = NULL; if (output_dest_stack_pos < 0) result = (initial_output_dest_changed) ? alt_initial_output_dest : stdout; else result = output_dest_stack[output_dest_stack_pos]; return result; } /** Debugging function to show output destination. */ void rpt_debug_output_dest() { FILE * dest = rpt_cur_output_dest(); char * addl = (dest == stdout) ? " (stdout)" : ""; printf("(%s) output_dest_stack[%d] = %p %s\n", __func__, output_dest_stack_pos, dest, addl); } /** Changes the current output destination, without saving * the current output destination on the destination stack. * * @param new_dest new output destination * * @remark Needed for set_fout() in core.c */ void rpt_change_output_dest(FILE* new_dest) { if (output_dest_stack_pos >= 0) output_dest_stack[output_dest_stack_pos] = new_dest; else { initial_output_dest_changed = true; alt_initial_output_dest = new_dest; } } // should not be needed, for diagnosing a problem void rpt_flush() { fflush(rpt_cur_output_dest()); } /** Writes a newline to the current output destination. */ void rpt_nl() { f0printf(rpt_cur_output_dest(), "\n"); } /* Writes a constant string to the current output destination. * * A newline is appended to the string specified. * * The output is indented per the specified indentation depth. * * @param title string to write * @param depth logical indentation depth. * * @remark This is the core function through which all output is funneled. */ void rpt_title(char * title, int depth) { bool debug = false; if (debug) printf("(%s) Writing to %p\n", __func__, rpt_cur_output_dest()); f0printf(rpt_cur_output_dest(), "%*s%s\n", rpt_get_indent(depth), "", title); } /* Writes a constant string to the current output destination. * * A newline is appended to the string specified. * * The output is indented per the specified indentation depth. * * @param depth logical indentation depth. * @param title string to write * * @remark * This function is logically equivalent to #rpt_title(), except that * the **depth** parameter is first, not last. * Experience wih the API has shown that #rpt_title() tends not to be * used along with #rpt_vstring() because the different position of the * **depth** parameter makes the code harder to read. */ void rpt_label(int depth, char * text) { rpt_title(text, depth); } /** Writes a formatted string to the current output destination. * * A newline is appended to the string specified * * @param depth logical indentation depth * @param format format string (normal printf) * @param ... arguments * * @remark Note that the depth parm is first on this function because of variable args */ void rpt_vstring(int depth, char * format, ...) { int buffer_size = 200; char buffer[buffer_size]; char * buf = buffer; va_list(args); va_start(args, format); int reqd_size = vsnprintf(buffer, buffer_size, format, args); // if buffer wasn't sufficiently large, allocate a temporary buffer if (reqd_size >= buffer_size) { // printf("(%s) Allocating temp buffer, reqd_size=%d\n", __func__, reqd_size); buf = malloc(reqd_size+1); va_start(args, format); vsnprintf(buf, reqd_size+1, format, args); } va_end(args); rpt_title(buf, depth); if (buf != buffer) free(buf); } /** Convenience function that writes multiple constant strings. * * @param depth logical indentation depth * @param ... pointers to constant strings, * last pointer is NULL to terminate list */ void rpt_multiline(int depth, ...) { va_list args; va_start(args, depth); char * s = NULL; while( (s = va_arg(args, char *)) != NULL) { rpt_title(s, depth); } va_end(args); } /** Writes all strings in a GPtrArray to the current report destination * * @param depth logical indentation depth * @param strings pointer to GPtrArray of strings */ void rpt_g_ptr_array(int depth, GPtrArray * strings) { for (int ndx = 0; ndx < strings->len; ndx++) { char * s = g_ptr_array_index(strings, ndx); rpt_title(s, depth); } } /** Writes a hex dump with indentation. * Output is written to the current report destination * * @param data start of bytes to dump * @param size number of bytes to dump * @param depth logical indentation depth */ void rpt_hex_dump(const Byte * data, int size, int depth) { fhex_dump_indented(rpt_cur_output_dest(), data, size, rpt_get_indent(depth)); } /** Writes a string to the current output destination, describing a pointer * to a named data structure. * * The output is indented per the specified indentation depth. * * @param name struct name * @param ptr pointer to struc * @param depth logical indentation depth */ void rpt_structure_loc(const char * name, const void * ptr, int depth) { // fprintf(rpt_cur_output_dest(), "%*s%s at: %p\n", rpt_indent(depth), "", name, ptr); rpt_vstring(depth, "%s at: %p", name, ptr); } /** Writes a pair of strings to the current output destination. * * If offset_absolute is true, then the s2 value will start in the same column, * irrespective of the line indentation. This may make some reports easier to read. * * @param s1 first string * @param s2 second string * @param col2offset offset from start of line where s2 starts * @param offset_absolute if true, col2offset is relative to the start of the line, before indentation * if false, col2offset is relative to the indented start of s1 * @param depth logical indentation depth */ void rpt_2col(char * s1, char * s2, int col2offset, bool offset_absolute, int depth) { int col1sz = col2offset; int indentct = rpt_get_indent(depth); if (offset_absolute) col1sz = col1sz - indentct; rpt_vstring(depth, "%-*s%s", col1sz, s1, s2 ); } /* Reports the contents of a file. * * @param fn name of file * @param verbose if true, emit message if error reading file * @depth depth logical indentation depth */ int rpt_file_contents(const char * fn, bool verbose, int depth) { GPtrArray * line_array = g_ptr_array_new(); int rc = file_getlines(fn, line_array, false); if (rc < 0) { if (verbose) rpt_vstring(depth, "Error reading file %s: %s", fn, strerror(-rc)); } else if (rc == 0) { if (verbose) rpt_vstring(depth, "Empty file: %s", fn); } else if (rc > 0) { int ndx = 0; for (; ndx < line_array->len; ndx++) { char * curline = g_ptr_array_index(line_array, ndx); // trim_in_place(curline); // strip trailing newline - now done in file_getlines() rpt_title(curline, depth); } } return rc; } /* The remaining rpt_ functions various data types share a common formatting so that they can * be use together. All channel their output through rpt_str(). * * Depending on whether the info parm is null, output takes one of the following forms: * name (info) : value * name : value */ /** Writes a string to the current output destination describing a named character string value. * * The output is indented per the specified indentation depth. * * Optionally, a description string can be specified along with the name. * The description string will be surrounded by parentheses. * * The string value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val string value * @param depth logical indentation depth */ void rpt_str(const char * name, char * info, const char * val, int depth) { bool debug = false; if (debug) printf("(%s) Writing to %p\n", __func__, rpt_cur_output_dest()); char infobuf[100]; if (info) snprintf(infobuf, 99, "(%s)", info); else infobuf[0] = '\0'; rpt_vstring(depth, "%-25s %30s : %s", name, infobuf, val); } /** Writes a string to the current output destination describing a boolean value. * * The value is displayed as "true" or "false". * * The output is indented per the specified indentation depth. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val value to show * @param depth logical indentation depth * * The value is formatted as "true" or "false". */ void rpt_bool(char * name, char * info, bool val, int depth) { char * valName = (val) ? "true" : "false"; rpt_str(name, info, valName, depth); } /** Writes a string to the current output destination, describing a named integer value. * * The output is indented per the specified indentation depth. * * Optionally, a description string can be specified along with the name. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val integer value * @param depth logical indentation depth */ void rpt_int(char * name, char * info, int val, int depth) { char buf[10]; snprintf(buf, 9, "%d", val); rpt_str(name, info, buf, depth); } /** Writes a string to the current output destination describing a 4 byte integer value, * indented per the specified indentation depth. * * The integer value is formatted as printable hex. * * Optionally, a description string can be specified along with the name. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val integer value * @param depth logical indentation depth */ void rpt_int_as_hex(char * name, char * info, int val, int depth) { char buf[16]; snprintf(buf, 15, "0x%08x", val); rpt_str(name, info, buf, depth); } /** Writes a string to the current output destination describing a single byte value, * indented per the specified indentation depth. * * The value is formatted as printable hex. * * Optionally, a description string can be specified along with the name. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val value * @param depth logical indentation depth */ void rpt_uint8_as_hex(char * name, char * info, unsigned char val, int depth) { char buf[16]; snprintf(buf, 15, "0x%02x", val); rpt_str(name, info, buf, depth); } /** Writes a string to the current output destination describing a named integer * value having a symbolic string representation. * * The output is indented per the specified indentation depth. * * The integer value is converted to a string using the specified function. * * Optionally, a description string can be specified along with the name. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val integer value * @param func interpretation function * @param depth logical indentation depth */ void rpt_mapped_int(char * name, char * info, int val, Value_To_Name_Function func, int depth) { char * valueName = func(val); char buf[100]; snprintf(buf, 100, "%d - %s", val, valueName); rpt_str(name, info, buf, depth); } /** Writes a string to the current output destination describing a sequence of bytes, * indented per the specified indentation depth. * * The value is formatted as printable hex. * * Optionally, a description string can be specified along with the name. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param bytes pointer to start of bytes to show * @param ct number of bytes to show * @param hex_prefix_flag if true, the printable hex value will begin with "0x" * @param depth logical indentation depth */ void rpt_bytes_as_hex( const char * name, char * info, Byte * bytes, int ct, bool hex_prefix_flag, int depth) { // printf("(%s) bytes=%p, ct=%d\n", __func__, bytes, ct); int bufsz = 2*ct + 1; bufsz++; // hack if (hex_prefix_flag) bufsz += 2; char * buf = malloc(bufsz); char * hex_prefix = (hex_prefix_flag) ? "0x" : ""; char * hs = hexstring(bytes, ct); snprintf(buf, bufsz-1, "%s%s", hex_prefix, hs); rpt_str(name, info, buf, depth); free(buf); free(hs); } // Functions for reporting integers that are collections of named bits #ifdef DEBUG static void report_flag_info( Flag_Info* pflag_info, int depth) { assert(pflag_info); rpt_structure_loc("FlagInfo", pflag_info, depth); int d1 = depth+1; rpt_str( "flag_name", NULL, pflag_info->flag_name, d1); rpt_str( "flag_info", NULL, pflag_info->flag_info, d1); rpt_int_as_hex("flag_val", NULL, pflag_info->flag_val, d1); } /* Function for debugging findFlagInfoDictionary. * * Reports the contents of a FlagDictionay record. */ static void report_flag_info_dictionary(Flag_Dictionary* pDict, int depth) { assert(pDict); rpt_structure_loc("Flag_Dictionary", pDict, depth); int d1 = depth+1; rpt_int("flag_info_ct", NULL, pDict->flag_info_ct, d1); int ndx=0; for(;ndx < pDict->flag_info_ct; ndx++) { report_flag_info(&pDict->flag_info_recs[ndx], d1); } } #endif static Flag_Info * find_flag_info_in_dictionary(char * flag_name, Flag_Dictionary * pdict) { Flag_Info * result = NULL; // printf("(%s) Starting. flag_name=%s, pdict=%p \n", __func__, flagName, pdict ); // printf("(%s) pdict->flag_info_ct=%d \n", __func__, pdict->flag_info_ct ); // report_flag_info_dictionary(pdict, 2); int ndx; for (ndx=0; ndx < pdict->flag_info_ct; ndx++) { // printf("(%s) ndx=%d \n", __func__, ndx ); // Flag_Info pcur_info = &(pdict->flag_info_recs[ndx]); // printf("(%s) pdict->flag_info_recs[ndx].flag_name=%s \n", __func__, pdict->flag_info_recs[ndx].flag_name ); if ( streq(flag_name, pdict->flag_info_recs[ndx].flag_name)) { // printf("(%s) Match \n", __func__ ); result = &pdict->flag_info_recs[ndx]; break; } } // printf("(%s) Returning: %p \n", __func__, result ); return result; } static void char_buf_append(char * buffer, int bufsize, char * val_to_append) { assert(strlen(buffer) + strlen(val_to_append) < bufsize); strcat(buffer, val_to_append); } static void flag_val_to_string_using_dictionary( int flags_val, Flag_Name_Set * pflag_name_set, Flag_Dictionary * pdict, char * buffer, int bufsize ) { // printf("(%s) flagsVal=0x%02x, pflagNameSet=%p, pDict=%p \n", __func__, flagsVal, pflagNameSet, pDict ); // printf("(%s) pflagNameSet->flagNameCt=%d \n", __func__, pflagNameSet->flagNameCt ); // printf("(%s) pDict->flagInfoCt=%d \n", __func__, pDict->flagInfoCt ); assert(buffer && bufsize > 1); buffer[0] = '\0'; int ndx; bool first = true; for (ndx=0; ndx < pflag_name_set->flag_name_ct; ndx++) { Flag_Info * pflag_info = find_flag_info_in_dictionary(pflag_name_set->flag_names[ndx], pdict); // printf("(%s) ndx=%d, pFlagInfp=%p \n", __func__, ndx, pFlagInfo ); if (flags_val & pflag_info->flag_val) { if (first) first = false; else char_buf_append(buffer, bufsize, ", "); char_buf_append(buffer, bufsize, pflag_info->flag_name); } } // printf("(%s) Returning |%s|\n", __func__, buffer ); } /** Writes a string to the current output destination describing an integer * that is to be interpreted as a named collection of named bits. * * Output is indented per the specified indentation depth. * The description string will be surrounded by parentheses. * * The value is prefixed with a colon. * * @param name name of value * @param info if non-null, description of value * @param val value to interpret * @param p_flag_name_set * @param p_dict * @param depth logical indentation depth */ void rpt_ifval2(char* name, char* info, int val, Flag_Name_Set* p_flag_name_set, Flag_Dictionary* p_dict, int depth) { char buf[1000]; buf[0] = '\0'; snprintf(buf, 7, "0x%04x", val); char_buf_append(buf, sizeof(buf), " - "); flag_val_to_string_using_dictionary(val, p_flag_name_set, p_dict, buf, sizeof(buf)); rpt_str(name, info, buf, depth); } ddcutil-0.8.6/src/util/string_util.c0000644000175000001440000013301013226100504014334 00000000000000/* string_util.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file string_util.c * String utility functions */ /** \cond */ // for strcasestr() // #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include /** \endcond */ #include "glib_util.h" #include "string_util.h" // Direct writes to stdout/stderr: // debug messages // stderr: hhs_to_byte() before terminating execution because of bad value // // General // /** Returns a character string representation of an integer as a boolean value. * * @param value value to represent * @return "true" or "false" */ char * bool_repr(int value) { char * answer = (value) ? "true" : "false"; return answer; } // // String functions (other than hex) // /** Compares 2 strings for equality, handling nulls * * @param s1 first string * @param s2 second string * @return true if the strings match, false if not */ bool streq(const char * s1, const char * s2) { bool result = false; if ( (s1 == NULL && s2 == NULL) || (s1 != NULL && s2 != NULL && (strcmp(s1, s2) == 0) ) ) result = true; return result; } /** Tests if one string is a valid abbreviation of another. * * @param value is this string an abbreviation? * @param longname unabbreviated value * @param minchars minimum number of characters that must match * @return true/false */ bool is_abbrev(const char * value, const char * longname, size_t minchars) { bool result = false; if (value && longname) { int vlen = strlen(value); if ( vlen >= minchars && vlen <= strlen(longname) && memcmp(value, longname, vlen) == 0 // n. returns 0 if vlen == 0 ) { result = true; } } // printf("(%s) value=|%s|, longname=|%s| returning %d\n", __func__, value, longname, result); return result; } /** Tests if string starts with a string. * * @param value_to_test value to examine * @param prefix prefix to check for * @return true/false * * @remark Consider using lib function g_str_prefix() ?? instead * * @remark * Returns **false** if either **value_to_test** or **prefix** are null */ bool str_starts_with(const char * value_to_test, const char * prefix) { return value_to_test && prefix && is_abbrev(prefix, value_to_test, strlen(prefix)); } /** Tests if string ends with a string. * * @param value_to_test value to examine * @param suffix substring to check for * @return true/flase * * @remark Consider using lib function g_str_suffix() ?? instead */ bool str_ends_with(const char * value_to_test, const char * suffix) { bool debug = false; if (debug) printf("(%s) value_to_test=|%s|, end_part=|%s|\n", __func__, value_to_test, suffix); int value_len = strlen(value_to_test); int end_part_len = strlen(suffix); bool result = false; if (end_part_len <=value_len) { int startpos = value_len-end_part_len; result = streq(value_to_test+startpos, suffix); } if (debug) printf("(%s) returning: %d\n", __func__, result); return result; } /** Are all characters in the string printable? * * @param s string to test * @return true/false (true if s==NULL) */ bool str_all_printable(const char * s) { bool result = true; if (s) { for (int ndx = 0; ndx < strlen(s); ndx++) { if (!isprint(s[ndx])) { result = false; break; } } } return result; } /** Compares a string to a null-terminated array of strings, using a specified * comparison function. * * @param s string to test * @param match_list null terminated array of strings to test against * @param comp_func comparison function * * @retval >= 0 index of first entry in list for which the comparison function succeeds * @retval -1 no match */ int matches_by_func(const char * s, const char ** match_list, String_Comp_Func comp_func) { int result = -1; int ndx = 0; for (ndx=0; match_list[ndx] != NULL; ndx++) { if ( (*comp_func)(s, match_list[ndx])) { result = ndx; break; } } return result; } /** Tests if a string exactly matches any string in a null-terminated * array of strings. (Null_Terminated_String_Array). * * @param s string to test for * @param match_list null terminated array of pointers to strings * * @retval >= 0 index of matching array entry * @retval -1 no match */ int exactly_matches_any(const char * s, const char ** match_list) { return matches_by_func(s, match_list, streq); } /** Finds the first entry in a null terminated array of strings * that is the initial portion of a specified string. * * @param s string to test against * @param match_list array of prefix strings (null-terminated) * * @retval >= 0 index of matching prefix * @retval -1 not found */ int starts_with_any(const char * s, const char ** match_list) { return matches_by_func(s, match_list, str_starts_with); } /** Trims leading and trailing whitespace from a string and * returns the result in a buffer provided by the caller. * If the buffer is insufficiently large, the result string * is truncated. * * The result is always null terminated. * * @param s string to trim (not modified) * @param buffer where to return result * @param bufsz buffer size * * @return pointer to truncated string (i.e. buffer) */ char * strtrim_r(const char * s, char * buffer, int bufsz) { bool debug = false; if (debug) printf("(%s) s=|%s|\n", __func__, s); int slen = strlen(s); int startpos = 0; int lastpos = slen-1; // n. -1 for 1 length string while ( startpos < slen && isspace(s[startpos]) ) startpos++; if (startpos < slen) { while ( lastpos >= startpos && isspace(s[lastpos])) lastpos--; } int tlen = 1 + lastpos - startpos; if (debug) printf("(%s) startpos=%d, lastpos=%d, tlen=%d\n", __func__, startpos, lastpos, tlen); if (tlen > (bufsz-1)) tlen = bufsz-1; memcpy(buffer, s+startpos, tlen); buffer[tlen] = '\0'; if (debug) printf("(%s) returning |%s|\n", __func__, buffer); return buffer; } /** Trims trailing whitespace from a string. * * @param s string to trim * @return s * * @remark * Particularly useful for stripping trailing newlines. */ char * rtrim_in_place(char * s) { int len = strlen(s); while(len > 0 && isspace(s[len-1])) { len--; s[len] = '\0'; } return s; } /** Trims leading and trailing whitespace from a string and * returns the result in newly allocated memory. * It is the caller's responsibility to free this memory. * The result string is null terminated. * * @param s string to trim (not modified) * @return truncated string in newly allocated memory */ char * strtrim(const char * s) { int bufsz = strlen(s)+1; char * buffer = calloc(1,bufsz); strtrim_r(s, buffer, bufsz); return buffer; } /** Extracts a substring from a string * * @param s string to process * @param startpos starting position (0 based) * @param ct number of characters; if ct + startpos is greater than * the string length, ct is reduced accordingly * @return extracted substring, in newly allocated memory */ char * substr(const char * s, int startpos, int ct) { assert(startpos >= 0); assert(ct>=0); if (startpos + ct > strlen(s)) ct = strlen(s) - startpos; char * result = calloc(ct+1, sizeof(char)); strncpy(result, s+startpos, ct); result[ct] = '\0'; return result; } /** Returns the initial portion of a string * * @param s string to process * @param ct number of characters; if ct is greater than * the string length, ct is reduced accordingly * @return extracted substring, in newly allocated memory */ char * lsub(const char * s, int ct) { return substr(s, 0, ct); } /** Joins an array of strings into a single string, using a separator string. * * @param pieces array of strings * @param ct0 number of strings, if < 0 the array is null terminated * @param sepstr separator string, if NULL then no separator string * * @return joined string (null terminated) * * The returned string has been malloc'd. It is the responsibility of * the caller to free it. */ char * strjoin( const char ** pieces, const int ct0, const char * sepstr) { // printf("(%s) ct0=%d, sepstr=|%s|\n", __func__, ct0, sepstr); int total_length = 0; int ndx; int seplen = (sepstr) ? strlen(sepstr) : 0; // sepstr may be null int max_ct = (ct0 < 0) ? 9999 : ct0; for (ndx=0; ndx < max_ct && pieces[ndx]; ndx++) { total_length += strlen(pieces[ndx]); if (ndx > 0) total_length += seplen; } total_length += 1; // for terminating null int ct = ndx; // printf("(%s) ct=%d, total_length=%d\n", __func__, ct, total_length); char * result = malloc(total_length); char * end = result; for (ndx=0; ndx 0 && seplen > 0) { strcpy(end, sepstr); end += strlen(sepstr); } strcpy(end, pieces[ndx]); end += strlen(pieces[ndx]); } // printf("(%s) result=%p, end=%p\n", __func__, result, end); assert(end == result + total_length -1); return result; } #ifdef FUTURE // YAGNI: String_Array typedef struct { int max_ct; int cur_ct; char** s; } String_Array; String_Array* new_string_array(int size) { String_Array * result = calloc(1, sizeof(String_Array)); result->max_ct = size; result->cur_ct = 0; result->s = calloc(sizeof(char*), size); return result; } #endif /** Splits a string based on a list of delimiter characters. * * @param str_to_split string to be split * @param delims string of delimiter characters * @return null terminated array of pieces * * Note: Each character in delims is used as an individual test. * The full string is NOT a delimiter string. */ Null_Terminated_String_Array strsplit(const char * str_to_split, const char * delims) { bool debug = false; int max_pieces = (strlen(str_to_split)+1); if (debug) printf("(%s) str_to_split=|%s|, delims=|%s|, max_pieces=%d\n", __func__, str_to_split, delims, max_pieces); char** workstruct = calloc(sizeof(char *), max_pieces+1); int piecect = 0; char * str_to_split_dup = strdup(str_to_split); char * rest = str_to_split_dup; char * token; // originally token assignment was in while() clause, but valgrind // complaining about uninitialized variable, trying to figure out why token = strsep(&rest, delims); // n. overwrites character found while (token) { // printf("(%s) token: |%s|\n", __func__, token); if (strlen(token) > 0) workstruct[piecect++] = strdup(token); token = strsep(&rest, delims); } if (debug) printf("(%s) piecect=%d\n", __func__, piecect); char ** result = calloc(sizeof(char *), piecect+1); // n. workstruct[piecect] == NULL because we used calloc() memcpy(result, workstruct, (piecect+1)*sizeof(char*) ); if (debug) { int ndx = 0; char * curpiece = result[ndx]; while (curpiece != NULL) { printf("(%s) curpiece=%p |%s|\n", __func__, curpiece, curpiece); ndx++; curpiece = result[ndx]; } } free(workstruct); free(str_to_split_dup); return result; } /** Splits a string into segments, each of which is no longer * that a specified number of characters. If delimiters are * specified, then they are used to split the string into segments. * Otherwise all segments, except possibly the last, are * **max_piece_length** in length. * * @param str_to_split string to be split * @param max_piece_length maximum length of each segment * @param delims string of delimiter characters * @return null terminated array of pieces * * @remark * Each character in **delims** is used as an individual test. * The full string is NOT a delimiter string. */ Null_Terminated_String_Array strsplit_maxlength( const char * str_to_split, uint16_t max_piece_length, const char * delims) { bool debug = false; if (debug) printf("(%s) max_piece_length=%u, delims=|%s|, str_to_split=|%s|\n", __func__, max_piece_length, delims, str_to_split); GPtrArray * pieces = g_ptr_array_sized_new(20); char * str_to_split2 = strdup(str_to_split); // work around constness char * start = str_to_split2; char * str_to_split2_end = str_to_split2 + strlen(str_to_split); if (debug) printf("(%s)x start=%p, str_to_split2_end=%p\n", __func__, start, str_to_split2_end); while (start < str_to_split2_end) { if (debug) printf("(%s) start=%p, str_to_split2_end=%p\n", __func__, start, str_to_split2_end); char * end = start + max_piece_length; if (end > str_to_split2_end) end = str_to_split2_end; // int cursize = end-start; // printf("(%s) end=%p, start=%p, cursize=%d, max_piece_length=%d\n", // __func__, end, start, cursize, max_piece_length); if ( end < str_to_split2_end) { // printf("(%s) Need to split. \n", __func__); if (delims) { char * last = end-1; while(last >= start) { // printf("(%s) last = %p\n", __func__, last); if (strchr(delims, *last)) { end = last+1; break; } last--; } } } char * piece = strndup(start, end-start); g_ptr_array_add(pieces, piece); start = start + strlen(piece); } Null_Terminated_String_Array result = g_ptr_array_to_ntsa(pieces); g_ptr_array_free(pieces, false); free(str_to_split2); if (debug) ntsa_show(result); return result; } /** Frees a null terminated array of strings. * * @param string_array null terminated array of pointers to strings * @param free_strings if try, each string in the array is freed as well */ void ntsa_free(Null_Terminated_String_Array string_array, bool free_strings) { if (string_array) { if (free_strings) { int ndx = 0; while (string_array[ndx] != NULL) free(string_array[ndx++]); } free(string_array); } } /** Returns the number of strings in a null terminated array of strings. * * @param string_array null terminated array of pointers to strings * @return number of strings in the array */ int ntsa_length(Null_Terminated_String_Array string_array) { assert(string_array); int ndx = 0; while (string_array[ndx] != NULL) { ndx++; } return ndx; } /** Creates a new #Null_Terminated_String_Array from 2 existing instances. * The result contains all the strings of the first array, followed by all * the strings of the second. * * @param a1 first instance * @param a2 second instance * @param dup if true, the pointers in the output array point to newly * allocated strings * if false, the pointers in the output array point to the * original strings. * * @return newly allocated #Null_Terminated_String_Array */ Null_Terminated_String_Array ntsa_join( Null_Terminated_String_Array a1, Null_Terminated_String_Array a2, bool dup) { assert(a1); assert(a2); int ct = ntsa_length(a1) + ntsa_length(a2); Null_Terminated_String_Array result = calloc((ct+1), sizeof(char *)); char ** to = result; char ** from = a1; while (*from) { if (dup) *to = strdup(*from); else *to = *from; to++; from++; } from = a2; while (*from) { if (dup) *to = strdup(*from); else *to = *from; to++; from++; } return result; } int ntsa_findx( Null_Terminated_String_Array string_array, char * value, String_Comp_Func func) { assert(string_array); int result = -1; int ndx = 0; char * s = NULL; while ( (s=string_array[ndx]) ) { // printf("(%s) checking ndx=%d |%s|\n", __func__, ndx, s); if (func(s,value)) { result = ndx; break; } ndx++; } // printf("(%s) Returning: %d\n", __func__, result); return result; } int ntsa_find( Null_Terminated_String_Array string_array, char * value) { return ntsa_findx(string_array, value, streq); } /* Reports the contents of a Null_Terminated_String_Array. * * @param string_array null-terminated string array * * @remark This is not a **report** function as that would make string_util * depend on report_util, creating a circular dependency within util */ void ntsa_show(Null_Terminated_String_Array string_array) { assert(string_array); printf("Null_Terminated_String_Array at %p:\n", string_array); int ndx = 0; while (string_array[ndx]) { printf(" %p: |%s|\n", string_array[ndx], string_array[ndx]); ndx++; } printf("Total entries: %d\n", ndx); } /** Converts a Null_Terminated_String_Array to a GPtrArray of pointers to strings. * The underlying strings are referenced, not duplicated. * * @param ntsa null-terminated array of strings * @return newly allocate GPtrArray */ GPtrArray * ntsa_to_g_ptr_array(Null_Terminated_String_Array ntsa) { int len = ntsa_length(ntsa); GPtrArray * garray = g_ptr_array_sized_new(len); int ndx; for (ndx=0; ndxlen+1, sizeof(char *)); for (int ndx=0; ndx < gparray->len; ndx++) { ntsa[ndx] = g_ptr_array_index(gparray,ndx); } return ntsa; } /** Converts an ASCII string to upper case. The original string is converted in place. * * @param s string to force to upper case * * @return converted string */ char * strupper(char * s) { if (s) { // check s not a null pointer char * p = s; while(*p) { *p = toupper(*p); p++; } } return s; } /** Creates an upper case copy of an ASCII string * * Arguments: * @param s string to copy * @return newly allocated string, NULL if s is NULL */ char * strdup_uc(const char* s) { if (!s) return NULL; char * us = strdup( s ); char * p = us; while (*p) {*p=toupper(*p); p++; } return us; } /* Replaces all instances of a character in a string with a different character. * The original string is converted in place. * * Arguments: * s string to force to upper case * * Returns: * s converted string */ char * str_replace_char(char * s, char old_char, char new_char) { if (s) { char * p = s; while (*p) { if (*p == old_char) *p = new_char; p++; } } return s; } /** Concatenates 2 strings into a newly allocated buffer. * * @param s1 first string * @param s2 second string * @return newly allocated string */ char * strcat_new(char * s1, char * s2) { assert(s1); assert(s2); char * result = malloc(strlen(s1) + strlen(s2) + 1); strcpy(result, s1); strcpy(result+strlen(s1), s2); return result; } /** Converts a sequence of characters into a (null-terminated) string. * * @param start pointer to first character * @param len number of characters * * @return newly allocated string, * NULL if start was NULL (is this the most useful behavior?) */ char * chars_to_string(const char * start, int len) { assert(len >= 0); char * strbuf = NULL; if (start) { strbuf = malloc(len+1); memcpy(strbuf, start, len); *(strbuf + len) = '\0'; } return strbuf; } /** Appends a value to a string in a buffer. * * @param buf pointer to character buffer * @param bufsz buffer size * @param sepstr if non-null, separator string to insert * @param nextval value to append * * @retval true string was truncated * @retval false normal append * * @remark * Consider allowing the truncation maker, currently "..." to be * specified as a parameter. */ bool sbuf_append(char * buf, int bufsz, char * sepstr, char * nextval) { assert(buf && (bufsz > 4) ); //avoid handling pathological case bool truncated = false; int seplen = (sepstr) ? strlen(sepstr) : 0; int maxchars = bufsz-1; int newlen = ( strlen(buf) == 0 ) ? strlen(nextval) : ( strlen(buf) + seplen + strlen(nextval)); if (newlen <= maxchars) { if (strlen(buf) > 0 && sepstr) strcat(buf, sepstr); strcat(buf, nextval); } else { if ( strlen(buf) < (maxchars-3) ) strcat(buf, "..."); else strcpy(buf+(maxchars-3), "..."); truncated = true; } return truncated; } // // Integer conversion // /** Converts a string representing an integer to an integer value. * * @param sval string representing an integer * @param p_ival address at which to store integer value * @return true if conversion succeeded, false if it failed * * \remark * If conversion fails, the value pointed to by **p_ival** is unchanged. * @remark * This function wraps system function strtol(), hiding the ugly details. */ bool str_to_int(const char * sval, int * p_ival) { bool debug = false; if (debug) printf("(%s) sval->|%s|\n", __func__, sval); char * endptr; bool ok = false; if ( *sval != '\0') { long result = strtol(sval, &endptr, 10); // printf("(%s) sval=%p, endptr=%p, *endptr=|%c| (0x%02x), result=%ld\n", // __func__, sval, endptr, *endptr, *endptr, result); if (*endptr == '\0') { *p_ival = result; ok = true; } } if (debug) { if (ok) printf("(%s) sval=%s, Returning: %s, *ival = %d\n", __func__, sval, bool_repr(ok), *p_ival); else printf("(%s) sval=%s, Returning: %s\n", __func__, sval, bool_repr(ok)); } return ok; } // // Hex value conversion. // /** Converts a (null terminated) string of 2 hex characters to * its byte value. * * @param s pointer to hex string * @param result pointer to byte in which converted value will be returned * * @return true if successful conversion, * false if string does not consist of hex characters, * or is not 2 characters in length. */ bool hhs_to_byte_in_buf(const char * s, Byte * result) { // printf("(%s) Starting s=%s, strlen(s)=%zd\n", __func__, s, strlen(s) ); // consider changing to fail if len != 2, or perhaps len != 1,2 //assert(strlen(s) == 2); bool ok = true; if (strlen(s) != 2) ok = false; else { char * endptr = NULL; errno = 0; long longtemp = strtol(s, &endptr, 16 ); int errsv = errno; // printf("(%s) After strtol, longtemp=%ld \n", __func__, longtemp ); // printf("errno=%d, s=|%s|, s=0x%02x &s=%p, longtemp = %ld, endptr=%p, *endptr=0x%02x\n", // errsv, s, s, &s, longtemp, endptr,*endptr); // if (*endptr != '\0' || errsv != 0) { if (endptr != s+2 || errsv != 0) { ok = false; } else *result = (Byte) longtemp; } // printf("(%s) Returning ok=%d\n", __func__, ok); return ok; } /** Converts a hex string representing a single byte into its byte value. * This is a more lenient version of hhs_to_byte_in_buf(), allowing * the value to begin with "0x" or "x", or end with "h". The allowed * prefix or suffix is case-insensitive. * * @param s pointer to hex string * @param result pointer to byte in which result will be returned * * @return **true** if successful conversion, * **false** if not */ bool any_one_byte_hex_string_to_byte_in_buf(const char * s, Byte * result) { // printf("(%s) s = |%s|\n", __func__, s); char * suc = strdup_uc(s); char * suc0 = suc; if (str_starts_with(suc, "0X")) suc = suc + 2; else if (*suc == 'X') suc = suc + 1; else if (str_ends_with(suc, "H")) *(suc+strlen(suc)-1) = '\0'; bool ok = hhs_to_byte_in_buf(suc, result); free(suc0); // printf("(%s) returning %d, *result=0x%02x\n", __func__, ok, *result); return ok; } /** Converts 2 hex characters to their corresponding byte value. * The characters need not be null terminated. * * @param p_hh pointer to hex characters. * @param converted pointer go byte in which converted value will be returned * * @return true if successful conversion, false if s does not point * to hex characters */ bool hhc_to_byte_in_buf(const char * p_hh, Byte * converted) { // printf("(%s) Starting p_hh=%.2s \n", __func__, hh ); char hhs[3]; hhs[0] = p_hh[0]; // hhs[1] = cc[1]; // why does compiler complain? hhs[1] = *(p_hh+1); hhs[2] = '\0'; return hhs_to_byte_in_buf(hhs, converted); } #ifdef DEPRECATED /* Converts a (null terminated) string of 2 hex characters to * its byte value. * * Arguments: * s pointer to hex string * * Returns: * byte value * * Execution terminates if invalid hex value. */ Byte hhs_to_byte(char * s) { // printf("(%s) Starting s=%s, strlen(s)=%d \n", __func__, s, strlen(s) ); Byte converted; if (!hhs_to_byte_in_buf(s, &converted)) { // no way to properly signal failure, so terminate execution // don't call a function such as program_logic_error() since this // file should have no dependencies on any other program files. fprintf(stderr, "Invalid hex value: %s", s); // exit(1); // warnings in OBS re exit() in library converted = 0x00; // stick something in there, ugh } return converted; } #endif #ifdef DEPRECATED /* Converts 2 hex characters to a single byte. * * Arguments: * hh address of 2 hex characters, need not be null terminated * * Returns: * byte value * * Execution terminates if invalid hex value. */ Byte hhc_to_byte(char * hh) { // printf("(%s) Starting hh=%.2s \n", __func__, hh ); char hhs[3]; hhs[0] = hh[0]; // hhs[1] = cc[1]; // why does compiler complain? hhs[1] = *(hh+1); hhs[2] = '\0'; return hhs_to_byte(hhs); } #endif /** Converts a string of hex characters (null terminated) to an array of bytes. * * @param hhs string of hex characters * @param pBa address at which to return pointer to byte array * * @retval >= 0 number of bytes in array, * @retval -1 string could not be converted * * If successful, the byte array whose address is returned in pBa has * been malloc'd. It is the responsibility of the caller to free it. */ int hhs_to_byte_array(const char * hhs, Byte** pBa) { if ( strlen(hhs) % 2) // if odd number of characters return -1; char xlate[] = "0123456789ABCDEF"; int bytect = strlen(hhs)/2; Byte * ba = malloc(bytect); bool ok = true; const char * h = hhs; Byte * b = ba; for (; *h && ok; b++) { char ch0 = toupper(*h++); char ch1 = toupper(*h++); char * pos0 = strchr(xlate, ch0); char * pos1 = strchr(xlate, ch1); if (pos0 && pos1) { *b = (pos0-xlate) * 16 + (pos1-xlate); } else { ok = false; } } if (!ok) { free(ba); bytect = -1; } else { *pBa = ba; } return bytect; } #ifdef DEPRECATED void test_one_hhs2Byte(char * hhs) { printf("(%s) Starting. hhs=%s \n", __func__, hhs ); Byte b1 = hhs_to_byte(hhs); printf("(%s) %s -> 0x%02x \n", __func__, hhs, b1 ); } void test_hhs_to_byte() { printf("(%s) Startomg \n", __func__ ); test_one_hhs2Byte("01"); test_one_hhs2Byte("ZZ"); // test_one_hhs2Byte("123"); } #endif /** Converts a sequence of bytes to its representation as a string of hex characters. * * @param bytes pointer to bytes * @param len number of bytes * * @return pointer to newly allocated hex string * * The value returned by this function has been malloc'd. It is the * responsibility of the caller to free the memory. */ char * hexstring(const unsigned char * bytes, int len) { int alloc_size = 3*len + 1; char* str_buf = malloc(alloc_size); int i; for (i = 0; i < len; i++) { // printf("(%s) 3*i = %d, alloc_size-3*i = %d\n", __func__, 3*i, alloc_size-3*i); snprintf(str_buf+3*i, alloc_size-3*i, "%02x ", bytes[i]); } // printf ("(%s) Final null offset: %d\n", __func__, 3*len-1); str_buf[3*len-1] = 0x00; // printf("(%s) Returning: |%s|\n", __func__, str_buf); return str_buf; } /** Converts a sequence of bytes to its representation as a string of hex characters. * * @param bytes pointer to bytes * @param len number of bytes * @param sepstr string to separate each 2 hex character pairs representing a byte, * if NULL then no separators will be inserted * @param uppercase if true, use uppercase hex characters, * if false, use lower case hex characters * @param buffer pointer to buffer in which hex string will be returned, * if NULL, then a buffer will be allocated * @param bufsz size of buffer * if 0, then a buffer will be allocated * * @return pointer to hex string * * If this function allocates a buffer, it is the responsibility of the caller * to free the memory. */ char * hexstring2( const unsigned char * bytes, int len, const char * sepstr, bool uppercase, char * buffer, int bufsz) { // if (len > 1) // printf("(%s) bytes=%p, len=%d, sepstr=|%s|, uppercase=%s, buffer=%p, bufsz=%d\n", __func__, // bytes, len, sepstr, bool_repr(uppercase), buffer, bufsz); int sepsize = 0; if (sepstr) { sepsize = strlen(sepstr); } int required_size = 2*len // hex rep of bytes + (len-1)*sepsize // for separators + 1; // terminating null // if (len > 1) // printf("(%s) required_size=%d\n", __func__, required_size); // special case: if (len == 0) required_size = 1; if (!buffer) bufsz = 0; assert (bufsz == 0 || bufsz >= required_size); if (bufsz == 0) { buffer = malloc(required_size); // printf("(%s) allocate buffer at %p, length=%d\n", __func__, buffer, required_size); } char * pattern = (uppercase) ? "%02X" : "%02x"; int incr1 = 2 + sepsize; int i; if (len == 0) *buffer = '\0'; for (i=0; i < len; i++) { // printf("(%s) i=%d, buffer+i*incr1=%p\n", __func__, i, buffer+i*incr1); sprintf(buffer+i*incr1, pattern, bytes[i]); if (i < (len-1) && sepstr) strcat(buffer, sepstr); } // printf("(%s) strlen(buffer) = %ld, required_size=%d \n", __func__, strlen(buffer), required_size ); // printf("(%s) buffer=|%s|\n", __func__, buffer ); assert(strlen(buffer) == required_size-1); return buffer; } #ifdef DEPRECATED // TODO: replace implementation of hexstring2_t() with call to hexstring3_t() /** Thread safe version of #hexstring2(). * * This function allocates a thread specific buffer in which the * hexstring is built. The buffer is valid until the next call * of this function in the same thread. * * @param bytes pointer to bytes * @param len number of bytes * @param sepstr string to separate each 2 hex character pairs representing a byte, * if NULL then no separators will be inserted * @param uppercase if true, use uppercase hex characters, * if false, use lower case hex characters * * @return pointer to hex string * * Note that if the returned pointer is referenced after another call to * this function, the results are unpredictable. * * This function is intended to simplify formatting of diagnostic messages, since * the caller needn't be concerned with buffer size and allocation. */ char * hexstring2_t_old( const unsigned char * bytes, int len, const char * sepstr, bool uppercase) { static GPrivate hexstring_key = G_PRIVATE_INIT(g_free); char * buf = g_private_get(&hexstring_key); // GThread * this_thread = g_thread_self(); // printf("(%s) this_thread=%p, hexstring_key=%p, buf=%p\n", // __func__, this_thread, &hexstring_key, buf); // TODO: Keep track of buffer size, only reallocate if buffer insufficiently large. // But note that this function is only used for diagnostic messages, so performance // gain is insignificant. if (buf) g_free(buf); // printf("(%s) bytes=%p, len=%d, sepstr=|%s|, uppercase=%s\n", __func__, // bytes, len, sepstr, bool_repr(uppercase)); int sepsize = 0; if (sepstr) { sepsize = strlen(sepstr); } int required_size = 1; // special case if len == 0 if (len > 0) required_size = 2*len // hex rep of bytes + (len-1)*sepsize // for separators + 1; // terminating null // printf("(%s) required_size=%d\n", __func__, required_size); buf = g_new(char, required_size); // printf("(%s) Calling g_private_set()\n", __func__); g_private_set(&hexstring_key, buf); // hexstring2(bytes, len, sepstr, uppercase, buf, required_size); char * pattern = (uppercase) ? "%02X" : "%02x"; int incr1 = 2 + sepsize; if (len == 0) *buf = '\0'; for (int i=0; i < len; i++) { // printf("(%s) i=%d, buffer+i*incr1=%p\n", __func__, i, buffer+i*incr1); sprintf(buf+i*incr1, pattern, bytes[i]); if (i < (len-1) && sepstr) strcat(buf, sepstr); } // printf("(%s) strlen(buffer) = %ld, required_size=%d \n", __func__, strlen(buffer), required_size ); // printf("(%s) buffer=|%s|\n", __func__, buffer ); assert(strlen(buf) == required_size-1); return buf; } #endif #ifdef DEPRECATED char * hexstring2_t( const unsigned char * bytes, int len, const char * sepstr, bool uppercase) { return hexstring3_t(bytes, len, sepstr, 1, uppercase); } #endif /** Thread safe version of #hexstring2(). * * This function allocates a thread specific buffer in which the hex string is built. * The buffer is valid until the next call of this function in the same thread. * * @param bytes pointer to bytes * @param len number of bytes * @param sepstr string to separate each segment of 2 hex character pairs representing bytes * if NULL then no separators will be inserted * @param hunk_size separator string frequency * @param uppercase if true, use uppercase hex characters, * if false, use lower case hex characters * * @return pointer to hex string * * Note that if the returned pointer is referenced after another call to * this function, the results are unpredictable. * * This function is intended to simplify formatting of diagnostic messages, since * the caller needn't be concerned with buffer size and allocation. */ char * hexstring3_t( const unsigned char * bytes, // bytes to convert int len, // number of bytes const char * sepstr, // separator string between hex digits uint8_t hunk_size, // separator string frequency bool uppercase) // use upper case hex characters { static GPrivate hexstring3_key = G_PRIVATE_INIT(g_free); static GPrivate hexstring3_len_key = G_PRIVATE_INIT(g_free); #ifdef OLD char * buf = g_private_get(&hexstring3_key); int * bufsz_ptr = g_private_get(&hexstring3_len_key); GThread * this_thread = g_thread_self(); printf("(%s) this_thread=%p, hexstring3_key=%p, buf=%p, hexstring3_len_key=%p, bufsz_ptr=%p\n", __func__, this_thread, &hexstring3_key, buf, &hexstring3_len_key, bufsz_ptr); if (bufsz_ptr) printf("(%s) *bufsz_ptr = %d\n", __func__, *bufsz_ptr); // TODO: Keep track of buffer size, only reallocate if buffer insufficiently large. // But note that this function is only used for diagnostic messages, so performance // gain is insignificant. // unnecessary if use g_private_replace() instead of g_private_set() // if (buf) // g_free(buf); #endif // printf("(%s) bytes=%p, len=%d, sepstr=|%s|, uppercase=%s\n", __func__, // bytes, len, sepstr, bool_repr(uppercase)); if (hunk_size == 0) sepstr = NULL; else if (sepstr == NULL) hunk_size = 0; int sepsize = 0; if (sepstr) { sepsize = strlen(sepstr); } int required_size = 1; // special case if len == 0 // excessive if hunk_size > 1, but not worth the effort to be accurate if (len > 0) required_size = 2*len // hex rep of bytes + (len-1)*sepsize // for separators + 1; // terminating null // printf("(%s) sepstr=|%s|, hunk_size=%d, required_size=%d\n", __func__, sepstr, hunk_size, required_size); #ifdef OLD if ( !bufsz_ptr || *bufsz_ptr < required_size) { buf = g_new(char, required_size); // printf("(%s) Calling g_private_set()\n", __func__); g_private_replace(&hexstring3_key, buf); if (!bufsz_ptr) { bufsz_ptr = g_new(int, 1); g_private_set(&hexstring3_len_key, bufsz_ptr); } *bufsz_ptr = required_size; } #endif char * buf = get_thread_dynamic_buffer(&hexstring3_key, &hexstring3_len_key, required_size); // char * buf = get_thread_private_buffer(&hexstring3_key, NULL, required_size); char * pattern = (uppercase) ? "%02X" : "%02x"; // int incr1 = 2 + sepsize; *buf = '\0'; for (int i=0; i < len; i++) { // printf("(%s) i=%d, strlen(buf)=%ld\n", __func__, i, strlen(buf)); sprintf(buf+strlen(buf), pattern, bytes[i]); bool insert_sepstr = (hunk_size == 0) ? (i < (len-1) && sepstr) : (i < (len-1) && sepstr && (i+1)%hunk_size == 0); if (insert_sepstr) strcat(buf, sepstr); } // printf("(%s) strlen(buffer) = %ld, required_size=%d \n", __func__, strlen(buffer), required_size ); // printf("(%s) buffer=|%s|\n", __func__, buffer ); assert(strlen(buf) <= required_size-1); // printf("(%s) Returning: %p\n", __func__, buf); return buf; } char * hexstring_t( const unsigned char * bytes, int len) { return hexstring3_t(bytes, len, " ", 1, false); } /** Dump a region of memory as hex characters and their ASCII values. * The output is indented by the specified number of spaces. * * @param fh where to write output, if NULL, write nothing * @param data start of region to show * @param size length of region * @param indents number of spaces to indent the output */ void fhex_dump_indented(FILE * fh, const Byte* data, int size, int indents) { if (fh) { int i; // index in data... int j; // index in line... char temp[8]; char buffer[128]; char *ascii; char indentation[100]; snprintf(indentation, 100, "%*s", indents, ""); memset(buffer, 0, 128); // printf("\n"); // Printing the ruler... fprintf(fh, "%s +0 +4 +8 +c 0 4 8 c \n", indentation); ascii = buffer + 58; memset(buffer, ' ', 58 + 16); buffer[58 + 16] = '\n'; buffer[58 + 17] = '\0'; buffer[0] = '+'; buffer[1] = '0'; buffer[2] = '0'; buffer[3] = '0'; buffer[4] = '0'; for (i = 0, j = 0; i < size; i++, j++) { if (j == 16) { fprintf(fh, "%s%s", indentation, buffer); memset(buffer, ' ', 58 + 16); sprintf(temp, "+%04x", i); memcpy(buffer, temp, 5); j = 0; } sprintf(temp, "%02x", 0xff & data[i]); memcpy(buffer + 8 + (j * 3), temp, 2); if ((data[i] > 31) && (data[i] < 127)) ascii[j] = data[i]; else ascii[j] = '.'; } if (j != 0) fprintf(fh, "%s%s", indentation, buffer); } } /** Dump a region of memory as hex characters and their ASCII values. * Output is written to the location specified by parameter fh. * * @param fh where to write output * @param data start of region to show * @param size length of region */ void fhex_dump(FILE * fh, const Byte* data, int size) { fhex_dump_indented(fh, data, size, 0); } /** Dump a region of memory as hex characters and their ASCII values. * Output is written to stdout. * * @param data start of region to show * @param size length of region */ void hex_dump(const Byte* data, int size) { fhex_dump(stdout, data, size); } /** Extension of fputc() that allows a NULL stream argument, * in which case no output is written. * * @param c character to write * @param stream if null do nothing * * @return result of underlying fputs(), or 0 if stream is NULL */ int f0putc(int c, FILE * stream) { int rc = 0; if (stream) rc = fputc(c, stream); return rc; } /** Extension of fputs() that allows a NULL stream argument, * in which case no output is written. * * @param msg text to write * @param stream if null do nothing * * @return result of underlying fputs(), or 0 if stream is NULL */ int f0puts(const char * msg, FILE * stream) { int rc = 0; if (stream) rc = fputs(msg, stream); return rc; } /** Extension of fprintf() that allows a NULL stream argument, * in which case no output is written. * * @param stream if null do nothing * @param format format string * * @return result of underlying vfprintf(), or 0 if stream is NULL */ int f0printf(FILE * stream, const char * format, ...) { int rc = 0; // printf("(%s) stream=%p\n", __func__, stream); if (stream) { va_list(args); va_start(args, format); rc = vfprintf(stream, format, args); va_end(args); } return rc; } /** Extension of vfprintf() that allows a NULL stream argument, * in which case no output is written. * * @param stream if null do nothing * @param format format string * @param ap pointer to variable argument list * * @return result of underlying vfprintf(), or 0 if stream is NULL */ int vf0printf(FILE * stream, const char * format, va_list ap) { int rc = 0; if (stream) rc = vfprintf(stream, format, ap); return rc; } // // Miscellaneous // /** Tests if a range of bytes is entirely 0 * * @param bytes pointer to first byte * @param bytect number of bytes * @return **true** if all bytes are zero, **false** if not */ bool all_bytes_zero(Byte * bytes, int bytect) { Byte sum = 0; for (int ndx=0; ndx < bytect; ndx++) { sum |= bytes[ndx]; } return !sum; } // Private version of strcasestr(), avoids needing to set _GNU_SOURCE char * ascii_strcasestr(const char * haystack, const char * needle) { char * result = NULL; if (haystack && needle) { char * uhaystack = g_ascii_strup(haystack, /*len=*/ -1); // -1: null-terminated char * uneedle = g_ascii_strup(needle, /*len=*/ -1); // -1: null-terminated char * ustart = strstr(uhaystack, uneedle); if (ustart) { int offset = ustart-uhaystack; char * h2 = (char *) haystack; // cast to avoid warning re discarding const qualifier result = h2+offset; } free(uhaystack); free(uneedle); } return result; } // Belongs in some more general file. where? string_util.c, data_structures.c? // Idea: allow for option to treat terms as regular expressions // convert parm ignore_case into a flags byte of options bool apply_filter_terms(const char * text, char ** terms, bool ignore_case) { assert(text); bool debug = false; bool result = true; char ** term = NULL; if (terms) { // printf("(%s) filter_terms:\n", __func__); // ntsa_show(terms); result = false; term = terms; while (*term) { // printf("(%s) Comparing |%s|\n", __func__, *term); if (ignore_case) { // if (strcasestr(text,*term)) { if (ascii_strcasestr(text,*term)) { result = true; break; } } else { if (strstr(text, *term)) { result = true; break; } } term++; } } if (debug) { if (result) { printf("(%s) text=|%s|, term=|%s|, Returning: true\n", __func__, text, *term); } else { printf("(%s) text=|%s|, Returning: false\n", __func__, text); } } return result; } ddcutil-0.8.6/src/util/sysfs_util.c0000644000175000001440000001571613212244277014224 00000000000000/* sysfs_util.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Functions for reading /sys file system */ #include #include #include #include #include #include #include "file_util.h" #include "string_util.h" #include "sysfs_util.h" /** Reads a /sys attribute file, which is 1 line of text * * \param dirname directory name * \param attrname attribute name, i.e. file name * \param verbose if true, write message to stderr if unable to open file * \return pointer to attribute value string, caller is responsible for freeing */ char * read_sysfs_attr( const char * dirname, const char * attrname, bool verbose) { char fn[PATH_MAX]; sprintf(fn, "%s/%s", dirname, attrname); return file_get_first_line(fn, verbose); } /** Reads a /sys attribute file, which is 1 line of text. * If the attribute is not found, returns a default value * * \param dirname directory name * \param attrname attribute name, i.e. file name * \param default_value default value, duplicated * \param verbose if true, write message to stderr if unable to open file * \return pointer to attribute value string, caller is responsible for freeing */ char * read_sysfs_attr_w_default( const char * dirname, const char * attrname, const char * default_value, bool verbose) { char fn[PATH_MAX]; sprintf(fn, "%s/%s", dirname, attrname); char * result = file_get_first_line(fn, verbose); if (!result) result = strdup(default_value); // strdup() so caller can free any result return result; } char * read_sysfs_attr_w_default_r( const char * dirname, const char * attrname, const char * default_value, char * buf, unsigned bufsz, bool verbose) { char fn[PATH_MAX]; sprintf(fn, "%s/%s", dirname, attrname); char * result = file_get_first_line(fn, verbose); if (result) { g_strlcpy(buf, result, bufsz); free(result); } else { g_strlcpy(buf, default_value, bufsz); } return buf; } /** Reads a binary /sys attribute file * * \param dirname directory name * \param attrname attribute name, i.e. file name * \param est_size estimated size * \param verbose if open fails, write message to stderr * \return if successful, a **GByteArray** of bytes, caller is responsible for freeing * if failure, then NULL */ GByteArray * read_binary_sysfs_attr( const char * dirname, const char * attrname, int est_size, bool verbose) { assert(dirname); assert(attrname); char fn[PATH_MAX]; sprintf(fn, "%s/%s", dirname, attrname); return read_binary_file(fn, est_size, verbose); } /** Looks in the /sys file system to check if a module is loaded. * * \param module_name module name * \return true if the module is loaded, false if not */ bool is_module_loaded_using_sysfs( const char * module_name) { bool debug = false; struct stat statbuf; char module_fn[100]; bool found = false; snprintf(module_fn, sizeof(module_fn), "/sys/module/%s", module_name); int rc = stat(module_fn, &statbuf); if (rc < 0) { // will be ENOENT (2) if file not found found = false; } else { // if (S_ISDIR(statbuf.st_mode)) // pointless found = true; } if (debug) printf("(%s) module_name = %s, returning %d", __func__, module_name, found); return found; } // The following functions would more properly be located in a file in base, // as they are not really generic sysfs utilities, but in the interest of // not proliferating files they are included here. /** Gets the sysfs name of an I2C device, * i.e. the value of /sys/bus/in2c/devices/i2c-n/name * * \param busno I2C bus number * \return newly allocated string containing attribute value, * NULL if not found * * \remark * Caller is responsible for freeing returned value */ char * get_i2c_device_sysfs_name(int busno) { char workbuf[50]; snprintf(workbuf, 50, "/sys/bus/i2c/devices/i2c-%d/name", busno); char * name = file_get_first_line(workbuf, /*verbose */ false); // DBGMSG("busno=%d, returning: %s", busno, bool_repr(result)); return name; } #ifdef UNUSED static bool is_smbus_device_using_sysfs(int busno) { #ifdef OLD char workbuf[50]; snprintf(workbuf, 50, "/sys/bus/i2c/devices/i2c-%d/name", busno); char * name = file_get_first_line(workbuf, /*verbose */ false); #endif char * name = get_i2c_device_sysfs_name(busno); bool result = false; if (name && str_starts_with(name, "SMBus")) result = true; free(name); // DBGMSG("busno=%d, returning: %s", busno, bool_repr(result)); return result; } #endif bool ignorable_i2c_device_sysfs_name(const char * name) { bool result = false; const char * ignorable_prefixes[] = { "SMBus", "soc:i2cdsi", "smu", // Mac G5, probing causes system hang "mac-io", // Mac G5 "u4", // Mac G5 NULL }; if (name) { #ifdef OLD if (str_starts_with(name, "SMBus")) result = true; else if (streq(name, "soc:i2cdsi")) // Raspberry Pi result = true; #endif if (starts_with_any(name, ignorable_prefixes) >= 0) result = true; } // printf("(%s) name=|%s|, returning: %s\n", __func__, name, bool_repr(result)); return result; } /** Checks if an I2C bus cannot be a DDC/CI connected monitor * and therefore can be ignored, e.g. if it is an SMBus device. * * \param busno I2C bus number * \return true if ignorable, false if not * * \remark * This function avoids unnecessary calls to i2cdetect, which can be * slow for SMBus devices and fills the system logs with errors */ bool is_ignorable_i2c_device(int busno) { bool result = false; char * name = get_i2c_device_sysfs_name(busno); if (name) result = ignorable_i2c_device_sysfs_name(name); // printf("(%s) busno=%d, name=|%s|, returning: %s\n", __func__, busno, name, bool_repr(result)); free(name); // safe if NULL return result; } ddcutil-0.8.6/src/util/subprocess_util.c0000644000175000001440000001741213203271475015240 00000000000000/* subprocess_util.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file subprocess_util.c * Functions to execute shell commands */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "glib_util.h" #include "report_util.h" #include "string_util.h" #include "subprocess_util.h" /** Executes a shell command and writes the output to the current report destination * or to stdout. * * @param shell_cmd command to execute * @param depth logical report indentation depth, * if < 0, write to stdout * * @return true command succeeded * false failed, e.g. command not found */ bool execute_shell_cmd_rpt(char * shell_cmd, int depth) { bool debug = false; if (debug) printf("(%s) Starting. shell_cmd = |%s|\n", __func__, shell_cmd); bool ok = true; FILE * fp; char cmdbuf[200]; snprintf(cmdbuf, sizeof(cmdbuf), "(%s) 2>&1", shell_cmd); // printf("(%s) cmdbuf=|%s|\n", __func__, cmdbuf); fp = popen(cmdbuf, "r"); // printf("(%s) open. errno=%d\n", __func__, errno); if (!fp) { // int errsv = errno; printf("Unable to execute command \"%s\": %s\n", shell_cmd, strerror(errno)); ok = false; } else { char * a_line = NULL; size_t len = 0; ssize_t read; bool first_line = true; while ( (read=getline(&a_line, &len, fp)) != -1) { if (strlen(a_line) > 0) { // printf("(%s) a_line: |%s|\n", __func__, a_line); int ch = a_line[strlen(a_line)-1]; if (debug) { if (ch != '\n') printf("(%s) Truncating character '%c' (0x%02x)\n", __func__, ch, ch); // else // printf("(%s) Truncating expected NL (0x%02x)\n", __func__, ch); } a_line[strlen(a_line)-1] = '\0'; } else printf("(%s) Zero length line\n", __func__); if (first_line) { if (str_ends_with(a_line, "not found")) { // printf("(%s) found \"not found\"\n", __func__); ok = false; break; } first_line = false; } if (debug && !str_all_printable(a_line)) { printf("(%s) String contains non-printable character!\n", __func__); } // printf("%s", "\n"); // solves the missing line problem, but why? if (depth < 0) { fputs(a_line, stdout); fputs("\n", stdout); } else { // n. output will be sent to current rpt_ dest ! rpt_title(a_line, depth); } // free(a_line); } int pclose_rc = pclose(fp); int errsv = errno; if (debug) printf("(%s) plose() rc=%d, error=%d - %s\n", __func__, pclose_rc, errsv, strerror(errsv)); } return ok; } /** Executes a shell command and writes the output to stdout. * * @param shell_cmd command to execute * * @return true command succeeded * false failed, e.g. command not found */ bool execute_shell_cmd(char * shell_cmd) { return execute_shell_cmd_rpt(shell_cmd, -1); } /** Executes a shell command and returns the output as an array of strings. * * @param shell_cmd command to execute * * @return :GPtrArray of response lines if command succeeded * NULL if command failed, e.g. command not found */ GPtrArray * execute_shell_cmd_collect(char * shell_cmd) { bool debug = false; GPtrArray * result = g_ptr_array_new(); // TO DO: set free func if (debug) printf("(%s) Starting. shell_cmd = |%s|", __func__, shell_cmd); bool ok = true; FILE * fp; char cmdbuf[200]; snprintf(cmdbuf, sizeof(cmdbuf), "(%s) 2>&1", shell_cmd); // printf("(%s) cmdbuf=|%s|\n", __func__, cmdbuf); fp = popen(cmdbuf, "r"); // printf("(%s) open. errno=%d\n", __func__, errno); if (!fp) { // int errsv = errno; fprintf(stderr, "Unable to execute command \"%s\": %s\n", shell_cmd, strerror(errno)); ok = false; } else { char * a_line = NULL; size_t len = 0; ssize_t read; bool first_line = true; while ( (read=getline(&a_line, &len, fp)) != -1) { if (strlen(a_line) > 0) a_line[strlen(a_line)-1] = '\0'; if (first_line) { if (str_ends_with(a_line, "not found")) { // printf("(%s) found \"not found\"\n", __func__); ok = false; break; } first_line = false; } g_ptr_array_add(result, strdup(a_line)); } int pclose_rc = pclose(fp); if (debug) printf("(%s) plose() rc = %d\n", __func__, pclose_rc); } if (!ok) { g_ptr_array_free(result, true); result = NULL; } return result; } /** Executes a shell command that always outputs a single line and returns the * output as a newly allocated character string * * @param shell_cmd command to execute * * @return :response if command succeeded * NULL if command failed, e.g. command not found * * @remark * Caller is responsible for freeing the returned string. */ char * execute_shell_cmd_one_line_result(char * shell_cmd) { char * result = NULL; GPtrArray * response = execute_shell_cmd_collect(shell_cmd); if (response) { result = strdup(g_ptr_array_index(response, 0)); g_ptr_array_free(response, true); } return result; } /** Tests if a command is found in path * * @param cmd command name * * @return true/false * * TODO: Check that actually executable, * e.g. could be in /sbin and not running privileged */ bool is_command_in_path(char * cmd) { bool result = false; char shell_cmd[100]; snprintf(shell_cmd, sizeof(shell_cmd), "which %s", cmd); GPtrArray * resp = execute_shell_cmd_collect(shell_cmd); if (resp) { if (resp->len > 0) result = true; g_ptr_array_free(resp, true); } return result; } /** Tests if a command is executable. * * \param cmd command to test execute * \retval 0 ok * \retval 127 command not found * \retval 2 command requires sudo * \retval 1 command executed, but with some error */ int test_command_executability(char * cmd) { assert(cmd); char * full_cmd = calloc(1, strlen(cmd) + 20); strcpy(full_cmd, cmd); strcat(full_cmd, ">/dev/null 2>&1"); // printf("(%s) cmd: |%s|, full_cmd: |%s|\n", __func__, cmd, full_cmd); int rc = system(full_cmd); // printf("(%s) system(%s) returned: %d, %d, %d\n", __func__, full_cmd, rc, WIFEXITED(rc), WEXITSTATUS(rc)); free(full_cmd); // 0 ok // 127 command not found // 2 on dmidecode - not running sudo // 2 on i2cdetect - not sudo // 1 on i2cdetect - sudo, but some error return WEXITSTATUS(rc); } ddcutil-0.8.6/src/util/timestamp.c0000644000175000001440000001403513203271475014014 00000000000000/* timestamp.c * * Created on: Mar 12, 2017 * Author: rock * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Timestamp Management */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "glib_util.h" #include "string_util.h" #include "timestamp.h" // // Timestamp Generation // /** For debugging timestamp generation, maintain a timestamp history. */ bool tracking_timestamps = false; // set true to enable timestamp history #define MAX_TIMESTAMPS 1000 // static long timestamp[MAX_TIMESTAMPS]; static int timestamp_ct = 0; static uint64_t * timestamp_history = NULL; /** Returns the current value of the realtime clock in nanoseconds. * * @return timestamp, in nanoseconds * * @remark * If debugging timestamp generation, the timestamp is remembered. */ uint64_t cur_realtime_nanosec() { // on Pi, __time_t resolves to long int struct timespec tvNow; clock_gettime(CLOCK_REALTIME, &tvNow); // long result = (tvNow.tv_sec * 1000) + (tvNow.tv_nsec / (1000 * 1000) ); // milliseconds // long result = (tvNow.tv_sec * 1000 * 1000) + (tvNow.tv_nsec / 1000); // microseconds // wrong on 32 // uint64_t result0 = tvNow.tv_sec * (1000 * 1000 * 1000) + tvNow.tv_nsec; // NANOSEC // printf("(%s) result0=%"PRIu64"\n", __func__, result0); // wrong on 32 // uint64_t result1 = tvNow.tv_sec * (1000 * 1000 * 1000); // printf("(%s) result1=%"PRIu64"\n", __func__, result1); // ok uint64_t result = tvNow.tv_sec * (uint64_t)(1000*1000*1000); // printf("(%s) result=%"PRIu64"\n", __func__, result); // ok // uint64_t result3 = tvNow.tv_sec * (uint64_t)1000000000; // printf("(%s) result3=%"PRIu64"\n", __func__, result3); // wrong value on 32 bit // uint64_t result4 = tvNow.tv_sec * (uint64_t)1000000000 + tvNow.tv_sec; // printf("(%s) result4=%"PRIu64"\n", __func__, result4); // wrong value on 32 bit // uint64_t result6 = (tvNow.tv_sec * (uint64_t)1000000000) + (uint64_t)tvNow.tv_sec; // printf("(%s) result6=%"PRIu64"\n", __func__, result6); // uint64_t result2 = tvNow.tv_sec; // printf("(%s) result2=%"PRIu64"\n", __func__, result2); // result2 *= (1000*1000*1000); // printf("(%s) result2=%"PRIu64"\n", __func__, result2); // must do addition separately on 32 bit, ow. get bad value result += tvNow.tv_nsec; // printf("(%s) result=%"PRIu64"\n", __func__, result); if (tracking_timestamps && timestamp_ct < MAX_TIMESTAMPS) { if (!timestamp_history) { timestamp_ct = 0; timestamp_history = calloc(MAX_TIMESTAMPS, sizeof(uint64_t)); } timestamp_history[timestamp_ct++] = result; } // printf("(%s) tv_sec=%ld, tv_nsec=%10ld, Returning: %"PRIu64"\n", // __func__, tvNow.tv_sec, tvNow.tv_nsec, result); return result; } /** Reports history of generated timestamps * * @remark * This is a debugging function. */ void show_timestamp_history() { if (tracking_timestamps && timestamp_history) { // n. DBGMSG writes to FOUT printf("Total timestamps: %d\n", timestamp_ct); bool monotonic = true; int ctr = 0; for (; ctr < timestamp_ct; ctr++) { printf(" timestamp[%d] = %15" PRIu64 "\n", ctr, timestamp_history[ctr] ); if (ctr > 0 && timestamp_history[ctr] <= timestamp_history[ctr-1]) { printf(" !!! NOT STRICTLY MONOTONIC !!!\n"); monotonic = false; } } printf("Timestamps are%s strictly monotonic\n", (monotonic) ? "" : " NOT"); } else printf("Not tracking timestamps\n"); } static uint64_t initial_timestamp_nanos = 0; /** Returns the elapsed time in nanoseconds since the start of * program execution. * * The first call to this function marks the start of program * execution and returns 0. * * @return nonoseconds since start of program execution */ uint64_t elapsed_time_nanosec() { // printf("(%s) initial_timestamp_nanos=%"PRIu64"\n", __func__, initial_timestamp_nanos); uint64_t cur_nanos = cur_realtime_nanosec(); if (initial_timestamp_nanos == 0) initial_timestamp_nanos = cur_nanos; uint64_t result = cur_nanos - initial_timestamp_nanos; // printf("(%s) Returning: %"PRIu64"\n", __func__, result); return result; } /** Returns the elapsed time since start of program execution * as a formatted, printable string. * * The string is built in a thread specific private buffer. The returned * string valid until the next call of this function in the same thread. * * @return formatted elapsed time */ char * formatted_elapsed_time() { static GPrivate formatted_elapsed_time_key = G_PRIVATE_INIT(g_free); char * elapsed_buf = get_thread_fixed_buffer(&formatted_elapsed_time_key, 40); uint64_t et_nanos = elapsed_time_nanosec(); uint64_t isecs = et_nanos/ (1000 * 1000 * 1000); uint64_t imillis = et_nanos/ (1000 * 1000); // printf("(%s) et_nanos=%"PRIu64", isecs=%"PRIu64", imillis=%"PRIu64"\n", __func__, et_nanos, isecs, imillis); snprintf(elapsed_buf, 40, "%3"PRIu64".%03"PRIu64"", isecs, imillis - (isecs*1000) ); // printf("(%s) |%s|\n", __func__, elapsed_buf); return elapsed_buf; } ddcutil-0.8.6/src/util/udev_i2c_util.c0000644000175000001440000002113113211165451014534 00000000000000/* udev_i2c_util.c * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * I2C specific udev utilities */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "report_util.h" #include "string_util.h" #include "sysfs_util.h" #include "udev_util.h" #include "udev_i2c_util.h" // // UDEV Inquiry // // Create, report, query, and destroy a list of summaries of UDEV I2C devices // #ifdef REFERENCE #define UDEV_DEVICE_SUMMARY_MARKER "UDSM" typedef struct udev_device_summary { char marker[4]; const char * sysname; const char * devpath; const char * sysattr_name; } Udev_Device_Summary; #endif /* Extract the i2c bus number from a device summary. * * Helper function for get_i2c_devices_using_udev() * * \param pointer to Udev_Device_Summary * \return I2C bus number from sysname attribute, -1 if unable to parse */ int udev_i2c_device_summary_busno(Udev_Device_Summary * summary) { int result = -1; // On Raspbian, not all sysattr names have the form i2c-n. if (str_starts_with(summary->sysname, "i2c-")) { const char * sbusno = summary->sysname+4; // DBGMSG("sbusno = |%s|", sbusno); int ibusno; bool ok = str_to_int(sbusno, &ibusno); if (ok) result = ibusno; } // DBGMSG("sysname=|%s|. Returning: %d", summary->sysname, result); return result; } /* Compare 2 udev device summaries of I2C devices by their I2C bus number * * Helper function for get_i2c_devices_using_udev() */ static int compare_udev_i2c_device_summary(const void * a, const void * b) { Udev_Device_Summary * p1 = *(Udev_Device_Summary**) a; Udev_Device_Summary * p2 = *(Udev_Device_Summary**) b; assert( p1 && (memcmp(p1->marker, UDEV_DEVICE_SUMMARY_MARKER, 4) == 0)); assert( p2 && (memcmp(p2->marker, UDEV_DEVICE_SUMMARY_MARKER, 4) == 0)); int v1 = udev_i2c_device_summary_busno(p1); int v2 = udev_i2c_device_summary_busno(p2); int result = (v1 == v2) ? 0 : (v1 < v2) ? -1 : 1; // DBGMSG("v1=%d, v2=%d, returning: %d", v1, v2, result); return result; } /** Returns array of Udev_Device_Summary for I2C devices found by udev, * sorted by bus number. * * \return array of #Udev_Device_Summary */ GPtrArray * get_i2c_devices_using_udev() { GPtrArray * summaries = summarize_udev_subsystem_devices("i2c-dev"); assert(summaries); if (summaries->len > 1) { g_ptr_array_sort(summaries, compare_udev_i2c_device_summary); } return summaries; } /** Reports a collection of #Udev_Device_Summary for I2C devices in table form. * * summaries array of #Udev_Device_Summary * title title line * depth logical indentation depth */ void report_i2c_udev_device_summaries(GPtrArray * summaries, char * title, int depth) { rpt_vstring(0,title); if (!summaries || summaries->len == 0) rpt_vstring(depth,"No devices detected"); else { rpt_vstring(depth,"%-11s %-10s %-35s %s", "Subsystem", "Sysname", "Sysattr Name", "Devpath"); for (int ndx = 0; ndx < summaries->len; ndx++) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); assert( memcmp(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4) == 0); // udev_i2c_device_summary_busno(summary); // ??? rpt_vstring(depth,"%-11s %-10s %-35s %s", summary->subsystem, summary->sysname, summary->sysattr_name, summary->devpath); } } } #ifdef NOT_WORTH_IT GPtrArray * get_i2c_smbus_devices_using_udev() { bool debug = false; GPtrArray * summaries = get_i2c_devices_using_udev(); if (summaries) { for (int ndx = summaries->len-1; ndx >= 0; ndx--) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); assert(memcmp(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4) == 0); if ( !str_starts_with(summary->sysattr_name, "SMBus") ) { // TODO: g_ptr_array_set_free_function() must already have been called g_ptr_array_remove_index(summaries, ndx); } } } if (debug) report_i2c_udev_device_summaries(summaries, "I2C SMBus Devices:", 0); return summaries; } #endif #ifdef UNUSED /** Given a specified I2C bus number, checks a list of I2C device * summaries to see if it is the bus number of a SMBUS device. * * \param summaries array of Udev_Device_Summary * \param sbusno I2C bus number, as string * * \return **true** if the number is that of an SMBUS device, **false* if not */ bool is_smbus_device_summary(GPtrArray * summaries, char * sbusno) { bool debug = false; char devname [10]; snprintf(devname, sizeof(devname), "i2c-%s", sbusno); // DBGMSF(debug, "sbusno=|%s|, devname=|%s|", sbusno, devname); if (debug) printf("(%s) sbusno=|%s|, devname=|%s|\n", __func__, sbusno, devname); bool result = false; for (int ndx = 0; ndx < summaries->len; ndx++) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); if ( streq(summary->sysname, devname) && str_starts_with(summary->sysattr_name, "SMBus") ) { result = true; break; } } // DBGMSF(debug, "Returning: %s", bool_repr(result), result); if (debug) printf("(%s) Returning: %s", __func__, bool_repr(result)); return result; } #endif /** Gets the numbers of all non-SMBus I2C devices * * \param include_ignorable_devices if true, do not exclude SMBus devices * \return sorted #Byte_Value_Array of I2C device numbers */ Byte_Value_Array get_i2c_device_numbers_using_udev(bool include_ignorable_devices) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); Byte_Value_Array bva = bva_create(); GPtrArray * summaries = get_i2c_devices_using_udev(); if (summaries) { for (int ndx = 0; ndx < summaries->len; ndx++) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); if ( !include_ignorable_devices && ignorable_i2c_device_sysfs_name(summary->sysattr_name) ) continue; int busno = udev_i2c_device_summary_busno(summary); assert(busno >= 0); assert(busno <= 127); bva_append(bva, busno); } g_ptr_array_free(summaries, true); } if (debug) bva_report(bva, "Returning I2c bus numbers:"); return bva; } /** Gets the bus numbers of I2C devices reported by UDEV, * optionally filtered by the sys attribute name (e.g. to eliminate SMBus devices). * * \param keep_func predicate function * \return sorted #Byte_Value_Array of I2C device numbers * * \remark * ***keep_func*** takes a bus number as its sole argument, * returning true iff the number should be included * \remark, * if the udev sysname value does not have the form i2c-n, * the udev node is ignored * \remark * if ***keep_func*** is NULL, all device numbers * are included, i.e. there is no filtering */ Byte_Value_Array get_i2c_device_numbers_using_udev_w_sysattr_name_filter(Sysattr_Name_Filter keep_func) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); Byte_Value_Array bva = bva_create(); GPtrArray * summaries = get_i2c_devices_using_udev(); if (summaries) { for (int ndx = 0; ndx < summaries->len; ndx++) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); bool keep = true; if (keep_func) keep = keep_func(summary->sysattr_name); if (keep) { int busno = udev_i2c_device_summary_busno(summary); if (busno >= 0) { // -1 if parse error assert(busno <= 127); bva_append(bva, busno); } } } g_ptr_array_free(summaries, true); } if (debug) bva_report(bva, "Returning I2c bus numbers:"); return bva; } ddcutil-0.8.6/src/util/udev_usb_util.c0000644000175000001440000004027013107075377014670 00000000000000/* udev_usb_util.c * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * USB specific udev utility functions */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "report_util.h" #include "string_util.h" #include "udev_util.h" #include "udev_usb_util.h" Usb_Detailed_Device_Summary * new_usb_detailed_device_summary() { Usb_Detailed_Device_Summary * devsum = calloc(1, sizeof(Usb_Detailed_Device_Summary)); memcpy(devsum->marker, UDEV_DETAILED_DEVICE_SUMMARY_MARKER, 4); return devsum; } /** Frees a Usb_Detailed_Device_Summary. * All underlying memory is released. * * @param devsum pointer to **Usb_Detailed_Device_Summary** */ void free_usb_detailed_device_summary(Usb_Detailed_Device_Summary * devsum) { if (devsum) { assert( memcmp(devsum->marker, UDEV_DETAILED_DEVICE_SUMMARY_MARKER, 4) == 0); free(devsum->devname); free(devsum->vendor_id); free(devsum->product_id); free(devsum->vendor_name); free(devsum->product_name); free(devsum->busnum_s); free(devsum->devnum_s); free(devsum); } } /** Reports a Usb_Detailed_Device_Summary instance. * * @param devsum pointer to **Usb_Detailed_Device_Summary** * @param depth logical indentation depth */ void report_usb_detailed_device_summary(Usb_Detailed_Device_Summary * devsum, int depth) { assert( devsum && (memcmp(devsum->marker, UDEV_DETAILED_DEVICE_SUMMARY_MARKER, 4) == 0)); rpt_structure_loc("Usb_Detailed_Device_Summary", devsum, depth); int d1 = depth+1; rpt_str("devname", NULL, devsum->devname, d1); // rpt_int("usb_busnum", NULL, devsum->usb_busnum, d1); // rpt_int("usb_devnum", NULL, devsum->usb_devnum, d1); // rpt_int("vid", NULL, devsum->vid, d1); // rpt_int("pid", NULL, devsum->pid, d1); rpt_str("vendor_id", NULL, devsum->vendor_id, d1); rpt_str("product_id", "", devsum->product_id, d1); rpt_str("vendor_name", NULL, devsum->vendor_name, d1); rpt_str("product_name", NULL, devsum->product_name, d1); rpt_str("busnum_s", NULL, devsum->busnum_s, d1); rpt_str("devnum_s", NULL, devsum->devnum_s, d1); } /** Look up information for a device name. * The expected use in in error messages. * * @param devname device name, e.g. /dev/usb/hiddev3 * @return pointer to newly allocated **Usb_Detailed_Device_Summary** struct, * NULL if not found */ Usb_Detailed_Device_Summary * lookup_udev_usb_device_by_devname(char * devname) { int depth = 0; // int d1 = depth+1; struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *devices, *dev_list_entry; struct udev_device *dev; /* Create the udev object */ udev = udev_new(); if (!udev) { printf("(%s) Can't create udev\n", __func__); return NULL; // exit(1); } Usb_Detailed_Device_Summary * devsum = new_usb_detailed_device_summary(); devsum->devname = strdup(devname); /* Create a list of matching devices. */ enumerate = udev_enumerate_new(udev); udev_enumerate_add_match_property(enumerate, "DEVNAME", devname); udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); int devct = 0; /* udev_list_entry_foreach is a macro which expands to a loop. The loop will be executed for each member in devices, setting dev_list_entry to a list entry which contains the device's path in /sys. */ udev_list_entry_foreach(dev_list_entry, devices) { const char *path; /* Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it */ path = udev_list_entry_get_name(dev_list_entry); // rpt_vstring(depth, "path: %s", path); dev = udev_device_new_from_syspath(udev, path); /* udev_device_get_devnode() returns the path to the device node itself in /dev. */ // rpt_vstring(depth, "Device Node Path: %s", udev_device_get_devnode(dev)); // report_udev_device(dev, d1); /* The device pointed to by dev contains information about the named device. In order to get information about the USB device, get the parent device with the subsystem/devtype pair of "usb"/"usb_device". This will be several levels up the tree, but the function will find it.*/ dev = udev_device_get_parent_with_subsystem_devtype( dev, "usb", "usb_device"); if (!dev) { rpt_vstring(depth, "Unable to find parent USB device."); continue; // exit(1); // TODO: fix } // puts(""); // rpt_vstring(depth, "Parent device:"); /* From here, we can call get_sysattr_value() for each file in the device's /sys entry. The strings passed into these functions (idProduct, idVendor, serial, etc.) correspond directly to the files in the directory which represents the USB device. Note that USB strings are Unicode, UCS2 encoded, but the strings returned from udev_device_get_sysattr_value() are UTF-8 encoded. */ devsum->vendor_id = strdup( udev_device_get_sysattr_value(dev,"idVendor") ); devsum->product_id = strdup( udev_device_get_sysattr_value(dev,"idProduct") ); devsum->vendor_name = strdup( udev_device_get_sysattr_value(dev,"manufacturer") ); devsum->product_name = strdup( udev_device_get_sysattr_value(dev,"product") ); devsum->busnum_s = strdup( udev_device_get_sysattr_value(dev,"busnum") ); devsum->devnum_s = strdup( udev_device_get_sysattr_value(dev,"devnum") ); // report_udev_device(dev, d1); udev_device_unref(dev); devct++; } /* Free the enumerator object */ udev_enumerate_unref(enumerate); udev_unref(udev); if (devct != 1) printf("(%s) Unexpectedly found %d matching devices for %s\n", __func__, devct, devname); if (devct == 0) { free_usb_detailed_device_summary(devsum); devsum = NULL; } // if (devsum) // report_usb_device_summary(devsum, 0); return devsum; } /** Reports on all devices in a UDEV subsystem * * @param subsystem subsystem name, e.g. "usbmisc" * @param show_usb_parent include reports on parent devices * @param depth logical indentation depth * * @remark * Adapted from USB sample code */ void probe_udev_subsystem(char * subsystem, bool show_usb_parent, int depth) { int d1 = depth+1; struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *devices, *dev_list_entry; struct udev_device *dev; /* Create the udev object */ udev = udev_new(); if (!udev) { printf("(%s) Can't create udev\n", __func__); return; // exit(1); } /* Create a list of the devices in the specified subsystem. */ enumerate = udev_enumerate_new(udev); udev_enumerate_add_match_subsystem(enumerate, subsystem); udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); /* For each item enumerated, print out its information. udev_list_entry_foreach is a macro which expands to a loop. The loop will be executed for each member in devices, setting dev_list_entry to a list entry which contains the device's path in /sys. */ udev_list_entry_foreach(dev_list_entry, devices) { puts(""); rpt_vstring(depth, "***One Device ***"); const char *path; /* Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it */ path = udev_list_entry_get_name(dev_list_entry); rpt_vstring(depth, "path: %s", path); dev = udev_device_new_from_syspath(udev, path); /* udev_device_get_devnode() returns the path to the device node itself in /dev. */ rpt_vstring(depth, "Device Node Path: %s", udev_device_get_devnode(dev)); report_udev_device(dev, d1); if (!show_usb_parent) continue; /* The device pointed to by dev contains information about the hidraw device. In order to get information about the USB device, get the parent device with the subsystem/devtype pair of "usb"/"usb_device". This will be several levels up the tree, but the function will find it.*/ dev = udev_device_get_parent_with_subsystem_devtype( dev, "usb", "usb_device"); if (!dev) { rpt_vstring(depth, "Unable to find parent USB device."); continue; // exit(1); } puts(""); rpt_vstring(depth, "Parent device:"); /* From here, we can call get_sysattr_value() for each file in the device's /sys entry. The strings passed into these functions (idProduct, idVendor, serial, etc.) correspond directly to the files in the directory which represents the USB device. Note that USB strings are Unicode, UCS2 encoded, but the strings returned from udev_device_get_sysattr_value() are UTF-8 encoded. */ rpt_vstring(d1, "VID/PID: %s %s", udev_device_get_sysattr_value(dev,"idVendor"), udev_device_get_sysattr_value(dev, "idProduct")); rpt_vstring(d1, "%s", udev_device_get_sysattr_value(dev,"manufacturer") ); rpt_vstring(d1, "%s", udev_device_get_sysattr_value(dev,"product")); rpt_vstring(d1, "serial: %s", udev_device_get_sysattr_value(dev, "serial")); report_udev_device(dev, d1); udev_device_unref(dev); } /* Free the enumerator object */ udev_enumerate_unref(enumerate); udev_unref(udev); return; } /** Reports on a struct **udev_usb_devinfo**. * * @param dinfo pointer to struct * @param depth logical indentation depth */ void report_udev_usb_devinfo(struct udev_usb_devinfo * dinfo, int depth) { rpt_structure_loc("udev_usb_devinfo", dinfo, depth); int d1 = depth+1; rpt_vstring(d1, "%-20s %d 0x%04x", "busno", dinfo->busno, dinfo->busno); rpt_vstring(d1, "%-20s %d 0x%04x", "devno", dinfo->devno, dinfo->devno); } /** Use UDEV to get the bus and device numbers for a USB device * * @param subsystem device subsystem, e.g. "usbmisc" * @param simple_devname simple device name, e.g. "hiddev" * * @return pointer to Udev_Usb_Devinfo containing result\n * NULL if not found * * Adapted from UDEV sample code. */ Udev_Usb_Devinfo * get_udev_usb_devinfo(char * subsystem, char * simple_devname) { assert(subsystem); assert(simple_devname); bool debug = false; if (debug) printf("(%s) Starting. subsystem=|%s|, simple_devname=|%s|\n", __func__, subsystem, simple_devname); struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *dev_list_entry; struct udev_device *dev; Udev_Usb_Devinfo * result = NULL; udev = udev_new(); // create udev context object if (!udev) { // should never happen printf("(%s) Can't create udev\n", __func__); goto bye; } /* Create a list of the devices in the specified subsystem. */ enumerate = udev_enumerate_new(udev); udev_enumerate_add_match_subsystem(enumerate, subsystem); udev_enumerate_add_match_sysname(enumerate, simple_devname); udev_enumerate_scan_devices(enumerate); // Given the specificity of our search, list should contain exactly 0 or 1 entries dev_list_entry = udev_enumerate_get_list_entry(enumerate); // get first entry of list if (dev_list_entry) { assert( udev_list_entry_get_next(dev_list_entry) == NULL); // should be 0 or 1 devices /* Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it */ const char * path = udev_list_entry_get_name(dev_list_entry); // printf("path: %s\n", path); dev = udev_device_new_from_syspath(udev, path); // udev_device_get_devnode() returns the path to the device node // itself in /dev, e.g. /dev/hidraw3, /dev/usb/hiddev2 if (debug) printf("(%s) Device Node Path: %s\n", __func__, udev_device_get_devnode(dev)); // report_udev_device(dev, 1); /* The device pointed to by dev contains information about the hidraw device. In order to get information about the USB device, get the parent device with the subsystem/devtype pair of "usb"/"usb_device". This will be several levels up the tree, but the function will find it.*/ dev = udev_device_get_parent_with_subsystem_devtype( dev, "usb", "usb_device"); if (!dev) { printf("(%s) Unable to find parent USB device for subsystem %s, device %s.", __func__, subsystem, simple_devname); } else { // printf("Parent device: \n"); /* From here, we can call get_sysattr_value() for each file in the device's /sys entry. The strings passed into these functions (idProduct, idVendor, serial, etc.) correspond directly to the files in the directory which represents the USB device. Note that USB strings are Unicode, UCS2 encoded, but the strings returned from udev_device_get_sysattr_value() are UTF-8 encoded. */ if (debug) { printf(" VID/PID: %s %s\n", udev_device_get_sysattr_value(dev,"idVendor"), udev_device_get_sysattr_value(dev, "idProduct")); printf(" %s\n %s\n", udev_device_get_sysattr_value(dev,"manufacturer"), udev_device_get_sysattr_value(dev,"product")); printf(" serial: %s\n", udev_device_get_sysattr_value(dev, "serial")); printf(" busnum: %s\n", udev_device_get_sysattr_value(dev, "busnum")); printf(" devnum: %s\n", udev_device_get_sysattr_value(dev, "devnum")); } const char * sbusnum = udev_device_get_sysattr_value(dev, "busnum"); const char * sdevnum = udev_device_get_sysattr_value(dev, "devnum"); result = calloc(1, sizeof(Udev_Usb_Devinfo)); //are these decimal or hex numbers? result->busno = atoi(sbusnum); result->devno = atoi(sdevnum); // report_udev_device(dev, 1); udev_device_unref(dev); } } /* Free the enumerator object */ udev_enumerate_unref(enumerate); udev_unref(udev); bye: if (debug) { printf("(%s) Returning: %p\n", __func__, result); if (result) report_udev_usb_devinfo(result, 1); } return result; } /** Encapsulates location of hiddev device files, in case it needs to be generalized \remark According to file https://www.kernel.org/doc/Documentation/hid/hiddev.txt, hiddev devices are always named /dev/usb/hiddevN (where n = 0..15). However, searching the web finds statements that the hiddev device files might be located in any of several distribution dependent directories, and code examples that looks in multiple directories. I suspect that for recent kernels/distributions the device file location is fixed, but that variation existed in the past. For now, assume the location is fixed. If in fact it proves to be variable, this function can be extended to use udev or other some other mechanisms to locate the hiddev directory. */ char * usb_hiddev_directory() { return "/dev/usb"; } ddcutil-0.8.6/src/util/udev_util.c0000644000175000001440000002373613214610651014014 00000000000000/* udev_util.c * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ // Adapted from source code at http://www.signal11.us/oss/udev/ /** @file udev_util.c * UDEV utility functions */ /** \cond */ #include #include #include #include /** \endcond */ #include "report_util.h" #include "string_util.h" #include "udev_util.h" /* GDestroyNotify() function to be called when a data element in a GPtrRrray of * #Udev_Device_Summary is destroyed. * * Arguments: * data pointer to Udev_Device_Summary */ void free_udev_device_summary(gpointer data) { if (data) { Udev_Device_Summary * summary = (Udev_Device_Summary *) data; assert(memcmp(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4) == 0); summary->marker[3] = 'x'; // no need to free strings, they are consts free(summary); } } /** Destroys a GPtrArray of Udev_Device_Summary * * @param summaries pointer to GPtrArray of #Udev_Device_Summary */ void free_udev_device_summaries(GPtrArray* summaries) { g_ptr_array_free(summaries, true); } /** Returns a struct containing key fields extracted from a **struct udev_device**. * * \param dev pointer to struct udev_device * \return newly allocated #Udev_Device_Summary * * \remark * It is the responsibility of the caller to free the returned struct * using #free_udev_device_summary(). * The strings pointed within #Udev_Device_Summary are consts * within the UDEV data structures and should not be freed. */ Udev_Device_Summary * get_udev_device_summary(struct udev_device * dev) { Udev_Device_Summary * summary = calloc(1,sizeof(struct udev_device_summary)); memcpy(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4); // n. all strings returned are const char * summary->devpath = udev_device_get_devpath(dev); summary->sysname = udev_device_get_sysname(dev); summary->sysattr_name = udev_device_get_sysattr_value(dev, "name"); summary->subsystem = udev_device_get_subsystem(dev); return summary; } /** Queries UDEV to obtain summaries of each device in a subsystem. * * @param subsystem subsystem name, e.g. "i2c-dev" * @return GPtrArray of #Udev_Device_Summary * * @remark * Use #free_udev_device_summaries() to free the returned data structure. */ GPtrArray * summarize_udev_subsystem_devices(char * subsystem) { struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *devices, *dev_list_entry; struct udev_device *dev; GPtrArray * summaries = g_ptr_array_sized_new(10); g_ptr_array_set_free_func(summaries, free_udev_device_summary); /* Create the udev object */ udev = udev_new(); if (!udev) { printf("(%s) Can't create udev\n", __func__); goto bye; } /* Create a list of the devices in the specified subsystem. */ enumerate = udev_enumerate_new(udev); udev_enumerate_add_match_subsystem(enumerate, subsystem); udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); /* For each item enumerated, print out its information. udev_list_entry_foreach is a macro which expands to a loop. The loop will be executed for each member in devices, setting dev_list_entry to a list entry which contains the device's path in /sys. */ udev_list_entry_foreach(dev_list_entry, devices) { const char *path; /* Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it */ path = udev_list_entry_get_name(dev_list_entry); dev = udev_device_new_from_syspath(udev, path); g_ptr_array_add(summaries, get_udev_device_summary(dev)); } bye: return summaries; } /** Queries udev to find all devices with a given name attribute * * @param name e.g. DPMST * @return GPtrArray of #Udev_Device_Summary * * @remark * Use #free_udev_device_summaries() to free the returned data structure. */ GPtrArray * find_devices_by_sysattr_name(char * name) { struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry *devices, *dev_list_entry; struct udev_device *dev; GPtrArray * result = g_ptr_array_sized_new(10); g_ptr_array_set_free_func(result, free_udev_device_summary); udev = udev_new(); // Create the udev object if (!udev) { printf("(%s) Can't create udev\n", __func__); goto bye; } /* Create a list of the devices in the specified subsystem. */ enumerate = udev_enumerate_new(udev); udev_enumerate_add_match_sysattr(enumerate, "name", name); udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); // udev_list_entry_foreach is a macro which expands to a loop. // The loop will be executed for each member in devices, setting dev_list_entry // to a list entry which contains the device's path in /sys. udev_list_entry_foreach(dev_list_entry, devices) { // Get the filename of the /sys entry for the device, // and create a udev_device object (dev) representing it const char * path = udev_list_entry_get_name(dev_list_entry); dev = udev_device_new_from_syspath(udev, path); g_ptr_array_add(result, get_udev_device_summary(dev)); } bye: return result; } /** Filters a **GPtrArray** of #Udev_Device_Summary removing * entries that do not satisfy the predicate function provided. * * summaries **GPtrArray** of #Udev_Device_Summary * func filter function, if returns false then delete the entry * \return NULL or **summaries** * * \remark * - if **summaries** is NULL, returns NULL * - if **summaries** is non_NULL, but keep_func is NULL, returns **summaries** */ GPtrArray * filter_device_summaries( GPtrArray * summaries, Udev_Summary_Filter_Func keep_func) { if (!summaries || !keep_func) goto bye; for (int ndx=0; ndx < summaries->len; ndx++) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); if (!keep_func(summary)) g_ptr_array_remove_index(summaries, ndx); } bye: return summaries; } /** Report on a single UDEV device * * @param dev pointer to struct **udev_device** to report * @param depth logical indentation depth */ void report_udev_device(struct udev_device * dev, int depth) { int d1 = depth+1; int d2 = depth+2; rpt_structure_loc("struct udev_device", dev, depth); rpt_vstring(d1, "devpath: %s", udev_device_get_devpath(dev)); rpt_vstring(d1, "subsystem: %s", udev_device_get_subsystem(dev)); rpt_vstring(d1, "devtype: %s", udev_device_get_devtype(dev)); rpt_vstring(d1, "syspath: %s", udev_device_get_syspath(dev)); rpt_vstring(d1, "sysname: %s", udev_device_get_sysname(dev)); rpt_vstring(d1, "sysnum: %s", udev_device_get_sysnum(dev)); rpt_vstring(d1, "devnode: %s", udev_device_get_devnode(dev)); struct udev_list_entry * cur_entry; struct udev_list_entry * properties_list_entry; struct udev_list_entry * sysattr_list_entry; properties_list_entry = udev_device_get_properties_list_entry(dev); sysattr_list_entry = udev_device_get_sysattr_list_entry(dev); rpt_vstring(d1, "Properties:"); udev_list_entry_foreach(cur_entry, properties_list_entry) { const char * prop_name = udev_list_entry_get_name(cur_entry); const char * prop_value = udev_list_entry_get_value(cur_entry); const char * prop_value2 = udev_device_get_property_value(dev, prop_name); assert(streq(prop_value, prop_value2)); rpt_vstring(d2, "%s -> %s", prop_name, prop_value); } rpt_vstring(d1, "Sysattrs:"); udev_list_entry_foreach(cur_entry, sysattr_list_entry) { const char * attr_name = udev_list_entry_get_name(cur_entry); const char * attr_value = udev_list_entry_get_value(cur_entry); const char * attr_value2 = udev_device_get_sysattr_value(dev, attr_name); assert(attr_value == NULL); // hex_dump( (Byte*) attr_value2, strlen(attr_value2)+1); if (attr_value2 && strchr(attr_value2, '\n')) { // if (streq(attr_name, "uevent")) { // output is annoying to visually scan since it contains newlines Null_Terminated_String_Array ntsa = strsplit(attr_value2, "\n"); if (ntsa_length(ntsa) == 0) rpt_vstring(d2, "%s -> %s", attr_name, ""); else { rpt_vstring(d2, "%s -> %s", attr_name, ntsa[0]); int ndx = 1; while (ntsa[ndx]) { rpt_vstring(d2, "%*s %s", strlen(attr_name) + 3, " ", ntsa[ndx]); ndx++; } } ntsa_free(ntsa, /* free_strings */ true); #ifdef ALTERNATIVE // simpler, works char * av = strdup(attr_value2); char * p = av; while (*p) { if (*p == 0x0a) *p = ','; p++; } rpt_vstring(d2, "%s -> %s", attr_name, av); free(av); #endif } // n. attr_name "descriptors" returns a hex value, not a null-terminated string // should display as hex, but how to determine length? // for example of reading, see http://fossies.org/linux/systemd/src/udev/udev-builtin-usb_id.c // not worth pursuing else { rpt_vstring(d2, "%s -> %s", attr_name, attr_value2); } } } ddcutil-0.8.6/src/util/utilrpt.c0000644000175000001440000000327613213243060013507 00000000000000/* utilrpt.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Report functions for other utility modules. * Avoids complex dependencies between report_util.c and other * util files. */ #include "data_structures.h" #include "report_util.h" #include "utilrpt.h" /** Displays all fields of a #Buffer. * This is a debugging function. * * @param buffer pointer to Buffer instance * @param depth logical indentation depth * * @remark * Output is written to the current report destination. */ void dbgrpt_buffer(Buffer * buffer, int depth) { rpt_vstring(depth, "Buffer at %p, bytes addr=%p, len=%d, max_size=%d", buffer, buffer->bytes, buffer->len, buffer->buffer_size); // printf(" bytes end addr=%p\n", buffer->bytes+buffer->buffer_size); if (buffer->bytes) rpt_hex_dump(buffer->bytes, buffer->len, depth); } ddcutil-0.8.6/src/util/failsim.c0000644000175000001440000003735713203271475013451 00000000000000/* failsim.c * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file failsim.c * Functions that provide a simple failure simulation framework. */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "debug_util.h" #include "file_util.h" #include "report_util.h" #include "string_util.h" #include "failsim.h" static Fsim_Name_To_Number_Func name_to_number_func = NULL; static Fsim_Name_To_Number_Func unmodulated_name_to_number_func = NULL; /** Sets the functions to be used to interpret a symbolic value * in a failure simulation control file. * * @param func normal function to use * @param unmodulated_func function to use when an unmodulated value is looked up */ void fsim_set_name_to_number_funcs( Fsim_Name_To_Number_Func func, Fsim_Name_To_Number_Func unmodulated_func) { name_to_number_func = func; unmodulated_name_to_number_func = unmodulated_func; } // singleton failure simulation table static GHashTable * fst = NULL; // Describes a call occurrence for which an error is to be simulated typedef struct fsim_call_occ_rec { Fsim_Call_Occ_Type call_occ_type; int occno; int rc; bool modulated; } Fsim_Call_Occ_Rec; // This struct describes the failure simulation state of a function. It // a) contains an array of FsimCall_Occ_Rec defining the simulated errors // b) a counter updated at runtime of the number of times the function has been called. #define FSIM_FUNC_REC_MARKER "FSFR" typedef struct fsim_func_rec { char marker[4]; char * func_name; int callct; GArray * call_occ_recs; // array of Fsim_Call_Occ_Rec } Fsim_Func_Rec; char * fsim_call_occ_type_names[] = {"FSIM_CALL_OCC_RECURRING", "FSIM_CALL_OCC_SINGLE" }; // GHashTable destroy function for hash value (i.e. pointer to Fsim_Func_Rec) static void fsim_destroy_func_rec(gpointer data) { Fsim_Func_Rec * frec = (Fsim_Func_Rec *) data; assert(memcmp(frec->marker, FSIM_FUNC_REC_MARKER, 4) == 0); g_array_unref(frec->call_occ_recs); frec->marker[3] = 'x'; free(data); } // GHashTable destroy function for hash key (i.e. pointer to string) void fsim_destroy_key(gpointer data) { free(data); } /* Reports a single entry in the error simulation table, * i.e. the conditions under which an error will be simulated * for the function and the error value for the function to return. * * Arguments: * key_ptr pointer to function name * value_ptr pointer to GArray of Fsim_Call_Occ_Rec's * user_data_ptr pointer to logical indentation depth */ static void report_error_table_entry( gpointer key_ptr, gpointer value_ptr, gpointer user_data_ptr) { bool debug = false; if (debug) printf("(%s) Starting. value_ptr=%p, user_data_ptr=%p\n", __func__, value_ptr, user_data_ptr); char * key = (char *) key_ptr; Fsim_Func_Rec * frec = (Fsim_Func_Rec *) value_ptr; int * depth_ptr = (int *) user_data_ptr; int depth = *depth_ptr; rpt_vstring(depth, "function: %s", key); for (int ndx = 0; ndx < frec->call_occ_recs->len; ndx++) { Fsim_Call_Occ_Rec occ_rec = g_array_index(frec->call_occ_recs, Fsim_Call_Occ_Rec, ndx); rpt_vstring(depth+1, "rc = %d, occurrences=(%s, %d)", occ_rec.rc, (occ_rec.call_occ_type == FSIM_CALL_OCC_RECURRING) ? "recurring" : "single", occ_rec.occno); } } /* Returns the failure simulation table. * If the table does not already exist it is created. * * Arguments: none * * Returns: pointer to failure simulation table */ static GHashTable * fsim_get_or_create_failsim_table() { if (!fst) { fst = g_hash_table_new_full( g_str_hash, g_str_equal, fsim_destroy_key, fsim_destroy_func_rec); } return fst; } /* Gets the record for a function in the failure simulation table. * If a record does not already exist, a new one is created. * * Arguments: * funcname function mame * * Returns: pointer to Fsim_Func_Rec for the function */ static Fsim_Func_Rec * fsim_get_or_create_func_rec(char * funcname) { GHashTable * fst = fsim_get_or_create_failsim_table(); Fsim_Func_Rec * frec = g_hash_table_lookup(fst, funcname); if (!frec) { frec = calloc(1, sizeof(Fsim_Func_Rec)); memcpy(frec->marker, FSIM_FUNC_REC_MARKER, 4); frec->func_name = strdup(funcname); frec->callct = 0; frec->call_occ_recs = g_array_new( false, // zero_terminated true, // clear_ sizeof(Fsim_Call_Occ_Rec) ); g_hash_table_insert(fst, frec->func_name, frec); } return frec; } /** Adds an error description to the failure simulation table entry for a function. * * @param funcname function name * @param call_occ_type recurring or single * @param occno occurrence number * @param rc return code to simulate */ void fsim_add_error( char * funcname, Fsim_Call_Occ_Type call_occ_type, int occno, int rc) { bool debug = false; if (debug) printf("(%s) funcname=|%s|, call_occ_type=%d, occ type: %s, occno=%d, fsim_rc=%d\n", __func__, funcname, call_occ_type, (call_occ_type == FSIM_CALL_OCC_RECURRING) ? "recurring" : "single", occno, rc); Fsim_Call_Occ_Rec callocc_rec; callocc_rec.call_occ_type = call_occ_type; callocc_rec.occno = occno; callocc_rec.rc = rc; Fsim_Func_Rec* frec = fsim_get_or_create_func_rec(funcname); g_array_append_val(frec->call_occ_recs, callocc_rec); } /** Resets the call counter in a failure simulation table entry * * @param funcname function name */ void fsim_reset_callct(char * funcname) { if (fst) { Fsim_Func_Rec * frec = g_hash_table_lookup(fst, funcname); if (frec) frec->callct = 0; } } /** Delete all error descriptors for a function. * * @param funcname function name */ void fsim_clear_errors_for_func(char * funcname) { if (fst) { // not an error if key doesn't exist g_hash_table_remove(fst, funcname); } } /* Clears the entire failure simulation table. */ void fsim_clear_error_table() { if (fst) { g_hash_table_destroy(fst); fst = NULL; } } /** Report the failure simulation table. * * @param depth logical indentation depth */ void fsim_report_error_table(int depth) { bool debug = false; int d1 = depth+1; if (debug) printf("(%s) d1=%d, &d1=%p\n", __func__, d1, &d1); if (fst) { rpt_vstring(depth, "Failure simulation table:"); g_hash_table_foreach(fst, report_error_table_entry, &d1); } else rpt_vstring(depth, "Failure simulation table not initialized"); } /* Evaluates a string status code expression. * * The string can take the following forms: * integer e.g. "-42" * boolean i.e. "true" or "false" * a symbolic status code name, optionally prefixed by * "modulated:" or "base:". * If neither "modulated" nor "vase" is specified, "modulated" is assumed * e.g. "DDC_RC_ALL_ZERO", "base:EBUSY" * * Arguments: * rc_string string to evaluate * evaluated_rc where to return evaluated value * * Returns: true if evaluation successful, false if error */ // Issue: should unmodulated values be negative, or should // an optional minus sign be recognized? // e.g. should we specify -EBUSY for -22? bool eval_fsim_rc(char * rc_string, int * evaluated_rc) { bool debug = false; if (debug) printf("(%s) Starting. rc_string=%s\n", __func__, rc_string); char * end; bool ok = false; *evaluated_rc = 0; long int answer = strtol(rc_string, &end, 10); if (*end == '\0') { *evaluated_rc = (int) answer; ok = true; } else if (streq(rc_string, "true")) { *evaluated_rc = true; ok = true; } else if (streq(rc_string, "false")) { *evaluated_rc = false; ok = true; } else { bool is_modulated = true; if (str_starts_with(rc_string, "modulated:")) { is_modulated = true; rc_string = rc_string + strlen("modulated:"); } else if (str_starts_with(rc_string, "base:")) { is_modulated = false; rc_string = rc_string + strlen("base:"); } if (strlen(rc_string) == 0) ok = false; else if (is_modulated && name_to_number_func) ok = name_to_number_func(rc_string, evaluated_rc); else if (!is_modulated && unmodulated_name_to_number_func) ok = unmodulated_name_to_number_func(rc_string, evaluated_rc); else ok = false; } if (debug) printf("(%s) Starting. rc_string=%s. Returning: %s, *evaluated_rc=%d\n", __func__, rc_string, bool_repr(ok), *evaluated_rc); return ok; } // // Bulk load the failure simulation table // // cf dumpload load variants // /** Load the failure simulation table from an array of strings. * Each string describes one simulated error for a function, and has * the form: * @verbatim function_name status_code occurrence_descriptor @endverbatim * where: * - **status_code** has a form documented for eval_fsim_rc() * - **occurrence_descriptor** has the form "[*]integer"\n * examples: * - *7 every 7th call fails * - 7 the 7th call fails * - *1 every call fails * * Examples: * \verbatim i2c_set_addr base:EBUSY 6 ddc_verify false *1 \endverbatim * * @param lines array of lines */ bool fsim_load_control_from_gptrarray(GPtrArray * lines) { bool debug = false; if (debug) printf("(%s) lines.len = %d\n", __func__, lines->len); bool dummy_data_flag = false; // Dummy data for development if (dummy_data_flag) { printf("(%s) Loading mock data\n", __func__); fsim_add_error("i2c_set_addr", FSIM_CALL_OCC_RECURRING, 2, -EBUSY); return true; } bool ok = true; fst = g_hash_table_new(g_str_hash, g_str_equal); for (int ndx = 0; ndx < lines->len; ndx++) { char * aline = g_ptr_array_index(lines, ndx); if (debug) printf("(%s) line: %s\n", __func__, aline); char * trimmed_line = strtrim(aline); if (strlen(trimmed_line) > 0 && trimmed_line[0] != '#' && trimmed_line[0] != '*') { Null_Terminated_String_Array pieces = strsplit(trimmed_line, " "); if (debug) ntsa_show(pieces); bool valid_line = true; char * funcname = NULL; int fsim_rc = 0; Fsim_Call_Occ_Type occtype = FSIM_CALL_OCC_SINGLE; int occno = 0; if (ntsa_length(pieces) != 3) valid_line = false; else { funcname = pieces[0]; valid_line = eval_fsim_rc(pieces[1], &fsim_rc); if (valid_line) { char * occdef = pieces[2]; if (*occdef == '*') { occtype = FSIM_CALL_OCC_RECURRING; occdef++; } if (strlen(occdef) == 0) valid_line = false; else { char * end; occno = strtol(occdef, &end, 10); if (*end != '\0') valid_line = false; } } if (valid_line) { fsim_add_error( funcname, occtype, occno, fsim_rc); } } if (!valid_line) { printf("(%s) Invalid control file line: %s\n", __func__, aline); ok = false; } ntsa_free(pieces, /* free_strings */ true); } free(trimmed_line); } // fsim_report_error_table(0); if (debug) printf("(%s) Returnind: %s\n", __func__, bool_repr(ok)); return ok; } // TODO: implement bool fsim_load_control_string(char * s) { bool ok = false; return ok; } /** Loads the failure simulation table from a control file. * * @param fn file name * * @return true if success, fails if error */ bool fsim_load_control_file(char * fn) { bool debug = false; if (debug) printf("(%s) fn=%s\n", __func__, fn); bool verbose = true; // should this be argument? GPtrArray * lines = g_ptr_array_new(); int linect = file_getlines(fn, lines, verbose); if (debug) printf("(%s) Read %d lines\n", __func__, linect); bool result = false; if (linect > 0) result = fsim_load_control_from_gptrarray(lines); // need free func g_ptr_array_free(lines, true); if (debug) printf("(%s) Returning: %s\n", __func__, bool_repr(result)); return result; } // // Execution time error check // /** This function is called at runtime to check if a failure should be * simulated. * * @param fn name of file from which check is performed * @param funcname name of function for which check is performed * * @return struct indicating whether failure should be simulated * and if so what the status code should be. * Note that the entire struct is returned on the stack, not * a pointer to the struct. */ Failsim_Result fsim_check_failure(const char * fn, const char * funcname) { bool debug = false; Failsim_Result result = {false, 0}; if (fst) { Fsim_Func_Rec * frec = g_hash_table_lookup(fst, funcname); if (frec) { frec->callct++; for (int ndx = 0; ndx < frec->call_occ_recs->len; ndx++) { Fsim_Call_Occ_Rec * occ_rec = &g_array_index(frec->call_occ_recs, Fsim_Call_Occ_Rec, ndx); if (debug) printf("(%s) call_occ_type=%d, callct = %d, occno=%d\n", __func__, occ_rec->call_occ_type, frec->callct, occ_rec->occno); if (occ_rec->call_occ_type == FSIM_CALL_OCC_RECURRING) { if ( frec->callct % occ_rec->occno == 0) { result.force_failure = true; result.failure_value = occ_rec->rc; break; } } else { if (frec->callct == occ_rec->occno) { result.force_failure = true; result.failure_value = occ_rec->rc; break; } } } if (result.force_failure) { printf("Simulating failure for call %d of function %s, returning %d\n", frec->callct, funcname, result.failure_value); // printf("Call stack:\n"); // why wasn't this here in the original version? show_backtrace(2); } } } if (debug) printf("(%s) funcname=%s, returning (%d,%d)\n", __func__, funcname, result.force_failure, result.failure_value); return result; } ddcutil-0.8.6/src/util/libdrm_util.c0000644000175000001440000005362513214610307014320 00000000000000/* libdrm_util.c * * Utilities for interpreting libdrm data structures. * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file libdrm_util.c * Utilities for use with libdrm */ /** \cond */ #include #include #include #include /** \endcond */ #include "data_structures.h" #include "report_util.h" #include "string_util.h" #include "libdrm_util.h" // /usr/include/libdrm and /usr/include/drm may both contain copies // drm.h amd drm_mode.h, // DRM_MODE_PROP_ATOMIC is found in the libdrm/drm_mode.h, but not in drm/drm_mode.h // In case we've picked up drm/drm_mode.h: #ifndef DRM_MODE_PROP_ATOMIC #define DRM_MODE_PROP_ATOMIC 0x80000000 #endif // // Identifier name tables // Value_Name_Title connector_type_table[] = { VNT(DRM_MODE_CONNECTOR_Unknown , "unknown" ), // 0 VNT(DRM_MODE_CONNECTOR_VGA , "VGA" ), // 1 VNT(DRM_MODE_CONNECTOR_DVII , "DVI-I" ), // 2 VNT(DRM_MODE_CONNECTOR_DVID , "DVI-D" ), // 3 VNT(DRM_MODE_CONNECTOR_DVIA , "DVI-A" ), // 4 VNT(DRM_MODE_CONNECTOR_Composite , "Composite" ), // 5 VNT(DRM_MODE_CONNECTOR_SVIDEO , "S-video" ), // 6 VNT(DRM_MODE_CONNECTOR_LVDS , "LVDS" ), // 7 VNT(DRM_MODE_CONNECTOR_Component , "Component" ), // 8 VNT(DRM_MODE_CONNECTOR_9PinDIN , "DIN" ), // 9 VNT(DRM_MODE_CONNECTOR_DisplayPort , "DP" ), // 10 VNT(DRM_MODE_CONNECTOR_HDMIA , "HDMI" ), // 11 VNT(DRM_MODE_CONNECTOR_HDMIB , "HDMI-B" ), // 12 VNT(DRM_MODE_CONNECTOR_TV , "TV" ), // 13 VNT(DRM_MODE_CONNECTOR_eDP , "eDP" ), // 14 VNT(DRM_MODE_CONNECTOR_VIRTUAL , "Virtual" ), // 15 VNT(DRM_MODE_CONNECTOR_DSI , "DSI" ), // 16 Display Signal Interface, used on Raspberry Pi VNT_END }; /** Returns the symbolic name of a connector type. * @param val connector type * @return symbolic name */ char * connector_type_name(Byte val) { return vnt_name(connector_type_table, val); } /** Returns the description string for a connector type. * @param val connector type * @return descriptive string */ char * connector_type_title(Byte val) { return vnt_title(connector_type_table, val); } // from libdrm/drm.h #define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ /* extended-types: rather than continue to consume a bit per type, * grab a chunk of the bits to use as integer type id. */ #define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0 #define DRM_MODE_PROP_TYPE(n) ((n) << 6) // #define DRM_MODE_PROP_OBJECT (DRM_MODE_PROP_TYPE(1)) // #define DRM_MODE_PROP_SIGNED_RANGE (DRM_MODE_PROP_TYPE(2)) Value_Name drm_property_flag_table[] = { VN(DRM_MODE_PROP_PENDING), // (1<<0) == x01 VN(DRM_MODE_PROP_RANGE), // (1<<1) == x02 VN(DRM_MODE_PROP_IMMUTABLE), // (1<<2) == x04 VN(DRM_MODE_PROP_ENUM), // (1<<3) == x88 /* enumerated type with text strings */ VN(DRM_MODE_PROP_BLOB), // (1<<4) == x10 VN(DRM_MODE_PROP_BITMASK), // defined in libdrm/drm.h // VALUE_NAME(DRM_MODE_PROP_ATOMIC), // defined in libdrm/drm.h 64 bit value VN_END }; #ifdef OLD char * interpret_property_flags_r(uint32_t flags, char * buffer, int bufsz) { #ifdef OLD interpret_named_flags_old( drm_property_flag_table, flags, buffer, bufsz, ", "); // sepstr); #endif interpret_named_flags( flags, drm_property_flag_table, ", ", // sepstr buffer, bufsz ); uint32_t extended_type = flags & DRM_MODE_PROP_EXTENDED_TYPE; if (extended_type) { char * extended_name = "other extended type"; if (extended_type == DRM_MODE_PROP_OBJECT) extended_name = "DRM_MODE_PROP_OBJECT"; else if (extended_type == DRM_MODE_PROP_SIGNED_RANGE) extended_name = "DRM_MODE_PROP_SIGNED_RANGE"; sbuf_append(buffer, bufsz, ", ", extended_name); } if (flags & DRM_MODE_PROP_ATOMIC) sbuf_append(buffer, bufsz, ", ", "DRM_MODE_PROP_ATOMIC"); return buffer; } #endif #ifdef OLD char * interpret_property_flags_old(uint32_t flags) { int bufsz = 150; static char property_flags_string[150]; return interpret_property_flags_r(flags, property_flags_string, bufsz); } #endif #ifdef FRAGMENT char * vnt_interpret_flags( uint32_t flags_val, Value_Name_Title_Table bitname_table, bool use_title, char * sepstr) #endif char * interpret_property_flags(uint32_t flags) { static char * buf = NULL; if (buf) free(buf); buf = vnt_interpret_flags( flags, drm_property_flag_table, false, // use name field, not title field ", "); int bufsz = strlen(buf) + 100; buf = realloc(buf, bufsz); // in case we need to append uint32_t extended_type = flags & DRM_MODE_PROP_EXTENDED_TYPE; if (extended_type) { if (strlen(buf) > 0) g_strlcat(buf, ", ", bufsz); char * extended_name = "other extended type"; if (extended_type == DRM_MODE_PROP_OBJECT) extended_name = "DRM_MODE_PROP_OBJECT"; else if (extended_type == DRM_MODE_PROP_SIGNED_RANGE) extended_name = "DRM_MODE_PROP_SIGNED_RANGE"; g_strlcat(buf, extended_name, bufsz); } if (flags & DRM_MODE_PROP_ATOMIC) { if (strlen(buf) > 0) g_strlcat(buf, ", ", bufsz); g_strlcat(buf, "DRM_MODE_PROP_ATOMIC", bufsz); } return buf; } Value_Name_Title drmModeConnection_table[] = { VNT(DRM_MODE_CONNECTED, "connected" ), // 1 VNT(DRM_MODE_DISCONNECTED, "disconnected" ), // 2 VNT(DRM_MODE_UNKNOWNCONNECTION, "unknown" ), // 3 VNT_END }; /** Returns the symbolic name of a drmModeConnection value. * @param val connection state * @return symbolic name */ char * connector_status_name(drmModeConnection val) { return vnt_name(drmModeConnection_table, val); } /** Returns a description string for a drmModeConnection value. * @param val connection state * @return descriptive string */ char * connector_status_title(drmModeConnection val) { return vnt_title(drmModeConnection_table, val); } Value_Name_Title drm_encoder_type_table[] = { VNT(DRM_MODE_ENCODER_NONE, "None"), // 0 VNT(DRM_MODE_ENCODER_DAC, "DAC"), // 1 VNT(DRM_MODE_ENCODER_TMDS, "TDMS"), // 2 VNT(DRM_MODE_ENCODER_LVDS, "LVDS"), // 3 VNT(DRM_MODE_ENCODER_TVDAC, "TVDAC"), // 4 VNT(DRM_MODE_ENCODER_VIRTUAL, "Virtual"), // 5 VNT(DRM_MODE_ENCODER_DSI, "DSI"), // 6 VNT_END }; /** Returns a description string for an encoder type * @param encoder_type encolder type * @return descriptive string */ char * encoder_type_title(uint32_t encoder_type) { return vnt_title(drm_encoder_type_table, encoder_type); } // // Report functions for libdrm data structures // #ifdef REF typedef struct _drmModeRes { int count_fbs; uint32_t *fbs; int count_crtcs; uint32_t *crtcs; int count_connectors; uint32_t *connectors; int count_encoders; uint32_t *encoders; uint32_t min_width, max_width; uint32_t min_height, max_height; } drmModeRes, *drmModeResPtr; #endif static char * join_ids(char * buf, int bufsz, uint32_t* vals, int ct) { buf[0] = '\0'; if (ct > 0 && vals) { strncpy(buf, " -> ", bufsz); for (int ndx = 0; ndx < ct; ndx++) { char b2[20]; snprintf(b2, 20, "%d", vals[ndx]); sbuf_append(buf, bufsz, " ", b2) ; } } return buf; } /** Reports a drmModeRes struct. * * @param res pointer to drmModeRes instance * @param depth logical indentation depth */ void report_drmModeRes(drmModeResPtr res, int depth) { int d1 = depth+1; char buf[200]; int bufsz=200; rpt_structure_loc("drmModeRes", res, depth); rpt_vstring(d1, "%-20s %d", "count_fbs", res->count_fbs); join_ids(buf, bufsz, res->fbs, res->count_fbs); rpt_vstring(d1, "%-20s %p%s", "fbs", res->fbs, buf); rpt_vstring(d1, "%-20s %d", "count_crtcs", res->count_crtcs); join_ids(buf, bufsz, res->crtcs, res->count_crtcs); rpt_vstring(d1, "%-20s %p%s", "crtcs", res->crtcs, buf); rpt_vstring(d1, "%-20s %d", "count_connectors", res->count_connectors); join_ids(buf, bufsz, res->connectors, res->count_connectors); rpt_vstring(d1, "%-20s %p%s", "connectors", res->connectors, buf); rpt_vstring(d1, "%-20s %d", "count_encoders", res->count_encoders); join_ids(buf, bufsz, res->encoders, res->count_encoders); rpt_vstring(d1, "%-20s %p%s", "encoders", res->encoders, buf); rpt_vstring(d1, "%-20s %d", "min_width", res->min_width); rpt_vstring(d1, "%-20s %d", "max_width", res->max_width); rpt_vstring(d1, "%-20s %d", "min_height", res->min_height); rpt_vstring(d1, "%-20s %d", "max_height", res->max_height); } #ifdef REF typedef struct _drmModeModeInfo { uint32_t clock; uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew; uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; uint32_t vrefresh; uint32_t flags; uint32_t type; char name[DRM_DISPLAY_MODE_LEN]; } drmModeModeInfo, *drmModeModeInfoPtr; #endif void summarize_drmmModeModeInfo(drmModeModeInfo * p, int depth) { // int d1 = depth+1; rpt_vstring(depth, "mode: %s", p->name); // rpt_vstring(d1, "flags: 0x%08x - %s", p->flags, ""); // rpt_vstring(d1, "type: %d = %s", p->type, ""); } #ifdef FOR_DRM_H // For struct in drm.h void report_drm_mode_card_res(struct drm_mode_card_res * res, int depth) { int d1 = depth+1; rpt_structure_loc("drm_mode_card_res", res, depth); rpt_vstring(d1, "%-20s, %ld 0x%08x, %p", "fb_id_ptr:", res->fb_id_ptr, res->fb_id_ptr, res->fb_id_ptr); rpt_vstring(d1, "%-20s, %d", "count_fbs", res->count_fbs); rpt_vstring(d1, "%-20s, %d", "count_crtcs", res->count_crtcs); rpt_vstring(d1, "%-20s, %d", "count_connectors", res->count_connectors); rpt_vstring(d1, "%-20s, %d", "count_encoders", res->count_encoders); rpt_vstring(d1, "%-20s, %d", "min_width", res->min_width); rpt_vstring(d1, "%-20s, %d", "max_width", res->max_width); rpt_vstring(d1, "%-20s, %d", "min_height", res->min_height); rpt_vstring(d1, "%-20s, %d", "max_height", res->max_height); } // This is struct in drm.h, not wrapper libdrm.h #ifdef REF struct drm_mode_get_connector { __u64 encoders_ptr; __u64 modes_ptr; __u64 props_ptr; __u64 prop_values_ptr; __u32 count_modes; __u32 count_props; __u32 count_encoders; __u32 encoder_id; /**< Current Encoder */ __u32 connector_id; /**< Id */ __u32 connector_type; __u32 connector_type_id; __u32 connection; __u32 mm_width; /**< width in millimeters */ __u32 mm_height; /**< height in millimeters */ __u32 subpixel; __u32 pad; }; #endif void report_drm_mode_get_connector(struct drm_mode_get_connector * p, int depth) { int d1 = depth+1; rpt_structure_loc("drm_mode_get_connector", p, depth); rpt_vstring(d1, "%-20s, %ld 0x%08x, %p", "props_ptr:", p->props_ptr, p->props_ptr, p->props_ptr); rpt_vstring(d1, "%-20s, %u", "count_modes", p->count_modes); rpt_vstring(d1, "%-20s, %u", "count_props", p->count_props); rpt_vstring(d1, "%-20s, %u", "count_encoders", p->count_encoders); rpt_vstring(d1, "%-20s, %u", "encouder_id", p->encoder_id); // current encoder rpt_vstring(d1, "%-20s, %d", "connector_id", p->connector_id); rpt_vstring(d1, "%-20s, %d", "connector_type", p->connector_type); rpt_vstring(d1, "%-20s, %d", "connector_type_id", p->connector_type_id); rpt_vstring(d1, "%-20s, %d", "connection", p->connection); rpt_vstring(d1, "%-20s, %d", "mm_width", p->mm_width); rpt_vstring(d1, "%-20s, %d", "mm_height", p->mm_height); rpt_vstring(d1, "%-20s, %d", "subpixel", p->subpixel); // rpt_vstring(d1, "%-20s, %d", "pad", p->pad); } #endif #ifdef REF typedef struct _drmModeConnector { uint32_t connector_id; uint32_t encoder_id; /**< Encoder currently connected to */ uint32_t connector_type; uint32_t connector_type_id; drmModeConnection connection; uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ drmModeSubPixel subpixel; int count_modes; drmModeModeInfoPtr modes; int count_props; uint32_t *props; /**< List of property ids */ uint64_t *prop_values; /**< List of property values */ int count_encoders; uint32_t *encoders; /**< List of encoder ids */ } drmModeConnector, *drmModeConnectorPtr; #endif /* Reports a drmModeConnector struct * * Arguments: * fd file descriptor * p pointer to drmModeConnector struct * depth logical identation depth */ void report_drmModeConnector( int fd, drmModeConnector * p, int depth) { int d1 = depth+1; int d2 = depth+2; char buf[200]; int bufsz=200; rpt_structure_loc("drmModeConnector", p, depth); rpt_vstring(d1, "%-20s %d", "connector_id:", p->connector_id); rpt_vstring(d1, "%-20s %d - %s", "connector_type:", p->connector_type, connector_type_name(p->connector_type)); rpt_vstring(d1, "%-20s %d", "connector_type_id:", p->connector_type_id); rpt_vstring(d1, "%-20s %u", "encoder_id", p->encoder_id); // current encoder #ifdef OLD rpt_vstring(d1, "%-20s %d", "count_encoders", p->count_encoders); buf[0] = '\0'; if (p->count_encoders > 0) { strncpy(buf, " -> ", 100); for (int ndx = 0; ndx < p->count_encoders; ndx++) { snprintf(buf+strlen(buf), 100-strlen(buf), "%d ", p->encoders[ndx]); } } rpt_vstring(d1, "%-20s %p%s", "encoders", p->encoders, buf); #endif rpt_vstring(d1, "%-20s %d", "count_encoderrs", p->count_encoders); join_ids(buf, bufsz, p->encoders, p->count_encoders); rpt_vstring(d1, "%-20s %p%s", "encoders", p->encoders, buf); rpt_vstring(d1, "%-20s %d", "count_props", p->count_props); for (int ndx = 0; ndx < p->count_props; ndx++) { rpt_vstring(d2, "index=%d, property id (props)=%u, property value (prop_values)=%u 0x%08x", ndx, p->props[ndx], p->prop_values[ndx], p->prop_values[ndx]); drmModePropertyPtr prop_ptr = drmModeGetProperty(fd, p->props[ndx]); if (prop_ptr) { report_property_value(fd, prop_ptr, p->prop_values[ndx], d2); drmModeFreeProperty(prop_ptr); } else { rpt_vstring(d2, "Unrecognized property id: %d, value=%u", p->props[ndx], p->prop_values[ndx]); } } rpt_nl(); rpt_vstring(d1, "%-20s %d", "count_modes", p->count_modes); for (int ndx = 0; ndx < p->count_modes; ndx++) { // p->nodes is a pointer to an array of struct _drmModeModeInfo, not an array of pointers summarize_drmmModeModeInfo( p->modes+ndx, d2); } rpt_vstring(d1, "%-20s %d - %s", "connection:", p->connection, connector_status_name(p->connection)); rpt_vstring(d1, "%-20s %d", "mm_width:", p->mmWidth); rpt_vstring(d1, "%-20s %d", "mm_height:", p->mmHeight); rpt_vstring(d1, "%-20s %d", "subpixel:", p->subpixel); rpt_nl(); } #ifdef REF typedef struct _drmModeProperty { uint32_t prop_id; uint32_t flags; char name[DRM_PROP_NAME_LEN]; int count_values; uint64_t *values; /* store the blob lengths */ int count_enums; struct drm_mode_property_enum *enums; int count_blobs; uint32_t *blob_ids; /* store the blob IDs */ } drmModePropertyRes, *drmModePropertyPtr; #endif /** Reports the raw bytes of a blob. * * @param blob_ptr pointer to a drmModePropertyBlobRes * @param depth logical indentation depth */ void report_drmModePropertyBlob(drmModePropertyBlobPtr blob_ptr, int depth) { rpt_vstring(depth, "blob id: %u", blob_ptr->id); rpt_hex_dump(blob_ptr->data, blob_ptr->length, depth); } /** Reports a property value * * @param fd file descriptor of open DRM device * @param prop_ptr pointer to struct containing property metadata * @param prop_value property value * @param depth logical indentation depth */ void report_property_value( int fd, drmModePropertyRes * prop_ptr, uint64_t prop_value, int depth) { int d1 = depth+1; rpt_vstring(depth, "Property id: %d", prop_ptr->prop_id); rpt_vstring(d1, "Name: %s", prop_ptr->name); rpt_vstring(d1, "Flags: 0x%04x - %s", prop_ptr->flags, interpret_property_flags(prop_ptr->flags) ); rpt_vstring(d1, "prop_value: %d 0x%08x", prop_value, prop_value); if (prop_ptr->flags & DRM_MODE_PROP_ENUM) { for (int i = 0; i < prop_ptr->count_enums; i++) { if (prop_ptr->enums[i].value == prop_value) { rpt_vstring(d1, "Property value(enum) = %d - %s", prop_value, prop_ptr->enums[i].name); break; } } } else if (prop_ptr->flags & DRM_MODE_PROP_BITMASK) { char buf[200] = ""; int bufsz=200; bool not_truncated = true; for (int i = 0; i < prop_ptr->count_enums && not_truncated; i++) { if (prop_ptr->enums[i].value & prop_value) { not_truncated = sbuf_append(buf, bufsz, ", ", prop_ptr->enums[i].name); } } rpt_vstring(d1, "Property value(bitmask) = 0x%04x - %s", prop_value, buf); } else if (prop_ptr->flags & DRM_MODE_PROP_RANGE) { if (prop_ptr->count_values != 2) { rpt_vstring(d1, "Property value = %d, Missing min or max value", prop_value); } else { rpt_vstring(d1, "Property value(range) = %d, min=%d, max=%d", prop_value, prop_ptr->values[0], prop_ptr->values[1]); } } // if (prop_ptr->flags & DRM_MODE_PROP_BLOB) { else if (drm_property_type_is(prop_ptr, DRM_MODE_PROP_BLOB)) { drmModePropertyBlobPtr blob_ptr = drmModeGetPropertyBlob(fd, prop_value); if (!blob_ptr) { rpt_vstring(d1, "Blob not found"); } else { report_drmModePropertyBlob(blob_ptr, d1); drmModeFreePropertyBlob(blob_ptr); } } else if (drm_property_type_is(prop_ptr, DRM_MODE_PROP_OBJECT)) { rpt_vstring(d1, "Object type, name = %s, value=%d", prop_ptr->name, prop_value); } else if (drm_property_type_is(prop_ptr, DRM_MODE_PROP_SIGNED_RANGE)) { if (prop_ptr->count_values != 2) { rpt_vstring(d1, "Signed property value = %d, Missing min or max value", prop_value); } else { rpt_vstring(d1, "Property value(range) = %d, min=%d, max=%d", (int64_t) prop_value, (int64_t) prop_ptr->values[0], (int64_t) prop_ptr->values[1]); } } else { rpt_vstring(d1, "Unrecognized type flags=0x%08x, value = %d", prop_ptr->flags, prop_value); } } #ifdef UGH // this belongs in property description, not in value dump if (prop->flags & DRM_MODE_PROP_BLOB) { printf("\t\tblobs:\n"); for (i = 0; i < prop->count_blobs; i++) dump_blob(dev, prop->blob_ids[i]); printf("\n"); } else { assert(prop->count_blobs == 0); } printf("\t\tvalue:"); if (prop->flags & DRM_MODE_PROP_BLOB) dump_blob(dev, value); else printf(" %"PRIu64"\n", value); #endif /** Reports a **drmModePropertyRes struct * * @param p pointer to drmModePropertyRes * @param depth logical indentation deptn */ void report_drm_modeProperty(drmModePropertyRes * p, int depth) { rpt_structure_loc("drmModePropertyRes", p, depth); int d1 = depth+1; int d2 = depth+2; rpt_vstring(d1, "%-20s %d", "prop_id:", p->prop_id); rpt_vstring(d1, "%-20s 0x%08x - %s", "flags:", p->flags, interpret_property_flags(p->flags)); rpt_vstring(d1, "%-20s %s", "name:", p->name); // null terminated? rpt_vstring(d1, "%-20s %d", "count_values:", p->count_values); for (int ndx = 0; ndx < p->count_values; ndx++) { rpt_vstring(d2, "values[%d] = %lu", ndx, p->values[ndx]); } rpt_vstring(d1, "%-20s %d", "count_enums:", p->count_enums); for (int ndx = 0; ndx < p->count_enums; ndx++) { rpt_vstring(d2, "enums[%d] = %u: %s", ndx, p->enums[ndx].value, p->enums[ndx].name); } rpt_vstring(d1, "%-20s %d", "count_blobs:", p->count_blobs); for (int ndx = 0; ndx < p->count_blobs; ndx++) { rpt_vstring(d2, "blob_ids[%d] = %u", ndx, p->blob_ids[ndx]); } } /** Emits a summary report for a **drmModePropertyRes struct * * @param p pointer to drmModePropertyRes * @param depth logical indentation deptn */ void summarize_drm_modeProperty(drmModePropertyRes * p, int depth) { rpt_vstring(depth, "Property %2d: %-20s flags: 0x%08x - %s", p->prop_id, p->name, p->flags, interpret_property_flags(p->flags) ); } ddcutil-0.8.6/src/util/x11_util.c0000644000175000001440000002051413101546540013451 00000000000000/* x11_util.c * * * Adapted from file randr-edid.c from libCEC. How to properly handle copyright? * * * Copyright (C) 2016-2917 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * * * * Adapted from libCEC by Pulse-Eight Limited. Pulse-Eight's copyright follows: * * This file is part of the libCEC(R) library. * * libCEC(R) is Copyright (C) 2011-2015 Pulse-Eight Limited. All rights reserved. * libCEC(R) is an original work, containing original code. * * libCEC(R) is a trademark of Pulse-Eight Limited. * * This program is dual-licensed; 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 * * * Alternatively, you can license this library under a commercial license, * please contact Pulse-Eight Licensing for more information. * * For more information contact: * Pulse-Eight Licensing * http://www.pulse-eight.com/ * http://www.pulse-eight.net/ */ /** @file x11_util.c * X11 related utility functions */ /** \cond */ #include #include #include #include #include #include #include #include #include #include /** \endcond */ // #include "env.h" // #include "randr-edid.h" #include "string_util.h" #include "x11_util.h" static const char * const edid_names[] = { #if (RANDR_MAJOR > 1) || (RANDR_MAJOR == 1 && RANDR_MINOR >2) RR_PROPERTY_RANDR_EDID, #else "EDID", #endif "EDID_DATA", "XFree86_DDC_EDID1_RAWDATA" }; #define EDID_NAME_COUNT (sizeof(edid_names)/sizeof(*edid_names)) // GPtrArray callback function // typedef: void (*GDestroyNotify)(gpointer data) static void edid_recs_free_func(gpointer voidptr) { X11_Edid_Rec * prec = voidptr; free(prec->edidbytes); free(prec->output_name); } /** Obtains all the EDIDs known to X11. * * @return GPtrArray of X11_Edid_Rec * * It is the responsibility of the caller to free the returned data structure */ GPtrArray * get_x11_edids() { bool debug = false; GPtrArray * edid_recs = g_ptr_array_new(); g_ptr_array_set_free_func(edid_recs, edid_recs_free_func); //uint16_t physical_address = 0; /* open default X11 DISPLAY */ Display *disp = XOpenDisplay(NULL); if( disp ) { int event_base, error_base; int maj, min; if( XRRQueryExtension(disp, &event_base, &error_base) && XRRQueryVersion(disp, &maj, &min) ) { int version = (maj << 8) | min; if( version >= 0x0102 ) { size_t atom_avail = 0; Atom edid_atoms[EDID_NAME_COUNT]; if( XInternAtoms(disp, (char **)edid_names, EDID_NAME_COUNT, True, edid_atoms) ) { /* remove missing some atoms */ atom_avail = 0; for(size_t atom_count=0; atom_count 0 ) { int scr_count = ScreenCount(disp); int screen; for(screen=0; screen 1) || (RANDR_MAJOR == 1 && RANDR_MINOR >=3) if( version >= 0x0103 ) { /* get cached resources if they are available */ rsrc = XRRGetScreenResourcesCurrent(disp, root); } if( NULL == rsrc ) #endif rsrc = XRRGetScreenResources(disp, root); if( NULL != rsrc ) { int output_id; for( output_id=0; output_id < rsrc->noutput; ++output_id ) { RROutput rr_output_id = rsrc->outputs[output_id]; XRROutputInfo *output_info = XRRGetOutputInfo(disp, rsrc, rr_output_id); if( NULL != output_info ) { // printf("Found output %.*s\n", output_info->nameLen, output_info->name); if( RR_Connected == output_info->connection ) { // printf("is connected\n"); bool edid_found = false; for(size_t atom_count=0; !edid_found && atom_countedidbytes = calloc(1,128); memcpy(edidrec->edidbytes, data, 128); edidrec->output_name = calloc(1, output_info->nameLen + 1); memcpy(edidrec->output_name, output_info->name, output_info->nameLen); g_ptr_array_add(edid_recs, edidrec); edid_found = true; // physical_address = CEDIDParser::GetPhysicalAddressFromEDID(data, nitems); } XFree(data); } } } XRRFreeOutputInfo(output_info); } else break; /* problem ? */ } XRRFreeScreenResources(rsrc); } } } } } XCloseDisplay(disp); } if (debug) { int ndx = 0; printf("Returning %d X11_Edid_Recs\n", edid_recs->len); for (; ndx < edid_recs->len; ndx++) { X11_Edid_Rec * prec = g_ptr_array_index(edid_recs, ndx); printf(" Output name: %s -> %p\n", prec->output_name, prec->edidbytes); hex_dump(prec->edidbytes, 128); } } return edid_recs; } /** Frees the data structure returned by get_x11_edids() * * @param edidrecs pointer to GPtrArray of pointers to X11_Edid_Rec */ void free_x11_edids(GPtrArray * edidrecs) { g_ptr_array_free(edidrecs, true); } ddcutil-0.8.6/src/util/coredefs.h0000644000175000001440000000234713230445447013615 00000000000000/* coredefs.h * * Basic definitions. These definitions are not application specific. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file coredefs.h * Basic definitions. */ #ifndef COREDEFS_H_ #define COREDEFS_H_ /** Raw byte */ typedef unsigned char Byte; #ifndef ARRAY_SIZE /** Number of entries in array */ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #endif #endif /* COREDEFS_H_ */ ddcutil-0.8.6/src/util/debug_util.h0000644000175000001440000000217513230445447014145 00000000000000/* debug_util.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DEBUG_UTIL_H_ #define DEBUG_UTIL_H_ /** @file debug_util.h * Functions for debugging */ #include GPtrArray * get_backtrace(int stack_adjust); void show_backtrace(int stack_adjust); #endif /* DEBUG_UTIL_H_ */ ddcutil-0.8.6/src/util/device_id_util.h0000644000175000001440000000533713230445447014775 00000000000000/* device_id_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file device_id_util.h * Lookup PCI and USB device ids */ #ifndef DEVICE_ID_UTIL_H_ #define DEVICE_ID_UTIL_H_ /** \cond */ #include #include #include #include /** \endcond */ // *** Initialization *** bool devid_ensure_initialized(); // *** Device ID lookup *** /** Return value for devid_get_pci_names() and devid_usb_names(). * Depending on the number of arguments to those functions, * device_name and subsys_or_interface_name may or may not be set. */ typedef struct { char * vendor_name; ///< vendor name char * device_name; ///< device name (may be NULL) char * subsys_or_interface_name; ///< subsystem or interface name (may be NULL) } Pci_Usb_Id_Names; Pci_Usb_Id_Names devid_get_pci_names( ushort vendor_id, ushort device_id, ushort subvendor_id, ushort subdevice_id, int argct); Pci_Usb_Id_Names devid_get_usb_names( ushort vendor_id, ushort device_id, ushort interface_id, int argct); // *** HID Descriptor Item Types *** // "item type" is the term used in usb.ids // "item tag" is the term used in USB HID documentation char * devid_hid_descriptor_item_type(ushort id); // R entry in usb.ids, corresponds to names_reporttag() // *** HID Descriptor Type *** // declared here but not defined // char * devid_hid_descriptor_type(ushort id); // HID entry in usb.ids // *** HUT table *** char * devid_usage_code_page_name(ushort usage_page_code); // corresponds to names_huts() char * devid_usage_code_id_name(ushort usage_page_code, ushort usage_simple_id); // corresponds to names_hutus() char * devid_usage_code_name_by_extended_id(uint32_t extended_usage); #endif /* DEVICE_ID_UTIL_H_ */ ddcutil-0.8.6/src/util/failsim.h0000644000175000001440000000615013230445447013443 00000000000000/* failsim.h * * Functions to enable runtime error simulation * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file failsim.h * Functions that provide a simple failure simulation framework. */ #ifndef FAILSIM_H_ #define FAILSIM_H_ #include "config.h" /** \cond */ #include #include /** \endcond */ // Issue: Where to send error messages? // // Initialization // typedef bool (*Fsim_Name_To_Number_Func)(const char * name, int * p_number); void fsim_set_name_to_number_funcs( Fsim_Name_To_Number_Func func, Fsim_Name_To_Number_Func unmodulated_func); /** Indicates whether a failure should occur exactly one or be recurring */ typedef enum {FSIM_CALL_OCC_RECURRING, FSIM_CALL_OCC_SINGLE} Fsim_Call_Occ_Type; // // Error table manipulation // void fsim_add_error( char * funcname, Fsim_Call_Occ_Type call_occ_type, int occno, int rc); void fsim_clear_errors_for_func(char * funcname); void fsim_clear_error_table(); void fsim_report_error_table(int depth); void fsim_reset_callct(char * funcname); // // Bulk load error table // bool fsim_load_control_from_gptrarray(GPtrArray * lines); // bool fsim_load_control_string(char * s); // unimplemented bool fsim_load_control_file(char * fn); // // Runtime error check // // int fsim_check_failure(const char * fn, const char * funcname); /* Return value for fsim_check_failure(). * Indicates whether a failure should be forced and if so the * simulated status code the function should return. */ typedef struct { bool force_failure; int failure_value; } Failsim_Result; Failsim_Result fsim_check_failure(const char * fn, const char * funcname); #ifdef ENABLE_FAILSIM #define FAILSIM \ do { \ Failsim_Result __rcsim = fsim_check_failure(__FILE__, __func__); \ if (__rcsim.force_failure) \ return __rcsim.failure_value; \ } while(0); #define FAILSIM_EXT(__addl_cmds) \ do { \ Failsim_Result __rcsim = fsim_check_failure(__FILE__, __func__); \ if (__rcsim.force_failure) { \ __addl_cmds; \ return __rcsim.failure_value; \ } \ } while(0); #else #define FAILSIM #define FAILSIM_EXT(__addl_cmds) #endif #endif /* FAILSIM_H_ */ ddcutil-0.8.6/src/util/libdrm_util.h0000644000175000001440000000345313230445447014330 00000000000000/* libdrm_util.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file libdrm_util.h * Utilities for use with libdrm */ #ifndef LIBDRM_UTIL_H_ #define LIBDRM_UTIL_H_ /** \cond */ #include #include /** \endcond */ char * connector_type_name( Byte val); char * connector_type_title(Byte val); char * connector_status_name( drmModeConnection val); char * connector_status_title(drmModeConnection val); char * encoder_type_title(uint32_t encoder_type); void report_drmModeRes( drmModeResPtr res, int depth); void report_drmModePropertyBlob( drmModePropertyBlobPtr blob_ptr, int depth); void report_drmModeConnector( int fd, drmModeConnector * p, int depth); void report_drm_modeProperty( drmModePropertyRes * p, int depth); void summarize_drm_modeProperty(drmModePropertyRes * p, int depth); void report_property_value(int fd, drmModePropertyPtr prop_ptr, uint64_t prop_value, int depth) ; #endif /* LIBDRM_UTIL_H_ */ ddcutil-0.8.6/src/util/multi_level_map.h0000644000175000001440000000445213230445447015200 00000000000000/* multi_level_map.h * * * Copyright (C) 2015-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file multi_level_map.h * Multi_Level_Map data structure */ #ifndef MULTI_LEVEL_TABLE_H_ #define MULTI_LEVEL_TABLE_H_ /** \cond */ #include /** \endcond */ #define MLT_MAX_LEVELS 4 typedef struct { int levels; char * names[MLT_MAX_LEVELS]; } Multi_Level_Names; typedef struct { int levels; uint ids[MLT_MAX_LEVELS]; } Multi_Level_Ids; typedef struct { ushort level; uint code; char * name; GPtrArray * children; } MLM_Node; /* Used to both describe a level in a **Multi_Level_Map** table, * /and maintain data about that level */ typedef struct { char * name; int initial_size; int total_entries; MLM_Node * cur_entry; } MLM_Level; void report_mlm_level(MLM_Level * level_desc, int depth); typedef struct { char* table_name; char* segment_tag; int levels; GPtrArray * root; MLM_Level level_detail[]; // MLM_Level * level_detail; } Multi_Level_Map; Multi_Level_Map * mlm_create(char * table_name, int levels, MLM_Level* level_detail); MLM_Node * mlm_add_node(Multi_Level_Map * mlm, MLM_Node * parent, uint key, char * value); void report_multi_level_map(Multi_Level_Map * mlm, int depth); Multi_Level_Names mlm_get_names(Multi_Level_Map * mlm, int argct, ...); Multi_Level_Names mlm_get_names2(Multi_Level_Map * mlm, int levelct, uint* ids); #endif /* MULTI_LEVEL_TABLE_H_ */ ddcutil-0.8.6/src/util/output_sink.h0000644000175000001440000000316713230445447014410 00000000000000/* output_sink.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file output_sink.h * Alternative mechanism for output redirecton. * Not currently used (3/2017) */ #ifndef UTIL_OUTPUT_SINK_H_ #define UTIL_OUTPUT_SINK_H_ /** \cond */ #include #include /** \endcond */ /** Type of output sink */ typedef enum {SINK_STDOUT, SINK_FILE, SINK_MEMORY} Output_Sink_Type; /** Opaque handle to output sink instance */ typedef void * Output_Sink; Output_Sink create_terminal_sink(); Output_Sink create_file_sink(FILE * fp); Output_Sink create_memory_sink(int initial_line_ct, int estimated_max_chars); int printf_sink(Output_Sink sink, const char * format, ...); GPtrArray * read_sink(Output_Sink sink); int close_sink(Output_Sink sink); #endif /* UTIL_OUTPUT_SINK_H_ */ ddcutil-0.8.6/src/util/x11_util.h0000644000175000001440000000255113230445447013466 00000000000000/* x11_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file x11_util.h * Utilities for X11 */ #ifndef X11_UTIL_H_ #define X11_UTIL_H_ /** \cond */ #include /** \endcond */ #include "coredefs.h" /** Represents one EDID known to X11 */ typedef struct { char * output_name; ///< RandR output name Byte * edidbytes; ///< pointer to 128 byte EDID } X11_Edid_Rec; GPtrArray * get_x11_edids(); // returns array of X11_Edid_Rec void free_x11_edids(GPtrArray * edidrecs); #endif /* X11_UTIL_H_ */ ddcutil-0.8.6/src/util/udev_usb_util.h0000644000175000001440000000537213230445447014675 00000000000000/* udev_usb_util.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * USB specific udev utility functions */ #ifndef UDEV_USB_UTIL_H_ #define UDEV_USB_UTIL_H_ /** \cond */ #include #include #include /** \endcond */ void probe_udev_subsystem(char * udev_class, bool show_usb_parent, int depth); #define UDEV_DETAILED_DEVICE_SUMMARY_MARKER "UDDS" /** Identifying information for UDEV device * * @remark * Currently (3/2017) used solely for informational messages, * so no need to convert from strings to integers. */ typedef struct { char marker[4]; ///< always "UDDS" char * devname; ///< e.g. /dev/usb/hiddev2 // int usb_busnum; // int usb_devnum; // uint16_t vid; // uint16_t pid; char * vendor_id; ///< vendor id, as 4 hex characters char * product_id; ///< product id, as 4 hex characters char * vendor_name; ///< vendor name char * product_name; ///< product name char * busnum_s; ///< bus number, as a string char * devnum_s; ///< device number, as a string } Usb_Detailed_Device_Summary; void free_usb_detailed_device_summary(Usb_Detailed_Device_Summary * devsum); void report_usb_detailed_device_summary(Usb_Detailed_Device_Summary * devsum, int depth); Usb_Detailed_Device_Summary * lookup_udev_usb_device_by_devname(char * devname); /** USB bus number/device number pair */ typedef struct udev_usb_devinfo { uint16_t busno; ///< USB bus number uint16_t devno; ///< device number on USB bus } Udev_Usb_Devinfo; void report_udev_usb_devinfo(struct udev_usb_devinfo * dinfo, int depth); Udev_Usb_Devinfo * get_udev_usb_devinfo(char * subsystem, char * simple_devname); // Move function to hiddev utility library? /** Excapsulates location of hiddev device files, in case it needs to be generalized */ char * usb_hiddev_directory(); #endif /* UDEV_USB_UTIL_H_ */ ddcutil-0.8.6/src/util/data_structures.h0000644000175000001440000001606713230445447015243 00000000000000/* data_structures.h * * General purpose data structures * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file data_structures.h * Generic data structures */ #ifndef DATA_STRUCTURES_H #define DATA_STRUCTURES_H /** \cond */ #include #include /** \endcond */ #include "coredefs.h" // for Byte typedef bool *IFilter(int i); /** An opaque structure containing an array of bytes that * can grow dynamically. Note that the same byte value can * appear multiple times. */ typedef void * Byte_Value_Array; Byte_Value_Array bva_create(); int bva_length(Byte_Value_Array bva); void bva_append(Byte_Value_Array bva, Byte item); Byte bva_get(Byte_Value_Array bva, int ndx); bool bva_contains(Byte_Value_Array bva, Byte item); bool bva_sorted_eq(Byte_Value_Array bva1, Byte_Value_Array bva2); Byte * bva_bytes(Byte_Value_Array bva); char * bva_as_string(Byte_Value_Array bva, bool as_hex, char * sep); void bva_free(Byte_Value_Array bva); void bva_report(Byte_Value_Array ids, char * title); bool bva_store_bytehex_list(Byte_Value_Array bva, char * start, int len); Byte_Value_Array bva_filter(Byte_Value_Array bva, IFilter filter_func); void bva_sort(Byte_Value_Array bva); /** An opaque data structure containing 256 flags */ typedef void * Byte_Bit_Flags; Byte_Bit_Flags bbf_create(); void bbf_free(Byte_Bit_Flags flags); void bbf_set(Byte_Bit_Flags flags, Byte val); bool bbf_is_set(Byte_Bit_Flags flags, Byte val); Byte_Bit_Flags bbf_subtract(Byte_Bit_Flags bbflags1, Byte_Bit_Flags bbflags2); char * bbf_repr(Byte_Bit_Flags flags, char * buffer, int buflen); int bbf_count_set(Byte_Bit_Flags flags); // number of bits set int bbf_to_bytes(Byte_Bit_Flags flags, Byte * buffer, int buflen); char * bbf_to_string(Byte_Bit_Flags flags, char * buffer, int buflen); bool bbf_store_bytehex_list(Byte_Bit_Flags flags, char * start, int len); /** Opaque iterator for #Byte_Bit_Flags */ typedef void * Byte_Bit_Flags_Iterator; Byte_Bit_Flags_Iterator bbf_iter_new(Byte_Bit_Flags bbflags); void bbf_iter_free(Byte_Bit_Flags_Iterator bbf_iter); void bbf_iter_reset(Byte_Bit_Flags_Iterator bbf_iter); int bbf_iter_next(Byte_Bit_Flags_Iterator bbf_iter); // // Byte_Value_Array Byte_Bit_Flags cross-compatibility functions // bool bva_bbf_same_values( Byte_Value_Array bva , Byte_Bit_Flags bbf); /** Function signature for passing function that appends a value to * either a #Byte_Bit_Flags or a #Byte_Value_Array */ typedef void (*Byte_Appender) (void * data_struct, Byte val); void bva_appender(void * data_struct, Byte val); void bbf_appender(void * data_struct, Byte val); // Store a value in either a Byte_Value_Array or a Byte_Bit_Flag bool store_bytehex_list(char * start, int len, void * data_struct, Byte_Appender appender); // test case void test_value_array(); // // Buffer with length management // #define BUFFER_MARKER "BUFR" /** Buffer with length management */ typedef struct { char marker[4]; ///< always "BUFR" Byte * bytes; ///< pointer to internal buffer int buffer_size; ///< size of internal buffer int len; ///< number of bytes in buffer uint16_t size_increment; ///< if > 0, auto-extend increment } Buffer; Buffer * buffer_new(int size, const char * trace_msg); void buffer_set_size_increment(Buffer * buffer, uint16_t increment); Buffer * buffer_dup(Buffer * srcbuf, const char * trace_msg); Buffer * buffer_new_with_value(Byte * bytes, int bytect, const char * trace_msg); int buffer_length(Buffer * buffer); void buffer_set_length(Buffer * buffer, int bytect); void buffer_free(Buffer * buffer, const char * trace_msg); void buffer_put(Buffer * buffer, Byte * bytes, int bytect); void buffer_set_byte(Buffer * buffer, int offset, Byte byte); void buffer_set_bytes(Buffer * buffer, int offset, Byte * bytes, int bytect); void buffer_append(Buffer * buffer, Byte * bytes, int bytect); void buffer_strcat(Buffer * buffer, char * str); void buffer_add(Buffer * buffer, Byte byte); void buffer_dump(Buffer * buffer); bool buffer_eq(Buffer* buf1, Buffer* buf2); void buffer_extend(Buffer* buf, int addl_bytes); Buffer * bbf_to_buffer(Byte_Bit_Flags flags); // // Identifier id to name and description lookup // /** \def VN(v) * Creates a Value_Name table entry by specifying its symbolic name. * * @param v symbolic name */ #define VN(v) {v,#v,NULL} /** \def VN_END * Terminating entry for a Value_Name table. */ #define VN_END {0xff,NULL,NULL} /** \def VNT(v,t) * Creates a Value_Name_Title table entry by specifying its symbolic name * and description * * @param v symbolic name * @param t symbol description */ #define VNT(v,t) {v,#v,t} /** Terminating entry for a Value_Name_Title table. */ #define VNT_END {0xff,NULL,NULL} /** A Value_Name_Title table is used to map byte values to their * symbolic names and description (title). * Each entry is a value/name/description triple.. * * The table is terminated by an entry whose name and description fields are NULL. */ typedef struct { uint32_t value; ///< value char * name; ///< symbolic name char * title; ///< value description } Value_Name_Title; typedef Value_Name_Title Value_Name_Title_Table[]; typedef Value_Name_Title Value_Name; typedef Value_Name_Title_Table Value_Name_Table; char * vnt_name( Value_Name_Title* table, uint32_t val); #ifdef TRANSITIONAL #define vn_name vnt_name #endif char * vnt_title(Value_Name_Title* table, uint32_t val); uint32_t vnt_find_id( Value_Name_Title_Table table, const char * s, bool use_title, // if false, search by symbolic name, if true, search by title bool ignore_case, uint32_t default_id); #define INTERPRET_VNT_FLAGS_BY_NAME false #define INTERPRET VNT_FLAGS_BY_TITLE true char * vnt_interpret_flags( uint32_t flags_val, Value_Name_Title_Table bitname_table, bool use_title, char * sepstr); #endif /* DATA_STRUCTURES_H */ ddcutil-0.8.6/src/util/edid.h0000644000175000001440000001042213230445447012721 00000000000000/* edid.h * * Functions for processing the EDID data structure, irrespective of how * the bytes of the EDID are obtained. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file edid.h * Functions to interpret EDID */ #ifndef EDID_H_ #define EDID_H_ /** \cond */ #include #include #include #include /** \endcond */ #include "coredefs.h" // Field sizes for holding strings extracted from an EDID // Note that these are sized to allow for a trailing null character. #define EDID_MFG_ID_FIELD_SIZE 4 #define EDID_EXTRA_STRING_FIELD_SIZE 14 #define EDID_MODEL_NAME_FIELD_SIZE 14 #define EDID_SERIAL_ASCII_FIELD_SIZE 14 #define EDID_SOURCE_MAX_LEN 3 #define EDID_SOURCE_FIELD_SIZE 4 //Calculates checksum for a 128 byte EDID Byte edid_checksum(Byte * edid); void parse_mfg_id_in_buffer(Byte * mfgIdBytes, char * buffer, int bufsize); // Extracts the 3 character manufacturer id from an EDID byte array. // The id is returned, with a trailing null character, in a buffer provided by the caller. void get_edid_mfg_id_in_buffer(Byte* edidbytes, char * result, int bufsize); #define EDID_MARKER_NAME "EDID" /** Represents a parsed EDID */ typedef struct { char marker[4]; ///< always "EDID" Byte bytes[128]; ///< raw bytes of EDID char mfg_id[EDID_MFG_ID_FIELD_SIZE]; ///< 3 character mfg id, null terminated ushort model_hex; ///< model hex field char model_name[EDID_MODEL_NAME_FIELD_SIZE]; ///< model name (tag 0xfc) uint32_t serial_binary; ///< binary serial number char serial_ascii[EDID_SERIAL_ASCII_FIELD_SIZE]; ///< serial number string (tag 0xff) char extra_descriptor_string[EDID_EXTRA_STRING_FIELD_SIZE]; ///< (tag 0xfe) int year; ///< can be year of manufacture or model bool is_model_year; ///< if true, year is model year, if false, is manufacture year Byte edid_version_major; ///< EDID major version number Byte edid_version_minor; ///< EDID minor version number ushort wx; ///< whitepoint x coordinate ushort wy; ///< whitepoint y coordinate ushort rx; ///< red x coordinate ushort ry; ///< red y coordinate ushort gx; ///< green x coordinate ushort gy; ///< green y coordinate ushort bx; ///< blue x coordinate ushort by; ///< blue y coordinate Byte video_input_definition; /// EDID byte 20 (x14) // bool is_digital_input; // from byte 20 (x14), but 7 Byte supported_features; ///< EDID byte 24 (x18) supported features bitmap uint8_t extension_flag; ///< number of optional extension blocks char edid_source[EDID_SOURCE_FIELD_SIZE]; ///< describes source of EDID } Parsed_Edid; Parsed_Edid * create_parsed_edid(Byte* edidbytes); void report_parsed_edid_base(Parsed_Edid * edid, bool verbose, bool show_raw, int depth); void report_parsed_edid(Parsed_Edid * edid, bool verbose, int depth); void free_parsed_edid(Parsed_Edid * parsed_edid); #endif /* EDID_H_ */ ddcutil-0.8.6/src/util/file_util.h0000644000175000001440000000320013230445447013764 00000000000000/* file_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file file_util.h * File utility functions */ #ifndef FILE_UTIL_H_ #define FILE_UTIL_H_ /** \cond */ #include #include #include /** \endcond */ int file_getlines(const char * fn, GPtrArray* line_array, bool verbose); char * file_get_first_line(const char * fn, bool verbose); GByteArray * read_binary_file(char * fn, int est_size, bool verbose); bool regular_file_exists(const char * fqfn); bool directory_exists(const char * fqfn); /** Filter function for get_filenames_by_filter() */ typedef int (*Dirent_Filter)(const struct dirent *end); GPtrArray * get_filenames_by_filter(const char * dirnames[], Dirent_Filter filter_func); int filename_for_fd(int fd, char** p_fn); #endif /* FILE_UTIL_H_ */ ddcutil-0.8.6/src/util/glib_string_util.h0000644000175000001440000000263313230445447015361 00000000000000/* glib_string_util.h * * Functions that depend on both glib_util.c and string_util.c * * glib_string_util.c/h exists to avoid circular dependencies. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file glib_string_util.h * Functions that depend on both glib_util.c and string_util.c */ /** \cond */ #include /** \endcond */ #ifndef GLIB_STRING_UTIL_H_ #define GLIB_STRING_UTIL_H_ char * join_string_g_ptr_array(GPtrArray* strings, char * sepstr); int gaux_string_ptr_array_find(GPtrArray * haystack, const char * needle); #endif /* GLIB_STRING_UTIL_H_ */ ddcutil-0.8.6/src/util/glib_util.h0000644000175000001440000000423713230445447013775 00000000000000/* glib_util.h * * Utility functions for glib. * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file glib_util.h * Functions for use with glib */ #ifndef GLIB_UTIL_H_ #define GLIB_UTIL_H_ /** \cond */ #include /** \endcond */ gpointer * g_list_to_g_array(GList * glist, guint * length); gint gaux_ptr_scomp(gconstpointer a, gconstpointer b); gchar * gaux_asprintf(gchar * fmt, ...); gchar * get_thread_dynamic_buffer( GPrivate * buf_key_ptr, GPrivate * bufsz_key_ptr, guint16 required_size); gchar * get_thread_fixed_buffer( GPrivate * buf_key_ptr, guint16 required_size); GPtrArray * gaux_ptr_array_truncate(GPtrArray * gpa, int limit); // Future: typedef gpointer (*GAuxDupFunc)(gpointer src); GPtrArray * gaux_ptr_array_append_array( GPtrArray * dest, GPtrArray * src, GAuxDupFunc dup_func); GPtrArray * gaux_ptr_array_join( GPtrArray * gpa1, GPtrArray * gpa2, GAuxDupFunc dup_func, GDestroyNotify element_free_func); GPtrArray * gaux_ptr_array_copy( GPtrArray * src, GAuxDupFunc dup_func, GDestroyNotify element_free_func); GPtrArray * gaux_ptr_array_from_null_terminated_array( gpointer * src, GAuxDupFunc dup_func, GDestroyNotify element_free_func); #endif /* GLIB_UTIL_H_ */ ddcutil-0.8.6/src/util/i2c_util.h0000644000175000001440000000203013230445447013522 00000000000000/* i2c_util.h * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * I2C Utility Functions */ #ifndef I2C_UTIL_H_ #define I2C_UTIL_H_ int i2c_name_to_busno(char * name); #endif /* I2C_UTIL_H_ */ ddcutil-0.8.6/src/util/report_util.h0000644000175000001440000000610213230445447014364 00000000000000/* report_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file report_util.h * Report utility package */ #ifndef REPORT_UTIL_H_ #define REPORT_UTIL_H_ /** \cond */ #include #include #include /** \endcond */ #include "coredefs.h" void rpt_push_output_dest(FILE* new_dest); void rpt_pop_output_dest(); FILE * rpt_cur_output_dest(); void rpt_reset_output_dest_stack(); void rpt_change_output_dest(FILE* new_dest); void rpt_debug_output_dest(); int rpt_get_indent(int depth); void rpt_flush(); void rpt_nl(); void rpt_title(char * title, int depth); void rpt_label(int depth, char * text); void rpt_multiline(int depth, ...); void rpt_g_ptr_array(int depth, GPtrArray * strings); void rpt_vstring(int depth, char * format, ...) ; void rpt_2col(char * s1, char * s2, int col2offset, bool offset_absolute, int depth); void rpt_structure_loc(const char * name, const void * ptr, int depth); void rpt_hex_dump(const Byte * data, int size, int depth); int rpt_file_contents(const char * fn, bool verbose, int depth); // Remaining rpt_ functions share common formatting void rpt_str(const char * name, char * info, const char * val, int depth); void rpt_int(char * name, char * info, int val, int depth); void rpt_bool(char * name, char * info, bool val, int depth); /** Interpretation function used by rpt_mapped_int() */ typedef char * (*Value_To_Name_Function)(int val); void rpt_mapped_int(char * name, char * info, int val, Value_To_Name_Function func, int depth); void rpt_int_as_hex(char * name, char * info, int val, int depth); void rpt_uint8_as_hex(char * name, char * info, unsigned char val, int depth) ; void rpt_bytes_as_hex(const char * name, char * info, Byte * bytes, int ct, bool hex_prefix_flag, int depth); typedef struct { char * flag_name; char * flag_info; int flag_val; } Flag_Info; typedef struct { int flag_info_ct; Flag_Info * flag_info_recs; } Flag_Dictionary; typedef struct { int flag_name_ct; char ** flag_names; } Flag_Name_Set; void rpt_ifval2(char * name, char * info, int val, Flag_Name_Set * pflagNameSet, Flag_Dictionary * pDict, int depth); #endif /* REPORT_UTIL_H_ */ ddcutil-0.8.6/src/util/string_util.h0000644000175000001440000001507013230445447014363 00000000000000/* string_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file string_util.h * String utility functions header file */ #ifndef STRINGUTIL_H_ #define STRINGUTIL_H_ /** \cond */ #include #include #include #include /** \endcond */ #include "coredefs.h" #include "glib_util.h" // // General // // Returns "true" or "false": char * bool_repr(int value); #ifdef DEPRECATED // use library function g_strlcpy() instead #define SAFE_STRNCPY(dest, src, buflen) \ do { \ strncpy(dest, src, (buflen) ); \ if (buflen > 0) \ dest[buflen-1] = '\0'; \ } while(0) #endif #define SAFE_SNPRINTF(buf, bufsz, fmt, ...) \ do { \ snprintf(buf, bufsz, fmt, __VA_ARGS__ ); \ if (bufsz > 0) \ buf[bufsz-1] = '\0'; \ } while(0) // // String functions (other than hex) // bool streq(const char * s1, const char * s2); bool is_abbrev(const char * value, const char * longname, size_t minchars); bool str_starts_with(const char * value_to_test, const char * start_part); bool str_ends_with(const char * value_to_test, const char * end_part); bool str_all_printable(const char * s); char * strupper(char * s); char * strdup_uc(const char* s); char * strjoin( const char ** pieces, const int ct, const char * sepstr); char * chars_to_string(const char * start, int len); char * strtrim(const char * s); char * strtrim_r(const char * s, char * buffer, int bufsz); char * rtrim_in_place(char * s); char * substr(const char * s, int startpos, int ct); char * lsub(const char * s, int ct); char * str_replace_char(char * s, char old_char, char new_char); char * strcat_new(char * s1, char * s2); bool sbuf_append(char * buf, int bufsz, char * sepstr, char * nextval); char * ascii_strcasestr(const char * haystack, const char * needle); typedef bool (*String_Comp_Func)(const char * a, const char * b); int matches_by_func( const char * word, const char ** match_list, String_Comp_Func comp_func); int exactly_matches_any(const char * word, const char ** match_list); int starts_with_any( const char * word, const char ** match_list); /** pointer to null-terminated array of strings */ typedef char** Null_Terminated_String_Array; void ntsa_free( Null_Terminated_String_Array string_array, bool free_strings); int ntsa_length(Null_Terminated_String_Array string_array); void ntsa_show( Null_Terminated_String_Array string_array); int ntsa_findx( Null_Terminated_String_Array string_array, char * value, String_Comp_Func func); int ntsa_find( Null_Terminated_String_Array string_array, char * value); Null_Terminated_String_Array ntsa_join( Null_Terminated_String_Array a1, Null_Terminated_String_Array a2, bool dup); Null_Terminated_String_Array strsplit(const char * str_to_split, const char* delims); Null_Terminated_String_Array strsplit_maxlength( const char * str_to_split, uint16_t max_piece_length, const char * delims); GPtrArray * ntsa_to_g_ptr_array(Null_Terminated_String_Array ntsa); Null_Terminated_String_Array g_ptr_array_to_ntsa(GPtrArray * garray); // // Integer conversion // bool str_to_int(const char * nptr, int * ival); // // Hex value conversion. // bool hhs_to_byte_in_buf(const char * s, Byte * result); // converts null terminated string into buffer bool any_one_byte_hex_string_to_byte_in_buf(const char * s, Byte * result); bool hhc_to_byte_in_buf(const char * hh, Byte * result); // converts 2 characters at hh into buffer #ifdef OLD Byte hhs_to_byte(char * s); // converts null terminated string Byte hhc_to_byte(char * hh); // converts 2 characters at hh void test_hhs_to_byte() ; #endif int hhs_to_byte_array(const char * hhs, Byte** pBa); char * hexstring(const Byte * bytes, int size); // buffer returned must be freed char * hexstring_t( const unsigned char * bytes, int len); char * hexstring2( const unsigned char * bytes, // bytes to convert int len, // number of bytes const char * sepstr, // separator string between hex digits bool uppercase, // use upper case hex characters char * buffer, // buffer in which to return hex string int bufsz); // buffer size #ifdef DEPRECATED char * hexstring2_t( const unsigned char * bytes, // bytes to convert int len, // number of bytes const char * sepstr, // separator string between hex digits bool uppercase); // use upper case hex characters? #endif char * hexstring3_t( const unsigned char * bytes, // bytes to convert int len, // number of bytes const char * sepstr, // separator string between hex digits uint8_t hunk_size, // separator string frequency bool uppercase); // use upper case hex characters void fhex_dump_indented(FILE * fh, const Byte* data, int size, int indents); void fhex_dump( FILE * fh, const Byte* bytes, int size); void hex_dump( const Byte* bytes, int size); // // Standard function variants that handle stream == NULL // int f0putc(int c, FILE * stream); int f0puts(const char * s, FILE * stream); int f0printf( FILE * stream, const char * format, ...); int vf0printf(FILE * stream, const char * format, va_list ap); // // Miscellaneous // bool all_bytes_zero(Byte * bytes, int bytect); bool apply_filter_terms(const char * text, char ** terms, bool ignore_case); #endif /* STRINGUTIL_H_ */ ddcutil-0.8.6/src/util/subprocess_util.h0000644000175000001440000000264713230445447015253 00000000000000/* subprocess_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file subprocess_util.h * Functions to execute shell commands */ #ifndef SUBPROCESS_UTIL_H_ #define SUBPROCESS_UTIL_H_ /** \cond */ #include #include /** \endcond */ bool execute_shell_cmd(char * shell_cmd); bool execute_shell_cmd_rpt(char * shell_cmd, int depth); GPtrArray * execute_shell_cmd_collect(char * shell_cmd); char * execute_shell_cmd_one_line_result(char * shell_cmd); bool is_command_in_path(char * cmd); int test_command_executability(char * cmd); #endif /* SUBPROCESS_UTIL_H_ */ ddcutil-0.8.6/src/util/sysfs_util.h0000644000175000001440000000363613230445447014231 00000000000000/* sysfs_util.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Functions for reading /sys file system */ #ifndef SYSFS_UTIL_H_ #define SYSFS_UTIL_H_ #include #include char * read_sysfs_attr( const char * dirname, const char * attrname, bool verbose); char * read_sysfs_attr_w_default( const char * dirname, const char * attrname, const char * default_value, bool verbose); char * read_sysfs_attr_w_default_r( const char * dirname, const char * attrname, const char * default_value, char * buf, unsigned bufsz, bool verbose); GByteArray * read_binary_sysfs_attr( const char * dirname, const char * attrname, int est_size, bool verbose); bool is_module_loaded_using_sysfs( const char * module_name); char * get_i2c_device_sysfs_name( int busno); bool ignorable_i2c_device_sysfs_name( const char * name); bool is_ignorable_i2c_device( int busno); #endif /* SYSFS_UTIL_H_ */ ddcutil-0.8.6/src/util/systemd_util.h0000644000175000001440000000224113230445447014541 00000000000000/* systemd_util.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef SYSTEMD_UTIL_H_ #define SYSTEMD_UTIL_H_ #include GPtrArray * get_current_boot_messages(char ** filter_terms, bool ignore_case, int limit); // bool apply_filter_terms(const char * text, char ** terms, bool ignore_case); #endif /* SYSTEMD_UTIL_H_ */ ddcutil-0.8.6/src/util/timestamp.h0000644000175000001440000000254313230445447014024 00000000000000/* timestamp.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file *Timestamp Generation */ #ifndef TIMESTAMP_H_ #define TIMESTAMP_H_ #include // // Timestamp Generation // uint64_t cur_realtime_nanosec(); // Returns the current value of the realtime clock in nanoseconds void show_timestamp_history(); // For debugging uint64_t elapsed_time_nanosec(); // nanoseconds since start of program, first call initializes char * formatted_elapsed_time(); // printable elapsed time #endif /* TIMESTAMP_H_ */ ddcutil-0.8.6/src/util/udev_i2c_util.h0000644000175000001440000000365013230445447014556 00000000000000/* udev_i2c_util.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * * I2C specific udev utilities */ #ifndef UDEV_I2C_UTIL_H_ #define UDEV_I2C_UTIL_H_ /** \cond */ #include #include /** \endcond */ #include "data_structures.h" #include "udev_util.h" GPtrArray * // array of Udev_Device_Summary get_i2c_devices_using_udev(); int udev_i2c_device_summary_busno(Udev_Device_Summary * summary); bool is_smbus_device_summary( GPtrArray * summaries, // array of Udev_Device_Summary char * sbusno) ; void report_i2c_udev_device_summaries( GPtrArray * summaries, // array of Udev_Device_Summary char * title, int depth) ; Byte_Value_Array // one byte for each I2C bus number get_i2c_device_numbers_using_udev(bool include_smbus); /** Signature of function that tests sys attribute name */ typedef bool (*Sysattr_Name_Filter)(const char * sysattr_name); Byte_Value_Array get_i2c_device_numbers_using_udev_w_sysattr_name_filter(Sysattr_Name_Filter keep_func); #endif /* UDEV_I2C_UTIL_H_ */ ddcutil-0.8.6/src/util/udev_util.h0000644000175000001440000000372313230445447014022 00000000000000/* udev_util.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** @file udev_util.h * UDEV utility functions */ #ifndef UDEV_UTIL_H_ #define UDEV_UTIL_H_ /** \cond */ #include #include #include /** \endcond */ #define UDEV_DEVICE_SUMMARY_MARKER "UDSM" /** Summary information for one UDEV device */ typedef struct udev_device_summary { char marker[4]; ///< always "UDSM" const char * sysname; ///< e.g. i2c-3 const char * devpath; ///< device path const char * sysattr_name; ///< sysattr name const char * subsystem; ///< subsystem, e.g. usbmisc } Udev_Device_Summary; void free_udev_device_summaries(GPtrArray* summaries); GPtrArray * summarize_udev_subsystem_devices(char * subsystem); GPtrArray * find_devices_by_sysattr_name(char * name); // Function returns true if keeep, false if discard typedef bool (*Udev_Summary_Filter_Func)(Udev_Device_Summary * summary); GPtrArray * filter_device_summaries(GPtrArray * summaries, Udev_Summary_Filter_Func func); void report_udev_device(struct udev_device * dev, int depth); #endif /* UDEV_UTIL_H_ */ ddcutil-0.8.6/src/util/utilrpt.h0000644000175000001440000000223713230445447013524 00000000000000/* utilrpt.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Report functions for other utility modules. * Avoids complex dependencies between report_util.c and other * util files. */ #ifndef UTILRPT_H_ #define UTILRPT_H_ #include "data_structures.h" void dbgrpt_buffer(Buffer * buffer, int depth); #endif /* UTILRPT_H_ */ ddcutil-0.8.6/src/util/error_info.h0000644000175000001440000000637713230445447014176 00000000000000/* error_info.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Struct for reporting errors that collects causes */ #ifndef ERROR_INFO_H_ #define ERROR_INFO_H_ #include #define ERRINFO_STATUS(_erec) ( (_erec) ? _erec->status_code : 0 ) #define ERROR_INFO_MARKER "EINF" /** Struct for reporting errors, designed for collecting retry failures */ typedef struct error_info { char marker[4]; ///< always EINF int status_code; ///< status code char * func; ///< name of function generating status code int max_causes; ///< max number entries in array currently pointed to by **causes** int cause_ct; ///< number of causal errors struct error_info ** causes; ///< pointer to array of pointers to Error_Info #ifdef ALT GPtrArray * causes_alt; // GPointerArray of Ddc_Error * #endif } Error_Info; typedef char * (*ErrInfo_Status_String)(int code); void errinfo_init( ErrInfo_Status_String name_func, ErrInfo_Status_String desc_func); void errinfo_free( Error_Info * erec); #define ERRINFO_FREE_WITH_REPORT(_erec, _report) \ errinfo_free_with_report(_erec, (_report), __func__) void errinfo_free_with_report( Error_Info * erec, bool report, const char * func); Error_Info * errinfo_new( int status_code, const char * func); Error_Info * errinfo_new_with_cause( int status_code, Error_Info * cause, const char * func); #ifdef UNUSED Error_Info * errinfo_new_chained( Error_Info * cause, const char * func); #endif Error_Info * errinfo_new_with_causes( int status_code, Error_Info ** causes, int cause_ct, const char * func); #ifdef UNUSED Error_Info * errinfo_new_with_callee_status_codes( int status_code, int * callee_status_codes, int callee_status_code_ct, const char * callee_func, const char * func); #endif void errinfo_add_cause( Error_Info * erec, Error_Info * cause); void errinfo_set_status( Error_Info * erec, int rc); char * errinfo_causes_string( Error_Info * erec); void errinfo_report( Error_Info * erec, int depth); char * errinfo_summary( Error_Info * erec); #endif /* ERROR_INFO_H_ */ ddcutil-0.8.6/src/usb_util/0000755000175000001440000000000013230445447012575 500000000000000ddcutil-0.8.6/src/usb_util/Makefile.am0000644000175000001440000000177313226561663014565 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src AM_CFLAGS = -Wall # lots of arguments for %p in format strings need (void*) casts if -Wpedantic # AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand clean-local: @echo "(src/usbutil/Makefile) clean-local" mostlyclean-local: @echo "(src/usbutil/Makefile) mostlyclean-local" distclean-local: @echo "(src/usbutil/Makefile) distclean-local" # The dist-hook find statements here find nothing, but the corresponding # statements in src/Makefile.am do. why? dist-hook: @echo "(src/usbutil/Makefile) dist-hook. top_distdir=$(top_distdir) distdir=$(distdir)" find $(distdir) -name "*.o" find $(distdir) -name "*.lo" if ENABLE_USB_COND # Intermediate Libraries noinst_LTLIBRARIES = libusbutil.la libusbutil_la_SOURCES = \ usb_hid_common.c \ hiddev_reports.c \ hiddev_util.c \ hidraw_util.c \ libusb_reports.c \ libusb_util.c \ base_hid_report_descriptor.c \ hid_report_descriptor.c endif ddcutil-0.8.6/src/usb_util/Makefile.in0000644000175000001440000005546613230171237014573 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ # lots of arguments for %p in format strings need (void*) casts if -Wpedantic # AM_CFLAGS += -Wpedantic @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand subdir = src/usb_util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libusbutil_la_LIBADD = am__libusbutil_la_SOURCES_DIST = usb_hid_common.c hiddev_reports.c \ hiddev_util.c hidraw_util.c libusb_reports.c libusb_util.c \ base_hid_report_descriptor.c hid_report_descriptor.c @ENABLE_USB_COND_TRUE@am_libusbutil_la_OBJECTS = usb_hid_common.lo \ @ENABLE_USB_COND_TRUE@ hiddev_reports.lo hiddev_util.lo \ @ENABLE_USB_COND_TRUE@ hidraw_util.lo libusb_reports.lo \ @ENABLE_USB_COND_TRUE@ libusb_util.lo \ @ENABLE_USB_COND_TRUE@ base_hid_report_descriptor.lo \ @ENABLE_USB_COND_TRUE@ hid_report_descriptor.lo libusbutil_la_OBJECTS = $(am_libusbutil_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_USB_COND_TRUE@am_libusbutil_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libusbutil_la_SOURCES) DIST_SOURCES = $(am__libusbutil_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src AM_CFLAGS = -Wall $(am__append_1) CLEANFILES = \ *expand # Intermediate Libraries @ENABLE_USB_COND_TRUE@noinst_LTLIBRARIES = libusbutil.la @ENABLE_USB_COND_TRUE@libusbutil_la_SOURCES = \ @ENABLE_USB_COND_TRUE@usb_hid_common.c \ @ENABLE_USB_COND_TRUE@hiddev_reports.c \ @ENABLE_USB_COND_TRUE@hiddev_util.c \ @ENABLE_USB_COND_TRUE@hidraw_util.c \ @ENABLE_USB_COND_TRUE@libusb_reports.c \ @ENABLE_USB_COND_TRUE@libusb_util.c \ @ENABLE_USB_COND_TRUE@base_hid_report_descriptor.c \ @ENABLE_USB_COND_TRUE@hid_report_descriptor.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/usb_util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/usb_util/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libusbutil.la: $(libusbutil_la_OBJECTS) $(libusbutil_la_DEPENDENCIES) $(EXTRA_libusbutil_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libusbutil_la_rpath) $(libusbutil_la_OBJECTS) $(libusbutil_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_hid_report_descriptor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hid_report_descriptor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hiddev_reports.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hiddev_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hidraw_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_reports.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb_util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb_hid_common.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am dist-hook distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am .PRECIOUS: Makefile clean-local: @echo "(src/usbutil/Makefile) clean-local" mostlyclean-local: @echo "(src/usbutil/Makefile) mostlyclean-local" distclean-local: @echo "(src/usbutil/Makefile) distclean-local" # The dist-hook find statements here find nothing, but the corresponding # statements in src/Makefile.am do. why? dist-hook: @echo "(src/usbutil/Makefile) dist-hook. top_distdir=$(top_distdir) distdir=$(distdir)" find $(distdir) -name "*.o" find $(distdir) -name "*.lo" # 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: ddcutil-0.8.6/src/usb_util/usb_hid_common.c0000644000175000001440000001116313230445447015650 00000000000000/* usb_hid_common.c * * Functions that are common to the wrappers for multiple USB HID * packages such as libusb, hiddev * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include "util/string_util.h" #include "usb_util/usb_hid_common.h" /* Return's the name of a collection type in a HID report descriptor. * * Per USB HID Specification v1.11, Section 6.2.2.6 */ const char * collection_type_name(uint8_t collection_type) { static char * collection_type_names[] = { "Physical", // 0 "Application", // 1 "Logical", // 2 "Report", // 3 "Named Array", // 4 "Usage Switch", // 5 "Usage_Modifier", // 6 }; char * result = NULL; if (collection_type < 7) result = collection_type_names[collection_type]; else if (collection_type & 0x80) result = "Vendor defined"; else result = "Reserved for future use."; return result; } /* Check for specific USB devices that should be treated as * monitors, even though the normal monitor check fails. * * This is a hack. * * Arguments: * vid USB vendor id * pid USB product id * * Returns true/false */ bool force_hid_monitor_by_vid_pid(int16_t vid, int16_t pid) { struct vid_pid { uint16_t vid; uint16_t pid; }; bool debug = false; if (debug) printf("(%s) Starting. vid=0x%04x, pid=0x%04x\n", __func__, vid, pid); bool result = false; struct vid_pid exceptions[] = { {0x0424, 0x3328}, // Std Micrososystems USB HID I2C - HP LP2480 {0x056d, 0x0002}, // Eizo, HID Monitor Controls {0x0451, 0xca01}, // Texas Instruments USB to I2C Solution - what is this // NEC monitors {0x0409, 0x040d}, // P232W {0x0409, 0x02b7}, // P241W {0x0409, 0x042c}, // P242W {0x0409, 0x02bb}, // PA231W {0x0409, 0x02b8}, // PA241W (seen at RIT) {0x0409, 0x042d}, // PA242W {0x0409, 0x02b9}, // PA271W {0x0409, 0x042e}, // PA272W {0x0409, 0x02ba}, // PA301W {0x0409, 0x042f}, // PA302W {0x0409, 0x02bc}, // MD301C4 {0x0409, 0x040a}, // MD211G3 {0x0409, 0x040b}, // MD211C3 {0x0409, 0x040c}, // MD211C2 {0x0409, 0x042b}, // MD242C2 {0x0409, 0x044f}, // EA244UHD {0x0409, 0x042b}, // EA304WMi {0x0409, 0x046b}, // PA322UHD {0x0409, 0x047d}, // X841UHD {0x0409, 0x04ac}, // X981UHD {0x0409, 0x04ad}, // X651UHD {0x0409, 0x046c}, // MD322C8 {0x0409, 0x04Ae}, // P212 {0x0409, 0x050c}, // PA322UHD2 // additional values from usb.ids {0x0419, 0x8002}, // Samsung, Syncmaster HID Monitor Control {0x0452, 0x0021}, // Misubishi, HID Monitor Controls {0x04a6, 0x0181}, // Nokia, HID Monitor Controls {0x04ca, 0x1766}, // Lite-on, HID Monitor Controls }; const int vid_pid_ct = sizeof(exceptions)/sizeof(struct vid_pid); for (int ndx = 0; ndx < vid_pid_ct && !result; ndx++) { if (vid == exceptions[ndx].vid) { // there used to be some buggy code here looking at case of exceptions[ndx].pid == 0, why? if ( pid == exceptions[ndx].pid) { result = true; // if (debug) printf("(%s) Matched exception vid=0x%04x, pid=0x%04x\n", __func__, exceptions[ndx].vid, exceptions[ndx].pid); } } } if (debug) printf("(%s) vid=0x%04x, pid=0x%04x, returning: %s\n", __func__, vid, pid, bool_repr(result)); return result; } ddcutil-0.8.6/src/usb_util/hiddev_reports.c0000644000175000001440000006743013230445447015714 00000000000000/* hiddev_reports.c * * The functions in this file report the contents of hiddev data structures. * They are used for debugging, exploratory programming, and in the * ddcutil interrogate command. * * * Copyright (C) 2016-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include #include // #include #include "util/device_id_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "usb_util/hiddev_util.h" // numerous functions and macro definitions #include "usb_util/hiddev_reports.h" /* Wrap ioctl(HIDIOCGSTRING) to retrieve a string. * * It is the responsibility of the caller to free the returned string. * * Arguments: fd * index string index number * * Returns: string, NULL if invalid index number * * Notes: */ char * get_hiddev_string(int fd, __s32 index) { struct hiddev_string_descriptor desc; desc.index = index; // strcpy(desc.value,"Unset"); // for debugging Apple display issue // Returns string length if found, -1 if not // Apple Cinema display never returns -1, always seems to be last valid value errno = 0; // Very slow call on Apple Cinema display int rc = ioctl(fd, HIDIOCGSTRING, &desc); // if (rc != 0) // REPORT_IOCTL_ERROR("HIDIOCGSTRING", rc); char * result = NULL; if (rc > 0) result = strdup(desc.value); return result; } /* Reports all defined strings. * * Arguments: * fd file descriptor * max_ct maximum number of strings to report * depth logical indentation depth * * Returns: nothing * * Note: Parm max_ct exists because at least the Apple Cinema display * does not report that a string index is out of range, it just * reports the last valid value. */ void report_hiddev_strings(int fd, int max_ct, int depth) { rpt_title("Device strings returned by ioctl(HIDIOCGSTRING):", depth); int d1 = depth+1; int string_index = 1; char * string_value = NULL; for (; (string_value = get_hiddev_string(fd, string_index)); string_index++) { // for (; string_index < 10; string_index++) { // string_value = get_hiddev_string(fd, string_index); if (max_ct >= 0 && string_index > max_ct) { free(string_value); break; } rpt_vstring(d1, "String index: %d, value = |%s|", string_index, string_value); free(string_value); } } /* Outputs debug report for struct hiddev_devinfo * * Arguments: * dinfo pointer to struct hiddev_devinfo * lookup_names if true, ids for usb vendor and product ids are looked up * depth logical indentation depth * * Returns: nothing */ void report_hiddev_devinfo(struct hiddev_devinfo * dinfo, bool lookup_names, int depth) { int d1 = depth+1; Pci_Usb_Id_Names names = {"","",""}; if (lookup_names) { devid_get_usb_names( dinfo->vendor, dinfo->product, 0, 2); } rpt_structure_loc("hiddev_devinfo", dinfo, depth); // bus types are defined in . No need to define a lookup table of types // to names, since the bus type is always USB rpt_vstring(d1,"%-20s: %u %s", "bustype", dinfo->bustype, (dinfo->bustype == 3) ? "BUS_USB" : ""); rpt_vstring(d1,"%-20s: %u", "busnum", dinfo->busnum); rpt_vstring(d1,"%-20s: %u", "devnum", dinfo->devnum); rpt_vstring(d1,"%-20s: %u", "ifnum", dinfo->ifnum); rpt_vstring(d1,"%-20s: 0x%04x %s", "vendor", dinfo->vendor, names.vendor_name); // strip high bytes? dinfo->product & 0x0000ffff // dinfo->product and dinfo->vendor are __s16, before conversion to hex string, they're // promoted to int, in which case the sign bit is extended, rpt_vstring(d1,"%-20s: 0x%04x %s", "product", dinfo->product & 0xffff, names.device_name); rpt_vstring(d1,"%-20s: %2x.%02x", "version", dinfo->version>>8, dinfo->version & 0x0f); // BCD rpt_vstring(d1,"%-20s: %u", "num_applications", dinfo->num_applications); } char * interpret_collection_type(__u32 type) { char * result = NULL; // Per USB HID spec section 6.2.2.4 Main Items // and section 6.2.2.6 Collection, End Collection Items switch(type) { case(0x00): result = "Physical"; break; case(0x01): result = "Application"; break; case(0x02): result = "Logical"; break; case(0x03): result = "Report"; break; case(0x04): result = "Named Array"; break; case(0x05): result = "Usage Switch"; break; case(0x06): result = "Usage Modifier"; break; default: if (type >= 0x80 && type <= 0xff) result = "Vendor-defined"; else result = "Reserved"; // should never occur } //switch return result; } /* Outputs debug report for struct hiddev_collection info * * Arguments: * cinfo pointer to struct hiddev_collecion_info * depth logical indentation depth * * Returns: nothing */ void report_hiddev_collection_info(struct hiddev_collection_info * cinfo, int depth) { int d1 = depth+1; rpt_structure_loc("hiddev_collection_info", cinfo, depth); rpt_vstring(d1, "%-20s: %u", "index", cinfo->index); rpt_vstring(d1, "%-20s: %u %s", "type", cinfo->type, interpret_collection_type(cinfo->type)); rpt_vstring(d1, "%-20s: 0x%08x %s", "usage", cinfo->usage, hiddev_interpret_usage_code(cinfo->usage)); rpt_vstring(d1, "%-20s: %u", "level", cinfo->level); } /* Outputs debug report for struct hiddev_string_descriptor * * Arguments: * desc pointer to struct hiddev_string_descriptor * depth logical indentation depth * * Returns: nothing */ void report_hiddev_string_descriptor(struct hiddev_string_descriptor * desc, int depth) { int d1 = depth+1; rpt_structure_loc("hiddev_string_descriptor", desc, depth); rpt_vstring(d1, "%-20s: %d", "index", desc->index); rpt_vstring(d1, "%-20s: |%s|", "value", desc->value); } #ifdef REF #define HID_FIELD_CONSTANT 0x001 #define HID_FIELD_VARIABLE 0x002 #define HID_FIELD_RELATIVE 0x004 #define HID_FIELD_WRAP 0x008 #define HID_FIELD_NONLINEAR 0x010 #define HID_FIELD_NO_PREFERRED 0x020 #define HID_FIELD_NULL_STATE 0x040 #define HID_FIELD_VOLATILE 0x080 #define HID_FIELD_BUFFERED_BYTE 0x100 #endif /* Produces a string representation of the HID field flag bits * * Arguments: flags word of flags * * Returns: String representation of flags. * * The value is built in an internal buffer and is valid * until the next call of this function. */ char * interpret_field_bits(__u32 flags) { #define FLAG_BIT(_bitname) \ if (flags & _bitname) \ curpos += sprintf(curpos, #_bitname "|") static char field_bits_buffer[200]; field_bits_buffer[0] = '\0'; char * curpos = field_bits_buffer; FLAG_BIT(HID_FIELD_CONSTANT); FLAG_BIT(HID_FIELD_VARIABLE); FLAG_BIT(HID_FIELD_RELATIVE); FLAG_BIT(HID_FIELD_WRAP); FLAG_BIT(HID_FIELD_NONLINEAR); FLAG_BIT(HID_FIELD_NO_PREFERRED); FLAG_BIT(HID_FIELD_NULL_STATE); FLAG_BIT(HID_FIELD_VOLATILE); FLAG_BIT(HID_FIELD_BUFFERED_BYTE); assert( (curpos-field_bits_buffer) < sizeof(field_bits_buffer) ); if (curpos != field_bits_buffer) *(curpos-1) = '\0'; return field_bits_buffer; #undef FLAG_BIT } /* Outputs debug report for struct hiddev_report_info * * Arguments: * desc pointer to struct hiddev_report_info * depth logical indentation depth * * Returns: nothing */ void report_hiddev_report_info(struct hiddev_report_info * rinfo, int depth) { int d1 = depth+1; rpt_structure_loc("hiddev_report_info", rinfo, depth); rpt_vstring(d1, "%-20s: %u %s", "report_type", rinfo->report_type, hiddev_report_type_name(rinfo->report_type)); rpt_vstring(d1, "%-20s: %s 0x%08x", "report_id", hiddev_interpret_report_id(rinfo->report_id), rinfo->report_id); // may have next flag set in high order bit rpt_vstring(d1, "%-20s: %u", "num_fields", rinfo->num_fields); } #ifdef REF #define HID_REPORT_ID_UNKNOWN 0xffffffff #define HID_REPORT_ID_FIRST 0x00000100 #define HID_REPORT_ID_NEXT 0x00000200 #define HID_REPORT_ID_MASK 0x000000ff #define HID_REPORT_ID_MAX 0x000000ff #endif /* Returns a string representation of a report id value * * Arguments: report_id * * Returns: string representation of id * * The value is built in an internal buffer and is valid * until the next call of this function. */ char * hiddev_interpret_report_id(__u32 report_id) { static char report_id_buffer[100]; report_id_buffer[0] = '\0'; if (report_id == HID_REPORT_ID_UNKNOWN) strcpy(report_id_buffer, "HID_REPORT_ID_UNKNOWN"); else { if (report_id & HID_REPORT_ID_FIRST) strcpy(report_id_buffer, "HID_REPORT_ID_FIRST|"); if (report_id & HID_REPORT_ID_NEXT) strcat(report_id_buffer, "HID_REPORT_ID_NEXT|"); sprintf(report_id_buffer + strlen(report_id_buffer), "%u", report_id & HID_REPORT_ID_MASK); } return report_id_buffer; } /* Returns a string representation of a HID usage code * * Arguments: usage_code * * Returns: string representation of usage code * * The value is built in an internal buffer and is valid * until the next call of this function. */ char * hiddev_interpret_usage_code(int usage_code ) { static char usage_buffer[100]; usage_buffer[0] = '\0'; if (usage_code == 0) { // sprintf(usage_buffer, "0x%08x", usage_code); usage_buffer[0] = '\0'; } else { unsigned short usage_page = usage_code >> 16; unsigned short usage_id = usage_code & 0xffff; char * page_name; char * page_value_name; if (usage_page >= 0xff00) { page_name = "Manufacturer"; page_value_name = ""; } else { page_name = devid_usage_code_page_name(usage_page); if (!page_name) { page_name = ""; page_value_name = ""; } else { page_value_name = devid_usage_code_id_name(usage_page, usage_id); if (!page_value_name) page_value_name = ""; } } snprintf(usage_buffer, sizeof(usage_buffer), // "0x%08x page=0x%04x (%s), id=0x%04x (%s)", // usage_code, "page=0x%04x (%s), id=0x%04x (%s)", usage_page, page_name, usage_id, page_value_name); } return usage_buffer; } /* Outputs debug report for struct hiddev_field_info * * Arguments: * desc pointer to struct hiddev_field_info * depth logical indentation depth * * Returns: nothing */ void report_hiddev_field_info(struct hiddev_field_info * finfo, int depth) { int d1 = depth+1; rpt_structure_loc("hiddev_field_info", finfo, depth); rpt_vstring(d1, "%-20s: %u %s", "report_type", finfo->report_type, hiddev_report_type_name(finfo->report_type)); // const char * s0 = names_reporttag(finfo->report_id); // const char * s1 = names_huts(finfo->physical>>16); // const char * s2 = names_hutus(finfo->physical); rpt_vstring(d1, "%-20s: %s (0x%08x)", "report_id", hiddev_interpret_report_id(finfo->report_id), finfo->report_id); rpt_vstring(d1, "%-20s: %u", "field_index", finfo->field_index); rpt_vstring(d1, "%-20s: %u", "maxusage", finfo->maxusage); rpt_vstring(d1, "%-20s: 0x%08x %s", "flags", finfo->flags, interpret_field_bits(finfo->flags) ); // rpt_vstring(d1, "%-20s: %u 0x%08x huts=|%s|, hutus=|%s| (physical usage for this field)", "physical", // finfo->physical, finfo->physical, s1, s2); rpt_vstring(d1, "%-20s: 0x%08x %s", "physical (usage)", finfo->physical, hiddev_interpret_usage_code(finfo->physical) ); rpt_vstring(d1, "%-20s: 0x%08x %s", "logical (usage)", finfo->logical, hiddev_interpret_usage_code(finfo->logical) ); rpt_vstring(d1, "%-20s: 0x%08x %s", "application (usage)", finfo->application, hiddev_interpret_usage_code(finfo->application) ); rpt_vstring(d1, "%-20s: %d", "logical_minimum", finfo->logical_minimum); rpt_vstring(d1, "%-20s: %d", "logical_maximum", finfo->logical_maximum); rpt_vstring(d1, "%-20s: %d", "physical_minimum", finfo->physical_minimum); rpt_vstring(d1, "%-20s: %d", "physical_maximum", finfo->physical_maximum); rpt_vstring(d1, "%-20s: %u", "unit_exponent", finfo->unit_exponent); rpt_vstring(d1, "%-20s: 0x%08x", "unit", finfo->unit); } /* Outputs debug report for struct hiddev_usage_ref * * Arguments: * desc pointer to struct hiddev_usage_ref * depth logical indentation depth * * Returns: nothing */ void report_hiddev_usage_ref(struct hiddev_usage_ref * uref, int depth) { int d1 = depth+1; rpt_structure_loc("hiddev_usage_ref", uref, depth); rpt_vstring(d1, "%-20s: %u %s", "report_type", uref->report_type, hiddev_report_type_name(uref->report_type)); // const char * s0 = names_reporttag(uref->report_id); // char * s1 = names_huts(uref->usage_code>>16); // char * s2 = names_hutus(uref->usage_code); rpt_vstring(d1, "%-20s: %u %s", "report_id", uref->report_id, hiddev_interpret_report_id(uref->report_id)); rpt_vstring(d1, "%-20s: %u", "field_index", uref->field_index); rpt_vstring(d1, "%-20s: %u", "usage_index", uref->usage_index); // rpt_vstring(d1, "%-20s: 0x%08x huts=|%s|, hutus=|%s|", "usage_code", uref->usage_code, s1, s2); // rpt_usage_code("usage_code", NULL, uref->usage_code, d1); rpt_vstring(d1, "%-20s: 0x%08x %s", "usage_code", uref->usage_code, hiddev_interpret_usage_code(uref->usage_code) ); rpt_vstring(d1, "%-20s: %d", "value", uref->value); } void report_hiddev_usage_ref_multi(struct hiddev_usage_ref_multi * uref_multi, int depth) { int d1 = depth+1; // int d2 = depth+2; rpt_structure_loc("hiddev_usage_ref_multi", uref_multi, depth); report_hiddev_usage_ref(&uref_multi->uref, d1); rpt_vstring(d1, "%-20s: %d", "num_values", uref_multi->num_values); rpt_vstring(d1, "%-20s at %p", "values", &uref_multi->values); // rpt_hex_dump(&uref_multi->values, uref_multi->num_values, d2); } /** Reports a usage code for a field, based on the index, and also optionally the * usage value of the field. * */ void report_field_usage( int fd, int report_type, int report_id, int field_index, int usage_index, bool show_value, int depth) { int d0 = depth; int d1 = depth+1; int rc; // printf("(%s) field index = %d, usage index=%d\n", __func__, i, j); struct hiddev_usage_ref uref = {0}; // initialize to make valgrind happy uref.report_type = report_type; // rinfo.report_type; uref.report_id = report_id; // rinfo.report_id; uref.field_index = field_index; // i; uref.usage_index = usage_index; // j; rpt_vstring(d0, "report_id: %d, field_index: %d, usage_index: %d", uref.report_id, uref.field_index, uref.usage_index); errno = 0; rc = ioctl(fd, HIDIOCGUCODE, &uref); // Fills in usage code if (rc != 0) REPORT_USB_IOCTL_ERROR("HIDIOCGUCODE", errno); // assert(rc == 0); if (rc == 0) { rpt_vstring(d1, "Usage code = 0x%08x %s", uref.usage_code, hiddev_interpret_usage_code(uref.usage_code)); int collection_index = ioctl(fd, HIDIOCGCOLLECTIONINDEX, &uref); rpt_vstring(d1, "Collection index for usage code: %d", collection_index); if (show_value) { // Gets the current value of the field rc = ioctl(fd, HIDIOCGUSAGE, &uref); // Fills in usage value if (rc != 0) REPORT_USB_IOCTL_ERROR("HIDIOCGUSAGE", errno); // occasionally see -1, errno = 22 invalid argument - for Battery System Page: Run Time to Empty if (rc == 0) rpt_vstring(d1, "Current value (value) = %d (0x%08x)", uref.value, uref.value); else rpt_vstring(d1, "Error getting current value"); } } } /* Reports all report descriptors of a particular type for an open HID device. * * Arguments: * fd file descriptor for open hiddev device * report_type HID_REPORT_TYPE_INPUT, HID_REPORT_TYPE_OUTPUT, or HID_REPORT_TYPE_FEATURE * depth logical indentation depth * * Returns: nothing */ void report_report_descriptors_for_report_type(int fd, __u32 report_type, int depth) { int ret; const int d0 = depth; const int d1 = d0 + 1; const int d2 = d0 + 2; const int d3 = d0 + 3; const int d4 = d0 + 4; struct hiddev_report_info rinfo = {0}; // initialize to make valgrind happy rinfo.report_type = report_type; rinfo.report_id = HID_REPORT_ID_FIRST; puts(""); rpt_vstring(d0, "Getting descriptors for report_type=%s", hiddev_report_type_name(report_type)); ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); if (ret != 0) { // no more reports if (ret != -1) REPORT_USB_IOCTL_ERROR("HIDIOCGREPORTINFO", errno); rpt_vstring(d1, "No reports defined"); return; } int rptct = 0; // count of reports seen, for our local interest while (ret >= 0) { // printf("(%s) Report counter %d, report_id = 0x%08x %s\n", // __func__, rptct, rinfo.report_id, interpret_report_id(rinfo.report_id)); puts(""); rpt_vstring(d0, "Report %s:", hiddev_interpret_report_id(rinfo.report_id)); report_hiddev_report_info(&rinfo, d1); rptct++; if (rinfo.report_type != HID_REPORT_TYPE_OUTPUT) { // So that usage value filled in int rc = ioctl(fd, HIDIOCGREPORT, &rinfo); if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGREPORT", errno); printf("(%s) Unable to get report %d\n", __func__, rinfo.report_id); break; } } int fndx, undx; if (rinfo.num_fields > 0) rpt_vstring(d1, "Scanning fields of report %s", hiddev_interpret_report_id(rinfo.report_id)); for (fndx = 0; fndx < rinfo.num_fields; fndx++) { // printf("(%s) field index = %d\n", __func__, i); bool edidfg = hiddev_is_field_edid(fd, &rinfo, fndx); if (edidfg) { rpt_vstring(d2, "Report id: %d, Field index: %d contains EDID:", rinfo.report_id, fndx); } struct hiddev_field_info finfo = {0}; memset(&finfo, 0, sizeof(finfo)); finfo.report_type = rinfo.report_type; finfo.report_id = rinfo.report_id; finfo.field_index = fndx; rpt_vstring(d2, "Report id: %d, Field index %d:", finfo.report_id, fndx); int rc = ioctl(fd, HIDIOCGFIELDINFO, &finfo); if (rc != 0) { // should never occur REPORT_USB_IOCTL_ERROR("HIDIOCGFIELDINFO", errno); break; // just stop checking fields } rpt_vstring(d2, "Description of field %d:", fndx); if (finfo.field_index != fndx) { rpt_vstring(d3, "!! Note that HIDIOCGFIELDINFO changed field_index to %d", finfo.field_index); } report_hiddev_field_info(&finfo, d3); bool usage_values_reported = false; __u32 common_ucode = 0; if (finfo.maxusage > 1) common_ucode = hiddev_get_identical_ucode(fd, &finfo, fndx); if (common_ucode) { rpt_vstring(d2, "Identical ucode for all usages: 0x%08x %s", common_ucode, hiddev_interpret_usage_code(common_ucode)); } // Get values for Feature or Input report if (finfo.report_type != HID_REPORT_TYPE_OUTPUT) { if (common_ucode) { if (finfo.flags & HID_FIELD_BUFFERED_BYTE) { rpt_vstring(d2, "Retrieving values using HIDIOCGUSAGES"); struct hiddev_usage_ref_multi uref_multi; uref_multi.uref.report_type = finfo.report_type; uref_multi.uref.report_id = finfo.report_id; uref_multi.uref.field_index = fndx; uref_multi.uref.usage_index = 0; uref_multi.num_values = finfo.maxusage; // needed? yes! rc = ioctl(fd, HIDIOCGUSAGES, &uref_multi); // Fills in usage values if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGUSAGES", errno); } else { // printf("(%s) Value retrieved by HIDIOCGUSAGES:\n", __func__); Byte * buf = calloc(1, finfo.maxusage); for (int ndx=0; ndxbytes, buf->len, d2); usage_values_reported = true; buffer_free(buf, __func__); } } } // common_ucode == true if (!usage_values_reported) { rpt_vstring(d2, "Usages for report_id: %d, field_index %d:", finfo.report_id, fndx /*finfo.field_index */); for (undx = 0; undx < finfo.maxusage; undx++) { report_field_usage(fd, finfo.report_type, finfo.report_id, fndx, undx, /*show_value=*/ true, d4); } //loop over undx } // common_ucode == false or !usage_values_collected } // HID_REPORT_TYPE_OUTPUT } // loop over fndx rinfo.report_id |= HID_REPORT_ID_NEXT; ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); } if (rptct == 0) rpt_title("None", d1); } /* Reports all report descriptors for an open HID device. * * Arguments: * fd file descriptor * depth logical indentation depth * * Returns: nothing */ void report_all_report_descriptors(int fd, int depth) { report_report_descriptors_for_report_type(fd, HID_REPORT_TYPE_INPUT, depth); report_report_descriptors_for_report_type(fd, HID_REPORT_TYPE_OUTPUT, depth); report_report_descriptors_for_report_type(fd, HID_REPORT_TYPE_FEATURE, depth); } /* Reports all collection information for an open HID device. * * Arguments: * fd file descriptor * depth logical indentation depth * * Returns: nothing */ void report_all_collections(int fd, int depth) { int d1 = depth+1; // int d2 = depth+2; rpt_title("All collections for device:", depth); int cndx = 0; // collection indexes start at 0 int ioctl_rc = 0; for (cndx=0; ioctl_rc != -1; cndx++) { struct hiddev_collection_info cinfo; memset(&cinfo, 0, sizeof(cinfo)); errno = 0; cinfo.index = cndx; ioctl_rc = ioctl(fd, HIDIOCGCOLLECTIONINFO, &cinfo); if (ioctl_rc != -1) { rpt_vstring(d1,"Collection %d:", cinfo.index); report_hiddev_collection_info(&cinfo, d1); } } } /* Reports all information about an open HID device. * * Arguments: * fd file descriptor * depth logical indentation depth * * Returns: nothing */ void report_hiddev_device_by_fd(int fd, int depth) { const int d1 = depth+1; const int d2 = depth+2; struct hiddev_devinfo dev_info; int rc; int version; rc = ioctl(fd, HIDIOCGVERSION, &version); // no need to test return code, always succeeds // ioctl(HIDIOCGVERSION) never fails, but add check of return code to avoid coverity flagging a problem assert(rc == 0); rpt_vstring(depth, "hiddev driver version (reported by HIDIOCGVERSION): %d.%d.%d", version>>16, (version >> 8) & 0xff, version & 0xff); #ifdef REDUNDANT_INFORMATION char * cgname = get_hiddev_name(fd); // HIDIOCGNAME // printf("(%s) get_hiddev_name() returned: |%s|\n", __func__, cgname); rpt_vstring(depth, "device name (reported by HIDIOCGNAME): |%s|", cgname); free(cgname); #endif rc = ioctl(fd, HIDIOCGDEVINFO, &dev_info); if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGDEVINFO", errno); return; } report_hiddev_devinfo(&dev_info, /*lookup_names=*/true, depth); // if (!is_interesting_device(&dev_info)) { // printf("(%s) Uninteresting device\n", __func__); // return; // } int string_id_limit = -1; if (dev_info.vendor == 0x05ac) { // string_id_limit = 3; // Apple never returns invalid index. rpt_vstring(depth, "Skipping string retrieval for Apple Cinema display due to limitations."); string_id_limit = 0; // disable entirely - string retrieval painfully slow for Apple Cinema } puts(""); if (string_id_limit != 0) { report_hiddev_strings(fd,string_id_limit,depth); // HIDIOCGSTRING puts(""); } rpt_title("Usages for each application associated with the device:", depth); if (dev_info.num_applications == 0) { // should never occur, but just in case rpt_title("No applications", d2); } else { for (int ndx = 0; ndx < dev_info.num_applications; ndx++) { int usage = ioctl(fd, HIDIOCAPPLICATION, ndx); // printf("(%s) HIDIOCAPPLICATION returned 0x%08x for application %d\n", __func__, usage, i); if (usage == -1) { continue; } rpt_vstring(d1, "Application %d: Usage code: 0x%08x %s", ndx, usage, hiddev_interpret_usage_code(usage)); } } puts(""); rpt_title("Collection information is a superset of application information.", depth); rpt_title("Querying collections returns information on all collections the device has,", depth); rpt_title("not just application collections.", depth); puts(""); report_all_collections(fd,depth); puts(""); rpt_vstring(depth, "Identified as HID monitor: %s", bool_repr(is_hiddev_monitor(fd)) ); // puts(""); report_all_report_descriptors(fd, depth); #ifdef FUTURE puts(""); if (dev_info.vendor == 0x05ac) // Apple get_edid(fd); if (is_hiddev_monitor(fd)) { find_edid_report(fd); } #endif } #ifdef NOT_NEEDED // pci_usb_ids functions now call pciusb_ids_ensure_initialized() as necessary void init_hiddev_reports() { pciusb_id_ensure_initialized(); // names_init(); } #endif ddcutil-0.8.6/src/usb_util/hiddev_util.c0000644000175000001440000007216113230445447015170 00000000000000/* hiddev_util.c * * * Copyright (C) 2016-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * */ /** \cond */ #include #include #include #include // #include #include #include #include #include #include #include #include #include #include #include #include // #include #include "util/coredefs.h" #include "util/file_util.h" #include "util/glib_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/utilrpt.h" /** \endcond */ #include "usb_util/usb_hid_common.h" #include "usb_util/hiddev_reports.h" #include "usb_util/hiddev_util.h" #include "base/core.h" static const char* report_type_id_table[] = { "invalid value", "HID_REPORT_TYPE_INPUT", "HID_REPORT_TYPE_OUTPUT", "HID_REPORT_TYPE_FEATURE" }; // To do: converge with similar function hid_report_type_name() // name hid_report_type_name() is more appropriate since there is nothing hiddev // specific about this function /* Returns a string representation of a report type id * * Arguments: report_type * * Returns: string representation of id */ const char * hiddev_report_type_name(__u32 report_type) { if (report_type < HID_REPORT_TYPE_MIN || report_type > HID_REPORT_TYPE_MAX) report_type = 0; return report_type_id_table[report_type]; } // // *** Functions to identify hiddev devices representing monitors *** // /* Filter to find hiddevN files for scandir() */ static int is_hiddev(const struct dirent *ent) { return !strncmp(ent->d_name, "hiddev", strlen("hiddev")); } /* Scans /dev to obtain list of hiddev device names * * Returns: GPtrArray of device device names. */ GPtrArray * get_hiddev_device_names_using_filesys() { const char *hidraw_paths[] = { "/dev/", "/dev/usb", NULL }; return get_filenames_by_filter(hidraw_paths, is_hiddev); } /* Find hiddev device names using udev. * * Slightly more robust than get_hiddev_device_names_using_filesys() since doesn't * make assumptions as to where hiddev devices are found in the /dev tree. * * Arguments: none * Returns: array of hiddev path names in /dev */ GPtrArray * get_hiddev_device_names_using_udev() { bool debug = false; if (debug) printf("(%s) Starting...\n", __func__); GPtrArray * dev_names = g_ptr_array_sized_new(10); g_ptr_array_set_free_func(dev_names, free); struct udev *udev; struct udev_enumerate *enumerate; struct udev_list_entry * devices, *dev_list_entry; struct udev_device *dev; char * subsystem = "usbmisc"; // hiddev devices are in usbmisc subsystem /* Create the udev object */ udev = udev_new(); if (!udev) { printf("Can't create udev\n"); goto bye; } /* Create a list of the devices in the subsystem. */ enumerate = udev_enumerate_new(udev); udev_enumerate_add_match_subsystem(enumerate, subsystem); udev_enumerate_scan_devices(enumerate); devices = udev_enumerate_get_list_entry(enumerate); /* udev_list_entry_foreach is a macro which expands to a loop. The loop will be executed for each member in devices, setting dev_list_entry to a list entry which contains the device's path in /sys. */ udev_list_entry_foreach(dev_list_entry, devices) { const char *path; /* Get the filename of the /sys entry for the device and create a udev_device object (dev) representing it */ path = udev_list_entry_get_name(dev_list_entry); dev = udev_device_new_from_syspath(udev, path); const char * sysname = udev_device_get_sysname(dev); if (str_starts_with(sysname, "hiddev")) { g_ptr_array_add(dev_names, strdup(udev_device_get_devnode(dev))); } udev_device_unref(dev); } g_ptr_array_sort(dev_names, gaux_ptr_scomp); udev_enumerate_unref(enumerate); // free the enumerator object udev_unref(udev); bye: return dev_names; } /* Find hiddev device names. * * Arguments: none * Returns: array of hiddev path names in /dev * * Allows for easily switching between alternative implementation. */ GPtrArray * get_hiddev_device_names() { return get_hiddev_device_names_using_udev(); // return get_hiddev_device_names_using_filesys(); } /* Check for specific USB devices that should be treated as * monitors, even though the normal monitor check fails. * * This is a hack. * * Arguments: * fd file descriptor * * Returns true/false */ bool force_hiddev_monitor(int fd) { bool debug = false; bool result = false; struct hiddev_devinfo dev_info; int rc = ioctl(fd, HIDIOCGDEVINFO, &dev_info); if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGDEVINFO", errno); goto bye; } result = force_hid_monitor_by_vid_pid( dev_info.vendor, dev_info.product); bye: if (debug) printf("(%s) vid=0x%04x, pid=0x%04x, returning: %s\n", __func__, dev_info.vendor, dev_info.product, bool_repr(result)); return result; } /* Check if an open hiddev device represents a USB compliant monitor. * * Arguments: * fd file descriptor * * Returns: true/false * * Per USB Monitor Control Class Specification section 5.5, * "to identify a HID class device as a monitor, the devices's * HID Report Descriptor must contain a top-level collection with * a usage of Monitor Control from the USB Monitor Usage Page." */ bool is_hiddev_monitor(int fd) { bool debug = false; if (debug) printf("(%s) Starting\n", __func__); int monitor_collection_index = -1; int cndx = 0; // indexes start at 0 int ioctl_rc = 0; for (cndx=0; ioctl_rc != -1; cndx++) { struct hiddev_collection_info cinfo; memset(&cinfo, 0, sizeof(cinfo)); errno = 0; cinfo.index = cndx; ioctl_rc = ioctl(fd, HIDIOCGCOLLECTIONINFO, &cinfo); if (ioctl_rc == -1) continue; assert(ioctl_rc == 0); if (debug) printf("(%s) cndx=%d, cinfo.level=%d, cinfo.usage=0x%08x\n", __func__, cndx, cinfo.level, cinfo.usage); if (cinfo.level == 0 && cinfo.usage == 0x00800001) { // USB Monitor Usage Page/Monitor Control monitor_collection_index = cndx; break; } } bool result = (monitor_collection_index >= 0); // FOR TESTING // if (!result) // result = force_hiddev_monitor(fd); if (debug) printf("(%s) Returning: %s\n", __func__, bool_repr(result)); return result; } /* Checks that all usages of a field have the same usage code. * * Arguments: * fd file descriptor of open hiddev device * finfo pointer to hiddev_field_info struct describing the field * field_index actual field index, value in finfo may have been changed by * HIDIOCGFIELDINFO call, that filled in hiddev_field_info * * Returns: usage code if all are identical, 0 if not */ __u32 hiddev_get_identical_ucode(int fd, struct hiddev_field_info * finfo, __u32 field_index) { // assert(finfo->flags & HID_FIELD_BUFFERED_BYTE); __u32 result = 0; for (int undx = 0; undx < finfo->maxusage; undx++) { struct hiddev_usage_ref uref = { .report_type = finfo->report_type, .report_id = finfo->report_id, .field_index = field_index, // actual field index, not value changed by HIDIOCGFIELDINFO .usage_index = undx }; // printf("(%s) report_type=%d, report_id=%d, field_index=%d, usage_index=%d\n", // __func__, rinfo->report_type, rinfo->report_id, field_index=saved_field_index, undx); int rc = ioctl(fd, HIDIOCGUCODE, &uref); // Fills in usage code if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGUCODE", errno); result = 0; break; } // printf("(%s) uref.field_index=%d, uref.usage_code = 0x%08x\n", // __func__, uref.field_index, uref.usage_code); if (undx == 0) result = uref.usage_code; else if (uref.usage_code != result) { result = 0; break; } } // loop over usages return result; } /* Collects all the usage values for a field and returns them in a Buffer. * * The field must meet the following requirements: * All usages must have the same usage code * All values must be single byte * * The function should only be called for INPUT and FEATURE reports. (assertion check) * * This function assumes that HIDIOCGREPORT has already been called * * Arguments: * fd file descriptor * finfo pointer to filled in hiddev_field_info for the field * field_index actual field index to use * * Returns: Buffer with accumulated value, * NULL if multiple usage codes or some usage value is > 0xff * It is the responsibility of the caller to free the returned buffer. */ Buffer * hiddev_collect_single_byte_usage_values( int fd, struct hiddev_field_info * finfo, __u32 field_index) { bool debug = false; Buffer * result = buffer_new(finfo->maxusage, __func__); bool ok = true; __s32 common_usage_code; // n.b. assumes HIDIOCGREPORT has been called assert(finfo->report_type != HID_REPORT_TYPE_OUTPUT); // bound is < finfo->maxusage, not <= finfo->maxusage // undx == finfo->maxusage returns errno=22, invalid argument for (int undx = 0; undx < finfo->maxusage; undx++) { struct hiddev_usage_ref uref = { .report_type = finfo->report_type, // rinfo.report_type; .report_id = finfo->report_id, // rinfo.report_id; .field_index = field_index, // use original value, not value changed by HIDIOCGFIELDINFO .usage_index = undx }; // printf("(%s) report_type=%d, report_id=%d, field_index=%d, maxusage=%d, usage_index=%d\n", // __func__, finfo->report_type, finfo->report_id, finfo->field_index, finfo->maxusage, undx); int rc = ioctl(fd, HIDIOCGUCODE, &uref); // Fills in usage code if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGUCODE", errno); ok = false; break; } // printf("(%s) uref.field_index=%d, uref.usage_code = 0x%08x\n", // __func__, uref.field_index, uref.usage_code); if (undx == 0) { common_usage_code = uref.usage_code; } else if (uref.usage_code != common_usage_code) { ok = false; if (debug) printf("(%s) Multiple usage codes", __func__); break; } rc = ioctl(fd, HIDIOCGUSAGE, &uref); // Fills in usage value if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGUSAGE", errno); ok = false; break; } if (uref.value &0xffffff00) { // if high order bytes non-zero if (true) printf("(%s) High order bytes of value for usage %d are non-zero\n", __func__, undx); ok = false; break; } Byte b = uref.value; buffer_add(result, b); if (false) printf("(%s) usage = %d, value=0x%08x, byte = 0x%02x\n", __func__, undx, uref.value, uref.value&0xff); } // loop over usages if (!ok && result) { buffer_free(result, __func__); result = NULL; } if (debug) { printf("(%s) Returning: %p\n", __func__, result); // if (result) // buffer_dump(result); } return result; } // // *** Functions for EDID retrieval *** // /* Checks if a field in a HID report represents an EDID * * Arguments: * fd file descriptor for open hiddev device * rinfo pointer to hiddev_report_info struct * field_index index number of field to check * * Returns: true if the field represents an EDID, false if not * * The field must have at least 128 usages, and the usage code for each must * be USB Monitor/EDID information */ bool hiddev_is_field_edid(int fd, struct hiddev_report_info * rinfo, int field_index) { bool debug = false; if (debug) printf("(%s) report_type=%d, report_id=%d, field index = %d\n", __func__, rinfo->report_type, rinfo->report_id, field_index); bool all_usages_edid = false; int rc; struct hiddev_field_info finfo = { .report_type = rinfo->report_type, .report_id = rinfo->report_id, .field_index = field_index }; int saved_field_index = field_index; rc = ioctl(fd, HIDIOCGFIELDINFO, &finfo); if (rc != 0) REPORT_USB_IOCTL_ERROR("HIDIOCGFIELDINFO", errno); assert(rc == 0); if (debug) { if (finfo.field_index != saved_field_index && debug) { printf("(%s) !!! ioctl(HIDIOCGFIELDINFO) changed field_index from %d to %d\n", __func__, saved_field_index, finfo.field_index); printf("(%s) rinfo.num_fields=%d, finfo.maxusage=%d\n", __func__, rinfo->num_fields, finfo.maxusage); } } if (finfo.maxusage >= 128) all_usages_edid = ( hiddev_get_identical_ucode(fd, &finfo, field_index) == 0x00800002 ); if (debug) printf("(%s) Returning: %s", __func__, bool_repr(all_usages_edid)); return all_usages_edid; } #define EDID_SIZE 128 // // hid_field_locator functions // void free_hid_field_locator(struct hid_field_locator * location) { if (location) { if (location->finfo) free(location->finfo); free(location); } } void report_hid_field_locator(struct hid_field_locator * ploc, int depth) { int d1 = depth+1; rpt_structure_loc("struct hid_field_locator", ploc, depth); if (ploc) { rpt_vstring(d1, "%-20s %u", "report_type:", ploc->report_type ); rpt_vstring(d1, "%-20s %u", "report_id:", ploc->report_id ); rpt_vstring(d1, "%-20s %u", "field_index:", ploc->field_index); // report_hiddev_report_info(ploc->rinfo, d1); report_hiddev_field_info(ploc->finfo, d1); } } /* Test if all, or alternatively at least 1, usage codes of a field match a specified usage code. * * Arguments: * fd file descriptor of open hiddev device * report_type HID_REPORT_TYPE_INPUT, HID_REPORT_TYPE_OUTPUT, or HID_REPORT_TYPE_FEATURE * report_id report number * field_index field index * ucode usage code to test against * require_all_match if true, all usages must be the specified value * * Returns: field information if true, NULL if false */ struct hiddev_field_info * test_field_ucode( int fd, __u32 report_type, __u32 report_id, __u32 field_index, __u32 ucode, bool require_all_match) { bool debug = false; if (debug) printf("(%s) report_type=%d, report_id=%d, field index=%d, ucode=0x%08x, require_all_match=%s\n", __func__, report_type, report_id, field_index, ucode, bool_repr(require_all_match)); struct hiddev_field_info * result = NULL; int rc; struct hiddev_field_info finfo = { .report_type = report_type, .report_id = report_id, .field_index = field_index }; int saved_field_index = field_index; rc = ioctl(fd, HIDIOCGFIELDINFO, &finfo); if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGFIELDINFO", errno); goto bye; } if (debug) { if (finfo.field_index != saved_field_index && debug) printf("(%s) !!! ioctl(HIDIOCGFIELDINFO) changed field_index from %d to %d\n", __func__, saved_field_index, finfo.field_index); } // result->field_id = fndx; bool is_matched = false; if (require_all_match) { __u32 ucode_found = hiddev_get_identical_ucode(fd, &finfo, field_index); if (ucode_found == ucode) is_matched = true; } else { // loop over all usage codes int undx; for (undx = 0; undx < finfo.maxusage; undx++) { struct hiddev_usage_ref uref = { .report_type = report_type, .report_id = report_id, .field_index = field_index, .usage_index = undx }; rc = ioctl(fd, HIDIOCGUCODE, &uref); // Fills in usage code if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGUCODE", errno); break; } if (uref.usage_code == ucode) { is_matched = true; break; } } // loop over usages } if (is_matched) { result = malloc(sizeof(struct hiddev_field_info)); memcpy(result, &finfo, sizeof(struct hiddev_field_info)); } bye: if (debug) { printf("(%s) Returning: %p\n", __func__, result); if (result) report_hiddev_field_info(result, 1); } return result; } /* Look through all reports of a given type (HID_REPORT_TYPE_FEATURE, etc) to * find one having a field with a given usage code. * * Arguments: * fd file descriptor of open hiddev device * report_type HID_REPORT_TYPE_INPUT, HID_REPORT_TYPE_OUTPUT, or HID_REPORT_TYPE_FEATURE * ucode usage code * match_all_ucodes if true, all usages of the field must match ucode * if false, at least one usage must match ucode * * Returns: record identifying the report and field */ struct hid_field_locator* hiddev_find_report(int fd, __u32 report_type, __u32 ucode, bool match_all_ucodes) { bool debug = false; if (debug) printf("(%s) Starting. report_type=%d, ucode=0x%08x, match_all_ucodes=%s\n", __func__, report_type, ucode, bool_repr(match_all_ucodes)); struct hid_field_locator * result = NULL; struct hiddev_report_info rinfo = { .report_type = report_type, .report_id = HID_REPORT_ID_FIRST }; int report_id_found = -1; int field_index_found = -1; struct hiddev_field_info * finfo_found = NULL; int reportinfo_rc = 0; //while (reportinfo_rc == 0 && report_id_found == -1) { while (reportinfo_rc == 0 && !finfo_found) { // printf("(%s) Report counter %d, report_id = 0x%08x %s\n", // __func__, rptct, rinfo.report_id, interpret_report_id(rinfo.report_id)); errno = 0; reportinfo_rc = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); if (reportinfo_rc != 0) { // no more reports if (reportinfo_rc != -1) REPORT_USB_IOCTL_ERROR("HIDIOCGREPORTINFO", errno); break; } for (int fndx = 0; fndx < rinfo.num_fields && field_index_found == -1; fndx++) { // finfo_found = is_field_edid(fd, &rinfo, fndx); // *** TEMP *** FORCE FAILURE finfo_found = test_field_ucode(fd, report_type, rinfo.report_id, fndx, ucode, match_all_ucodes); if (finfo_found) { report_id_found = rinfo.report_id; field_index_found = fndx; break; } } rinfo.report_id |= HID_REPORT_ID_NEXT; } // loop over reports // assert( (report_id_found >= 0 && finfo_found ) || // (report_id_found == -1 && !finfo_found ) ); if (finfo_found) { // if (report_id_found >= 0) { result = calloc(1, sizeof(struct hid_field_locator)); // result->rinfo = calloc(1, sizeof(struct hiddev_report_info)); // memcpy(result->rinfo, &rinfo, sizeof(struct hiddev_report_info)); result->finfo = finfo_found; // returned by is_field_edid() or test_field_ucode() result->report_type = rinfo.report_type; result->report_id = report_id_found; result->field_index = field_index_found; // finfo.field_index may have been changed by HIDIOGREPORTINFO } if (debug) { if (result) { printf("(%s) Returning: %p\n", __func__, result); printf("(%s) report_id=%d, field_index=%d\n", __func__, result->report_id, result->field_index); // report_hid_field_locator(result, 1); } else printf("(%s) Returning NULL", __func__); } return result; } /* Finds the report describing the EDID. * * Arguments: * fd file descriptor of open hiddev device * * Returns: pointer to newly allocated struct hid_field_locator representing * the feature report and field within that report that returns * the EDID, * NULL if not found * * It is the responsibility of the caller to free the returned struct. */ struct hid_field_locator * locate_edid_report(int fd) { bool debug = false; struct hid_field_locator* result = NULL; result = hiddev_find_report(fd, HID_REPORT_TYPE_FEATURE, 0x00800002, /*match_all_ucodes=*/true); if (result) { // find_report() should have parm specifying minimum number of usages if (result->finfo->maxusage < 128) { printf("(%s) Located report contains less than 128 usages. Discarding.\n", __func__); free_hid_field_locator(result); result = NULL; } } if (debug) { if (result) { printf("(%s) Returning %p report_id=%d, field_index=%d\n", __func__, result, result->report_id, result->field_index); // report_hid_field_locator(result, 1); } else printf("(%s) Returning NULL", __func__); } return result; } // // Get multibyte value // /* Base function for retrieving a multibyte field value using a * call to HIDIOCGUSAGES. The value to be retrieved is specified * using a struct hiddev_usage_ref_multi. * * Arguments: * fd file descriptor of open hiddev device * uref_multi specifies value to be retrieve, and buffer * in which to return bytes * * Returns: * pointer to Buffer struct containing the value, NULL if error * * It is the responsibility of the caller to free the returned buffer. */ Buffer * get_multibyte_value_by_uref_multi( int fd, struct hiddev_usage_ref_multi * uref_multi ) { bool debug = false; if (debug) { printf("(%s) Starting. fd=%d, uref_multi=%p\n", __func__, fd, uref_multi); report_hiddev_usage_ref_multi(uref_multi, 1); } int rc; Buffer * result = NULL; __u32 report_type = uref_multi->uref.report_type; assert(report_type == HID_REPORT_TYPE_FEATURE || report_type == HID_REPORT_TYPE_INPUT); // *** CG19 *** rc = ioctl(fd, HIDIOCGUSAGES, uref_multi); // Fills in usage value if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGUSAGES", errno); goto bye; } result = buffer_new(uref_multi->num_values, __func__); for (int ndx=0; ndxnum_values; ndx++) buffer_add(result, uref_multi->values[ndx] & 0xff); bye: if (debug) { DBGMSG("Returning: %p", __func__, result); if (result) { dbgrpt_buffer(result, 1); } } return result; } /* Retrieve the bytes of a multibyte field value using a * call to HIDIOCGUSAGES. The field to be retrieved is * specified using a struct hid_field_locator. * * Arguments: * fd file descriptor of open hiddev device * loc pointer to hid_field_locator struct * * Returns: * pointer to Buffer struct containing the value, NULL if error * * It is the responsibility of the caller to free the returned buffer. */ Buffer * hiddev_get_multibyte_report_value_by_hid_field_locator( int fd, struct hid_field_locator * loc) { bool debug = false; if (debug) { printf("(%s) Starting. hid_field_locator=%p\n", __func__, loc); // report_hid_field_locator(loc, 1); } Buffer * result = NULL; struct hiddev_report_info rinfo; rinfo.report_type = loc->report_type; rinfo.report_id = loc->report_id; rinfo.num_fields = 0; // initialize to avoid valgrind warning int rc = ioctl(fd, HIDIOCGREPORT, &rinfo); if (rc != 0) { REPORT_USB_IOCTL_ERROR("HIDIOCGREPORT", errno); goto bye; } struct hiddev_usage_ref_multi uref_multi; memset(&uref_multi, 0, sizeof(uref_multi)); // initialize all fields to make valgrind happy uref_multi.uref.report_type = loc->report_type; uref_multi.uref.report_id = loc->report_id; uref_multi.uref.field_index = loc->field_index; uref_multi.uref.usage_index = 0; uref_multi.uref.usage_code = 0; uref_multi.num_values = loc->finfo->maxusage; result = get_multibyte_value_by_uref_multi(fd, &uref_multi); bye: if (debug) printf("(%s) Returning: %p\n", __func__, result); return result; } /* Retrieve the bytes of a multibyte field value using a call to HIDIOCGUSAGES. * It is left to hiddev to determine the correct report of the specified report * type to use to get the value of the specified usage code. * * Arguments: * fd file descriptor of open hiddev device * report_type HID_REPORT_TYPE_FEATURE or HID_REPORT_TYPE_INPUT * usage_code usage code to retrieve * num_values number of bytes * * Returns: * pointer to Buffer struct containing the value, NULL if error * * It is the responsibility of the caller to free the returned buffer. */ Buffer * hiddev_get_multibyte_value_by_report_type_and_ucode( int fd, __u32 report_type, __u32 usage_code, __u32 num_values) { bool debug = false; if (debug) printf("(%s) Starting. fd=%d, report_type=%d, usage_code=0x%08x, num_values=%d\n", __func__, fd, report_type, usage_code, num_values); Buffer * result = NULL; assert(report_type == HID_REPORT_TYPE_FEATURE || report_type == HID_REPORT_TYPE_INPUT); struct hiddev_usage_ref_multi uref_multi; memset(&uref_multi, 0, sizeof(uref_multi)); // initialize all fields to make valgrind happy uref_multi.uref.report_type = report_type; uref_multi.uref.report_id = HID_REPORT_ID_UNKNOWN; uref_multi.uref.usage_code = usage_code; uref_multi.num_values = num_values; // needed? yes! result = get_multibyte_value_by_uref_multi(fd, &uref_multi); if (debug) printf("(%s) Returning: %p\n", __func__, result); return result; } /* Retrieve the bytes of a multibyte field value using a call to HIDIOCGUSAGES. * It is left to hiddev to determine the correct report to use to get the value * of the specified usage code. Both Feature and Input reports are tried. * * This function first tries to get a value using a feature report. * If that fails, an input report is tried. * * Arguments: * fd file descriptor of open hiddev device * usage_code usage code to retrieve * num_values number of bytes * * Returns: * pointer to Buffer struct containing the value * * It is the responsibility of the caller to free the returned buffer. */ Buffer * hiddev_get_multibyte_value_by_ucode(int fd,__u32 usage_code, __u32 num_values) { Buffer * result = hiddev_get_multibyte_value_by_report_type_and_ucode( fd, HID_REPORT_TYPE_FEATURE, usage_code, num_values); if (!result) result = hiddev_get_multibyte_value_by_report_type_and_ucode( fd, HID_REPORT_TYPE_INPUT, usage_code, num_values); return result; } /* Retrieves the EDID (128 bytes) from a hiddev device representing a HID * compliant monitor. * * Arguments: * fd file descriptor * * Returns: * pointer to Buffer struct containing the EDID * * It is the responsibility of the caller to free the returned buffer. */ Buffer * get_hiddev_edid(int fd) { bool debug = false; if (debug) printf("(%s) Starting\n", __func__); Buffer * result = NULL; struct hid_field_locator * loc = locate_edid_report(fd); if (loc) { result = hiddev_get_multibyte_report_value_by_hid_field_locator(fd, loc); free_hid_field_locator(loc); } if (debug) printf("(%s) Returning: %p\n", __func__, result); return result; } // // *** Miscellaneous functions *** // /* Returns the name of a hiddev device, as reported by ioctl HIDIOCGNAME. * * Arguments: * fd file descriptor of open hiddev device * * Returns: pointer to newly allocated string, * NULL if ioctl call fails (should never happen) */ char * get_hiddev_name(int fd) { // printf("(%s) Starting. fd=%d\n", __func__, fd); const int blen = 256; char buf1[blen]; for (int ndx=0; ndx < blen; ndx++) buf1[ndx] = '\0'; // initialize to avoid valgrind warning // returns length of result, including terminating null int rc = ioctl(fd, HIDIOCGNAME(blen), buf1); // printf("(%s) HIDIOCGNAME returned %d\n", __func__, rc); // hex_dump(buf1,64); char * result = NULL; if (rc >= 0) result = strdup(buf1); // printf("(%s) Returning |%s|\n", __func__, result); return result; } ddcutil-0.8.6/src/usb_util/hidraw_util.c0000644000175000001440000002635313230445447015205 00000000000000/* hidraw_util.c * * Created on: Jul 23, 2016 * Author: rock * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "util/coredefs.h" #include "util/file_util.h" #include "util/glib_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/udev_util.h" #include "util/udev_usb_util.h" #include "usb_util/base_hid_report_descriptor.h" #include "usb_util/hid_report_descriptor.h" #include "usb_util/usb_hid_common.h" #include "usb_util/hidraw_util.h" // // *** Functions to identify hidraw devices representing monitors *** // /* Filter to find hiddevN files for scandir() */ static int is_hidraw(const struct dirent *ent) { return !strncmp(ent->d_name, "hidraw", strlen("hidraw")); } GPtrArray * get_hidraw_device_names_using_filesys() { const char *hidraw_paths[] = { "/dev/", NULL }; // Dirent_Filter filterfunc = is_hidraw; return get_filenames_by_filter(hidraw_paths, is_hidraw); } // // Utility functions // const char * bus_str(int bus) { switch (bus) { case BUS_USB: return "USB"; break; case BUS_HIL: return "HIL"; break; case BUS_BLUETOOTH: return "Bluetooth"; break; case BUS_VIRTUAL: return "Virtual"; break; default: return "Other"; break; } } // // Probe hidraw devices // void probe_hidraw_device(char * devname, bool show_monitors_only, int depth) { bool debug = false; puts(""); rpt_vstring(depth, "Probing device %s", devname); // printf("(%s) %s\n", __func__, devname); int d1 = depth+1; int d2 = depth+2; int fd; // int i; int res, desc_size = 0; Byte buf[1024] = {0}; // initialize to avoid valgrind warning struct hidraw_report_descriptor rpt_desc; struct hidraw_devinfo info; memset(&rpt_desc, 0x0, sizeof(rpt_desc)); memset(&info, 0x0, sizeof(info)); // memset(buf, 0x0, sizeof(buf)); /* Open the Device with non-blocking reads. In real life, don't use a hard coded path; use libudev instead. */ fd = open(devname, O_RDWR|O_NONBLOCK); if (fd < 0) { rpt_vstring(depth, "Unable to open device %s: %s", devname, strerror(errno)); Usb_Detailed_Device_Summary * devsum = lookup_udev_usb_device_by_devname(devname); if (devsum) { // report_usb_detailed_device_summary(devsum, 2); rpt_vstring(d1, "USB bus %s, device %s, vid:pid: %s:%s - %s:%s", devsum->busnum_s, devsum->devnum_s, devsum->vendor_id, devsum->product_id, devsum->vendor_name, devsum->product_name); free_usb_detailed_device_summary(devsum); } goto bye; } /* Get Raw Name */ res = ioctl(fd, HIDIOCGRAWNAME(256), buf); if (res < 0) { perror("HIDIOCGRAWNAME"); goto bye; } rpt_vstring(d1, "Raw Name: %s", buf); /* Get Physical Location */ res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); if (res < 0) { perror("HIDIOCGRAWPHYS"); goto bye; } rpt_vstring(d1, "Raw Phys: %s", buf); /* Get Raw Info */ res = ioctl(fd, HIDIOCGRAWINFO, &info); if (res < 0) { perror("HIDIOCGRAWINFO"); goto bye; } rpt_vstring(d1, "Raw Info:"); rpt_vstring(d2, "bustype: %d (%s)", info.bustype, bus_str(info.bustype)); rpt_vstring(d2, "vendor: 0x%04hx", info.vendor); rpt_vstring(d2, "product: 0x%04hx", info.product); // Get bus and device numbers using udev since hidraw doesn't report it char * simple_devname = strstr(devname, "hidraw"); Udev_Usb_Devinfo * dinfo = get_udev_usb_devinfo("hidraw", simple_devname); if (dinfo) { rpt_vstring(d1, "Busno:Devno as reported by get_udev_usb_devinfo() for %s: %03d:%03d", simple_devname, dinfo->busno, dinfo->devno); free(dinfo); } else rpt_vstring(d1, "Error getting busno:devno using get_udev_usb_devinfo()"); /* Get Report Descriptor Size */ // why is this necessary? buffer in rpt_desc is already HID_MAX_DESCRIPTOR_SIZE? res = ioctl(fd, HIDIOCGRDESCSIZE, &desc_size); if (res < 0) { perror("HIDIOCGRDESCSIZE"); goto bye; } if (debug) rpt_vstring(d1, "Report Descriptor Size: %d", desc_size); // bool is_monitor = false; /* Get Report Descriptor */ rpt_desc.size = desc_size; res = ioctl(fd, HIDIOCGRDESC, &rpt_desc); if (res < 0) { perror("HIDIOCGRDESC"); goto bye; } if (debug) { rpt_vstring(d1, "Report Descriptor:"); // for (i = 0; i < rpt_desc.size; i++) // printf("%hhx ", rpt_desc.value[i]); // puts("\n"); rpt_hex_dump(rpt_desc.value, rpt_desc.size, d2); } Hid_Report_Descriptor_Item * report_item_list = tokenize_hid_report_descriptor(rpt_desc.value, rpt_desc.size) ; // report_hid_report_item_list(report_item_list, d2); bool is_monitor = is_monitor_by_tokenized_hid_report_descriptor(report_item_list); #ifdef OLD Hid_Report_Descriptor_Item * cur_item = report_item_list; // Look at the first Usage Page item, is it USB Monitor? while (cur_item) { if (cur_item->btag == 0x04) { if (cur_item->data == 0x80) is_monitor = true; break; } cur_item = cur_item->next; } #endif rpt_vstring(d1, "%s a USB connected monitor", (is_monitor) ? "Is" : "Not"); if (!is_monitor && show_monitors_only) { is_monitor = force_hid_monitor_by_vid_pid( info.vendor, info.product); if (is_monitor) rpt_vstring(d1, "Device vid/pid matches exception list. Forcing report for device."); } Parsed_Hid_Descriptor * phd = NULL; if (is_monitor || !show_monitors_only) { rpt_vstring(d1,"Tokenized report descriptor:"); report_hid_report_item_list(report_item_list, d2); } if (is_monitor) { puts(""); phd = parse_hid_report_desc(rpt_desc.value, rpt_desc.size); Parsed_Hid_Report * edid_report = find_edid_report_descriptor(phd); if (edid_report) { rpt_title("Report descriptor for EDID:", d1); summarize_parsed_hid_report(edid_report, d2); } else rpt_title("No EDID report descriptor found!!!", d1); puts(""); GPtrArray * feature_reports = get_vcp_code_reports(phd); if (feature_reports && feature_reports->len > 0) { rpt_title("Report descriptors for VCP features:", d1); summarize_vcp_code_report_array(feature_reports, d2); } else rpt_title("No VCP Feature report descriptors found!!!", d1); GPtrArray * reports = select_parsed_hid_report_descriptors(phd, HIDF_REPORT_TYPE_FEATURE); if (reports->len == 0) { puts(""); rpt_title("No HID reports exist of type HIDF_REPORT_TYPE_FEATURE.", d1); } for (int ndx = 0; ndx < reports->len; ndx++) { Parsed_Hid_Report * a_report = g_ptr_array_index(reports, ndx); puts(""); rpt_vstring(d1, "HID Feature report id: %3d 0x%02x", a_report->report_id, a_report->report_id); rpt_vstring(d1, "Parsed report description:"); report_parsed_hid_report(a_report, d2); /* Get Feature */ buf[0] = a_report->report_id; /* Report Number */ res = ioctl(fd, HIDIOCGFEATURE(1024), buf); if (res < 0) { perror("HIDIOCGFEATURE"); } else { // printf("ioctl HIDIOCGFEATURE returned: %d\n", res); rpt_vstring(d1,"Report data:"); rpt_vstring(d1, "Per hidraw.h: The first byte of SFEATURE and GFEATURE is the report number"); rpt_hex_dump(buf, res, d2); } } free_parsed_hid_descriptor(phd); // not defined, but need to free phd } free_hid_report_item_list(report_item_list); bye: if (fd > 0) close(fd); } /* Indicates if a hidraw device represents a monitor. * * Arguments: * devname device name, e.g. /dev/hidraw3 * * Returns: true/false * */ bool hidraw_is_monitor_device(char * devname) { bool debug = false; if (debug) printf("(%s) 'Checking device %s\n", __func__, devname); bool is_monitor = false; int fd; int res, desc_size = 0; Byte buf[1024]; // TODO: maximum report size struct hidraw_report_descriptor rpt_desc; // struct hidraw_devinfo info; /* Open the Device with non-blocking reads. In real life, don't use a hard coded path; use libudev instead. */ fd = open(devname, O_RDWR|O_NONBLOCK); if (fd < 0) { perror("Unable to open device"); goto bye; } memset(&rpt_desc, 0x0, sizeof(rpt_desc)); // memset(&info, 0x0, sizeof(info)); memset(buf, 0x0, sizeof(buf)); /* Get Report Descriptor Size */ res = ioctl(fd, HIDIOCGRDESCSIZE, &desc_size); if (res < 0) { perror("HIDIOCGRDESCSIZE"); goto bye; } /* Get Report Descriptor */ rpt_desc.size = desc_size; res = ioctl(fd, HIDIOCGRDESC, &rpt_desc); if (res < 0) { perror("HIDIOCGRDESC"); goto bye; } Hid_Report_Descriptor_Item * report_item_list = tokenize_hid_report_descriptor(rpt_desc.value, rpt_desc.size) ; // report_hid_report_item_list(report_item_list, 2); is_monitor = is_monitor_by_tokenized_hid_report_descriptor(report_item_list); free_hid_report_item_list(report_item_list); bye: if (fd >= 0) // really shouldn't be closing 0..2 stdin..stderr, but coverity complains close(fd); if (debug) printf("(%s) devname=%s, returning %s\n", __func__, devname, bool_repr(is_monitor)); return is_monitor; } /* Probes hidraw devices. * * Arguments: * show_monitors_only show detailed information only for monitors * depth logical indentation depth * * Returns: nothing */ void probe_hidraw(bool show_monitors_only, int depth) { GPtrArray * hidraw_names = get_hidraw_device_names_using_filesys(); rpt_vstring(depth, "Found %d USB HID devices.", hidraw_names->len); for (int ndx = 0; ndx < hidraw_names->len; ndx++) { char * devname = g_ptr_array_index(hidraw_names, ndx); // printf("(%s) Probing %s...\n", __func__, devname); probe_hidraw_device(devname, true, depth); } g_ptr_array_free(hidraw_names, true); } ddcutil-0.8.6/src/usb_util/libusb_reports.c0000664000175000001440000012515413227061731015725 00000000000000/* libusb_reports.c * * Report libusb data structures * * libusb is not currently used by ddcutil. This code is retained for reference. * * * Copyright (C) 2016-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * * * Portions adapted from lsusb.c (command lsusb) by Thomas Sailer and David Brownell */ // Adapted from usbplay2 file libusb_util.c #include #include #include #include #include // HID_MAX_DESCRIPTOR_SIZE is here on Mint #include // for HID_MAX_DESCRIPTOR_SIZE #include #include #include #include #include // #include #include "util/data_structures.h" #include "util/string_util.h" #include "util/report_util.h" #include "util/device_id_util.h" #include "usb_util/base_hid_report_descriptor.h" #include "usb_util/hid_report_descriptor.h" #include "usb_util/usb_hid_common.h" #include "usb_util/libusb_reports.h" // // Identifier to name tables // Value_Name class_id_table[] = { {LIBUSB_CLASS_PER_INTERFACE, "LIBUSB_CLASS_PER_INTERFACE"}, VN(LIBUSB_CLASS_AUDIO), // {0xff,NULL}, VN_END }; Value_Name_Title class_code_table[] = { /** In the context of a \ref libusb_device_descriptor "device descriptor", * LIBUSB_CLASS_PER_INSTANCE indicates that each interface specifies its * own class information and all interfaces operate independently. */ VNT( LIBUSB_CLASS_PER_INTERFACE, "Per interface"), // 0 VNT( LIBUSB_CLASS_AUDIO, "Audio"), // 1 VNT( LIBUSB_CLASS_COMM, "Communications"), // 2 VNT( LIBUSB_CLASS_HID, "Human Interface Device"), // 3 VNT( LIBUSB_CLASS_PHYSICAL, "Physical device"), // 5 VNT( LIBUSB_CLASS_PRINTER, "Printer"), // 7 VNT( LIBUSB_CLASS_IMAGE, "Image"), // 6 VNT( LIBUSB_CLASS_MASS_STORAGE, "Mass storage"), // 8 VNT( LIBUSB_CLASS_HUB, "Hub"), // 9 VNT( LIBUSB_CLASS_DATA, "Data"), // 10 VNT( LIBUSB_CLASS_SMART_CARD, "Smart card"), // 0x0b VNT( LIBUSB_CLASS_CONTENT_SECURITY, "Content security"), // 0x0d VNT( LIBUSB_CLASS_VIDEO, "Video"), // 0x0e VNT( LIBUSB_CLASS_PERSONAL_HEALTHCARE, "Personal healthcare"), // 0x0f VNT( LIBUSB_CLASS_DIAGNOSTIC_DEVICE, "Diagnostic device"), // 0xdc VNT( LIBUSB_CLASS_WIRELESS, "Wireless"), // 0xe0 VNT( LIBUSB_CLASS_APPLICATION, "Application"), // 0xfe VNT( LIBUSB_CLASS_VENDOR_SPEC, "Vendor specific"), // 0xff VNT_END }; Value_Name_Title descriptor_type_table[] = { VNT( LIBUSB_DT_DEVICE, "Device"), // 0x01 VNT( LIBUSB_DT_CONFIG, "Configuration"), // 0x02 VNT( LIBUSB_DT_STRING, "String"), // 0x03 VNT( LIBUSB_DT_INTERFACE, "Interface"), // 0x04 VNT( LIBUSB_DT_ENDPOINT, "Endpoint"), // 0x05 VNT( LIBUSB_DT_BOS, "BOS" ), // 0x0f, VNT( LIBUSB_DT_DEVICE_CAPABILITY, "Device Capability"), // 0x10, VNT( LIBUSB_DT_HID, "HID"), // 0x21, VNT( LIBUSB_DT_REPORT, "HID report"), // 0x22, VNT( LIBUSB_DT_PHYSICAL, "Physical"), // 0x23, VNT( LIBUSB_DT_HUB, "Hub"), // 0x29, VNT( LIBUSB_DT_SUPERSPEED_HUB, "SuperSpeed Hub"), // 0x2a, VNT( LIBUSB_DT_SS_ENDPOINT_COMPANION, "SuperSpeed Endpoint Companion"), // 0x30 VNT_END }; #ifdef REF /** \ingroup desc * Endpoint direction. Values for bit 7 of the * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme. */ enum libusb_endpoint_direction { /** In: device-to-host */ LIBUSB_ENDPOINT_IN = 0x80, /** Out: host-to-device */ LIBUSB_ENDPOINT_OUT = 0x00 }; #endif Value_Name_Title endpoint_direction_table[] = { VNT( LIBUSB_ENDPOINT_IN, "IN"), VNT( LIBUSB_ENDPOINT_OUT, "OUT"), VNT_END }; #ifdef REF #define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ /** \ingroup desc * Endpoint transfer type. Values for bits 0:1 of the * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. */ enum libusb_transfer_type { /** Control endpoint */ LIBUSB_TRANSFER_TYPE_CONTROL = 0, /** Isochronous endpoint */ LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, /** Bulk endpoint */ LIBUSB_TRANSFER_TYPE_BULK = 2, /** Interrupt endpoint */ LIBUSB_TRANSFER_TYPE_INTERRUPT = 3, /** Stream endpoint */ LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4, }; #endif // Problem: LIBUSB_TRANFER_TYPE_BULK_STREAM not defined in 1.0.17 #define LIBUSB_TRANSFER_TYPE_BULK_STREAM_LOCAL 4 Value_Name_Title transfer_type_table[] = { VNT(LIBUSB_TRANSFER_TYPE_CONTROL, "Control"), // 0 VNT(LIBUSB_TRANSFER_TYPE_ISOCHRONOUS, "Isochronous"), // 1 VNT(LIBUSB_TRANSFER_TYPE_BULK, "Bulk"), // 2 VNT(LIBUSB_TRANSFER_TYPE_INTERRUPT, "Interrupt"), // 3 VNT(LIBUSB_TRANSFER_TYPE_BULK_STREAM_LOCAL, "Bulk Stream"), // 4 VNT_END }; char * descriptor_title(Byte val) { return vnt_title(descriptor_type_table, val); } char * endpoint_direction_title(Byte val) { return vnt_title(endpoint_direction_table, val); } char * transfer_type_title(Byte val) { return vnt_title(transfer_type_table, val); } char * class_code_title(Byte val) { return vnt_title(class_code_table, val); } // // Misc Utilities // #define LIBUSB_STRING_BUFFER_SIZE 100 char libusb_string_buffer[LIBUSB_STRING_BUFFER_SIZE]; char * lookup_libusb_string(struct libusb_device_handle * dh, int string_id) { int rc = libusb_get_string_descriptor_ascii( dh, string_id, (unsigned char *) libusb_string_buffer, LIBUSB_STRING_BUFFER_SIZE); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_string_descriptor_ascii", rc); strcpy(libusb_string_buffer, ""); } else { // 7/2017: assert was triggered by user, why? // replace assert by diagnostic message printf("(%s) rc=%d, LIBUSB_STRING_BUFFER_SIZE=%d, strlen=%zu\n", __func__, rc, LIBUSB_STRING_BUFFER_SIZE, strlen(libusb_string_buffer) ); // assert(rc == strlen(libusb_string_buffer)); } return libusb_string_buffer; } #ifdef UNUSED // unused, and requires include of wchar.h wchar_t libusb_string_buffer_wide[LIBUSB_STRING_BUFFER_SIZE]; wchar_t * lookup_libusb_string_wide(struct libusb_device_handle * dh, int string_id) { int rc = libusb_get_string_descriptor( dh, string_id, 33, // US English (unsigned char *) libusb_string_buffer_wide, // N. CAST LIBUSB_STRING_BUFFER_SIZE); if (rc < 0) { REPORT_LIBUSB_ERROR("libusb_get_string_descriptor_wide", rc, LIBUSB_CONTINUE); wcscpy(libusb_string_buffer_wide, L""); } else { // printf("(%s) rc=%d, wcslen(libusb_string_buffer_wide)=%d, strlen=%d\n", // __func__, rc, wcslen(libusb_string_buffer_wide), strlen(libusb_string_buffer_wide) ); // assert(rc == wcslen(libusb_string_buffer)); } return (wchar_t *) libusb_string_buffer; } #endif // from lsusb.c /* ---------------------------------------------------------------------- */ /* workaround libusb API goofs: "byte" should never be sign extended; * using "char" is trouble. Likewise, sizes should never be negative. */ static inline int typesafe_control_msg( libusb_device_handle * dev, unsigned char requesttype, unsigned char request, int value, int idx, unsigned char * bytes, unsigned size, int timeout) { int ret = libusb_control_transfer( dev, requesttype, request, value, idx, bytes, size, timeout); if (ret < 0) return -ret; else return ret; } #define usb_control_msg typesafe_control_msg // // Report functions for libusb data structures // void report_libusb_endpoint_descriptor( const struct libusb_endpoint_descriptor * epdesc, libusb_device_handle * dh, // may be null int depth) { int d1 = depth+1; rpt_structure_loc("libusb_endpoint_descriptor", epdesc, depth); rpt_vstring(d1, "%-20s 0x%02x %s", "bDescriptorType:", epdesc->bDescriptorType, descriptor_title(epdesc->bDescriptorType) ); /** bEndpointAddress: The address of the endpoint described by this descriptor. Bits 0:3 are * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, * see \ref libusb_endpoint_direction. */ unsigned char endpoint_number = epdesc->bEndpointAddress & 0x0f; char * direction_name = (epdesc->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) ? "IN" : "OUT"; rpt_vstring(d1, "%-20s 0x%02x Endpoint number: %d Direction: %s", "bEndpointAddress:", epdesc->bEndpointAddress, endpoint_number, direction_name); /** Attributes which apply to the endpoint when it is configured using * the bConfigurationValue. Bits 0:1 determine the transfer type and * correspond to \ref libusb_transfer_type. Bits 2:3 are only used for * isochronous endpoints and correspond to \ref libusb_iso_sync_type. * Bits 4:5 are also only used for isochronous endpoints and correspond to * \ref libusb_iso_usage_type. Bits 6:7 are reserved. */ // uint8_t bmAttributes; Byte transfer_type = epdesc->bmAttributes & 0x03; // Byte isoc_sync_type = epdesc->bmAttributes & 0x0c; // unused // Byte isoc_iso_usage_type = epdesc->bmAttributes & 0x30; // unused rpt_vstring(d1, "%-20s 0x%02x Transfer Type: %s", "bmAttributes:", epdesc->bmAttributes, transfer_type_title(transfer_type) ); /** Maximum packet size this endpoint is capable of sending/receiving. */ // uint16_t wMaxPacketSize; rpt_vstring(d1, "%-20s %u", "wMaxPacketSize:", epdesc->wMaxPacketSize); /** Interval for polling endpoint for data transfers. */ // uint8_t bInterval; rpt_vstring(d1, "%-20s %d %s", "bInterval", epdesc->bInterval, "(data transfer polling interval)" ); // skipping several /** Length of the extra descriptors, in bytes. */ // int extra_length; rpt_vstring(d1, "%-20s %d (length of extra descriptors)", "extra_length:", epdesc->extra_length); } // from lsusb.c /* Read a control message * * Arguments: * dh libusb display handle * bmRequestType * bRequest * wValue * wIndex bInterfaceNumber parm * dbuf pointer to buffer * dbufsz buffer size * WLength number of bytes to try to read * pbytes_read return number of bytes actually read here * * Returns: true if success, false if not */ bool call_read_control_msg( struct libusb_device_handle * dh, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, // = bInterfaceNumber Byte * dbuf, // data uint16_t dbufsz, uint16_t wLength, // report length int * pbytes_read) { bool debug = false; if (debug) printf("(%s) Starting\n", __func__); assert(dh); assert( dbufsz >= wLength); // const int CTRL_RETRIES = 2; const int CTRL_TIMEOUT = (5*1000); /* milliseconds */ bool ok = false; int bytes_read = 0; uint16_t bInterfaceNumber = wIndex; uint16_t rptlen = wLength; int rc = libusb_claim_interface(dh, bInterfaceNumber); if (rc != 0) { // TODO: replace w proper diagnostic message using libusb functions printf("(%s) libusb_claim_inteface returned %d\n", __func__, rc); goto bye; } int retries = 4; while (bytes_read < rptlen && retries--) { bytes_read = usb_control_msg( dh, bmRequestType, bRequest, wValue, bInterfaceNumber, // = wIndex dbuf, rptlen, // = wLength CTRL_TIMEOUT); } if (bytes_read > 0) { ok = true; } libusb_release_interface(dh, bInterfaceNumber); bye: *pbytes_read = bytes_read; if (debug) printf("(%s) Returning: %s, *pbytes_read=%d\n", __func__, bool_repr(ok), *pbytes_read); return ok; } /* Get bytes of HID Report Descriptor * * Arguments: * dh * bInterfaceNumber * rptlen * dbuf * dbufsz * * Returns: true if success, false if not */ bool get_raw_report_descriptor( struct libusb_device_handle * dh, uint8_t bInterfaceNumber, uint16_t rptlen, // report length Byte * dbuf, int dbufsz, int * pbytes_read) { bool ok = false; assert(dh); ok = call_read_control_msg( dh, // dev_handle LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_INTERFACE, // bmRequestType LIBUSB_REQUEST_GET_DESCRIPTOR, // bRequest LIBUSB_DT_REPORT << 8 | 0x0, // wValue - the value field for the setup packet bInterfaceNumber, // ?? wIndex - index field for the setup packet ??? dbuf, // data dbufsz, rptlen, // wLength pbytes_read ); if (ok && *pbytes_read < rptlen) { printf(" Warning: incomplete report descriptor\n"); // dump_report_desc(dbuf, *pbytes_read); // old way } return ok; } // TODO: move to more appropriate location // HID Class-Specific Requests values. See section 7.2 of the HID specifications #define HID_GET_REPORT 0x01 #define HID_GET_IDLE 0x02 #define HID_GET_PROTOCOL 0x03 #define HID_SET_REPORT 0x09 #define HID_SET_IDLE 0x0A #define HID_SET_PROTOCOL 0x0B #ifdef ALREADY_DEFINED // defined in hid_report_descriptor.h #define HID_REPORT_TYPE_INPUT 0x01 #define HID_REPORT_TYPE_OUTPUT 0x02 #define HID_REPORT_TYPE_FEATURE 0x03 #endif /* Get bytes of HID Feature Report * * Arguments: * dh libusb device handle * bInterfaceNumber interface number * report_id feature report number * rptlen bytes requested (may be larger than actual report size) * dbuf pointer to buffer * dbufsz buffer size * pbytes_read return number of bytes read here * * Returns: true if success, false if not */ bool get_raw_report( struct libusb_device_handle * dh, uint8_t bInterfaceNumber, uint8_t report_id, uint16_t rptlen, // report length Byte * dbuf, int dbufsz, int * pbytes_read) { bool ok = false; ok = call_read_control_msg( dh, // dev_handle LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE, // bmRequestType HID_GET_REPORT, // bRequest HID_REPORT_TYPE_FEATURE << 8 | report_id, // wValue - the value field for the setup packet bInterfaceNumber, // ?? wIndex - index field for the setup packet ??? dbuf, // data dbufsz, rptlen, // wLength pbytes_read ); return ok; } /* Reports struct libusb_interface_descriptor * * Arguments: * inter pointer to libusb_interface_descriptor instance * dh display handle, not required but allows for additional information * depth logical indentation depth * * Returns: nothing */ void report_libusb_interface_descriptor( const struct libusb_interface_descriptor * inter, libusb_device_handle * dh, // may be null int depth) { int d1 = depth+1; rpt_structure_loc("libusb_interface_descriptor", inter, depth); /** Size of this descriptor (in bytes) */ // uint8_t bLength; rpt_vstring(d1, "%-20s %d", "bLength", inter->bLength); /** Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE LIBUSB_DT_INTERFACE * in this context. */ // uint8_t bDescriptorType; rpt_vstring(d1, "%-20s 0x%02x %s", "bDescriptorType:", inter->bDescriptorType, descriptor_title(inter->bDescriptorType) ); /** Number of this interface */ // uint8_t bInterfaceNumber; rpt_vstring(d1, "%-20s %u", "bInterfaceNumber:", inter->bInterfaceNumber); /** Value used to select this alternate setting for this interface */ // uint8_t bAlternateSetting; rpt_vstring(d1, "%-20s %u", "bAlternateSetting:", inter->bAlternateSetting); /** Number of endpoints used by this interface (excluding the control * endpoint). */ // uint8_t bNumEndpoints; rpt_vstring(d1, "%-20s %u", "bNumEndpoints:", inter->bNumEndpoints); /** USB-IF class code for this interface. See \ref libusb_class_code. */ // uint8_t bInterfaceClass; rpt_vstring(d1, "%-20s %u (0x%02x) %s", "bInterfaceClass:", inter->bInterfaceClass, inter->bInterfaceClass, class_code_title(inter->bInterfaceClass) ); /** USB-IF subclass code for this interface, qualified by the * bInterfaceClass value */ // uint8_t bInterfaceSubClass; rpt_vstring(d1, "%-20s %u (0x%02x) %s", "bInterfaceSubClass:", inter->bInterfaceSubClass, inter->bInterfaceSubClass, ""); /** USB-IF protocol code for this interface, qualified by the * bInterfaceClass and bInterfaceSubClass values */ // uint8_t bInterfaceProtocol; rpt_vstring(d1, "%-20s %u (0x%02x) %s", "bInterfaceProtocol:", inter->bInterfaceProtocol, inter->bInterfaceProtocol, ""); // Index of string descriptor describing this interface: uint8_t iInterface; char * interface_name = ""; if (dh && inter->iInterface > 0) interface_name = lookup_libusb_string(dh, inter->iInterface); rpt_vstring(d1, "%-20s %d \"%s\" ", "iInterface", inter->iInterface, interface_name ); /** Array of endpoint descriptors. This length of this array is determined * by the bNumEndpoints field. */ // const struct libusb_endpoint_descriptor *endpoint; // NB: This is an array of endpoint descriptors, // not an array of pointers to endpoint descriptors // nor a pointer to array of pointers to endpoint descriptors int ndx = 0; for (ndx=0; ndxbNumEndpoints; ndx++) { const struct libusb_endpoint_descriptor *epdesc = &(inter->endpoint[ndx]); report_libusb_endpoint_descriptor(epdesc, dh, d1); } /** Extra descriptors. If libusb encounters unknown interface descriptors, * it will store them here, should you wish to parse them. */ // const unsigned char *extra; /** Length of the extra descriptors, in bytes. */ // int extra_length; rpt_vstring(d1, "%-20s %d (length of extra descriptors)", "extra_length:", inter->extra_length); if (inter->extra_length > 0) { rpt_vstring(d1, "extra at %p: ", inter->extra); rpt_hex_dump(inter->extra, inter->extra_length, d1); if (dh) { if (inter->bInterfaceClass == LIBUSB_CLASS_HID) { // 3 const Byte * cur_extra = inter->extra; int remaining_length = inter->extra_length; while (remaining_length > 0) { HID_Descriptor * cur_hid_desc = (HID_Descriptor *) cur_extra; assert(cur_hid_desc->bLength <= remaining_length); report_hid_descriptor(dh, inter->bInterfaceNumber, cur_hid_desc, d1); cur_extra += cur_hid_desc->bLength; remaining_length -= cur_hid_desc->bLength; } } } } } /* Reports struct libusb_interface * * Arguments: * inter pointer to libusb_interface instance * dh display handle, not required but allows for additional information * depth logical indentation depth * * Returns: nothing * * struct libusb_interface represents a collection of alternate settings for a * particular USB interface. It contains an array of interface descriptors, one * for each alternate settings. */ void report_libusb_interface( const struct libusb_interface * interface, libusb_device_handle * dh, // may be null int depth) { int d1 = depth+1; rpt_structure_loc("libusb_interface", interface, depth); // The number of alternate settings that belong to this interface rpt_vstring(d1, "%-20s %d (number of alternate settings for this interface)", "num_altsetting", interface->num_altsetting); // rpt_int("num_altsetting", NULL, interface->num_altsetting, d1); for (int ndx=0; ndxnum_altsetting; ndx++) { report_libusb_interface_descriptor(&interface->altsetting[ndx], dh, d1); } } /* Reports struct libusb_config_descriptor * * Arguments: * config pointer to libusb_config_descriptor instance * dh display handle, not required but allows for additional information * depth logical indentation depth * * Returns: nothing * * struct libusb_config_descriptor represents the standard USB configuration * descriptor. This descriptor is documented in section 9.6.3 of the USB 3.0 * specification. It contains multiple libusb_interface structs. * * All multiple-byte fields are represented in host-endian format. */ void report_libusb_config_descriptor( const struct libusb_config_descriptor * config, libusb_device_handle * dh, // may be null int depth) { int d1 = depth+1; rpt_structure_loc("libusb_config_descriptor", config, depth); // Size of this descriptor (in bytes): uint8_t bLength; rpt_vstring(d1, "%-20s %d", "bLength:", config->bLength, d1); // Descriptor type. Will have value LIBUSB_DT_CONFIG in this context. rpt_vstring(d1, "%-20s 0x%02x %s", "bDescriptorType:", config->bDescriptorType, // uint8_t bDescriptorType; descriptor_title(config->bDescriptorType) ); /** Total length of data returned for this configuration */ //uint16_t wTotalLength; /** Number of interfaces supported by this configuration */ // uint8_t bNumInterfaces; rpt_int("bNumInterfaces", NULL, config->bNumInterfaces, d1); /** Identifier value for this configuration */ // uint8_t bConfigurationValue; rpt_int("bConfigurationValue", "id for this configuration", config->bConfigurationValue, d1); /** Index of string descriptor describing this configuration */ // uint8_t iConfiguration; rpt_int("iConfiguration", "index of string descriptor", config->iConfiguration, d1); /** Configuration characteristics */ // uint8_t bmAttributes; rpt_uint8_as_hex("bmAttributes", "config characteristics", config->bmAttributes, d1); /** Maximum power consumption of the USB device from this bus in this * configuration when the device is fully opreation. Expressed in units * of 2 mA. */ // uint8_t MaxPower; rpt_int("MaxPower", "units of 2 mA", config->MaxPower, d1); /** Array of interfaces supported by this configuration. The length of * this array is determined by the bNumInterfaces field. */ // const struct libusb_interface *interface; int ndx = 0; for (ndx=0; ndxbNumInterfaces; ndx++) { const struct libusb_interface *inter = &(config->interface[ndx]); report_libusb_interface(inter, dh, d1); } /** Extra descriptors. If libusb encounters unknown configuration * descriptors, it will store them here, should you wish to parse them. */ // const unsigned char *extra; /** Length of the extra descriptors, in bytes. */ // int extra_length; rpt_int("extra_length", "len of extra descriptors", config->extra_length, d1); } /* Reports struct libusb_device_descriptor. * * Arguments: * desc pointer to libusb_device_descriptor instance * dh if non-null, string values are looked up for string descriptor indexes * depth logical indentation depth * * Returns: nothing * * struct libusb_device_descriptor represents the standard USB device descriptor. * This descriptor is documented in section 9.6.1 of the USB 3.0 specification. * * All multiple-byte fields are represented in host-endian format. */ void report_libusb_device_descriptor( const struct libusb_device_descriptor * desc, libusb_device_handle * dh, // may be null int depth) { int d1 = depth+1; rpt_structure_loc("libusb_device_descriptor", desc, depth); // Size of this descriptor (in bytes): uint8_t bLength; rpt_vstring(d1, "%-20s %d", "bLength:", desc->bLength); // Descriptor type. Will have value LIBUSB_DT_DEVICE in this context. rpt_vstring(d1, "%-20s 0x%02x %s", "bDescriptorType:", desc->bDescriptorType, // uint8_t bDescriptorType; descriptor_title(desc->bDescriptorType) ); /** USB specification release number in binary-coded decimal. A value of * 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. */ // uint16_t bcdUSB; unsigned int bcdHi = desc->bcdUSB >> 8; unsigned int bcdLo = desc->bcdUSB & 0x0f; rpt_vstring(d1,"%-20s 0x%04x (%x.%02x)", "bcdUSB", desc->bcdUSB, bcdHi, bcdLo); /** USB-IF class code for the device. See \ref libusb_class_code. */ rpt_vstring(d1, "%-20s 0x%02x (%u) %s", "bDeviceClass:", desc->bDeviceClass, // uint8_t bDeviceClass; desc->bDeviceClass, class_code_title(desc->bDeviceClass) ); /** USB-IF subclass code for the device, qualified by the bDeviceClass value */ // uint8_t bDeviceSubClass; rpt_vstring(d1, "%-20s 0x%02x (%u)", "bDeviceSubClass:", desc->bDeviceSubClass, desc->bDeviceSubClass); /** USB-IF protocol code for the device, qualified by the bDeviceClass and * bDeviceSubClass values */ // uint8_t bDeviceProtocol; // rpt_int("bDeviceProtocol", NULL, desc->bDeviceProtocol, d1); rpt_vstring(d1, "%-20s 0x%02x (%u)", "bDeviceProtocol:", desc->bDeviceProtocol, desc->bDeviceProtocol); /** Maximum packet size for endpoint 0 */ // uint8_t bMaxPacketSize0; rpt_vstring(d1, "%-20s %u (max size for endpoint 0)", "bMaxPacketSize0:", desc->bMaxPacketSize0); Pci_Usb_Id_Names usb_id_names = devid_get_usb_names( desc->idVendor, desc->idProduct, 0, 2); // USB-IF vendor ID: uint16_t idVendor; rpt_vstring(d1, "%-20s 0x%04x %s", "idVendor:", desc->idVendor, usb_id_names.vendor_name); // USB-IF product ID: uint16_t idProduct; rpt_vstring(d1, "%-20s 0x%04x %s", "idProduct:", desc->idProduct, usb_id_names.device_name); // Device release number in binary-coded decimal: uint16_t bcdDevice; bcdHi = desc->bcdDevice >> 8; bcdLo = desc->bcdDevice & 0x0f; rpt_vstring(d1, "%-20s %2x.%02x (device release number)", "bcdDevice:", bcdHi, bcdLo); // Index of string descriptor describing manufacturer: uint8_t iManufacturer; // rpt_vstring(d1, "%-20s %u (mfg string descriptor index)", "iManufacturer:", desc->iManufacturer); char * mfg_name = ""; // wchar_t * mfg_name_w = L""; if (dh && desc->iManufacturer) { mfg_name = lookup_libusb_string(dh, desc->iManufacturer); // mfg_name_w = lookup_libusb_string_wide(dh, desc->iManufacturer) ; // wprintf(L"Manufacturer (wide) %d -%ls\n", // desc->iManufacturer, // lookup_libusb_string_wide(dh, desc->iManufacturer) ); } rpt_vstring(d1, "%-20s %d %s", "iManufacturer:", desc->iManufacturer, mfg_name); // rpt_vstring(d1, "%-20s %u %S", "iManufacturer:", desc->iManufacturer, mfg_name_w); // Index of string descriptor describing product: uint8_t iProduct; // rpt_int("iProduct", "product string descriptor index", desc->iProduct, d1); char * product_name = ""; if (dh && desc->iProduct) product_name = lookup_libusb_string(dh, desc->iProduct); rpt_vstring(d1, "%-20s %u %s", "iProduct:", desc->iProduct, product_name); //Index of string descriptor containing device serial number: uint8_t iSerialNumber; // rpt_int("iSerialNumber", "index of string desc for serial num", desc->iProduct, d1); char * sn_name = ""; if (dh && desc->iSerialNumber) sn_name = lookup_libusb_string(dh, desc->iSerialNumber); rpt_vstring(d1, "%-20s %u %s", "iSerialNumber:", desc->iSerialNumber, sn_name); // Number of possible configurations: uint8_t bNumConfigurations; rpt_vstring(d1, "%-20s %u (number of possible configurations)", "bNumConfigurations:", desc->bNumConfigurations); } char * format_port_number_path(unsigned char path[], int portct, char * buf, int bufsz) { *buf = 0; int ndx; for (ndx=0; ndx < portct; ndx++) { char *end = buf + strlen(buf); // printf("end=%p\n", end); if (ndx == 0) sprintf(end, "%u", path[ndx]); else sprintf(end, ".%u", path[ndx]); } return buf; } bool is_hub_descriptor(const struct libusb_device_descriptor * desc) { return (desc->bDeviceClass == 9); } #ifdef IN_PROGRESS void report_open_dev( libusb_device * dev, libusb_device_handle * dh, // must not be null bool show_hubs, int depth) { bool debug = false; if (debug) printf("(%s) Starting. dev=%p, dh=%p, show_hubs=%s\n", __func__, dev, dh, bool_repr(show_hubs)); assert(dev); assert(dh); int d1 = depth+1; int rc; } #endif /* Reports a single libusb device. * */ void report_libusb_device( libusb_device * dev, bool show_hubs, int depth) { bool debug = false; if (debug) printf("(%s) Starting. dev=%p, show_hubs=%s\n", __func__, dev, bool_repr(show_hubs)); int d1 = depth+1; int rc; rpt_structure_loc("libusb_device", dev, depth); uint8_t busno = libusb_get_bus_number(dev); uint8_t devno = libusb_get_device_address(dev); rpt_vstring(d1, "%-20s: %d (0x%04x)", "Bus number", busno, busno); rpt_vstring(d1, "%-20s: %d (0x%04x)", "Device address", devno, devno); uint8_t portno = libusb_get_port_number(dev); rpt_vstring(d1, "%-20s: %u (%s)", "Port number", portno, "libusb_get_port_number(), number of the port this device is connected to"); /* uint8_t */ unsigned char path[8]; int portct = libusb_get_port_numbers(dev, path, sizeof(path)); char buf[100]; format_port_number_path(path, portct, buf, 100); rpt_vstring(d1, "%-20s: %s (list of all port numbers from root)", "Port numbers", buf); struct libusb_device_descriptor desc; // copies data into struct pointed to by desc, does not allocate: rc = libusb_get_device_descriptor(dev, &desc); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor", rc); goto bye; } if ( !show_hubs && is_hub_descriptor(&desc)) { rpt_title("Is hub device, skipping detail", d1); } else { struct libusb_device_handle * dh = NULL; int rc = libusb_open(dev, &dh); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_open", rc); dh = NULL; // belt and suspenders goto bye; } else { if (debug) printf("(%s) Successfully opened\n", __func__); int has_detach_kernel_capability = libusb_has_capability(LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER); if (debug) printf("(%s) %s kernel detach driver capability\n", __func__, (has_detach_kernel_capability) ? "Has" : "Does not have"); if (has_detach_kernel_capability) { rc = libusb_set_auto_detach_kernel_driver(dh, 1); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_set_auto_detach_kernel_driver", rc); libusb_close(dh); goto bye; } } } #ifdef TEMPORARY_TEST if (dh) { // printf("String 0:\n"); // printf("%s\n", lookup_libusb_string(dh, 0)); // INVALID_PARM printf("String 1:\n"); printf("%s\n", lookup_libusb_string(dh, 1)); } #endif report_libusb_device_descriptor(&desc, dh, d1); struct libusb_config_descriptor *config; libusb_get_config_descriptor(dev, 0 /* config_index */, &config); // returns a pointer report_libusb_config_descriptor(config, dh, d1); libusb_free_config_descriptor(config); libusb_close(dh); } bye: printf("\n"); if (debug) printf("(%s) Done\n", __func__); } // Report a list of libusb_devices void report_libusb_devices(libusb_device **devs, bool show_hubs, int depth) { libusb_device *dev; int i = 0; while ((dev = devs[i++]) != NULL) { puts(""); report_libusb_device(dev, show_hubs, depth); } } #ifdef REF typedef struct hid_class_descriptor { uint8_t bDescriptorType; uint16_t wDescriptorLength; } HID_Class_Descriptor; typedef struct hid_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdHID; uint8_t bCountryCode; uint8_t bNumDescriptors; // number of class descriptors, always at least 1, i.e. Report descriptor uint8_t bDescriptorType; // start of first class descriptor uint16_t wDescriptorLength; } HID_Descriptor; #endif static void report_retrieved_report_descriptor_and_probe( libusb_device_handle* dh, Byte * dbuf, int dbufct, int depth) { int d1 = depth+1; int d2 = depth+2; // int d3 = depth+3; Byte buf[1024] = {0}; int bytes_read = 0; rpt_vstring(depth, "Displaying report descriptor in HID external form:"); Hid_Report_Descriptor_Item* item_list = tokenize_hid_report_descriptor(dbuf, dbufct); report_hid_report_item_list(item_list, d1); puts(""); Parsed_Hid_Descriptor* phd = parse_hid_report_desc_from_item_list(item_list); if (phd) { rpt_vstring(depth, "Parsed report descriptor:"); report_parsed_hid_descriptor(phd, d1); puts(""); rpt_vstring(d1, "Finding HID report for EDID..."); Parsed_Hid_Report* edid_report_desc = find_edid_report_descriptor(phd); if (!edid_report_desc) { rpt_vstring(d2, "Not found"); } else { // get EDID report report_parsed_hid_report(edid_report_desc, d1); rpt_vstring(d1, "Get report data for EDID"); uint16_t rptlen = 258; bytes_read = 0; uint16_t report_id = edid_report_desc->report_id; bool ok = get_raw_report( dh, 0, // interface number TODO report_id, rptlen, buf, 1024, &bytes_read); if (!ok) printf("(%s) Error reading report\n", __func__); else { rpt_vstring(d2, "Read %d bytes for report %d 0x%02x for EDID", bytes_read, report_id, report_id); rpt_hex_dump(buf, bytes_read, d2); } } // VCP Codes puts(""); rpt_vstring(d1, "Finding HID feature reports for VCP features..."); GPtrArray* vcp_code_report_descriptors = get_vcp_code_reports(phd); if (vcp_code_report_descriptors && vcp_code_report_descriptors->len > 0) { for (int ndx = 0; ndx < vcp_code_report_descriptors->len; ndx++) { Vcp_Code_Report* vcr = g_ptr_array_index(vcp_code_report_descriptors, ndx); // puts(""); summarize_vcp_code_report(vcr, d2); rpt_vstring(d2, "Get report data for VCP feature 0x%02x", vcr->vcp_code); uint16_t rptlen = 3; bytes_read = 0; uint16_t report_id = vcr->rpt->report_id; bool ok = get_raw_report( dh, 0, // interface number TODO report_id, rptlen, buf, 1024, &bytes_read); if (!ok) printf("(%s) Error reading report\n", __func__); else { rpt_vstring(d2, "Read %d bytes for report %d 0x%02x for vcp feature 0x%02x", bytes_read, report_id, report_id, vcr->vcp_code); rpt_hex_dump(buf, bytes_read, d2); } puts(""); } } else { rpt_vstring(d2, "Not found"); puts(""); } free_parsed_hid_descriptor(phd); } free_hid_report_item_list(item_list); } /* Reports a HID_Descriptor * * Arguments: * dh libusb device handle * bInterfaceNumber interface number * desc pointer to HID_Descriptor to report * depth logical indentation depth * * Returns: * nothing */ void report_hid_descriptor( libusb_device_handle * dh, uint8_t bInterfaceNumber, HID_Descriptor * desc, int depth) { bool debug = false; if (debug) printf("(%s) Starting. dh=%p, bInterfaceNumber=%d, desc=%p\n", __func__, dh, bInterfaceNumber, desc); int d1 = depth+1; rpt_structure_loc("HID_Descriptor", desc, depth); rpt_vstring(d1, "%-20s %u", "bLength", desc->bLength); rpt_vstring(d1, "%-20s %u %s", "bDescriptorType", desc->bDescriptorType, descriptor_title(desc->bDescriptorType)); rpt_vstring(d1, "%-20s %2x.%02x (0x%04x)", "bcdHID", desc->bcdHID>>8, desc->bcdHID & 0x0f, desc->bcdHID); rpt_vstring(d1, "%-20s %u", "bCountryCode", desc->bCountryCode); rpt_vstring(d1, "%-20s %u", "bNumDescriptors", desc->bNumDescriptors); rpt_vstring(d1, "first bDescriptorType is at %p", &desc->bClassDescriptorType); int ndx = 0; for (;ndx < desc->bNumDescriptors; ndx++) { assert(sizeof(HID_Class_Descriptor) == 3); int offset = ndx * sizeof(HID_Class_Descriptor); HID_Class_Descriptor * cur = (HID_Class_Descriptor *) (&desc->bClassDescriptorType + offset); rpt_vstring(d1, "cur = %p", cur); rpt_vstring(d1, "%-20s %u %s", "bDescriptorType", cur->bDescriptorType, descriptor_title(cur->bDescriptorType)); uint16_t descriptor_len = cur->wDescriptorLength; // assumes we're on little endian system // uint16_t rpt_len = buf[7+3*i] | (buf[8+3*i] << rpt_vstring(d1, "%-20s %u", "wDescriptorLength", descriptor_len); switch(cur->bDescriptorType) { case LIBUSB_DT_REPORT: { rpt_vstring(d1, "Reading report descriptor of type LIBUSB_DT_REPORT from device..."); Byte dbuf[HID_MAX_DESCRIPTOR_SIZE]; if (dh == NULL) { printf("(%s) device handle is NULL, Cannot get report descriptor\n", __func__); } else { int bytes_read = 0; bool ok = get_raw_report_descriptor( dh, bInterfaceNumber, descriptor_len, // report length dbuf, sizeof(dbuf), &bytes_read); if (!ok) printf("(%s) get_raw_report_descriptor() returned %s\n", __func__, bool_repr(ok)); if (ok) { puts(""); rpt_hex_dump(dbuf, bytes_read, d1); puts(""); report_retrieved_report_descriptor_and_probe(dh, dbuf, bytes_read, d1); } } break; } case LIBUSB_DT_STRING: printf("(%s) Unimplemented: String report descriptor\n", __func__); break; default: printf("(%s) Descriptor. Type= 0x%02x\n", __func__, cur->bDescriptorType); break; } } if (debug) printf("(%s) Done.\n", __func__); } // // Module initialization // void init_libusb_reports() { devid_ensure_initialized(); } ddcutil-0.8.6/src/usb_util/libusb_util.c0000644000175000001440000005600513227064172015202 00000000000000/* libusb_util.c * * libusb is currently used only within query_sysenv.c * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include "util/device_id_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "usb_util/hid_report_descriptor.h" #include "usb_util/libusb_reports.h" #include "usb_util/usb_hid_common.h" #include "usb_util/libusb_util.h" // Note on function naming: // Since libusb.h uses "libusb_" as a prefix to function and struct names, it // would be confusing for this file to use the same convention. // // Utility functions // // copied and modified from make_path() in libusb/hid.c in hidapi char *make_path(int bus_number, int device_address, int interface_number) { char str[64]; snprintf(str, sizeof(str), "%04x:%04x:%02x", bus_number, device_address, interface_number); str[sizeof(str)-1] = '\0'; return strdup(str); } char *make_path_from_libusb_device(libusb_device *dev, int interface_number) { return make_path(libusb_get_bus_number(dev), libusb_get_device_address(dev), interface_number); } // // Possible_Monitor_Device reporting and lifecycle // struct possible_monitor_device * new_possible_monitor_device() { struct possible_monitor_device * cur = calloc(1, sizeof(struct possible_monitor_device)); return cur; } #ifdef UNTESTED void free_possible_monitor_device(struct possible_monitor_device * mondev) { if (mondev) { if (mondev->manufacturer_name) free(mondev->manufacturer_name); if (mondev->product_name) free(mondev->product_name); if (mondev->serial_number) free(mondev->serial_number); // n. do not free libusb_device // if (mondev->libusb_device) // libusb_unref_device(mondev->libusb_device); // ??? free(mondev); } } void free_possible_monitor_device_list(struct possible_monitor_device * head) { struct possible_monitor_device * cur = head; while (cur) { struct possible_monitor_device * next = cur->next; free_possible_monitor_device(cur); cur = next; } } #endif void report_possible_monitor_device(struct possible_monitor_device * mondev, int depth) { int d1 = depth+1; rpt_structure_loc("possible_monitor_device", mondev, depth); rpt_vstring(d1, "%-20s %p", "libusb_device", mondev->libusb_device); rpt_vstring(d1, "%-20s %d", "bus", mondev->bus); rpt_vstring(d1, "%-20s %d", "device_address", mondev->device_address); rpt_vstring(d1, "%-20s 0x%04x", "vid", mondev->vid); rpt_vstring(d1, "%-20s 0x%04x", "pid", mondev->pid); rpt_vstring(d1, "%-20s %d", "interface", mondev->interface); rpt_vstring(d1, "%-20s %d", "alt_setting", mondev->alt_setting); rpt_vstring(d1, "%-20s %s", "manufacturer_name", mondev->manufacturer_name); rpt_vstring(d1, "%-20s %s", "product_name", mondev->product_name); rpt_vstring(d1, "%-20s %s", "serial_number_ascii", mondev->serial_number); // rpt_vstring(d1, "%-20s %S", "serial_number_wide", mondev->serial_number_wide); rpt_vstring(d1, "%-20s %p", "next_sibling", mondev->next); } void report_possible_monitors(struct possible_monitor_device * mondev_head, int depth) { rpt_title("Possible monitor devices:", depth); if (!mondev_head) { rpt_title("None", depth+1); } else { struct possible_monitor_device * cur = mondev_head; while(cur) { report_possible_monitor_device(cur, depth+1); cur = cur->next; } } } typedef struct descriptor_path { unsigned short busno; unsigned short devno; struct libusb_device_descriptor * desc; struct libusb_device * dev; struct libusb_config_descriptor * config; struct libusb_interface * interface; struct libusb_interface_descriptor * inter; } Descriptor_Path; void report_descriptor_path(Descriptor_Path * pdpath, int depth) { int d1 = depth+1; rpt_structure_loc("Descriptor_Path", pdpath, depth); rpt_vstring(d1, "%-20s %d", "busno:", pdpath->busno); rpt_vstring(d1, "%-20s %d", "devno:", pdpath->devno); rpt_vstring(d1, "%-20s %p", "desc:", pdpath->desc); rpt_vstring(d1, "%-20s %p", "dev:", pdpath->dev); rpt_vstring(d1, "%-20s %p", "config:", pdpath->config); rpt_vstring(d1, "%-20s %p", "interface:", pdpath->interface); rpt_vstring(d1, "%-20s %p", "inter:", pdpath->inter); } // // Identify HID interfaces that that are not keyboard or mouse // /* Tests if the specified libusb_interface_descriptor possibly represents a * USB connected monitor. * * Arguments: * config pointer to instance to test * dpath structure path to this instance, used for messages * * Returns: true/false */ static bool possible_monitor_interface_descriptor( const struct libusb_interface_descriptor * inter, Descriptor_Path dpath) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" dpath.inter = inter; #pragma GCC diagnostic pop bool result = false; if (inter->bInterfaceClass == LIBUSB_CLASS_HID) { if (debug) { rpt_vstring(0, "bInterfaceClass: 0x%02x (%d)", inter->bInterfaceClass, inter->bInterfaceClass); rpt_vstring(0, "bInterfaceSubClass: 0x%02x (%d)", inter->bInterfaceSubClass, inter->bInterfaceSubClass); rpt_int("bInterfaceProtocol", NULL, inter->bInterfaceProtocol, 0); } if (inter->bInterfaceProtocol != 1 && inter->bInterfaceProtocol != 2) result = true; } if (debug) printf("(%s) Returning %s\n", __func__, bool_repr(result)); return result; } /* Tests if the specified libusb_interface possibly represents a * USB connected monitor. * * Arguments: * config pointer to instance to test * dpath structure path to this instance, used for messages * * Returns: true/false */ static bool possible_monitor_interface( const struct libusb_interface * interface, Descriptor_Path dpath) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); // apparently doesn't work on older versions of GCC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" dpath.interface = interface; #pragma GCC diagnostic pop bool result = false; int ndx; for (ndx=0; ndxnum_altsetting; ndx++) { const struct libusb_interface_descriptor * idesc = &interface->altsetting[ndx]; // report_interface_descriptor(idesc, d1); result |= possible_monitor_interface_descriptor(idesc, dpath); } if (debug) printf("(%s) Returning: %s\n", __func__, bool_repr(result)); return result; } /* Tests if the specified libusb_config_descriptor possibly represents a * USB connected monitor. * * Arguments: * config pointer to instance to test * dpath structure path to this instance, used for messages * * Returns: true/false */ static bool possible_monitor_config_descriptor( const struct libusb_config_descriptor * config, Descriptor_Path dpath) { bool result = false; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" dpath.config = config; #pragma GCC diagnostic pop int ndx = 0; if (config->bNumInterfaces > 1) { // report_descriptor_path(&dpath, 0); uint16_t vid = dpath.desc->idVendor; uint16_t pid = dpath.desc->idProduct; Pci_Usb_Id_Names names; names = devid_get_usb_names( vid, pid, 0, 2); printf("(%s) Examining only interface 0 for device %d:%d, vid=0x%04x, pid=0x%04x %s %s\n", __func__, dpath.busno, dpath.devno, vid, pid, names.vendor_name, names.device_name); } // HACK: look at only interface 0 // for (ndx=0; ndxbNumInterfaces; ndx++) { const struct libusb_interface *inter = &(config->interface[ndx]); result |= possible_monitor_interface(inter, dpath); // } // if (result) // printf("(%s) Returning: %d\n", __func__, result); return result; } /* Tests if the specified libusb_device instance possibly represents a * USB connected monitor. * * Arguments: * config pointer to instance to test * dpath structure path to this instance, used for messages * * Returns: true/false */ bool possible_monitor_dev(libusb_device * dev, bool check_forced_monitor, Descriptor_Path dpath) { bool debug = false; if (debug) printf("(%s) Starting. dev=%p\n", __func__, dev); bool result = false; struct libusb_config_descriptor *config; libusb_get_config_descriptor(dev, 0, &config); struct libusb_device_descriptor desc; // copies data into struct pointed to by desc, does not allocate: int rc = libusb_get_device_descriptor(dev, &desc); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor", rc); goto bye; } dpath.desc = &desc; dpath.dev = dev; result = possible_monitor_config_descriptor(config, dpath); libusb_free_config_descriptor(config); if (!result && check_forced_monitor) { struct libusb_device_descriptor desc; int rc = libusb_get_device_descriptor(dev, &desc); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_device_descriptor", rc); goto bye; } // ushort vid = desc.idVendor; // ushort pid = desc.idProduct; if (debug) printf("(%s) Callling force_hid_monitor_by_vid_pid(0x%04x, 0x%04x)\n", __func__, desc.idVendor, desc.idProduct ); result = force_hid_monitor_by_vid_pid(desc.idVendor, desc.idProduct); } bye: if (debug) printf("(%s) Returning: %s\n" , __func__, bool_repr(result)); return result; } // *** NOT CURRENTLY USED *** // check_forced_monitor not implemented // apparently can get by without collected information in struct possible_monitor_device struct possible_monitor_device * alt_possible_monitor_dev( libusb_device * dev, bool check_forced_monitor) // NOT CURRENTLY USED! { bool debug = false; if (debug) printf("(%s) Starting. dev=%p, check_forced_monitor=%s\n", __func__, dev, bool_repr(check_forced_monitor)); struct possible_monitor_device * new_node = NULL; // report_dev(dev, NULL, false /* show hubs */, 0); int bus = libusb_get_bus_number(dev); int device_address = libusb_get_device_address(dev); ushort vid = 0; ushort pid = 0; struct libusb_device_descriptor desc; int rc = libusb_get_device_descriptor(dev, &desc); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_device_descriptor", rc); goto bye; } vid = desc.idVendor; pid = desc.idProduct; struct libusb_config_descriptor * config; rc = libusb_get_config_descriptor(dev, 0, &config); // returns a pointer if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_config_descriptor", rc); goto bye; } // Logitech receiver has subclass 0 on interface 2, // try ignoring all interfaces other than 0 int inter_no = 0; // for (inter_no=0; inter_nobNumInterfaces; inter_no++) { { const struct libusb_interface *inter = &(config->interface[inter_no]); int altset_no; for (altset_no=0; altset_nonum_altsetting; altset_no++) { const struct libusb_interface_descriptor * idesc = &inter->altsetting[altset_no]; if (idesc->bInterfaceClass == LIBUSB_CLASS_HID) { rpt_vstring(0, "bInterfaceClass: 0x%02x (%d)", idesc->bInterfaceClass, idesc->bInterfaceClass); rpt_vstring(0, "bInterfaceSubClass: 0x%02x (%d)", idesc->bInterfaceSubClass, idesc->bInterfaceSubClass); rpt_int("bInterfaceProtocol", NULL, idesc->bInterfaceProtocol, 0); if (idesc->bInterfaceProtocol != 1 && idesc->bInterfaceProtocol != 2) { // TO ADDRESS: WHAT IF MULTIPLE altsettings? what if they conflict? libusb_ref_device(dev); // if (debug) // report_dev(dev, NULL, false, 0); struct libusb_device_handle * dh = NULL; rc = libusb_open(dev, &dh); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_open", rc); dh = NULL; // belt and suspenders } else { printf("(%s) Successfully opened\n", __func__); rc = libusb_set_auto_detach_kernel_driver(dh, 1); if (rc < 0) REPORT_LIBUSB_ERROR_NOEXIT("libusb_set_auto_detach_kernel_driver", rc); if (new_node) { printf("(%s) Found additional possible monitor device on altset_no %d. Ignoring.\n", __func__, altset_no); } else { new_node = new_possible_monitor_device(); new_node->libusb_device = dev; new_node->bus = bus; new_node->device_address = device_address; new_node->alt_setting = altset_no; new_node->interface = inter_no; new_node->vid = vid; new_node->pid = pid; if (debug) { printf("Manufacturer: %d - %s\n", desc.iManufacturer, lookup_libusb_string(dh, desc.iManufacturer) ); printf("Product: %d - %s\n", desc.iProduct, lookup_libusb_string(dh, desc.iProduct) ); printf("Serial number: %d - %s\n", desc.iSerialNumber, lookup_libusb_string(dh, desc.iSerialNumber) ); } new_node->manufacturer_name = strdup(lookup_libusb_string(dh, desc.iManufacturer)); new_node->product_name = strdup(lookup_libusb_string(dh, desc.iProduct)); new_node->serial_number = strdup(lookup_libusb_string(dh, desc.iSerialNumber)); // new_node->serial_number_wide = wcsdup(lookup_libusb_string_wide(dh, desc.iSerialNumber)); // printf("(%s) serial_number_wide = |%S|\n", __func__, new_node->serial_number_wide); // report_device_descriptor(&desc, NULL, d1); // report_open_libusb_device(dh, 1); } libusb_close(dh); } } } } } libusb_free_config_descriptor(config); bye: if (debug) printf("(%s) Returning %p\n", __func__, new_node); return new_node; } /** Examines a null terminated list of pointers to struct libusb_device * * Returns a linked list of struct possible_monitor_device that represents * possible monitors */ // *** NOT CURRENTLY USED *** struct possible_monitor_device * get_possible_monitors( libusb_device **devs // null terminated list ) { bool debug = false; if (debug) printf("(%s) Starting\n", __func__); Possible_Monitor_Device * last_device = new_possible_monitor_device(); Possible_Monitor_Device * head_device = last_device; libusb_device *dev; int i = 0; while ((dev = devs[i++]) != NULL) { Possible_Monitor_Device * possible_monitor = alt_possible_monitor_dev(dev, /* check_forced_monitor= */ true); if (possible_monitor) { last_device->next = possible_monitor; last_device = possible_monitor; } } struct possible_monitor_device * true_head; true_head = head_device->next; free(head_device); if (debug) printf("(%s) Returning: %p\n", __func__, true_head); return true_head; } /* Filters a null terminated list of pointers to struct libusb_device to * those representing possible USB connected monitors. * * Arguments: * devs null terminated list * * Returns: filtered list (newly allocated) * * It is the responsibility of the caller to free the returned list. */ libusb_device ** filter_possible_monitor_devs( libusb_device **devs) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); libusb_device *dev; int devct = 0; while ( devs[devct++] ) {} libusb_device ** result = calloc(devct+1, sizeof(libusb_device *)); int foundndx = 0; int i = 0; while ((dev = devs[i++]) != NULL) { unsigned short busno = libusb_get_bus_number(dev); unsigned short devno = libusb_get_device_address(dev); Descriptor_Path dpath; memset(&dpath, 0, sizeof(Descriptor_Path)); dpath.busno = busno; dpath.devno = devno; struct libusb_device_descriptor desc; // copies data into struct pointed to by desc, does not allocate: int rc = libusb_get_device_descriptor(dev, &desc); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor", rc); break; } dpath.desc = &desc; if (debug) printf("(%s) Examining device. bus=0x%04x, device=0x%04x\n", __func__, busno, devno); bool possible = possible_monitor_dev(dev, /*check_forced_monitor=*/ true, dpath); if (possible) { uint16_t vid = dpath.desc->idVendor; uint16_t pid = dpath.desc->idProduct; Pci_Usb_Id_Names names; names = devid_get_usb_names( vid, pid, 0, 2); printf("Found potential HID device %d:%d, vid=0x%04x, pid=0x%04x %s %s\n", dpath.busno, dpath.devno, vid, pid, names.vendor_name, (names.device_name) ? names.device_name : "(unrecognized pid)"); result[foundndx++] = dev; } } if (debug) printf("(%s) Returing: %p\n", __func__, result); return result; } /* Probe USB HID devices using libusb facilities. * * Arguments: * possible_monitors_only if true, only show detail for possible monitors * depth logical indentation depth * * Returns: nothing */ void probe_libusb(bool possible_monitors_only, int depth) { bool debug = false; if (debug) printf("(%s) Starting\n", __func__); bool ok = devid_ensure_initialized(); if (!ok) { printf("(%s) devid_ensure_initialized() failed. Terminating probe_libusb()\n", __func__); return; } libusb_device ** devs; int rc; ssize_t cnt; // number of devices in list rc = libusb_init(NULL); // initialize a library session, use default context if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_init", rc); goto bye; } libusb_set_debug(NULL /*default context*/, LIBUSB_LOG_LEVEL_INFO); cnt = libusb_get_device_list(NULL /* default context */, &devs); if (cnt < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_list", (int) cnt); } else { libusb_device ** devs_to_show = devs; libusb_device ** filtered_devs_to_show = NULL; if (possible_monitors_only) { devs_to_show = filter_possible_monitor_devs(devs); filtered_devs_to_show = devs_to_show; // note newly allocated memory } report_libusb_devices(devs_to_show, false, // show_hubs depth); if (filtered_devs_to_show) free(filtered_devs_to_show); libusb_free_device_list(devs, 1 /* unref the devices in the list */); } libusb_exit(NULL); bye: if (debug) printf("(%s) Done\n", __func__); } bool libusb_is_monitor_by_path(ushort busno, ushort devno, ushort intfno) { bool debug = false; printf("(%s) Starting. busno=%d 0x%04x, devno=%d 0x%04x, intfno=%d 0x%02x\n", __func__, busno, busno, devno, devno, intfno, intfno); bool result = false; if (intfno == 0) { // monitors never have more than 1 interface bool ok = devid_ensure_initialized(); if (!ok) { printf("(%s) devid_ensure_initialized() failed. Terminating probe_libusb()\n", __func__); goto bye; } libusb_device **devs; int rc; ssize_t cnt; // number of devices in list rc = libusb_init(NULL); // initialize a library session, use default context if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_init", rc); goto bye; } libusb_set_debug(NULL /*default context*/, LIBUSB_LOG_LEVEL_INFO); cnt = libusb_get_device_list(NULL /* default context */, &devs); if (cnt < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_list", (int) cnt); } else { libusb_device *dev; int i = 0; while ((dev = devs[i++]) != NULL) { // unsigned short busno = libusb_get_bus_number(dev); // unsigned short devno = libusb_get_device_address(dev); if (busno == libusb_get_bus_number(dev) && devno == libusb_get_device_address(dev)) { printf ("(%s) Found busno=%d, devno=%d\n", __func__, busno, devno); Descriptor_Path dpath; memset(&dpath, 0, sizeof(Descriptor_Path)); dpath.busno = busno; dpath.devno = devno; struct libusb_device_descriptor desc; // copies data into struct pointed to by desc, does not allocate: int rc = libusb_get_device_descriptor(dev, &desc); if (rc < 0) { REPORT_LIBUSB_ERROR_NOEXIT("libusb_get_device_descriptor", rc); break; } dpath.desc = &desc; if (debug) printf("(%s) Examining device. bus=0x%04x, device=0x%04x\n", __func__, busno, devno); result = possible_monitor_dev(dev, /*check_forced_monitor=*/ true, dpath); break; } } libusb_free_device_list(devs, 1 /* unref the devices in the list */); } libusb_exit(NULL); } bye: if (debug) printf("(%s) Done. Returning %s\n", __func__, bool_repr(result)); return result; } ddcutil-0.8.6/src/usb_util/base_hid_report_descriptor.c0000644000175000001440000003341313230445447020254 00000000000000/* base_hid_report_descriptor.c * * Functions to perform basic parsing of the HID Report Descriptor and * display the contents of the Report Descriptor in the format used * in HID documentation. * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include "util/device_id_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "usb_util/usb_hid_common.h" #include "usb_util/base_hid_report_descriptor.h" typedef struct ptr_pair{ void * p1; void * p2; } Ptr_Pair; Ptr_Pair item_flag_names_r(uint16_t flags, char * b1, int b1_size, char * b2, int b2_size) { assert(b1_size >= 80); assert(b2_size >= 80); snprintf(b1, b1_size, "%s %s %s %s %s", flags & 0x01 ? "Constant" : "Data", flags & 0x02 ? "Variable" : "Array", flags & 0x04 ? "Relative" : "Absolute", flags & 0x08 ? "Wrap" : "No_Wrap", flags & 0x10 ? "Non_Linear" : "Linear" ); snprintf(b2, b2_size, "%s %s %s %s", flags & 0x20 ? "No_Preferred_State" : "Preferred_State", flags & 0x40 ? "Null_State" : "No_Null_Position", flags & 0x80 ? "Volatile" : "Non_Volatile", flags & 0x100 ? "Buffered Bytes" : "Bitfield" ); Ptr_Pair result = {b1,b2}; return result; } Ptr_Pair item_flag_names(uint16_t flags) { static char b1[80]; static char b2[80]; return item_flag_names_r(flags, b1, 80, b2, 80); } #ifdef OLD static void dump_unit(unsigned int data, unsigned int len) { char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" }; char *units[5][8] = { { "None", "None", "None", "None", "None", "None", "None", "None" }, { "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, { "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, { "None", "Inch", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }, { "None", "Degrees", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }, }; unsigned int i; unsigned int sys; int earlier_unit = 0; /* First nibble tells us which system we're in. */ sys = data & 0xf; data >>= 4; if (sys > 4) { if (sys == 0xf) printf("System: Vendor defined, Unit: (unknown)\n"); else printf("System: Reserved, Unit: (unknown)\n"); return; } else { printf("System: %s, Unit: ", systems[sys]); } for (i = 1 ; i < len * 2 ; i++) { char nibble = data & 0xf; data >>= 4; if (nibble != 0) { if (earlier_unit++ > 0) printf("*"); printf("%s", units[sys][i]); if (nibble != 1) { /* This is a _signed_ nibble(!) */ int val = nibble & 0x7; if (nibble & 0x08) val = -((0x7 & ~val) + 1); printf("^%d", val); } } } if (earlier_unit == 0) printf("(None)"); printf("\n"); } #endif static char * unit_name_r(unsigned int data, unsigned int len, char * buf, int bufsz) { assert(bufsz >= 80); char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" }; char *units[5][8] = { { "None", "None", "None", "None", "None", "None", "None", "None" }, { "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, { "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" }, { "None", "Inch", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }, { "None", "Degrees", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }, }; unsigned int i; unsigned int sys; int earlier_unit = 0; /* First nibble tells us which system we're in. */ sys = data & 0xf; data >>= 4; if (sys > 4) { if (sys == 0xf) strcpy(buf, "System: Vendor defined, Unit: (unknown)"); else strcpy(buf, "System: Reserved, Unit: (unknown)"); } else { sprintf(buf, "System: %s, Unit: ", systems[sys]); for (i = 1 ; i < len * 2 ; i++) { char nibble = data & 0xf; data >>= 4; if (nibble != 0) { if (earlier_unit++ > 0) strcat(buf, "*"); sprintf(buf+strlen(buf), "%s", units[sys][i]); if (nibble != 1) { /* This is a _signed_ nibble(!) */ int val = nibble & 0x7; if (nibble & 0x08) val = -((0x7 & ~val) + 1); sprintf(buf+strlen(buf), "^%d", val); } } } } if (earlier_unit == 0) strcat(buf, "(None)"); return buf; } static char * unit_name(unsigned int data, unsigned int len) { static char buf[80]; return unit_name_r(data, len, buf, 80); } /** Debugging function. */ void report_raw_hid_report_item(Hid_Report_Descriptor_Item * item, int depth) { int d1 = depth+1; rpt_structure_loc("Hid_Report_Item", item, depth); rpt_vstring(d1, "%-20s: 0x%02x", "btype", item->btype); rpt_vstring(d1, "%-20s: 0x%02x", "btag", item->btag); // rpt_vstring(d1, "%-20s: %d", "bsize", item->bsize); // rpt_vstring(d1, "%-20s: %d", "bsize_orig", item->bsize_orig); rpt_vstring(d1, "%-20s: %d", "bsize_bytect", item->bsize_bytect); rpt_vstring(d1, "%-20s: 0x%08x", "data", item->data); } void free_hid_report_item_list(Hid_Report_Descriptor_Item * head) { while (head) { Hid_Report_Descriptor_Item * next = head->next; free(head); head = next; } } /* Converts the bytes of a HID Report Descriptor to a linked list of * Hid_Report_Items. * * Arguments: * b address of bytes * l number of bytes * * Returns: linked list of Hid_Report_Items */ // need better name Hid_Report_Descriptor_Item * tokenize_hid_report_descriptor(Byte * b, int l) { bool debug = false; if (debug) printf("(%s) Starting. b=%p, l=%d\n", __func__, b, l); Hid_Report_Descriptor_Item * root = NULL; Hid_Report_Descriptor_Item * prev = NULL; Hid_Report_Descriptor_Item * cur = NULL; int i, j; // if (debug) // printf("(%s) Report Descriptor: (length is %d)\n", __func__, l); for (i = 0; i < l; ) { cur = calloc(1, sizeof(Hid_Report_Descriptor_Item)); Byte b0 = b[i] & 0x03; // first 2 bits are size indicator, 0, 1, 2, or 3 cur->bsize_bytect = (b0 == 3) ? 4 : b0; // actual number of bytes cur->btype = (b[i] & (0x03 << 2))>>2; // next 2 bits are type, shift to range 0..3 cur->btag = b[i] & ~0x03; // mask out size bits to get tag memcpy(cur->raw_bytes, b+i, 1+cur->bsize_bytect); // WRONG: printf("(%s) raw_bytes: 0x%0*x\n", __func__, (1+cur->bsize_bytect)*2, cur->raw_bytes); if (cur->bsize_bytect > 0) { cur->data = 0; for (j = 0; j < cur->bsize_bytect; j++) { cur->data += (b[i+1+j] << (8*j)); } } // alt: int kk = i+1; switch(cur->bsize_bytect) { case 4: cur->data_alt.u32 = b[kk+3]<< 24 | b[kk+2] << 16 | b[kk+1] << 8 | b[kk]; assert (cur->data_alt.u32 == cur->data); break; case 2: cur->data_alt.u16 = b[kk+1] << 8 | b[kk]; // printf("(%s) data_alt.u16 = 0x%04x, cur->data = 0x%08x\n", // __func__, cur->data_alt.u16, cur->data); assert (cur->data_alt.u16 == cur->data); break; case 1: cur->data_alt.u8 = b[kk]; assert (cur->data_alt.u8 == cur->data); break; default: assert(cur->bsize_bytect == 0); } if (!root) { root = cur; prev = cur; } else { prev->next = cur; prev = cur; } i += 1 + cur->bsize_bytect; } if (debug) printf("(%s) Returning: %p\n", __func__, root); return root; } typedef struct hid_report_item_globals { uint16_t usage_page; struct hid_report_item_globals * prev; } Hid_Report_Item_Globals; /* Reports a single Hid_Report_Item * * Arguments: * item pointer to Hid_Report_Item to report * globals current globals state * depth logical indentation depth */ void report_hid_report_item( Hid_Report_Descriptor_Item * item, Hid_Report_Item_Globals * globals, int depth) { // int d1 = depth+1; int d_indent = depth+5; // TODO: handle push/pop of globals char *types[4] = { "Main", "Global", "Local", "reserved" }; char databuf[80]; if (item->bsize_bytect == 0) strcpy(databuf, "none"); else snprintf(databuf, 80, "0x%0*x", item->bsize_bytect*2, item->data); char rawbuf[16]; rawbuf[0] = '\0'; // possibly switch this on and off char workbuf[9]; // 2 chars/byte + 1 for terminating null hexstring2( item->raw_bytes+1, // bytes to convert item->bsize_bytect, // number of bytes NULL, // no separator string false, // uppercase, workbuf, // buffer in which to return hex string sizeof(workbuf) ); // buffer size snprintf(rawbuf, 16, "%02x %-8s ", item->raw_bytes[0], workbuf); rpt_vstring(depth, "%sItem(%-6s): %s, data=[ %s ]", rawbuf, types[item->btype], devid_hid_descriptor_item_type(item->btag), // replacement for names_reporttag() databuf); switch (item->btag) { case 0x04: /* Usage Page */ #ifdef HACK_FOR_HP_LP2480ZX switch(item->data) { // belongs elsewhere case 0xffa0: printf("Fixup: data = 0xffa0 -> 0x80\n"); item->data = 0x80; break; case 0xffa1: item->data = 0x81; break; } #endif rpt_vstring(d_indent, "%s", devid_usage_code_page_name(item->data)); // names_huts(data)); globals->usage_page = item->data; break; case 0x08: /* Usage */ case 0x18: /* Usage Minimum */ case 0x28: /* Usage Maximum */ { // char * name = names_hutus((hut<<16) + item->data); char * name = devid_usage_code_id_name(globals->usage_page,item->data); if (!name) { name = "Unrecognized usage"; } rpt_vstring(d_indent, "%s", name); } break; case 0x54: /* Unit Exponent */ rpt_vstring(d_indent, "Unit Exponent: %i", (signed char)item->data); break; case 0x64: /* Unit */ rpt_vstring(d_indent, "%s", unit_name(item->data, item->bsize_bytect)); break; case 0xa0: /* Collection */ rpt_vstring(d_indent, "%s", collection_type_name(item->data)); break; case 0x80: /* Input */ case 0x90: /* Output */ case 0xb0: /* Feature */ { // interpret the bits into 2 lines of text Ptr_Pair flag_names = item_flag_names(item->data); rpt_vstring(d_indent, "%s", flag_names.p1); rpt_vstring(d_indent, "%s", flag_names.p2); break; } } } /* Given a Hid Report Descriptor, represented as a linked list of * Hid_Report_Items, display the descriptor in a form similar to that * used in HID documentation, with annotation. * * Arguments: * head first item in list * depth logical indentation depth * * Returns: nothing */ void report_hid_report_item_list(Hid_Report_Descriptor_Item * head, int depth) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); Hid_Report_Item_Globals globals; // will contain current globals as list is walked memset(&globals, 0, sizeof(Hid_Report_Item_Globals)); while (head) { report_hid_report_item(head, &globals, depth); head = head->next; } } /* Indicates if a tokenized HID Report Descriptor, represented as a linked * list of Hid_Report_Descriptor_Items, represents a USB connected monitor. * * Arguments: * report_item_list list head * * Returns: true/false * * Per section 5.5 of Usb Monitor Control Class Specification Rev 1.0: * "In order to identify a HID class device as a monitor, the device's * HID Report Descriptor must contain a top-level collection with a usage * of Monitor Control from the USB Monitor Usage Page." * * i.e. Usage page = 0x80 USB monitor * Usage id = 0x01 Monitor Control */ bool is_monitor_by_tokenized_hid_report_descriptor(Hid_Report_Descriptor_Item * report_item_list) { bool is_monitor = false; Hid_Report_Descriptor_Item * cur_item = report_item_list; // We cheat on the spec. Just look at the first Usage Page item, is it USB Monitor? while (cur_item) { if (cur_item->btag == 0x04) { if (cur_item->data == 0x80) { is_monitor = true; } break; } } return is_monitor; } ddcutil-0.8.6/src/usb_util/hid_report_descriptor.c0000644000175000001440000013017413230445447017264 00000000000000/* hid_report_descriptor.c * * Interpret a HID Report Descriptor * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * * * Report parsing adapted from lsusb.c (command lsusb) by Thomas Sailer and * David Brownell. */ #include #include #include #include #include #include #include #include "util/coredefs.h" #include "util/device_id_util.h" #include "util/report_util.h" #include "usb_util/base_hid_report_descriptor.h" #include "usb_util/usb_hid_common.h" #include "usb_util/hid_report_descriptor.h" // // Lookup tables // static const char* report_type_name_table[] = { "invalid", "Input", "Output", "Feature" }; /* Returns a string representation of a report type id * * Arguments: report_type * * Returns: string representation of id */ const char * hid_report_type_name(Byte report_type) { if (report_type < HID_REPORT_TYPE_MIN || report_type > HID_REPORT_TYPE_MAX) report_type = 0; return report_type_name_table[report_type]; } /* Create a string representation of Main Item flags bitfield. * The representation is returned in a buffer provided, which * must be at least 150 bytes in size. * * Arguments: * data flags * buffer where to save formatted response * bufsz buffer size * * Returns: buffer */ char * interpret_item_flags_r(uint16_t data, char * buffer, int bufsz) { assert(buffer && bufsz > 150); snprintf(buffer, bufsz, "%s %s %s %s %s %s %s %s %s", data & 0x01 ? "Constant" : "Data", data & 0x02 ? "Variable" : "Array", data & 0x04 ? "Relative" : "Absolute", data & 0x08 ? "Wrap" : "No_Wrap", data & 0x10 ? "Non_Linear" : "Linear", data & 0x20 ? "No_Preferred_State" : "Preferred_State", data & 0x40 ? "Null_State" : "No_Null_Position", data & 0x80 ? "Volatile" : "Non_Volatile", data & 0x100 ? "Buffered Bytes" : "Bitfield"); return buffer; } // // Free functions for Parsed_Hid_Descriptor and its contained structs // void free_parsed_hid_field(Parsed_Hid_Field * phf) { if (phf) { if (phf->extended_usages) g_array_free(phf->extended_usages, true); free(phf); } } // wrap free_parsed_hid_field() in signature of GDestroyNotify() void free_parsed_hid_field_func(gpointer data) { free_parsed_hid_field((Parsed_Hid_Field *) data); } void free_parsed_hid_report(Parsed_Hid_Report * phr) { if (phr) { if (phr->hid_fields) { g_ptr_array_set_free_func(phr->hid_fields, free_parsed_hid_field_func); g_ptr_array_free(phr->hid_fields, true); } free(phr); } } // wrap free_parsed_hid_report() in signature of GDestroyNotify() void free_parsed_hid_report_func(gpointer data) { free_parsed_hid_report((Parsed_Hid_Report *) data); } void free_parsed_hid_collection_func(gpointer data); // forward ref void free_parsed_hid_collection(Parsed_Hid_Collection * phc) { if (phc) { if (phc->reports) { g_ptr_array_set_free_func(phc->reports, free_parsed_hid_report_func); g_ptr_array_free(phc->reports, true); } if (phc->child_collections) { g_ptr_array_set_free_func(phc->child_collections, free_parsed_hid_collection_func); g_ptr_array_free(phc->child_collections, true); } free(phc); } } // wrap free_parsed_hid_collection() in signature of GDestroyNotify() void free_parsed_hid_collection_func(gpointer data) { free_parsed_hid_collection((Parsed_Hid_Collection *) data); } void free_parsed_hid_descriptor(Parsed_Hid_Descriptor * phd) { if (phd) { if (phd->root_collection) { free_parsed_hid_collection(phd->root_collection); } free(phd); } } // // Functions to report Parsed_Hid_Descriptor and its contained structs // void report_hid_field(Parsed_Hid_Field * hf, int depth) { int d1 = depth+1; // rpt_structure_loc("Hid_Field", hf, depth); rpt_title("Field: ", depth); char buf[200]; rpt_vstring(d1, "%-20s: 0x%04x %s", "Usage page", hf->usage_page, devid_usage_code_page_name(hf->usage_page)); // deprecated // rpt_vstring(d1, "%-20s: 0x%04x %s", "Usage id", // hf->usage_id, // devid_usage_code_id_name(hf->usage_page, hf->usage_id)); char * ucode_name = ""; #ifdef OLD if (hf->extended_usage) { ucode_name = devid_usage_code_name_by_extended_id(hf->extended_usage); if (!ucode_name) ucode_name = "(Unrecognized usage code)"; } else ucode_name = "WARNING: No usage specified for field"; rpt_vstring(d1, "%-20s: 0x%08x %s", "Extended Usage", hf->extended_usage, ucode_name); #endif if (!hf->extended_usages && !hf->min_extended_usage && !hf->max_extended_usage) { rpt_vstring(d1, "WARNING: No usage specified for field"); } else { if (hf->extended_usages) { for (int ndx = 0; ndx < hf->extended_usages->len; ndx++) { uint32_t extusage = g_array_index(hf->extended_usages, uint32_t, ndx); ucode_name = devid_usage_code_name_by_extended_id(extusage); if (!ucode_name) ucode_name = "(Unrecognized usage code)"; if (ndx == 0) rpt_vstring(d1, "%-20s: 0x%08x %s", "Extended Usage", extusage, ucode_name); else rpt_vstring(d1, "%-20s 0x%08x %s", "", extusage, ucode_name); } } if (hf->min_extended_usage) { ucode_name = devid_usage_code_name_by_extended_id(hf->min_extended_usage); if (!ucode_name) ucode_name = "(Unrecognized usage code)"; rpt_vstring(d1, "%-20s: 0x%08x %s", "Minimum Extended Usage", hf->min_extended_usage, ucode_name); } if (hf->max_extended_usage) { ucode_name = devid_usage_code_name_by_extended_id(hf->max_extended_usage); if (!ucode_name) ucode_name = "(Unrecognized usage code)"; rpt_vstring(d1, "%-20s: 0x%08x %s", "Maximum Extended Usage", hf->max_extended_usage, ucode_name); } if ( ( hf->min_extended_usage && !hf->max_extended_usage) || (!hf->min_extended_usage && hf->max_extended_usage) ) rpt_vstring(d1, "Min and max extended usage must occur together"); } rpt_vstring(d1, "%-20s: 0x%04x %s", "Item flags", hf->item_flags, interpret_item_flags_r(hf->item_flags, buf, 200) ); rpt_vstring(d1, "%-20s: 0x%04x %d", "Logical minimum", hf->logical_minimum, hf->logical_minimum); rpt_vstring(d1, "%-20s: 0x%04x %d", "Logical maximum", hf->logical_maximum, hf->logical_maximum); rpt_vstring(d1, "%-20s: 0x%04x %d", "Physical minimum", hf->physical_minimum, hf->physical_minimum); rpt_vstring(d1, "%-20s: 0x%04x %d", "Physical maximum", hf->physical_maximum, hf->physical_maximum); rpt_vstring(d1, "%-20s: %d", "Report size", hf->report_size); rpt_vstring(d1, "%-20s: %d", "Report count", hf->report_count); rpt_vstring(d1, "%-20s: 0x%04x %d", "Unit_exponent", hf->unit_exponent, hf->unit_exponent); rpt_vstring(d1, "%-20s: 0x%04x %d", "Unit", hf->unit, hf->unit); } /* Report a single report in a parsed HID report descriptor * * Arguments: * pdesc pointer to Hid_Report instance * depth logical indentation depth * * Returns: nothing */ void report_parsed_hid_report(Parsed_Hid_Report * hr, int depth) { int d1 = depth+1; // int d2 = depth+2; // rpt_structure_loc("Hid_Report", hr,depth); rpt_vstring(depth, "%-20s:%*s 0x%02x %d", "Report id", rpt_get_indent(1), "", hr->report_id, hr->report_id); rpt_vstring(d1, "%-20s: 0x%02x %s", "Report type", hr->report_type, hid_report_type_name(hr->report_type) ); if (hr->hid_fields && hr->hid_fields->len > 0) { // rpt_title("Fields: (alt) ", d1); for (int ndx=0; ndxhid_fields->len; ndx++) { report_hid_field( g_ptr_array_index(hr->hid_fields, ndx), d1); } } else rpt_vstring(d1, "%-20s: none", "Fields"); } /* Output a brief summary of a Parsed_Hid_Report indicating its report id and type * * Arguments: * pdesc pointer to Hid_Report instance * depth logical indentation depth * * Returns: nothing */ void summarize_parsed_hid_report(Parsed_Hid_Report * hr, int depth) { // int d1 = depth+1; // rpt_vstring(depth, "%-20s:%*s 0x%02x %d", "Report id", rpt_indent(1), "", hr->report_id, hr->report_id); // rpt_vstring(d1, "%-20s: 0x%02x %s", "Report type", // hr->report_type, hid_report_type_name(hr->report_type) ); rpt_vstring(depth, "report id: 0x%02x (%3d), report type: 0x%02x (%s)", hr->report_id, hr->report_id, hr->report_type, hid_report_type_name(hr->report_type) ); } void report_hid_collection(Parsed_Hid_Collection * col, int depth) { bool show_dummy_root = false; int d1 = depth+1; if (!col->is_root_collection || show_dummy_root) rpt_structure_loc("Hid_Collection", col, depth); if (col->is_root_collection) { if (show_dummy_root) rpt_title("Dummy root collection", d1); } else { rpt_vstring(d1, "%-20s: x%02x %s", "Collection type", col->collection_type, collection_type_name(col->collection_type)); rpt_vstring(d1, "%-20s: x%02x %s", "Usage page", col->usage_page, devid_usage_code_page_name(col->usage_page)); // deprecated: // rpt_vstring(d1, "%-20s: x%02x %s", "Usage id", // col->usage_id, devid_usage_code_id_name(col->usage_page, col->usage_id)); rpt_vstring(d1, "%-20s: 0x%08x %s", "Extended Usage", col->extended_usage, devid_usage_code_name_by_extended_id(col->extended_usage)); } if (col->child_collections && col->child_collections->len > 0) { int child_depth = d1; if (!col->is_root_collection || show_dummy_root) rpt_title("Contained collections: ", d1); else child_depth = depth; for (int ndx = 0; ndx < col->child_collections->len; ndx++) { Parsed_Hid_Collection * a_child = g_ptr_array_index(col->child_collections, ndx); report_hid_collection(a_child, child_depth); } } if (col->reports && col->reports->len > 0) { if (col->is_root_collection) printf("(%s) ERROR: Dummy root collection contains reports\n", __func__); rpt_title("Reports:", d1); for (int ndx = 0; ndx < col->reports->len; ndx++) report_parsed_hid_report(g_ptr_array_index(col->reports, ndx), d1); } else rpt_vstring(d1, "%-20s: None", "Reports"); } /* Report a parsed HID descriptor. * * Arguments: * pdesc pointer to Parsed_Hid_Descriptor * depth logical indentation depth * * Returns: nothing */ void report_parsed_hid_descriptor(Parsed_Hid_Descriptor * pdesc, int depth) { int d1 = depth + 1; rpt_structure_loc("Parsed_Hid_Descriptor", pdesc, depth); report_hid_collection(pdesc->root_collection, d1); } static void accumulate_report_descriptors_for_collection( Parsed_Hid_Collection * col, Byte report_type_flags, GPtrArray * accumulator) { if (col->child_collections && col->child_collections->len > 0) { for (int ndx = 0; ndx < col->child_collections->len; ndx++) { Parsed_Hid_Collection * a_child = g_ptr_array_index(col->child_collections, ndx); accumulate_report_descriptors_for_collection(a_child, report_type_flags, accumulator); } } if (col->reports && col->reports->len > 0) { for (int ndx = 0; ndx < col->reports->len; ndx++) { Parsed_Hid_Report * rpt = g_ptr_array_index(col->reports, ndx); if ( (rpt->report_type == HID_REPORT_TYPE_INPUT && (report_type_flags & HIDF_REPORT_TYPE_INPUT )) || (rpt->report_type == HID_REPORT_TYPE_OUTPUT && (report_type_flags & HIDF_REPORT_TYPE_OUTPUT )) || (rpt->report_type == HID_REPORT_TYPE_FEATURE && (report_type_flags & HIDF_REPORT_TYPE_FEATURE)) ) { g_ptr_array_add(accumulator, rpt); } } } } /* Extracts the report descriptors of the specified report type or types and * returns them as an array of pointers to the reports. * * Arguments: * phd pointer to parsed HID descriptor * report_type_flags report types to select, as array of flag bits * * Returns: array of pointers to Hid_Report */ GPtrArray * select_parsed_hid_report_descriptors(Parsed_Hid_Descriptor * phd, Byte report_type_flags) { GPtrArray * selected_reports = g_ptr_array_new(); accumulate_report_descriptors_for_collection( phd->root_collection, report_type_flags, selected_reports); return selected_reports; } // // Data structures and functions For building Parsed_Hid_Descriptor // // struct cur_report_globals; typedef struct cur_report_globals { uint16_t usage_page; int16_t logical_minimum; int16_t logical_maximum; bool physical_minimum_defined; // for future use properly implementing physical min/max algorithm per USB spec bool physical_maximum_defined; int16_t physical_minimum; int16_t physical_maximum; uint16_t unit_exponent; uint16_t unit; uint16_t report_size; uint16_t report_id; uint16_t report_count; // number of data fields for the item struct cur_report_globals * prev; } Cur_Report_Globals; typedef struct cur_report_locals { // if bSize = 3, usages are 4 byte extended usages // int usage_bsize; // actually just 0..4 int usage_bsize_bytect; // 0, 1, 2, or 4 GArray * usages; uint32_t usage_minimum; uint32_t usage_maximum; GArray * designator_indexes; uint16_t designator_minimum; uint16_t designator_maximum; GArray * string_indexes; uint16_t string_maximum; uint16_t string_minimum; } Cur_Report_Locals; void free_cur_report_locals(Cur_Report_Locals * locals) { if (locals) { if (locals->usages) g_array_free(locals->usages, true); if (locals->string_indexes) g_array_free(locals->string_indexes, true); if (locals->designator_indexes) g_array_free(locals->designator_indexes, true); free(locals); } } Parsed_Hid_Report * find_hid_report(Parsed_Hid_Collection * col, Byte report_type, uint16_t report_id) { Parsed_Hid_Report * result = NULL; if (col->reports->len) { for (int ndx=0; ndx < col->reports->len && !result; ndx++) { Parsed_Hid_Report * cur = g_ptr_array_index(col->reports, ndx); if (cur->report_type == report_type && cur->report_id == report_id) result = cur; } } return result; } Parsed_Hid_Report * find_hid_report_or_new(Parsed_Hid_Collection * hc, Byte report_type, uint16_t report_id) { bool debug = false; if (debug) printf("(%s) report_type=%d, report_id=%d\n", __func__, report_type, report_id); assert(hc); Parsed_Hid_Report * result = find_hid_report(hc, report_type, report_id); if (!result) { if (!hc->reports) { hc->reports = g_ptr_array_new(); } result = calloc(1, sizeof(Parsed_Hid_Report)); result->report_id = report_id; result->report_type = report_type; g_ptr_array_add(hc->reports, result); } return result; } void add_report_field(Parsed_Hid_Report * hr, Parsed_Hid_Field * hf) { assert(hr && hf); if (!hr->hid_fields) hr->hid_fields = g_ptr_array_new(); g_ptr_array_add(hr->hid_fields, hf); } void add_hid_collection_child(Parsed_Hid_Collection * parent, Parsed_Hid_Collection * new_child) { if (!parent->child_collections) parent->child_collections = g_ptr_array_new(); g_ptr_array_add(parent->child_collections, new_child); } /* From the Device Class Definition for Human Interface Devices: Interpretation of Usage, Usage Minimum orUsage Maximum items vary as a function of the item's bSize field. If the bSize field = 3 then the item is interpreted as a 32 bit unsigned value where the high order 16 bits defines the Usage Page and the low order 16 bits defines the Usage ID. 32 bit usage items that define both the Usage Page and Usage ID are often referred to as "Extended" Usages. If the bSize field = 1 or 2 then the Usage is interpreted as an unsigned value that selects a Usage ID on the currently defined Usage Page. When the parser encounters a main item it concatenates the last declared Usage Page with a Usage to form a complete usage value. Extended usages can be used to override the currently defined Usage Page for individual usages. */ /* Creates an extended usage value from a usage page and usage value. * If the usage value size (usage_bsize) is 4 bytes, then it is already * and extended value and is returned. If it is 1 or 2 bytes, then it * represents a simple usage id and is combined with the usage page to * create an extended value. * * If usage_bsize is not in the range 1..4, then the extended value is * created heuristically. If the high order bytes of usage are non-zero, * the usage is assumed to be an extended usage and returned. If the high * order bytes of usage are 0, it is treated as a simple usage id and is * combined with with usage_page to create the extended usage value. * * Arguments: * usage_page * usage * usage_bsize 3 or 4 indicates a 4 byte value * * Returns: extended usage value */ uint32_t extended_usage(uint16_t usage_page, uint32_t usage, int usage_bsize) { bool debug = false; uint32_t result = 0; if (usage_bsize == 3 || usage_bsize == 4) // allow it to be indicator (3) or actual number of bytes result = usage; else if (usage_bsize == 1 || usage_bsize == 2) { assert( (usage & 0xff00) == 0); result = usage_page <<16 | usage; } else if (usage & 0xff00) result = usage; else result = usage_page << 16 | usage; if (debug) { printf("(%s) usage_page=0x%04x, usage=0x%08x, usage_bsize=%d, returning 0x%08x\n", __func__, usage_page, usage, usage_bsize, result); } return result; } /* The data value in the report descriptor can be 1, 2, or 4 bytes. * In tokenized form, it is stored as a 4 byte unsigned integer. * This function looks at the high order bit of the original value * to determine if the value is negative. * * Arguments: * data data value, possibly expanded to 4 bytes * bytect number of bytes in original value * * Returns: signed value */ static int32_t maybe_signed_data(uint32_t data, int bytect) { bool debug = false; if (debug) printf("(%s) bytect = %d, data = 0x%0*x\n", __func__, bytect, 2*bytect, data); int32_t result = 0; assert(bytect == 0 || bytect == 1 || bytect==2 || bytect==4); if (bytect > 0) { int sign_bitno = (bytect * 8) - 1; uint32_t sign_mask = 1 << sign_bitno; // printf(" sign_bitno = %d, sign_mask=0x%08x\n", sign_bitno, sign_mask); if (data & sign_mask) result = -data; else result = data; } if (debug) printf("(%s) Returning: %d\n", __func__, result); return result; } /* Fully interpret a sequence of Hid_Report_Items * * Arguments: * head pointer to linked list of Hid_Report_Items * * Returns: parsed report descriptor */ // TODO: Should this function return NULL in case of invalid data (e.g. more end than start collections)? Parsed_Hid_Descriptor * parse_hid_report_desc_from_item_list(Hid_Report_Descriptor_Item * items_head) { bool debug = false; if (debug) printf("(%s) Starting.\n", __func__); char *types[4] = { "Main", "Global", "Local", "reserved" }; Cur_Report_Globals * cur_globals = calloc(1, sizeof(struct cur_report_globals)); Cur_Report_Locals * cur_locals = calloc(1, sizeof(struct cur_report_locals)); Parsed_Hid_Collection * cur_collection = NULL; Parsed_Hid_Descriptor * parsed_descriptor = calloc(1, sizeof(Parsed_Hid_Descriptor)); parsed_descriptor->root_collection = calloc(1,sizeof(Parsed_Hid_Collection)); parsed_descriptor->root_collection->is_root_collection = true; parsed_descriptor->valid_descriptor = true; // set false if invalid, should never occur #define COLLECTION_STACK_SIZE 10 Parsed_Hid_Collection * collection_stack[COLLECTION_STACK_SIZE]; collection_stack[0] = parsed_descriptor->root_collection; int collection_stack_cur = 0; Hid_Report_Descriptor_Item * item = items_head; while(item) { if (debug) { char datastr[20]; snprintf(datastr, 20, "[0x%0*x] %d", item->bsize_bytect*2, item->data, item->data); printf("(%s) Item(%-6s): %s, data=%s\n", __func__, types[item->btype], devid_hid_descriptor_item_type(item->btag), datastr); } switch (item->btype) { // Main item tags case 0: // Main item switch(item->btag) { case 0xa0: // Collection { cur_collection = calloc(1, sizeof(Parsed_Hid_Collection)); cur_collection->collection_type = item->data; cur_collection->usage_page = cur_globals->usage_page; uint32_t cur_usage = 0; if (cur_locals->usages && cur_locals->usages->len > 0) { cur_usage = g_array_index(cur_locals->usages, uint32_t, 0); // cur_collection->usage_id = cur_usage; // deprecated } else { printf("(%s) No usage id has been set for collection\n", __func__); } if (cur_usage) { cur_collection->extended_usage = extended_usage( cur_globals->usage_page, cur_usage, cur_locals->usage_bsize_bytect); // or 0 to use heuristic } else { // what to do if there was no usage value? // makes no sense to combine it with usage page printf("(%s) Collection has no usage value\n", __func__); } cur_collection->reports = g_ptr_array_new(); // add this collection as a child of the parent collection add_hid_collection_child(collection_stack[collection_stack_cur], cur_collection); assert(collection_stack_cur < COLLECTION_STACK_SIZE-1); collection_stack[++collection_stack_cur] = cur_collection; break; } case 0x80: /* Input */ case 0x90: /* Output */ case 0xb0: /* Feature */ { Parsed_Hid_Field * hf = calloc(1, sizeof(Parsed_Hid_Field)); Byte report_type; if (item->btag == 0x80) report_type = HID_REPORT_TYPE_INPUT; else if (item->btag == 0x90) report_type = HID_REPORT_TYPE_OUTPUT; else report_type = HID_REPORT_TYPE_FEATURE; hf->item_flags = item->data; uint16_t report_id = cur_globals->report_id; Parsed_Hid_Report * hr = find_hid_report_or_new( cur_collection, report_type, report_id); // add this item/field to current report add_report_field(hr, hf); #ifdef OLD int field_index = hr->hid_fields->len - 1; // field number within report // if multiple usages, does this apply to fields within report or // occurrences within field ??? // WRONG! if (cur_locals->usages && cur_locals->usages->len > 0) { int usagect = cur_locals->usages->len; int usagendx = (field_index < usagect) ? field_index : usagect-1; uint32_t this_usage = g_array_index(cur_locals->usages, uint32_t, usagendx); hf->extended_usage = extended_usage(cur_globals->usage_page, this_usage, cur_locals->usage_bsize_bytect); // or 0 to use heuristic if (debug) { printf("(%s) item 0x%02x, usagect=%d, usagendx=%d, this_usage=0x%04x\n", __func__, item->btag, usagect, usagendx, this_usage); } } else { // message unnecessary here, warning will be issued by report_parsed_hid_report() if (debug) { printf("(%s) Tag 0x%02x, Report id: %d 0x%02x: No usage values in cur_locals\n", __func__, item->btag, report_id, report_id); } } #endif if ( ( cur_locals->usage_minimum && !cur_locals->usage_maximum) || (!cur_locals->usage_minimum && cur_locals->usage_maximum) ) { printf("(%s) Either both or neither usage_minimum or usage_maximum must be specified\n", __func__); parsed_descriptor->valid_descriptor = false; } if (cur_locals->usage_minimum) hf->min_extended_usage = extended_usage(cur_globals->usage_page, cur_locals->usage_minimum, 0); if (cur_locals->usage_maximum) hf->max_extended_usage = extended_usage(cur_globals->usage_page, cur_locals->usage_maximum, 0); if (cur_locals->usages && cur_locals->usages->len > 0) { hf->extended_usages = g_array_new(true, true, sizeof(uint32_t)); for (int ndx = 0; ndx < cur_locals->usages->len; ndx++) { uint32_t ausage = g_array_index(cur_locals->usages, uint32_t, ndx); uint32_t extusage = extended_usage(cur_globals->usage_page, ausage, 0); g_array_append_val(hf->extended_usages, extusage ); } } hf->usage_page = cur_globals->usage_page; hf->report_size = cur_globals->report_size; hf->report_count = cur_globals->report_count; hf->unit_exponent = cur_globals->unit_exponent; hf->unit = cur_globals->unit; hf->logical_minimum = cur_globals->logical_minimum; hf->logical_maximum = cur_globals->logical_maximum; /* From the HID Device Class Definition spec section 6.2.2.7: Until Physical Minimum and Physical Maximum are declared in a report descriptor they are assumed by the HID parser to be equal to Logical Minimum and Logical Maximum, respectively. After declaring them to so that they can applied to a (Input, Output or Feature) main item they continue to effect all subsequent main items. If both the Physical Minimum and Physical Maximum extents are equal to 0 then they will revert to their default interpretation. */ #ifdef WRONG // see section 6.2.2.7 for correct algorithm hf->physical_minimum = (cur_globals->physical_minimum) ? cur_globals->physical_minimum : cur_globals->logical_minimum; hf->physical_maximum = (cur_globals->physical_maximum) ? cur_globals->physical_maximum : cur_globals->logical_maximum; #endif hf->physical_minimum = cur_globals->physical_minimum; hf->physical_maximum = cur_globals->physical_maximum; #define UNHANDLED(F) \ if (cur_locals->F) \ printf("%s) Tag 0x%02x, Unimplemented: %s\n", __func__, item->btag, #F); UNHANDLED(designator_indexes) UNHANDLED(designator_minimum) UNHANDLED(designator_maximum) UNHANDLED(string_indexes) UNHANDLED(string_minimum) UNHANDLED(string_maximum) #undef UNHANDLED break; } case 0xc0: // End Collection if (collection_stack_cur == 0) { printf("(%s) End Collection item without corresponding Collection\n", __func__); // Need to do anything more to recover? } else collection_stack_cur--; break; default: break; } // switch(btag) free_cur_report_locals(cur_locals); cur_locals = calloc(1, sizeof(struct cur_report_locals)); break; // Global item tags case 1: // Global item switch (item->btag) { case 0x04: /* Usage Page */ cur_globals->usage_page = item->data; break; case 0x14: // Logical Minimum cur_globals->logical_minimum = maybe_signed_data(item->data, item->bsize_bytect); break; case 0x24: cur_globals->logical_maximum = maybe_signed_data(item->data, item->bsize_bytect); break; case 0x34: cur_globals->physical_minimum = maybe_signed_data(item->data, item->bsize_bytect); break; case 0x44: cur_globals->physical_maximum = maybe_signed_data(item->data, item->bsize_bytect);; break; case 0x54: // Unit Exponent cur_globals->unit_exponent = item->data; // Global break; case 0x64: // Unit cur_globals->unit = item->data; // ?? // Global break; case 0x74: cur_globals->report_size = item->data; break; case 0x84: cur_globals->report_id = item->data; break; case 0x94: cur_globals->report_count = item->data; break; case 0xa4: // Push { Cur_Report_Globals* old_globals = cur_globals; cur_globals = calloc(1, sizeof(Cur_Report_Globals)); cur_globals->prev = old_globals; break; } case 0xb4: // Pop if (!cur_globals->prev) { printf("(%s) Invalid item Pop without previous Push\n", __func__); } else { Cur_Report_Globals * popped_globals = cur_globals; cur_globals = cur_globals->prev; free(popped_globals); } break; default: printf("(%s) Invalid global item tag: 0x%02x\n", __func__, item->btag); } // switch(btag) break; // Local item tags case 2: // Local item switch(item->btag) { case 0x08: // Usage { if (debug) printf("(%s) tag 0x08 (Usage), bsize_bytect=%d, value=0x%08x %d\n", __func__, item->bsize_bytect, item->data, item->data); if (cur_locals->usages == NULL) cur_locals->usages = g_array_new( /* null terminated */ false, /* init to 0 */ true, /* field size */ sizeof(uint32_t) ); g_array_append_val(cur_locals->usages, item->data); if (cur_locals->usages->len > 1) { if (debug) printf("(%s) After append, cur_locals->usages->len = %d\n", __func__, cur_locals->usages->len); } if (cur_locals->usages->len == 1) cur_locals->usage_bsize_bytect = item->bsize_bytect; else { if (item->bsize_bytect != cur_locals->usage_bsize_bytect && cur_locals->usage_bsize_bytect != 0) // avoid redundant messages { printf("(%s) Warning: Multiple usages for fields have different size values\n", __func__); printf(" Switching to heurisitic interpretation of usage\n"); cur_locals->usage_bsize_bytect = 0; } } break; } case 0x18: // Usage minimum cur_locals->usage_minimum = item->data; break; case 0x28: cur_locals->usage_maximum = item->data; break; case 0x38: // designator index // TODO: same as 0x08 Usage printf("(%s) Local item value 0x38 (Designator Index) unimplemented\n", __func__); break; case 0x48: cur_locals->designator_minimum = item->data; break; case 0x58: cur_locals->designator_maximum = item->data; break; case 0x78: // string index // TODO: same as 0x08 Usage printf("(%s) Local item value 0x78 (String Index) unimplemented\n", __func__); break; case 0x88: cur_locals->string_minimum = item->data; break; case 0x98: cur_locals->string_maximum = item->data; break; case 0xa8: // delimiter - defines beginning or end of set of local items // what to do? printf("(%s) Local item Delimiter unimplemented\n", __func__); break; default: printf("(%s) Invalid local item tag: 0x%02x\n", __func__, item->btag); } break; default: printf("(%s) Invalid item type: 0x%04x\n", __func__, item->btype); } item = item->next; } free_cur_report_locals(cur_locals); // Free the globals stack, in case there's anything on it Cur_Report_Globals * prev_globals = NULL; while (cur_globals) { prev_globals = cur_globals->prev; free(cur_globals); cur_globals = prev_globals; } return parsed_descriptor; } /* Parse and interpret the bytes of a HID report descriptor. * * Arguments: * b address of first byte * desclen number of bytes * * Returns: parsed report descriptor */ Parsed_Hid_Descriptor * parse_hid_report_desc(Byte * b, int desclen) { bool debug = false; if (debug) printf("(%s) Starting. b=%p, desclen=%d\n", __func__, b, desclen); Hid_Report_Descriptor_Item * item_list = tokenize_hid_report_descriptor(b, desclen) ; Parsed_Hid_Descriptor * result = parse_hid_report_desc_from_item_list(item_list); free_hid_report_item_list(item_list); return result; } // // Functions that extract information from a Parsed_Hid_Descriptor // /* Indicates if a parsed HID Report Descriptor represents a USB connected monitor. * * Arguments: * phd pointer parsed HID Report Descriptor * * Returns: true/false * * Per section 5.5 of USB Monitor Control Class Specification Rev 1.0: * "In order to identify a HID class device as a monitor, the device's * HID Report Descriptor must contain a top-level collection with a usage * of Monitor Control from the USB Monitor Usage Page." * * i.e. Usage page = 0x80 USB monitor * Usage id = 0x01 Monitor Control */ bool is_monitor_by_parsed_hid_report_descriptor(Parsed_Hid_Descriptor * phd) { bool is_monitor = false; Parsed_Hid_Collection * root_collection = phd->root_collection; for (int ndx = 0; ndx < root_collection->child_collections->len; ndx++) { Parsed_Hid_Collection * col = g_ptr_array_index(root_collection->child_collections, ndx); if (col->extended_usage == (0x0080 << 16 | 0x0001) ) { is_monitor = true; break; } } return is_monitor; } uint16_t get_vcp_code_from_parsed_hid_report(Parsed_Hid_Report * rpt) { uint16_t vcp_code = 0; if (rpt->report_type == HID_REPORT_TYPE_FEATURE && rpt->hid_fields && rpt->hid_fields->len == 1) { Parsed_Hid_Field * f = g_ptr_array_index(rpt->hid_fields, 0); // n. ignoring possibility of report count > 1, multiple usages if (f->usage_page == 0x80) { // vcp_code = f->extended_usage & 0xffff; vcp_code = g_array_index(f->extended_usages, uint32_t, 0) & 0xffff; assert( (vcp_code & 0xff00) == 0); } } return vcp_code; } void report_vcp_code_report(Vcp_Code_Report * vcr, int depth) { int d1 = depth+1; rpt_structure_loc("Vcp_Code_Report", vcr, depth); rpt_vstring(d1, "%-20s %d 0x%02x", "vcp_code", vcr->vcp_code, vcr->vcp_code); rpt_vstring(d1, "%-20s %p", "rpt", vcr->rpt); report_parsed_hid_report(vcr->rpt, d1); } void report_vcp_code_report_array(GPtrArray * vcr_array, int depth) { rpt_vstring(depth, "Vcp_Code_Report array at %p contains %d entries:", vcr_array, vcr_array->len); int d1 = depth+1; for (int ndx=0; ndx < vcr_array->len; ndx++) { report_vcp_code_report( g_ptr_array_index(vcr_array, ndx), d1); } } void summarize_vcp_code_report(Vcp_Code_Report * vcr, int depth) { // int d1 = depth+1; // rpt_vstring(depth, "%-20s %d 0x%02x", "vcp_code", vcr->vcp_code, vcr->vcp_code); // rpt_vstring(d1, "%-20s %d 0x%02x", "report_id", vcr->rpt->report_id, vcr->rpt->report_id); rpt_vstring(depth, "vcp code: 0x%02x (%3d), report id: 0x%02x (%3d), report type: 0x%02x (%s)", vcr->vcp_code, vcr->vcp_code, vcr->rpt->report_id, vcr->rpt->report_id, vcr->rpt->report_type, hid_report_type_name(vcr->rpt->report_type)); } void summarize_vcp_code_report_array(GPtrArray * vcr_array, int depth) { // rpt_vstring(depth, "VCP code reports:"); // int d1 = depth+1; for (int ndx=0; ndx < vcr_array->len; ndx++) { summarize_vcp_code_report( g_ptr_array_index(vcr_array, ndx), depth); } } /* Per the spec, e.g. USB Monitor Control Class Spec section 5.5, there can be * multiple top application collections, one of which must be a monitor application. * In practice, we've only seen a single top level application collection, but for * generality this function selects the monitor application from a parsed HID descriptor. */ // May be null in case where device was forced to be a monitor for // testing purposes based on its vid/pid Parsed_Hid_Collection * get_monitor_application_collection(Parsed_Hid_Descriptor * phd) { bool debug = false; if (debug) printf("(%s) Starting. phd=%p\n", __func__, phd); Parsed_Hid_Collection * result = NULL; Parsed_Hid_Collection * root_collection = phd->root_collection; for (int ndx = 0; ndx < root_collection->child_collections->len; ndx++) { Parsed_Hid_Collection * col = g_ptr_array_index(root_collection->child_collections, ndx); if (debug) printf("(%s) extended_usage = 0x%08x\n", __func__, col->extended_usage); if (col->extended_usage == (0x0080 << 16 | 0x0001) ) { result = col; break; } } if (debug) printf("(%s) Returning: %p\n", __func__, result); return result; } static int compare_vcp_code_report(gconstpointer first, gconstpointer second) { int result = 0; const Vcp_Code_Report * a = first; const Vcp_Code_Report * b = second; if (a->vcp_code < b->vcp_code) result = -1; else if (a->vcp_code > b->vcp_code) result = 1; return result; } /* Gets table of VCP codes and the reports that implement them. * * Arguments: phd pointer to parsed HID descriptor * * Returns: array of Vco_Code_Report */ GPtrArray * get_vcp_code_reports(Parsed_Hid_Descriptor * phd) { bool debug = false; if (debug) printf("(%s) Starting. phd=%p\n", __func__, phd); // May be null in case where device was forced to be a monitor for // testing purposds based on its vid/pid Parsed_Hid_Collection * col = get_monitor_application_collection(phd); GPtrArray * vcp_reports = g_ptr_array_new(); // Simplifying assumptions: // report has only one field if (col && col->reports) { for (int ndx = 0; ndx < col->reports->len; ndx++) { Parsed_Hid_Report * rpt = g_ptr_array_index(col->reports, ndx); if (rpt->report_type == HID_REPORT_TYPE_FEATURE) { if (rpt->hid_fields && rpt->hid_fields->len == 1) { Parsed_Hid_Field * f = g_ptr_array_index(rpt->hid_fields, 0); if (debug) report_hid_field(f, 5); if (f->usage_page == 0x0082 && f->report_size == 8 ) { // Have seen cases where usage ID == 0, e.g. Apple Cinema Display report xe7 // ignore such // Byte vcp_feature_code = f->extended_usage & 0xff; // TO DO: Handle case of min_usage/max_usage if (f->extended_usages) { Byte vcp_feature_code = g_array_index(f->extended_usages, uint32_t, 0) & 0xffff; if (vcp_feature_code) { Vcp_Code_Report * code_rpt = calloc(1, sizeof(Vcp_Code_Report)); code_rpt->vcp_code = vcp_feature_code; code_rpt->rpt = rpt; g_ptr_array_add(vcp_reports, code_rpt); } else { if (debug) printf("(%s) Ignoring report with usage_id = 0\n", __func__); } } } } } } } // sort array by vcp code g_ptr_array_sort(vcp_reports, compare_vcp_code_report); if (debug) { printf("(%s) Returning array of %d reports at %p\n", __func__, vcp_reports->len, vcp_reports); report_vcp_code_report_array(vcp_reports, 1); } return vcp_reports; } /* Gets Parsed_Hid_Report for the EDID * * Arguments: phd pointer to parsed HID descriptor * * Returns: Parsed_Hid_Report for EDID */ Parsed_Hid_Report * find_edid_report_descriptor(Parsed_Hid_Descriptor * phd) { bool debug = false; if (debug) printf("(%s) Starting. phd=%p\n", __func__, phd); Parsed_Hid_Collection * col = get_monitor_application_collection(phd); Parsed_Hid_Report * edid_report = NULL; if (col && col->reports) { for (int ndx = 0; ndx < col->reports->len; ndx++) { Parsed_Hid_Report * rpt = g_ptr_array_index(col->reports, ndx); if (rpt->report_type == HID_REPORT_TYPE_FEATURE) { if (rpt->hid_fields && rpt->hid_fields->len == 1) { Parsed_Hid_Field * f = g_ptr_array_index(rpt->hid_fields, 0); if (f->extended_usages && f->extended_usages->len == 1) { uint32_t extusage = g_array_index(f->extended_usages, uint32_t, 0); if (extusage == ((0x0080 << 16) | 0x0002) && (f->item_flags & HID_FIELD_BUFFERED_BYTE) && f->report_size == 8 && f->report_count >= 128 ) { edid_report = rpt; break; } } } } } } return edid_report; } ddcutil-0.8.6/src/usb_util/usb_hid_common.h0000644000175000001440000000221213230445447015650 00000000000000/* usb_hid_common.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef USB_HID_COMMON_H_ #define USB_HID_COMMON_H_ #include #include const char * collection_type_name(uint8_t collection_type); bool force_hid_monitor_by_vid_pid(int16_t vid, int16_t pid); #endif /* USB_HID_COMMON_H_ */ ddcutil-0.8.6/src/usb_util/hidraw_util.h0000644000175000001440000000210013230445447015172 00000000000000/* hidraw_util.h * * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef HIDRAW_UTIL_H_ #define HIDRAW_UTIL_H_ void probe_hidraw(bool show_monitors_only, int depth); bool hidraw_is_monitor_device(char * devname); #endif /* _HIDRAW_UTIL_H_ */ ddcutil-0.8.6/src/usb_util/base_hid_report_descriptor.h0000644000175000001440000000415513230445447020262 00000000000000/* base_hid_report_descriptor.h * * Functions to perform basic parsing of the HID Report Descriptor and * display the contents of the Report Descriptor in the format used * in HID documentation. * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef BASE_HID_REPORT_DESCRIPTOR_H_ #define BASE_HID_REPORT_DESCRIPTOR_H_ #include #include "util/coredefs.h" typedef struct hid_report_item { struct hid_report_item * next; Byte raw_bytes[5]; Byte btype; // 0=Main, 1=Global, 2=Local, prefix bits 2-3 Byte btag; Byte bsize_bytect; // number of bytes, as opposed to indicator, i.e 4 means 4 bytes uint32_t data; // alternative, as done in struct hid_item in kernel header file hid.h: union { uint8_t u8; int8_t s8; uint16_t u16; int8_t s16; uint32_t u32; int32_t s32; uint8_t *longdata; } data_alt; } Hid_Report_Descriptor_Item; void report_hid_report_item_list(Hid_Report_Descriptor_Item * head, int depth); void free_hid_report_item_list(Hid_Report_Descriptor_Item * head); Hid_Report_Descriptor_Item * tokenize_hid_report_descriptor(Byte * b, int l) ; bool is_monitor_by_tokenized_hid_report_descriptor(Hid_Report_Descriptor_Item * report_item_list); #endif /* BASE_HID_REPORT_DESCRIPTOR_H_ */ ddcutil-0.8.6/src/usb_util/hid_report_descriptor.h0000644000175000001440000001423113230445447017264 00000000000000/* hid_report_descriptor.h * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef HID_REPORT_DESCRIPTOR_H_ #define HID_REPORT_DESCRIPTOR_H_ #include #include "util/coredefs.h" #include "usb_util/base_hid_report_descriptor.h" #ifndef HID_FIELD_CONSTANT // Bits of item flags, as defined in hiddev.h // Define them here if hiddev.h was not already included #define HID_FIELD_CONSTANT 0x001 #define HID_FIELD_VARIABLE 0x002 #define HID_FIELD_RELATIVE 0x004 #define HID_FIELD_WRAP 0x008 #define HID_FIELD_NONLINEAR 0x010 #define HID_FIELD_NO_PREFERRED 0x020 #define HID_FIELD_NULL_STATE 0x040 #define HID_FIELD_VOLATILE 0x080 #define HID_FIELD_BUFFERED_BYTE 0x100 #endif // values identical to those for HID_REPORT_TYPE_* in hiddev.h: #define HID_REPORT_TYPE_INPUT 1 #define HID_REPORT_TYPE_OUTPUT 2 #define HID_REPORT_TYPE_FEATURE 3 #define HID_REPORT_TYPE_MIN 1 #define HID_REPORT_TYPE_MAX 3 /* From the Device Class Definition for Human Interface Devices: Interpretation of Usage, Usage Minimum orUsage Maximum items vary as a function of the item's bSize field. If the bSize field = 3 then the item is interpreted as a 32 bit unsigned value where the high order 16 bits defines the Usage Page and the low order 16 bits defines the Usage ID. 32 bit usage items that define both the Usage Page and Usage ID are often referred to as "Extended" Usages. If the bSize field = 1 or 2 then the Usage is interpreted as an unsigned value that selects a Usage ID on the currently defined Usage Page. When the parser encounters a main item it concatenates the last declared Usage Page with a Usage to form a complete usage value. Extended usages can be used to override the currently defined Usage Page for individual usages. */ typedef struct parsed_hid_field { uint16_t item_flags; uint16_t usage_page; #ifdef OLD uint32_t extended_usage; // hi 16 bits usage_page, lo 16 bits usage_id #endif GArray * extended_usages; // new way, array of uint_32t, hi 16 bits usage page, lo 16 bits usage id uint32_t min_extended_usage; uint32_t max_extended_usage; /* The meaning of logical min/max vs physical/min max is the opposite of what one might expect. Logical refers to the values returned by the device. Physical refers to the "real world" bounds. Per section 6.2.2.7 of the HID Device Class Definition v 1.11: While Logical Minimum and Logical Maximum (extents) bound the values returned by a device, Physical Minimum and Physical Maximum give meaning to those bounds by allowing the report value to be offset and scaled. For example, a thermometer might have logical extents of 0 and 999 but physical extents of 32 and 212 degrees. */ int16_t logical_minimum; int16_t logical_maximum; int16_t physical_minimum; int16_t physical_maximum; uint16_t report_size; uint16_t report_count; uint16_t unit_exponent; uint16_t unit; } Parsed_Hid_Field; typedef struct parsed_hid_report { uint16_t report_id; Byte report_type; GPtrArray * hid_fields; // array of pointers to Parsed_Hid_Field } Parsed_Hid_Report; typedef struct parsed_hid_collection { uint16_t usage_page; uint32_t extended_usage; Byte collection_type; bool is_root_collection; GPtrArray * reports; // array of pointers to Parsed_Hid_Report GPtrArray * child_collections; // array of pointers to Parsed_Hid_Collection } Parsed_Hid_Collection; typedef struct parsed_hid_descriptor { bool valid_descriptor; Parsed_Hid_Collection * root_collection; } Parsed_Hid_Descriptor; void free_parsed_hid_descriptor(Parsed_Hid_Descriptor * phd); Parsed_Hid_Descriptor * parse_hid_report_desc_from_item_list(Hid_Report_Descriptor_Item * items_head); Parsed_Hid_Descriptor * parse_hid_report_desc(Byte * b, int desclen); void report_parsed_hid_report(Parsed_Hid_Report * hr, int depth); void summarize_parsed_hid_report(Parsed_Hid_Report * hr, int depth); void report_parsed_hid_descriptor(Parsed_Hid_Descriptor * pdesc, int depth); bool is_monitor_by_parsed_hid_report_descriptor(Parsed_Hid_Descriptor * phd); // TODO: use same bit values as item type? will that work? // TODO: poor names typedef enum hid_report_type_enum { HIDF_REPORT_TYPE_NONE = 0x00, HIDF_REPORT_TYPE_INPUT = 0x02, // == 1 << HID_REPORT_TYPE_INPUT HIDF_REPORT_TYPE_OUTPUT = 0x04, // == 1 << HID_REPORT_TYPE_OUTPUT HIDF_REPORT_TYPE_FEATURE = 0x08, // == 1 << HID_REPORT_TYPE_FEATURE HIDF_REPORT_TYPE_ANY = 0xff } Hid_Report_Type_Enum; GPtrArray * select_parsed_hid_report_descriptors(Parsed_Hid_Descriptor * phd, Byte report_type_flags); typedef struct vcp_code_report { uint8_t vcp_code; Parsed_Hid_Report * rpt; } Vcp_Code_Report; void report_vcp_code_report(Vcp_Code_Report * vcr, int depth); void report_vcp_code_report_array(GPtrArray * vcr_array, int depth); void summarize_vcp_code_report(Vcp_Code_Report * vcr, int depth); void summarize_vcp_code_report_array(GPtrArray * vcr_array, int depth); GPtrArray * get_vcp_code_reports(Parsed_Hid_Descriptor * phd); Parsed_Hid_Report * find_edid_report_descriptor(Parsed_Hid_Descriptor * phd); #endif /* HID_REPORT_DESCRIPTOR_H_ */ ddcutil-0.8.6/src/usb_util/hiddev_reports.h0000644000175000001440000000315513230445447015713 00000000000000/* hiddev_reports.h * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef HIDDEV_REPORTS_H_ #define HIDDEV_REPORTS_H_ #include #include void init_hiddev_reports(); void report_hiddev_devinfo(struct hiddev_devinfo * devinfo, bool lookup_names, int depth); void report_hiddev_device_by_fd(int fd, int depth); void report_hiddev_usage_ref(struct hiddev_usage_ref * uref, int depth); void report_hiddev_usage_ref_multi(struct hiddev_usage_ref_multi * uref_multi, int depth); void report_hiddev_report_info(struct hiddev_report_info * rinfo, int depth); void report_hiddev_field_info(struct hiddev_field_info * finfo, int depth); char * hiddev_interpret_report_id(__u32 report_id); char * hiddev_interpret_usage_code(int usage_code ); #endif /* UTIL_HIDDEV_REPORTS_H_ */ ddcutil-0.8.6/src/usb_util/hiddev_util.h0000644000175000001440000000677713230445447015207 00000000000000/* hiddev_util.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * */ #ifndef HIDDEV_UTIL_H_ #define HIDDEV_UTIL_H_ #include #include // so callers will have definition of strerror() used in REPORT_IOCTL_ERROR macro: #include #include "util/data_structures.h" #include "util/edid.h" // The define is used within directory usb_util. // The more general REPORT_USB_ERROR is defined in base/core.h, so is unavailable // at the util level. #define REPORT_USB_IOCTL_ERROR(_ioctl_name, _errno) \ do { \ printf("(%s) ioctl(%s) failed. errno=%d: %s\n", \ __func__, \ _ioctl_name, \ _errno, \ strerror(_errno) \ ); \ } while(0) #define HID_REPORT_TYPE_INPUT_FG (1 << HID_REPORT_TYPE_INPUT) #define HID_REPORT_TYPE_OUTPUT_FG (1 << HID_REPORT_TYPE_OUTPUT) #define HID_REPORT_TYPE_FEATURE_FG (1 << HID_REPORT_TYPE_FEATURE) // Identifies a field within a report // n. names of structs in hiddev.h begin with "hiddev_", so using that prefix // for the following struct would be confusing struct hid_field_locator { struct hiddev_field_info * finfo; // simplify by eliminating? __u32 report_type; __u32 report_id; __u32 field_index; }; void free_hid_field_locator(struct hid_field_locator * location); void report_hid_field_locator(struct hid_field_locator * ploc, int depth); // n. hiddev.h contains declarations of structs, but not functions, so // prefixing the following functions with "hiddev_" does not lead to confusion struct hid_field_locator* hiddev_find_report(int fd, __u32 report_type, __u32 ucode, bool match_all_ucodes); Buffer * hiddev_get_multibyte_report_value_by_hid_field_locator(int fd, struct hid_field_locator * loc); Buffer * get_hiddev_edid(int fd); Buffer * hiddev_get_multibyte_value_by_report_type_and_ucode(int fd, __u32 report_type, __u32 usage_code, __u32 num_values); Buffer * hiddev_get_multibyte_value_by_ucode(int fd, __u32 usage_code, __u32 num_values); const char * hiddev_report_type_name(__u32 report_type); bool force_hiddev_monitor(int fd); bool is_hiddev_monitor(int fd); GPtrArray * get_hiddev_device_names(); char * get_hiddev_name(int fd); bool hiddev_is_field_edid(int fd, struct hiddev_report_info * rinfo, int field_index); __u32 hiddev_get_identical_ucode(int fd, struct hiddev_field_info * finfo, __u32 actual_field_index); Buffer * hiddev_collect_single_byte_usage_values( int fd, struct hiddev_field_info * finfo, __u32 field_index); #endif /* HIDDEV_UTIL_H_ */ ddcutil-0.8.6/src/usb_util/libusb_reports.h0000644000175000001440000001440013230445447015723 00000000000000/* libusb_reports.h * * libusb is not currently used by ddcutil. This code is retained for reference. * * * Copyright (C) 2016-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ // Adapted from usbplay2 file libusb_util.h #ifndef LIBUSB_REPORTS_H_ #define LIBUSB_REPORTS_H_ #include // need pkgconfig? #include // #include #include "util/coredefs.h" #define LIBUSB_EXIT true #define LIBUSB_CONTINUE false #define REPORT_LIBUSB_ERROR(_funcname, _errno, _exit_on_error) \ do { \ fprintf(stderr, "(%s) " _funcname " returned %d (%s): %s\n", \ __func__, \ _errno, \ libusb_error_name(_errno), \ libusb_strerror(_errno) \ ); \ if (_exit_on_error) \ exit(1); \ } while(0); #define REPORT_LIBUSB_ERROR_NOEXIT(_funcname, _errno) \ do { \ fprintf(stderr, "(%s) " _funcname " returned %d (%s): %s\n", \ __func__, \ _errno, \ libusb_error_name(_errno), \ libusb_strerror(_errno) \ ); \ } while(0); #define CHECK_LIBUSB_RC(_funcname, _rc, _exit_on_error) \ do { \ if (_rc < 0) { \ fprintf(stderr, "(%s) " _funcname " returned %d (%s): %s\n", \ __func__, \ _rc, \ libusb_error_name(_rc), \ libusb_strerror(_rc) \ ); \ if (_exit_on_error) \ exit(1); \ } \ } while(0); // Initialization void init_libusb_reports(); // initialize lookup tables // Lookup descriptive names of constants char * descriptor_title(Byte val); char * endpoint_direction_title(Byte val); char * transfer_type_title(Byte val); char * class_code_title(Byte val); // Misc utilities char * lookup_libusb_string( struct libusb_device_handle * dh, int string_id); #ifdef UNUSED wchar_t * lookup_libusb_string_wide(struct libusb_device_handle * dh, int string_id); #endif // Report functions for libusb data structures void report_libusb_endpoint_descriptor( const struct libusb_endpoint_descriptor * epdesc, libusb_device_handle * dh, // may be null int depth); void report_libusb_interface_descriptor( const struct libusb_interface_descriptor * inter, libusb_device_handle * dh, // may be null int depth); void report_libusb_interface( const struct libusb_interface * interface, libusb_device_handle * dh, // may be null int depth) ; void report_libusb_config_descriptor( const struct libusb_config_descriptor * config, libusb_device_handle * dh, // may be null int depth); void report_libusb_device_descriptor( const struct libusb_device_descriptor * desc, libusb_device_handle * dh, // may be null int depth); void report_libusb_device( libusb_device * dev, bool show_hubs, int depth); void report_libusb_devices( libusb_device ** devs, bool show_hubs, int depth); #ifdef OLD bool get_raw_report_descriptor_old( struct libusb_device_handle * dh, uint8_t bInterfaceNumber, uint16_t rptlen, // report length Byte * dbuf, int dbufsz, int * pbytes_read); #endif bool get_raw_report_descriptor( struct libusb_device_handle * dh, uint8_t bInterfaceNumber, uint16_t rptlen, // report length Byte * dbuf, int dbufsz, int * pbytes_read); bool get_raw_report( struct libusb_device_handle * dh, uint8_t bInterfaceNumber, uint8_t report_id, uint16_t rptlen, // report length Byte * dbuf, int dbufsz, int * pbytes_read); bool is_hub_descriptor(const struct libusb_device_descriptor * desc); // really belongs elsewhere typedef struct __attribute__((__packed__)) hid_class_descriptor { uint8_t bDescriptorType; uint16_t wDescriptorLength; } HID_Class_Descriptor; typedef struct __attribute__((__packed__)) hid_descriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdHID; uint8_t bCountryCode; uint8_t bNumDescriptors; // number of class descriptors, always at least 1, i.e. Report descriptor uint8_t bClassDescriptorType; // start of first class descriptor uint16_t wClassDescriptorLength; } HID_Descriptor; void report_hid_descriptor( libusb_device_handle * dh, uint8_t bInterfaceNumber, HID_Descriptor * desc, int depth); #endif /* LIBUSB_REPORTS_H_ */ ddcutil-0.8.6/src/usb_util/libusb_util.h0000644000175000001440000000454513230445447015213 00000000000000/* libusb_util.h * * libusb is currently used only within query_sysenv.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef LIBUSB_UTIL_H_ #define LIBUSB_UTIL_H_ #include #include #include "usb_util/libusb_reports.h" char *make_path(int bus_number, int device_address, int interface_number); char *make_path_from_libusb_device(libusb_device *dev, int interface_number); // bool possible_monitor_dev(libusb_device * dev, bool check_forced_monitor); // singly linked list of possible monitors typedef struct possible_monitor_device { libusb_device * libusb_device; int bus; int device_address; int alt_setting; int interface; ushort vid; ushort pid; char * manufacturer_name; char * product_name; // conversion is annoying, just retrieve both ascii and wchar version of the serial number // wchar_t * serial_number_wide; char * serial_number; // retrieved as ASCII, note some usages expect wchar struct possible_monitor_device * next; } Possible_Monitor_Device; struct possible_monitor_device * get_possible_monitors(); void report_possible_monitors(struct possible_monitor_device * mondev_head, int depth); #ifdef UNTESTED void free_possible_monitor_device_list(struct possible_monitor_device * head); #endif void probe_libusb(bool possible_monitors_only,int depth); bool libusb_is_monitor_by_path(ushort busno, ushort devno, ushort intfno); #endif /* LIBUSB_UTIL_H_ */ ddcutil-0.8.6/src/base/0000755000175000001440000000000013230445447011661 500000000000000ddcutil-0.8.6/src/base/Makefile.am0000644000175000001440000000160313226541040013624 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall AM_CFLAGS += -Werror # AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand clean-local: @echo "(src/base/Makefile) clean-local" mostlyclean-local: @echo "(src/base/Makefile) mostlyclean-local" distclean-local: @echo "(src/base/Makefile) distclean-local" dist-hook: @echo "(src/base/Makefile) dist-hook" # Intermediate Library noinst_LTLIBRARIES = libbase.la libbase_la_SOURCES = \ base_init.c \ build_info.c \ core.c \ ddc_errno.c \ ddc_packets.c \ displays.c \ execution_stats.c \ feature_sets.c \ linux_errno.c \ sleep.c \ status_code_mgt.c \ vcp_version.c ddcutil-0.8.6/src/base/Makefile.in0000644000175000001440000005446313230171237013653 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ # AM_CFLAGS += -Wpedantic @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand subdir = src/base ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbase_la_LIBADD = am_libbase_la_OBJECTS = base_init.lo build_info.lo core.lo \ ddc_errno.lo ddc_packets.lo displays.lo execution_stats.lo \ feature_sets.lo linux_errno.lo sleep.lo status_code_mgt.lo \ vcp_version.lo libbase_la_OBJECTS = $(am_libbase_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libbase_la_SOURCES) DIST_SOURCES = $(libbase_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall -Werror $(am__append_1) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libbase.la libbase_la_SOURCES = \ base_init.c \ build_info.c \ core.c \ ddc_errno.c \ ddc_packets.c \ displays.c \ execution_stats.c \ feature_sets.c \ linux_errno.c \ sleep.c \ status_code_mgt.c \ vcp_version.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/base/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/base/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libbase.la: $(libbase_la_OBJECTS) $(libbase_la_DEPENDENCIES) $(EXTRA_libbase_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libbase_la_OBJECTS) $(libbase_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base_init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/build_info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_errno.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_packets.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/displays.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/execution_stats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/feature_sets.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_errno.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status_code_mgt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcp_version.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am dist-hook distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am .PRECIOUS: Makefile clean-local: @echo "(src/base/Makefile) clean-local" mostlyclean-local: @echo "(src/base/Makefile) mostlyclean-local" distclean-local: @echo "(src/base/Makefile) distclean-local" dist-hook: @echo "(src/base/Makefile) dist-hook" # 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: ddcutil-0.8.6/src/base/base_init.c0000644000175000001440000000263513224450200013672 00000000000000/** @file base_init.c * Master base services initialization */ /* * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include "util/error_info.h" #include "core.h" #include "ddc_packets.h" #include "displays.h" #include "execution_stats.h" #include "linux_errno.h" #include "sleep.h" #include "base_init.h" /** Master initialization function for files in subdirectory base */ void init_base_services() { init_msg_control(); errinfo_init(psc_name, psc_desc); init_sleep_stats(); init_execution_stats(); init_status_code_mgt(); // init_linux_errno(); init_displays(); } ddcutil-0.8.6/src/base/build_info.c0000644000175000001440000000260513215627625014065 00000000000000/** \file build_info.c * * Build Information: version, build timestamp, etc. */ /* build_info.c * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include "base/build_info.h" const char * BUILD_VERSION = VERSION; /**< ddcutil version */ // TODO: patch dummy values at link time // const char * BUILD_DATE = __DATE__; const char * BUILD_DATE = "mmm dd yyyy"; /**< build date, to be patched at link time */ // const char * BUILD_TIME = __TIME__; const char * BUILD_TIME = "hh:mm:ss"; /**< build time, to be patched at link time */ ddcutil-0.8.6/src/base/core.c0000644000175000001440000007153513226122434012701 00000000000000/** @file core.c * Core functions and global variables. * * File core.c provides a collection of inter-dependent services at the core * of the **ddcutil** application. * * These include * - message destination redirection * - abnormal termination * - standard function call options * - timestamp generation * - message level control * - debug and trace messages */ /* core.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ //* \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "util/data_structures.h" #include "util/debug_util.h" #include "util/file_util.h" #include "util/glib_util.h" #include "util/glib_string_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/timestamp.h" #include "base/ddc_errno.h" #include "base/linux_errno.h" #include "base/core.h" // // Global SDTOUT and STDERR redirection, for controlling message output in API // /** @defgroup output_redirection Basic Output Redirection */ /** Current stream for normal output. * * @remark * Will be NULL until init_msg_control() is called. * Be careful during program initialization. * * @ingroup output_redirection */ FILE * FOUT = NULL; /** Current stream for error messages. * * @remark * Will be NULL until init_msg_control() is called. * Be careful during program initialization. * * @ingroup output_redirection */ FILE * FERR = NULL; #ifdef OVERKILL #define FOUT_STACK_SIZE 8 static FILE* fout_stack[FOUT_STACK_SIZE]; static int fout_stack_pos = -1; #endif /** Initialize **stdout** and **stderr** redirection. * * Must be called during program initialization. * * @ingroup output_redirection */ void init_msg_control() { FOUT = stdout; FERR = stderr; } // issue: how to specify that output should be discarded vs reset to stdout? // issue will resetting report dest cause conflicts? // To reset to STDOUT, use constant stdout in stdio.h - NO - screws up rpt_util // problem: /** Redirect output that would normally go to **stdout**. * * @param fout pointer to output stream * * @ingroup output_redirection */ void set_fout(FILE * fout) { bool debug = false; DBGMSF(debug, "fout = %p", fout); FOUT = fout; rpt_change_output_dest(fout); } /** Redirect output that would normally go to **stdout** back to **stdout**. * @ingroup output_redirection */ void set_fout_to_default() { FOUT = stdout; rpt_change_output_dest(stdout); } /** Redirect output that would normally go to **stderr**.. * * @param ferr pointer to output stream * @ingroup output_redirection */ void set_ferr(FILE * ferr) { FERR = ferr; } /** Redirect output that would normally go to **stderr** back to **stderr**. * @ingroup output_redirection */ void set_ferr_to_default() { FERR = stderr; } #ifdef OVERKILL // Functions that allow for temporarily changing the output destination. void push_fout(FILE* new_dest) { assert(fout_stack_pos < FOUT_STACK_SIZE-1); fout_stack[++fout_stack_pos] = new_dest; } void pop_fout() { if (fout_stack_pos >= 0) fout_stack_pos--; } void reset_fout_stack() { fout_stack_pos = 0; } FILE * cur_fout() { // special handling for unpushed case because can't statically initialize // output_dest_stack[0] to stdout return (fout_stack_pos < 0) ? stdout : fout_stack[fout_stack_pos]; } #endif // // Global error return // #ifdef OBSOLETE /** @defgroup abnormal_termination Abnormal Termination * */ static jmp_buf* global_abort_jmp_buf_ptr = NULL; // It's an error handler. Do not dynamically allocate DDCA_Global_Failure_Information global_failure_information = {0}; /** Registers the longjmp() target with the **ddcutil** library. * * @param jb pointer to jmp_buf * * @ingroup abnormal_termination */ void register_jmp_buf(jmp_buf* jb) { DBGMSG("setting global_abort_jmp_buf_ptr = %p", jb); global_abort_jmp_buf_ptr = jb; } #endif #ifdef UNUSED // currently unused, iftest out to avoid rpmlint complaint about exit from library /** Primary function for terminating **ddcutil** execution * due to an internal error. * * If a longjump jump buffer has been registered, basic error information * is stored in buffer global_failure_information, and longjmp() is called. * Otherwise, exit() is called. * * @param funcname function name of error * @param lineno line number of error * @param fn file name of error * @param status status code * * @ingroup abnormal_termination */ /* coverity [+kill] avoid coverity memory leak warnings */ void ddc_abort( const char * funcname, const int lineno, const char * fn, int status) { show_backtrace(2); #ifdef OBSOLETE DBGMSG("global_abort_jmp_buf_ptr = %p", global_abort_jmp_buf_ptr); if (global_abort_jmp_buf_ptr) { // save failure information in case it's of use at longjmp() return global_failure_information.info_set_fg = true; global_failure_information.status = status; g_strlcpy(global_failure_information.funcname, funcname, sizeof(global_failure_information.funcname)); global_failure_information.lineno = lineno; g_strlcpy(global_failure_information.fn, fn, sizeof(global_failure_information.fn)); longjmp(*global_abort_jmp_buf_ptr, status); } else { #endif // no point setting global_failure_information, we're outta here f0puts("Terminating execution.\n", FERR); exit(EXIT_FAILURE); // or return status? #ifdef OBSOLETE } #endif } #endif // // Standard call options // Value_Name_Table callopt_bitname_table2 = { VN(CALLOPT_ERR_MSG), // VN(CALLOPT_ERR_ABORT), VN(CALLOPT_RDONLY), VN(CALLOPT_WARN_FINDEX), VN(CALLOPT_FORCE), VN(CALLOPT_NONE), // special entry VN_END }; #ifdef OLD /** Interprets a **Call_Options** byte as a printable string. * The returned value is valid until the next call of this function. * * @param calloptions **Call_Options** byte * * @return interpreted value */ char * interpret_call_options(Call_Options calloptions) { static char * buffer = NULL; if (buffer) { free(buffer); buffer = NULL; } buffer = vnt_interpret_flags(calloptions, callopt_bitname_table2, false, "|"); return buffer; } #endif /** Thread safe version of **interpret_call_options()**. * * Interprets a **Call_Options** byte as a printable string. * The returned value is valid until the next call of this function in * the current thread. * * @param calloptions **Call_Options** byte * * @return interpreted value */ char * interpret_call_options_t(Call_Options calloptions) { static GPrivate callopts_buf_key = G_PRIVATE_INIT(g_free); char * buf = g_private_get(&callopts_buf_key); // GThread * this_thread = g_thread_self(); // printf("(%s) this_thread=%p, callopts_buf_key=%p, buf=%p\n", // __func__, this_thread, &callopts_buf_key, buf); if (!buf) { buf = g_new(char, 200); g_private_set(&callopts_buf_key, buf); } char * buftemp = vnt_interpret_flags(calloptions, callopt_bitname_table2, false, "|"); g_strlcpy(buf, buftemp, 200); free(buftemp); return buf; } #ifdef UNUSED char * interpret_call_options_a(Call_Options calloptions) { char * buffer = vnt_interpret_flags(calloptions, callopt_bitname_table2, false, "|"); return buffer; } #endif // Local definitions and functions shared by all message control categories #define SHOW_REPORTING_TITLE_START 0 #define SHOW_REPORTING_MIN_TITLE_SIZE 28 static void print_simple_title_value(int offset_start_to_title, char * title, int offset_title_start_to_value, char * value) { f0printf(FOUT, "%.*s%-*s%s\n", offset_start_to_title,"", offset_title_start_to_value, title, value); } // // Message level control for normal output // /** \defgroup msglevel Message Level Management * * Functions and variables to manage and query output level settings. */ static DDCA_Output_Level output_level; /** Gets the current output level. * * @return output level * * \ingroup msglevel */ DDCA_Output_Level get_output_level() { return output_level; } /** Sets the output level. * * @param newval output level to set * * \ingroup msglevel */ void set_output_level(DDCA_Output_Level newval) { // printf("(%s) newval=%s \n", __func__, msgLevelName(newval) ); output_level = newval; } /** Gets the printable name of an output level. * * @param val output level * @return printable name for output level * * \ingroup msglevel */ char * output_level_name(DDCA_Output_Level val) { char * result = NULL; switch (val) { case DDCA_OL_TERSE: result = "Terse"; break; case DDCA_OL_NORMAL: result = "Normal"; break; case DDCA_OL_VERBOSE: result = "Verbose"; break; // default unnecessary, case exhausts enum } // printf("(%s) val=%d 0x%02x, returning: %s\n", __func__, val, val, result); return result; } /** Reports the current output level. * The report is written to the current **FOUT** device. * * \ingroup msglevel */ void show_output_level() { // printf("Output level: %s\n", output_level_name(output_level)); print_simple_title_value(SHOW_REPORTING_TITLE_START, "Output level: ", SHOW_REPORTING_MIN_TITLE_SIZE, output_level_name(output_level)); } // // Debug and trace message control // /** defgroup dbgtrace Debug and Trace Messages * */ bool dbgtrc_show_time = false; ///< include elapsed time in debug/trace output static Value_Name_Title_Table trace_group_table = { VNT(TRC_BASE, "BASE"), VNT(TRC_I2C, "I2C"), #ifdef HAVE_ADL VNT(TRC_ADL, "ADL"), #endif VNT(TRC_DDC, "DDC"), VNT(TRC_USB, "USB"), VNT(TRC_TOP, "TOP"), VNT(TRC_ENV, "ENV"), VNT_END }; const int trace_group_ct = ARRAY_SIZE(trace_group_table)-1; /** Given a trace group name, returns its identifier. * Case is ignored. * * @param name trace group name * @return trace group identifier * @retval TRC_NEVER unrecognized name * * /ingroup dbgtrace */ Trace_Group trace_class_name_to_value(char * name) { return (Trace_Group) vnt_find_id( trace_group_table, name, true, // search title field true, // ignore-case TRC_NEVER); } static Byte trace_levels = TRC_NEVER; // 0x00 /** Specifies the trace groups to be traced. * * @param trace_flags bit flags indicating groups to trace * * @ingroup dbgtrace */ void set_trace_levels(Trace_Group trace_flags) { bool debug = false; DBGMSF(debug, "trace_flags=0x%02x\n", trace_flags); trace_levels = trace_flags; } // traced_function_table and traced_file_table were initially implemented using // GHashTable. The implementation had bugs, and given that (a) these data structures // are used only for testing and (b) there will be at most a handful of entries in the // tables, a simpler GPtrArray implementation is used. static GPtrArray * traced_function_table = NULL; static GPtrArray * traced_file_table = NULL; /** Adds a function to the list of functions to be traced. * * @param funcname function name */ void add_traced_function(const char * funcname) { // printf("(%s) funcname=|%s|\n", __func__, funcname); if (!traced_function_table) traced_function_table = g_ptr_array_new(); // n. g_ptr_array_find_with_equal_func() requires glib 2.54 if (gaux_string_ptr_array_find(traced_function_table, funcname) < 0) g_ptr_array_add(traced_function_table, g_strdup(funcname)); } /** Adds a file to the list of files to be traced. * * @param filename file name * * @remark * Only the basename portion of the specified file name is used. * @remark * If the file name does not end in ".c", that suffix is appended. */ void add_traced_file(const char * filename) { if (!traced_file_table) traced_file_table = g_ptr_array_new(); // n. g_ptr_array_find_with_equal_func() requires glib 2.54 gchar * bname = g_path_get_basename(filename); if (!str_ends_with(bname, ".c")) { int newsz = strlen(bname) + 2 + 1; gchar * temp = calloc(1, newsz); strcpy(temp, bname); strcat(temp, ".c"); free(bname); bname = temp; } if (gaux_string_ptr_array_find(traced_file_table, bname) < 0) g_ptr_array_add(traced_file_table, bname); else free(bname); // printf("(%s) filename=|%s|, bname=|%s|, found=%s\n", __func__, filename, bname, bool_repr(found)); } /** Checks if a function is being traced. * * @param funcname function name * @return **true** if the function is being traced, **false** if not */ bool is_traced_function(const char * funcname) { bool result = (traced_function_table && gaux_string_ptr_array_find(traced_function_table, funcname) >= 0); // printf("(%s) funcname=|%s|, returning: %s\n", __func__, funcname, bool_repr(result2)); return result; } /** Checks if a file is being traced. * * @param filename file name * @return **true** if trace is enabled for all functions in the file, **false** if not */ bool is_traced_file(const char * filename) { char * bname = g_path_get_basename(filename); bool result = (traced_file_table && gaux_string_ptr_array_find(traced_file_table, bname) >= 0); // printf("(%s) filename=|%s|, bname=|%s|, returning: %s\n", __func__, filename, bname, bool_repr(result)); free(bname); return result; } static char * get_traced_functions_as_joined_string() { char * result = NULL; if (traced_function_table) { g_ptr_array_sort(traced_function_table, gaux_ptr_scomp); result = join_string_g_ptr_array(traced_function_table, ", "); } return result; } static char * get_traced_files_as_joined_string() { char * result = NULL; if (traced_file_table) { g_ptr_array_sort(traced_file_table, gaux_ptr_scomp); result = join_string_g_ptr_array(traced_file_table, ", "); } return result; } /** Outputs a line reporting the traced function list. * Output is written to the current **FOUT** device. */ void show_traced_functions() { char * buf = get_traced_functions_as_joined_string(); print_simple_title_value(SHOW_REPORTING_TITLE_START, "Traced functions: ", SHOW_REPORTING_MIN_TITLE_SIZE, (buf && (strlen(buf) > 0)) ? buf : "none"); free(buf); } /** Outputs a line reporting the traced file list. * Output is written to the current **FOUT** device. */ void show_traced_files() { char * buf = get_traced_files_as_joined_string(); print_simple_title_value(SHOW_REPORTING_TITLE_START, "Traced files: ", SHOW_REPORTING_MIN_TITLE_SIZE, (buf && (strlen(buf) > 0)) ? buf : "none"); free(buf); } /** Checks if a tracing is to be performed. * * Tracing is enabled if any of the following tests pass: * - trace group * - file name * - function name * * @param trace_group group to check * @param filename file from which check is occurring (not currently used) * @param funcname function name * * @return **true** if tracing enabled, **false** if not * * @remark * - Multiple trace group bits can be set in **trace_group**. If any of those * group are currently being traced, the function returns **true**. That is, * a given trace location in the code can be activated by multiple trace groups. * - If trace_group == TRC_ALWAYS (0xff), the function returns **true**. * Commonly, if debugging is active in a given location, the trace_group value * being checked can be set to TRC_ALWAYS, so a site can have a single debug/trace * function call. * * @ingroup dbgtrace * */ bool is_tracing(Trace_Group trace_group, const char * filename, const char * funcname) { bool result = (trace_group == 0xff) || (trace_levels & trace_group); // is trace_group being traced? result = result || is_traced_function(funcname) || is_traced_file(filename); // printf("(%s) trace_group = %02x, filename=%s, funcname=%s, traceLevels=0x%02x, returning %d\n", // __func__, trace_group, filename, funcname, trace_levels, result); return result; } /** Outputs a line reporting the active trace groups. * Output is written to the current **FOUT** device. */ void show_trace_groups() { char * buf = vnt_interpret_flags(trace_levels, trace_group_table, true /* use title */, ", "); print_simple_title_value(SHOW_REPORTING_TITLE_START, "Trace groups active: ", SHOW_REPORTING_MIN_TITLE_SIZE, (strlen(buf) == 0) ? "none" : buf); free(buf); } // // Error_Info reporting // /** If true, report #Error_Info instances before they are freed. */ bool report_freed_exceptions = false; // // Report DDC data errors // // global variable - controls display of messages regarding DDC data errors bool report_ddc_errors = true; /** Checks if DDC data errors are to be reported. This is the case if any of the * following hold: * - DDC error reporting has been explicitly enabled * - The trace group specified by the calling function is currently active. * - The value of **trace_group** is 0xff, which is the convention used for debug messages * - The file name specified is currently being traced * - The function name specified is currently being traced. * * @param trace_group trace group of caller, if 0xff then always output * @param filename file name to check * @param funcname function name to check * @return **true** if message is to be output, **false** if not * * @remark * This function is normally wrapped in function **IS_REPORTING_DDC()** */ bool is_reporting_ddc(Trace_Group trace_group, const char * filename, const char * funcname) { bool result = (is_tracing(trace_group,filename, funcname) || report_ddc_errors); return result; } /* Submits a message regarding a DDC data error for possible output. * * @param trace_group group to check, 0xff to always output * @param funcname function name to check * @param lineno line number in file * @param filename file name to check * @param format message format string * @param ... arguments for message format string * * @return **true** if message was output, **false** if not * * Normally, invocation of this function is wrapped in macro DDCMSG. */ bool ddcmsg(Trace_Group trace_group, const char * funcname, const int lineno, const char * filename, char * format, ...) { bool result = false; bool debug_or_trace = is_tracing(trace_group, filename, funcname); if (debug_or_trace || report_ddc_errors) { result = true; char buffer[200]; va_list(args); va_start(args, format); vsnprintf(buffer, 200, format, args); if (debug_or_trace) f0printf(FOUT, "(%s) DDC: %s\n", funcname, buffer); else f0printf(FOUT, "DDC: %s\n", buffer); va_end(args); } return result; } /** Tells whether DDC data errors are reported. * Output is writtent to the current **FOUT** device. */ void show_ddcmsg() { print_simple_title_value(SHOW_REPORTING_TITLE_START, "Reporting DDC data errors: ", SHOW_REPORTING_MIN_TITLE_SIZE, bool_repr(report_ddc_errors)); } /** Reports output levels for: * - general output level (terse, verbose, etc) * - DDC data errors * - trace groups * - traced functions * - traced files * * Output is written to the current **FOUT** device. */ void show_reporting() { show_output_level(); show_ddcmsg(); show_trace_groups(); show_traced_functions(); show_traced_files(); // f0puts("", FOUT); } // // Issue messages of various types // /** Issues an error message. * The message is written to the current FERR device. * * @param funcname function name of caller * @param lineno line number in caller * @param filename file name of caller * @param format format string for message * @param ... arguments for format string * * @remark * This function cannot map to dbgtrc(), since it writes to stderr, not stdout * @remark * n. used within macro **LOADFUNC** of adl_intf.c */ void severemsg( const char * funcname, const int lineno, const char * filename, char * format, ...) { char buffer[200]; char buf2[250]; va_list(args); va_start(args, format); vsnprintf(buffer, 200, format, args); snprintf(buf2, 250, "(%s) %s\n", funcname, buffer); f0puts(buf2, FERR); va_end(args); } /** Core function for emitting debug or trace messages. * Normally wrapped in a DBGMSG or TRCMSG macro to simplify calling. * * The message is output if any of the following are true: * - the trace_group specified is currently active * - the value is trace group is 0xff * - funcname is the name of a function being traced * - filename is the name of a file being traced * * @param trace_group trace group of caller, 0xff to always output * @param funcname function name of caller * @param lineno line number in caller * @param filename file name of caller * @param format format string for message * @param ... arguments for format string * * @return **true** if message was output, **false** if not */ bool dbgtrc( Trace_Group trace_group, const char * funcname, const int lineno, const char * filename, char * format, ...) { static char * buffer = NULL; static int bufsz = 200; // initial value static char * buf2 = NULL; if (!buffer) { // first call buffer = calloc(bufsz, sizeof(char)); buf2 = calloc(bufsz+60, sizeof(char)); } bool msg_emitted = false; if ( is_tracing(trace_group, filename, funcname) ) { va_list(args); va_start(args, format); int ct = vsnprintf(buffer, bufsz, format, args); va_end(args); if (ct >= bufsz) { // if buffer too small, reallocate free(buffer); free(buf2); bufsz = ct+1; buffer = calloc(bufsz, sizeof(char)); buf2 = calloc(bufsz+50, sizeof(char)); va_list(args); va_start(args, format); ct = vsnprintf(buffer, bufsz, format, args); assert(ct < bufsz); va_end(args); } if (dbgtrc_show_time) snprintf(buf2, bufsz+60, "[%s](%s) %s\n", formatted_elapsed_time(), funcname, buffer); else snprintf(buf2, bufsz+60, "(%s) %s\n", funcname, buffer); f0puts(buf2, FOUT); // no automatic terminating null msg_emitted = true; } return msg_emitted; } // // Standardized handling of exceptional conditions, including // error messages and possible program termination. // #ifdef OLD /* Report an IOCTL error and possibly terminate execution. * * Arguments: * errnum errno value * funcname function name of error * lineno line number of error * filename file name of error * fatal if true, terminate execution * * Returns: nothing */ void report_ioctl_error_old( int errnum, const char* funcname, // const to avoid warning msg on references at compile time int lineno, char* filename, bool fatal) { int errsv = errno; f0printf(FERR, "ioctl error in function %s at line %d in file %s: errno=%s\n", funcname, lineno, filename, linux_errno_desc(errnum) ); // not worth the linkage issues: // fprintf(stderr, " %s\n", explain_errno_ioctl(errnum, filedes, request, data)); if (fatal) { ddc_abort(funcname, lineno, filename, DDCL_INTERNAL_ERROR); } errno = errsv; } #endif /** Reports an IOCTL error. * The message is written to the current **FERR** device. * * @param ioctl_name ioctl name * @param errnum errno value * @param funcname function name of error * @param filename file name of error * @param lineno line number of error */ void report_ioctl_error( const char * ioctl_name, int errnum, const char * funcname, const char * filename, int lineno) { int errsv = errno; f0printf(FERR, "(%s) Error in ioctl(%s), errno=%s\n", funcname, ioctl_name, linux_errno_desc(errnum) ); errno = errsv; } /** Called when a condition that should be impossible has been detected. * Issues messages to the current FERR device. * * This function is normally invoked using macro PROGRAM_LOGIC_ERROR() * * @param funcname function name * @param lineno line number in source file * @param fn source file name * @param format format string, as in printf() * @param ... one or more substitution values for the format string * * @ingroup output_redirection */ void program_logic_error( const char * funcname, const int lineno, const char * fn, char * format, ...) { // assemble the error message char buffer[200]; va_list(args); va_start(args, format); vsnprintf(buffer, 200, format, args); va_end(args); // assemble the location message: char buf2[250]; snprintf(buf2, 250, "Program logic error in function %s at line %d in file %s:\n", funcname, lineno, fn); // don't combine into 1 line, might be very long. just output 2 lines: f0puts(buf2, FERR); f0puts(buffer, FERR); f0puts("\n", FERR); } #ifdef UNUSED /** Called when a condition that should be impossible has been detected. * Issues messages to **stderr** and terminates execution. * * This function is normally invoked using macro PROGRAM_LOGIC_ERROR() * * @param funcname function name * @param lineno line number in source file * @param fn source file name * @param format format string, as in printf() * @param ... one or more substitution values for the format string * * @ingroup output_redirection */ void program_logic_error_fatal( const char * funcname, const int lineno, const char * fn, char * format, ...) { // assemble the error message char buffer[200]; va_list(args); va_start(args, format); vsnprintf(buffer, 200, format, args); // assemble the location message: char buf2[250]; snprintf(buf2, 250, "Program logic error in function %s at line %d in file %s:\n", funcname, lineno, fn); // don't combine into 1 line, might be very long. just output 2 lines: f0puts(buf2, FERR); f0puts(buffer, FERR); f0puts("\n", FERR); // fputs("Terminating execution.\n", stderr); ddc_abort(funcname, lineno, fn, DDCL_INTERNAL_ERROR); } #endif #ifdef UNUSED /** This function is called to terminate execution on a fatal error. * * It is normally wrapped in macro TERMINATE_EXECUTION_ON_ERROR(format,...) * * @param trace_group trace group for function where error occurred * @param funcname function name * @param lineno line number * @param filename file name * @param format printf() style format string * @param ... arguments for format string * * @ingroup output_redirection */ void terminate_execution_on_error( Trace_Group trace_group, const char * funcname, const int lineno, const char * filename, char * format, ...) { char buffer[200]; char buf2[250]; char * finalBuffer = buffer; va_list(args); va_start(args, format); vsnprintf(buffer, 200, format, args); if ( is_tracing(trace_group, filename, funcname) ) { snprintf(buf2, 250, "(%s) %s", funcname, buffer); finalBuffer = buf2; } f0puts(finalBuffer, FERR); f0puts("\n", FERR); ddc_abort(funcname, lineno, filename, DDCL_INTERNAL_ERROR); } #endif ddcutil-0.8.6/src/base/ddc_errno.c0000644000175000001440000002067713107075377013724 00000000000000/* ddc_errno.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Error codes internal to **ddcutil**. */ /** \cond */ #include #include /** \endcond */ #include "util/string_util.h" #include "base/ddc_errno.h" // // DDCRC status code descriptions // // TODO: Consider modifying EDENTRY generate doxygen comment as well using description field #define EDENTRY(id,desc) {id, #id, desc} // DDCRC_DOUBLE_BYTE probably not worth keeping, can only reliably check for // small subset of DDCRC_PACKET_SIZE, DDCRC_RESPONSE_ENVELOPE, DDCRC_CHECKSUM static Status_Code_Info ddcrc_info[] = { EDENTRY(DDCRC_OK , "success" ), EDENTRY(DDCRC_PACKET_SIZE , "packet data field too large" ), EDENTRY(DDCRC_RESPONSE_ENVELOPE , "invalid source address in reply packet"), EDENTRY(DDCRC_CHECKSUM , "checksum error" ), EDENTRY(DDCRC_RESPONSE_TYPE , "incorrect response type" ), EDENTRY(DDCRC_INVALID_DATA , "error parsing data bytes" ), EDENTRY(DDCRC_NULL_RESPONSE , "received DDC null response" ), EDENTRY(DDCRC_MULTI_PART_READ_FRAGMENT , "error in fragment" ), EDENTRY(DDCRC_ALL_TRIES_ZERO , "every try response 0x00" ), // applies to multi-try exchange EDENTRY(DDCRC_DOUBLE_BYTE , "duplicated byte in response" ), EDENTRY(DDCRC_REPORTED_UNSUPPORTED , "DDC reports facility unsupported" ), EDENTRY(DDCRC_READ_ALL_ZERO , "packet contents entirely 0x00" ), EDENTRY(DDCRC_BAD_BYTECT , "wrong number of bytes in DDC response" ), EDENTRY(DDCRC_READ_EQUALS_WRITE , "response identical to request" ), EDENTRY(DDCRC_INVALID_MODE , "invalid read or write mode" ), EDENTRY(DDCRC_RETRIES , "maximum retries exceeded" ), EDENTRY(DDCRC_EDID , "invalid EDID" ), EDENTRY(DDCRC_DETERMINED_UNSUPPORTED , "ddcutil determined that facility unsupported" ), // library errors EDENTRY(DDCL_ARG , "illegal argument"), EDENTRY(DDCL_UNIMPLEMENTED , "unimplemented"), EDENTRY(DDCL_UNINITIALIZED , "library uninitialized"), EDENTRY(DDCL_UNKNOWN_FEATURE , "feature not in feature table"), EDENTRY(DDCRC_INTERPRETATION_FAILED , "feature value interpretation function failed"), EDENTRY(DDCRC_MULTI_FEATURE_ERROR , "at least 1 error occurred on a multi-feature request"), EDENTRY(DDCRC_INVALID_DISPLAY , "invalid display"), EDENTRY(DDCL_INTERNAL_ERROR , "fatal error condition"), EDENTRY(DDCL_OTHER , "other error"), // for use during development EDENTRY(DDCRC_VERIFY , "VCP read after write failed"), EDENTRY(DDCRC_NOT_FOUND , "not found"), EDENTRY(DDCRC_ALL_RESPONSES_NULL , "all tries returned DDC Null Message"), }; #undef EDENTRY static int ddcrc_desc_ct = sizeof(ddcrc_info)/sizeof(Status_Code_Info); /** Returns the #Status_Code_Info struct for a **ddcutil** status code. * * @param rc ddcutil status code * @return pointer to #Status_Code_Info, NULL if not found * * @remark * Returns a pointer into a struct compiled into the executable. * Do not deallocate. * @remark * **ddcutil** status codes are always modulated. */ Status_Code_Info * ddcrc_find_status_code_info(int rc) { Status_Code_Info * result = NULL; int ndx; for (ndx=0; ndx < ddcrc_desc_ct; ndx++) { if (rc == ddcrc_info[ndx].code) { result = &ddcrc_info[ndx]; break; } } return result; } /* Status code classification DDCRC_NULL_RESPONSE DDCRC_ALL_TRIES_ZERO DDCRC_REPORTED_UNSUPPORTED DDCRC_DETERMINED_UNSUPPORTED DDCRC_REPORTED_UNSUPPORTED is a primary error, but reports a state, not really an error Derived codes are set after function has examined a primary code Do not count as DDC errors. Derived: DDCRC_ALL_TRIES_ZERO DDCRC_RETRIES DDCRC_DETERMINED_UNSUPPORTED DDCRC NULL_RESPONSE is ambiguous can be expected (DDC detection) no answer to give, e.g. because not ready, not expected (protocol error) but also is used by some monitors to indicate invalid request (e.g. unsupported VCP code) All others indicate real, primary errors Issues: - DDCRC_REPORTED_UNSUPPORTED should not be a fatal failure in try_stats, it is a successful try, it's just that the response is "unsupported" * */ /** Certain **ddcutil** status codes (e.g. DDCRC_DETERMINED_UNSUPPORTED) * are "derived" at higher levels from primary **ddcutil** status codes * in lower level routines. These should be excluded from certain error * counts as otherwise an error would be double counted. * * @param gsc status code * @return true/false */ bool ddcrc_is_derived_status_code(Public_Status_Code gsc) { return (gsc == DDCRC_ALL_TRIES_ZERO || gsc == DDCRC_RETRIES || gsc == DDCRC_DETERMINED_UNSUPPORTED ); } /** Certain **ddcutil** status codes, (e.g. DDCRC_REPORTED_UNSUPPORTED) * report states that should not be considered to be DDC protocol errors. */ bool ddcrc_is_not_error(Public_Status_Code gsc) { return (gsc == DDCRC_REPORTED_UNSUPPORTED); } /* Returns a sting description of a **ddcutil** status code that is * intended for use in error messages. * * @param rc ddcutil status code * @return status code description * * @remark * The result is built in an internal buffer. The contents will be * valid until the next call to this function. * @remark * A generic message is returned if the status code is unrecognized. */ char * ddcrc_desc(int rc) { static char workbuf[200]; // char * result = NULL; Status_Code_Info * pdesc = ddcrc_find_status_code_info(rc); if (pdesc) { snprintf(workbuf, 200, "%s(%d): %s", pdesc->name, rc, pdesc->description); } else { snprintf(workbuf, 200, "Unexpected status code %d", rc); } // result = workbuf; // return result; return workbuf; } /** Gets the (unmodulated) ddcutil error number for a symbolic name. * * @param error_name symbolic name, e.g. DDCRC_CHECKSUM * @param p_errnum where to return error number * * Returns: true if found, false if not * * @remark * Since **ddcutil** specific error numbers are always modulated, * the return value for this function is always identical to * ddc_error_name_to_modulated_number(). */ bool ddc_error_name_to_number(const char * error_name, Status_DDC * p_errnum) { int found = false; *p_errnum = 0; for (int ndx = 0; ndx < ddcrc_desc_ct; ndx++) { if ( streq(ddcrc_info[ndx].name, error_name) ) { *p_errnum = ddcrc_info[ndx].code; found = true; break; } } return found; } #ifdef OLD /** Gets the (modulated) ddcutil error number for a symbolic name. * * @param error_name symbolic name, e.g. DDCRC_CHECKSUM * @param p_errnum where to return error number * * Returns: true if found, false if not * * @remark * Since **ddcutil** specific error numbers are always modulated, * the return value for this function is always identical to * ddc_error_name_to_number(). */ bool ddc_error_name_to_modulated_number( const char * error_name, Global_Status_Code * p_errnum) { int result = 0; bool found = ddc_error_name_to_number(error_name, &result); assert(result <= 0); // ddcutil error numbers are already modulated *p_errnum = result; return found; } #endif ddcutil-0.8.6/src/base/ddc_packets.c0000644000175000001440000011407213222770601014210 00000000000000/* ddc_packets.c * * Functions for creating DDC packets and interpreting DDC response packets. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Functions for creating DDC packets and interpreting DDC response packets. */ /** \cond */ #include #include #include #include #include #include "util/report_util.h" #include "util/string_util.h" #include "util/utilrpt.h" /** \endcond */ #include "base/ddc_errno.h" #include "base/execution_stats.h" #include "base/ddc_packets.h" // // Trace control // Trace_Group TRACE_GROUP = TRC_DDC; // // Utilities // /* Tests if a byte is equal to the preceding byte * * Arguments: pb pointer to byte (test this byte and *(pb-1) * * Returns: * true/false */ bool is_double_byte(Byte * pb) { Byte * pb0 = pb-1; // DBGMSG("pb=%p, pb0=%p, *pb=0x%02x *pb0=0x%02x ", pb, pb0, *pb, *pb0 ); bool result = (*pb == *pb0); // DBGMSG("Returning: %d ", result ); return result; } // // Checksums // #ifdef OLD Byte xor_bytes(Byte * bytes, int len) { Byte result = 0x00; int ndx; for (ndx=0; ndx < len; ndx++) { result = result ^ bytes[ndx]; } return result; } #endif Byte ddc_checksum(Byte * bytes, int len, bool altmode) { // DBGMSG("bytes=%p, len=%d, altmode=%d", bytes, len, altmode); // largest packet is capabilities fragment, which can have up to 32 bytes of text, // plus 4 bytes of offset data. Adding this to the dest, src, and len bytes is 39 // assert(len <= MAX_DDC_PACKET_WO_CHECKSUM); // no longer needed, not allocating work buffer assert(len >= 1); Byte checksum = bytes[0]; if (altmode) checksum = 0x50; for (int ndx = 1; ndx < len; ndx++) { checksum ^= bytes[ndx]; } // assert(checksum == ddc_checksum_old(bytes, len, altmode)); return checksum; } void test_one_checksum(Byte * bytes, int len, bool altmode, Byte expected, char * spec_section) { unsigned char actual = ddc_checksum(bytes, len, altmode); char * hs = hexstring(bytes, len); printf( "bytes=%s, altmode=%d, expected=0x%02x, actual=0x%02x, spec section=%s\n", hs, altmode, expected, actual, spec_section ); free(hs); } void test_checksum() { puts("\ntest_checksum\n"); Byte bytes[] = {0x6e, 0x51, 0x82, 0xf5, 0x01}; test_one_checksum( bytes, 5, false, 0x49, "6.2" ); test_one_checksum( (Byte[]) {0x6e, 0x51, 0x81, 0xb1}, 4, false, 0x0f, "6.3" ); test_one_checksum( (Byte[]) {0x6f, 0x6e, 0x82, 0xa1, 0x00}, 5, true, 0x1d, "6.3" ); test_one_checksum( (Byte[]) {0x6f, 0x6e, 0x80}, 3, true, 0xbe, "6.4" ); test_one_checksum( (Byte[]) {0xf0, 0xf1, 0x81, 0xb1}, 4, false, 0x31, "7.4" ); test_one_checksum( (Byte[]) {0x6e, 0xf1, 0x81, 0xb1}, 4, false, 0xaf, "7.4" ); test_one_checksum( (Byte[]) {0xf1, 0xf0, 0x82, 0xa1, 0x00}, 5, true, 0x83, "7.4"); test_one_checksum( (Byte[]) {0x6f, 0xf0, 0x82, 0xa1, 0x00}, 5, true, 0x83, "7.4"); } bool valid_ddc_packet_checksum(Byte * readbuf) { bool debug = false; bool result = false; int data_size = (readbuf[2] & 0x7f); if (data_size > MAX_DDCCI_PACKET_SIZE) { // correct constant? DDCMSG(debug, "Invalid data_size = %d", data_size); } else { int response_size_wo_checksum = 3 + data_size; readbuf[1] = 0x51; // dangerous unsigned char expected_checksum = ddc_checksum(readbuf, response_size_wo_checksum, false); unsigned char actual_checksum = readbuf[response_size_wo_checksum]; DBGMSF(debug, "actual checksum = 0x%02x, expected = 0x%02x", actual_checksum, expected_checksum); result = (expected_checksum == actual_checksum); } DBGMSF(debug, "Returning: %d", result); return result; } // // Packet general functions // Byte * get_packet_start(DDC_Packet * packet) { Byte * result = NULL; if (packet) result = packet->raw_bytes->bytes; return result; } int get_packet_len(DDC_Packet * packet) { return (packet) ? packet->raw_bytes->len : 0; } int get_data_len(DDC_Packet * packet) { return (packet) ? packet->raw_bytes->len - 4 : 0; } Byte * get_data_start(DDC_Packet * packet) { return (packet) ? packet->raw_bytes->bytes+3 : NULL; } int get_packet_max_size(DDC_Packet * packet) { return packet->raw_bytes->buffer_size; } void dbgrpt_packet(DDC_Packet * packet, int depth) { assert(packet); // make clang analyzer happy int d0 = depth; // printf("DDC_Packet dump. Addr: %p, Type: 0x%02x, Tag: |%s|, buf: %p, aux_data: %p\n", // packet, packet->type, packet->tag, packet->raw_bytes, packet->aux_data); rpt_vstring(depth, "DDC_Packet dump. Addr: %p, Type: 0x%02x, Tag: |%s|, buf: %p, parsed: %p", packet, packet->type, packet->tag, packet->raw_bytes, packet->parsed.raw_parsed); dbgrpt_buffer(packet->raw_bytes, d0); // TODO show interpreted aux_data if (packet->parsed.raw_parsed) { switch(packet->type) { case (DDC_PACKET_TYPE_CAPABILITIES_RESPONSE): case (DDC_PACKET_TYPE_TABLE_READ_RESPONSE): report_interpreted_multi_read_fragment(packet->parsed.multi_part_read_fragment, d0); break; case (DDC_PACKET_TYPE_QUERY_VCP_RESPONSE): report_interpreted_nontable_vcp_response(packet->parsed.nontable_response, d0); break; default: // PROGRAM_LOGIC_ERROR("Unexpected packet type: -x%02x", packet->type); rpt_vstring(d0, "PROGRAM_LOGIC_ERROR: Unexpected packet type: -x%02x", packet->type); } } } bool isNullPacket(DDC_Packet * packet) { return (get_data_len(packet) == 0); } void free_ddc_packet(DDC_Packet * packet) { bool debug = false; DBGMSF(debug, "packet=%p", packet); // dump_packet(packet); if (packet) { if (packet->parsed.raw_parsed) { DBGMSF(debug, "freeing packet->parsed.raw=%p", packet->parsed.raw_parsed); free(packet->parsed.raw_parsed); } DBGMSF(debug, "calling free_buffer() for packet->buf=%p", packet->raw_bytes); buffer_free(packet->raw_bytes, "free DDC packet"); DBGMSF(debug, "freeing packet=%p", packet); free(packet); } DBGMSF(debug, "Done" ); } /** Base function for creating any DDC packet * * \param max_size size of buffer allocated for packet bytes * \param tag debug string (may be NULL) * * \return pointer to newly allocated #DDC_Packet */ DDC_Packet * create_empty_ddc_packet(int max_size, const char * tag) { bool debug = false; DBGMSF(debug, "Starting. max_size=%d, tag=%s", max_size, (tag) ? tag : "(nil)"); DDC_Packet * packet = malloc(sizeof(DDC_Packet)); packet->raw_bytes = buffer_new(max_size, "empty DDC packet"); if (tag) { g_strlcpy(packet->tag, tag, MAX_DDC_TAG); } else packet->tag[0] = '\0'; // DBGMSG("packet->tag=%s", packet->tag); packet->type = DDC_PACKET_TYPE_NONE; packet->parsed.raw_parsed = NULL; DBGMSF(debug, "Done. Returning %p, packet->tag=%p", packet, packet->tag); if (debug) dbgrpt_packet(packet, 1); return packet; } // // Request Packets // /** Creates a generic DDC request packet * * \param data_bytes data bytes of packet * \param data_bytect number of data bytes * \param tag debug string (may be NULL) * * \return pointer to created packet */ DDC_Packet * create_ddc_base_request_packet( Byte * data_bytes, int data_bytect, const char * tag) { bool debug = false; DBGMSF(debug, "Starting. bytes=%s, tag=%s", hexstring_t(data_bytes,data_bytect), tag); assert( data_bytect <= 32 ); DDC_Packet * packet = create_empty_ddc_packet(3+data_bytect+1, tag); buffer_set_byte( packet->raw_bytes, 0, 0x6e); buffer_set_byte( packet->raw_bytes, 1, 0x51); buffer_set_byte( packet->raw_bytes, 2, data_bytect | 0x80); buffer_set_bytes(packet->raw_bytes, 3, data_bytes, data_bytect); int packet_size_wo_checksum = 3 + data_bytect; Byte checksum = ddc_checksum(packet->raw_bytes->bytes, packet_size_wo_checksum, false); buffer_set_byte(packet->raw_bytes, packet_size_wo_checksum, checksum); buffer_set_length(packet->raw_bytes, 3 + data_bytect + 1); if (data_bytect > 0) packet->type = data_bytes[0]; else packet->type = 0x00; // dump_buffer(packet->buf); DBGMSF(debug, "Done. packet=%p", packet); return packet; } /* Creates a DDC VCP table read request packet * * Arguments: * offset offset value * tag debug string * * Returns: * pointer to created capabilities request packet */ DDC_Packet * create_ddc_multi_part_read_request_packet( Byte request_type, Byte request_subtype, int offset, const char * tag) { assert (request_type == DDC_PACKET_TYPE_CAPABILITIES_REQUEST || request_type == DDC_PACKET_TYPE_TABLE_READ_REQUEST ); DDC_Packet * packet_ptr = NULL; Byte ofs_hi_byte = (offset >> 16) & 0xff; Byte ofs_lo_byte = offset & 0xff; if (request_type == DDC_PACKET_TYPE_CAPABILITIES_REQUEST) { Byte data_bytes[] = { DDC_PACKET_TYPE_CAPABILITIES_REQUEST , ofs_hi_byte, ofs_lo_byte }; packet_ptr = create_ddc_base_request_packet(data_bytes, 3, tag); } else { Byte data_bytes[] = { DDC_PACKET_TYPE_TABLE_READ_REQUEST, request_subtype, // VCP code ofs_hi_byte, ofs_lo_byte }; packet_ptr = create_ddc_base_request_packet(data_bytes, 4, tag); } // DBGMSG("Done. packet_ptr=%p", packet_ptr); // dump_packet(packet_ptr); return packet_ptr; } /* Updates the offset in a multi part read request packet * * Arguments: * packet address of packet * offset new offset value */ void update_ddc_multi_part_read_request_packet_offset(DDC_Packet * packet, int new_offset) { assert (packet->type == DDC_PACKET_TYPE_CAPABILITIES_REQUEST || packet->type == DDC_PACKET_TYPE_TABLE_READ_REQUEST ); // update offset Byte ofs_hi_byte = (new_offset >> 8) & 0xff; // ofs_hi_byte = 0x00; // *** TEMP *** INSERT BUG Byte ofs_lo_byte = new_offset & 0xff; Byte * data_bytes = get_data_start(packet); if (packet->type == DDC_PACKET_TYPE_CAPABILITIES_REQUEST) { data_bytes[1] = ofs_hi_byte; data_bytes[2] = ofs_lo_byte; } else { data_bytes[2] = ofs_hi_byte; // changed from update_ddc_capabilities_request_offset data_bytes[3] = ofs_lo_byte; // changed ... } // DBGMSG("offset=%d, ofs_hi_byte=0x%02x, ofs_lo_byte=0x%02x", new_offset, ofs_hi_byte, ofs_lo_byte ); // update checksum Byte * bytes = get_packet_start(packet); int packet_size_wo_checksum = get_packet_len(packet)-1; bytes[packet_size_wo_checksum] = ddc_checksum(bytes, packet_size_wo_checksum, false); // DBGMSG("Done."); // dump_packet(packet); } /* Creates a DDC VCP table write request packet * * Arguments: * offset offset value * tag debug string * * Returns: * pointer to created capabilities request packet */ DDC_Packet * create_ddc_multi_part_write_request_packet( Byte request_type, // always DDC_PACKET_TYPE_WRITE_REQUEST Byte request_subtype, // VCP code int offset, Byte * bytes_to_write, int bytect, const char * tag) { assert (request_type == DDC_PACKET_TYPE_TABLE_WRITE_REQUEST ); assert (bytect + 4 <= 35); // is this the right limit?, spec unclear DDC_Packet * packet_ptr = NULL; Byte ofs_hi_byte = (offset >> 16) & 0xff; Byte ofs_lo_byte = offset & 0xff; Byte data_bytes[40] = { DDC_PACKET_TYPE_TABLE_WRITE_REQUEST, request_subtype, // VCP code ofs_hi_byte, ofs_lo_byte }; memcpy(data_bytes+4, bytes_to_write, bytect); packet_ptr = create_ddc_base_request_packet(data_bytes, 4+bytect, tag); // DBGMSG("Done. packet_ptr=%p", packet_ptr); // dump_packet(packet_ptr); return packet_ptr; } /* Creates a Get VCP request packet * * Arguments: * vcp_code VCP feature code * tag debug string * * Returns: * pointer to created DDC packet */ DDC_Packet * create_ddc_getvcp_request_packet(Byte vcp_code, const char * tag) { Byte data_bytes[] = { 0x01, // Command: get VCP Feature vcp_code // VCP opcode }; DDC_Packet * pkt = create_ddc_base_request_packet(data_bytes, 2, tag); // DBGMSG("Done. rc=%d, packet_ptr%p, *packet_ptr=%p", rc, packet_ptr, *packet_ptr); return pkt; } /* Creates a Set VCP request packet * * Arguments: * vcp_code VCP feature code * int new value * tag debug string * * Returns: * pointer to created DDC packet */ DDC_Packet * create_ddc_setvcp_request_packet(Byte vcp_code, int new_value, const char * tag) { Byte data_bytes[] = { 0x03, // Command: get VCP Feature vcp_code, // VCP opcode (new_value >> 8) & 0xff, new_value & 0xff }; DDC_Packet * pkt = create_ddc_base_request_packet(data_bytes, 4, tag); // DBGMSG("Done. rc=%d, packet_ptr%p, *packet_ptr=%p", rc, packet_ptr, *packet_ptr); return pkt; } DDC_Packet * create_ddc_save_settings_request_packet(const char * tag) { Byte data_bytes[] = { 0x0C // Command: Save Current Settings }; DDC_Packet * pkt = create_ddc_base_request_packet(data_bytes, 1, tag); // DBGMSG("Done. rc=%d, packet_ptr%p, *packet_ptr=%p", rc, packet_ptr, *packet_ptr); return pkt; } // // Response Packets // /** Performs tasks common to creating any DDC response packet. * Checks for malformed packet, but not packet contents. * * \param i2c_response_bytes pointer to raw packet bytes * \param response_bytes_buffer_size size of buffer pointed to by **i2c_response_bytes**, * (used for debug hex dump) * \param tag debug string (may be NULL) * \param packet_ptr_addr where to return pointer to newly allocated #DDC_Packet * * \retval 0 * \retval DDCRC_RESPONSE_ENVELOPE * \retval DDCRC_DOUBLE_BYTE * \retval DDCRC_PACKET_SIZE * \retval DDCRC_CHECKSUM * * The pointer returned at packet_ptr_addr is non-null iff the status code is 0. */ Status_DDC create_ddc_base_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, const char * tag, DDC_Packet ** packet_ptr_addr) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. i2c_response_bytes=%s", hexstring_t(i2c_response_bytes, 20) ); int result = DDCRC_OK; DDC_Packet * packet = NULL; if (i2c_response_bytes[0] != 0x6e ) { DDCMSG(debug, "Unexpected source address 0x%02x, should be 0x6e", i2c_response_bytes[0]); result = DDCRC_RESPONSE_ENVELOPE; } else { int data_ct = i2c_response_bytes[1] & 0x7f; // DBGMSG("data_ct=%d", data_ct); if (data_ct > MAX_DDC_DATA_SIZE) { if ( is_double_byte(&i2c_response_bytes[1])) { result = DDCRC_DOUBLE_BYTE; DDCMSG(debug, "Double byte in packet."); } else { result = DDCRC_PACKET_SIZE; DDCMSG(debug,"Invalid data length in packet: %d exceeds MAX_DDC_DATA_SIZE", data_ct); } } else { packet = create_empty_ddc_packet(3 + data_ct + 1, tag); // DBGMSG("create_empty_ddc_packet() returned %p", packet); if (data_ct > 0) packet->type = i2c_response_bytes[2]; Byte * packet_bytes = packet->raw_bytes->bytes; buffer_set_byte( packet->raw_bytes, 0, 0x6f); // implicit, would be 0x50 on access bus buffer_set_byte( packet->raw_bytes, 1, 0x6e); // i2c_response_bytes[0] buffer_set_bytes( packet->raw_bytes, 2, i2c_response_bytes+1, 1 + data_ct + 1); buffer_set_length(packet->raw_bytes, 3 + data_ct + 1); Byte calculated_checksum = ddc_checksum(packet_bytes, 3 + data_ct, true); // replacing right byte? Byte actual_checksum = packet_bytes[3+data_ct]; if (calculated_checksum != actual_checksum) { DDCMSG(debug, "Actual checksum 0x%02x, expected 0x%02x", actual_checksum, calculated_checksum); result = DDCRC_CHECKSUM; free_ddc_packet(packet); } } } if (result != DDCRC_OK) { DDCMSG(debug, "i2c_response_bytes: %s", hexstring_t(i2c_response_bytes, response_bytes_buffer_size)); } if (result == DDCRC_OK) *packet_ptr_addr = packet; else *packet_ptr_addr = NULL; DBGTRC(debug, TRACE_GROUP, "Returning %s, *packet_ptr_addr=%p", ddcrc_desc(result), *packet_ptr_addr); assert( (result==DDCRC_OK && *packet_ptr_addr) || (result != DDCRC_OK && !*packet_ptr_addr)); return result; } /** Creates a DDC response packet, checking for expected type and DDC Null Response * * \param i2c_response_bytes pointer to raw packet bytes * \param response_bytes_buffer_size size of buffer pointed to by **i2c_response_bytes** * \param expected_type expected packet type * \param tag debug string (may be NULL) * \param packet_ptr_addr where to return pointer to newly allocated #DDC_Packet * * \return 0 for success\n * as from create_ddc_base_response_packet, indicating malformed response * \retval DDCRC_NULL_RESPONSE * \retval DDCRC_RESPONSE_TYPE * * The pointer returned at packet_ptr_addr is non-null iff the status code is 0. */ Status_DDC create_ddc_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, DDC_Packet_Type expected_type, const char * tag, DDC_Packet ** packet_ptr_addr) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. i2c_response_bytes=%s", hexstring_t(i2c_response_bytes, 20)); Status_DDC result = create_ddc_base_response_packet( i2c_response_bytes, response_bytes_buffer_size, tag, packet_ptr_addr); // DBGMSG("create_ddc_base_response_packet() returned %d, *packet_ptr_addr=%p", result, *packet_ptr_addr); if (result == 0) { if (isNullPacket(*packet_ptr_addr)) { result = DDCRC_NULL_RESPONSE; } else if ( get_data_start(*packet_ptr_addr)[0] != expected_type) { result = DDCRC_RESPONSE_TYPE; } } if (result != DDCRC_OK && *packet_ptr_addr) { // if (debug) // DBGMSG("failure, freeing response packet at %p", *packet_ptr_addr); TRCMSG("failure, freeing response packet at %p", *packet_ptr_addr); // does this cause the free(readbuf) failure in try_read? free_ddc_packet(*packet_ptr_addr); *packet_ptr_addr = 0; } if (result < 0) { log_status_code(result, __func__); } DBGTRC(debug, TRACE_GROUP, "Returning %s, *packet_ptr_addr=%p", ddcrc_desc(result), *packet_ptr_addr); assert( (result==DDCRC_OK && *packet_ptr_addr) || (result != DDCRC_OK && !*packet_ptr_addr)); return result; } // // Packet data parsers // // Capabilities response data void report_interpreted_capabilities( Interpreted_Multi_Part_Read_Fragment * interpreted, int depth) { int d1 = depth+1; rpt_vstring(depth, "Capabilities response contents:"); rpt_vstring(d1, "offset: %d", interpreted->fragment_offset); rpt_vstring(d1, "fragment length: %d", interpreted->fragment_length); rpt_vstring(d1, "text: |%.*s|", interpreted->fragment_length, interpreted->bytes); } /** Interprets the bytes of a multi part read response. * * \param response_type * \param data_bytes * \param bytect * \param aux_data pointer to #Interpreted_Multi_Part_Read_Fragment to fill in * \retval 0 success * \retval DDCRC_INVALID_DATA */ Status_DDC interpret_multi_part_read_response( DDC_Packet_Type response_type, Byte * data_bytes, int bytect, Interpreted_Multi_Part_Read_Fragment * aux_data) // Interpreted_Capabilities_Fragment * aux_data, { bool debug = false; int result = DDCRC_OK; // not needed, already checked if (bytect < 3 || bytect > 35) { // if (debug) DDCMSG(debug, "Invalid response data length: %d", bytect); result = COUNT_STATUS_CODE(DDCRC_INVALID_DATA); } else { assert( data_bytes[0] == response_type); // table read reply opcode // CHANGED Byte offset_hi_byte = data_bytes[1]; Byte offset_lo_byte = data_bytes[2]; int read_data_length = bytect-3; // max 32 // CHANGED Byte * read_data_start = data_bytes+3; // CHANGED // DBGMSG("offset_hi_byte = 0x%02x, offset_lo_byte = 0x%02x", offset_hi_byte, offset_lo_byte ); aux_data->fragment_type = response_type; // set in caller? would make response_type parm unnecessary aux_data->fragment_offset = offset_hi_byte << 8 | offset_lo_byte; aux_data->fragment_length = read_data_length; // changed assert(read_data_length <= MAX_DDC_CAPABILITIES_FRAGMENT_SIZE); // ??? memcpy(aux_data->bytes, read_data_start, read_data_length); // CHANGED // aux_data->text[text_length] = '\0'; // CHANGED } if (debug) DBGMSG("returning %s", ddcrc_desc(result)); return result; } void report_interpreted_multi_read_fragment( Interpreted_Multi_Part_Read_Fragment * interpreted, int depth) { int d1 = depth+1; rpt_vstring(depth, "Multi-read response contents:"); rpt_vstring(d1, "fragment type: 0x%02x", interpreted->fragment_type); rpt_vstring(d1, "offset: %d", interpreted->fragment_offset); rpt_vstring(d1, "fragment length: %d", interpreted->fragment_length); rpt_vstring(d1, "data addr: %p", interpreted->bytes); if (interpreted->fragment_type == DDC_PACKET_TYPE_CAPABILITIES_RESPONSE) rpt_vstring(d1, "text: |%.*s|", interpreted->fragment_length, interpreted->bytes); else { char * hs = hexstring(interpreted->bytes, interpreted->fragment_length); rpt_vstring(d1, "data: 0x%s", hs); free(hs); } } // VCP feature response data // overlay the standard 8 byte VCP feature response typedef // no benefit to union here // union /* Vcp_Response */ { // Byte bytes[8]; struct { Byte feature_reply_op_code; // always 0x02 Byte result_code; // 0x00=no error, 0x01=Unsupported op code Byte vcp_opcode; // VCP opcode from feature request message Byte vcp_typecode; // 0x00=set parameter, 0x01=momentary Byte mh; Byte ml; Byte sh; Byte sl; // } fields; } /*__attribute__((packed)) */ Vcp_Response; /** Interprets the standard 8 byte VCP feature response. * * The response is checked for validity, and a * Interpreted_Notable_Vcp_Response struct is filled in. * * \param vcp_data_bytes pointer to data bytes * \param bytect number of bytes in response, must be 8 * \param requested_vcp_code must be in the vcp_code field of he response bytes * \param aux_data pointer to #Parsed_Nontable_Vcp_Response struct to be filled in * * \retval 0 success * \retval DDCRC_INVALID_DATA * * \remark * It is not an error if the supported_opcode byte is set false in an * otherwise well constructed response. */ Status_DDC interpret_vcp_feature_response_std( Byte* vcp_data_bytes, int bytect, Byte requested_vcp_code, Parsed_Nontable_Vcp_Response* aux_data) // record in which interpreted feature response will be stored { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. requested_vcp_code: 0x%02x, vcp_data_bytes: %s", requested_vcp_code, hexstring3_t(vcp_data_bytes, bytect, " ", 4, false)); int result = DDCRC_OK; // set initial values for failure case: aux_data->vcp_code = 0x00; aux_data->valid_response = false; aux_data->supported_opcode = false; aux_data->max_value = 0; aux_data->cur_value = 0; if (bytect != 8) { DDCMSG(debug, "Invalid response data length: %d, should be 8, response data bytes: %s", bytect, hexstring3_t(vcp_data_bytes, bytect, " ", 4, false)); COUNT_STATUS_CODE(DDCRC_INVALID_DATA); result = DDCRC_INVALID_DATA; } else { // overlay Vcp_Response on the data bytes of the response Vcp_Response * vcpresp = (Vcp_Response *) vcp_data_bytes; assert( sizeof(*vcpresp) == 8); assert(vcpresp->result_code == vcp_data_bytes[1]); // validate the overlay aux_data->vcp_code = vcpresp->vcp_opcode; bool valid_response = true; if (vcpresp->vcp_opcode != requested_vcp_code){ DDCMSG(debug, "Unexpected VCP opcode 0x%02x, should be 0x%02x, response data bytes: %s", vcpresp->vcp_opcode, requested_vcp_code, hexstring3_t(vcp_data_bytes, bytect, " ", 4, false)); result = COUNT_STATUS_CODE(DDCRC_INVALID_DATA); } else if (vcpresp->result_code != 0) { if (vcpresp->result_code == 0x01) { // Do not report as DDC error if VCP code is 0x00, since that value is used // for probing. bool msg_emitted = DBGTRC(debug, TRACE_GROUP, "Unsupported VCP Code: 0x%02x", vcpresp->vcp_opcode); if (requested_vcp_code != 0x00 && !msg_emitted) DDCMSG(debug, "Unsupported VCP Code: 0x%02x", vcpresp->vcp_opcode); aux_data->valid_response = true; } else { DDCMSG(debug, "Unexpected result code: 0x%02x, response_data_bytes: %s", vcpresp->result_code, hexstring3_t(vcp_data_bytes, bytect, " ", 4, false)); result = COUNT_STATUS_CODE(DDCRC_INVALID_DATA); } } else { int max_val = (vcpresp->mh << 8) | vcpresp->ml; int cur_val = (vcpresp->sh << 8) | vcpresp->sl; DBGTRC(debug, TRACE_GROUP, "vcp_opcode = 0x%02x, vcp_type_code=0x%02x, max_val=%d (0x%04x), cur_val=%d (0x%04x)", vcpresp->vcp_opcode, vcpresp->vcp_typecode, max_val, max_val, cur_val, cur_val); DBGTRC(debug, TRACE_GROUP, "valid_response=%s", bool_repr(valid_response)); aux_data->valid_response = true; aux_data->supported_opcode = true; aux_data->max_value = max_val; // valid only for continuous features aux_data->cur_value = cur_val; // valid only for continuous features // for new way aux_data->mh = vcpresp->mh; aux_data->ml = vcpresp->ml; aux_data->sh = vcpresp->sh; aux_data->sl = vcpresp->sl; } } DBGTRC(debug, TRACE_GROUP, "Returning %s", psc_desc(result)); return result; } void report_interpreted_nontable_vcp_response( Parsed_Nontable_Vcp_Response * interpreted, int depth) { rpt_vstring(depth,"VCP code: 0x%02x", interpreted->vcp_code); rpt_vstring(depth,"valid_response: %d", interpreted->valid_response); rpt_vstring(depth,"supported_opcode: %d", interpreted->supported_opcode); rpt_vstring(depth,"max_value: %d", interpreted->max_value); rpt_vstring(depth,"cur_value: %d", interpreted->cur_value); rpt_vstring(depth,"mh: 0x%02x", interpreted->mh); rpt_vstring(depth,"ml: 0x%02x", interpreted->ml); rpt_vstring(depth,"sh: 0x%02x", interpreted->sh); rpt_vstring(depth,"sl: 0x%02x", interpreted->sl); } void report_parsed_vcp_response(Parsed_Vcp_Response * response, int depth) { rpt_vstring(depth, "Parsed_Vcp_Reponse at %p:", response); rpt_vstring(depth, "response_type: %d", response->response_type); if (response->response_type == DDCA_NON_TABLE_VCP_VALUE) { rpt_vstring(depth, "non_table_response at %p:", response->non_table_response); report_interpreted_nontable_vcp_response(response->non_table_response, depth+1); } else { rpt_vstring(depth, "table_response at %p", response->table_response); } } // // Response packets // /** Creates a #DDC_Packet for a DDC response. * * \param i2c_response_bytes pointer to raw packet bytes * \param response_bytes_buffer_size size of buffer pointed to by **i2c_response_bytes** * \param expected_type expected packet type * \param expected_subtype depends on expected_type * \param tag debug string (may be NULL) * \param packet_ptr_addr where to return pointer to newly allocated #DDC_Packet * * \retval 0 * \return as from #create_ddc_response_packet() * \retval DDCRC_INVALID_DATA may be set by function that fills in aux_data struct * * The pointer returned at packet_ptr_addr is non-null iff the status code is 0. * * The contents of **expected_subtype** depends on the value of **expected_type**. * For DDC_PACKET_TYPE_QUERY_VCP_RESPONSE it is the VCP feature code. */ Status_DDC create_ddc_typed_response_packet( Byte* i2c_response_bytes, int response_bytes_buffer_size, DDC_Packet_Type expected_type, Byte expected_subtype, const char* tag, DDC_Packet** packet_ptr_addr) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. i2c_response_bytes=%s", hexstring_t(i2c_response_bytes, 20) ); // DBGMSG("before create_ddc_response_packet(), *packet_ptr_addr=%p", *packet_ptr_addr); // n. may return DDC_NULL_RESPONSE?? (old note) Status_DDC rc = create_ddc_response_packet( i2c_response_bytes, response_bytes_buffer_size, expected_type, tag, packet_ptr_addr); DBGTRC(debug, TRACE_GROUP, "Create_ddc_response_packet() returned %s, *packet_ptr_addr=%p", __func__, psc_desc(rc), *packet_ptr_addr); if (rc == 0) { DDC_Packet * packet = *packet_ptr_addr; switch (expected_type) { case DDC_PACKET_TYPE_CAPABILITIES_RESPONSE: case DDC_PACKET_TYPE_TABLE_READ_RESPONSE: { Interpreted_Multi_Part_Read_Fragment * aux_data = calloc(1, sizeof(Interpreted_Multi_Part_Read_Fragment)); packet->parsed.multi_part_read_fragment = aux_data; rc = interpret_multi_part_read_response( expected_type, get_data_start(packet), get_data_len(packet), aux_data); } break; case DDC_PACKET_TYPE_QUERY_VCP_RESPONSE: { Parsed_Nontable_Vcp_Response * aux_data = calloc(1, sizeof(Parsed_Nontable_Vcp_Response)); packet->parsed.nontable_response = aux_data; rc = interpret_vcp_feature_response_std( get_data_start(packet), get_data_len(packet), expected_subtype, aux_data); } break; default: rc = DDCL_INTERNAL_ERROR; DBGMSG("Unhandled case. expected_type=%d", expected_type); break; } } if (rc != DDCRC_OK && *packet_ptr_addr) { free_ddc_packet(*packet_ptr_addr); *packet_ptr_addr = NULL; } DBGTRC(debug, TRACE_GROUP, "Returning %s, *packet_ptr=%p", ddcrc_desc(rc), *packet_ptr_addr); if ( (debug || IS_TRACING()) && rc >= 0) dbgrpt_packet(*packet_ptr_addr, 1); assert( (rc == 0 && *packet_ptr_addr) || (rc != 0 && !*packet_ptr_addr)); return rc; } Status_DDC create_ddc_multi_part_read_response_packet( Byte response_type, Byte * i2c_response_bytes, int response_bytes_buffer_size, const char * tag, DDC_Packet ** packet_ptr) { bool debug = false; DDC_Packet * packet = NULL; Status_DDC rc = create_ddc_response_packet(i2c_response_bytes, response_bytes_buffer_size, DDC_PACKET_TYPE_TABLE_READ_RESPONSE, tag, &packet); if (rc != 0) { // DBGMSG("create_ddc_response_packet() returned %s, packet=%p", ddcrc_description(rc), packet); TRCMSG("create_ddc_response_packet() returned %s, packet=%p", ddcrc_desc(rc), packet); } if (rc == 0) { // dump_packet(packet); int min_data_len = 3; int max_data_len = 35; int data_len = get_data_len(packet); if (data_len < min_data_len || data_len > max_data_len) { DDCMSG(debug, "Invalid data fragment_length_wo_null: %d", data_len); if (IS_REPORTING_DDC()) dbgrpt_packet(packet, 1); rc = COUNT_STATUS_CODE(DDCRC_INVALID_DATA); } else { Interpreted_Multi_Part_Read_Fragment * aux_data = calloc(1, sizeof(Interpreted_Multi_Part_Read_Fragment)); packet->parsed.multi_part_read_fragment = aux_data; rc = interpret_multi_part_read_response( response_type, get_data_start(packet), get_data_len(packet), aux_data); } } if (rc != 0 && packet) { free_ddc_packet(packet); } if (rc == 0) *packet_ptr = packet; return rc; } // VCP Feature response // 4/2017: used only in ddc_vcp_tests.c: Status_DDC create_ddc_getvcp_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, Byte expected_vcp_opcode, const char * tag, DDC_Packet ** packet_ptr) { bool debug = false; DDC_Packet * packet = NULL; Status_DDC rc = create_ddc_response_packet( i2c_response_bytes, response_bytes_buffer_size, DDC_PACKET_TYPE_QUERY_VCP_RESPONSE, tag, &packet); if (rc != 0) { // DBGMSG("create_ddc_response_packet() returned %s, packet=%p", ddcrc_description(rc), packet); TRCMSG("create_ddc_response_packet() returned %s, packet=%p", ddcrc_desc(rc), packet); } if (rc == 0) { // dump_packet(packet); int data_len = get_data_len(packet); if (data_len != 8) { // DBGMSG("Invalid data length: %d, should be 8", data_len); // dump_packet(packet); DDCMSG(debug, "Invalid data length: %d, should be 8", data_len); if ( IS_REPORTING_DDC() ) dbgrpt_packet(packet, 1); rc = COUNT_STATUS_CODE(DDCRC_INVALID_DATA); } else { Parsed_Nontable_Vcp_Response * aux_data = calloc(1, sizeof(Parsed_Nontable_Vcp_Response)); packet->parsed.nontable_response = aux_data; rc = interpret_vcp_feature_response_std( get_data_start(packet), get_data_len(packet), expected_vcp_opcode, aux_data); } } if (rc != 0 && packet) { free_ddc_packet(packet); } if (rc == 0) *packet_ptr = packet; return rc; } // // Operations on response packets // // VCP Feature Code /** Extracts the interpretation of a non-table VCP response from a #DDC_Packet. * * This is the aux_data field of #DDC_Packet * * \param packet pointer to digested packet (not raw bytes) * \param make_copy if true, make a copy of the aux_data field,\n * if false, just return a pointer to it * \param interpreted_ptr where to return newly allocated #Parsed_Nontable_Vcp_Response * \retval 0 success * \retval DDCRC_RESPONSE_TYPE not a VCP response packet * * The value pointed to by **interpreted_ptr** is non-null iff the returned status code is 0. */ Status_DDC get_interpreted_vcp_code( DDC_Packet * packet, bool make_copy, Parsed_Nontable_Vcp_Response ** interpreted_ptr) { bool debug = false; DBGMSF(debug, "Starting"); Status_DDC rc = DDCRC_OK; if (packet->type != DDC_PACKET_TYPE_QUERY_VCP_RESPONSE) { COUNT_STATUS_CODE(DDCRC_RESPONSE_TYPE); rc = DDCRC_RESPONSE_TYPE; *interpreted_ptr = NULL; } else { if (make_copy) { Parsed_Nontable_Vcp_Response * copy = malloc(sizeof(Parsed_Nontable_Vcp_Response)); memcpy(copy, packet->parsed.nontable_response, sizeof(Parsed_Nontable_Vcp_Response)); *interpreted_ptr = copy; } else { *interpreted_ptr = packet->parsed.nontable_response; } } DBGMSF(debug, "Returning %d: %s\n", rc, psc_desc(rc) ); assert( (rc == 0 && *interpreted_ptr) || (rc && !*interpreted_ptr)); return rc; } // 12/23/2015: not currently used Status_DDC get_vcp_cur_value(DDC_Packet * packet, int * value_ptr) { Parsed_Nontable_Vcp_Response * aux_ptr; Status_DDC rc = get_interpreted_vcp_code(packet, false, &aux_ptr); if (rc == 0) { *value_ptr = aux_ptr->cur_value; } return rc; } ddcutil-0.8.6/src/base/displays.c0000644000175000001440000011325313227336715013605 00000000000000/* displays.c * * Maintains list of all detected monitors. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Monitor identifier, reference, handle */ #include /** \cond */ #include #include // #include #include #include #include #include #include "util/glib_util.h" #include "util/string_util.h" #include "util/report_util.h" #include "util/udev_util.h" #include "util/udev_usb_util.h" /** \endcond */ #include "public/ddcutil_c_api.h" #include "core.h" #include "vcp_version.h" #include "displays.h" // *** Miscellaneous *** /** Reports whether a #DDCA_Adlno value is set or is currently undefined. * \param adlno ADL adapter/index number pair * * \remark * Used to hide the magic number for "undefined" */ bool is_adlno_defined(DDCA_Adlno adlno) { return adlno.iAdapterIndex >= 0 && adlno.iDisplayIndex >= 0; } // *** DDCA_IO_Path *** /** Tests 2 #DDCA_IO_Path instances for equality * * \param p1 first instance * \param p2 second instance * \return true/false */ bool dpath_eq(DDCA_IO_Path p1, DDCA_IO_Path p2) { bool result = false; if (p1.io_mode == p2.io_mode) { switch(p1.io_mode) { case DDCA_IO_DEVI2C: result = (p1.path.i2c_busno == p2.path.i2c_busno); break; case DDCA_IO_ADL: result = (p1.path.adlno.iAdapterIndex == p2.path.adlno.iAdapterIndex) && (p1.path.adlno.iDisplayIndex == p2.path.adlno.iDisplayIndex); break; case DDCA_IO_USB: result = p1.path.hiddev_devno == p2.path.hiddev_devno; } } return result; } // *** Display_Async_Rec *** // At least temporarily for development, base all async operations for a display // on this struct. static GMutex displays_master_list_mutex; static GPtrArray * displays_master_list = NULL; // only handful of displays, simple data structure suffices void dbgrpt_displays_master_list(GPtrArray* displays_master_list, int depth) { int d1 = depth+1; rpt_structure_loc("displays_master_list", displays_master_list, depth); if (displays_master_list) { for (int ndx = 0; ndx < displays_master_list->len; ndx++) { Display_Async_Rec * cur = g_ptr_array_index(displays_master_list, ndx); // DBGMSG("%p", cur); rpt_vstring(d1, "%p - %s", cur, dpath_repr_t(&cur->dpath)); } } } Display_Async_Rec * display_async_rec_new(DDCA_IO_Path dpath) { Display_Async_Rec * newrec = calloc(1, sizeof(Display_Async_Rec)); memcpy(newrec->marker, DISPLAY_ASYNC_REC_MARKER, 4); newrec->dpath = dpath; // g_mutex_init(&newrec->thread_lock); // newrec->owning_thread = NULL; newrec->request_queue = g_queue_new(); g_mutex_init(&newrec->request_queue_lock); #ifdef FUTURE newrec->request_execution_thread = g_thread_new( strdup(dpath_repr_t(dref)), // thread name NULL, // GThreadFunc *** TEMP *** dref->request_queue); // or just dref?, how to pass dh? #endif return newrec; } Display_Async_Rec * find_display_async_rec(DDCA_IO_Path dpath) { bool debug = false; assert(displays_master_list); Display_Async_Rec * result = NULL; for (int ndx = 0; ndx < displays_master_list->len; ndx++) { Display_Async_Rec * cur = g_ptr_array_index(displays_master_list, ndx); if ( dpath_eq(cur->dpath, dpath) ) { result = cur; break; } } DBGMSF(debug, "Returning %p", result); return result; } /** Obtains a reference to the #Display_Async_Rec for a display. * */ Display_Async_Rec * get_display_async_rec(DDCA_IO_Path dpath) { bool debug = false; assert(displays_master_list); DBGMSF(debug, "dpath=%s", dpath_repr_t(&dpath)); if (debug) dbgrpt_displays_master_list(displays_master_list, 1); // This is a simple critical section. Always wait. // G_LOCK(global_locks_mutex); g_mutex_lock(&displays_master_list_mutex); Display_Async_Rec * result = find_display_async_rec(dpath); if (!result) { result = display_async_rec_new(dpath); // DBGMSG("Adding %p", gdl); g_ptr_array_add(displays_master_list, result); } // G_UNLOCK(global_locks_mutex); g_mutex_unlock(&displays_master_list_mutex); DBGMSF(debug, "Returning %p", result); return result; } // GLOCK... macros confuse Eclipse // GLOCK_DEFINE_STATIC(global_locks_mutex); /** Acquired at display open time. * Only 1 thread can open */ bool lock_display_lock(Display_Async_Rec * async_rec, bool wait) { assert(async_rec && memcmp(async_rec->marker, DISPLAY_ASYNC_REC_MARKER, 4) == 0); bool lock_acquired = false; if (wait) { g_mutex_lock(&async_rec->display_lock); lock_acquired = true; } else { lock_acquired = g_mutex_trylock(&async_rec->display_lock); } if (lock_acquired) async_rec->thread_owning_display_lock = g_thread_self(); return lock_acquired; } void unlock_display_lock(Display_Async_Rec * async_rec) { assert(async_rec && memcmp(async_rec->marker, DISPLAY_ASYNC_REC_MARKER, 4) == 0); if (async_rec->thread_owning_display_lock == g_thread_self()) { async_rec->thread_owning_display_lock = NULL; g_mutex_unlock(&async_rec->display_lock); } } // *** Display_Identifier *** static char * Display_Id_Type_Names[] = { "DISP_ID_BUSNO", "DISP_ID_ADL", "DISP_ID_MONSER", "DISP_ID_EDID", "DISP_ID_DISPNO", "DISP_ID_USB", "DISP_ID_HIDDEV" }; /** Returns symbolic name of display identifier type * \param val display identifier type * \return symbolic name */ char * display_id_type_name(Display_Id_Type val) { return Display_Id_Type_Names[val]; } static Display_Identifier* common_create_display_identifier(Display_Id_Type id_type) { Display_Identifier* pIdent = calloc(1, sizeof(Display_Identifier)); memcpy(pIdent->marker, DISPLAY_IDENTIFIER_MARKER, 4); pIdent->id_type = id_type; pIdent->busno = -1; pIdent->iAdapterIndex = -1; pIdent->iDisplayIndex = -1; pIdent->usb_bus = -1; pIdent->usb_device = -1; memset(pIdent->edidbytes, '\0', 128); *pIdent->model_name = '\0'; *pIdent->serial_ascii = '\0'; return pIdent; } /** Creates a #Display_Identifier using a **ddcutil** display number * * \param dispno display number (1 based) * \return pointer to newly allocated #Display_Identifier * * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_dispno_display_identifier(int dispno) { Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_DISPNO); pIdent->dispno = dispno; return pIdent; } /** Creates a #Display_Identifier using an I2C bus number * * \param busno O2C bus number * \return pointer to newly allocated #Display_Identifier * * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_busno_display_identifier(int busno) { Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_BUSNO); pIdent->busno = busno; return pIdent; } /** Creates a #Display_Identifier using an ADL adapter number/display number pair. * * \param iAdapterIndex ADL adapter number * \param iDisplayIndex ADL display number * \return pointer to newly allocated #Display_Identifier * * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex) { Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_ADL); pIdent->iAdapterIndex = iAdapterIndex; pIdent->iDisplayIndex = iDisplayIndex; return pIdent; } /** Creates a #Display_Identifier using an EDID value * * \param edidbytes pointer to 128 byte EDID value * \return pointer to newly allocated #Display_Identifier * * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_edid_display_identifier( const Byte* edidbytes ) { Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_EDID); memcpy(pIdent->edidbytes, edidbytes, 128); return pIdent; } /** Creates a #Display_Identifier using one or more of * manufacturer id, model name, and/or serial number string * as recorded in the EDID. * * \param mfg_id manufacturer id * \param model_name model name * \param serial_ascii string serial number * \return pointer to newly allocated #Display_Identifier * * \remark * Unspecified parameters can be either NULL or strings of length 0. * \remark * At least one parameter must be non-null and have length > 0. * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_mfg_model_sn_display_identifier( const char* mfg_id, const char* model_name, const char* serial_ascii ) { assert(!mfg_id || strlen(mfg_id) < EDID_MFG_ID_FIELD_SIZE); assert(!model_name || strlen(model_name) < EDID_MODEL_NAME_FIELD_SIZE); assert(!serial_ascii || strlen(serial_ascii) < EDID_SERIAL_ASCII_FIELD_SIZE); Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_MONSER); if (mfg_id) strcpy(pIdent->mfg_id, mfg_id); else pIdent->model_name[0] = '\0'; if (model_name) strcpy(pIdent->model_name, model_name); else pIdent->model_name[0] = '\0'; if (serial_ascii) strcpy(pIdent->serial_ascii, serial_ascii); else pIdent->serial_ascii[0] = '\0'; assert( strlen(pIdent->mfg_id) + strlen(pIdent->model_name) + strlen(pIdent->serial_ascii) > 0); return pIdent; } /** Creates a #Display_Identifier using a USB /dev/usb/hiddevN device number * * \param hiddev_devno hiddev device number * \return pointer to newly allocated #Display_Identifier * * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_usb_hiddev_display_identifier(int hiddev_devno) { Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_HIDDEV); pIdent->hiddev_devno = hiddev_devno; return pIdent; } /** Creates a #Display_Identifier using a USB bus number/device number pair. * * \param bus USB bus number * \param device USB device number * \return pointer to newly allocated #Display_Identifier * * \remark * It is the responsibility of the caller to free the allocated * #Display_Identifier using #free_display_identifier(). */ Display_Identifier* create_usb_display_identifier(int bus, int device) { Display_Identifier* pIdent = common_create_display_identifier(DISP_ID_USB); pIdent->usb_bus = bus; pIdent->usb_device = device; return pIdent; } /** Reports the contents of a #Display_Identifier in a format suitable * for debugging use. * * \param pdid pointer to #Display_Identifier instance * \param depth logical indentation depth */ void dbgrpt_display_identifier(Display_Identifier * pdid, int depth) { rpt_structure_loc("BasicStructureRef", pdid, depth ); int d1 = depth+1; rpt_mapped_int("ddc_io_mode", NULL, pdid->id_type, (Value_To_Name_Function) display_id_type_name, d1); rpt_int( "dispno", NULL, pdid->dispno, d1); rpt_int( "busno", NULL, pdid->busno, d1); rpt_int( "iAdapterIndex", NULL, pdid->iAdapterIndex, d1); rpt_int( "iDisplayIndex", NULL, pdid->iDisplayIndex, d1); rpt_int( "usb_bus", NULL, pdid->usb_bus, d1); rpt_int( "usb_device", NULL, pdid->usb_device, d1); rpt_int( "hiddev_devno", NULL, pdid->hiddev_devno, d1); rpt_str( "mfg_id", NULL, pdid->mfg_id, d1); rpt_str( "model_name", NULL, pdid->model_name, d1); rpt_str( "serial_ascii", NULL, pdid->serial_ascii, d1); char * edidstr = hexstring(pdid->edidbytes, 128); rpt_str( "edid", NULL, edidstr, d1); free(edidstr); #ifdef ALTERNATIVE // avoids a malloc and free, but less clear char edidbuf[257]; char * edidstr2 = hexstring2(pdid->edidbytes, 128, NULL, true, edidbuf, 257); rpt_str( "edid", NULL, edidstr2, d1); #endif } /** Returns a succinct representation of a #Display_Identifier for * debugging purposes. * * \param pdid pointer to #Display_Identifier * \return pointer to string description * * \remark * The returned pointer is valid until the #Display_Identifier is freed. */ char * did_repr(Display_Identifier * pdid) { if (!pdid->repr) { char * did_type_name = display_id_type_name(pdid->id_type); switch (pdid->id_type) { case(DISP_ID_BUSNO): pdid->repr = gaux_asprintf( "Display Id[type=%s, bus=/dev/i2c-%d]", did_type_name, pdid->busno); break; case(DISP_ID_ADL): pdid->repr = gaux_asprintf( "Display Id[type=%s, adlno=%d.%d]", did_type_name, pdid->iAdapterIndex, pdid->iDisplayIndex); break; case(DISP_ID_MONSER): pdid->repr = gaux_asprintf( "Display Id[type=%s, mfg=%s, model=%s, sn=%s]", did_type_name, pdid->mfg_id, pdid->model_name, pdid->serial_ascii); break; case(DISP_ID_EDID): { char * hs = hexstring(pdid->edidbytes, 128); pdid->repr = gaux_asprintf( "Display Id[type=%s, edid=%8s...%8s]", did_type_name, hs, hs+248); free(hs); break; } case(DISP_ID_DISPNO): pdid->repr = gaux_asprintf( "Display Id[type=%s, dispno=%d]", did_type_name, pdid->dispno); break; case DISP_ID_USB: pdid->repr = gaux_asprintf( "Display Id[type=%s, usb bus:device=%d.%d]", did_type_name, pdid->usb_bus, pdid->usb_device);; break; case DISP_ID_HIDDEV: pdid->repr = gaux_asprintf( "Display Id[type=%s, hiddev_devno=%d]", did_type_name, pdid->hiddev_devno); break; } // switch } return pdid->repr; } /** Frees a #Display_Identifier instance * * \param pdid pointer to #Display_Identifier to free */ void free_display_identifier(Display_Identifier * pdid) { if (pdid) { assert( memcmp(pdid->marker, DISPLAY_IDENTIFIER_MARKER, 4) == 0); pdid->marker[3] = 'x'; free(pdid->repr); // may be null, that's ok free(pdid); } } #ifdef FUTURE // *** Display Selector *** (future) Display_Selector * dsel_new() { Display_Selector * dsel = calloc(1, sizeof(Display_Selector)); memcpy(dsel->marker, DISPLAY_SELECTOR_MARKER, 4); dsel->dispno = -1; dsel->busno = -1; dsel->iAdapterIndex = -1; dsel->iDisplayIndex = -1; dsel->usb_bus = -1; dsel->usb_device = -1; return dsel; } void dsel_free(Display_Selector * dsel) { if (dsel) { assert(memcmp(dsel->marker, DISPLAY_SELECTOR_MARKER, 4) == 0); free(dsel->mfg_id); free(dsel->model_name); free(dsel->serial_ascii); free(dsel->edidbytes); } } #endif // *** DDCA_IO_Mode and DDCA_IO_Path *** static char * IO_Mode_Names[] = { "DDCA_IO_DEVI2C", "DDCA_IO_ADL", "DDCA_IO_USB" }; /** Returns the symbolic name of a #DDCA_IO_Mode value. * * \param val #DDCA_IO_Mode value * \return symbolic name, e.g. "DDCA_IO_DEVI2C" */ char * io_mode_name(DDCA_IO_Mode val) { return (val >= 0 && val < 3) // protect against bad arg ? IO_Mode_Names[val] : NULL; } /** Thread safe function that returns a brief string representation of a #DDCA_IO_Path. * The returned value is valid until the next call to this function on the current thread. * * \param dpath pointer to ##DDCA_IO_Path * \return string representation of #DDCA_IO_Path */ char * dpath_short_name_t(DDCA_IO_Path * dpath) { static GPrivate dpath_short_name_key = G_PRIVATE_INIT(g_free); char * buf = get_thread_fixed_buffer(&dpath_short_name_key, 100); switch(dpath->io_mode) { case DDCA_IO_DEVI2C: snprintf(buf, 100, "bus dev/i2c-%d", dpath->path.i2c_busno); break; case DDCA_IO_ADL: snprintf(buf, 100, "adlno (%d.%d)", dpath->path.adlno.iAdapterIndex, dpath->path.adlno.iDisplayIndex); break; case DDCA_IO_USB: snprintf(buf, 100, "usb /dev/usb/hiddev%d", dpath->path.hiddev_devno); } return buf; } /** Thread safe function that returns a string representation of a #DDCA_IO_Path * suitable for diagnostic messages. The returned value is valid until the * next call to this function on the current thread. * * \param dpath pointer to ##DDCA_IO_Path * \return string representation of #DDCA_IO_Path */ char * dpath_repr_t(DDCA_IO_Path * dpath) { static GPrivate dpath_repr_key = G_PRIVATE_INIT(g_free); char * buf = get_thread_fixed_buffer(&dpath_repr_key, 100); switch(dpath->io_mode) { case DDCA_IO_DEVI2C: snprintf(buf, 100, "Display_Path[/dev/i2c-%d]", dpath->path.i2c_busno); break; case DDCA_IO_ADL: snprintf(buf, 100, "Display_Path[adl=(%d.%d)]", dpath->path.adlno.iAdapterIndex, dpath->path.adlno.iDisplayIndex); break; case DDCA_IO_USB: snprintf(buf, 100, "Display_Path[/dev/usb/hiddev%d]", dpath->path.hiddev_devno); } return buf; } // *** Display_Ref *** static Display_Ref * create_base_display_ref(DDCA_IO_Path io_path) { Display_Ref * dref = calloc(1, sizeof(Display_Ref)); memcpy(dref->marker, DISPLAY_REF_MARKER, 4); dref->io_path = io_path; dref->vcp_version = VCP_SPEC_UNQUERIED; dref->async_rec = get_display_async_rec(io_path); // keep? return dref; } // PROBLEM: bus display ref getting created some other way /** Creates a #Display_Ref for IO mode #DDCA_IO_DEVI2C * * @param busno /dev/i2c bus number * \return pointer to newly allocated #Display_Ref */ Display_Ref * create_bus_display_ref(int busno) { bool debug = false; DDCA_IO_Path io_path; io_path.io_mode = DDCA_IO_DEVI2C; io_path.path.i2c_busno = busno; Display_Ref * dref = create_base_display_ref(io_path); if (debug) { DBGMSG("Done. Constructed bus display ref:"); dbgrpt_display_ref(dref,0); } return dref; } /** Creates a #Display_Ref for IO mode #DDCA_IO_ADL * * @param iAdapterIndex ADL adapter index * @param iDisplayIndex ADL display index * \return pointer to newly allocated #Display_Ref */ Display_Ref * create_adl_display_ref(int iAdapterIndex, int iDisplayIndex) { bool debug = false; DDCA_IO_Path io_path; io_path.io_mode = DDCA_IO_ADL; io_path.path.adlno.iAdapterIndex = iAdapterIndex; io_path.path.adlno.iDisplayIndex = iDisplayIndex; Display_Ref * dref = create_base_display_ref(io_path); if (debug) { DBGMSG("Done. Constructed ADL display ref:"); dbgrpt_display_ref(dref,0); } return dref; } #ifdef USE_USB /** Creates a #Display_Ref for IO mode #DDCA_IO_ADL * * @param usb_bus USB bus number * @param usb_device USB device number * @param hiddev_devname device name, e.g. /dev/usb/hiddev1 * \return pointer to newly allocated #Display_Ref */ Display_Ref * create_usb_display_ref(int usb_bus, int usb_device, char * hiddev_devname) { assert(hiddev_devname); bool debug = false; DDCA_IO_Path io_path; io_path.io_mode = DDCA_IO_USB; io_path.path.hiddev_devno = hiddev_name_to_number(hiddev_devname); Display_Ref * dref = create_base_display_ref(io_path); dref->usb_bus = usb_bus; dref->usb_device = usb_device; dref->usb_hiddev_name = strdup(hiddev_devname); if (debug) { DBGMSG("Done. Constructed ADL display ref:"); dbgrpt_display_ref(dref,0); } return dref; } #endif #ifdef THANKFULLY_UNNEEDED // Issue: what to do with referenced data structures Display_Ref * clone_display_ref(Display_Ref * old) { assert(old); Display_Ref * dref = calloc(1, sizeof(Display_Ref)); // dref->ddc_io_mode = old->ddc_io_mode; // dref->busno = old->busno; // dref->iAdapterIndex = old->iAdapterIndex; // dref->iDisplayIndex = old->iDisplayIndex; // DBGMSG("dref=%p, old=%p, len=%d ", dref, old, (int) sizeof(BasicDisplayRef) ); memcpy(dref, old, sizeof(Display_Ref)); if (old->usb_hiddev_name) { dref->usb_hiddev_name = strcpy(dref->usb_hiddev_name, old->usb_hiddev_name); } return dref; } #endif // Is it still meaningful to free a display ref? void free_display_ref(Display_Ref * dref) { if (dref && (dref->flags & DREF_TRANSIENT) ) { assert(memcmp(dref->marker, DISPLAY_REF_MARKER,4) == 0); dref->marker[3] = 'x'; if (dref->usb_hiddev_name) // always set by strdup() free(dref->usb_hiddev_name); if (dref->capabilities_string) // always a private copy free(dref->capabilities_string); // 9/2017: what about pedid, detail2? // what to do with gdl, request_queue? free(dref); } } /** Tests if 2 #Display_Ref instances specify the same path to the * display. * * Note that if a display communicates MCCS over both I2C and USB * these are different paths to the display. * * \param this pointer to first #Display_Ref * \param that pointer to second Ddisplay_Ref * \retval true same display * \retval false different displays */ bool dref_eq(Display_Ref* this, Display_Ref* that) { #ifdef OLD bool result = false; if (!this && !that) result = true; else if (this && that) { if (this->io_mode == that->io_mode) { switch (this->io_mode) { case DDCA_IO_DEVI2C: result = (this->busno == that->busno); break; case DDCA_IO_ADL: result = (this->iAdapterIndex == that->iAdapterIndex && this->iDisplayIndex == that->iDisplayIndex); break; case DDCA_IO_USB: result = (this->usb_bus == that->usb_bus && this->usb_device == that->usb_device); break; } } } return result; #endif // return dpath_eq(dpath_from_dref(this), dpath_from_dref(that)); return dpath_eq(this->io_path, that->io_path); } /** Reports the contents of a #Display_Ref in a format appropriate for debugging. * * \param pref pointer to #Display_Ref instance * \param depth logical indentation depth */ void dbgrpt_display_ref(Display_Ref * dref, int depth) { rpt_structure_loc("DisplayRef", dref, depth ); int d1 = depth+1; int d2 = depth+2; #ifdef OLD // old rpt_mapped_int("ddc_io_mode", NULL, dref->io_mode, (Value_To_Name_Function) io_mode_name, d1); switch (dref->io_mode) { case DDCA_IO_DEVI2C: rpt_int("busno", NULL, dref->busno, d1); break; case DDCA_IO_ADL: rpt_int("iAdapterIndex", NULL, dref->iAdapterIndex, d1); rpt_int("iDisplayIndex", NULL, dref->iDisplayIndex, d1); break; case DDCA_IO_USB: rpt_int("usb_bus", NULL, dref->usb_bus, d1); rpt_int("usb_device", NULL, dref->usb_device, d1); rpt_str("usb_hiddev_name", NULL, dref->usb_hiddev_name, d1); rpt_int("usb_hiddev_devno", NULL, dref->usb_hiddev_devno, d1); break; } #endif // alt: rpt_vstring(d1, "io_path: %s", dpath_repr_t(&(dref->io_path))); if (dref->io_path.io_mode == DDCA_IO_USB) { rpt_int("usb_bus", NULL, dref->usb_bus, d1); rpt_int("usb_device", NULL, dref->usb_device, d1); rpt_str("usb_hiddev_name", NULL, dref->usb_hiddev_name, d1); } // rpt_vstring(d1, "vcp_version: %d.%d\n", dref->vcp_version.major, dref->vcp_version.minor ); rpt_vstring(d1, "vcp_version: %s", format_vspec(dref->vcp_version) ); rpt_vstring(d1, "flags: 0x%02x", dref->flags); rpt_vstring(d2, "DDC communication checked: %s", (dref->flags & DREF_DDC_COMMUNICATION_CHECKED) ? "true" : "false"); if (dref->flags & DREF_DDC_COMMUNICATION_CHECKED) rpt_vstring(d2, "DDC communication working: %s", (dref->flags & DREF_DDC_COMMUNICATION_WORKING) ? "true" : "false"); rpt_vstring(d2, "DDC NULL response usage checked: %s", bool_repr(dref->flags & DREF_DDC_NULL_RESPONSE_CHECKED)); if (dref->flags & DREF_DDC_NULL_RESPONSE_CHECKED) rpt_vstring(d2, "DDC NULL response may indicate unsupported: %s", bool_repr(dref->flags & DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED)); } #ifdef OLD /** Creates a short description of a #Display_Ref in a buffer provided * by the caller. * * \param dref pointer to #Display_Ref * \param buf pointer to buffer * \param bufsz buffer size */ static char * dref_short_name_r(Display_Ref * dref, char * buf, int bufsz) { assert(buf); assert(bufsz > 0); switch (dref->io_mode) { case DDCA_IO_DEVI2C: SAFE_SNPRINTF(buf, bufsz, "bus /dev/i2c-%d", dref->busno); // snprintf(buf, bufsz, "bus /dev/i2c-%d", dref->busno); // buf[bufsz-1] = '\0'; // ensure null terminated break; case DDCA_IO_ADL: SAFE_SNPRINTF(buf, bufsz, "adl display %d.%d", dref->iAdapterIndex, dref->iDisplayIndex); // snprintf(buf, bufsz, "adl display %d.%d", dref->iAdapterIndex, dref->iDisplayIndex); // buf[bufsz-1] = '\0'; // ensure null terminated break; case DDCA_IO_USB: SAFE_SNPRINTF(buf, bufsz, "usb %d:%d", dref->usb_bus, dref->usb_device); // snprintf(buf, bufsz, "usb %d:%d", dref->usb_bus, dref->usb_device); buf[bufsz-1] = '\0'; // ensure null terminated break; } return buf; } #endif /** Thread safe function that returns a short description of a #Display_Ref. * The returned value is valid until the next call to this function on * the current thread. * * \param dref pointer to #Display_Ref * \return short description */ char * dref_short_name_t(Display_Ref * dref) { return dpath_short_name_t(&dref->io_path); #ifdef OLD static GPrivate dref_short_name_key = G_PRIVATE_INIT(g_free); char * buf = get_thread_fixed_buffer(&dref_short_name_key, 100); char buf2[80]; snprintf(buf, 100, "Display_Ref[%s]", dref_short_name_r(dref, buf2, 80) ); return buf; #endif } /** Thread safe function that returns a string representation of a #Display_Ref * suitable for diagnostic messages. The returned value is valid until the * next call to this function on the current thread. * * \param dref pointer to #Display_Ref * \return string representation of #Display_Ref */ char * dref_repr_t(Display_Ref * dref) { static GPrivate dref_repr_key = G_PRIVATE_INIT(g_free); char * buf = get_thread_fixed_buffer(&dref_repr_key, 100); // char buf2[80]; SAFE_SNPRINTF(buf, 100, "Display_Ref[%s]", dpath_short_name_t(&dref->io_path)); return buf; } // *** Display_Handle *** /** Creates a #Display_Handle for an I2C #Display_Ref. * * \param fh file handle of open display * \param dref pointer to #Display_Ref * \return newly allocated #Display_Handle * * \remark * This functions handles the boilerplate of creating a #Display_Handle. */ Display_Handle * create_bus_display_handle_from_display_ref(int fh, Display_Ref * dref) { // assert(dref->io_mode == DDCA_IO_DEVI2C); assert(dref->io_path.io_mode == DDCA_IO_DEVI2C); Display_Handle * dh = calloc(1, sizeof(Display_Handle)); memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4); dh->fh = fh; dh->dref = dref; dref->vcp_version = VCP_SPEC_UNQUERIED; dh->repr = gaux_asprintf( "Display_Handle[i2c: fh=%d, busno=%d]", dh->fh, dh->dref->io_path.path.i2c_busno); return dh; } /** Creates a #Display_Handle for an ADL #Display_Ref. * * \param dref pointer to #Display_Ref * \return newly allocated #Display_Handle * * \remark * This functions handles the boilerplate of creating a #Display_Handle. */ Display_Handle * create_adl_display_handle_from_display_ref(Display_Ref * dref) { // assert(dref->io_mode == DDCA_IO_ADL); assert(dref->io_path.io_mode == DDCA_IO_ADL); Display_Handle * dh = calloc(1, sizeof(Display_Handle)); memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4); dh->dref = dref; dref->vcp_version = VCP_SPEC_UNQUERIED; // needed? dh->repr = gaux_asprintf( "Display_Handle[adl: display %d.%d]", dh->dref->io_path.path.adlno.iAdapterIndex, dh->dref->io_path.path.adlno.iDisplayIndex); return dh; } #ifdef USE_USB /** Creates a #Display_Handle for a USB #Display_Ref. * * \param fh file handle of open display * \param dref pointer to #Display_Ref * \return newly allocated #Display_Handle * * \remark * This functions handles to boilerplate of creating a #Display_Handle. */ Display_Handle * create_usb_display_handle_from_display_ref(int fh, Display_Ref * dref) { // assert(dref->io_mode == DDCA_IO_USB); assert(dref->io_path.io_mode == DDCA_IO_USB); Display_Handle * dh = calloc(1, sizeof(Display_Handle)); memcpy(dh->marker, DISPLAY_HANDLE_MARKER, 4); dh->fh = fh; dh->dref = dref; dh->repr = gaux_asprintf( "Display_Handle[usb: %d:%d, %s/hiddev%d]", dh->dref->usb_bus, dh->dref->usb_device, usb_hiddev_directory(), dh->dref->io_path.path.hiddev_devno); dref->vcp_version = VCP_SPEC_UNQUERIED; return dh; } #endif /** Reports the contents of a #Display_Handle in a format useful for debugging. * * \param dh display handle * \param msg if non-null, output this string before the #Display_Handle detail * \param depth logical indentation depth */ void dbgrpt_display_handle(Display_Handle * dh, const char * msg, int depth) { int d1 = depth+1; if (msg) rpt_vstring(depth, "%s", msg); rpt_vstring(d1, "Display_Handle: %p", dh); if (dh) { if (memcmp(dh->marker, DISPLAY_HANDLE_MARKER, 4) != 0) { rpt_vstring(d1, "Invalid marker in struct: 0x%08x, |%.4s|\n", *dh->marker, (char *)dh->marker); } else { rpt_vstring(d1, "dref: %p", dh->dref); rpt_vstring(d1, "io mode: %s", io_mode_name(dh->dref->io_path.io_mode) ); switch (dh->dref->io_path.io_mode) { case (DDCA_IO_DEVI2C): // rpt_vstring(d1, "ddc_io_mode = DDC_IO_DEVI2C"); rpt_vstring(d1, "fh: %d", dh->fh); rpt_vstring(d1, "busno: %d", dh->dref->io_path.path.i2c_busno); break; case (DDCA_IO_ADL): // rpt_vstring(d1, "ddc_io_mode = DDC_IO_ADL"); rpt_vstring(d1, "iAdapterIndex: %d", dh->dref->io_path.path.adlno.iAdapterIndex); rpt_vstring(d1, "iDisplayIndex: %d", dh->dref->io_path.path.adlno.iDisplayIndex); break; case (DDCA_IO_USB): // rpt_vstring(d1, "ddc_io_mode = USB_IO"); rpt_vstring(d1, "fh: %d", dh->fh); rpt_vstring(d1, "usb_bus: %d", dh->dref->usb_bus); rpt_vstring(d1, "usb_device: %d", dh->dref->usb_device); rpt_vstring(d1, "hiddev_device_name: %s", dh->dref->usb_hiddev_name); break; } } // rpt_vstring(d1, "vcp_version: %d.%d", dh->vcp_version.major, dh->vcp_version.minor); } } #ifdef OLD /* Returns a string summarizing the specified #Display_Handle. * * The string is returned in a newly allocated buffer. * It is the responsibility of the caller to free this buffer. * * \param dh display handle * * \return string representation of handle */ char * dh_repr_a(Display_Handle * dh) { assert(dh); assert(dh->dref); char * repr = NULL; switch (dh->dref->io_mode) { case DDCA_IO_DEVI2C: repr = gaux_asprintf( "Display_Handle[i2c: fh=%d, busno=%d]", dh->fh, dh->dref->busno); break; case DDCA_IO_ADL: repr = gaux_asprintf( "Display_Handle[adl: display %d.%d]", dh->dref->iAdapterIndex, dh->dref->iDisplayIndex); break; case DDCA_IO_USB: repr = gaux_asprintf( "Display_Handle[usb: %d:%d, %s/hiddev%d]", dh->dref->usb_bus, dh->dref->usb_device, usb_hiddev_directory(), dh->dref->usb_hiddev_devno); break; } return repr; } #endif #ifdef OLD /* Returns a string summarizing the specified #Display_Handle. * The string is returned in a buffer provided by the caller. * * \param dh display handle * \param buf pointer to buffer * \param bufsz buffer size * * \return string representation of handle (buf) */ static char * dh_repr_r(Display_Handle * dh, char * buf, int bufsz) { assert(dh); assert(dh->dref); switch (dh->dref->io_mode) { case DDCA_IO_DEVI2C: snprintf(buf, bufsz, "Display_Handle[i2c: fh=%d, busno=%d]", dh->fh, dh->dref->busno); break; case DDCA_IO_ADL: snprintf(buf, bufsz, "Display_Handle[adl: display %d.%d]", dh->dref->iAdapterIndex, dh->dref->iDisplayIndex); break; case DDCA_IO_USB: snprintf(buf, bufsz, "Display_Handle[usb: %d:%d, %s/hiddev%d]", dh->dref->usb_bus, dh->dref->usb_device, usb_hiddev_directory(), dh->dref->usb_hiddev_devno); break; } buf[bufsz-1] = '\0'; return buf; } #endif /** Returns a string summarizing the specified #Display_Handle. * * The string is valid until the next call to this function * from within the current thread. * * This variant of #dh_repr() is thread safe. * * \param dh display handle * \return string representation of handle */ char * dh_repr_t(Display_Handle * dh) { static GPrivate dh_buf_key = G_PRIVATE_INIT(g_free); const int bufsz = 100; char * buf = get_thread_fixed_buffer(&dh_buf_key, bufsz); assert(dh); assert(dh->dref); switch (dh->dref->io_path.io_mode) { case DDCA_IO_DEVI2C: snprintf(buf, bufsz, "Display_Handle[i2c: fh=%d, busno=%d]", dh->fh, dh->dref->io_path.path.i2c_busno); break; case DDCA_IO_ADL: snprintf(buf, bufsz, "Display_Handle[adl: display %d.%d]", dh->dref->io_path.path.adlno.iAdapterIndex, dh->dref->io_path.path.adlno.iDisplayIndex); break; case DDCA_IO_USB: snprintf(buf, bufsz, "Display_Handle[usb: %d:%d, %s/hiddev%d]", dh->dref->usb_bus, dh->dref->usb_device, usb_hiddev_directory(), dh->dref->io_path.path.hiddev_devno); break; } buf[bufsz-1] = '\0'; return buf; } /** Returns a string summarizing the specified #Display_Handle. * * \param dh display handle * * \return string representation of handle */ char * dh_repr(Display_Handle * dh) { assert(dh); assert(dh->dref); assert(dh->repr); // Do not calculate and memoize dh->repr here, due to possible race condition between threads // Instead always precalculate at time of Display_Handle creation return dh->repr; } /** Frees a #Display_Handle struct. * * \param dh display handle to free */ void free_display_handle(Display_Handle * dh) { if (dh && memcmp(dh->marker, DISPLAY_HANDLE_MARKER, 4) == 0) { dh->marker[3] = 'x'; free(dh->repr); free(dh); } } // *** Miscellaneous *** /** Creates and initializes a #Video_Card_Info struct. * * \return new instance * * \remark * Currently unused. Struct Video_Card_Info is referenced only in ADL code. */ Video_Card_Info * create_video_card_info() { Video_Card_Info * card_info = calloc(1, sizeof(Video_Card_Info)); memcpy(card_info->marker, VIDEO_CARD_INFO_MARKER, 4); return card_info; } /** Given a hiddev device name, e.g. /dev/usb/hiddev3, * extract its number, e.g. 3. * * \param hiddev_name device name * \return device number, -1 if error */ int hiddev_name_to_number(char * hiddev_name) { assert(hiddev_name); char * p = strstr(hiddev_name, "hiddev"); int hiddev_number = -1; if (p) { p = p + strlen("hiddev"); if (strlen(p) > 0) { // hiddev_number unchanged if error // n str_to_int() allows leading whitespace, not worth checking bool ok = str_to_int(p, &hiddev_number); if (!ok) hiddev_number = -1; // not necessary, but makes coverity happy } } // DBGMSG("hiddev_name = |%s|, returning: %d", hiddev_name, hiddev_number); return hiddev_number; } /** Given a hiddev device number, e.g. 3, return its name, e.g. /dev/usb/hiddev3 * * \param hiddev_number device number * \return device name * * \remark It the the responsibility of the caller to free the returned string. */ char * hiddev_number_to_name(int hiddev_number) { assert(hiddev_number >= 0); char * s = gaux_asprintf("%s/hiddev%d", usb_hiddev_directory(),hiddev_number); // DBGMSG("hiddev_number=%d, returning: %s", hiddev_number, s); return s; } void init_displays() { displays_master_list = g_ptr_array_new(); } ddcutil-0.8.6/src/base/execution_stats.c0000644000175000001440000006374613224160457015204 00000000000000/* execution_stats.c * * For recording and reporting the count and elapsed time of system calls. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Record execution statistics, mainly the count and elapsed time of system calls. */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/glib_util.h" #include "util/report_util.h" #include "base/core.h" #include "base/sleep.h" #include "base/parms.h" #include "base/ddc_errno.h" #include "base/execution_stats.h" // // Typedefs // typedef struct { IO_Event_Type id; const char * name; const char * desc; uint64_t call_nanosec; int call_count; } IO_Event_Type_Stats; // struct that accumulates status code occurrence statistics // The design allows for multiple Status_Code_Counts instances // used for different purposes (e.g. derived status codes), // hence the name field. // But currently there is only 1 instance. #define STATUS_CODE_COUNTS_MARKER "SCCT" typedef struct { char marker[4]; GHashTable * error_counts_hash; // hash table whose key is a status code, and whose // value is the number of occurrences of that status code int total_status_counts; char * name; } Status_Code_Counts; // // Global Variables // // static IO_Event_Type last_io_event; // static long last_io_timestamp = -1; static uint64_t program_start_timestamp; static uint64_t resettable_start_timestamp; static Status_Code_Counts * primary_error_code_counts; static Status_Code_Counts * retryable_error_code_counts; static GMutex status_code_counts_mutex; static GMutex global_stats_mutex; static bool debug_status_code_counts_mutex = false; static bool debug_global_stats_mutex = false; static bool debug_sleep_stats_mutex = false; // // IO Event Tracking // static IO_Event_Type_Stats io_event_stats[] = { // id name desc nanosec count {IE_WRITE, "IE_WRITE", "write calls", 0, 0}, {IE_READ, "IE_READ", "read calls", 0, 0}, {IE_WRITE_READ, "IE_WRITE_READ", "write/read calls", 0, 0}, {IE_OPEN, "IE_OPEN", "open file calls", 0, 0}, {IE_CLOSE, "IE_CLOSE", "close file calls", 0, 0}, {IE_OTHER, "IE_OTHER", "other I/O calls", 0, 0}, }; #define IO_EVENT_TYPE_CT (sizeof(io_event_stats)/sizeof(IO_Event_Type_Stats)) static GMutex io_event_stats_mutex; static bool debug_io_event_stats_mutex; static void reset_io_event_stats() { bool debug = false || debug_io_event_stats_mutex; DBGMSF(debug, "Starting"); g_mutex_lock(&io_event_stats_mutex); for (int ndx = 0; ndx < IO_EVENT_TYPE_CT; ndx++) { io_event_stats[ndx].call_count = 0; io_event_stats[ndx].call_nanosec = 0; } g_mutex_unlock(&io_event_stats_mutex); DBGMSF(debug, "Done"); } /** Returns symbolic name of an event type. * * @param event_type * @return symbolic name */ const char * io_event_name(IO_Event_Type event_type) { // return io_event_names[event_type]; return io_event_stats[event_type].name; } // unused int max_event_name_length() { int result = 0; int ndx = 0; for (;ndx < IO_EVENT_TYPE_CT; ndx++) { int curval = strlen(io_event_stats[ndx].name); if (curval > result) result = curval; } return result; } static int total_io_event_count() { int total = 0; int ndx = 0; for (;ndx < IO_EVENT_TYPE_CT; ndx++) total += io_event_stats[ndx].call_count; return total; } // unused uint64_t total_io_event_nanosec() { uint64_t total = 0; int ndx = 0; for (;ndx < IO_EVENT_TYPE_CT; ndx++) total += io_event_stats[ndx].call_nanosec; return total; } // No effect on program logic, but makes debug messages easier to scan uint64_t normalize_timestamp(uint64_t timestamp) { return timestamp - program_start_timestamp; } /** Called immediately after an I2C IO call, this function updates * two sets of data: * * 1) Updates the total number of calls and elapsed time for * categories of calls. * * 2) Updates the timestamp and call type maintained for the * most recent I2C call. This information is used to determine * the required time for the next sleep call. * * @param event_type e.g. IE_WRITE * @param location function name * @param start_time_nanos starting time of the event in nanoseconds * @param end_time_nanos ending time of the event in nanoseconds */ void log_io_call( const IO_Event_Type event_type, const char * location, uint64_t start_time_nanos, uint64_t end_time_nanos) { bool debug = false || debug_io_event_stats_mutex; uint64_t elapsed_nanos = (end_time_nanos-start_time_nanos); DBGMSF(debug, "event_type=%d %-10s, elapsed_nanos=%"PRIu64", as millis=%"PRIu64, event_type, io_event_name(event_type), elapsed_nanos, elapsed_nanos/(1000*1000) ); g_mutex_lock(&io_event_stats_mutex); io_event_stats[event_type].call_count++; io_event_stats[event_type].call_nanosec += elapsed_nanos; g_mutex_unlock(&io_event_stats_mutex); DBGMSF(debug, "Updated total nanosec = %"PRIu64", as millis=%"PRIu64, io_event_stats[event_type].call_nanosec, io_event_stats[event_type].call_nanosec /(1000*1000) ); // unused // last_io_event = event_type; // last_io_timestamp = normalize_timestamp(end_time_nanos); } /** Reports the accumulated execution statistics * * @param depth logical indentation depth */ void report_io_call_stats(int depth) { int d1 = depth+1; rpt_title("Call Stats:", depth); int total_ct = 0; uint64_t total_nanos = 0; int ndx = 0; // int max_name_length = max_event_name_length(); // not working as variable length string specifier // DBGMSG("max_name_length=%d", max_name_length); rpt_vstring(d1, "%-40s Count Millisec ( Nanosec)", "Type"); for (;ndx < IO_EVENT_TYPE_CT; ndx++) { if (io_event_stats[ndx].call_count > 0) { IO_Event_Type_Stats* curstat = &io_event_stats[ndx]; char buf[100]; snprintf(buf, 100, "%-17s (%s)", curstat->desc, curstat->name); rpt_vstring(d1, "%-40s %4d %10" PRIu64 " (%13" PRIu64 ")", buf, curstat->call_count, curstat->call_nanosec / (1000*1000), curstat->call_nanosec ); total_ct += curstat->call_count; total_nanos += curstat->call_nanosec; } } rpt_vstring(d1, "%-40s %4d %10"PRIu64" (%13" PRIu64 ")", "Totals:", total_ct, total_nanos / (1000*1000), total_nanos ); } // // Status Code Occurrence Tracking // // Design: IO errors are noted in the function that sets psc negative, // do not leave it to caller to set. That way do not need to keep track // if a called function has already set. // // BUT: status codes are not noted until they are modulated to Global_Status_Code static Status_Code_Counts * new_status_code_counts(char * name) { bool debug = false || debug_status_code_counts_mutex; DBGMSF(debug, "Starting"); g_mutex_lock(&status_code_counts_mutex); Status_Code_Counts * pcounts = calloc(1,sizeof(Status_Code_Counts)); memcpy(pcounts->marker, STATUS_CODE_COUNTS_MARKER, 4); pcounts->error_counts_hash = g_hash_table_new(NULL,NULL); pcounts->total_status_counts = 0; if (name) pcounts->name = strdup(name); g_mutex_unlock(&status_code_counts_mutex); DBGMSF(debug, "Done"); return pcounts; } static void reset_status_code_counts_struct(Status_Code_Counts * pcounts) { bool debug = false || debug_status_code_counts_mutex; DBGMSF(debug, "Starting"); assert(pcounts); g_mutex_lock(&status_code_counts_mutex); if (pcounts->error_counts_hash) g_hash_table_remove_all(pcounts->error_counts_hash); pcounts->total_status_counts = 0; g_mutex_unlock(&status_code_counts_mutex); DBGMSF(debug, "Done"); } static void reset_status_code_counts() { reset_status_code_counts_struct(primary_error_code_counts); reset_status_code_counts_struct(retryable_error_code_counts); } static int log_any_status_code(Status_Code_Counts * pcounts, int rc, const char * caller_name) { bool debug = false || debug_status_code_counts_mutex; DBGMSF(debug, "caller=%s, rc=%d", caller_name, rc); assert(pcounts->error_counts_hash); if (rc == 0) { DBGMSG("Called with rc = 0, from function %s", caller_name); } g_mutex_lock(&status_code_counts_mutex); pcounts->total_status_counts++; // n. if key rc not found, returns NULL, which is 0 int ct = GPOINTER_TO_INT(g_hash_table_lookup(pcounts->error_counts_hash, GINT_TO_POINTER(rc)) ); g_hash_table_insert(pcounts->error_counts_hash, GINT_TO_POINTER(rc), GINT_TO_POINTER(ct+1)); // DBGMSG("Old count=%d", ct); // check the new value int newct = GPOINTER_TO_INT(g_hash_table_lookup(pcounts->error_counts_hash, GINT_TO_POINTER(rc)) ); g_mutex_unlock(&status_code_counts_mutex); // DBGMSG("new count for key %d = %d", rc, newct); assert(newct == ct+1); DBGMSF(debug, "Done"); return ct+1; } /** Log a status code occurrence * * @param rc status code * @param caller_name function logging the event * * @return status code (unchanged) * * @remark returning the status code allows for assigning a status code and * logging it to be done in one statement */ Public_Status_Code log_status_code(Public_Status_Code rc, const char * caller_name) { // DBGMSG("rc=%d, caller_name=%s", rc, caller_name); Status_Code_Counts * pcounts = primary_error_code_counts; // if ( ddcrc_is_derived_status_code(rc) ) // pcounts = secondary_status_code_counts; log_any_status_code(pcounts, rc, caller_name); return rc; } /** Log a status code that occurs in a retry loop * * @param rc status code * @param caller_name function logging the event * * @return status code (unchanged) * * @remark returning the status code allows for assigning a status code and * logging it to be done in one statement */ Public_Status_Code log_retryable_status_code(Public_Status_Code rc, const char * caller_name) { // DBGMSG("rc=%d, caller_name=%s", rc, caller_name); Status_Code_Counts * pcounts = retryable_error_code_counts; log_any_status_code(pcounts, rc, caller_name); return rc; } // Used by qsort in show_specific_status_counts() static int compare( const void* a, const void* b) { int int_a = * ( (int*) (a) ); int int_b = * ( (int*) (b) ); if ( int_a == int_b ) return 0; else if ( int_a < int_b ) return 1; else return -1; } static void show_specific_status_counts(Status_Code_Counts * pcounts) { bool debug = false; DBGMSF(debug, "Starting"); char * title = (pcounts->name) ? pcounts->name : "Errors"; assert(pcounts->error_counts_hash); unsigned int keyct; // g_hash_table_get_keys_as_array() new in v 2.40, which is not later than the version // in all but the most recent distros, .e.g SUSE 13.2 is v 2.18 // gpointer * keysp = g_hash_table_get_keys_as_array(pcounts->error_counts_hash, &keyct); GList * glist = g_hash_table_get_keys(pcounts->error_counts_hash); gpointer * keysp = g_list_to_g_array(glist, &keyct); if (debug) { DBGMSG("Keys. keyct=%d", keyct); for (int ndx = 0; ndx < keyct; ndx++) { DBGMSG( "keysp[%d]: %d %p %d", ndx, keysp[ndx], keysp[ndx], GPOINTER_TO_INT(keysp[ndx]) ); } } int summed_ct = 0; // fprintf(stdout, "DDC packet error status codes with non-zero counts: %s\n", fprintf(stdout, "%s: %s\n", title, (keyct == 0) ? "None" : ""); if (keyct > 0) { qsort(keysp, keyct, sizeof(gpointer), compare); // sort keys fprintf(stdout, "Count Status Code Description\n"); int ndx; for (ndx=0; ndx Invalid status code key = %d", key); // break; // } assert( GINT_TO_POINTER(key) == keyp); int ct = GPOINTER_TO_INT(g_hash_table_lookup(pcounts->error_counts_hash,keyp)); summed_ct += ct; // fprintf(stdout, "%4d %6d\n", ct, key); Status_Code_Info * desc = find_status_code_info(key); // or consider flags in Status_Code_Info with this information char * aux_msg = ""; if (ddcrc_is_derived_status_code(key)) aux_msg = " (derived)"; else if (ddcrc_is_not_error(key)) aux_msg = " (not an error)"; fprintf(stdout, "%5d %-28s (%5ld) %s %s\n", ct, (desc) ? desc->name : "", key, (desc) ? desc->description : "", aux_msg ); } } printf("Total errors: %d\n", pcounts->total_status_counts); assert(summed_ct == pcounts->total_status_counts); g_free(keysp); // fprintf(stdout,"\n"); DBGMSF(debug, "Done"); } /** Master function to display status counts */ void show_all_status_counts() { show_specific_status_counts(primary_error_code_counts); // show_specific_status_counts(secondary_status_code_counts); // not used rpt_nl(); show_specific_status_counts(retryable_error_code_counts); } static int get_true_io_error_count(Status_Code_Counts * pcounts) { assert(pcounts->error_counts_hash); unsigned int keyct; // g_hash_table_get_keys_as_array() new in v 2.40, which is not later than the version // in all but the most recent distros, .e.g SUSE 13.2 is v 2.18 // gpointer * keysp = g_hash_table_get_keys_as_array(pcounts->error_counts_hash, &keyct); GList * glist = g_hash_table_get_keys(pcounts->error_counts_hash); gpointer * keysp = g_list_to_g_array(glist, &keyct); int summed_ct = 0; int ndx; for (ndx=0; ndxerror_counts_hash,GINT_TO_POINTER(key))); summed_ct += ct; } // DBGMSG("Total errors: %d", total_counts); assert(summed_ct == pcounts->total_status_counts); g_free(keysp); return summed_ct; } // // Sleep Strategy // // names for Sleep_Event enum values static const char * sleep_event_names[] = { "SE_WRITE_TO_READ", "SE_POST_OPEN", "SE_POST_WRITE", "SE_POST_READ", "SE_DDC_NULL", "SE_POST_SAVE_SETTINGS", }; #define SLEEP_EVENT_ID_CT (sizeof(sleep_event_names)/sizeof(char *)) /** Returns the name of sleep event type */ const char * sleep_event_name(Sleep_Event_Type event_type) { return sleep_event_names[event_type]; } static int sleep_event_cts_by_id[SLEEP_EVENT_ID_CT]; static int total_sleep_event_ct = 0; static int sleep_strategy = 0; static GMutex sleep_stats_mutex; static void reset_sleep_event_counts() { bool debug = false || debug_sleep_stats_mutex; DBGMSF(debug, "Starting"); g_mutex_lock(&sleep_stats_mutex); for (int ndx = 0; ndx < SLEEP_EVENT_ID_CT; ndx++) { sleep_event_cts_by_id[ndx] = 0; } g_mutex_unlock(&sleep_stats_mutex); DBGMSF(debug, "Done"); } // TODO: create table of sleep strategy number, description /** Rudimentary mechanism for changing the sleep strategy. */ bool set_sleep_strategy(int strategy) { if (strategy == -1) // if unset strategy = 0; // use default strategy bool result = false; if (strategy >= 0 && strategy <= 2) { sleep_strategy = strategy; result = true; } return result; } /** Gets the current sleep strategy number */ int get_sleep_strategy() { return sleep_strategy; } /** Gets description of a sleep strategy. * * \param sleep_strategy sleep strategy number * \return description */ char * sleep_strategy_desc(int sleep_strategy) { char * result = NULL; switch(sleep_strategy) { case (0): result = "Default"; break; case (1): result = "Half sleep time"; break; case (2): result = "Double sleep time"; break; default: result = NULL; } return result; } /** Sleep for a period based on a failure event type and the number * of consecutive failures. * * This function does 3 things: * 1. Determines the sleep period based on the communication * mechanism, event type and occurrence number. * 2. Records the sleep event. * 3. Sleeps for period determined. * * @param io_mode communication mechanism (must be #DDCA_IO_DEVI2C) * @param event_type reason for sleep (currently only #SE_DDC_NULL - DDC Null Response) * @param occno occurrence count of event * * @remark * Can be called in a multi-threaded environment. Guards changes to the stats * data structure with a mutex. */ void call_dynamic_tuned_sleep( DDCA_IO_Mode io_mode, Sleep_Event_Type event_type, int occno) { bool debug = false || debug_sleep_stats_mutex; int sleep_time_millis = 0; assert(io_mode == DDCA_IO_DEVI2C); assert(event_type == SE_DDC_NULL); switch(event_type) { case SE_DDC_NULL: sleep_time_millis = occno * DDC_TIMEOUT_MILLIS_NULL_RESPONSE_INCREMENT; break; default: // PROGRAM_LOGIC_ERROR("Invalid sleep event type: %d = %s", event_type, sleep_event_name(event_type)); DBGMSG("PROGRAM LOCIG ERROR: Invalid sleep event type: %d = %s", event_type, sleep_event_name(event_type)); } DBGMSF(debug, "Event type=%s, occno=%d, calculated sleep time = %d millisec", sleep_event_name(event_type), occno, sleep_time_millis); g_mutex_lock(&sleep_stats_mutex); sleep_event_cts_by_id[event_type]++; total_sleep_event_ct++; g_mutex_unlock(&sleep_stats_mutex); sleep_millis(sleep_time_millis); DBGMSF(debug, "Done"); } /** Convenience function for invoking #call_dynamic_tuned_sleep() in * the common case where the communication mechanism is I2C. * * \param event_type * \param occno occurrence count of event */ void call_dynamic_tuned_sleep_i2c( Sleep_Event_Type event_type, int occno) { call_dynamic_tuned_sleep(DDCA_IO_DEVI2C, event_type, occno); } /** Sleep for a period required by the DDC protocol. * * This function allows for tuning the actual sleep time. * * This function does 3 things: * 1. Determine the sleep period based on the communication * mechanism, call type, sleep strategy in effect, * and potentially other information. * 2. Record the sleep event. * 3. Sleep for period determined. * * @param io_mode communication mechanism * @param event_type reason for sleep * * @todo * Extend to take account of actual time since return from * last system call, previous error rate, etc. */ void call_tuned_sleep(DDCA_IO_Mode io_mode, Sleep_Event_Type event_type) { bool debug = false || debug_sleep_stats_mutex; DBGMSF(debug, "Starting"); int sleep_time_millis = 0; // should be a default switch(io_mode) { assert(event_type != SE_DDC_NULL); case DDCA_IO_DEVI2C: switch(event_type) { case (SE_WRITE_TO_READ): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; switch(sleep_strategy) { case (1): sleep_time_millis = sleep_time_millis/2; break; case (2): sleep_time_millis = sleep_time_millis*2; break; default: break; } break; case (SE_POST_WRITE): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; switch(sleep_strategy) { case (1): sleep_time_millis = sleep_time_millis/2; break; case (2): sleep_time_millis = sleep_time_millis*2; break; default: break; } break; case (SE_POST_OPEN): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; break; case (SE_POST_READ): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; break; case (SE_POST_SAVE_SETTINGS): sleep_time_millis = DDC_TIMEOUT_POST_SAVE_SETTINGS; // per DDC spec break; default: sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; } // switch within DDC_IO_DEVI2C break; case DDCA_IO_ADL: switch(event_type) { case (SE_WRITE_TO_READ): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; break; case (SE_POST_WRITE): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; break; case (SE_POST_OPEN): sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; break; case (SE_POST_SAVE_SETTINGS): sleep_time_millis = 200; // per DDC spec break; default: sleep_time_millis = DDC_TIMEOUT_MILLIS_DEFAULT; } break; case DDCA_IO_USB: printf("(%s) call_tuned_sleep() called for USB_IO\n", __func__); break; } // TODO: // get error rate (total calls, total errors), current adjustment value // adjust by time since last i2c event // Is tracing useful, given that we know the event type? // void sleep_millis_with_trace(int milliseconds, const char * caller_location, const char * message); // For better performance, separate mutex for each index in array g_mutex_lock(&sleep_stats_mutex); sleep_event_cts_by_id[event_type]++; total_sleep_event_ct++; g_mutex_unlock(&sleep_stats_mutex); sleep_millis(sleep_time_millis); DBGMSF(debug, "Done"); } // Convenience functions /** Convenience function that invokes call_tuned_sleep() for * /dev/i2c devices. * * @param event_type sleep event type */ void call_tuned_sleep_i2c(Sleep_Event_Type event_type) { call_tuned_sleep(DDCA_IO_DEVI2C, event_type); } /** Convenience function that invokes call_tuned_sleep() for * ADL devices. * * @param event_type sleep event type */ void call_tuned_sleep_adl(Sleep_Event_Type event_type) { call_tuned_sleep(DDCA_IO_ADL, event_type); } /** Convenience function that determines the device type from the * #Display_Handle before invoking all_tuned_sleep(). * @param dh display handle of open device * @param event_type sleep event type */ void call_tuned_sleep_dh(Display_Handle* dh, Sleep_Event_Type event_type) { call_tuned_sleep(dh->dref->io_path.io_mode, event_type); } /** Reports sleep strategy statistics. * * @param depth logical indentation depth */ void report_sleep_strategy_stats(int depth) { int d1 = depth+1; rpt_title("Sleep Strategy Stats:", depth); rpt_vstring(d1, "Total IO events: %5d", total_io_event_count()); rpt_vstring(d1, "IO error count: %5d", get_true_io_error_count(primary_error_code_counts)); rpt_vstring(d1, "Total sleep events: %5d", total_sleep_event_ct); rpt_nl(); rpt_title("Sleep Event type Count", d1); for (int id=0; id < SLEEP_EVENT_ID_CT; id++) { rpt_vstring(d1, "%-21s %4d", sleep_event_names[id], sleep_event_cts_by_id[id]); } } // // Module initialization // /** Initializes execution stats module. * * Must be called once at program startup. */ void init_execution_stats() { primary_error_code_counts = new_status_code_counts("DDC Related Errors"); retryable_error_code_counts = new_status_code_counts("Errors Wrapped in Retry"); // secondary_status_code_counts = new_status_code_counts("Derived and Other Errors"); program_start_timestamp = cur_realtime_nanosec(); resettable_start_timestamp = program_start_timestamp; elapsed_time_nanosec(); // first call initializes, used for dbgtrc } /** Resets collected execution statistics */ void reset_execution_stats() { bool debug = false || debug_global_stats_mutex; DBGMSF(debug, "Starting"); reset_sleep_event_counts(); reset_status_code_counts(); reset_io_event_stats(); g_mutex_lock(&global_stats_mutex); resettable_start_timestamp = cur_realtime_nanosec(); g_mutex_unlock(&global_stats_mutex); DBGMSF(debug, "Done"); } /** Reports elapsed time statistics. * * @param depth logical indentation depth * * If a statistics reset has occurred, reports both the time * since reset and total elapsed time. */ void report_elapsed_stats(int depth) { uint64_t end_nanos = cur_realtime_nanosec(); if (program_start_timestamp != resettable_start_timestamp) { uint64_t cur_elapsed_nanos = end_nanos - resettable_start_timestamp; rpt_vstring(depth, "Elapsed milliseconds since last reset (nanosec):%10"PRIu64" (%13"PRIu64")", cur_elapsed_nanos / (1000*1000), cur_elapsed_nanos); } uint64_t elapsed_nanos = end_nanos - program_start_timestamp; rpt_vstring(depth, "Total elapsed milliseconds (nanoseconds): %10"PRIu64" (%13"PRIu64")", elapsed_nanos / (1000*1000), elapsed_nanos); } ddcutil-0.8.6/src/base/feature_sets.c0000664000175000001440000001332213224274576014447 00000000000000/* features_sets.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Feature set identifiers */ /** \cond */ #include #include #include #include "util/data_structures.h" #include "util/report_util.h" #include "util/string_util.h" /** \endcond */ #include "base/core.h" #include "base/feature_sets.h" // // VCP_Feature_Subset utilities // #ifdef OLD Vcp_Subset_Desc vcp_subset_desc_old[] = { {VCP_SUBSET_PROFILE, "VCP_SUBSET_PROFILE", "PROFILE"}, {VCP_SUBSET_COLOR, "VCP_SUBSET_COLOR", "COLOR"}, {VCP_SUBSET_LUT, "VCP_SUBSET_LUT", "LUT"}, {VCP_SUBSET_CRT, "VCP_SUBSET_CRT", "CRT"}, {VCP_SUBSET_TV, "VCP_SUBSET_TV", "TV"}, {VCP_SUBSET_AUDIO, "VCP_SUBSET_AUDIO", "AUDIO"}, {VCP_SUBSET_WINDOW, "VCP_SUBSET_WINDOW", "WINDOW"}, {VCP_SUBSET_DPVL, "VCP_SUBSET_DPVL", "DPVL"}, {VCP_SUBSET_SCAN, "VCP_SUBSET_SCAN", "SCAN"}, {VCP_SUBSET_ALL, "VCP_SUBSET_ALL", NULL}, {VCP_SUBSET_SUPPORTED, "VCP_SUBSET_SUPPORTED", "SUPPORTED"}, {VCP_SUBSET_KNOWN, "VCP_SUBSET_KNOWN", "KNOWN"}, {VCP_SUBSET_PRESET, "VCP_SUBSET_PRESET", "PRESET"}, {VCP_SUBSET_MFG, "VCP_SUBSET_MFG", "MFG"}, {VCP_SUBSET_TABLE, "VCP_SUBSET_TABLE", "TABLE"}, {VCP_SUBSET_SINGLE_FEATURE, "VCP_SUBSET_SINGLE_FEATURE", NULL}, {VCP_SUBSET_NONE , "VCP_SUBSET_NONE", NULL}, }; const int vcp_subset_count_old = sizeof(vcp_subset_desc_old)/sizeof(struct _Vcp_Subset_Desc); #endif Value_Name_Table vcp_subset_table = { VNT(VCP_SUBSET_PROFILE, "PROFILE"), VNT(VCP_SUBSET_COLOR, "COLOR"), VNT(VCP_SUBSET_LUT, "LUT"), VNT(VCP_SUBSET_CRT, "CRT"), VNT(VCP_SUBSET_TV, "TV"), VNT(VCP_SUBSET_AUDIO, "AUDIO"), VNT(VCP_SUBSET_WINDOW, "WINDOW"), VNT(VCP_SUBSET_DPVL, "DPVL"), VNT(VCP_SUBSET_SCAN, "SCAN"), VNT(VCP_SUBSET_ALL, NULL), VNT(VCP_SUBSET_SUPPORTED, "SUPPORTED"), VNT(VCP_SUBSET_KNOWN, "KNOWN"), VNT(VCP_SUBSET_PRESET, "PRESET"), VNT(VCP_SUBSET_MFG, "MFG"), VNT(VCP_SUBSET_TABLE, "TABLE"), VNT(VCP_SUBSET_SINGLE_FEATURE, NULL), VNT(VCP_SUBSET_NONE, NULL), VNT_END }; // const int vcp_subset_count3 = (sizeof(vcp_subset_desc)/sizeof(Value_Name_Title) ) - 1; const int vcp_subset_count = ARRAY_SIZE(vcp_subset_table) - 1; #ifdef OLD static struct _Vcp_Subset_Desc * find_subset_desc(VCP_Feature_Subset subset_id) { struct _Vcp_Subset_Desc * result = NULL; int ndx = 0; for(; ndxsubset_id_name; return result; } #endif char * feature_subset_names(VCP_Feature_Subset subset_ids) { GString * buf = g_string_sized_new(100); int kk = 0; bool first = true; for(;kk < vcp_subset_count; kk++) { Value_Name_Title cur_desc = vcp_subset_table[kk]; if (subset_ids & cur_desc.value) { if (first) first = false; else g_string_append(buf, ", "); g_string_append(buf, (cur_desc.title) ? cur_desc.title : cur_desc.name); } } char * result = buf->str; g_string_free(buf, false); return result; } #ifdef REFERENCE typedef struct { VCP_Feature_Subset subset; Byte specific_feature; } Feature_Set_Ref; #endif void dbgrpt_feature_set_ref(Feature_Set_Ref * fsref, int depth) { rpt_vstring(depth, "subset: %s (%d)", feature_subset_name(fsref->subset), fsref->subset); rpt_vstring(depth, "specific_feature: 0x%02x", fsref->specific_feature); } static Value_Name_Title_Table feature_set_flag_table = { VNT(FSF_FORCE, "force"), VNT(FSF_SHOW_UNSUPPORTED, "report unsupported features"), VNT(FSF_NOTABLE, "do not report table features"), VNT_END }; const int feature_set_flag_ct = ARRAY_SIZE(feature_set_flag_table)-1; char * feature_set_flag_names(Feature_Set_Flags flags) { return vnt_interpret_flags( flags, feature_set_flag_table, false, // use value name, not description "|"); // sepstr } ddcutil-0.8.6/src/base/linux_errno.c0000644000175000001440000003006413101546540014305 00000000000000/* linux_errno.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Linux errno descriptions */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/string_util.h" #include "base/linux_errno.h" // To consider: use libexplain. // Forward declarations // static Status_Code_Info * get_negative_errno_info(int errnum); Status_Code_Info * find_errno_description(int errnum); void show_errno_desc_table(); /** Initialize linux_errno.c */ // n. called from main before command line parsed, trace control not yet established void init_linux_errno() { #ifdef OLD register_retcode_desc_finder( RR_ERRNO, get_negative_errno_info, false); // finder_arg_is_modulated #endif // show_errno_desc_table(); } // // Error handling // // // Known system error numbers // // Because macro EDENTRY ignores the description value supplied and sets // the description field to NULL, find_eerno_description(), called by // linux_errno_desc(), will lookup the description using strerror(). #define EDENTRY(id,desc) {id, #id, NULL} static Status_Code_Info errno_desc[] = { EDENTRY(0, "success"), EDENTRY(EPERM, "Operation not permitted"), EDENTRY(ENOENT, "No such file or directory"), EDENTRY(ESRCH, "No such process"), // 3 EDENTRY(EINTR, "Interrupted system call"), // 4 EDENTRY(EIO, "I/O error"), // 5 EDENTRY(ENXIO, "No such device or address"), // 6 EDENTRY(E2BIG, "Argument list too long"), EDENTRY(ENOEXEC, "Exec format error"), EDENTRY(EBADF, "Bad file number"), // 9 EDENTRY(ECHILD, "No child processes"), EDENTRY(EAGAIN, "Try again"), EDENTRY(ENOMEM, "Out of memory"), EDENTRY(EACCES, "Permission denied"), // 13 EDENTRY(EFAULT, "Bad address"), // 14 EDENTRY(ENOTBLK, "Block device required"), EDENTRY(EBUSY, "Device or resource busy"), EDENTRY(EEXIST, "File exists"), EDENTRY(EXDEV, "Cross-device link"), EDENTRY(ENODEV, "No such device"), EDENTRY(ENOTDIR, "Not a directory"), EDENTRY(EISDIR, "Is a directory"), EDENTRY(EINVAL, "Invalid argument"), // 22 EDENTRY(ENFILE, "File table overflow"), EDENTRY(EMFILE, "Too many open files"), EDENTRY(ENOTTY, "Not a typewriter"), EDENTRY(ETXTBSY, "Text file busy"), EDENTRY(EFBIG, "File too large"), EDENTRY(ENOSPC, "No space left on device"), EDENTRY(ESPIPE, "Illegal seek"), EDENTRY(EROFS, "Read-only file system"), EDENTRY(EMLINK, "Too many links"), // 31 EDENTRY(EPIPE, "Broken pipe"), // 32 EDENTRY(EDOM, "Math argument out of domain of func"), // 33 EDENTRY(ERANGE, "Math result not representable"), // 34 // break in seq EDENTRY(EPROTO, "Protocol error"), // 71 EDENTRY(ENOTSOCK, "Socket operation on non-socket"), // 88 EDENTRY(EDESTADDRREQ, "Destination address required"), // 89 EDENTRY(EMSGSIZE, "Message too long"), // 90 EDENTRY(EPROTOTYPE, "Protocol wrong type for socket"), // 91 EDENTRY(ENOPROTOOPT, "Protocol not available"), // 92 EDENTRY(EPROTONOSUPPORT, "Protocol not supported"), // 93 EDENTRY(ESOCKTNOSUPPORT, "Socket type not supported"), // 94 EDENTRY(EOPNOTSUPP, "Operation not supported on transport endpoint"),// 95 EDENTRY(EPFNOSUPPORT, "Protocol family not supported"), // 96 EDENTRY(EAFNOSUPPORT, "Address family not supported by protocol"), // 97 EDENTRY(EADDRINUSE, "Address already in use"), // 98 EDENTRY(EADDRNOTAVAIL, "Cannot assign requested address"), // 99 EDENTRY(ENETDOWN, "Network is down"), // 100 EDENTRY(ENETUNREACH, "Network is unreachable"), // 101 EDENTRY(ENETRESET, "Network dropped connection because of reset"), // 102 EDENTRY(ECONNABORTED, "Software caused connection abort"), // 103 EDENTRY(ECONNRESET, "Connection reset by peer"), // 104 EDENTRY(ENOBUFS, "No buffer space available"), // 105 EDENTRY(EISCONN, "Transport endpoint is already connected"), // 106 EDENTRY(ENOTCONN, "Transport endpoint is not connected"), // 107 EDENTRY(ESHUTDOWN, "Cannot send after transport endpoint shutdown"),// 108 EDENTRY(ETOOMANYREFS, "Too many references: cannot splice"), // 109 EDENTRY(ETIMEDOUT, "Connection timed out"), // 110 EDENTRY(ECONNREFUSED, "Connection refused"), // 111 EDENTRY(EHOSTDOWN, "Host is down"), // 112 EDENTRY(EHOSTUNREACH, "No route to host"), // 113 EDENTRY(EALREADY, "Operation already in progress"), // 114 EDENTRY(EINPROGRESS, "Operation now in progress"), // 115 EDENTRY(ESTALE, "Stale file handle"), // 116 EDENTRY(EUCLEAN, "Structure needs cleaning"), // 117 EDENTRY(ENOTNAM , "Not a XENIX named type file"), // 118 EDENTRY(ENAVAIL , "No XENIX semaphores available"), // 119 EDENTRY(EISNAM , "Is a named type file"), // 120 EDENTRY(EREMOTEIO , "Remote I/O error"), // 121 EDENTRY(EDQUOT , "Quota exceeded"), // 122 }; #undef EDENTRY static const int errno_desc_ct = sizeof(errno_desc)/sizeof(Status_Code_Info); #define WORKBUF_SIZE 300 static char workbuf[WORKBUF_SIZE]; static char dummy_errno_description[WORKBUF_SIZE]; static Status_Code_Info dummy_errno_desc; /** Debugging function that displays the errno description table. */ void show_errno_desc_table() { printf("(%s) errno_desc table:\n", __func__); for (int ndx=0; ndx < errno_desc_ct; ndx++) { Status_Code_Info cur = errno_desc[ndx]; printf("(%3d, %-20s, %s\n", cur.code, cur.name, cur.description); } } /* Simple call to get a description string for a Linux errno value. * * For use in specifically reporting an unmodulated Linux error number. * * Arguments: * error_number system errno value * * Returns: * string describing the error. * * The string returned is valid until the next call to this function. */ char * linux_errno_desc(int error_number) { bool debug = false; if (debug) printf("(%s) error_number = %d\n", __func__, error_number); assert(error_number >= 0); Status_Code_Info * pdesc = find_errno_description(error_number); if (pdesc) { snprintf(workbuf, WORKBUF_SIZE, "%s(%d): %s", pdesc->name, error_number, pdesc->description); } else { snprintf(workbuf, WORKBUF_SIZE, "%d: %s", error_number, strerror(error_number)); } if (debug) printf("(%s) error_number=%d, returning: |%s|\n", __func__, error_number, workbuf); return workbuf; } char * linux_errno_name(int error_number) { Status_Code_Info * pdesc = find_errno_description(error_number); return pdesc->name; } /* Returns the Status_Code_Info record for the specified error number * * @param errnum linux error number, in positive, unmodulated form * * @return Status_Code_Description record, NULL if not found * * @remark * If the description field of the found Status_Code_Info struct is NULL, it is set * by calling strerror() */ Status_Code_Info * find_errno_description(int errnum) { bool debug = false; if (debug) printf("(%s) errnum=%d\n", __func__, errnum); Status_Code_Info * result = NULL; int ndx; for (ndx=0; ndx < errno_desc_ct; ndx++) { if (errnum == errno_desc[ndx].code) { result = &errno_desc[ndx]; break; } } if (result && !result->description) { // char * desc = strerror(errnum); // result->description = malloc(strlen(desc)+1); // strcpy(result->description, desc); result->description = strdup(strerror(errnum)); } if (debug) printf("(%s) Returning %p\n", __func__, result); return result; } // n. returned value is valid only until next call Status_Code_Info * create_dynamic_errno_info(int errnum) { Status_Code_Info * result = &dummy_errno_desc; result->code = errnum; result->name = NULL; // would be simpler to use strerror_r(), but the return value of // that function depends on compiler switches. char * s = strerror(errnum); // generates an unknown code message for unrecognized errnum int sz = sizeof(dummy_errno_description); strncpy(dummy_errno_description, s, sz); dummy_errno_description[sz-1] = '\0'; // ensure trailing null in case strncpy truncated result->description = dummy_errno_description; return result; } Status_Code_Info * get_errno_info(int errnum) { Status_Code_Info * result = find_errno_description(errnum); return result; } // returns NULL if not found Status_Code_Info * get_negative_errno_info(int errnum) { bool debug = false; if (debug) printf("(%s) errnum=%d\n", __func__, errnum); return get_errno_info(-errnum); } /** Gets the Linux error number for a symbolic name. * The value is returned as a negative number. * * @param errno_name symbolic name, e.g. EBUSY * @param perrno where to return error number * * @return true if found, false if not */ bool errno_name_to_number(const char * errno_name, int * perrno) { int found = false; *perrno = 0; for (int ndx = 0; ndx < errno_desc_ct; ndx++) { if ( streq(errno_desc[ndx].name, errno_name) ) { *perrno = -errno_desc[ndx].code; found = true; break; } } return found; } /** Gets the Linux error number for a symbolic name. * The value is returned as a negative, modulated number. * * @param errno_name symbolic name, e.g. EBUSY * @param p_error_number where to return error number * * @return true if found, false if not */ #ifdef OLD bool errno_name_to_modulated_number( const char * errno_name, Global_Status_Code * p_error_number) { int result = 0; bool found = errno_name_to_number(errno_name, &result); assert(result >= 0); if (result != 0) { result = modulate_rc(result, RR_ERRNO); assert(result <= 0); } *p_error_number = result; return found; } #endif #ifdef OLD bool errno_name_to_modulated_number( const char * errno_name, Public_Status_Code * p_error_number) { return errno_name_to_number(errno_name, p_error_number); } #endif ddcutil-0.8.6/src/base/sleep.c0000644000175000001440000000736213203271475013063 00000000000000/* sleep.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file sleep.h * Sleep Management * * Sleeps are integral to the DDC protocol. Most of **ddcutil's** elapsed * time is spent in sleeps mandated by the DDC protocol. * Sleep invocation is centralized here to keep statistics and facilitate * future tuning. */ /** \cond */ #include #include #include /** \endcond */ #include "util/report_util.h" #include "util/timestamp.h" #include "base/core.h" #include "base/sleep.h" // // Sleep and sleep statistics // static Sleep_Stats sleep_stats; /** Sets all sleep statistics to 0. */ void init_sleep_stats() { sleep_stats.total_sleep_calls = 0; sleep_stats.requested_sleep_milliseconds = 0; sleep_stats.actual_sleep_nanos = 0; } /** Returns the current sleep statistics * * \return the current value of the accumulated sleep stats */ Sleep_Stats get_sleep_stats() { return sleep_stats; } /** Reports the accumulated sleep statistics * * \param depth logical indentation depth */ void report_sleep_stats(int depth) { int d1 = depth+1; rpt_title("Sleep Call Stats:", depth); rpt_vstring(d1, "Total sleep calls: %10d", sleep_stats.total_sleep_calls); rpt_vstring(d1, "Requested sleep time milliseconds : %10d", sleep_stats.requested_sleep_milliseconds); rpt_vstring(d1, "Actual sleep milliseconds (nanosec): %10"PRIu64" (%13" PRIu64 ")", sleep_stats.actual_sleep_nanos / (1000*1000), sleep_stats.actual_sleep_nanos); } /** Sleep for the specified number of milliseconds. * * \param milliseconds number of milliseconds to sleep */ void sleep_millis(int milliseconds) { uint64_t start_nanos = cur_realtime_nanosec(); usleep(milliseconds*1000); // usleep takes microseconds, not milliseconds sleep_stats.actual_sleep_nanos += (cur_realtime_nanosec()-start_nanos); sleep_stats.requested_sleep_milliseconds += milliseconds; sleep_stats.total_sleep_calls++; } /** Sleep for the specified number of milliseconds, with tracing * * \param milliseconds number of milliseconds to sleep * \param caller_location name of calling function * \param message trace message * * Tracing is only performed if the trace_sleep function internal to this function * is set to **true**. */ void sleep_millis_with_trace( int milliseconds, const char * caller_location, const char * message) { bool trace_sleep = false; if (trace_sleep) { char sloc[100]; char smsg[200]; if (caller_location) snprintf(sloc, 100, "(%s) ", caller_location); else sloc[0] = '\0'; if (message) snprintf(smsg, 200, "%s. ", message); else smsg[0] = '\0'; printf("%s%sSleeping for %d milliseconds\n", sloc, smsg, milliseconds); } sleep_millis(milliseconds); } ddcutil-0.8.6/src/base/status_code_mgt.c0000644000175000001440000003402713213444576015142 00000000000000/* status_code_mgt.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Status Code Management */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/string_util.h" #include "base/ddc_errno.h" #include "base/linux_errno.h" #include "base/status_code_mgt.h" /* Notes on status code management. Status codes in the ddcutil have multiple sources: 1) Linux system calls. - In general, functions return 0 or a positive value to indicate success. - Values greater than 0 indicate something about a successful call, such as the number of bytes read. - Negative values indicate that an error occurred. In that case the special variable errno is typically the "error code", though some packages set the return code to -errno. - Errno values, listed in errno.h, are positive numbers ranging from 1 to apparently less than 200. 2) ADL - ADL functions return status codes, listed in file adl_defines.h - The value of these codes ranges from 4 to -21. 0 indicates normal success. - Positive values appear to be "ok, but". Not clear when these values occur or what to do about them. - Negative values indicate errors, some of which may reflect programming errors. 3) ddcutil specific status codes. Problem: Linux and ADL error numbers conflict. ddcutil error numbers can be assigned to a range out of conflict. Solution. Mulitplexing. */ // Describes a status code range typedef struct { Retcode_Range_Id id; int base; int max; Retcode_Description_Finder desc_finder; bool finder_arg_is_modulated; Retcode_Number_Finder number_finder; Retcode_Number_Finder base_number_finder; } Retcode_Range_Table_Entry; // order must be kept consistent with Retcode_Range_Id // For explainers in files that are included by this file, the explainer // can be filled in statically. For other files, register_retcode_desc_finder() // is called by the initializer function in those files. Retcode_Range_Table_Entry retcode_range_table[] = { {.id = RR_ERRNO, .base = RCRANGE_ERRNO_START, .max = RCRANGE_ERRNO_MAX, // .desc_finder = NULL, // will be filled in by call to ... // .finder_arg_is_modulated = false, // ... register_retcode_desc_finder() .desc_finder = get_negative_errno_info, .finder_arg_is_modulated = true, // finder_arg_is_modulated // .number_finder = errno_name_to_modulated_number, .number_finder = errno_name_to_number, .base_number_finder = errno_name_to_number }, {.id = RR_ADL, .base = RCRANGE_ADL_START, .max = RCRANGE_ADL_MAX, // .desc_finder = NULL, // will be filled in by call to ... // .finder_arg_is_modulated = false, // ... register_retcode_desc_finder() .desc_finder = get_adl_status_description, .finder_arg_is_modulated = false, // finder_arg_is_modulated .number_finder = adl_error_name_to_modulated_number, // mock implementation if not HAVE_ADL .base_number_finder = adl_error_name_to_number // mock implementation if not HAVE_ADL }, {.id = RR_DDC, .base = RCRANGE_DDC_START, .max = RCRANGE_DDC_MAX, .desc_finder = ddcrc_find_status_code_info, .finder_arg_is_modulated = true, // .number_finder = ddc_error_name_to_modulated_number, .number_finder = ddc_error_name_to_number, .base_number_finder = ddc_error_name_to_number }, }; int retcode_range_ct = sizeof(retcode_range_table)/sizeof(Retcode_Range_Table_Entry); static void validate_retcode_range_table() { int ndx = 0; for (;ndx < retcode_range_ct; ndx++) { // printf("ndx=%d, id=%d, base=%d\n", ndx, retcode_range_table[ndx].id, retcode_range_table[ndx].base); assert( retcode_range_table[ndx].id == ndx); } } #ifdef OLD /** This function is called by modules for specific status code ranges * to register the explanation routines for their * status codes. It exists to avoid circular dependencies of includes. * * @param id status code range id * @param finder_func function to return #Status_Code_Info struct for a status code, * of type #Retcode_Description_Finder * @param finder_arg_is_modulated if true, **finder_func** takes a modulated * status code as an argument. If false, it * takes an unmodualted value. * * @remark * This function will be executed from module initialization functions, which are called * from main before the command line is parsed, so trace control not yet configured */ void register_retcode_desc_finder( Retcode_Range_Id id, Retcode_Description_Finder finder_func, bool finder_arg_is_modulated) { bool debug = false; if (debug) printf("(%s) registering callback description finder for range id %d, finder_func=%p, finder_arg_is_modulated=%s\n", __func__, id, finder_func, bool_repr(finder_arg_is_modulated)); retcode_range_table[id].desc_finder = finder_func; retcode_range_table[id].finder_arg_is_modulated = finder_arg_is_modulated; } #endif /** Shifts a status code in the RR_BASE range to a specified range. * * @param rc base status code to modulate * @param range_id range to which status code should be modulated * * @return modulated status code * * @remark * It is an error to pass an already modulated status code as an argument to * this function. */ int modulate_rc(int rc, Retcode_Range_Id range_id){ bool debug = false; if (debug) printf("(%s) rc=%d, range_id=%d\n", __func__, rc, range_id); assert(range_id == RR_ADL); // assert( abs(rc) <= RCRANGE_BASE_MAX ); int base = retcode_range_table[range_id].base; if (rc != 0) { if (rc < 0) rc -= base; else rc += base; } if (debug) printf("(%s) Returning: %d\n", __func__, rc); return rc; } /** Shifts a status code from the specified modulation range to the base range * * @param rc status code to demodulate * @param range_id a modulation range * * @return demodulated status code * * @remark * It is an error to pass an unmodulated status code as an * argument to this funtion. */ int demodulate_rc(int rc, Retcode_Range_Id range_id) { // TODO: check that rc is in the specified modulation range // assert( abs(rc) > RCRANGE_BASE_MAX ); assert(range_id == RR_ADL); int base = retcode_range_table[range_id].base; if (rc != 0) { if (rc < 0) rc = rc + base; // rc = -((-rc)-base); else rc = rc-base; } return rc; } /** Determines the modulation range for a status code. * * @param rc status code to check * * @return range identifier (#Retcode_Range_Id) */ Retcode_Range_Id get_modulation(Public_Status_Code rc) { int ndx = 0; int abs_rc = abs(rc); Retcode_Range_Id range_id; for (;ndx < retcode_range_ct; ndx++) { if (abs_rc >= retcode_range_table[ndx].base && abs_rc <= retcode_range_table[ndx].max) { range_id = retcode_range_table[ndx].id; assert (range_id == ndx); break; } } assert(ndx < retcode_range_ct); // fails if not found // printf("(%s) rc=%d, returning %d\n", __func__, rc, range_id); return range_id; } static Status_Code_Info ok_status_code_info = {0, "OK", "success"}; // N.B. Works equally well whether argument is a Global_Status_Code or a // Public_Status_Code. get_modulaetion() figures things out /** Given a #Public_Status_Code, returns a pointer to the #Status_Code_Info struct. * desribing it. * * @param status_code global (modulated) status code * @return pointer to #Status_Code_Info for staus code, NULL if not found */ Status_Code_Info * find_status_code_info(Public_Status_Code status_code) { bool debug = false; // use don't use DBGMSG to avoid circular includes if (debug) printf("(%s) Starting. rc = %d\n", __func__, status_code); Status_Code_Info * pinfo = NULL; if (status_code == 0) pinfo = &ok_status_code_info; else { Retcode_Range_Id modulation = get_modulation(status_code); if (debug) printf("(%s) modulation=%d\n", __func__, modulation); Retcode_Description_Finder finder_func = retcode_range_table[modulation].desc_finder; assert(finder_func != NULL); bool finder_arg_is_modulated = retcode_range_table[modulation].finder_arg_is_modulated; int rawrc = (finder_arg_is_modulated) ? status_code : demodulate_rc(status_code, modulation); if (debug) printf("(%s) rawrc = %d\n", __func__, rawrc); pinfo = finder_func(rawrc); } if (debug) { printf("(%s) Done. Returning %p", __func__, pinfo); if (pinfo) report_status_code_info(pinfo); } return pinfo; } #define GSC_WORKBUF_SIZE 300 /** Returns a description string for a #Public_Status_Code. * Synthesizes a description if information for the status code cannot be found. * * @param psc status code number * @return string description of status code * * @remark * The value returned is valid until the next call of this function in the * same thread. Caller should not free. */ char * psc_desc(Public_Status_Code psc) { static GPrivate psc_desc_key = G_PRIVATE_INIT(g_free); char * workbuf = get_thread_fixed_buffer(&psc_desc_key, GSC_WORKBUF_SIZE); // printf("(%s) workbuf=%p\n", __func__, workbuf); // static char workbuf[GSC_WORKBUF_SIZE]; // printf("(%s) status_code=%d\n", __func__, status_code); Status_Code_Info * pinfo = find_status_code_info(psc); if (pinfo) { snprintf(workbuf, GSC_WORKBUF_SIZE, "%s(%d): %s", pinfo->name, psc, pinfo->description); } else { snprintf(workbuf, GSC_WORKBUF_SIZE, "%d", psc ); } return workbuf; } #undef GSC_WORKBUF_SIZE /** Returns the symbolic name of a #Public_Status_Code * * @param status_code status code value * @return symbolic name, or "" if not found */ char * psc_name(Public_Status_Code status_code) { Status_Code_Info * pdesc = find_status_code_info(status_code); char * result = (pdesc) ? pdesc->name : ""; return result; } /** Given a status code name, convert it to a unmodulated base status code * Valid only for those status code ranges which ... * * * @param status_code_name * @param p_error_number where to return status code number * @return true if conversion successful, false if unrecognized status code */ bool status_name_to_unmodulated_number( const char * status_code_name, int * p_error_number) { int status_code = 0; bool found = false; for (int ndx = 1; ndx < retcode_range_ct; ndx++) { // printf("ndx=%d, id=%d, base=%d\n", ndx, retcode_range_table[ndx].id, retcode_range_table[ndx].base); if (retcode_range_table[ndx].base_number_finder) { found = retcode_range_table[ndx].base_number_finder(status_code_name, &status_code); if (found) break; } } *p_error_number = status_code; return found; } /** Given a status code symbolic name, convert it to #Public_Status_Code value. * * If the name is for an ADL status code, the value is modulated. * * @param status_code_name * @param p_error_number where to return status code number * @return true if conversion successful, false if unrecognized status code */ bool status_name_to_modulated_number( const char * status_code_name, Public_Status_Code * p_error_number) { Public_Status_Code psc = 0; bool found = false; for (int ndx = 1; ndx < retcode_range_ct; ndx++) { // printf("ndx=%d, id=%d, base=%d\n", ndx, retcode_range_table[ndx].id, retcode_range_table[ndx].base); if (retcode_range_table[ndx].number_finder) { found = retcode_range_table[ndx].number_finder(status_code_name, &psc); if (found) break; } } *p_error_number = psc; return found; } // // Initialization and debugging // /** Initialize this module. */ void init_status_code_mgt() { // N.B called before command line parsed, so command line trace control not in effect // printf("(%s) Starting\n", __func__); validate_retcode_range_table(); // uses asserts to check consistency // error_counts_hash = g_hash_table_new(NULL,NULL); // initialize_ddcrc_desc(); } /** Display the contents of a #Status_Code_Info struct. * This is a debugging function. * * @param pdesc pointer to #Status_Code_Info struct */ void report_status_code_info(Status_Code_Info * pdesc) { printf("Status_Code_Info struct at %p\n", pdesc); if (pdesc) { printf("code: %d\n", pdesc->code); printf("name: %p: %s\n", pdesc->name, pdesc->name); printf("description: %p: %s\n", pdesc->description, pdesc->description); // printf("memoized_description: %p: %s\n", pdesc->memoized_description, pdesc->memoized_description); } } ddcutil-0.8.6/src/base/vcp_version.c0000644000175000001440000002353313213715037014304 00000000000000/* vcp_version.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * VCP/MCCS Version Specification * */ /** \cond */ #include #include #include #include /** \endcond */ #include "util/data_structures.h" #include "util/string_util.h" #include "base/core.h" #include "base/vcp_version.h" // // MCCS version constants and utilities // const DDCA_MCCS_Version_Spec VCP_SPEC_V10 = {1,0}; ///< MCCS version 1.0 const DDCA_MCCS_Version_Spec VCP_SPEC_V20 = {2,0}; ///< MCCS version 2.0 const DDCA_MCCS_Version_Spec VCP_SPEC_V21 = {2,1}; ///< MCCS version 2.1 const DDCA_MCCS_Version_Spec VCP_SPEC_V30 = {3,0}; ///< MCCS version 3.0 const DDCA_MCCS_Version_Spec VCP_SPEC_V22 = {2,2}; ///< MCCS version 2.2 const DDCA_MCCS_Version_Spec VCP_SPEC_UNKNOWN = {0,0}; ///< value for monitor has been queried unsuccessfully const DDCA_MCCS_Version_Spec VCP_SPEC_ANY = {0,0}; ///< used as query specifier const DDCA_MCCS_Version_Spec VCP_SPEC_UNQUERIED = {0xff, 0xff}; ///< indicates version not queried /* Tests if a #DDCA_MCCS_Version_Spec value represents a valid MCCS version, * i.e. 1.0, 2.0, 2.1, 3.0, or 2.2. * * @param vspec value to test * * @return true/false */ static bool is_known_vcp_spec(DDCA_MCCS_Version_Spec vspec) { bool result = vcp_version_eq(vspec, VCP_SPEC_V10) || vcp_version_eq(vspec, VCP_SPEC_V20) || vcp_version_eq(vspec, VCP_SPEC_V21) || vcp_version_eq(vspec, VCP_SPEC_V30) || vcp_version_eq(vspec, VCP_SPEC_V22); return result; } /** \file * Note that MCCS (VCP) versioning forms a directed graph, not a linear ordering. * * The v3.0 spec is an extension of v2.1, not v2.2. * Both v3.0 and v2.2 are successors to v2.1. * * -- v3.0 * | * v1.0---v2.0---- v2.1 * | * -- v2.2 * */ /** Checks if one #DDCA_MCCS_Version_Spec is less than or equal * to another. * * @param v1 first version spec * @param v2 second version spec * * @retval true v1 is <= v2 * @retval false v1 > v2 * * @remark * Aborts if an attempt is made to compare v2.2 with v3.0 * @remark * Will require modification if a new spec appears */ bool vcp_version_le(DDCA_MCCS_Version_Spec v1, DDCA_MCCS_Version_Spec v2) { bool debug = false; bool result = false; assert( is_known_vcp_spec(v1) && is_known_vcp_spec(v2) ); assert( !(vcp_version_eq(v1, VCP_SPEC_V22) && vcp_version_eq(v2, VCP_SPEC_V30)) && !(vcp_version_eq(v2, VCP_SPEC_V22) && vcp_version_eq(v1, VCP_SPEC_V30)) ); if (v1.major < v2.major) result = true; else if (v1.major == v2.major) { if (v1.minor <= v2.minor) result = true; } DBGMSF(debug, "v1=%d.%d <= v2=%d.%d returning: %s", v1.major, v2.minor, v2.major, v2.minor, bool_repr(result)); return result; } /** CHecks if one #DDCA_MCCS_Version_Spec is greater than another. * * See \see vcp_version_le for discussion of version comparison * * @param val first version * @param min second version * @return true/false */ bool vcp_version_gt(DDCA_MCCS_Version_Spec val, DDCA_MCCS_Version_Spec min) { return !vcp_version_le(val,min); } /** Test if two DDCA_MCCS_VersionSpec values are identical. * @param v1 first version * @param v2 second version * @return true/false */ bool vcp_version_eq(DDCA_MCCS_Version_Spec v1, DDCA_MCCS_Version_Spec v2){ return (v1.major == v2.major) && (v1.minor == v2.minor); } /** Tests if a #DDCA_MCCS_Version_Spec represents "unqueried". * * Encapsulates the use of a magic number. * * @param vspec version spec to test * @result true/false */ bool vcp_version_is_unqueried(DDCA_MCCS_Version_Spec vspec) { return (vspec.major == 0xff && vspec.minor == 0xff); } /** Converts a #DDCA_MCCS_Version_Spec to a printable string, * handling the special values for unqueried and unknown. * * @param vspec version spec * @return string in the form "2.0" * @retval "unqueried" for VCP_SPEC_UNQUERIED * @retval "Unknown" for VCP_SPEC_UNKNOWN */ char * format_vspec(DDCA_MCCS_Version_Spec vspec) { static char private_buffer[20]; if ( vcp_version_eq(vspec, VCP_SPEC_UNQUERIED) ) g_strlcpy(private_buffer, "Unqueried", sizeof(private_buffer)); // g_strlcpy() to quiet covrity else if ( vcp_version_eq(vspec, VCP_SPEC_UNKNOWN) ) strcpy(private_buffer, "Unknown"); // will coverity flag this? else snprintf(private_buffer, 20, "%d.%d", vspec.major, vspec.minor); // DBGMSG("Returning: |%s|", private_buffer); return private_buffer; } // new way: Value_Name_Title_Table version_id_table = { VNT(DDCA_V10, "1.0"), VNT(DDCA_V20, "2.0"), VNT(DDCA_V21, "2.1"), VNT(DDCA_V30, "3.0"), VNT(DDCA_V22, "2.2"), VNT(DDCA_VNONE, "unknown"), VNT_END }; /** Returns a #DDCA_MCCS_Version_Id in a form suitable for display, * e.g. "2.0". * * @param version_id version id value * @return value in external form. */ char * format_vcp_version_id(DDCA_MCCS_Version_Id version_id) { char * result = NULL; switch (version_id) { case DDCA_V10: result = "1.0"; break; case DDCA_V20: result = "2.0"; break; case DDCA_V21: result = "2.1"; break; case DDCA_V30: result = "3.0"; break; case DDCA_V22: result = "2.2"; break; case DDCA_VNONE: result = "unknown"; break; } char * result2 = vnt_title(version_id_table, version_id); assert(streq(result, result2)); return result; } #ifdef OLD char * vcp_version_id_name0(DDCA_MCCS_Version_Id version_id) { bool debug = false; DBGMSF(debug, "Starting. version_id=%d", version_id); char * result = NULL; switch (version_id) { case DDCA_V10: result = "DDCA_V10"; break; case DDCA_V20: result = "DDCA_V20"; break; case DDCA_V21: result = "DDCA_V21"; break; case DDCA_V30: result = "DDCA_V30"; break; case DDCA_V22: result = "DDCA_V22"; break; case DDCA_VNONE: result = "DDCA_VNONE"; break; } char * result2 = vnt_name(version_id_table, version_id); assert(streq(result, result2)); DBGMSF(debug, "Returning: %s", result); return result; } #endif char * vcp_version_id_name(DDCA_MCCS_Version_Id version_id) { bool debug = false; DBGMSF(debug, "Starting. version_id=%d", version_id); char * result = vnt_name(version_id_table, version_id); DBGMSF(debug, "Returning: %s", result); return result; } /** Converts a string representation of an MCCS version, e.g. "2.2" * to a version spec (integer pair). * * @param s string to convert * @return integer pair of major and minor versions * retval DDCA_UNK if invalid string */ DDCA_MCCS_Version_Spec parse_vspec(char * s) { DDCA_MCCS_Version_Spec vspec; int ct = sscanf(s, "%hhd . %hhd", &vspec.major, &vspec.minor); if (ct != 2 || vspec.major > 3 || vspec.minor > 2) { vspec = VCP_SPEC_UNKNOWN; } return vspec; } /** Converts a MCCS version spec (integer pair) to a version id (enumeration). * * @param vspec version spec * @return version id * @retval #DDCA_VUNK if vspec does not represent a valid MCCS version */ DDCA_MCCS_Version_Id mccs_version_spec_to_id(DDCA_MCCS_Version_Spec vspec) { DDCA_MCCS_Version_Id result = DDCA_VUNK; // initialize to avoid compiler warning if (vspec.major == 1 && vspec.minor == 0) result = DDCA_V10; else if (vspec.major == 2 && vspec.minor == 0) result = DDCA_V20; else if (vspec.major == 2 && vspec.minor == 1) result = DDCA_V21; else if (vspec.major == 3 && vspec.minor == 0) result = DDCA_V30; else if (vspec.major == 2 && vspec.minor == 2) result = DDCA_V22; else if (vspec.major == 2 && vspec.minor == 1) result = DDCA_V21; else if (vspec.major == 0 && vspec.minor == 0) result = DDCA_VUNK; // case UNQUERIED should never arise else { PROGRAM_LOGIC_ERROR("Unexpected version spec value %d.%d", vspec.major, vspec.minor); assert(false); result = DDCA_VUNK; // in case assertions turned off } return result; } /** Converts a MCCS version id (enumerated value) to * a version spec (integer pair). * * @param id version id * @return version spec */ DDCA_MCCS_Version_Spec mccs_version_id_to_spec(DDCA_MCCS_Version_Id id) { bool debug = false; DBGMSF(debug, "Starting. id=%d", id); DDCA_MCCS_Version_Spec vspec = VCP_SPEC_ANY; // use table instead? switch(id) { case DDCA_VANY: vspec = VCP_SPEC_ANY; break; case DDCA_V10: vspec = VCP_SPEC_V10; break; case DDCA_V20: vspec = VCP_SPEC_V20; break; case DDCA_V21: vspec = VCP_SPEC_V21; break; case DDCA_V30: vspec = VCP_SPEC_V30; break; case DDCA_V22: vspec = VCP_SPEC_V22; break; } // DDCA_MCCS_Version_Spec converted; // converted.major = vspec.major; // converted.minor = vspec.minor; DBGMSF(debug, "Returning: %d.%d", debug, vspec.major, vspec.minor); return vspec; } ddcutil-0.8.6/src/base/adl_errors.h0000644000175000001440000000261013230445447014105 00000000000000/*adl_errors.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * ADL Error Number Services */ #ifndef ADL_ERRORS_H_ #define ADL_ERRORS_H_ #include "base/status_code_mgt.h" void init_adl_errors() ; Status_Code_Info * get_adl_status_description(int errnum); bool adl_error_name_to_number( const char * adl_error_name, Base_Status_ADL * p_adl_error_number); bool adl_error_name_to_modulated_number( const char * adl_error_name, Modulated_Status_ADL * p_adl_error_number); #endif /* ADL_ERRORS_H_ */ ddcutil-0.8.6/src/base/base_init.h0000644000175000001440000000205713230445447013713 00000000000000/** \file base_init.h" * Master base services initialization */ /* * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef BASE_SERVICES_H_ #define BASE_SERVICES_H_ void init_base_services(); #endif /* BASE_SERVICES_H_ */ ddcutil-0.8.6/src/base/build_info.h0000644000175000001440000000221613230445447014065 00000000000000/** \file build_info.h * * Build Information: version, build timestamp, etc. */ /* build_info.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef BUILD_INFO_H_ #define BUILD_INFO_H_ extern const char * BUILD_VERSION; extern const char * BUILD_DATE; extern const char * BUILD_TIME; #endif /* BUILD_INFO_H_ */ ddcutil-0.8.6/src/base/feature_sets.h0000644000175000001440000000516113230445447014446 00000000000000/* feature_sets.h * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Feature set identifiers */ #ifndef FEATURE_SETS_H_ #define FEATURE_SETS_H_ /** \cond */ #include #include "util/coredefs.h" /** \endcond */ // If this enum is changed, be sure to change the corresponding // table in feature_sets.c typedef enum { VCP_SUBSET_PROFILE = 0x8000, VCP_SUBSET_COLOR = 0x4000, VCP_SUBSET_LUT = 0x2000, VCP_SUBSET_CRT = 0x1000, VCP_SUBSET_TV = 0x0800, VCP_SUBSET_AUDIO = 0x0400, VCP_SUBSET_WINDOW = 0x0200, VCP_SUBSET_DPVL = 0x0100, // subsets used only on commands processing, // not in feature descriptor table VCP_SUBSET_SCAN = 0x0080, VCP_SUBSET_ALL = 0x0040, VCP_SUBSET_SUPPORTED = 0x0020, VCP_SUBSET_KNOWN = 0x0010, VCP_SUBSET_PRESET = 0x0008, // uses VCP_SPEC_PRESET VCP_SUBSET_MFG = 0x0004, // mfg specific codes VCP_SUBSET_TABLE = 0x0002, // is a table feature VCP_SUBSET_SINGLE_FEATURE = 0x0001, VCP_SUBSET_NONE = 0x0000, } VCP_Feature_Subset; char * feature_subset_name(VCP_Feature_Subset subset_id); char * feature_subset_names(VCP_Feature_Subset subset_ids); typedef struct { VCP_Feature_Subset subset; Byte specific_feature; } Feature_Set_Ref; typedef enum { // apply to multiple feature feature sets FSF_SHOW_UNSUPPORTED = 0x01, FSF_NOTABLE = 0x02, // applies to single feature feature set FSF_FORCE = 0x04 } Feature_Set_Flags; char * feature_set_flag_names(Feature_Set_Flags flags); void dbgrpt_feature_set_ref(Feature_Set_Ref * fsref, int depth); #endif /* FEATURE_SETS_H_ */ ddcutil-0.8.6/src/base/linux_errno.h0000644000175000001440000000306313230445447014320 00000000000000/* linux_errno.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Linux errno descriptions */ #ifndef BASE_LINUX_ERRNO_H_ #define BASE_LINUX_ERRNO_H_ #include "base/status_code_mgt.h" void init_linux_errno(); // Interpret system error number // not thread safe, always points to same internal buffer, contents overwritten on each call char * linux_errno_name(int error_number); char * linux_errno_desc(int error_number); Status_Code_Info * get_errno_info(int errnum); Status_Code_Info * get_negative_errno_info(int errnum); bool errno_name_to_number(const char * errno_name, int * perrno); bool errno_name_to_modulated_number(const char * errno_name, Public_Status_Code * p_error_number); #endif /* BASE_LINUX_ERRNO_H_ */ ddcutil-0.8.6/src/base/parms.h0000644000175000001440000001015113230445447013072 00000000000000/* parms.h * * Tunable parameters. * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * System configuration and tuning */ #ifndef PARMS_H_ #define PARMS_H_ // // *** Timeout values // // n. the DDC spec lists timeout values in milliseconds /** Normal timeout value in DDC spec */ #define DDC_TIMEOUT_MILLIS_DEFAULT 50 #ifdef UNUSED /** Timeout between DDC Get Feature Request and Get Feature Reply */ #define DDC_TIMEOUT_MILLIS_POST_GETVCP_WRITE 40 // per spec #endif /** Timeout following a DDC Set VCP Feature command, per DDC spec */ #define DDC_TIMEOUT_MILLIS_POST_SETVCP_WRITE 50 /** Timeout following a DDC Save Command Settings command, per DDC spec */ #define DDC_TIMEOUT_POST_SAVE_SETTINGS 200 #ifdef UNUSED #define DDC_TIMEOUT_MILLIS_POST_CAPABILITIES_READ 50 #endif // not part of spec /** Timeout between retries */ #define DDC_TIMEOUT_MILLIS_RETRY 200 /** Use default timeout */ #define DDC_TIMEOUT_USE_DEFAULT -1 /** No timeout */ #define DDC_TIMEOUT_NONE 0 /** Timeout value used for dynamic tuned sleep in case of DDC Null Message response */ #define DDC_TIMEOUT_MILLIS_NULL_RESPONSE_INCREMENT 100 // // *** Choose method of low level IC2 communication // // Parms used within production portion of code #define DEFAULT_I2C_IO_STRATEGY I2C_IO_STRATEGY_FILEIO // #define DEFAULT_I2C_IO_STRATEGY I2C_IO_STRATEGY_IOCTL // Parms used only within testcase portion of code: #define DEFAULT_I2C_WRITE_MODE "write" // #define DEFAULT_I2C_WRITE_MODE "ioctl_write" //#define DEFAULT_I2C_WRITE_MODE "i2c_smbus_write_i2c_block_data" #define DEFAULT_I2C_READ_MODE "read" // #define DEFAULT_I2C_READ_MODE "ioctl_read" // i2c_smbus_read_i2c_block_data can't handle capabilities fragments 32 bytes in size, since with // "envelope" the packet exceeds the i2c_smbus_read_i2c_block_data 32 byte limit // Notes on I2C IO strategies // // TODO: move comments re smbus problems to low level smbus functions (currently in i2c_base_io.c) // // Default settings in i2c_io.c // valid write modes: "write", "ioctl_write", "i2c_smbus_write_i2c_block_data" // valid read modes: "read", "ioctl_read", "i2c_smbus_read_i2c_block_data" // 11/2015: write modes "write" and "ioctl_write" both work // "i2c_smbus_write_i2c_block_data" returns ERRNO EINVAL, invalid argument // "read" and "ioctl_read" both work, appear comparable // fails: "i2c_smb_read_i2c_block_data" // // *** Retry Management *** // // Affects memory allocation in try_stats: #define MAX_MAX_TRIES 15 // All MAX_..._TRIES values must be <= MAX_MAX_TRIES #define MAX_WRITE_ONLY_EXCHANGE_TRIES 4 #define MAX_WRITE_READ_EXCHANGE_TRIES 10 #define MAX_MULTI_EXCHANGE_TRIES 8 // // *** Miscellaneous // /** Maximum numbers of values on setvcp command */ #define MAX_SETVCP_VALUES 50 /** Maximum command arguments */ // #define MAX_ARGS (MAX_SETVCP_VALUES*2) // causes CMDID_* undefined #define MAX_ARGS 100 // hack /** Parallelize display checks during initialization if at least this number of displays */ // on banner with 4 displays, async detect: 1.7 sec, non-async 3.4 sec #define DISPLAY_CHECK_ASYNC_THRESHOLD 2 #define DISPLAY_CHECK_ASYNC_NEVER 0xff #endif /* PARMS_H_ */ ddcutil-0.8.6/src/base/sleep.h0000644000175000001440000000323413230445447013064 00000000000000/* sleep.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file sleep.h * Sleep Management * * Sleeps are integral to the DDC protocol. Most of **ddcutil's** elapsed * time is spent in sleeps mandated by the DDC protocol. * Sleep invocation is centralized here to keep statistics and facilitate * future tuning. */ #ifndef BASE_SLEEP_H_ #define BASE_SLEEP_H_ #include // // Sleep and sleep statistics // void sleep_millis(int milliseconds); void sleep_millis_with_trace(int milliseconds, const char * caller_location, const char * message); typedef struct { uint64_t actual_sleep_nanos; int requested_sleep_milliseconds; int total_sleep_calls; } Sleep_Stats; void init_sleep_stats(); Sleep_Stats get_sleep_stats(); void report_sleep_stats(int depth); #endif /* BASE_SLEEP_H_ */ ddcutil-0.8.6/src/base/vcp_version.h0000644000175000001440000000426313230445447014314 00000000000000/* vcp_version_spec.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * VCP Version Specification */ #ifndef VCP_VERSION_H_ #define VCP_VERSION_H_ /** \cond */ #include /** \endcond */ #include "public/ddcutil_types.h" #include "util/coredefs.h" extern const DDCA_MCCS_Version_Spec VCP_SPEC_V10; extern const DDCA_MCCS_Version_Spec VCP_SPEC_V20; extern const DDCA_MCCS_Version_Spec VCP_SPEC_V21; extern const DDCA_MCCS_Version_Spec VCP_SPEC_V30; extern const DDCA_MCCS_Version_Spec VCP_SPEC_V22; extern const DDCA_MCCS_Version_Spec VCP_SPEC_ANY; extern const DDCA_MCCS_Version_Spec VCP_SPEC_UNKNOWN; extern const DDCA_MCCS_Version_Spec VCP_SPEC_UNQUERIED; bool vcp_version_le(DDCA_MCCS_Version_Spec val, DDCA_MCCS_Version_Spec max); bool vcp_version_gt(DDCA_MCCS_Version_Spec val, DDCA_MCCS_Version_Spec min); bool vcp_version_eq(DDCA_MCCS_Version_Spec v1, DDCA_MCCS_Version_Spec v2); bool vcp_version_is_unqueried(DDCA_MCCS_Version_Spec vspec); char * format_vspec(DDCA_MCCS_Version_Spec vspec); DDCA_MCCS_Version_Spec parse_vspec(char * s); char * format_vcp_version_id(DDCA_MCCS_Version_Id version_id); char * vcp_version_id_name(DDCA_MCCS_Version_Id version_id); DDCA_MCCS_Version_Spec mccs_version_id_to_spec(DDCA_MCCS_Version_Id id); DDCA_MCCS_Version_Id mccs_version_spec_to_id(DDCA_MCCS_Version_Spec vspec); #endif /* VCP_VERSION_H_ */ ddcutil-0.8.6/src/base/ddc_errno.h0000644000175000001440000001157613230445447013723 00000000000000/* ddc_errno.h * * Error codes internal to the application, which are * primarily ddcutil related. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Error codes internal to **ddcutil**. */ #ifndef DDC_ERRNO_H_ #define DDC_ERRNO_H_ #include "base/status_code_mgt.h" // Why not use #define: // - Eclipse global name change doesn't work well // // Why not use enum: // Full set of status codes is the union of modulate(errno), modulated(adl_error_number), app specific error numbers // // Disadvantage: // - can't use as case values for switch // // Reason for using defines: // errno.h values are defines // adl error values are defines // // Status codes created by this application // (as opposed to Linux ERRNO, ADL) // These generally indicate a DDC protocol problem #define DDCRC_OK 0 #define DDCRC_PACKET_SIZE (-RCRANGE_DDC_START-1) #define DDCRC_RESPONSE_ENVELOPE (-RCRANGE_DDC_START-2) #define DDCRC_CHECKSUM (-RCRANGE_DDC_START-3) #define DDCRC_INVALID_DATA (-RCRANGE_DDC_START-4) #define DDCRC_RESPONSE_TYPE (-RCRANGE_DDC_START-5) #define DDCRC_NULL_RESPONSE (-RCRANGE_DDC_START-6) #define DDCRC_MULTI_PART_READ_FRAGMENT (-RCRANGE_DDC_START-7) #define DDCRC_ALL_TRIES_ZERO (-RCRANGE_DDC_START-8) // packet data entirely 0 // not used TODO eliminate #define DDCRC_DOUBLE_BYTE (-RCRANGE_DDC_START-9) // duplicated byte in packet #define DDCRC_REPORTED_UNSUPPORTED (-RCRANGE_DDC_START-10) // DDC reply says unsupported #define DDCRC_READ_ALL_ZERO (-(RCRANGE_DDC_START+11) ) #define DDCRC_BAD_BYTECT (-(RCRANGE_DDC_START+12) ) #define DDCRC_READ_EQUALS_WRITE (-(RCRANGE_DDC_START+13) ) #define DDCRC_INVALID_MODE (-(RCRANGE_DDC_START+14) ) #define DDCRC_RETRIES (-(RCRANGE_DDC_START+15) ) // too many retries #define DDCRC_EDID (-(RCRANGE_DDC_START+16) ) // invalid EDID #define DDCRC_DETERMINED_UNSUPPORTED (-(RCRANGE_DDC_START+17) ) // facility determined to be unsupported #define DDCL_ARG (-(RCRANGE_DDC_START+18) ) // illegal argument #define DDCL_INVALID_OPERATION (-(RCRANGE_DDC_START+19) ) // e.g. writing a r/o feature #define DDCL_UNIMPLEMENTED (-(RCRANGE_DDC_START+20) ) // unimplemented service #define DDCL_UNINITIALIZED (-(RCRANGE_DDC_START+21) ) // library not initialized #define DDCL_UNKNOWN_FEATURE (-(RCRANGE_DDC_START+22) ) // feature not in feature table #define DDCRC_INTERPRETATION_FAILED (-(RCRANGE_DDC_START+23) ) // value format failed #define DDCRC_MULTI_FEATURE_ERROR (-(RCRANGE_DDC_START+24) ) // an error occurred on a multi-feature request #define DDCRC_INVALID_DISPLAY (-(RCRANGE_DDC_START+25) ) // monitor not found, can't open, no DDC support, etc #define DDCL_INTERNAL_ERROR (-(RCRANGE_DDC_START+26) ) // error that triggers program failure #define DDCL_OTHER (-(RCRANGE_DDC_START+27) ) // other error (for use during development) #define DDCRC_VERIFY (-(RCRANGE_DDC_START+28) ) // read after VCP write failed or wrong value #define DDCRC_NOT_FOUND (-(RCRANGE_DDC_START+29) ) // generic not found #define DDCRC_ALL_RESPONSES_NULL (-(RCRANGE_DDC_START+30) ) // all responses are DDC Null Message // TODO: consider replacing DDCRC_EDID by more generic DDCRC_BAD_DATA, could be used for e.g. invalid capabilities string // what about DDCRC_INVALID_DATA? // maybe most of DDCRC_... become DDCRC_I2C... // never used // #define DDCRC_PACKET_ERROR_END (-RCRANGE_DDC_START-16) // special end value Status_Code_Info * ddcrc_find_status_code_info(int rc); bool ddc_error_name_to_number(const char * errno_name, Status_DDC * perrno); // bool ddc_error_name_to_modulated_number(const char * errno_name, Global_Status_Code * p_error_number); // Returns status code description: char * ddcrc_desc(int rc); // must be freed after use bool ddcrc_is_derived_status_code(Public_Status_Code gsc); bool ddcrc_is_not_error(Public_Status_Code gsc); #endif /* APP_ERRNO_H_ */ ddcutil-0.8.6/src/base/ddc_packets.h0000644000175000001440000001730213230445447014221 00000000000000/* ddc_packets.h * * Functions for creating DDC packets and interpreting DDC response packets. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Functions for creating DDC packets and interpreting DDC response packets. */ #ifndef DDC_PACKETS_H_ #define DDC_PACKETS_H_ /** \cond */ #include /** \endcond */ #include "ddcutil_types.h" #include "util/data_structures.h" #include "base/status_code_mgt.h" #include "base/core.h" // was in common.h #define MAX_DDCCI_PACKET_SIZE 37 // 32 + 5; // largest packet is capabilities response packet, which has 1 byte for reply op code, // 2 for offset, and up to 32 bytes fragment #define MAX_DDC_DATA_SIZE 35 #define MAX_DDC_PACKET_WO_CHECKSUM 38 #define MAX_DDC_PACKET_INC_CHECKSUM 39 // also is max table fragment size #define MAX_DDC_CAPABILITIES_FRAGMENT_SIZE 32 #define MAX_DDC_TAG 39 #ifdef NEW // apparently unused typedef struct { Byte vcp_opcode; Byte vcp_type_code; Byte parse_status; Byte mh; Byte ml; Byte sh; Byte sl; void * interpretation; // specific to VCP_opcode } Parsed_VCP_Response_Data; #endif /** Interpretation of a packet of type DDC_PACKET_TYPE_QUERY_VCP_RESPONSE */ typedef struct { Byte vcp_code; ///< VCP feature code bool valid_response; ///< bool supported_opcode; int max_value; int cur_value; // for new way Byte mh; Byte ml; Byte sh; Byte sl; } Parsed_Nontable_Vcp_Response; /** For digesting capabilities or table read fragment */ typedef struct { Byte fragment_type; // DDC_PACKET_TYPE_CAPABILITIES_RESPONSE || DDC_PACKET_TYPE_TABLE_READ_RESPONSE int fragment_offset; int fragment_length; // without possible terminating '\0' // add 1 to allow for appending a terminating '\0' in case of DDC_PACKET_TYPE_CAPABILITIES_RESPONSE Byte bytes[MAX_DDC_CAPABILITIES_FRAGMENT_SIZE+1]; } Interpreted_Multi_Part_Read_Fragment; // TODO: Unify with list in ddc_command_codes.h typedef Byte DDC_Packet_Type; #define DDC_PACKET_TYPE_NONE 0x00 #define DDC_PACKET_TYPE_QUERY_VCP_REQUEST 0x01 #define DDC_PACKET_TYPE_QUERY_VCP_RESPONSE 0x02 #define DDC_PACKET_TYPE_SET_VCP_REQUEST 0x03 // n. no reply message #define DDC_PACKET_TYPE_SAVE_CURRENT_SETTINGS 0x0C // n. no reply message #define DDC_PACKET_TYPE_CAPABILITIES_REQUEST 0xf3 #define DDC_PACKET_TYPE_CAPABILITIES_RESPONSE 0xe3 #define DDC_PACKET_TYPE_ID_REQUEST 0xf1 #define DDC_PACKET_TYPE_ID_RESPONSE 0xe1 #define DDC_PACKET_TYPE_TABLE_READ_REQUEST 0xe2 #define DDC_PACKET_TYPE_TABLE_READ_RESPONSE 0xe4 #define DDC_PACKET_TYPE_TABLE_WRITE_REQUEST 0xe7 /** Packet bytes and interpretation */ typedef struct { Buffer * raw_bytes; ///< raw packet bytes char tag[MAX_DDC_TAG+1]; ///* debug string describing packet, +1 for \0 DDC_Packet_Type type; ///* packet type // void * aux_data; ///* type dependent // for a bit more type safety and code clarity: union { Parsed_Nontable_Vcp_Response * nontable_response; Interpreted_Multi_Part_Read_Fragment * multi_part_read_fragment; void * raw_parsed; } parsed; // additional fields for new way of parsing result data // Parsed_Response_Data * parsed_response; } DDC_Packet; void dbgrpt_packet(DDC_Packet * packet, int depth); void free_ddc_packet(DDC_Packet * packet); bool is_double_byte(Byte * pb); // Byte xor_bytes(Byte * bytes, int len); Byte ddc_checksum(Byte * bytes, int len, bool altmode); bool valid_ddc_packet_checksum(Byte * readbuf); void test_checksum(); typedef struct { DDCA_Vcp_Value_Type response_type; Parsed_Nontable_Vcp_Response * non_table_response; Buffer * table_response; } Parsed_Vcp_Response; void report_parsed_vcp_response(Parsed_Vcp_Response * response,int depth); Status_DDC create_ddc_base_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, const char * tag, DDC_Packet ** packet_ptr); Status_DDC create_ddc_typed_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, Byte expected_type, Byte expected_subtype, const char * tag, DDC_Packet ** packet_ptr_addr); DDC_Packet * create_ddc_capabilities_request_packet( int offset, const char * tag); DDC_Packet * create_ddc_multi_part_read_request_packet( Byte request_type, Byte request_subtype, int offset, const char * tag); DDC_Packet * create_ddc_multi_part_write_request_packet( Byte request_type, // always DDC_PACKET_TYPE_WRITE_REQUEST Byte request_subtype, // VCP code int offset, Byte * bytes_to_write, int bytect, const char * tag); void update_ddc_capabilities_request_packet_offset( DDC_Packet * packet, int offset); void update_ddc_multi_part_read_request_packet_offset( DDC_Packet * packet, int offset); Status_DDC create_ddc_capabilities_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, const char * tag, DDC_Packet ** packet_ptr); Status_DDC interpret_capabilities_response( Byte * data_bytes, int bytect, Interpreted_Multi_Part_Read_Fragment * aux_data, bool debug); DDC_Packet * create_ddc_getvcp_request_packet( Byte vcp_code, const char * tag); Status_DDC create_ddc_getvcp_response_packet( Byte * i2c_response_bytes, int response_bytes_buffer_size, Byte expected_vcp_opcode, const char * tag, DDC_Packet ** packet_ptr); DDC_Packet * create_ddc_setvcp_request_packet( Byte vcp_code, int new_value, const char * tag); DDC_Packet * create_ddc_save_settings_request_packet( const char * tag); Status_DDC get_interpreted_vcp_code( DDC_Packet * packet, bool make_copy, Parsed_Nontable_Vcp_Response ** interpreted_ptr); void report_interpreted_capabilities( Interpreted_Multi_Part_Read_Fragment * interpreted, int depth); void report_interpreted_multi_read_fragment( Interpreted_Multi_Part_Read_Fragment * interpreted, int depth); void report_interpreted_nontable_vcp_response( Parsed_Nontable_Vcp_Response * interpreted, int depth); #ifdef OLD void report_interpreted_aux_data(Byte response_type, void * interpreted); #endif Byte * get_packet_start(DDC_Packet * packet); int get_packet_len( DDC_Packet * packet); Byte * get_data_start( DDC_Packet * packet); int get_data_len( DDC_Packet * packet); #endif /* DDC_PACKETS_H_ */ ddcutil-0.8.6/src/base/core.h0000644000175000001440000002334313230445447012707 00000000000000/** @file core.h * Core functions and global variables. * * File core.c provides a collection of inter-dependent services at the core * of the **ddcutil** application. * * These include * - message destination redirection * - abnormal termination * - standard function call options * - timestamp generation * - message level control * - debug and trace messages */ /* core.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef BASE_CORE_H_ #define BASE_CORE_H_ /** \cond */ #include #include #include #include #include #include /** \endcond */ #include "public/ddcutil_types.h" #include "util/coredefs.h" // /** @addtogroup abnormal_termination // */ // // Initialization // void init_msg_control(); // // For aborting out of shared library // #ifdef OBSOLETE void register_jmp_buf(jmp_buf* jb); #endif #ifdef UNUSED void ddc_abort( const char * funcname, const int lineno, const char * fn, int status); #define DDC_ABORT(status) \ ddc_abort(__func__, __LINE__, __FILE__, status) #endif #ifdef OBSOLETE extern DDCA_Global_Failure_Information global_failure_information; #endif // // Standard function call arguments and return values // /** Byte of standard call options */ typedef Byte Call_Options; #define CALLOPT_NONE 0x00 ///< no options #define CALLOPT_ERR_MSG 0x80 ///< issue message if error // #define CALLOPT_ERR_ABORT 0x40 ///< terminate execution if error #define CALLOPT_RDONLY 0x20 ///< open read-only #define CALLOPT_WARN_FINDEX 0x10 ///< issue warning msg re hiddev_field_info.field_index change #define CALLOPT_FORCE 0x08 ///< ignore various validity checks char * interpret_call_options_t(Call_Options calloptions); #ifdef FUTURE // A way to return both a status code and a pointer. // Has the benefit of avoiding the "Something** parm" construct, // but requires a cast by the caller, so loses type checking. // How useful will this be? typedef struct { int rc; void * result; } RC_And_Result; #endif // // Global redirection for messages that normally go to stdout and stderr, // used within functions that are part of the shared library. // extern FILE * FOUT; extern FILE * FERR; void set_fout(FILE * fout); void set_ferr(FILE * ferr); void set_fout_to_default(); void set_ferr_to_default(); // // Message level control // DDCA_Output_Level get_output_level(); void set_output_level(DDCA_Output_Level newval); char * output_level_name(DDCA_Output_Level val); // // Trace message control // extern bool dbgtrc_show_time; // include elapsed time in debug/trace timestamps void add_traced_function(const char * funcname); bool is_traced_function( const char * funcname); void show_traced_functions(); void add_traced_file(const char * filename); bool is_traced_file( const char * filename); void show_traced_files(); typedef enum { TRC_BASE = 0x80, TRC_I2C = 0x40, TRC_ADL = 0x20, TRC_DDC = 0x10, TRC_USB = 0x08, TRC_TOP = 0x04, TRC_ENV = 0x02, TRC_NEVER = 0x00, TRC_ALWAYS = 0xff } Trace_Group; #define TRC_NONE TRC_NEVER Trace_Group trace_class_name_to_value(char * name); void set_trace_levels(Trace_Group trace_flags); char * get_active_trace_group_names(); void show_trace_groups(); bool is_tracing(Trace_Group trace_group, const char * filename, const char * funcname); /** Checks if tracking is currently active for the globally defined TRACE_GROUP value, * current file and function. * * Wrappers call to **is_tracing()**, using the current **TRACE_GROUP** value, * filename, and function as implicit arguments. */ #define IS_TRACING() is_tracing(TRACE_GROUP, __FILE__, __func__) #define IS_TRACING_GROUP(grp) is_tracing(grp, __FILE__, __func__) #define IS_TRACING_BY_FUNC_OR_FILE() is_tracing(TRC_NEVER, __FILE__, __func__) // // Error_Info reporting // extern bool report_freed_exceptions; // // DDC data error reporting // // Controls display of messages regarding I2C error conditions that can be retried. extern bool report_ddc_errors; bool is_reporting_ddc(Trace_Group trace_group, const char * filename, const char * funcname); #define IS_REPORTING_DDC() is_reporting_ddc(TRACE_GROUP, __FILE__, __func__) bool ddcmsg(Trace_Group trace_group, const char* funcname, const int lineno, const char* fn, char* format, ...); #define DDCMSG0(format, ...) ddcmsg(TRACE_GROUP, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) /** Variant of **DDCMSG** that takes an explicit trace group as an argument. * * @param debug_flag * @param trace_group * @param format * @param ... */ #define DDCMSGX(debug_flag, trace_group, format, ...) \ ddcmsg(( (debug_flag) ) ? 0xff : (trace_group), __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) /** Macro that wrappers function **ddcmsg()**, passing the current TRACE_GROUP, * file name, line number, and function name as arguments. * * @param debug_flag * @param format * @param ... */ #define DDCMSG(debug_flag, format, ...) \ ddcmsg(( (debug_flag) ) ? 0xff : (TRACE_GROUP), __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) // Show report levels for all types void show_reporting(); // // Issue messages of various types // void severemsg( const char * funcname, const int lineno, const char * fn, char * format, ...); bool dbgtrc( Trace_Group trace_group, const char * funcname, const int lineno, const char * fn, char * format, ...); #define SEVEREMSG( format, ...) \ severemsg( __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) // cannot map to dbgtrc, writes to stderr, not stdout // #define SEVEREMSG(format, ...) dbgtrc(0xff, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) #define DBGMSG( format, ...) dbgtrc(0xff, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) // workaround: if -Wpedantic, ISO C does not allow variadic macro calls that have no variable arguments #define DBGMSG0( text) dbgtrc(0xff, __func__, __LINE__, __FILE__, text) #define DBGMSF(debug_flag, format, ...) \ do { if (debug_flag) dbgtrc( 0xff, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__); } while(0) #define DBGMSF0(debug_flag, text) \ do { if (debug_flag) dbgtrc( 0xff, __func__, __LINE__, __FILE__, text); } while(0) #define TRCMSG( format, ...) \ dbgtrc(TRACE_GROUP, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) // which of these are really useful? // not currently used: TRCALWAYS, TRCMSGTG, TRCMSGTF #define TRCALWAYS( format, ...) \ dbgtrc(0xff, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) #define TRCMSGTG(trace_group, format, ...) \ dbgtrc(trace_group, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) #define TRCMSGTF(trace_flag, format, ...) \ do { if (trace_flag) dbgtrc(0xff, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__); } while(0) // alt: dbgtrc( ( (trace_flag) ? (0xff) : TRACE_GROUP ), __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) // For messages that are issued either if tracing is enabled for the appropriate trace group or // if a debug flag is set. #define DBGTRC(debug_flag, trace_group, format, ...) \ dbgtrc( ( (debug_flag) ) ? 0xff : (trace_group), __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) #define DBGTRC0(debug_flag, trace_group, format) \ dbgtrc( ( (debug_flag) ) ? 0xff : (trace_group), __func__, __LINE__, __FILE__, format) // // Error handling // #ifdef OLD void report_ioctl_error_old( int errnum, const char* funcname, int lineno, char* filename, bool fatal); #endif void report_ioctl_error( const char * ioctl_name, int errnum, const char * funcname, const char * filename, int lineno); #define REPORT_IOCTL_ERROR(_ioctl_name, _errnum) \ report_ioctl_error(_ioctl_name, _errnum, __func__, __FILE__, __LINE__); // reports a program logic error void program_logic_error( const char * funcname, const int lineno, const char * fn, char * format, ...); /** @def PROGRAM_LOGIC_ERROR(format,...) * Wraps call to program_logic_error() * * Reports an error in program logic. * @ingroup abnormal_termination */ #define PROGRAM_LOGIC_ERROR(format, ...) \ program_logic_error(__func__, __LINE__, __FILE__, format, ##__VA_ARGS__) #ifdef OLD void terminate_execution_on_error( Trace_Group trace_group, const char * funcname, const int lineno, const char * fn, char * format, ...); /** @def TERMINATE_EXECUTION_ON_ERROR(format,...) * Wraps call to terminate_execution_on_error() * @ingroup abnormal_termination */ #define TERMINATE_EXECUTION_ON_ERROR(format, ...) \ terminate_execution_on_error(TRACE_GROUP, __func__, __LINE__, __FILE__, format, ##__VA_ARGS__) #endif #endif /* BASE_CORE_H_ */ ddcutil-0.8.6/src/base/displays.h0000644000175000001440000002423313230445447013606 00000000000000/* displays.h * * Display specification * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Display specification */ #ifndef DISPLAYS_H_ #define DISPLAYS_H_ /** \cond **/ #include #include #include "util/coredefs.h" #include "util/edid.h" /** \endcond */ #include "public/ddcutil_types.h" #include "core.h" #include "feature_sets.h" #include "vcp_version.h" typedef void * Global_Display_Lock; /** \file Display Specification Monitors are specified in different ways in different contexts: 1) Display_Identifier contains the identifiers specified on the command line. 2) Display_Ref is a logical display identifier. It can be an I2C identifier, an ADL identifier, or a USB identifier. For Display_Identifiers containing either busno (for I2C) or ADL adapter.display numbers the translation from Display_Identier to Display_Ref is direct. Otherwise, displays are searched to find the monitor. 3) Display_Handle is passed as an argument to "open" displays. For ADL displays, the translation from Display_Ref to Display_Handle is direct. For I2C displays, the device must be opened. Display_Handle then contains the open file handle. */ // *** Initialization *** void init_displays(); // *** DDCA_Display_Path *** char * io_mode_name(DDCA_IO_Mode val); bool dpath_eq(DDCA_IO_Path p1, DDCA_IO_Path p2); char * dpath_repr_t(DDCA_IO_Path * dpath); // value valid until next call // *** Display_Async *** #define DISPLAY_ASYNC_REC_MARKER "DSNC" typedef struct Display_Async { char marker[4]; DDCA_IO_Path dpath; // key // Global_Display_Lock gdl; GThread * thread_owning_display_lock; // id of thread owning lock (type int is placeholder) GMutex display_lock; // for future request queue structure GQueue * request_queue; GMutex request_queue_lock; GThread * request_execution_thread; // or in DH? } Display_Async_Rec; // *** Display_Identifier *** /** Display_Identifier type */ typedef enum { DISP_ID_BUSNO, ///< /dev/i2c bus number DISP_ID_ADL, ///< ADL iAdapterIndex/iDisplayIndex pair DISP_ID_MONSER, ///< monitor mfg id, model name, and/or serial number DISP_ID_EDID, ///< 128 byte EDID DISP_ID_DISPNO, ///< ddcutil assigned sisplay number DISP_ID_USB, ///< USB bus/device number pair DISP_ID_HIDDEV ///< /dev/usb/hiddev device number } Display_Id_Type; char * display_id_type_name(Display_Id_Type val); #define DISPLAY_IDENTIFIER_MARKER "DPID" /** Specifies the identifiers to be used to select a display. */ typedef struct { char marker[4]; // always "DPID" Display_Id_Type id_type; int dispno; int busno; int iAdapterIndex; int iDisplayIndex; char mfg_id[EDID_MFG_ID_FIELD_SIZE]; char model_name[EDID_MODEL_NAME_FIELD_SIZE]; char serial_ascii[EDID_SERIAL_ASCII_FIELD_SIZE]; int usb_bus; int usb_device; int hiddev_devno; // 4/1027 Byte edidbytes[128]; char * repr; } Display_Identifier; Display_Identifier* create_dispno_display_identifier(int dispno); Display_Identifier* create_busno_display_identifier(int busno); Display_Identifier* create_adlno_display_identifier(int iAdapterIndex, int iDisplayIndex); Display_Identifier* create_edid_display_identifier(const Byte* edidbytes); Display_Identifier* create_mfg_model_sn_display_identifier(const char* mfg_code, const char* model_name, const char* serial_ascii); Display_Identifier* create_usb_display_identifier(int bus, int device); Display_Identifier* create_usb_hiddev_display_identifier(int hiddev_devno); char * did_repr(Display_Identifier * pdid); void dbgrpt_display_identifier(Display_Identifier * pdid, int depth); void free_display_identifier(Display_Identifier * pdid); #ifdef FUTURE // new way #define DISPLAY_SELECTOR_MARKER "DSEL" typedef struct { char marker[4]; // always "DSEL" int dispno; int busno; int iAdapterIndex; int iDisplayIndex; char * mfg_id; char * model_name; char * serial_ascii; int usb_bus; int usb_device; Byte * edidbytes; // always 128 bytes } Display_Selector; Display_Selector * dsel_new(); void dsel_free( Display_Selector * dsel); Display_Selector * dsel_set_display_number(Display_Selector* dsel, int dispno); Display_Selector * dsel_set_i2c_busno( Display_Selector* dsel, int busno); Display_Selector * dsel_set_adl_numbers( Display_Selector* dsel, int iAdapterIndex, int iDisplayIndex); Display_Selector * dsel_set_usb_numbers( Display_Selector* dsel, int bus, int device); Display_Selector * dsel_set_mfg_id( Display_Selector* dsel, char* mfg_id); Display_Selector * dsel_set_model_name( Display_Selector* dsel, char* model_name); Display_Selector * dsel_set_sn( Display_Selector* dsel, char * serial_ascii); Display_Selector * dsel_set_edid_bytes( Display_Selector* dsel, Byte * edidbytes); Display_Selector * dsel_set_edid_hex( Display_Selector* dsel, char * hexstring); bool dsel_validate( Display_Selector * dsel); #endif // *** Display_Ref *** typedef Byte Dref_Flags; #define DREF_DDC_COMMUNICATION_CHECKED 0x80 #define DREF_DDC_COMMUNICATION_WORKING 0x40 #define DREF_DDC_NULL_RESPONSE_CHECKED 0x20 #define DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED 0x10 #define DREF_DDC_IS_MONITOR_CHECKED 0x08 #define DREF_DDC_IS_MONITOR 0x04 #define DREF_TRANSIENT 0x02 #define DISPLAY_REF_MARKER "DREF" /** A **Display_Ref** is a logical display identifier. * It can contain an I2C bus number, and ADL adapter/display number pair, * or a USB bus number/device number pair. */ typedef struct _display_ref { char marker[4]; #ifdef OLD DDCA_IO_Mode io_mode; int busno; int iAdapterIndex; int iDisplayIndex; int usb_hiddev_devno; // added 4/2017 #endif DDCA_IO_Path io_path; int usb_bus; int usb_device; char * usb_hiddev_name; DDCA_MCCS_Version_Spec vcp_version; Dref_Flags flags; char * capabilities_string; // added 4/2017, private copy Parsed_Edid * pedid; // added 4/2017 // for merger with Display_Rec: int dispno; void * detail2; Display_Async_Rec * async_rec; } Display_Ref; // n. works for both Display_Ref and Display_Handle // #define ASSERT_DISPLAY_IO_MODE(_dref, _mode) assert(_dref && _dref->io_mode == _mode) Display_Ref * create_bus_display_ref(int busno); Display_Ref * create_adl_display_ref(int iAdapterIndex, int iDisplayIndex); Display_Ref * create_usb_display_ref(int bus, int device, char * hiddev_devname); void dbgrpt_display_ref(Display_Ref * dref, int depth); char * dref_short_name_t(Display_Ref * dref); char * dref_repr_t(Display_Ref * dref); // value valid until next call // Display_Ref * clone_display_ref(Display_Ref * old); void free_display_ref(Display_Ref * dref); // Do two Display_Ref's identify the same device? bool dref_eq(Display_Ref* this, Display_Ref* that); // n. returned on stack // DDCA_IO_Path dpath_from_dref(Display_Ref * dref); // *** Display_Handle *** #define DISPLAY_HANDLE_MARKER "DSPH" /** Describes an open display device. */ typedef struct { char marker[4]; Display_Ref* dref; int fh; // file handle if ddc_io_mode == DDC_IO_DEVI2C or USB_IO // added 7/2016 char * repr; } Display_Handle; Display_Handle * create_bus_display_handle_from_display_ref(int fh, Display_Ref * dref); Display_Handle * create_adl_display_handle_from_display_ref(Display_Ref * dref); Display_Handle * create_usb_display_handle_from_display_ref(int fh, Display_Ref * dref); void dbgrpt_display_handle(Display_Handle * dh, const char * msg, int depth); char * dh_repr(Display_Handle * dh); char * dh_repr_t(Display_Handle * dh); void free_display_handle(Display_Handle * dh); // *** Video_Card_Info *** #define VIDEO_CARD_INFO_MARKER "VIDC" /** Video card information */ typedef struct { char marker[4]; int vendor_id; char * adapter_name; char * driver_name; } Video_Card_Info; Video_Card_Info * create_video_card_info(); // *** Miscellaneous *** bool is_adlno_defined(DDCA_Adlno adlno); /** Reserved #DDCA_Adlno value indicating undefined */ #define ADLNO_UNDEFINED {-1,-1} // For internal display selection functions #define DISPSEL_NONE 0x00 #define DISPSEL_VALID_ONLY 0x80 #ifdef FUTURE #define DISPSEL_I2C 0x40 #define DISPSEL_ADL 0x20 #define DISPSEL_USB 0x10 #define DISPSEL_ANY (DISPSEL_I2C | DISPSEL_ADL | DISPSEL_USB) #endif //* Option flags for display selection functions */ typedef Byte Display_Selection_Options; int hiddev_name_to_number(char * hiddev_name); char * hiddev_number_to_name(int hiddev_number); bool lock_display_lock(Display_Async_Rec * async_rec, bool wait); void unlock_display_lock(Display_Async_Rec * async_rec); #endif /* DISPLAYS_H_ */ ddcutil-0.8.6/src/base/execution_stats.h0000644000175000001440000001007413230445447015175 00000000000000/* execution_stats.h * * For recording the count and elapsed time of system calls. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Record execution statistics, namely the count and elapsed time of system calls. */ #ifndef EXECUTION_STATS_H_ #define EXECUTION_STATS_H_ /** \cond */ #include #include /** \endcond */ #include "util/timestamp.h" #include "base/displays.h" #include "base/status_code_mgt.h" // Initialization void init_execution_stats(); void reset_execution_stats(); // Global Stats void report_elapsed_stats(int depth); // IO Event Tracking /** IO Event type identifiers. * * Statistics for each event type are recorded separately. */ typedef enum { IE_WRITE, ///< write event IE_READ, ///< read event IE_WRITE_READ, ///< write/read operation, typical for I2C IE_OPEN, ///< device file open IE_CLOSE, ///< device file close IE_OTHER ///< other IO event } IO_Event_Type; const char * io_event_name(IO_Event_Type event_type); void log_io_call( const IO_Event_Type event_type, const char * location, uint64_t start_time_nanos, uint64_t end_time_nanos); #define RECORD_IO_EVENT(event_type, cmd_to_time) { \ uint64_t _start_time = cur_realtime_nanosec(); \ cmd_to_time; \ log_io_call(event_type, __func__, _start_time, cur_realtime_nanosec()); \ } void report_io_call_stats(int depth); // Record Status Code Occurrence Public_Status_Code log_status_code(Public_Status_Code rc, const char * caller_name); Public_Status_Code log_retryable_status_code(Public_Status_Code rc, const char * caller_name); #define COUNT_STATUS_CODE(rc) log_status_code(rc,__func__) #define COUNT_RETRYABLE_STATUS_CODE(rc) log_retryable_status_code(rc,__func__) void show_all_status_counts(); // Sleep Strategy bool set_sleep_strategy(int strategy); int get_sleep_strategy(); char * sleep_strategy_desc(int sleep_strategy); /** Sleep event type */ typedef enum { SE_WRITE_TO_READ, ///< between I2C write and read SE_POST_OPEN, ///< after I2C device opened SE_POST_WRITE, ///< after I2C write without subsequent read SE_POST_READ, ///< after I2C read SE_DDC_NULL, ///< after DDC Null response SE_POST_SAVE_SETTINGS ///< after DDC Save Current Settings command } Sleep_Event_Type; const char * sleep_event_name(Sleep_Event_Type event_type); // Functions for sleeping. The actual sleep time is determined // by the strategy in place given the situation in which sleep is invoked. // Convenience methods that call call_tuned_sleep(): void call_tuned_sleep_i2c(Sleep_Event_Type event_type); // DDC_IO_DEVI2C void call_tuned_sleep_adl(Sleep_Event_Type event_type); // DDC_IO_ADL void call_tuned_sleep_dh(Display_Handle* dh, Sleep_Event_Type event_type); // The workhorse: void call_tuned_sleep(DDCA_IO_Mode io_mode, Sleep_Event_Type event_type); void call_dynamic_tuned_sleep( DDCA_IO_Mode io_mode,Sleep_Event_Type event_type, int occno); void call_dynamic_tuned_sleep_i2c(Sleep_Event_Type event_type, int occno); void report_sleep_strategy_stats(int depth); #endif /* EXECUTION_STATS_H_ */ ddcutil-0.8.6/src/base/status_code_mgt.h0000644000175000001440000001052113230445447015135 00000000000000/* status_code_mgt.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Status Code Management */ #ifndef STATUS_CODE_MGT_H_ #define STATUS_CODE_MGT_H_ /** \cond */ #include /** \endcond */ // Called from the mainline to perform initialization void init_status_code_mgt(); /** Describes one status code. * * @remark * Code could be simplified by using a #Value_Name_Title table instead, * but left as is because we might want to add additional fields. */ typedef struct { int code; char * name; char * description; // idea: add flags for NOT_AN_ERROR, DERIVED ? } Status_Code_Info; // debugging function: void report_status_code_info(Status_Code_Info * pdesc); // For distinguishing types of return codes. // C does not enforce type checking, but useful for documentation // trying different styles for readability, consistency w standards typedef int Status_Errno; ///< negative Linux errno values typedef int Status_DDC; ///< DDC specific status codes typedef int Status_Errno_DDC; ///< union(Status_Errno,Status_DDC) typedef int Base_Status_ADL; ///< unmodulated ADL status codes typedef int Modulated_Status_ADL; ///< modulated ADL status codes typedef int Public_Status_Code; ///< union(Status_Errno, Status_DDC, Modulated_Status_ADL) /** Pointer to function that finds the #Status_Code_Info for a status code * @param rc status code * @return ponter to #Status_Code_Info for the code, NULL if not found * */ typedef Status_Code_Info * (*Retcode_Description_Finder)(int rc); /** Pointer to a function that converts a symbolic status code name * to its integer value * * \param name status code symbolic name * @param p_number where to return status code * @return true if conversion succeeded, false if name not found */ typedef bool (*Retcode_Number_Finder)(const char * name, int * p_number); // // Status codes ranges // // #define RCRANGE_BASE_START 0 // #define RCRANGE_BASE_MAX 999 // #define RCRANGE_ERRNO_START 1000 #define RCRANGE_ERRNO_START 0 #define RCRANGE_ERRNO_MAX 1999 #define RCRANGE_ADL_START 2000 #define RCRANGE_ADL_MAX 2999 #define RCRANGE_DDC_START 3000 #define RCRANGE_DDC_MAX 3999 /** Status code range identifiers * * @remark * - must be kept consistent with table in status_code_mgt.c */ typedef enum { // RR_BASE, ///< indicates unmodulated status code RR_ERRNO, ///< range id for Linux errno values RR_ADL, ///< range id for modulated ADL error codes RR_DDC ///< range id for **ddcutil**-specific error codes } Retcode_Range_Id; int modulate_rc( int unmodulated_rc, Retcode_Range_Id range_id); int demodulate_rc(int modulated_rc, Retcode_Range_Id range_id); Retcode_Range_Id get_modulation(int rc); // int demodulate_any_rc(int modulated_rc); // unimplemented Status_Code_Info * find_status_code_info(Public_Status_Code status_code); // Return status code description and name. Do not free after use. char * psc_desc(Public_Status_Code rc); char * psc_name(Public_Status_Code status_code); bool status_name_to_unmodulated_number( const char * status_code_name, int * p_error_number); bool status_name_to_modulated_number( const char * status_code_name, Public_Status_Code * p_error_number); #ifdef FUTURE // Future: bool status_code_name_to_psc_number( const char * status_code_name, Public_Status_Code * p_error_number); #endif #endif /* STATUS_CODE_MGT_H_ */ ddcutil-0.8.6/src/vcp/0000755000175000001440000000000013230445447011537 500000000000000ddcutil-0.8.6/src/vcp/Makefile.am0000644000175000001440000000147013226562155013516 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall AM_CFLAGS += -Werror # vcp_feature_codes.c requires extensive changes if -Wpedantic # AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand clean-local: @echo "(src/vcp/Makefile) clean-local" mostlyclean-local: @echo "(src/vcp/Makefile) mostlyclean-local" distclean-local: @echo "(src/vcp/Makefile) distclean-local" dist-hook: @echo "(src/vcp/Makefile) dist-hook" # Intermediate Library noinst_LTLIBRARIES = libvcp.la libvcp_la_SOURCES = \ ddc_command_codes.c \ parse_capabilities.c \ parsed_capabilities_feature.c \ vcp_feature_codes.c \ vcp_feature_set.c \ vcp_feature_values.c ddcutil-0.8.6/src/vcp/Makefile.in0000644000175000001440000005344313230171237013526 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ # vcp_feature_codes.c requires extensive changes if -Wpedantic # AM_CFLAGS += -Wpedantic @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand subdir = src/vcp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libvcp_la_LIBADD = am_libvcp_la_OBJECTS = ddc_command_codes.lo parse_capabilities.lo \ parsed_capabilities_feature.lo vcp_feature_codes.lo \ vcp_feature_set.lo vcp_feature_values.lo libvcp_la_OBJECTS = $(am_libvcp_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libvcp_la_SOURCES) DIST_SOURCES = $(libvcp_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall -Werror $(am__append_1) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libvcp.la libvcp_la_SOURCES = \ ddc_command_codes.c \ parse_capabilities.c \ parsed_capabilities_feature.c \ vcp_feature_codes.c \ vcp_feature_set.c \ vcp_feature_values.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/vcp/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/vcp/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libvcp.la: $(libvcp_la_OBJECTS) $(libvcp_la_DEPENDENCIES) $(EXTRA_libvcp_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libvcp_la_OBJECTS) $(libvcp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_command_codes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse_capabilities.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsed_capabilities_feature.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcp_feature_codes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcp_feature_set.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcp_feature_values.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am dist-hook distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am .PRECIOUS: Makefile clean-local: @echo "(src/vcp/Makefile) clean-local" mostlyclean-local: @echo "(src/vcp/Makefile) mostlyclean-local" distclean-local: @echo "(src/vcp/Makefile) distclean-local" dist-hook: @echo "(src/vcp/Makefile) dist-hook" # 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: ddcutil-0.8.6/src/vcp/ddc_command_codes.c0000644000175000001440000000700112715067016015225 00000000000000/* ddc_command_codes.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ // Direct writes to sysout/syserr: NO #include #include #include #include "util/string_util.h" #include "vcp/ddc_command_codes.h" // // MCCS Command and Response Codes // Cmd_Code_Table_Entry cmd_code_table[] = { {CMD_VCP_REQUEST , "VCP Request" }, {CMD_VCP_RESPONSE , "VCP Response" }, {CMD_VCP_SET , "VCP Set" }, {CMD_TIMING_REPLY , "Timing Reply "}, {CMD_TIMING_REQUEST , "Timing Request" }, {CMD_VCP_RESET , "VCP Reset" }, {CMD_SAVE_SETTINGS , "Save Settings" }, {CMD_SELF_TEST_REPLY , "Self Test Reply" }, {CMD_SELF_TEST_REQUEST , "Self Test Request" }, {CMD_ID_REPLY , "Identification Reply"}, {CMD_TABLE_READ_REQUST , "Table Read Request" }, {CMD_CAPABILITIES_REPLY , "Capabilities Reply" }, {CMD_TABLE_READ_REPLY , "Table Read Reply" }, {CMD_TABLE_WRITE , "Table Write" }, {CMD_ID_REQUEST , "Identification Request" }, {CMD_CAPABILITIES_REQUEST , "Capabilities Request" }, {CMD_ENABLE_APP_REPORT , "Enable Application Report" } }; int ddc_cmd_code_count = sizeof(cmd_code_table)/sizeof(Cmd_Code_Table_Entry); Cmd_Code_Table_Entry * get_ddc_cmd_struct_by_index(int ndx) { // DBGMSG("ndx=%d, cmd_code_count=%d ", ndx, cmd_code_count ); assert( 0 <= ndx && ndx < ddc_cmd_code_count); return &cmd_code_table[ndx]; } // Commented out as part of removing printf statements from code that // is part of library. This function is not currently used. If needed, // this function can be passed a message collector of some sort, or // just implemented in the caller. //void list_cmd_codes() { // printf("DDC command codes:\n"); // int ndx = 0; // for (;ndx < ddc_cmd_code_count; ndx++) { // Cmd_Code_Table_Entry entry = cmd_code_table[ndx]; // printf(" %02x - %-30s\n", entry.cmd_code, entry.name); // } //} Cmd_Code_Table_Entry * get_ddc_cmd_struct_by_id(Byte cmd_id) { // DBGMSG("Starting. id=0x%02x ", id ); int ndx = 0; Cmd_Code_Table_Entry * result = NULL; for (;ndx < ddc_cmd_code_count; ndx++) { if (cmd_id == cmd_code_table[ndx].cmd_code) { result = &cmd_code_table[ndx]; break; } } // DBGMSG("Done. ndx=%d. returning %p", ndx, result); return result; } char * ddc_cmd_code_name(Byte command_id) { char * result = NULL; Cmd_Code_Table_Entry * cmd_entry = get_ddc_cmd_struct_by_id(command_id); if (cmd_entry) result = cmd_entry->name; else result ="unrecognized command"; return result; } ddcutil-0.8.6/src/vcp/parse_capabilities.c0000644000175000001440000005024513226561443015454 00000000000000/* ddc_capabilities.c * * Parse the capabilities string * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Parse the capabilities string returned by DDC, query the parsed data structure. */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/report_util.h" #include "util/string_util.h" #include "base/core.h" #include "base/displays.h" #include "vcp/ddc_command_codes.h" #include "vcp/parsed_capabilities_feature.h" #include "vcp/vcp_feature_codes.h" #include "vcp/parse_capabilities.h" #ifdef TESTS // not made static to avoid warning about unused variable char* test_cap_strings[] = { // GSM LG Ultra HD "(prot(monitor)type(LED)model(25UM65)cmds(01 02 03 0C E3 F3)" "vcp(0203(10 00)0405080B0C101214(05 07 08 0B) 16181A5260(03 04)6C6E70" "87ACAEB6C0C6C8C9D6(01 04)DFE4E5E6E7E8E9EAEBED(00 10 20 40)EE(00 01)" "FE(01 02 03)FF)mswhql(1)mccs_ver(2.1))", }; #endif // // Report parsed data structures // static void report_commands(Byte_Value_Array cmd_ids, int depth) { rpt_label(depth, "Commands:"); int ct = bva_length(cmd_ids); int ndx = 0; for (; ndx < ct; ndx++) { Byte hval = bva_get(cmd_ids, ndx); rpt_vstring(depth+1, "Command: %02x (%s)", hval, ddc_cmd_code_name(hval)); } } static void report_features( GPtrArray* features, // GPtrArray of Capabilities_Feature_Record DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; int d0 = 0; int d1 = 1; rpt_label(d0, "VCP Features:"); int ct = features->len; int ndx; for (ndx=0; ndx < ct; ndx++) { Capabilities_Feature_Record * vfr = g_ptr_array_index(features, ndx); DBGMSF(debug, "vfr = %p", vfr); report_capabilities_feature(vfr, vcp_version, d1); } } /** Reports the Parsed_Capabilities struct for human consumption. * * @param pcaps pointer to ***Parsed_Capabilities*** * * Output is written to the current FOUT device. */ void report_parsed_capabilities(Parsed_Capabilities* pcaps) { bool debug = false; assert(pcaps && memcmp(pcaps->marker, PARSED_CAPABILITIES_MARKER, 4) == 0); DBGMSF(debug, "Starting. pcaps->raw_cmds_segment_seen=%s, pcaps->commands=%p, pcaps->vcp_features=%p", bool_repr(pcaps->raw_cmds_segment_seen), pcaps->commands, pcaps->vcp_features); int d0 = 0; // int d1 = d0+1; DDCA_Output_Level output_level = get_output_level(); if (output_level >= DDCA_OL_VERBOSE) { rpt_vstring(d0, "%s capabilities string: %s", (pcaps->raw_value_synthesized) ? "Synthesized unparsed" : "Unparsed", pcaps->raw_value); } bool damaged = false; rpt_vstring(d0, "MCCS version: %s", (pcaps->mccs_version_string) ? pcaps->mccs_version_string : "not present"); if (pcaps->commands) report_commands(pcaps->commands, d0); else { // not an error in the case of USB_IO, as the capabilities string was // synthesized and does not include a commands segment // also, HP LP2480zx does not have cmds segment if (pcaps->raw_cmds_segment_seen) damaged = true; } if (pcaps->vcp_features) report_features(pcaps->vcp_features, pcaps->parsed_mccs_version); else { // handle pathological case of 0 length capabilities string, e.g. Samsung S32D850T if (pcaps->raw_vcp_features_seen) damaged = true; } if (damaged) rpt_label(d0, "Capabilities string not completely parsed"); } // // Lifecycle // /* Creates a Parsed_Capabilities record. * * The data structures passed to this function become owned by * the newly created Parsed_Capabilties record. * * Arguments: * raw_value * mccs_ver * raw_cmds_segment_seen * commands * vcp_features * * Returns: * Parsed_Capaibilities record */ Parsed_Capabilities * new_parsed_capabilities( char * raw_value, char * mccs_ver, bool raw_cmds_segment_seen, bool raw_vcp_features_seen, Byte_Value_Array commands, // each stored byte is command id GPtrArray * vcp_features ) { bool debug = false; DBGMSF(debug, "raw_cmds_segment_seen=%s, commands=%p", bool_repr(raw_cmds_segment_seen), commands); Parsed_Capabilities* pcaps = calloc(1, sizeof(Parsed_Capabilities)); memcpy(pcaps->marker, PARSED_CAPABILITIES_MARKER, 4); pcaps->raw_value = raw_value; pcaps->mccs_version_string = mccs_ver; pcaps->raw_cmds_segment_seen = raw_cmds_segment_seen, pcaps->commands = commands; pcaps->vcp_features = vcp_features; DDCA_MCCS_Version_Spec parsed_vcp_version = {0.0}; if (mccs_ver) { int vmajor; int vminor; int rc = sscanf(mccs_ver, "%d.%d", &vmajor, &vminor); if (rc != 2) { DBGMSG("Unable to parse mccs_ver, value=\"%s\", rc=%d\n", mccs_ver, rc); } else { parsed_vcp_version.major = vmajor; parsed_vcp_version.minor = vminor; // DBGMSG("Parsed mccs_ver: %d.%d", parsed_vcp_version.major, parsed_vcp_version.minor); } } pcaps->parsed_mccs_version = parsed_vcp_version; return pcaps; } /** Frees a Parsed_Capabilities record * * @param pcaps pointer to #Parsed_Capabilities struct */ void free_parsed_capabilities(Parsed_Capabilities * pcaps) { bool debug = false; DBGMSF(debug, "Starting. pcaps=%p", pcaps); assert( pcaps ); assert( memcmp(pcaps->marker, PARSED_CAPABILITIES_MARKER, 4) == 0); free(pcaps->raw_value); free(pcaps->mccs_version_string); if (pcaps->commands) bva_free(pcaps->commands); if (pcaps->vcp_features) { DBGMSF(debug, "vcp_features->len = %d", pcaps->vcp_features->len); int ndx; for (ndx=pcaps->vcp_features->len-1; ndx >=0; ndx--) { Capabilities_Feature_Record * vfr = g_ptr_array_index(pcaps->vcp_features, ndx); // report_feature(vfr); free_capabilities_feature(vfr); g_ptr_array_remove_index(pcaps->vcp_features, ndx); } g_ptr_array_free(pcaps->vcp_features, true); } pcaps->marker[3] = 'x'; free(pcaps); } // // Parsing // /* Capabilities string format. Parenthesized expression containing sequence of "segments" each segment consists of a segment name, followed by a parenthesized value */ typedef struct { char * name_start; int name_len; char * value_start; int value_len; char * remainder_start; int remainder_len; } Capabilities_Segment; /* Extract information about the next segment of the capabilities string. * * Arguments: start current position in the capabilities string * len length of remainder of capabilities string * * Returns: pointer to newly allocated Capabilities_Segment describing the segment * It is the responsibility of the caller to free the returned struct, * BUT NOT THE LOCATIONS IT ADDRESSES */ static Capabilities_Segment * next_capabilities_segment(char * start, int len) { Capabilities_Segment * segment = calloc(1, sizeof(Capabilities_Segment)); char * pos = start; while(*pos != '(') pos++; segment->name_start = start; // Fix for Apple Cinema Display, which precedes segment name with blank while(segment->name_start < pos && *segment->name_start == ' ') segment->name_start++; segment->name_len = pos-(segment->name_start); int depth = 1; segment->value_start = pos+1; while (depth > 0) { pos = pos + 1; if (*pos == '(') depth++; else if (*pos == ')') depth--; } segment->value_len = pos - segment->value_start; segment->remainder_start = pos+1; segment->remainder_len = start + len - segment->remainder_start; // printf("name: |%.*s|\n", segment->name_len, segment->name_start); // printf("value: |%.*s|\n", segment->value_len, segment->value_start); // printf("remainder: |%.*s|\n", segment->remainder_len, segment->remainder_start); return segment; } // TODO: On every monitor tested, the values are separated by spaces. // However, per the Access Bus spec, Section 7, values need not be separated by spaces, // e.g. 010203 is valid /* Parse the value of the cmds segment, which is a list of * 2 character hex values separated by spaces. * * Arguments: * start * len * * Returns: * Byte_Value_Array indicating command values seen */ // Alternatively, return a ByteBitFlag instance, // or pass a preallocted instances static Byte_Value_Array parse_cmds_segment( char * start, int len) { bool debug = false; DBGMSF(debug, "Starting. start=%p, len=%d", start, len); Byte_Value_Array cmd_ids2 = bva_create(); bool ok = store_bytehex_list(start, len, cmd_ids2, bva_appender); if (!ok) { f0printf(FERR, "Error processing commands list: %.*s\n", len, start); } // report_id_array(cmd_ids, "Command ids found:"); if (debug) { // report_cmd_array(cmd_ids); DBGMSG("store_bytehex_list returned %d", ok); report_commands(cmd_ids2, 1); } Byte_Value_Array result = (ok) ? cmd_ids2 : NULL; DBGMSF(debug, "returning %p", result); return result; } /* Finds the matching closing parenthesis for the * current open parenthesis. * * Arguments: * start first character to examine (must be '(') * end points to end of string, i.e. the byte * after the last character to examine * * Returns: * pointer to closing parenthesis * or end if closing parenthesis not found */ static char * find_closing_paren( char * start, char * end) { assert( *start == '('); char * pos = start+1; int depth = 1; while (pos < end && depth > 0) { if (*pos == '(') depth++; else if (*pos == ')') depth--; pos++; } if (depth == 0) pos--; return pos; } /* Parse the value of the vcp segment. * * Arguments: * start * len * * Returns: * GPtrArray of Capabilities_Feature_Record * */ static GPtrArray * parse_vcp_segment( char * start, int len) { bool debug = false; GPtrArray* vcp_array = g_ptr_array_sized_new(40); // initial size // Vcp_Code_Table_Entry * vcp_entry; // future? char * pos = start; char * end = start + len; Byte cur_feature_id = 0x00; // initialization logically unnecessary, but o.w. get warning bool valid_feature; int value_len = 0; // initialization logically unnecessary, but o.w. get warning char * value_start = NULL; // ditto while (pos < end) { valid_feature = false; // strip leading blanks while(*pos == ' ' && pos < end) pos++; if (pos == end) break; char * st = pos; while (*pos != ' ' && *pos != '(' && pos < end) pos++; int len = pos-st; DBGMSF(debug, "Found: Feature code subsegment: %.*s\n", len, st); // If len > 2, feature codes not separated by blanks. Take just the first 2 characters if (len > 2) { pos = st + 2; len = 2; } bool value_ok = false; if (len == 2) { // cur_feature_id = hhc_to_byte(st); // what if invalid hex? value_ok = hhc_to_byte_in_buf(st, &cur_feature_id); if (value_ok) { valid_feature = true; value_start = NULL; value_len = 0; } } if (!value_ok) { f0printf(FOUT, "Feature: %.*s (invalid code)\n", 1, st); } if (*pos == '(') { // find matching ) char * value_end = find_closing_paren(pos, end); if (value_end == end) { DBGMSG0("Value parse terminated without closing paren " ); // bad data, what to do? // need better error message // TODO: recover from error, this is bad data from the monitor goto bye; } value_start = pos+1; value_len = value_end - (pos + 1); // printf(" Values: %.*s\n", value_len, value_start); pos = value_end + 1; // point to character after closing paren } if (valid_feature) { Capabilities_Feature_Record * vfr = new_capabilities_feature(cur_feature_id, value_start, value_len); if (debug) { DDCA_MCCS_Version_Spec dummy_version = {0,0}; report_capabilities_feature(vfr, dummy_version, 1); } g_ptr_array_add(vcp_array, vfr); } } bye: return vcp_array; } /** Parses the entire capabilities string * * @param buf_start starting address of string * @param buf_len length of string (not including trailing null) * * @return pointer to newly allocated ParsedCapabilities structure */ Parsed_Capabilities * parse_capabilities( char * buf_start, int buf_len) { // DBGMSG("Substituting test capabilities string"); // buf_start = test_cap_strings[0]; // buf_len = strlen(test_cap_strings[0]); bool debug = false; if (debug) { DBGMSG("Starting. len=%d", buf_len); hex_dump((Byte*)buf_start, buf_len); DBGMSG("Starting. buf_start -> |%.*s|", buf_len, buf_start); } // Make a copy of the unparsed value char * raw_value = chars_to_string(buf_start, buf_len); char * mccs_ver_string = NULL; // Version_Spec parsed_vcp_version = {0.0}; Byte_Value_Array commands = NULL; GPtrArray * vcp_features = NULL; bool raw_cmds_segment_seen = false; bool raw_vcp_features_seen = false; // Apple Cinema display violates spec, does not surround capabilities string with parens if (buf_start[0] == '(') { // for now, don't try to fix bad string assert(buf_start[buf_len-1] == ')' ); buf_start = buf_start+1; buf_len = buf_len -2; } while (buf_len > 0) { Capabilities_Segment * seg = next_capabilities_segment(buf_start, buf_len); buf_start = seg->remainder_start; buf_len = seg->remainder_len; if (debug) { printf("Segment: |%.*s| -> |%.*s|\n", seg->name_len, seg->name_start, seg->value_len, seg->value_start ); } if (memcmp(seg->name_start, "cmds", seg->name_len) == 0) { raw_cmds_segment_seen = true; commands = parse_cmds_segment(seg->value_start, seg->value_len); } else if (memcmp(seg->name_start, "vcp", seg->name_len) == 0 || memcmp(seg->name_start, "VCP", seg->name_len) == 0 // hack for Apple Cinema Display ) { vcp_features = parse_vcp_segment(seg->value_start, seg->value_len); raw_vcp_features_seen = true; } else if (memcmp(seg->name_start, "mccs_version_string", seg->name_len) == 0) { DBGMSF(debug, "MCCS version: %.*s", seg->value_len, seg->value_start); // n. pointer will be stored in pcaps mccs_ver_string = chars_to_string(seg->value_start, seg->value_len); } else { // additional segment names seen: asset_eep, mpu, mswhql DBGMSF(debug, "Ignoring segment: %.*s", seg->name_len, seg->name_start); } free(seg); } // n. may be damaged Parsed_Capabilities * pcaps = new_parsed_capabilities( raw_value, mccs_ver_string, // this pointer is saved in returned struct raw_cmds_segment_seen, raw_vcp_features_seen, commands, // each stored byte is command id vcp_features); DBGMSF(debug, "Returning %p", pcaps); if (pcaps) { DBGMSF(debug, "vcp_features.len = %d", vcp_features->len); DBGMSF(debug, "pcaps->vcp_features.len = %d", pcaps->vcp_features->len); } return pcaps; } /** Parses a capabilities string passed in a #Buffer object. * * @param capabilities pointer to #Buffer * * @return pointer to newly allocated #Parsed_Capabilities structure */ Parsed_Capabilities* parse_capabilities_buffer( Buffer * capabilities) { // dump_buffer(capabilities); int len = capabilities->len - 1; while (capabilities->bytes[len] == '\0') { // strip trailings 0's - 2 seen // printf("%d\n", len); len--; } len++; return parse_capabilities((char *)capabilities->bytes, len); } /** Parses a capabilities string passed as a character string. * * @param caps null terminated capabilities string * * @return pointer to newly allocated #Parsed_Capabilities structure */ Parsed_Capabilities* parse_capabilities_string( char * caps) { return parse_capabilities(caps, strlen(caps)); } /** Returns list of feature ids in a #Parsed_Capabilities structure. * * @param pcaps pointer to #Parsed_Capabilities * @param readable_only restrict returned list to readable features * * @return #Byte_Bit_Flags indicating features found */ Byte_Bit_Flags parsed_capabilities_feature_ids( Parsed_Capabilities * pcaps, bool readable_only) { assert(pcaps); bool debug = false; DBGMSF(debug, "Starting. readable_only=%s, feature count=%d", bool_repr(readable_only), pcaps->vcp_features->len); Byte_Bit_Flags flags = bbf_create(); if (pcaps->vcp_features) { // pathological case of 0 length capabilities string for (int ndx = 0; ndx < pcaps->vcp_features->len; ndx++) { Capabilities_Feature_Record * frec = g_ptr_array_index(pcaps->vcp_features, ndx); // DBGMSG("Feature 0x%02x", frec->feature_id); bool add_feature_to_list = true; if (readable_only) { VCP_Feature_Table_Entry * vfte = vcp_find_feature_by_hexid_w_default(frec->feature_id); if (!is_feature_readable_by_vcp_version(vfte, pcaps->parsed_mccs_version)) add_feature_to_list = false; if (vfte->vcp_global_flags & DDCA_SYNTHETIC) free_synthetic_vcp_entry(vfte); } if (add_feature_to_list) bbf_set(flags, frec->feature_id); } } DBGMSF(debug, "Returning Byte_Bit_Flags: %s", bbf_to_string(flags, NULL, 0)); return flags; } /** Checks if it's possible that a monitor support table reads. * * Alternatively stated, checks the parsed capabilities to see if table * reads can definitely be ruled out. * * @param pcaps pointer to #Parsed_Capabilities (may be null) * * @return **false** if **pcaps** is non-null and a commands segment was * parsed and neither Table Read Request nor Table Read Reply was found, * **true** otherwise */ bool parsed_capabilities_may_support_table_commands(Parsed_Capabilities * pcaps) { bool result = true; if (pcaps && pcaps->raw_cmds_segment_seen && pcaps->commands) { if ( !bva_contains(pcaps->commands, 0xe2) && // Table Read Request !bva_contains(pcaps->commands, 0xe4) // Table Read Reply ) result = false; } return result; } #ifdef TESTS // // Tests // void test_segment(char * text) { char * start = text; int len = strlen(text); Capabilities_Segment * capseg = next_capabilities_segment(start, len); free(capseg); // it's just a test function, but avoid coverity flagging memory leak } void test_segments() { test_segment("vcp(10 20)"); test_segment("vcp(10 20)abc"); test_segment("vcp(10 20 30( asdf ))x"); } void test_parse_caps() { Parsed_Capabilities * pcaps = parse_capabilities_string("(alpha(adsf)vcp(10 20 30(31 32) ))"); report_parsed_capabilities(pcaps); free_parsed_capabilities(pcaps); } #endif ddcutil-0.8.6/src/vcp/parsed_capabilities_feature.c0000644000175000001440000002332213226562037017327 00000000000000/* parsed_capabilities_feature.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Describes one VCP feature in a capabilities string. * * The functions in this file are used only in parse_capabilities.c, * but were extracted for clarity. */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/data_structures.h" #include "util/report_util.h" #include "vcp/vcp_feature_codes.h" #include "vcp/parsed_capabilities_feature.h" // Trace class for this file // static TraceGroup TRACE_GROUP = TRC_DDC; // currently unused, commented out to avoid warning /** Given a feature code and the unparenthesized value string extracted * from a capabilities string, parses the value string and creates * a #Capabilities_Feature_Record. * * \param feature_id * \param value_string_start start of value string, may be NULL * \param value_string_len length of value string */ Capabilities_Feature_Record * new_capabilities_feature( Byte feature_id, char * value_string_start, int value_string_len) { bool debug = false; if (debug) { DBGMSG("Starting. Feature: 0x%02x", feature_id); if (value_string_start) DBGMSG("value string: |%.*s|", value_string_len, value_string_start); else DBGMSG0("value_string_start = NULL"); } Capabilities_Feature_Record * vfr = (Capabilities_Feature_Record *) calloc(1,sizeof(Capabilities_Feature_Record)); memcpy(vfr->marker, CAPABILITIES_FEATURE_MARKER, 4); vfr->feature_id = feature_id; // relying on calloc to 0 all other fields if (value_string_start) { vfr->value_string = (char *) malloc( value_string_len+1); memcpy(vfr->value_string, value_string_start, value_string_len); vfr->value_string[value_string_len] = '\0'; #ifdef OLD_BVA Byte_Value_Array bva_values = bva_create(); bool ok1 = store_bytehex_list(value_string_start, value_string_len, bva_values, bva_appender); if (!ok1) { f0printf(FOUT, "Error processing VCP feature value list into bva_values: %.*s\n", value_string_len, value_string_start); } #endif Byte_Bit_Flags bbf_values = bbf_create(); bool ok2 = store_bytehex_list(value_string_start, value_string_len, bbf_values, bbf_appender); if (!ok2) { SEVEREMSG("Error processing VCP feature value list into bbf_values: %.*s\n", value_string_len, value_string_start); } if (debug) { #ifdef OLD_WAY DBGMSG("store_bytehex_list for bva returned %d", ok1); #endif DBGMSG("store_bytehex_list for bbf returned %d", ok2); //DBGMSG("Comparing Byte_value_Array vs ByteBitFlags"); } #ifdef OLD_WAY bool compok = bva_bbf_same_values(bva_values, bbf_values); if (compok) { if (debug) DBGMSG("Byte_Value_Array and ByteBitFlags equivalent"); } else { DBGMSG("Byte_Value_Array and ByteBitFlags DO NOT MATCH"); bva_report(bva_values, "Byte_Value_Array contents:"); char buf[768]; DBGMSG("ByteBitFlags as list: %s", bbf_to_string(bbf_values, buf, 768)); } #endif #ifdef OLD_BVA vfr->values = bva_values; if (debug) bva_report(vfr->values, "Feature values (array):"); #endif vfr->bbflags = bbf_values; if (debug) { char buf[768]; DBGMSG("ByteBitFlags as list: %s", bbf_to_string(bbf_values,buf,768)); } } return vfr; } /** Frees a #Capabilities_Feature_Record instance. * * \param pfeat pointer to #Capabilities_Feature_Record to free.\n * If null, do nothing */ void free_capabilities_feature( Capabilities_Feature_Record * pfeat) { // DBGMSG("Starting. pfeat=%p", pfeat); if (pfeat) { assert(memcmp(pfeat->marker, CAPABILITIES_FEATURE_MARKER, 4) == 0); if (pfeat->value_string) free(pfeat->value_string); #ifdef OLD_BVA // TODO: prune one implementation if (pfeat->values) bva_free(pfeat->values); #endif if (pfeat->bbflags) bbf_free(pfeat->bbflags); pfeat->marker[3] = 'x'; free(pfeat); } // DBGMSG("Done."); } /** Displays the contents of a #Capabilities_Feature_Record as part * of the **capabilities** command. * * Output is written to the #FOUT device. * * @param vfr pointer to #Capabilities_Feature_Record * @param vcp_version monitor VCP version, used in case feature * information is version specific * @param depth logical indentation depth */ void report_capabilities_feature( Capabilities_Feature_Record * vfr, DDCA_MCCS_Version_Spec vcp_version, int depth) { bool debug = false; DBGMSF(debug, "Starting. vfr=%p, vcp_version=%d.%d", vfr, vcp_version.major, vcp_version.minor); assert(vfr && memcmp(vfr->marker, CAPABILITIES_FEATURE_MARKER, 4) == 0); int d0 = depth; int d1 = depth+1; int d2 = depth+2; rpt_vstring(d0, "Feature: %02X (%s)", vfr->feature_id, get_feature_name_by_id_and_vcp_version(vfr->feature_id, vcp_version)); DDCA_Output_Level ol = get_output_level(); DBGMSF(debug, "vfr->value_string=%p", vfr->value_string); if (ol >= DDCA_OL_VERBOSE && vfr->value_string) { rpt_vstring(d1, "Values (unparsed): %s", vfr->value_string); } #ifdef OLD_BVA // hex_dump((Byte*) vfr, sizeof(VCP_Feature_Record)); // if (vfr->values) // report_id_array(vfr->values, "Feature values:"); char * buf0 = NULL; DBGMSF(debug, "vfr->values=%p", vfr->values); if (vfr->values) { // Get the descriptions of the documented values for the feature DDCA_Feature_Value_Entry * feature_values = find_feature_values_for_capabilities(vfr->feature_id, vcp_version); DBGMSF(debug, "Feature values %sfound for feature 0x%02x", (feature_values) ? "" : "NOT ", vfr->feature_id); int ct = bva_length(vfr->values); if (feature_values) { // did we find descriptions for the features? if (ol >= DDCA_OL_VERBOSE) f0printf(FOUT, " Values ( parsed):\n"); else f0printf(FOUT, " Values:\n"); int ndx = 0; for (; ndx < ct; ndx++) { Byte hval = bva_get(vfr->values, ndx); char * value_name = get_feature_value_name(feature_values, hval); if (!value_name) value_name = "Unrecognized value"; f0printf(FOUT, " %02x: %s\n", hval, value_name); } } else { // no interpretation available, just show the values int required_size = 3 * ct; buf0 = malloc(required_size); char * bufend = buf0+required_size; char * pos = buf0; int ndx = 0; for (; ndx < ct; ndx++) { Byte hval = bva_get(vfr->values, ndx); snprintf(pos, bufend-pos, "%02X ", hval); pos = pos+3; } *(pos-1) = '\0'; if (ol >= DDCA_OL_VERBOSE) f0printf(FOUT, " Values ( parsed): %s (interpretation unavailable)\n", buf0); else f0printf(FOUT, " Values: %s (interpretation unavailable)\n", buf0); } } // assert( streq(buf0, vfr->value_string)); if (buf0) free(buf0); #endif // #ifdef NEW_BBF DBGMSF(debug, "vfr->bbflags=%p", vfr->bbflags); if (vfr->bbflags) { // Get the descriptions of the documented values for the feature DDCA_Feature_Value_Entry * feature_values = find_feature_values_for_capabilities(vfr->feature_id, vcp_version); DBGMSF(debug, "Feature values %sfound for feature 0x%02x", (feature_values) ? "" : "NOT ", vfr->feature_id); if (feature_values) { // did we find descriptions for the features? if (ol >= DDCA_OL_VERBOSE) rpt_vstring(d1, "Values ( parsed):"); else rpt_vstring(d1, "Values:"); Byte_Bit_Flags iter = bbf_iter_new(vfr->bbflags); int nextval = -1; while ( (nextval = bbf_iter_next(iter)) >= 0) { assert(nextval < 256); char * value_name = get_feature_value_name(feature_values, nextval); if (!value_name) value_name = "Unrecognized value"; rpt_vstring(d2, "%02x: %s", nextval, value_name); } bbf_iter_free(iter); } else { // no interpretation available, just show the values char * buf1 = bbf_to_string(vfr->bbflags, NULL, 0); // allocate buffer if (ol >= DDCA_OL_VERBOSE) rpt_vstring(d1, "Values ( parsed): %s (interpretation unavailable)", buf1); else rpt_vstring(d1, "sValues: %s (interpretation unavailable)", buf1); free(buf1); } } // #endif DBGMSF0(debug, "Done."); } ddcutil-0.8.6/src/vcp/vcp_feature_codes.c0000644000175000001440000046111313215715272015310 00000000000000/* vcp_feature_codes.c * * VCP Feature Code Table and the functions it references * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * VCP Feature Code Table and related functions */ #include #include #include #include #include "util/data_structures.h" #include "util/report_util.h" #include "base/ddc_errno.h" #include "base/vcp_version.h" #include "vcp/vcp_feature_codes.h" // Direct writes to stdout,stderr: // in table validation functions (Benign) // Forward references int vcp_feature_code_count; VCP_Feature_Table_Entry vcp_code_table[]; static DDCA_Feature_Value_Entry x14_color_preset_absolute_values[]; DDCA_Feature_Value_Entry xc8_display_controller_type_values[]; static DDCA_Feature_Value_Entry x8d_tv_audio_mute_source_values[]; static DDCA_Feature_Value_Entry x8d_sh_blank_screen_values[]; bool default_table_feature_detail_function( Buffer * data, DDCA_MCCS_Version_Spec vcp_version, char** presult); bool format_feature_detail_debug_continuous( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz); bool format_feature_detail_standard_continuous( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz); bool format_feature_detail_sl_lookup( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz); // // Functions implementing the VCPINFO command // /* Creates humanly readable interpretation of VCP feature flags. * The result is returned in a buffer supplied by the caller. * * Arguments: * flags * buf * buflen * * Returns: buf */ static char * vcp_interpret_version_feature_flags( DDCA_Version_Feature_Flags flags, char* buf, int buflen) { // DBGMSG("flags: 0x%04x", flags); char * rwmsg = ""; if (flags & DDCA_RO) rwmsg = "ReadOnly "; else if (flags & DDCA_WO) rwmsg = "WriteOnly"; else if (flags & DDCA_RW) rwmsg = "ReadWrite"; char * typemsg = ""; // NEED TO ALSO HANDLE TABLE TYPE if (flags & DDCA_CONT) typemsg = "Continuous"; else if (flags & DDCA_NC) typemsg = "Non-continuous"; else if (flags & DDCA_NORMAL_TABLE) typemsg = "Table"; // else if (flags & VCP_TYPE_V2NC_V3T) // typemsg = "V2:NC, V3:Table"; else if (flags & DDCA_DEPRECATED) typemsg = "Deprecated"; else typemsg = "Type not set"; // TODO: determine if varying interpretation by analyzing entry // need function has_version_specific_features(entry) char * vermsg = ""; // if (flags & VCP_FUNC_VER) // if (has_version_specific_features(entry)) // vermsg = " (Version specific interpretation)"; snprintf(buf, buflen, "%s %s%s", rwmsg, typemsg, vermsg); return buf; } /* Implements command LISTVCP * * Arguments: * fh where to write output */ void vcp_list_feature_codes(FILE * fh) { fprintf(fh, "Recognized VCP feature codes:\n"); char buf[200]; char buf2[200]; // TODO make listvcp respect display to get version? int ndx = 0; for (;ndx < vcp_feature_code_count; ndx++) { VCP_Feature_Table_Entry entry = vcp_code_table[ndx]; // DBGMSG("code=0x%02x, flags: 0x%04x", entry.code, entry.flags); DDCA_MCCS_Version_Spec vspec = get_highest_non_deprecated_version(&entry); DDCA_Version_Feature_Flags vflags = get_version_specific_feature_flags(&entry, vspec); vcp_interpret_version_feature_flags(vflags, buf, sizeof(buf)); char * vermsg = ""; if (has_version_specific_features(&entry)) vermsg = " (Version specific interpretation)"; snprintf(buf2, sizeof(buf2), "%s%s", buf, vermsg); fprintf(fh, " %02x - %-40s %s\n", entry.code, get_non_version_specific_feature_name(&entry), // vcp_interpret_feature_flags(entry.flags, buf, 200) // *** TODO: HOW TO HANDLE THIS w/o version? buf2 ); } } /* Returns a byte of flags indicating those MCCS versions for which the * specified VCP feature is defined. * * Arguments: * pentry pointer to VCP_Feature_Table_Entry for VCP feature * * Returns: byte of flags */ static Byte valid_versions(VCP_Feature_Table_Entry * pentry) { Byte result = 0x00; if (pentry->v20_flags) result |= DDCA_V20; if (pentry->v21_flags) { if ( !(pentry->v21_flags & DDCA_DEPRECATED) ) result |= DDCA_V21; } else { if (result & DDCA_V20) result |= DDCA_V21; } if (pentry->v30_flags) { if ( !(pentry->v30_flags & DDCA_DEPRECATED) ) result |= DDCA_V30; } else { if (result & DDCA_V21) result |= DDCA_V30; } if (pentry->v22_flags) { if ( !(pentry->v22_flags & DDCA_DEPRECATED) ) result |= DDCA_V22; } else { if (result & DDCA_V21) result |= DDCA_V22; } return result; } /* Given a byte of flags indicating MCCS versions, return a string containing a * comma delimited list of MCCS version names. * * Arguments: * valid_version_flags * version_name_buf buffer in which to return string * bufsz buffer size * * Returns: version_name_buf * * Note: MCCS 1.0 is not reported */ static char * valid_version_names_r( Byte valid_version_flags, char * version_name_buf, int bufsz) { assert(bufsz >= (4*5)); // max 4 version names, 5 chars/name *version_name_buf = '\0'; if (valid_version_flags & DDCA_V20) strcpy(version_name_buf, "2.0"); if (valid_version_flags & DDCA_V21) { if (strlen(version_name_buf) > 0) strcat(version_name_buf, ", "); strcat(version_name_buf, "2.1"); } if (valid_version_flags & DDCA_V30) { if (strlen(version_name_buf) > 0) strcat(version_name_buf, ", "); strcat(version_name_buf, "3.0"); } if (valid_version_flags & DDCA_V22) { if (strlen(version_name_buf) > 0) strcat(version_name_buf, ", "); strcat(version_name_buf, "2.2"); } return version_name_buf; } /* Appends a string to an existing string in a buffer. * If the length of the existing string is greater than 0, * append ", " first. * * Arguments: * val value to append * buf start of buffer * bufsz buffer size * * Returns: buf * * Note: No check is made that buf contains a valid string. */ static char * str_comma_cat_r(char * val, char * buf, int bufsz) { int cursz = strlen(buf); assert(cursz + 2 + strlen(val) + 1 <= bufsz); if (cursz > 0) strcat(buf, ", "); strcat(buf, val); return buf; } static char * spec_group_names_r(VCP_Feature_Table_Entry * pentry, char * buf, int bufsz) { *buf = '\0'; if (pentry->vcp_spec_groups & VCP_SPEC_PRESET) str_comma_cat_r("Preset", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_IMAGE) str_comma_cat_r("Image", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_CONTROL) str_comma_cat_r("Control", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_GEOMETRY) str_comma_cat_r("Geometry", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_MISC) str_comma_cat_r("Miscellaneous", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_AUDIO) str_comma_cat_r("Audio", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_DPVL) str_comma_cat_r("DPVL", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_MFG) str_comma_cat_r("Manufacturer specific", buf, bufsz); if (pentry->vcp_spec_groups & VCP_SPEC_WINDOW) str_comma_cat_r("Window", buf, bufsz); return buf; } #ifdef OLD char * subset_names_r(VCP_Feature_Table_Entry * pentry, char * buf, int bufsz) { *buf = '\0'; if (pentry->vcp_subsets & VCP_SUBSET_PROFILE) str_comma_cat_r("PROFILE", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_COLOR) str_comma_cat_r("COLOR", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_LUT) str_comma_cat_r("LUT", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_CRT) str_comma_cat_r("CRT", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_TV) str_comma_cat_r("TV", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_AUDIO) str_comma_cat_r("AUDIO", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_WINDOW) str_comma_cat_r("WINDOW", buf, bufsz); if (pentry->vcp_subsets & VCP_SUBSET_DPVL) str_comma_cat_r("DPVL", buf, bufsz); return buf; } #endif #ifdef OLD static char * subset_names_r(VCP_Feature_Table_Entry * pentry, char * buf, int bufsz) { *buf = '\0'; int kk = 0; for(;kk < vcp_subset_count; kk++) { Vcp_Subset_Desc cur_desc = vcp_subset_desc[kk]; if (pentry->vcp_subsets & cur_desc.subset_id) str_comma_cat_r(cur_desc.public_name, buf, bufsz); } return buf; } #endif #ifdef OLD static char * subset_names_r(VCP_Feature_Table_Entry * pentry, char * buf, int bufsz) { *buf = '\0'; int kk = 0; for(;kk < vcp_subset_count; kk++) { Value_Name_Title cur_desc = vcp_subset_table[kk]; if (pentry->vcp_subsets & cur_desc.value) str_comma_cat_r(cur_desc.title, buf, bufsz); } return buf; } #endif static void report_sl_values(DDCA_Feature_Value_Entry * sl_values, int depth) { while (sl_values->value_name != NULL) { rpt_vstring(depth, "0x%02x: %s", sl_values->value_code, sl_values->value_name); sl_values++; } } char * interpret_ddca_version_feature_flags_readwrite( DDCA_Version_Feature_Flags feature_flags) { char * result = NULL; if (feature_flags & DDCA_RW) result = "Read Write"; else if (feature_flags & DDCA_RO) result = "Read Only"; else if (feature_flags & DDCA_WO) result = "Write Only"; else { PROGRAM_LOGIC_ERROR("No read/write bits set"); result = "PROGRAM LOGIC ERROR: No read/write bits set"; } return result; } char * interpret_ddca_version_feature_flags_type( DDCA_Version_Feature_Flags feature_flags) { char * result = NULL; if (feature_flags & DDCA_STD_CONT) result = "Continuous (normal)"; else if (feature_flags & DDCA_COMPLEX_CONT) result = "Continuous (complex)"; else if (feature_flags & DDCA_SIMPLE_NC) result = "Non-Continuous (simple)"; else if (feature_flags & DDCA_COMPLEX_NC) result = "Non-Continuous (complex)"; else if (feature_flags & DDCA_WO_NC) result = "Non-Continuous (write-only)"; else if (feature_flags & DDCA_NORMAL_TABLE) result = "Table (normal)"; else if (feature_flags & DDCA_WO_TABLE) result = "Table (write-only)"; else { result = "PROGRAM LOGIC ERROR: No C/NC/T subtype bit set"; PROGRAM_LOGIC_ERROR("No C/NC/T subtype bit set"); } return result; } char * interpret_ddca_global_feature_flags( DDCA_Version_Feature_Flags feature_flags) { char * result = ""; if (feature_flags & DDCA_SYNTHETIC) result = "Synthetic"; return result; } static char * interpret_feature_flags_r( DDCA_Version_Feature_Flags vflags, char * workbuf, int bufsz) { bool debug = false; DBGMSF(debug, "vflags=0x%04x", vflags); assert(bufsz >= 100); // bigger than we'll need *workbuf = '\0'; if (vflags & DDCA_DEPRECATED) { strcpy(workbuf, "Deprecated"); } else { strcpy(workbuf, interpret_ddca_version_feature_flags_readwrite(vflags)); strcat(workbuf, ", "); strcat(workbuf, interpret_ddca_version_feature_flags_type(vflags)); #ifdef OLD if (vflags & DDCA_RO) strcpy(workbuf, "Read Only, "); else if (vflags & DDCA_WO) strcpy(workbuf, "Write Only, "); else if (vflags & DDCA_RW) strcpy(workbuf, "Read Write, "); else PROGRAM_LOGIC_ERROR("No read/write bits set"); #endif #ifdef OLD if (vflags & DDCA_STD_CONT) strcat(workbuf, "Continuous (standard)"); else if (vflags & DDCA_COMPLEX_CONT) strcat(workbuf, "Continuous (complex)"); else if (vflags & DDCA_SIMPLE_NC) strcat(workbuf, "Non-Continuous (simple)"); else if (vflags & DDCA_COMPLEX_NC) strcat(workbuf, "Non-Continuous (complex)"); else if (vflags & DDCA_WO_NC) strcat(workbuf, "Non-Continuous (write-only)"); else if (vflags & DDCA_TABLE) strcat(workbuf, "Table"); else PROGRAM_LOGIC_ERROR("No type bits set"); #endif char * s = interpret_ddca_global_feature_flags(vflags); if (s && strlen(s) > 0) { strcat(workbuf, ", "); strcat(workbuf, s); } } return workbuf; } // report function specifically for use by report_vcp_feature_table_entry() static void report_feature_table_entry_flags( VCP_Feature_Table_Entry * pentry, DDCA_MCCS_Version_Spec vcp_version, int depth) { char workbuf[200]; DDCA_Version_Feature_Flags vflags = get_version_specific_feature_flags(pentry, vcp_version); if (vflags) { interpret_feature_flags_r(vflags, workbuf, sizeof(workbuf)); rpt_vstring(depth, "Attributes (v%d.%d): %s", vcp_version.major, vcp_version.minor, workbuf); } } /* Emits a report on a VCP_Feature_Table_Entry. This function is used by the * VCPINFO command. The report is written to the current report destination. * * Arguments: * pentry pointer to feature table entry * depth logical indentation depth */ void report_vcp_feature_table_entry(VCP_Feature_Table_Entry * pentry, int depth) { char workbuf[200]; int d1 = depth+1; DDCA_Output_Level output_level = get_output_level(); DDCA_MCCS_Version_Spec vspec = get_highest_non_deprecated_version(pentry); DDCA_Version_Feature_Flags vflags = get_version_specific_feature_flags(pentry, vspec); char * feature_name = get_non_version_specific_feature_name(pentry); rpt_vstring(depth, "VCP code %02X: %s", pentry->code, feature_name); rpt_vstring(d1, "%s", pentry->desc); valid_version_names_r(valid_versions(pentry), workbuf, sizeof(workbuf)); rpt_vstring(d1, "MCCS versions: %s", workbuf); rpt_vstring(d1, "MCCS specification groups: %s", spec_group_names_r(pentry, workbuf, sizeof(workbuf))); char * subset_names = feature_subset_names(pentry->vcp_subsets); rpt_vstring(d1, "ddcutil feature subsets: %s", subset_names); free(subset_names); #ifdef OLD rpt_vstring(d1, "ddcutil feature subsets: %s", subset_names_r(pentry, workbuf, sizeof(workbuf))); #endif if (has_version_specific_features(pentry)) { // rpt_vstring(d1, "VERSION SPECIFIC FLAGS"); report_feature_table_entry_flags(pentry, VCP_SPEC_V20, d1); report_feature_table_entry_flags(pentry, VCP_SPEC_V21, d1); report_feature_table_entry_flags(pentry, VCP_SPEC_V30, d1); report_feature_table_entry_flags(pentry, VCP_SPEC_V22, d1); } else { interpret_feature_flags_r(vflags, workbuf, sizeof(workbuf)); rpt_vstring(d1, "Attributes: %s", workbuf); } if (pentry->default_sl_values && output_level >= DDCA_OL_VERBOSE) { rpt_vstring(d1, "Simple NC values:"); report_sl_values(pentry->default_sl_values, d1+1); } } // End of VCPINFO related functions /* Emits a report on a Version_Specific_Feature_Info struct. This is a * debugging report. The report is written to the current report destination. * * Arguments: * info pointer to struct * depth logical indentation depth */ void report_version_feature_info( DDCA_Version_Feature_Info * info, int depth) { char workbuf[200]; int d1 = depth+1; // DDCA_Output_Level output_level = get_output_level(); rpt_vstring(depth, "VCP code %02X: %s", info->feature_code, info->feature_name); rpt_vstring(d1, "Version spec: %d.%d", info->vspec.major, info->vspec.minor); rpt_vstring(d1, "Version id: %d", info->version_id); // to do: need repr_mccs_version_id() function rpt_vstring(d1, "Description: %s", info->desc); DDCA_Version_Feature_Flags vflags = info->feature_flags; interpret_feature_flags_r(vflags, workbuf, sizeof(workbuf)); rpt_vstring(d1, "Attributes: %s", workbuf); // rpt_vstring(d1, "Global_flags: 0x%02x", info->global_flags); // TODO: interpretation function if(info->sl_values) { rpt_vstring(d1, "Simple NC values:"); report_sl_values(info->sl_values, d1+1); } } // // Miscellaneous VCP_Feature_Table lookup functions // char * get_feature_name_by_id_only(Byte feature_id) { char * result = NULL; VCP_Feature_Table_Entry * vcp_entry = vcp_find_feature_by_hexid(feature_id); if (vcp_entry) result = get_non_version_specific_feature_name(vcp_entry); else if (0xe0 <= feature_id && feature_id <= 0xff) result = "manufacturer specific feature"; else result = "unrecognized feature"; return result; } char * get_feature_name_by_id_and_vcp_version(Byte feature_id, DDCA_MCCS_Version_Spec vspec) { char * result = NULL; VCP_Feature_Table_Entry * vcp_entry = vcp_find_feature_by_hexid(feature_id); if (vcp_entry) { result = get_version_sensitive_feature_name(vcp_entry, vspec); if (!result) result = get_non_version_specific_feature_name(vcp_entry); // fallback } else if (0xe0 <= feature_id && feature_id <= 0xff) result = "manufacturer specific feature"; else result = "unrecognized feature"; return result; } int vcp_get_feature_code_count() { return vcp_feature_code_count; } /* Gets the appropriate VCP flags value for a feature, given * the VCP version for the monitor. * * Arguments: * pvft_entry vcp_feature_table entry * vcp_version VCP version for monitor * * Returns: * flags, 0 if feature is not defined for version */ DDCA_Version_Feature_Flags get_version_specific_feature_flags( VCP_Feature_Table_Entry * pvft_entry, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; DDCA_Version_Feature_Flags result = 0; if (vcp_version.major >= 3) result = pvft_entry->v30_flags; else if (vcp_version.major == 2 && vcp_version.minor >= 2) result = pvft_entry->v22_flags; if (!result && (vcp_version.major >= 3 || (vcp_version.major == 2 && vcp_version.minor >= 1)) ) result = pvft_entry->v21_flags; if (!result) result = pvft_entry->v20_flags; #ifdef NO // this is what get_version_sensisitve_feature_flags() is for if (!result) { DDCA_MCCS_Version_Spec version_used = {0,0}; result = pvft_entry->v21_flags; if (result) { version_used.major = 2; version_used.minor = 1; } else { result = pvft_entry->v22_flags; if (result) { version_used.major = 2; version_used.minor = 2; } else { result = pvft_entry->v30_flags; assert(result); version_used.major = 3; version_used.minor = 0; } } char buf[20]; if (vcp_version.major < 1) strcpy(buf, "Undefined"); else snprintf(buf, 20, "%d.%d", vcp_version.major, vcp_version.minor); DBGTRC(true, TRACE_GROUP, "Monitor version %s is less than earliest MCCS version for which VCP feature code %02x is defined.", buf, pvft_entry->code); DBGTRC(true, TRACE_GROUP, "Using definition for MCCS version %d.%d", version_used.major, version_used.minor); } #endif DBGMSF(debug, "Feature = 0x%02x, vcp version=%d.%d, returning 0x%02x", pvft_entry->code, vcp_version.major, vcp_version.minor, result); return result; } bool is_feature_supported_in_version( VCP_Feature_Table_Entry * pvft_entry, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; bool result = false; DDCA_Version_Feature_Flags vflags = get_version_specific_feature_flags(pvft_entry, vcp_version); result = (vflags && !(vflags&DDCA_DEPRECATED)); DBGMSF(debug, "Feature = 0x%02x, vcp versinon=%d.%d, returning %s", pvft_entry->code, vcp_version.major, vcp_version.minor, bool_repr(result) ); return result; } /* Gets appropriate VCP flags value for a feature, given * the VCP version for the monitor. If the VCP version specified is less than * the first version for which the feature is defined, returns the flags for the * first version for which the feature is defined. This situation can arise when scanning * all possible VCP codes. * * Arguments: * pvft_entry vcp_feature_table entry * vcp_version VCP version for monitor * * Returns: * flags */ DDCA_Version_Feature_Flags get_version_sensitive_feature_flags( VCP_Feature_Table_Entry * pvft_entry, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; DDCA_Version_Feature_Flags result = get_version_specific_feature_flags(pvft_entry, vcp_version); if (!result) { // vcp_version is lower than the first version level at which the field // was defined. This can occur e.g. if scanning. Pick the best // possible flags by scanning up in versions. if (pvft_entry->v21_flags) result = pvft_entry->v21_flags; else if (pvft_entry->v30_flags) result = pvft_entry->v30_flags; else if (pvft_entry->v22_flags) result = pvft_entry->v22_flags; if (!result) { PROGRAM_LOGIC_ERROR( "Feature = 0x%02x, Version=%d.%d: No version sensitive feature flags found", pvft_entry->code, vcp_version.major, vcp_version.minor); assert(false); } } DBGMSF(debug, "Feature = 0x%02x, vcp version=%d.%d, returning 0x%02x", pvft_entry->code, vcp_version.major, vcp_version.minor, result); return result; } bool has_version_specific_features(VCP_Feature_Table_Entry * pentry) { int ct = 0; if (pentry->v20_flags) ct++; if (pentry->v21_flags) ct++; if (pentry->v30_flags) ct++; if (pentry->v22_flags) ct++; return (ct > 1); } /* Returns the highest version number for which a feature is not deprecated */ DDCA_MCCS_Version_Spec get_highest_non_deprecated_version( VCP_Feature_Table_Entry * vfte) { DDCA_MCCS_Version_Spec vspec = {0,0}; if ( vfte->v22_flags && !(vfte->v22_flags & DDCA_DEPRECATED) ) { vspec.major = 2; vspec.minor = 2; } else if ( vfte->v30_flags && !(vfte->v30_flags & DDCA_DEPRECATED) ) { vspec.major = 3; vspec.minor = 0; } else if ( vfte->v21_flags && !(vfte->v21_flags & DDCA_DEPRECATED) ) { vspec.major = 2; vspec.minor = 1; } else if ( vfte->v20_flags && !(vfte->v20_flags & DDCA_DEPRECATED) ) { vspec.major = 2; vspec.minor = 0; } else { PROGRAM_LOGIC_ERROR("Feature 0x%02x is deprecated for all versions", vfte->code); assert(false); } return vspec; } // convenience function bool is_feature_readable_by_vcp_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; bool result = (get_version_sensitive_feature_flags(vfte, vcp_version) & DDCA_READABLE ); DBGMSF(debug, "code=0x%02x, vcp_version=%d.%d, returning %d", vfte->code, vcp_version.major, vcp_version.minor, result); return result; } // convenience function bool is_feature_writable_by_vcp_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { return (get_version_sensitive_feature_flags(vfte, vcp_version) & DDCA_WRITABLE ); } // convenience function bool is_feature_table_by_vcp_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { return (get_version_sensitive_feature_flags(vfte, vcp_version) & DDCA_NORMAL_TABLE ); } // Checks if the table/non-table choice for a feature is version sensitive bool is_version_conditional_vcp_type(VCP_Feature_Table_Entry * vfte) { bool result = false; Byte allflags = vfte->v30_flags | vfte->v22_flags | vfte->v21_flags | vfte->v20_flags; bool some_nontable = allflags & (DDCA_CONT | DDCA_NC); bool some_table = allflags & DDCA_NORMAL_TABLE; result = some_nontable && some_table; return result; } DDCA_Feature_Value_Entry * get_version_specific_sl_values( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; DDCA_Feature_Value_Entry * result = NULL; if (vcp_version.major >= 3) result = vfte->v30_sl_values; else if (vcp_version.major == 2 && vcp_version.minor >= 2) result = vfte->v22_sl_values; if (!result && (vcp_version.major >= 3 || (vcp_version.major == 2 && vcp_version.minor == 1)) ) result = vfte->v21_sl_values; if (!result) result = vfte->default_sl_values; DBGMSF(debug, "Feature = 0x%02x, vcp version=%d.%d, returning %p", vfte->code, vcp_version.major, vcp_version.minor, result); return result; } DDCA_Feature_Value_Entry * get_version_sensitive_sl_values( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; DDCA_Feature_Value_Entry * result = get_version_specific_sl_values(vfte, vcp_version); if (!result) { // vcp_version is lower than the first version level at which the field // was defined. This can occur e.g. if scanning. Pick the best // possible flags by scanning up in versions. if (vfte->v21_sl_values) result = vfte->v21_sl_values; else if (vfte->v30_sl_values) result = vfte->v30_sl_values; else if (vfte->v22_sl_values) result = vfte->v22_sl_values; // should it be a fatal error if not found? // if (!result) { // PROGRAM_LOGIC_ERROR( // "Feature = 0x%02x, Version=%d.%d: No version sensitive sl values", // pvft_entry->code, vcp_version.major, vcp_version.minor); // } } DBGMSF(debug, "Feature = 0x%02x, vcp version=%d.%d, returning %p", vfte->code, vcp_version.major, vcp_version.minor, result); return result; } char * get_version_specific_feature_name( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; char * result = NULL; if (vcp_version.major >= 3) result = vfte->v30_name; else if (vcp_version.major == 2 && vcp_version.minor >= 2) result = vfte->v22_name; if (!result && (vcp_version.major >= 3 || (vcp_version.major == 2 && vcp_version.minor >= 1)) ) result = vfte->v21_name; if (!result) result = vfte->v20_name; DBGMSF(debug, "Feature = 0x%02x, vcp version=%d.%d, returning %s", vfte->code, vcp_version.major, vcp_version.minor, result); return result; } char * get_version_sensitive_feature_name( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; char * result = get_version_specific_feature_name(vfte, vcp_version); if (!result) { // DBGMSG("Using original name field"); // result = pvft_entry->name; // vcp_version is lower than the first version level at which the field // was defined. This can occur e.g. if scanning. Pick the best // possible name by scanning up in versions. if (vfte->v21_name) result = vfte->v21_name; else if (vfte->v30_name) result = vfte->v30_name; else if (vfte->v22_name) result = vfte->v22_name; if (!result) DBGMSG("Feature = 0x%02x, Version=%d.%d: No version specific feature name found", vfte->code, vcp_version.major, vcp_version.minor); } DBGMSF(debug, "Feature = 0x%02x, vcp version=%d.%d, returning %s", vfte->code, vcp_version.major, vcp_version.minor, result); return result; } // for use when we don't know the version char * get_non_version_specific_feature_name( VCP_Feature_Table_Entry * vfte) { DDCA_MCCS_Version_Spec vspec = {2,2}; return get_version_sensitive_feature_name(vfte, vspec); } DDCA_Version_Feature_Info * extract_version_feature_info( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vspec, bool version_sensitive) { bool debug = false; DBGMSF(debug, "vspec=%d.%d, version_sensitive=%s", vspec.major, vspec.minor, bool_repr(version_sensitive)); assert(vfte); // DDCA_MCCS_Version_Id version_id = mccs_version_spec_to_id(vspec); DDCA_Version_Feature_Info * info = calloc(1, sizeof(DDCA_Version_Feature_Info)); memcpy(info->marker, VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER , 4); info->feature_code = vfte->code; // redundant, for now info->version_id = mccs_version_spec_to_id(vspec); info->vspec = vspec; info->feature_flags = (version_sensitive) ? get_version_sensitive_feature_flags(vfte, vspec) : get_version_specific_feature_flags(vfte, vspec); info->desc = vfte->desc; info->feature_name = (version_sensitive) ? get_version_sensitive_feature_name(vfte, vspec) : get_version_specific_feature_name(vfte, vspec); info->feature_flags |= vfte->vcp_global_flags; info->sl_values = (version_sensitive) ? get_version_sensitive_sl_values(vfte, vspec) : get_version_specific_sl_values(vfte, vspec); return info; } void free_version_feature_info(DDCA_Version_Feature_Info * info) { // be careful, may be called from client if (info && memcmp(info->marker, VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER, 4) == 0) { info->marker[3] = 'x'; // Only need to free pointers to values that were allocated when creating // this struct, not those that are pointers into permanent data structures. // info->desc, info->name, info->sl values point into VCP_Feature_Table_Entry // TODO: Address case of synthetic VCP_Feature_Table_Entry free(info); } } #ifdef OLD DDCA_Version_Feature_Info * get_version_specific_feature_info( DDCA_Vcp_Feature_Code feature_code, bool with_default, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id) { DDCA_Version_Feature_Info* info = NULL; DDCA_MCCS_Version_Spec vspec = mccs_version_id_to_spec(mccs_version_id); VCP_Feature_Table_Entry * pentry = (with_default) ? vcp_find_feature_by_hexid_w_default(feature_code) : vcp_find_feature_by_hexid(feature_code); if (pentry) info = extract_version_feature_info(pentry, vspec, /*version_sensitive=*/false); if (pentry->vcp_global_flags & DDCA_SYNTHETIC) free_synthetic_vcp_entry(pentry); return info; } DDCA_Version_Feature_Info * get_version_sensitive_feature_info( DDCA_Vcp_Feature_Code feature_code, bool with_default, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id) { DDCA_Version_Feature_Info* info = NULL; DDCA_MCCS_Version_Spec vspec = mccs_version_id_to_spec(mccs_version_id); VCP_Feature_Table_Entry * pentry = (with_default) ? vcp_find_feature_by_hexid_w_default(feature_code) : vcp_find_feature_by_hexid(feature_code); if (pentry) info = extract_version_feature_info(pentry, vspec, /*version_sensitive=*/ true); if (pentry->vcp_global_flags & DDCA_SYNTHETIC) free_synthetic_vcp_entry(pentry); return info; } #endif /** Gets information about a VCP feature. * * @param feature_code * @param mccs_version_id * @param with_default if feature code not recognized, return dummy information, * otherwise return NULL * @param version_sensitive * * @retval pointer to DDCA_Version_Feature_Info * @retval NULL if feature not found and with_default == false */ DDCA_Version_Feature_Info * get_version_feature_info( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Id mccs_version_id, bool with_default, bool version_sensitive) { bool debug = false; DBGMSF(debug, "feature_code=0x%02x, mccs_version_id=%d(%s), with_default=%s, version_sensitive=%s", feature_code, mccs_version_id, vcp_version_id_name(mccs_version_id), bool_repr(with_default), bool_repr(version_sensitive)); DDCA_Version_Feature_Info* info = NULL; DDCA_MCCS_Version_Spec vspec = mccs_version_id_to_spec(mccs_version_id); VCP_Feature_Table_Entry * pentry = (with_default) ? vcp_find_feature_by_hexid_w_default(feature_code) : vcp_find_feature_by_hexid(feature_code); if (pentry) { info = extract_version_feature_info(pentry, vspec, version_sensitive); if (pentry->vcp_global_flags & DDCA_SYNTHETIC) free_synthetic_vcp_entry(pentry); } return info; } // // Functions that return a function for formatting a feature value // // Functions that lookup a value contained in a VCP_Feature_Table_Entry, // returning a default if the value is not set for that entry. Format_Normal_Feature_Detail_Function get_nontable_feature_detail_function( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { assert(vfte); bool debug = false; DBGMSF(debug, "Starting"); DDCA_Version_Feature_Flags version_specific_flags = get_version_sensitive_feature_flags(vfte, vcp_version); assert(version_specific_flags); assert(version_specific_flags & DDCA_NON_TABLE); Format_Normal_Feature_Detail_Function func = NULL; if (version_specific_flags & DDCA_STD_CONT) func = format_feature_detail_standard_continuous; else if (version_specific_flags & DDCA_SIMPLE_NC) func = format_feature_detail_sl_lookup; else if (version_specific_flags & DDCA_WO_NC) func = NULL; // but should never be called for this case else { assert(version_specific_flags & (DDCA_COMPLEX_CONT | DDCA_COMPLEX_NC)); func = vfte->nontable_formatter; assert(func); } DBGMSF(debug, "Returning: %p", func); return func; } Format_Table_Feature_Detail_Function get_table_feature_detail_function( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version) { assert(vfte); // TODO: // if VCP_V2NC_V3T, then get version id // based on version id, choose .formatter or .formatter_v3 // NO - test needs to be set in caller, this must return a Format_Feature_Detail_Function, which is not for Table Format_Table_Feature_Detail_Function func = vfte->table_formatter; if (!func) func = default_table_feature_detail_function; return func; } // Functions that apply formatting bool vcp_format_nontable_feature_detail( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version, Nontable_Vcp_Value * code_info, char * buffer, int bufsz) { bool debug = false; DBGMSF(debug, "Starting. Code=0x%02x, vcp_version=%d.%d", vfte->code, vcp_version.major, vcp_version.minor); Format_Normal_Feature_Detail_Function ffd_func = get_nontable_feature_detail_function(vfte, vcp_version); bool ok = ffd_func(code_info, vcp_version, buffer, bufsz); return ok; } bool vcp_format_table_feature_detail( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version, Buffer * accumulated_value, char * * aformatted_data ) { Format_Table_Feature_Detail_Function ffd_func = get_table_feature_detail_function(vfte, vcp_version); bool ok = ffd_func(accumulated_value, vcp_version, aformatted_data); return ok; } /* Given a feature table entry and a raw feature value, * return a formatted string interpretation of the value. * * Arguments: * vcp_entry vcp_feature_table_entry * vcp_version monitor VCP version * valrec feature value * aformatted_data location where to return formatted string value * * Returns: * true if formatting successful, false if not * * It is the caller's responsibility to free the returned string. */ bool vcp_format_feature_detail( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version, DDCA_Single_Vcp_Value * valrec, char * * aformatted_data ) { bool debug = false; DBGMSF(debug, "Starting"); // hack to avoid having to change all of vcp_feature_code.c // Parsed_Vcp_Response * // raw_data = single_vcp_value_to_parsed_vcp_response(valrec); bool ok = true; *aformatted_data = NULL; char * formatted_data = NULL; // if (raw_data->response_type == NON_TABLE_VCP_CALL) { if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { Nontable_Vcp_Value* nontable_value = single_vcp_value_to_nontable_vcp_value(valrec); char workbuf[200]; ok = vcp_format_nontable_feature_detail( vfte, vcp_version, nontable_value, workbuf, 200); if (ok) formatted_data = strdup(workbuf); } else { // TABLE_VCP_CALL ok = vcp_format_table_feature_detail( vfte, vcp_version, buffer_new_with_value(valrec->val.t.bytes, valrec->val.t.bytect, __func__), &formatted_data); } if (ok) { *aformatted_data = formatted_data; assert(*aformatted_data); } else { if (formatted_data) free(formatted_data); assert(!*aformatted_data); } DBGMSF(debug, "Done. Returning %d, *aformatted_data=%p", ok, *aformatted_data); return ok; } // // Functions that return or destroy a VCP_Feature_Table_Entry // /* Free a dynamically created VCP_Feature_Table_Entry.. * Does nothing if the entry is in the permanently allocates * vcp_code_table. */ void free_synthetic_vcp_entry(VCP_Feature_Table_Entry * pfte) { // DBGMSG("pfte = %p", pfte); assert(memcmp(pfte->marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4) == 0); // DBGMSG("code=0x%02x", pfte->code); // report_vcp_feature_table_entry(pfte, 1); if (pfte->vcp_global_flags & DDCA_SYNTHETIC) { #ifdef NO // if synthetic, strings were not malloed DBGMSG("pfte->desc=%p", pfte->desc); DBGMSG("pfte->v20_name=%p", pfte->v20_name); DBGMSG("pfte->v21_name=%p", pfte->v21_name); DBGMSG("pfte->v30_name=%p", pfte->v30_name); DBGMSG("pfte->v22_name=%p", pfte->v22_name); if (pfte->desc) free(pfte->desc); if (pfte->v20_name) free(pfte->v20_name); if (pfte->v21_name) free(pfte->v21_name); if (pfte->v30_name) free(pfte->v30_name); if (pfte->v22_name) free(pfte->v22_name); #endif free(pfte); } } static VCP_Feature_Table_Entry * vcp_new_feature_table_entry(DDCA_Vcp_Feature_Code id) { VCP_Feature_Table_Entry* pentry = calloc(1, sizeof(VCP_Feature_Table_Entry) ); pentry->code = id; memcpy(pentry->marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4); // DBGMSG("id=0x%02x. Returning: %p", id, pentry); return pentry; } /* Returns an entry in the VCP feature table based on its index in the table. * * Arguments: * ndx table index * * Returns: * VCP_Feature_Table_Entry */ VCP_Feature_Table_Entry * vcp_get_feature_table_entry(int ndx) { // DBGMSG("ndx=%d, vcp_code_count=%d ", ndx, vcp_code_count ); assert( 0 <= ndx && ndx < vcp_feature_code_count); return &vcp_code_table[ndx]; } /* Creates a dummy VCP feature table entry for a feature code. * It is the responsibility of the caller to free this memory. * * Arguments: * id feature id * * Returns: * created VCP_Feature_Table_Entry */ VCP_Feature_Table_Entry * vcp_create_dummy_feature_for_hexid(DDCA_Vcp_Feature_Code id) { // DBGMSG("Starting. id=0x%02x", id); VCP_Feature_Table_Entry * pentry = vcp_new_feature_table_entry(id); if (id >= 0xe0) { pentry->v20_name = "Manufacturer Specific"; } else { pentry->v20_name = "Unknown feature"; } pentry->nontable_formatter = format_feature_detail_debug_continuous; pentry->v20_flags = DDCA_RW | DDCA_COMPLEX_CONT; pentry->vcp_global_flags = DDCA_SYNTHETIC; // indicates caller should free return pentry; } /* Creates a table type dummy VCP_Feature_Table_Entry for a feature code. * It is the responsibility of the caller to free this memory. * * Arguments: * id feature id * * Returns: * created VCP_Feature_Table_Entry */ VCP_Feature_Table_Entry * vcp_create_table_dummy_feature_for_hexid(DDCA_Vcp_Feature_Code id) { VCP_Feature_Table_Entry * pentry = vcp_new_feature_table_entry(id); if (id >= 0xe0) { pentry->v20_name = "Manufacturer Specific"; } else { pentry->v20_name = "Unknown feature"; } pentry->table_formatter = default_table_feature_detail_function, pentry->v20_flags = DDCA_RW | DDCA_NORMAL_TABLE; pentry->vcp_global_flags = DDCA_SYNTHETIC; // indicates caller should free return pentry; } /* Returns an entry in the VCP feature table based on the hex value * of its feature code. * * Arguments: * id feature id * * Returns: * VCP_Feature_Table_Entry, NULL if not found * Note this is a pointer into the VCP feature data structures. * It should NOT be freed by the caller. */ VCP_Feature_Table_Entry * vcp_find_feature_by_hexid(DDCA_Vcp_Feature_Code id) { // DBGMSG("Starting. id=0x%02x ", id ); int ndx = 0; VCP_Feature_Table_Entry * result = NULL; for (;ndx < vcp_feature_code_count; ndx++) { if (id == vcp_code_table[ndx].code) { result = &vcp_code_table[ndx]; break; } } // DBGMSG("Done. ndx=%d. returning %p", ndx, result); return result; } /* Returns an entry in the VCP feature table based on the hex value * of its feature code. If the entry is not found, a synthetic entry * is generated. It is the responsibility of the caller to free this * entry. * * Arguments: * id feature id * * Returns: * VCP_Feature_Table_Entry */ VCP_Feature_Table_Entry * vcp_find_feature_by_hexid_w_default(DDCA_Vcp_Feature_Code id) { // DBGMSG("Starting. id=0x%02x ", id ); VCP_Feature_Table_Entry * result = vcp_find_feature_by_hexid(id); if (!result) result = vcp_create_dummy_feature_for_hexid(id); // DBGMSG("Done. ndx=%d. returning %p", ndx, result); return result; } //////////////////////////////////////////////////////////////////////// // // Functions to format Table values // /////////////////////////////////////////////////////////////////////// /* Value formatting function for use with table features when we don't * understand how to interpret the values. * * Arguments: * data byte buffer * vcp_version VCP Version spec * presult where to return formatted value * * Returns: * Newly allocated formatted string. It is the responsiblity of the * caller to free this string. */ bool default_table_feature_detail_function( Buffer * data, DDCA_MCCS_Version_Spec vcp_version, char ** presult) { *presult = hexstring2(data->bytes, data->len, " " /*spacer*/, false /* upper case */, NULL, 0); return true; } // // Functions applicable to multiple Table feature codes // // none so far // // Functions to format specific Table feature values // // x73 bool format_feature_detail_x73_lut_size( Buffer * data_bytes, DDCA_MCCS_Version_Spec vcp_version, char ** pformatted_result) { bool ok = true; if (data_bytes->len != 9) { DBGMSG("Expected 9 byte response. Actual response:"); hex_dump(data_bytes->bytes, data_bytes->len); ok = default_table_feature_detail_function(data_bytes, vcp_version, pformatted_result); } else { Byte * bytes = data_bytes->bytes; ushort red_entry_ct = bytes[0] << 8 | bytes[1]; ushort green_entry_ct = bytes[2] << 8 | bytes[3]; ushort blue_entry_ct = bytes[4] << 8 | bytes[5]; int red_bits_per_entry = bytes[6]; int green_bits_per_entry = bytes[7]; int blue_bits_per_entry = bytes[8]; char buf[200]; snprintf(buf, sizeof(buf), "Number of entries: %d red, %d green, %d blue, Bits per entry: %d red, %d green, %d blue", red_entry_ct, green_entry_ct, blue_entry_ct, red_bits_per_entry, green_bits_per_entry, blue_bits_per_entry); *pformatted_result = strdup(buf); } return ok; } // // Functions for interpreting non-continuous features whose values are // stored in the SL byte // /* Returns the feature value table for a feature. In a few cases, the table * is VCP version sensitive. * * Arguments: * feature_code VCP feature id * vcp_version VCP version of monitor * * Returns: * pointer to feature value table, NULL if not found */ DDCA_Feature_Value_Entry * find_feature_values( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; if (debug) DBGMSG("Starting. feature_code=0x%02x", feature_code); DDCA_Feature_Value_Entry * result = NULL; VCP_Feature_Table_Entry * pentry = vcp_find_feature_by_hexid(feature_code); // may not be found if called for capabilities and it's a mfg specific code if (pentry) { DDCA_Version_Feature_Flags feature_flags = get_version_sensitive_feature_flags(pentry, vcp_version); // if (feature_code == 0x66) // *** TEMP *** // feature_flags = DDCA_RW | VCP2_SIMPLE_NC; assert(feature_flags); if (feature_flags & DDCA_SIMPLE_NC) { result = get_version_specific_sl_values(pentry, vcp_version); } } if (debug) DBGMSG("Starting. feature_code=0x%02x. Returning: %p", feature_code, result); return result; } // hack to handle x14, where the sl values are not stored in the vcp feature table // used by CAPABILITIES command DDCA_Feature_Value_Entry * find_feature_values_for_capabilities( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Spec vcp_version) { bool debug = false; if (debug) DBGMSG("Starting. feature_code=0x%02x", feature_code); // ugh .. need to know the version number here // for now just assume vcp version < 3, return the table for v2 DDCA_Feature_Value_Entry * result = NULL; if (feature_code == 0x14) { if (vcp_version.major < 3) result = x14_color_preset_absolute_values; else { SEVEREMSG("Unimplemented: x14 lookup when vcp version >= 3"); } } else { // returns NULL if feature_code not found, which would be the case, e.g., for a // manufacturer specific code result = find_feature_values(feature_code, vcp_version); } if (debug) DBGMSG("Starting. feature_code=0x%02x. Returning: %p", feature_code, result); return result; } /* Given a hex value to be interpreted and an array of value table entries, * return the explanation string for value. * * Arguments: * value_entries array of Feature_Value_Entry * value_id value to look up * * Returns: * explanation string from the Feature_Value_Entry found, * NULL if not found */ char * get_feature_value_name(DDCA_Feature_Value_Entry * value_entries, Byte value_id) { // DBGMSG("Starting. pvalues_for_feature=%p, value_id=0x%02x", pvalues_for_feature, value_id); char * result = NULL; DDCA_Feature_Value_Entry * cur_value = value_entries; while (cur_value->value_name != NULL) { // DBGMSG("value_code=0x%02x, value_name = %s", cur_value->value_code, cur_value->value_name); if (cur_value->value_code == value_id) { result = cur_value->value_name; // DBGMSG("Found"); break; } cur_value++; } return result; } /* Given the ids for a feature code and a SL byte value, * return the explanation string for value. * * The VCP version is also passed, given that for a few * features the version 3 values are not a strict superset * of the version 2 values. * * Arguments: * feature_code VCP feature code * vcp_version VCP version * value_id value to look up * * Returns: * explanation string, or "Invalid value" if value_id not found */ char * lookup_value_name( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Spec vcp_version, Byte sl_value) { DDCA_Feature_Value_Entry * values_for_feature = find_feature_values(feature_code, vcp_version); assert(values_for_feature); char * name = get_feature_value_name(values_for_feature, sl_value); if (!name) name = "Invalid value"; return name; } //////////////////////////////////////////////////////////////////////// // // Functions to format Non-Table values // /////////////////////////////////////////////////////////////////////// // // Value formatting functions for use with non-table features when we don't // understand how to interpret the values for a feature. // // used when the value is calculated using the SL and SH bytes, but we haven't // written a full interpretation function bool format_feature_detail_debug_sl_sh( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { snprintf(buffer, bufsz, "SL: 0x%02x , SH: 0x%02x", code_info->sl, code_info->sh); return true; } // For debugging features marked as Continuous // Outputs both the byte fields and calculated cur and max values bool format_feature_detail_debug_continuous( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { snprintf(buffer, bufsz, "mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x, max value = %5d, cur value = %5d", code_info->mh, code_info->ml, code_info->sh, code_info->sl, code_info->max_value, code_info->cur_value); return true; } bool format_feature_detail_debug_bytes( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { snprintf(buffer, bufsz, "mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x", code_info->mh, code_info->ml, code_info->sh, code_info->sl); return true; } // // Functions applicable to multiple non-table feature codes // // used when the value is just the SL byte, but we haven't // written a full interpretation function bool format_feature_detail_sl_byte( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { snprintf(buffer, bufsz, "Value: 0x%02x" , code_info->sl); return true; } /* Formats the value of a non-continuous feature whose value is returned in byte SL. * The names of possible values is stored in a value list in the feature table entry * for the feature. * * Arguments: * code_info parsed feature data * vcp_version VCP version * buffer buffer in which to store output * bufsz buffer size * * Returns: * true if formatting successful, false if not */ bool format_feature_detail_sl_lookup( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { char * s = lookup_value_name(code_info->vcp_code, vcp_version, code_info->sl); snprintf(buffer, bufsz,"%s (sl=0x%02x)", s, code_info->sl); return true; } /* Standard feature detail formatting function for a feature marked * as Continuous. * * Arguments: * code_info * vcp_version * buffer location where to return formatted value * bufsz size of buffer * * Returns: * true */ bool format_feature_detail_standard_continuous( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { // TODO: calculate cv, mv here from bytes int cv = code_info->cur_value; int mv = code_info->max_value; // if (msgLevel == TERSE) // printf("VCP %02X %5d\n", vcp_code, cv); // else snprintf(buffer, bufsz, "current value = %5d, max value = %5d", cv, mv); // code_info->cur_value, code_info->max_value);) return true; } /* Standard feature detail formatting function for a feature marked * as Continuous for which the Sh/Sl bytes represent an integer in * the range 0..65535 and max value is not relevant. * * Arguments: * code_info * vcp_version * buffer location where to return formatted value * bufsz size of buffer * * Returns: * true */ bool format_feature_detail_ushort( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { int cv = code_info->cur_value; snprintf(buffer, bufsz, "%5d (0x%04x)", cv, cv); return true; } // // Functions for specific non-table VCP Feature Codes // // 0x02 bool format_feature_detail_new_control_value( // 0x02 Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { char * name = NULL; switch(code_info->sl) { case 0x01: name = "No new control values"; break; case 0x02: name = "One or more new control values have been saved"; break; case 0xff: name = "No user controls are present"; break; default: name = ""; } snprintf(buffer, bufsz, "%s (0x%02x)" , name, code_info->sl); // perhaps set to false if a reserved code return true; } // 0x0b bool x0b_format_feature_detail_color_temperature_increment( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { if (code_info->cur_value == 0 || code_info->cur_value > 5000 ) snprintf(buffer, bufsz, "Invalid value: %d", code_info->cur_value); else snprintf(buffer, bufsz, "%d degree(s) Kelvin", code_info->cur_value); return true; // or should it be false if invalid value? } // 0x0c bool x0c_format_feature_detail_color_temperature_request( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { // int increments = code_info->cur_value; snprintf(buffer, bufsz, "3000 + %d * (feature 0B color temp increment) degree(s) Kelvin", code_info->cur_value); return true; } // 0x14 bool format_feature_detail_select_color_preset( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { bool debug = false; if (debug) DBGMSG("vcp_version=%d.%d", vcp_version.major, vcp_version.minor); char buf0[100]; bool ok = true; char * mh_msg = NULL; Byte mh = code_info->mh; if (mh == 0x00) mh_msg = "No tolerance specified"; else if (mh >= 0x0b) { mh_msg = "Invalid tolerance"; ok = false; } else { snprintf(buf0, 100, "Tolerance: %d%%", code_info->mh); mh_msg = buf0; } // char buf2[100]; char * sl_msg = NULL; Byte sl = code_info->sl; if (sl == 0x00 || sl >= 0xe0) { sl_msg = "Invalid SL value."; ok = false; } else if (vcp_version.major < 3 || code_info->mh == 0x00) { sl_msg = get_feature_value_name(x14_color_preset_absolute_values, code_info->sl); if (!sl_msg) { sl_msg = "Invalid SL value"; ok = false; } #ifdef OLD switch (code_info->sl) { case 0x01: sl_msg = "sRGB"; break; case 0x02: sl_msg = "Display Native"; break; case 0x03: sl_msg = "4000 K"; break; case 0x04: sl_msg = "5000 K"; break; case 0x05: sl_msg = "6500 K"; break; case 0x06: sl_msg = "7500 K"; break; case 0x07: sl_msg = "8200 K"; break; case 0x08: sl_msg = "9300 K"; break; case 0x09: sl_msg = "10000 K"; break; case 0x0a: sl_msg = "11500 K"; break; case 0x0b: sl_msg = "User 1"; break; case 0x0c: sl_msg = "User 2"; break; case 0x0d: sl_msg = "User 3"; break; default: sl_msg = "Invalid SL value"; ok = false; #endif } else { switch (code_info->sl) { case 0x01: sl_msg = "sRGB"; break; case 0x02: sl_msg = "Display Native"; break; case 0x03: sl_msg = "-4 relative warmer"; break; case 0x04: sl_msg = "-3 relative warmer"; break; case 0x05: sl_msg = "-2 relative warmer"; break; case 0x06: sl_msg = "-1 relative warmer"; break; case 0x07: sl_msg = "+1 relative cooler"; break; case 0x08: sl_msg = "+2 relative cooler"; break; case 0x09: sl_msg = "+3 relative cooler"; break; case 0x0a: sl_msg = "+4 relative cooler"; break; case 0x0b: sl_msg = "User 1"; break; case 0x0c: sl_msg = "User 2"; break; case 0x0d: sl_msg = "User 3"; break; default: sl_msg = "Invalid SL value"; ok = false; } } if (vcp_version.major < 3) { snprintf(buffer, bufsz, "Setting: %s (0x%02x)", sl_msg, sl); } else { snprintf(buffer, bufsz, "Setting: %s (0x%02x), %s (0x%02x)", sl_msg, sl, mh_msg, mh); } return ok; } // 0x62 bool format_feature_detail_audio_speaker_volume_v30( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0x62); // Continous in 2.0, 2,2, assume 2.1 is same // NC with special x00 and xff values in 3.0 assert(vcp_version.major >= 3); // leave v2 code in case logic changes if (vcp_version.major < 3) { snprintf(buffer, bufsz, "%d", code_info->sl); } else { if (code_info->sl == 0x00) snprintf(buffer, bufsz, "Fixed (default) level (0x00)" ); else if (code_info->sl == 0xff) snprintf(buffer, bufsz, "Mute (0xff)"); else snprintf(buffer, bufsz, "Volume level: %d (00x%02x)", code_info->sl, code_info->sl); } return true; } bool format_feature_detail_x8d_v22_mute_audio_blank_screen( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0x8d); assert (vcp_version.major == 2 && vcp_version.minor >= 2); // As of v2.2, SH byte contains screen blank settings DDCA_Feature_Value_Entry * sl_values = x8d_tv_audio_mute_source_values; DDCA_Feature_Value_Entry * sh_values = x8d_sh_blank_screen_values; char * sl_name = get_feature_value_name(sl_values, code_info->sl); char * sh_name = get_feature_value_name(sh_values, code_info->sh); if (!sl_name) sl_name = "Invalid value"; if (!sh_name) sh_name = "Invalid value"; snprintf(buffer, bufsz,"%s (sl=0x%02x), %s (sh=0x%02x)", sl_name, code_info->sl, sh_name, code_info->sh); return true; } // 0x8f, 0x91 bool format_feature_detail_audio_treble_bass_v30( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0x8f || code_info->vcp_code == 0x91); // Continous in 2.0, assume 2.1 same as 2.0, // NC with reserved x00 and special xff values in 3.0, 2.2 // This function should not be called if VCP2_STD_CONT assert ( vcp_version_gt(vcp_version, VCP_SPEC_V21) ); // leave v2 code in in case things change bool ok = true; if ( vcp_version_le(vcp_version, VCP_SPEC_V21)) { snprintf(buffer, bufsz, "%d", code_info->sl); } else { if (code_info->sl == 0x00) { snprintf(buffer, bufsz, "Invalid value: 0x00" ); ok = false; } else if (code_info->sl < 0x80) snprintf(buffer, bufsz, "%d: Decreased (0x%02x, neutral - %d)", code_info->sl, code_info->sl, 0x80 - code_info->sl); else if (code_info->sl == 0x80) snprintf(buffer, bufsz, "%d: Neutral (0x%02x)", code_info->sl, code_info->sl); else snprintf(buffer, bufsz, "%d: Increased (0x%02x, neutral + %d)", code_info->sl, code_info->sl, code_info->sl - 0x80); } return ok; } // 0x93 bool format_feature_detail_audio_balance_v30( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0x93); // Continous in 2.0, NC in 3.0, 2.2, assume 2.1 same as 2.0 // NC with reserved x00 and special xff values in 3.0, // This function should not be called if VCP2_STD_CONT assert ( vcp_version_gt(vcp_version, VCP_SPEC_V21) ); // leave v2 code in in case things change bool ok = true; if ( vcp_version_le(vcp_version, VCP_SPEC_V21)) { snprintf(buffer, bufsz, "%d", code_info->sl); } else { if (code_info->sl == 0x00) { snprintf(buffer, bufsz, "Invalid value: 0x00" ); ok = false; } else if (code_info->sl < 0x80) snprintf(buffer, bufsz, "%d: Left channel dominates (0x%02x, centered - %d)", code_info->sl, code_info->sl, 0x80-code_info->sl); else if (code_info->sl == 0x80) snprintf(buffer, bufsz, "%d: Centered (0x%02x)", code_info->sl, code_info->sl); else snprintf(buffer, bufsz, "%d Right channel dominates (0x%02x, centered + %d)", code_info->sl, code_info->sl, code_info->sl-0x80); } return ok; } // 0xac bool format_feature_detail_xac_horizontal_frequency( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0xac); // this is R/O field, so max value is irrelevant if (code_info->mh == 0xff && code_info->ml == 0xff && code_info->sh == 0xff && code_info->sl == 0xff) { snprintf(buffer, bufsz, "Cannot determine frequency or out of range"); } else { // this is R/O field, so max value is irrelevant // int khz = code_info->cur_value/1000; // int dec = code_info->cur_value % 1000; // snprintf(buffer, bufsz, "%d.%03d Khz", khz, dec); snprintf(buffer, bufsz, "%d hz", code_info->cur_value); } return true; } // This function implements the MCCS interpretation in MCCS 2.0 and 3.0. // However, the Dell U3011 returns a "nominal" value of 50 and a max // value of 100. Therefore, this function is not used. Instead, the // 6-axis hue values are interpreted as standard continuous values. // 0x9b..0xa0 bool format_feature_detail_6_axis_hue( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { Byte vcp_code = code_info->vcp_code; Byte sl = code_info->sl; assert (0x9b <= vcp_code && vcp_code <= 0xa0); struct Names { Byte id; char * hue_name; char * more_name; char * less_name; }; struct Names names[] = { {0x9b, "red", "yellow", "magenta"}, {0x9c, "yellow", "green", "red"}, {0x9d, "green", "cyan", "yellow"}, {0x9e, "cyan", "blue", "green"}, {0x9f, "blue", "magenta", "cyan"}, {0xa0, "magenta", "red", "blue"}, }; struct Names curnames = names[vcp_code-0x9b]; if (sl < 0x7f) snprintf(buffer, bufsz, "%d: Shift towards %s (0x%02x, nominal-%d)", sl, curnames.less_name, sl, 0x7f-sl); else if (sl == 0x7f) snprintf(buffer, bufsz, "%d: Nominal (default) value (0x%02x)", sl, sl); else snprintf(buffer, bufsz, "%d Shift towards %s (0x%02x, nominal+%d)", sl, curnames.more_name, sl, sl-0x7f); return true; } // 0xae bool format_feature_detail_xae_vertical_frequency( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0xae); if (code_info->mh == 0xff && code_info->ml == 0xff && code_info->sh == 0xff && code_info->sl == 0xff) { snprintf(buffer, bufsz, "Cannot determine frequency or out of range"); } else { // this is R/O field, so max value is irrelevant // code_info->cur_value; // vert frequency, in .01 hz int hz = code_info->cur_value/100; int dec = code_info->cur_value % 100; snprintf(buffer, bufsz, "%d.%02d hz", hz, dec); } return true; } // 0xbe bool format_feature_detail_xbe_link_control( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { // test bit 0 // but in MCCS spec is bit 0 the high order bit or the low order bit?, // i.e. 0x80 or 0x01? // since spec refers to "Bits 7..1 reserved", implies that 0 is least // significant bit char * s = (code_info->sl & 0x01) ? "enabled" : "disabled"; snprintf(buffer, bufsz, "Link shutdown is %s (0x%02x)", s, code_info->sl); return true; } // 0xc0 bool format_feature_detail_xc0_display_usage_time( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0xc0); uint usage_time; // DBGMSG("vcp_version=%d.%d", vcp_version.major, vcp_version.minor); // TODO: Control with Output_Level // v2 spec says this is a 2 byte value, says nothing about mh, ml if (vcp_version.major >= 3) { if (code_info->mh != 0x00) { SEVEREMSG("Data error. Mh byte = 0x%02x, should be 0x00 for display usage time", code_info->mh ); } usage_time = (code_info->ml << 16) | (code_info->sh << 8) | (code_info->sl); } else usage_time = (code_info->sh << 8) | (code_info->sl); snprintf(buffer, bufsz, "Usage time (hours) = %d (0x%06x) mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x", usage_time, usage_time, code_info->mh, code_info->ml, code_info->sh, code_info->sl); return true; } // 0xc6 bool format_feature_detail_application_enable_key( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0xc6); snprintf(buffer, bufsz, "0x%02x%02x", code_info->sh, code_info->sl); return true; } // 0xc8 bool format_feature_detail_display_controller_type( Nontable_Vcp_Value * info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert(info->vcp_code == 0xc8); bool ok = true; Byte mfg_id = info->sl; char *sl_msg = NULL; sl_msg = get_feature_value_name(xc8_display_controller_type_values, info->sl); if (!sl_msg) { sl_msg = "Invalid SL value"; ok = false; } // ushort controller_number = info->ml << 8 | info->sh; // spec is inconsistent, controller number can either be ML/SH or MH/ML // observation suggests it's ml and sh snprintf(buffer, bufsz, "Mfg: %s (sl=0x%02x), controller number: mh=0x%02x, ml=0x%02x, sh=0x%02x", sl_msg, mfg_id, info->mh, info->ml, info->sh); return ok; } // xc9, xdf bool format_feature_detail_version( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { int version_number = code_info->sh; int revision_number = code_info->sl; snprintf(buffer, bufsz, "%d.%d", version_number, revision_number); return true; } // 0xce bool format_feature_detail_xce_aux_display_size( Nontable_Vcp_Value * code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz) { assert (code_info->vcp_code == 0xce); int rows = (code_info->sl & 0xc0) >> 6; int chars_per_row = code_info->sl & 0x3f; snprintf(buffer, bufsz, "Rows=%d, characters/row=%d (sl=0x%02x)", rows, chars_per_row, code_info->sl); return true; } ///////////////////////////////////////////////////////////////////////// // // Feature_Value_Entry tables (SL byte value lookup) // Used for Simple NC features // ///////////////////////////////////////////////////////////////////////// // {0x00,NULL} is the end of list marker. 0x00 might be a valid value, but NULL never is // 0x02 static DDCA_Feature_Value_Entry x02_new_control_values[] = { // values identical in 2.0, 3.0, 2.2 specs {0x01, "No new control values"}, {0x02, "One or more new control values have been saved"}, {0xff, "No user controls are present"}, {0x00, NULL} }; static DDCA_Feature_Value_Entry x03_soft_controls_values[] = { // values identical in 2.0, 3.0, 2.2 specs {0x00, "No button active"}, {0x01, "Button 1 active"}, {0x02, "Button 2 active"}, {0x03, "Button 3 active"}, {0x04, "Button 4 active"}, {0x05, "Button 5 active"}, {0x06, "Button 6 active"}, {0x07, "Button 7 active"}, {0xff, "No user controls are present"}, {0x00, NULL} }; // 0x14 static DDCA_Feature_Value_Entry x14_color_preset_absolute_values[] = { {0x01, "sRGB"}, {0x02, "Display Native"}, {0x03, "4000 K"}, {0x04, "5000 K"}, {0x05, "6500 K"}, {0x06, "7500 K"}, {0x07, "8200 K"}, {0x08, "9300 K"}, {0x09, "10000 K"}, {0x0a, "11500 K"}, {0x0b, "User 1"}, {0x0c, "User 2"}, {0x0d, "User 3"}, {0x00, NULL} // end of list marker }; // 0x1e, 0x1f static DDCA_Feature_Value_Entry x1e_x1f_auto_setup_values[] = { {0x00, "Auto setup not active"}, {0x01, "Performing auto setup"}, // end of values for 0x1e, v2.0 {0x02, "Enable continuous/periodic auto setup"}, {0x00, NULL} // end of list marker }; // 0x60: These are MCCS V2 values. In V3, x60 is type table. // see also EloView Remote Mgt Local Cmd Set document DDCA_Feature_Value_Entry x60_v2_input_source_values[] = { {0x01, "VGA-1"}, // aka Analog video (R/G/B) 1 {0x02, "VGA-2"}, {0x03, "DVI-1"}, {0x04, "DVI-2"}, {0x05, "Composite video 1"}, {0x06, "Composite video 2"}, {0x07, "S-Video-1"}, {0x08, "S-Video-2"}, {0x09, "Tuner-1"}, {0x0a, "Tuner-2"}, {0x0b, "Tuner-3"}, {0x0c, "Component video (YPrPb/YCrCb) 1"}, {0x0d, "Component video (YPrPb/YCrCb) 2"}, {0x0e, "Component video (YPrPb/YCrCb) 3"}, // end of v2.0 values // remaining values in v2.2 spec, assume also valid for v2.1 {0x0f, "DisplayPort-1"}, {0x10, "DisplayPort-2"}, {0x11, "HDMI-1"}, {0x12, "HDMI-2"}, {0x00, NULL} }; // 0x63 DDCA_Feature_Value_Entry x63_speaker_select_values[] = { {0x00, "Front L/R"}, {0x01, "Side L/R"}, {0x02, "Rear L/R"}, {0x03, "Center/Subwoofer"}, {0x00, NULL} }; // 0x66 DDCA_Feature_Value_Entry x66_ambient_light_sensor_values[] = { {0x01, "Disabled"}, {0x02, "Enabled"}, {0x00, NULL} }; // 0x82: Horizontal Mirror DDCA_Feature_Value_Entry x82_horizontal_flip_values[] = { {0x00, "Normal mode"}, {0x01, "Mirrored horizontally mode"}, {0x00, NULL} }; // 0x84: Horizontal Mirror DDCA_Feature_Value_Entry x84_vertical_flip_values[] = { {0x00, "Normal mode"}, {0x01, "Mirrored vertically mode"}, {0x00, NULL} }; // 0x8b DDCA_Feature_Value_Entry x8b_tv_channel_values[] = { {0x01, "Increment channel"}, {0x02, "Decrement channel"}, {0x00, NULL} }; // 0x8d: Audio Mute static DDCA_Feature_Value_Entry x8d_tv_audio_mute_source_values[] = { {0x01, "Mute the audio"}, {0x02, "Unmute the audio"}, {0x00, NULL} }; // 0x8d: SH byte values only apply in v2.2 static DDCA_Feature_Value_Entry x8d_sh_blank_screen_values[] = { {0x01, "Blank the screen"}, {0x02, "Unblank the screen"}, {0x00, NULL} }; // 0x86: Display Scaling DDCA_Feature_Value_Entry x86_display_scaling_values[] = { {0x01, "No scaling"}, {0x02, "Max image, no aspect ration distortion"}, {0x03, "Max vertical image, no aspect ratio distortion"}, {0x04, "Max horizontal image, no aspect ratio distortion"}, // v 2.0 spec values end here {0x05, "Max vertical image with aspect ratio distortion"}, {0x06, "Max horizontal image with aspect ratio distortion"}, {0x07, "Linear expansion (compression) on horizontal axis"}, // Full mode {0x08, "Linear expansion (compression) on h and v axes"}, // Zoom mode {0x09, "Squeeze mode"}, {0x0a, "Non-linear expansion"}, // Variable {0x00, NULL} }; // 0x87: Sharpness algorithm - used only for v2.0 DDCA_Feature_Value_Entry x87_sharpness_values[] = { {0x01, "Filter function 1"}, {0x02, "Filter function 2"}, {0x03, "Filter function 3"}, {0x04, "Filter function 4"}, {0x00, NULL} }; // 0x94 DDCA_Feature_Value_Entry x94_audio_stereo_mode_values[] = { {0x00, "Speaker off/Audio not supported"}, {0x01, "Mono"}, {0x02, "Stereo"}, {0x03, "Stereo expanded"}, // end of v20 values // 3.0 values: {0x11, "SRS 2.0"}, {0x12, "SRS 2.1"}, {0x13, "SRS 3.1"}, {0x14, "SRS 4.1"}, {0x15, "SRS 5.1"}, {0x16, "SRS 6.1"}, {0x17, "SRS 7.1"}, {0x21, "Dolby 2.0"}, {0x22, "Dolby 2.1"}, {0x23, "Dolby 3.1"}, {0x24, "Dolby 4.1"}, {0x25, "Dolby 5.1"}, {0x26, "Dolby 6.1"}, {0x27, "Dolby 7.1"}, {0x31, "THX 2.0"}, {0x32, "THX 2.1"}, {0x33, "THX 3.1"}, {0x34, "THX 4.1"}, {0x35, "THX 5.1"}, {0x36, "THX 6.1"}, {0x37, "THX 7.1"}, // end of v3.0 values {0x00, NULL} }; // 0x99 DDCA_Feature_Value_Entry x99_window_control_values[] = { {0x00, "No effect"}, {0x01, "Off"}, {0x02, "On"}, {0x00, NULL} }; // 0xa2 DDCA_Feature_Value_Entry xa2_auto_setup_values[] = { {0x01, "Off"}, {0x02, "On"}, {0x00, NULL} }; // 0xa5 static DDCA_Feature_Value_Entry xa5_window_select_values[] = { {0x00, "Full display image area selected except active windows"}, {0x01, "Window 1 selected"}, {0x02, "Window 2 selected"}, {0x03, "Window 3 selected"}, {0x04, "Window 4 selected"}, {0x05, "Window 5 selected"}, {0x06, "Window 6 selected"}, {0x07, "Window 7 selected"}, {0xff, NULL} // terminator }; // 0xaa static DDCA_Feature_Value_Entry xaa_screen_orientation_values[] = { {0x01, "0 degrees"}, {0x02, "90 degrees"}, {0x03, "180 degrees"}, {0x04, "270 degrees"}, {0xff, "Display cannot supply orientation"}, {0xff, NULL} // terminator }; // 0xb0 static DDCA_Feature_Value_Entry xb0_settings_values[] = { {0x01, "Store current settings in the monitor"}, {0x02, "Restore factory defaults for current mode"}, {0x00, NULL} // termination entry }; // 0xb2 static DDCA_Feature_Value_Entry xb2_flat_panel_subpixel_layout_values[] = { {0x00, "Sub-pixel layout not defined"}, {0x01, "Red/Green/Blue vertical stripe"}, {0x02, "Red/Green/Blue horizontal stripe"}, {0x03, "Blue/Green/Red vertical stripe"}, {0x04, "Blue/Green/Red horizontal stripe"}, {0x05, "Quad pixel, red at top left"}, {0x06, "Quad pixel, red at bottom left"}, {0x07, "Delta (triad)"}, {0x08, "Mosaic"}, // end of v2.0 values {0xff, NULL} // terminator }; // 0xb6 static DDCA_Feature_Value_Entry xb6_v20_display_technology_type_values[] = { { 0x01, "CRT (shadow mask)"}, { 0x02, "CRT (aperture grill)"}, { 0x03, "LCD (active matrix)"}, // TFT in 2.0 { 0x04, "LCos"}, { 0x05, "Plasma"}, { 0x06, "OLED"}, { 0x07, "EL"}, { 0x08, "MEM"}, // MEM in 2.0 {0xff, NULL} // terminator }; // 0xb6 static DDCA_Feature_Value_Entry xb6_display_technology_type_values[] = { { 0x01, "CRT (shadow mask)"}, { 0x02, "CRT (aperture grill)"}, { 0x03, "LCD (active matrix)"}, // TFT in 2.0 { 0x04, "LCos"}, { 0x05, "Plasma"}, { 0x06, "OLED"}, { 0x07, "EL"}, { 0x08, "Dynamic MEM"}, // MEM in 2.0 { 0x09, "Static MEM"}, // not in 2.0 {0xff, NULL} // terminator }; // 0xc8 DDCA_Feature_Value_Entry xc8_display_controller_type_values[] = { {0x01, "Conexant"}, {0x02, "Genesis"}, {0x03, "Macronix"}, {0x04, "IDT"}, // was MRT, 2.2a and 3.0 update have IDT {0x05, "Mstar"}, {0x06, "Myson"}, {0x07, "Phillips"}, {0x08, "PixelWorks"}, {0x09, "RealTek"}, {0x0a, "Sage"}, {0x0b, "Silicon Image"}, {0x0c, "SmartASIC"}, {0x0d, "STMicroelectronics"}, {0x0e, "Topro"}, {0x0f, "Trumpion"}, {0x10, "Welltrend"}, {0x11, "Samsung"}, {0x12, "Novatek"}, {0x13, "STK"}, {0x14, "Silicon Optics"}, // added in 3.0 Update Document 3/20/2007 // end of MCCS 3.0 values, beginning of values added in 2.2: {0x15, "Texas Instruments"}, {0x16, "Analogix"}, {0x17, "Quantum Data"}, {0x18, "NXP Semiconductors"}, {0x19, "Chrontel"}, {0x1a, "Parade Technologies"}, {0x1b, "THine Electronics"}, {0x1c, "Trident"}, {0x1d, "Micros"}, // end of values added in MCCS 2.2 {0xff, "Not defined - a manufacturer designed controller"}, {0xff, NULL} // terminator }; DDCA_Feature_Value_Entry * pxc8_display_controller_type_values = xc8_display_controller_type_values; // 0xca static DDCA_Feature_Value_Entry xca_osd_values[] = { {0x01, "OSD Disabled"}, {0x02, "OSD Enabled"}, {0xff, "Display cannot supply this information"}, {0xff, NULL} // terminator }; // 0xcc // Note in v2.2 spec: // Typo in Version 2.1. 10h should read 0Ah. If a parser // encounters a display with MCCS v2.1 using 10h it should // auto-correct to 0Ah. static DDCA_Feature_Value_Entry xcc_osd_language_values[] = { {0x00, "Reserved value, must be ignored"}, {0x01, "Chinese (traditional, Hantai)"}, {0x02, "English"}, {0x03, "French"}, {0x04, "German"}, {0x05, "Italian"}, {0x06, "Japanese"}, {0x07, "Korean"}, {0x08, "Portuguese (Portugal)"}, {0x09, "Russian"}, {0x0a, "Spanish"}, // end of MCCS v2.0 values {0x0b, "Swedish"}, {0x0c, "Turkish"}, {0x0d, "Chinese (simplified / Kantai)"}, {0x0e, "Portuguese (Brazil)"}, {0x0f, "Arabic"}, {0x10, "Bulgarian "}, {0x11, "Croatian"}, {0x12, "Czech"}, {0x13, "Danish"}, {0x14, "Dutch"}, {0x15, "Estonian"}, {0x16, "Finish"}, {0x17, "Greek"}, {0x18, "Hebrew"}, {0x19, "Hindi"}, {0x1a, "Hungarian"}, {0x1b, "Latvian"}, {0x1c, "Lithuanian"}, {0x1d, "Norwegian "}, {0x1e, "Polish"}, {0x1f, "Romanian "}, {0x20, "Serbian"}, {0x21, "Slovak"}, {0x22, "Slovenian"}, {0x23, "Thai"}, {0x24, "Ukranian"}, {0x25, "Vietnamese"}, {0x00, NULL} // end of list marker }; // TODO: consolidate with x60_v2_input_source_values // 0xd0: These are MCCS V2 values. need to check V3 DDCA_Feature_Value_Entry xd0_v2_output_select_values[] = { {0x01, "Analog video (R/G/B) 1"}, {0x02, "Analog video (R/G/B) 2"}, {0x03, "Digital video (TDMS) 1"}, {0x04, "Digital video (TDMS) 22"}, {0x05, "Composite video 1"}, {0x06, "Composite video 2"}, {0x07, "S-Video-1"}, {0x08, "S-Video-2"}, {0x09, "Tuner-1"}, {0x0a, "Tuner-2"}, {0x0b, "Tuner-3"}, {0x0c, "Component video (YPrPb/YCrCb) 1"}, {0x0d, "Component video (YPrPb/YCrCb) 2"}, {0x0e, "Component video (YPrPb/YCrCb) 3"}, // end of v2.0 values // remaining values in v2.2 spec, assume also valid for v2.1 // TODO: CHECK {0x0f, "DisplayPort-1"}, {0x10, "DisplayPort-2"}, {0x11, "HDMI-1"}, {0x12, "HDMI-2"}, {0x00, NULL} }; // 0xd6 static DDCA_Feature_Value_Entry xd6_power_mode_values[] = { {0x01, "DPM: On, DPMS: Off"}, {0x02, "DPM: Off, DPMS: Standby"}, {0x03, "DPM: Off, DPMS: Suspend"}, {0x04, "DPM: Off, DPMS: Off" }, {0x05, "Write only value to turn off display"}, {0x00, NULL} // termination entry }; // 0xd7 static DDCA_Feature_Value_Entry xd7_aux_power_output_values[] = { {0x01, "Disable auxiliary power"}, {0x02, "Enable Auxiliary power"}, {0x00, NULL} // termination entry }; // 0xda static DDCA_Feature_Value_Entry xda_scan_mode_values[] = { {0x00, "Normal operation"}, {0x01, "Underscan"}, {0x02, "Overscan"}, {0x03, "Widescreen" }, // in 2.0 spec, not in 3.0 {0x00, NULL} // termination entry }; // 0xdb static DDCA_Feature_Value_Entry xdb_image_mode_values[] = { {0x00, "No effect"}, {0x01, "Full mode"}, {0x02, "Zoom mode"}, {0x03, "Squeeze mode" }, {0x04, "Variable"}, {0x00, NULL} // termination entry }; static DDCA_Feature_Value_Entry xdc_display_application_values[] = { {0x00, "Standard/Default mode"}, {0x01, "Productivity"}, {0x02, "Mixed"}, {0x03, "Movie"}, {0x04, "User defined"}, {0x05, "Games"}, {0x06, "Sports"}, {0x07, "Professional (all signal processing disabled)"}, {0x08, "Standard/Default mode with intermediate power consumption"}, {0x09, "Standard/Default mode with low power consumption"}, {0x0a, "Demonstration"}, {0xf0, "Dynamic contrast"}, {0xff, NULL} // terminator }; #pragma GCC diagnostic push // not suppressing warning, why?, but removing static does avoid warning #pragma GCC diagnostic ignored "-Wunused-variable" // 0xde // write-only feature DDCA_Feature_Value_Entry xde_wo_operation_mode_values[] = { {0x01, "Stand alone"}, {0x02, "Slave (full PC control)"}, {0x00, NULL} // termination entry }; #pragma GCC diagnostic pop //////////////////////////////////////////////////////////////////////// // // Virtual Control Panel (VCP) Feature Code Master Table // //////////////////////////////////////////////////////////////////////// //TODO: // In 2.0 spec, only the first letter of the first word of a name is capitalized // In 3.0/2.2, the first letter of each word of a name is capitalized // Need to make this consistent throughout the table VCP_Feature_Table_Entry vcp_code_table[] = { { .code=0x01, // defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_MISC, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Causes a CRT to perform a degauss cycle", .v20_flags = DDCA_WO |DDCA_WO_NC, .v20_name = "Degauss", }, { .code=0x02, .vcp_spec_groups = VCP_SPEC_MISC, // defined in 2.0, identical in 3.0, 2.2 .nontable_formatter = format_feature_detail_new_control_value, // ?? .default_sl_values = x02_new_control_values, .desc = "Indicates that a display user control (other than power) has been " "used to change and save (or autosave) a new value.", .v20_flags = DDCA_RW | DDCA_COMPLEX_NC, .v20_name = "New control value", }, { .code=0x03, // defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_MISC, .default_sl_values = x03_soft_controls_values, .desc = "Allows display controls to be used as soft keys", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Soft controls", }, { .code=0x04, // Defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_PRESET, .desc = "Restore all factor presets including brightness/contrast, " "geometry, color, and TV defaults.", .vcp_subsets = VCP_SUBSET_COLOR, // but note WO .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Restore factory defaults", }, { .code=0x05, // Defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_PRESET, .vcp_subsets = VCP_SUBSET_COLOR, // but note WO .desc = "Restore factory defaults for brightness and contrast", .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Restore factory brightness/contrast defaults", }, { .code=0x06, // Defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_PRESET, .desc = "Restore factory defaults for geometry adjustments", .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Restore factory geometry defaults", }, { .code=0x08, // Defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_PRESET, .vcp_subsets = VCP_SUBSET_COLOR, // but note WO .desc = "Restore factory defaults for color settings.", .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Restore color defaults", }, { .code=0x0A, // Defined in 2.0, identical in 3.0 .vcp_spec_groups = VCP_SPEC_PRESET, .vcp_subsets = VCP_SUBSET_TV, .desc = "Restore factory defaults for TV functions.", .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Restore factory TV defaults", }, { .code=0x0b, .vcp_spec_groups = VCP_SPEC_IMAGE, // Defined in 2.0 .nontable_formatter=x0b_format_feature_detail_color_temperature_increment, // from 2.0 spec: // .desc="Allows the display to specify the minimum increment in which it can " // "adjust the color temperature.", // simpler: .desc="Color temperature increment used by feature 0Ch Color Temperature Request", .vcp_subsets = VCP_SUBSET_COLOR, .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .v20_name="Color temperature increment", }, { .code=0x0c, //.name="Color temperature request", .vcp_spec_groups = VCP_SPEC_IMAGE, // Defined in 2.0 .nontable_formatter=x0c_format_feature_detail_color_temperature_request, .desc="Specifies a color temperature (degrees Kelvin)", // my desc .vcp_subsets = VCP_SUBSET_COLOR, .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .v20_name="Color temperature request", }, { .code=0x0e, // Defined in 2.0 .vcp_spec_groups = VCP_SPEC_IMAGE, .desc="Increase/decrease the sampling clock frequency.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Clock", }, { .code=0x10, .vcp_spec_groups = VCP_SPEC_IMAGE, // Defined in 2.0, name changed in 3.0, what is it in 2.1? //.name="Luminosity", .desc="Increase/decrease the brightness of the image.", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Brightness", .v30_name = "Luminosity", }, { .code=0x11, // not in 2.0, is in 3.0, assume introduced in 2.1 .vcp_spec_groups = VCP_SPEC_IMAGE, .nontable_formatter=format_feature_detail_debug_bytes, .desc = "Select contrast enhancement algorithm respecting flesh tone region", .vcp_subsets = VCP_SUBSET_COLOR, .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, .v21_name = "Flesh tone enhancement", }, { .code=0x12, .vcp_spec_groups = VCP_SPEC_IMAGE, // Defined in 2.0, identical in 3.0 .desc="Increase/decrease the contrast of the image.", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Contrast", }, { .code=0x13, .vcp_spec_groups = VCP_SPEC_IMAGE, // not in 2.0, is in 3.0, assume first defined in 2.1 // deprecated in 2.2 .nontable_formatter=format_feature_detail_debug_bytes, .desc = "Increase/decrease the specified backlight control value", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v21_flags = DDCA_RW | DDCA_COMPLEX_CONT, .v21_name = "Backlight control", .v22_flags = DDCA_DEPRECATED, }, { .code=0x14, .vcp_spec_groups = VCP_SPEC_IMAGE, // Defined in 2.0, different in 3.0, 2.2 // what is appropriate choice for 2.1 ? // interpretation varies depending on VCP version .nontable_formatter=format_feature_detail_select_color_preset, .default_sl_values= x14_color_preset_absolute_values, .desc="Select a specified color temperature", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Select color preset", .v30_flags = DDCA_RW | DDCA_COMPLEX_NC, .v22_flags = DDCA_RW | DDCA_COMPLEX_NC, }, { .code=0x16, .vcp_spec_groups = VCP_SPEC_IMAGE, .desc="Increase/decrease the luminesence of red pixels", // my simplification .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Video gain: Red", }, { .code=0x17, .vcp_spec_groups = VCP_SPEC_IMAGE, // not in 2.0, is in 3.0 and 2.2, assume valid for 2.1 .desc="Increase/decrease the degree of compensation", // my simplification .vcp_subsets = VCP_SUBSET_COLOR, .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "User color vision compensation", }, { .code=0x18, .vcp_spec_groups = VCP_SPEC_IMAGE, .desc="Increase/decrease the luminesence of green pixels", // my simplification .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Video gain: Green", }, { .code=0x1a, .vcp_spec_groups = VCP_SPEC_IMAGE, .desc="Increase/decrease the luminesence of blue pixels", // my simplification .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Video gain: Blue", }, { .code=0x1c, .vcp_spec_groups = VCP_SPEC_IMAGE, // defined in 2.0, identical in 3.0 .desc="Increase/decrease the focus of the image", // my simplification .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Focus", }, { .code=0x1e, // Done .vcp_spec_groups = VCP_SPEC_IMAGE, // 2.0, 3.0, 2.2 // Defined in 2.0, additional value in 3.0, 2.2 .default_sl_values = x1e_x1f_auto_setup_values, .desc="Perform autosetup function (H/V position, clock, clock phase, " "A/D converter, etc.", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Auto setup", }, { .code=0x1f, // Done // not defined in 2.0, is defined in 3.0, 2.2, assume introduced in 2.1 .vcp_spec_groups = VCP_SPEC_IMAGE, // 3.0 .default_sl_values = x1e_x1f_auto_setup_values, .desc="Perform color autosetup function (R/G/B gain and offset, A/D setup, etc. ", .vcp_subsets = VCP_SUBSET_COLOR, .v21_flags = DDCA_RW | DDCA_SIMPLE_NC, .v21_name = "Auto color setup", }, { .code=0x20, // Done // Group 8.4 Geometry, identical in 2.0, 3.0, 2.2 except for name // When did name change to include "(phase)"? Assuming 2.1 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value moves the image toward " "the right (left) of the display.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Position", .v21_name="Horizontal Position (Phase)", }, { .code=0x22, // Done // Group 8.4 Geometry, identical in 2.0, 3.0, 2.2 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increase/decrease the width of the image.", .v20_name="Horizontal Size", .v20_flags = DDCA_RW | DDCA_STD_CONT, }, { .code=0x24, // Done // Group 8.4 Geometry, identical in 2.0, 3.0, 2.2 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value causes the right and left " "sides of the image to become more (less) convex.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Pincushion", }, { .code=0x26, // Done // Group 8.4 Geometry, identical in 2.0, 3.0, 2.2 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value moves the center section " "of the image toward the right (left) side of the display.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Pincushion Balance", }, { .code=0x28, // Done // Group 8.4 Geometry, name changed in 3.0 & 2.2 vs 2.0 what should it be for 2.1? // assume it changed in 2.1 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // description identical in 3.0, 2.0 even though name changed .desc = "Increasing (decreasing) this value shifts the red pixels to " "the right (left) and the blue pixels left (right) across the " "image with respect to the green pixels.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Convergence", .v21_name="Horizontal Convergence R/B", }, { .code=0x29, // Done // not in 2.0, when was this added? 2.1 or 3.0? assuming 2.1 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value shifts the magenta pixels to " "the right (left) and the green pixels left (right) across the " "image with respect to the magenta (sic) pixels.", .v21_name="Horizontal Convergence M/G", .v21_flags=DDCA_RW | DDCA_STD_CONT, }, { .code = 0x2a, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry, identical in 3.0, 2.2 .desc = "Increase/decrease the density of pixels in the image center.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Linearity", }, { .code = 0x2c, // Done // Group 8.4 Geometry .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value shifts the density of pixels " "from the left (right) side to the right (left) side of the image.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Horizontal Linearity Balance", }, { .code=0x2e, .vcp_spec_groups = VCP_SPEC_IMAGE, // not defined in 2.0, is defined in 3.0 // assume new in 2.1 .vcp_subsets = VCP_SUBSET_COLOR, .nontable_formatter=format_feature_detail_debug_bytes, .desc = "Gray Scale Expansion", .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, .v21_name = "Gray scale expansion", }, { .code=0x30, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value moves the image toward " "the top (bottom) edge of the display.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Vertical Position", .v21_name="Vertical Position (Phase)", }, { .code=0x32, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry. Did name change with 2.1 or 3.0/2.2? - assuming 2.1 .desc = "Increase/decreasing the height of the image.", .v20_flags=DDCA_RW | DDCA_STD_CONT, .v20_name="Vertical Size", }, { .code=0x34, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry. Identical in 2.0, 3.0, 2.2 .desc = "Increasing (decreasing) this value will cause the top and " "bottom edges of the image to become more (less) convex.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Vertical Pincushion", }, { .code=0x36, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, .desc = "Increasing (decreasing) this value will move the center " "section of the image toward the top (bottom) edge of the display.", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Vertical Pincushion Balance", }, { .code=0x38, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry. Assume name changed with 2.1 .desc = "Increasing (decreasing) this value shifts the red pixels up (down) " "across the image and the blue pixels down (up) across the image " "with respect to the green pixels.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Vertical Convergence", .v21_name="Vertical Convergence R/B", }, { .code=0x39, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry. Not in 2.0. Assume added in 2.1 .desc = "Increasing (decreasing) this value shifts the magenta pixels up (down) " "across the image and the green pixels down (up) across the image " "with respect to the magenta (sic) pixels.", .v21_name="Vertical Convergence M/G", .v21_flags= DDCA_RW | DDCA_STD_CONT, }, { .code=0x3a, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry .desc = "Increase/decease the density of scan lines in the image center.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name = "Vertical Linearity", }, { .code=0x3c, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry .desc = "Increase/decrease the density of scan lines in the image center.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name = "Vertical Linearity Balance", }, { .code=0x3e, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_MISC, // 2.0: MISC // Defined in 2.0, identical in 3.0 .desc="Increase/decrease the sampling clock phase shift", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Clock phase", }, { .code=0x40, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // When did name change from 2.0? assume 2.1 //.name="Horizontal Parallelogram", .desc = "Increasing (decreasing) this value shifts the top section of " "the image to the right (left) with respect to the bottom section " "of the image.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Key Balance", // 2.0 .v21_name="Horizontal Parallelogram", }, { .code=0x41, .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // not defined in 2.0, assume defined in 2.1 // 3.0 doc has same description for x41 as x40, is this right? // 2.2 spec has the same identical description in x41 and x40 .desc = "Increasing (decreasing) this value shifts the top section of " "the image to the right (left) with respect to the bottom section " "of the image. (sic)", .v21_flags= DDCA_RW | DDCA_STD_CONT, .v21_name="Vertical Parallelogram", }, { .code=0x42, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // When did name change from 2.0? assume 2.1 .desc = "Increasing (decreasing) this value will increase (decrease) the " "ratio between the horizontal size at the top of the image and the " "horizontal size at the bottom of the image.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Trapezoid", .v21_name="Horizontal Keystone", // ?? }, { .code=0x43, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry // When did name change from 2.0? assume 2.1 .desc = "Increasing (decreasing) this value will increase (decrease) the " "ratio between the vertical size at the left of the image and the " "vertical size at the right of the image.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Vertical Trapezoid", .v21_name="Vertical Keystone", // ?? }, { .code=0x44, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry // When did name change from 2.0? assume 2.1 .desc = "Increasing (decreasing) this value rotates the image (counter) " "clockwise around the center point of the screen.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Tilt (rotation)", .v21_name="Rotation", // ?? }, { .code=0x46, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry // When did name change from 2.0? assume 2.1 .desc = "Increase/decrease the distance between the left and right sides " "at the top of the image.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Top Corner", .v21_name="Top Corner Flare", // ?? }, { .code=0x48, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // name is different in 3.0, assume changed in 2.1 //.name="Placeholder", //.flags=VCP_RW | VCP_CONTINUOUS, // .nontable_formatter=format_feature_detail_standard_continuous, .desc = "Increasing (decreasing) this value moves the top of the " "image to the right (left).", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Top Corner Balance", .v21_name="Top Corner Hook", }, { .code=0x4a, //Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // Group 8.4 Geometry // When did name change from 2.0? assume 2.1 .desc = "Increase/decrease the distance between the left " "and right sides at the bottom of the image.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Bottom Corner", .v21_name="Bottom Corner Flare", // ?? }, { .code=0x4c, // Done .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // name is different in 3.0, assume changed in 2.1 .desc = "Increasing (decreasing) this value moves the bottom end of the " "image to the right (left).", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Bottom Corner Balance", .v21_name="Bottom Corner Hook", }, // code 0x4e: // what is going on with 0x4e? // In 2.0 spec, the cross ref lists it as Trapezoid, in Table Geometry // However, the Geometry table lists 7E as Trapezoid // In 3.0 and 2.2, neither 4E or 7E are defined // code: 0x50 // listed as Keystone, table GEOMETRY in 2.0 // But Geometry table lists 0x80 as being keystone, not 0x4e // In 3.0 and 2.2, neither x50 nor x80 are defined { .code=0x52, .vcp_spec_groups = VCP_SPEC_MISC, // defined in 2.0, 3.0 has extended consistent explanation .nontable_formatter = format_feature_detail_sl_byte, // TODO: write proper function .desc= "Read id of one feature that has changed, 0x00 indicates no more", // my desc .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .v20_name = "Active control", }, { .code= 0x54, .vcp_spec_groups = VCP_SPEC_MISC, // not defined in 2.0, defined in 3.0, 2.2 identical to 3.0, assume new in 2.1 .nontable_formatter=format_feature_detail_debug_bytes, // TODO: write formatter .desc = "Controls features aimed at preserving display performance", .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, .v21_name = "Performance Preservation", }, { .code=0x56, .vcp_spec_groups = VCP_SPEC_IMAGE, // defined in 2.0 //.name="Horizontal Moire", //.flags=VCP_RW | VCP_CONTINUOUS, // .nontable_formatter=format_feature_detail_standard_continuous, .desc="Increase/decrease horizontal moire cancellation.", // my simplification //.global_flags = VCP_RW, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Horizontal Moire", }, { .code=0x58, .vcp_spec_groups = VCP_SPEC_IMAGE, // defined in 2.0 .desc="Increase/decrease vertical moire cancellation.", // my simplification .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name="Vertical Moire", }, { .code=0x59, // DONE .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, // not in 2.0, defined in 3.0, assume new as of 2.1 .nontable_formatter=format_feature_detail_sl_byte, // Per spec, values range from x00..xff // On U3011 monitor, values range from 0..100, returned max value is 100 // Change the .desc to fit observed reality // Same comments apply to other saturation codes //.desc = "Value < 127 decreases red saturation, 127 nominal (default) value, " // "> 127 increases red saturation", .desc="Increase/decrease red saturation", .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "6 axis saturation: Red", }, { .code=0x5a, // DONE .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, // not in 2.0, defined in 3.0, assume new as of 2.1 .nontable_formatter=format_feature_detail_sl_byte, // .desc = "Value < 127 decreases yellow saturation, 127 nominal (default) value, " // "> 127 increases yellow saturation", .desc="Increase/decrease yellow saturation", .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "6 axis saturation: Yellow", }, { .code=0x5b, // DONE .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, // not in 2.0, defined in 3.0, assume new as of 2.1 .nontable_formatter=format_feature_detail_sl_byte, // .desc = "Value < 127 decreases green saturation, 127 nominal (default) value, " // "> 127 increases green saturation", .desc="Increase/decrease green saturation", .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "6 axis saturation: Green", }, { .code=0x5c, // DONE .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, // not in 2.0, defined in 3.0, assume new as of 2.1 .nontable_formatter=format_feature_detail_sl_byte, // .desc = "Value < 127 decreases cyan saturation, 127 nominal (default) value, " // "> 127 increases cyan saturation", .desc="Increase/decrease cyan saturation", .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "6 axis saturation: Cyan", }, { .code=0x5d, // DONE .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, // not in 2.0, defined in 3.0, assume new as of 2.1 .nontable_formatter=format_feature_detail_sl_byte, // .desc = "Value < 127 decreases blue saturation, 127 nominal (default) value, " // "> 127 increases blue saturation", .desc="Increase/decrease blue saturation", .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "6 axis saturation: Blue", }, { .code=0x5e, // DONE .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, // not in 2.0, defined in 3.0, assume new as of 2.1 .nontable_formatter=format_feature_detail_sl_byte, // .desc = "Value < 127 decreases magenta saturation, 127 nominal (default) value, " // "> 127 increases magenta saturation", .desc="Increase/decrease magenta saturation", .v21_flags = DDCA_RW | DDCA_STD_CONT, .v21_name = "6 axis saturation: Magenta", }, { .code=0x60, .vcp_spec_groups = VCP_SPEC_MISC, // MCCS 2.0, 2.2: NC, MCCS 3.0: T .default_sl_values = x60_v2_input_source_values, // used for all but v3.0 .desc = "Selects active video source", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Input Source", .v30_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v22_flags = DDCA_RW | DDCA_SIMPLE_NC }, { .code=0x62, .vcp_spec_groups = VCP_SPEC_AUDIO, .vcp_subsets = VCP_SUBSET_AUDIO, // is in 2.0, special coding as of 3.0 assume changed as of 3.0 // .nontable_formatter=format_feature_detail_standard_continuous, .nontable_formatter=format_feature_detail_audio_speaker_volume_v30, // requires special handling for V3, mix of C and NC, SL byte only .desc = "Adjusts speaker volume", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v30_flags = DDCA_RW | DDCA_COMPLEX_CONT, .v22_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Audio speaker volume", }, { .code=0x63, .vcp_spec_groups = VCP_SPEC_AUDIO, // not in 2.0, is in 3.0, assume new as of 2.1 .vcp_subsets = VCP_SUBSET_AUDIO, .desc="Selects a group of speakers", .v21_flags = DDCA_RW | DDCA_SIMPLE_NC, .default_sl_values = x63_speaker_select_values, .v21_name = "Speaker Select", }, { .code=0x64, .vcp_spec_groups = VCP_SPEC_AUDIO, // is in 2.0, n. unlike x62, this code is identically defined in 2.0, 30 .vcp_subsets = VCP_SUBSET_AUDIO, .desc = "Increase/decrease microphone gain", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Audio: Microphone Volume", }, { .code=0x66, .vcp_spec_groups = VCP_SPEC_MISC, // not in 2.0, assume new in 2.1 // however, seen on NEC PA241W, which reports VCP version as 2.0 .nontable_formatter=format_feature_detail_debug_bytes, .desc = "Enable/Disable ambient light sensor", .v21_flags = DDCA_RW | DDCA_SIMPLE_NC, .v21_name = "Ambient light sensor", .default_sl_values = x66_ambient_light_sensor_values, }, { .code=0x6b, // First defined in MCCS 2.2, .vcp_spec_groups=VCP_SPEC_IMAGE, .desc="Increase/decrease the white backlight level", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v22_name = "Backlight Level: White", .v22_flags = DDCA_RW | DDCA_STD_CONT, }, { .code=0x6c, .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // Defined in 2.0, name change in ? //.name="Video black level: Red", // .nontable_formatter=format_feature_detail_standard_continuous, .desc="Increase/decrease the black level of red pixels", // my simplification .v20_flags = DDCA_RW |DDCA_STD_CONT, .v20_name = "Video black level: Red", }, { .code=0x6d, // First defined in MCCS 2.2, .vcp_spec_groups=VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .desc="Increase/decrease the red backlight level", .v22_name = "Backlight Level: Red", .v22_flags = DDCA_RW | DDCA_STD_CONT, }, { .code=0x6e, .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // Defined in 2.0, name change in ? .desc="Increase/decrease the black level of green pixels", // my simplification .v20_flags = DDCA_RW |DDCA_STD_CONT, .v20_name = "Video black level: Green", }, { .code=0x6f, // First defined in MCCS 2.2, .vcp_spec_groups=VCP_SPEC_IMAGE, .desc="Increase/decrease the green backlight level", // .nontable_formatter=format_feature_detail_standard_continuous, .v22_name = "Backlight Level: Green", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v22_flags = DDCA_RW | DDCA_STD_CONT, }, { .code=0x70, .vcp_spec_groups = VCP_SPEC_IMAGE, // Defined in 2.0, name change in ? .desc="Increase/decrease the black level of blue pixels", // my simplification .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v20_flags = DDCA_RW |DDCA_STD_CONT, .v20_name = "Video black level: Blue", }, { .code=0x71, // First defined in MCCS 2.2, .vcp_spec_groups=VCP_SPEC_IMAGE, .desc="Increase/decrease the blue backlight level", .v22_name = "Backlight Level: Blue", .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, .v22_flags = DDCA_RW | DDCA_STD_CONT, }, { .code=0x72, // 2.0: undefined, 3.0 & 2.2: defined, assume defined in 2.1 .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_COLOR, .desc="Select relative or absolute gamma", .nontable_formatter=format_feature_detail_debug_sl_sh, .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, // TODO implement function .v21_name = "Gamma", }, { .code=0x73, .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_LUT, // VCP_SPEC_MISC in 2.0, VCP_SPEC_IMAGE in 3.0, 2.1? 2.2 .table_formatter=format_feature_detail_x73_lut_size, .desc = "Provides the size (number of entries and number of bits/entry) " "for the Red, Green, and Blue LUT in the display.", .v20_flags = DDCA_RO| DDCA_NORMAL_TABLE, .v20_name = "LUT Size", }, { .code=0x74, // VCP_SPEC_MISC in 2.0, VCP_SPEC_IMAGE in 3.0, 2.2 .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_LUT, .table_formatter = default_table_feature_detail_function, .desc = "Writes a single point within the display's LUT, reads a single point from the LUT", .v20_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v20_name = "Single point LUT operation", }, { .code=0x75, // VCP_SPEC_MISC in 2.0, VCP_SPEC_IMAGE in 3.0, 2.2 .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_LUT, .table_formatter = default_table_feature_detail_function, .desc = "Load (read) multiple values into (from) the display's LUT", .v20_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v20_name = "Block LUT operation", }, { .code=0x76, // defined in 2.0, 3.0 .vcp_spec_groups = VCP_SPEC_MISC, .vcp_subsets = VCP_SUBSET_LUT, .desc = "Initiates a routine resident in the display", .v20_flags = DDCA_WO | DDCA_WO_TABLE, .v20_name = "Remote Procedure Call", }, { .code=0x78, .vcp_spec_groups = VCP_SPEC_MISC, // Not in 2.0 // defined in 3.0, 2.2 - name and description vary, but content identical // what to do about 2.1? assume it's defined in 2.1 and identical to 3.0 .desc = "Causes a selected 128 byte block of Display Identification Data " "(EDID or Display ID) to be read", .v21_flags = DDCA_RO | DDCA_NORMAL_TABLE, .v21_name = "EDID operation", .v30_flags = DDCA_RO | DDCA_NORMAL_TABLE, .v30_name = "EDID operation", .v22_flags = DDCA_RO | DDCA_NORMAL_TABLE, .v22_name = "Display Identification Operation", }, { .code=0x7a, .vcp_spec_groups = VCP_SPEC_IMAGE, // v2.0 // defined in 2.0, not in 3.0 or 2.2, what to do for 2.1? .desc="Increase/decrease the distance to the focal plane of the image", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Adjust Focal Plane", .v30_flags = DDCA_DEPRECATED, .v22_flags = DDCA_DEPRECATED, }, { .code=0x7c, .vcp_spec_groups = VCP_SPEC_IMAGE, // defined in 2.0, is in 3.0 // my simplification, merger of 2.0 and 3.0 descriptions: .desc="Increase/decrease the distance to the zoom function of the projection lens (optics)", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Adjust Zoom", }, { .code=0x7e, // TODO: CHECK 2.2 SPEC // Is this really a valid v2.0 code? See earlier comments // Is in V2.0 Geometry table, but not cross reference. .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // data from v2.0 spec, not in v3.0 spec // when was it deleted? v3.0 or v2.1? For safety assume 3.0 .desc = "Increase/decrease the trapezoid distortion in the image", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v30_flags=DDCA_DEPRECATED, .v22_flags=DDCA_DEPRECATED, .v20_name="Trapezoid", }, { .code=0x80, // TODO: CHECK 2.2 SPEC // The v2.0 cross ref lists 0x50 as Keystone, group Geometry // However, the Geometry table lists Keystone as x50, not x80 // Neither x50 nor x80 are defined in v3.0 .vcp_spec_groups = VCP_SPEC_GEOMETRY, .vcp_subsets = VCP_SUBSET_CRT, // in 2.0 spec, not in 3.0, or 2.2 // assume not in 2.1 .desc="Increase/decrease the keystone distortion in the image.", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Keystone", .v21_flags = DDCA_DEPRECATED, }, { .code=0x82, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_GEOMETRY, // 2.0: Image, 3.0: Geometry .default_sl_values = x82_horizontal_flip_values, .desc="Flip picture horizontally", // DESIGN ISSUE!!! // This feature is WO in 2.0 spec, RW in 3.0, what is it in 2.2 // implies cannot use global_flags to store RO/RW/WO .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "HorFlip", .v21_name = "Horizontal Mirror (Flip)", .v21_flags = DDCA_RW | DDCA_SIMPLE_NC, .v21_sl_values = x82_horizontal_flip_values, }, { .code=0x84, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_GEOMETRY, // 2.0: Image, 3.0: Geometry .default_sl_values = x84_vertical_flip_values, // DESIGN ISSUE!!! // This feature is WO in 2.0 spec, RW in 3.0, what is it in 2.2 // implies cannot use global_flags to store RO/RW/WO .desc="Flip picture vertically", .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "VertFlip", .v21_name = "Vertical Mirror (Flip)", .v21_flags = DDCA_RW | DDCA_SIMPLE_NC, .v21_sl_values = x84_vertical_flip_values, }, { .code=0x86, // Done // v2.0 spec cross ref lists as MISC, but defined in IMAGE table, assume IMAGE .vcp_spec_groups = VCP_SPEC_IMAGE, // 2.0: IMAGE //.name="DisplayScaling", //.flags = VCP_RW | VCP_NON_CONT, .default_sl_values = x86_display_scaling_values, .desc = "Control the scaling (input vs output) of the display", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Display Scaling", }, { .code=0x87, // Done .vcp_spec_groups = VCP_SPEC_IMAGE , // 2.0 IMAGE, 3.0 Image, 2.2 Image // defined in 2.0, is C in 3.0 and 2.2, assume 2.1 is C as well .default_sl_values = x87_sharpness_values, // .desc = "Specifies one of a range of algorithms", .desc = "Selects one of a range of algorithms. " "Increasing (decreasing) the value must increase (decrease) " "the edge sharpness of image features.", .v20_flags=DDCA_RW | DDCA_SIMPLE_NC, .v20_name="Sharpness", .v21_flags=DDCA_RW | DDCA_STD_CONT, }, { .code=0x88, // 2.0 cross ref lists this as IMAGE, but defined in MISC table // 2.2: Image .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_CRT, // ??? .desc = "Increase (decrease) the velocity modulation of the horizontal " "scan as a function of the change in luminescence level", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Velocity Scan Modulation", }, { .code=0x8a, .vcp_spec_groups = VCP_SPEC_IMAGE, // 2.0, 2.2, 3.0 // Name differs in 3.0 vs 2.0, assume 2.1 same as 2.0 .vcp_subsets = VCP_SUBSET_TV | VCP_SUBSET_COLOR, .desc = "Increase/decrease the amplitude of the color difference " "components of the video signal", .v20_flags =DDCA_RW | DDCA_STD_CONT, .v20_name = "TV Color Saturation", .v21_name = "Color Saturation", }, { .code=0x8b, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .vcp_subsets = VCP_SUBSET_TV, .desc = "Increment (1) or decrement (2) television channel", .v20_flags=DDCA_WO | DDCA_WO_NC, .v20_name="TV Channel Up/Down", .default_sl_values=x8b_tv_channel_values, }, { .code = 0x8c, .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_IMAGE, // 2.0: SPEC, 2.2: IMAGE .vcp_subsets = VCP_SUBSET_TV, .desc = "Increase/decrease the amplitude of the high frequency components " "of the video signal", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "TV Sharpness", }, { .code=0x8d, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 // v3.0 same as v2.0 // v2.2 adds SH byte for screen blank .vcp_subsets = VCP_SUBSET_TV | VCP_SUBSET_AUDIO, .desc = "Mute/unmute audio, and (v2.2) screen blank", .nontable_formatter=format_feature_detail_x8d_v22_mute_audio_blank_screen, .default_sl_values = x8d_tv_audio_mute_source_values, .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Audio Mute", .v22_flags = DDCA_RW | DDCA_COMPLEX_NC, .v22_name = "Audio mute/Screen blank", }, { .code=0x8e, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .vcp_subsets = VCP_SUBSET_TV, .desc = "Increase/decrease the ratio between blacks and whites in the image", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "TV Contrast", }, { .code=0x8f, .vcp_spec_groups = VCP_SPEC_AUDIO, // v2.0, 2.2, 3.0 .vcp_subsets = VCP_SUBSET_AUDIO, .desc="Emphasize/de-emphasize high frequency audio", // n. for v2.0 name in spec is "TV-audio treble". "TV" prefix is // dropped in 2.2, 3.0. just use the more generic term for all versions // similar comments apply to x91, x93 .v20_name="Audio Treble", // requires special handling for V3, mix of C and NC, SL byte only .nontable_formatter=format_feature_detail_audio_treble_bass_v30, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v30_flags = DDCA_RW | DDCA_COMPLEX_NC, .v22_flags = DDCA_RW | DDCA_COMPLEX_NC, }, { .code=0x90, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .vcp_subsets = VCP_SUBSET_TV | VCP_SUBSET_COLOR, .desc = "Increase/decrease the wavelength of the color component of the video signal. " "AKA tint. Applies to currently active interface", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "Hue", }, { .code=0x91, .vcp_spec_groups = VCP_SPEC_AUDIO, // v2.0, 2.2, 3.0 .vcp_subsets = VCP_SUBSET_AUDIO, .desc="Emphasize/de-emphasize low frequency audio", .v20_name="Audio Bass", // requires special handling for V3.0 and v2.2: mix of C and NC, SL byte only .nontable_formatter=format_feature_detail_audio_treble_bass_v30, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v30_flags = DDCA_RW | DDCA_COMPLEX_NC, .v22_flags = DDCA_RW | DDCA_COMPLEX_NC, }, { .code=0x92, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .vcp_subsets = VCP_SUBSET_TV, .desc = "Increase/decrease the black level of the video", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "TV Black level/Brightness", .v21_name = "TV Black level/Luminesence", }, { .code=0x93, .vcp_spec_groups = VCP_SPEC_AUDIO, // v2.0, 2.2, 3.0 .vcp_subsets = VCP_SUBSET_AUDIO, .desc="Controls left/right audio balance", .v20_name="Audio Balance L/R", // requires special handling for V3 and v2.2, mix of C and NC, SL byte only .nontable_formatter=format_feature_detail_audio_treble_bass_v30, .v20_flags = DDCA_RW | DDCA_STD_CONT, .v30_flags = DDCA_RW | DDCA_COMPLEX_NC, .v22_flags = DDCA_RW | DDCA_COMPLEX_NC, }, { .code=0x94, .vcp_spec_groups = VCP_SPEC_AUDIO, // v2.0 // name changed in 3.0, assume applies to 2.1 .vcp_subsets = VCP_SUBSET_TV | VCP_SUBSET_AUDIO, .desc="Select audio mode", .v20_name="Audio Stereo Mode", .v21_name="Audio Processor Mode", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .default_sl_values=x94_audio_stereo_mode_values, }, { .code=0x95, // Done .vcp_spec_groups = VCP_SPEC_WINDOW | VCP_SPEC_GEOMETRY, // 2.0: WINDOW, 3.0: GEOMETRY .vcp_subsets = VCP_SUBSET_WINDOW, .desc="Top left X pixel of an area of the image", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Window Position(TL_X)", }, { .code=0x96, // Done .vcp_spec_groups = VCP_SPEC_WINDOW | VCP_SPEC_GEOMETRY, // 2.0: WINDOW, 3.0: GEOMETRY .vcp_subsets = VCP_SUBSET_WINDOW, .desc="Top left Y pixel of an area of the image", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Window Position(TL_Y)", }, { .code=0x97, // Done .vcp_spec_groups = VCP_SPEC_WINDOW | VCP_SPEC_GEOMETRY, // 2.0: WINDOW, 3.0: GEOMETRY .vcp_subsets = VCP_SUBSET_WINDOW, .desc="Bottom right X pixel of an area of the image", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Window Position(BR_X)", }, { .code=0x98, // Done .vcp_spec_groups = VCP_SPEC_WINDOW | VCP_SPEC_GEOMETRY, // 2.0: WINDOW, 3.0: GEOMETRY .vcp_subsets = VCP_SUBSET_WINDOW, .desc="Bottom right Y pixel of an area of the image", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Window Position(BR_Y)", }, { .code=0x99, .vcp_spec_groups = VCP_SPEC_WINDOW, // 2.0: WINDOW // in 2.0, not in 3.0 or 2.2, what is correct choice for 2.1? .vcp_subsets = VCP_SUBSET_WINDOW, .default_sl_values = x99_window_control_values, .desc="Enables the brightness and color within a window to be different " "from the desktop.", .v20_flags= DDCA_RW | DDCA_SIMPLE_NC, .v20_name="Window control on/off", .v30_flags = DDCA_DEPRECATED, .v30_flags = DDCA_DEPRECATED, }, { .code=0x9a, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, // 2.0: WINDOW, 3.0, 2.2: IMAGE .vcp_subsets = VCP_SUBSET_WINDOW, // VCP_SUBSET_COLOR? // 2.2 spec notes: // 1) should be used in conjunction with VCP 99h // 2) Not recommended for new designs, see A5h for alternate .desc="Changes the contrast ratio between the area of the window and the " "rest of the desktop", .v20_flags= DDCA_RW | DDCA_STD_CONT, .v20_name="Window background", }, { .code=0x9b, // in 2.0, same in 3.0 .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, // 2.0: WINDOW, 3.0: IMAGE .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // U3011 doesn't implement the spec that puts the midpoint at 127, // Just interpret this and the other hue fields as standard continuous // .desc = "Value < 127 shifts toward magenta, 127 no effect, " // "> 127 shifts toward yellow", // .nontable_formatter=format_feature_detail_6_axis_hue, // .v20_flags =DDCA_RW | VCP2_COMPLEX_CONT, .desc = "Decrease shifts toward magenta, " "increase shifts toward yellow", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "6 axis hue control: Red", }, { .code=0x9c, // in 2.0, same in 3.0 .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, // 2.0: WINDOW, 3.0: IMAGE .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // .nontable_formatter=format_feature_detail_6_axis_hue, // .desc = "Value < 127 shifts toward green, 127 no effect, " // "> 127 shifts toward red", // .v20_flags = DDCA_RW | VCP2_COMPLEX_CONT, .desc = "Decrease shifts toward green, " "increase shifts toward red", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "6 axis hue control: Yellow", }, { .code=0x9d, // in 2.0, same in 3.0 .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, // 2.0: WINDOW, 3.0: IMAGE .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // .nontable_formatter=format_feature_detail_6_axis_hue, // .desc = "Value < 127 shifts toward yellow, 127 no effect, " // "> 127 shifts toward cyan", // .v20_flags =DDCA_RW | VCP2_COMPLEX_CONT, .desc = "Decrease shifts toward yellow, " "increase shifts toward cyan", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "6 axis hue control: Green", }, { .code=0x9e, // in 2.0, same in 3.0 .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, // 2.0: WINDOW, 3.0: IMAGE .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // .nontable_formatter=format_feature_detail_6_axis_hue, // .desc = "Value < 127 shifts toward green, 127 no effect, " // "> 127 shifts toward blue", // .v20_flags = DDCA_RW | VCP2_COMPLEX_CONT, // VCP_SUBSET_COLORMGT? .desc = "Decrease shifts toward green, " "increase shifts toward blue", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "6 axis hue control: Cyan", }, { .code=0x9f, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // .nontable_formatter=format_feature_detail_6_axis_hue, // .desc = "Value < 127 shifts toward cyan, 127 no effect, " // "> 127 shifts toward magenta", // .v20_flags =DDCA_RW | VCP2_COMPLEX_CONT, .desc = "Decrease shifts toward cyan, " "increase shifts toward magenta", .v20_flags = DDCA_RW | DDCA_STD_CONT, .v20_name = "6 axis hue control: Blue", }, { .code=0xa0, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, .vcp_subsets = VCP_SUBSET_COLOR | VCP_SUBSET_PROFILE, // .nontable_formatter=format_feature_detail_6_axis_hue, // .desc = "Value < 127 shifts toward blue, 127 no effect, " // "> 127 shifts toward red", // .v20_flags = DDCA_RW | VCP2_COMPLEX_CONT, .v20_flags = DDCA_RW | DDCA_STD_CONT, .desc = "Decrease shifts toward blue, 127 no effect, " "increase shifts toward red", .v20_name = "6 axis hue control: Magenta", }, { .code=0xa2, // Defined in 2.0, same in 3.0 .vcp_spec_groups = VCP_SPEC_IMAGE, .desc="Turn on/off an auto setup function", .default_sl_values=xa2_auto_setup_values, .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Auto setup on/off", }, { .code=0xa4, // Complex interpretation, to be implemented .vcp_spec_groups = VCP_SPEC_IMAGE, .vcp_subsets = VCP_SUBSET_WINDOW, // 2.0 spec says: "This command structure is recommended, in conjunction with VCP A5h // for all new designs" // type NC in 2.0, type T in 3.0, 2.2, what is correct choice for 2.1? //.name="Window control on/off", //.flags = VCP_RW | VCP_NON_CONT, .nontable_formatter = format_feature_detail_debug_sl_sh, // TODO: write proper function .table_formatter = default_table_feature_detail_function, // TODO: write proper function .desc = "Turn selected window operation on/off, window mask", .v20_flags = DDCA_RW | DDCA_COMPLEX_NC, .v30_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v22_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v20_name = "Turn the selected window operation on/off", .v30_name = "Window mask control", .v22_name = "Window mask control", }, { .code=0xa5, .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_WINDOW, .vcp_subsets = VCP_SUBSET_WINDOW, // 2.0 spec says: "This command structure is recommended, in conjunction with VCP A4h // for all new designs // designated as C, but only takes specific values // v3.0 appears to be identical .default_sl_values = xa5_window_select_values, .desc = "Change selected window (as defined by 95h..98h)", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Change the selected window", }, { .code=0xaa, // Done .vcp_spec_groups = VCP_SPEC_IMAGE | VCP_SPEC_GEOMETRY, // 3.0: IMAGE, 2.0: GEOMETRY .default_sl_values=xaa_screen_orientation_values, .desc="Indicates screen orientation", .v20_flags=DDCA_RO | DDCA_SIMPLE_NC, .v20_name="Screen Orientation", }, { .code=0xac, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .nontable_formatter=format_feature_detail_xac_horizontal_frequency, .desc = "Horizontal sync signal frequency as determined by the display", // 2.0: 0xff 0xff 0xff indicates the display cannot supply this info .v20_flags = DDCA_RO | DDCA_COMPLEX_CONT, .v20_name = "Horizontal frequency", }, { .code=0xae, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .nontable_formatter=format_feature_detail_xae_vertical_frequency, .desc = "Vertical sync signal frequency as determined by the display, " "in .01 hz", // 2.0: 0xff 0xff indicates the display cannot supply this info .v20_flags =DDCA_RO | DDCA_COMPLEX_CONT, .v20_name = "Vertical frequency", }, { .code=0xb0, .vcp_spec_groups = VCP_SPEC_PRESET, // Defined in 2.0, v3.0 spec clarifies that value to be set is in SL byte //.name="(Re)Store user saved values for cur mode", // this was my name from the explanation .default_sl_values = xb0_settings_values, .desc = "Store/restore the user saved values for the current mode.", .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Settings", }, { .code=0xb2, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .default_sl_values=xb2_flat_panel_subpixel_layout_values, .desc = "LCD sub-pixel structure", .v20_flags = DDCA_RO | DDCA_SIMPLE_NC, .v20_name = "Flat panel sub-pixel layout", }, { .code = 0xb4, .vcp_spec_groups = VCP_SPEC_CONTROL, // 3.0 .desc = "Indicates timing mode being sent by host", // not defined in 2.0, is defined in 3.0 and 2.2 as T // seen on U3011 which is v2.1 // should this be seen as T or NC for 2.1? // if set T for 2.1, monitor returns NULL response, which // ddcutil interprets as unsupported. // if set NC for 2.1, response looks valid, // supported opcode is set .v21_name = "Source Timing Mode", .nontable_formatter = format_feature_detail_debug_bytes, .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, .v30_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v22_flags = DDCA_RW | DDCA_NORMAL_TABLE, }, { .code=0xb6, // DONE .vcp_spec_groups = VCP_SPEC_MISC, // 2.0, 3.0 // v3.0 table not upward compatible w 2.0, assume changed as of 2.1 .desc = "Indicates the base technology type", .default_sl_values=xb6_v20_display_technology_type_values, .v21_sl_values = xb6_display_technology_type_values, .v20_flags = DDCA_RO | DDCA_SIMPLE_NC, .v20_name = "Display technology type", }, { .code=0xb7, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .desc = "Video mode and status of a DPVL capable monitor", .v20_name = "Monitor status", .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .nontable_formatter = format_feature_detail_sl_byte, //TODO: implement proper function }, { .code=0xb8, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .v20_name = "Packet count", .desc = "Counter for DPVL packets received", .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .nontable_formatter = format_feature_detail_ushort, }, { .code=0xb9, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .v20_name = "Monitor X origin", .desc = "X origin of the monitor in the vertical screen", .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .nontable_formatter = format_feature_detail_ushort, }, { .code=0xba, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .v20_name = "Monitor Y origin", .desc = "Y origin of the monitor in the vertical screen", .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .nontable_formatter = format_feature_detail_ushort, }, { .code=0xbb, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .desc = "Error counter for the DPVL header", .v20_name = "Header error count", .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .nontable_formatter = format_feature_detail_ushort, }, { .code=0xbc, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .desc = "CRC error counter for the DPVL body", .v20_name = "Body CRC error count", .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .nontable_formatter = format_feature_detail_ushort, }, { .code=0xbd, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .desc = "Assigned identification number for the monitor", .v20_name = "Client ID", .v20_flags = DDCA_RW | DDCA_COMPLEX_CONT, .nontable_formatter = format_feature_detail_ushort, }, { .code=0xbe, .vcp_spec_groups = VCP_SPEC_DPVL, .vcp_subsets = VCP_SUBSET_DPVL, .desc = "Indicates status of the DVI link", .v20_name = "Link control", .v20_flags = DDCA_RW | DDCA_COMPLEX_NC, .nontable_formatter = format_feature_detail_xbe_link_control, }, { .code=0xc0, .vcp_spec_groups = VCP_SPEC_MISC, .nontable_formatter=format_feature_detail_xc0_display_usage_time, .desc = "Active power on time in hours", .v20_flags =DDCA_RO | DDCA_COMPLEX_CONT, .v20_name = "Display usage time", }, { .code=0xc2, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .desc = "Length in bytes of non-volatile storage in the display available " "for writing a display descriptor, max 256", .v20_flags = DDCA_RO | DDCA_STD_CONT, // should there be a different flag when we know value uses only SL? // or could this value be exactly 256? .v20_name = "Display descriptor length", }, { .code=0xc3, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .table_formatter = default_table_feature_detail_function, .desc="Reads (writes) a display descriptor from (to) non-volatile storage " "in the display.", .v20_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v20_name = "Transmit display descriptor", }, { .code = 0xc4, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .nontable_formatter=format_feature_detail_debug_bytes, .desc = "If enabled, the display descriptor shall be displayed when no video " "is being received.", .v20_flags = DDCA_RW | DDCA_COMPLEX_NC, // need to handle "All other values. The display descriptor shall not be displayed" .v20_name = "Enable display of \'display descriptor\'", }, { .code=0xc6, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .nontable_formatter=format_feature_detail_application_enable_key, .desc = "A 2 byte value used to allow an application to only operate with known products.", .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .v20_name = "Application enable key", }, { .code=0xc8, .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_CONTROL, // 2.0: MISC, 3.0: CONTROL .nontable_formatter=format_feature_detail_display_controller_type, .default_sl_values=xc8_display_controller_type_values, .desc = "Mfg id of controller and 2 byte manufacturer-specific controller type", .v20_flags = DDCA_RW | DDCA_COMPLEX_NC, .v20_name = "Display controller type", }, { .code=0xc9, .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_CONTROL, // 2.: MISC, 3.0: CONTROL .nontable_formatter=format_feature_detail_version, .desc = "2 byte firmware level", .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .v20_name = "Display firmware level", }, { .code=0xca, // Says the v2.2 spec: A new feature added to V3.0 and expanded in V2.2 // BUT: xCA is present in 2.0 spec, defined identically to 3.0 spec .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_CONTROL, // 2.0: MISC, 3.0: CONTROL .default_sl_values=xca_osd_values, // .desc = "Indicates whether On Screen Display is enabled", .desc = "Sets and indicates the current operational state of OSD (and buttons in v2.2)", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "OSD", .v22_flags = DDCA_RW | DDCA_COMPLEX_NC, // for v3.0: .nontable_formatter = format_feature_detail_debug_sl_sh, // TODO: write proper function for v3.0 .v22_name = "OSD/Button Control" }, { .code=0xcc, .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_CONTROL, // 2.0: MISC, 3.0: CONTROL .default_sl_values=xcc_osd_language_values, .desc = "On Screen Display language", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "OSD Language", }, { .code=0xcd, .vcp_spec_groups = VCP_SPEC_MISC, // 3.0: MISC // not in 2.0, is in 3.0, assume exists in 2.1 .desc = "Control up to 16 LED (or similar) indicators to indicate system status", .nontable_formatter = format_feature_detail_debug_sl_sh, .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, .v21_name = "Status Indicators", }, { .code=0xce, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .desc = "Rows and characters/row of auxiliary display", .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .v20_name = "Auxiliary display size", .nontable_formatter = format_feature_detail_xce_aux_display_size, }, { .code=0xcf, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .desc = "Sets contents of auxiliary display device", .v20_flags = DDCA_WO | DDCA_WO_TABLE, .v20_name = "Auxiliary display data", }, { .code=0xd0, .vcp_spec_groups = VCP_SPEC_MISC, .desc = "Selects the active output", .v20_name = "Output select", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .default_sl_values = xd0_v2_output_select_values, .table_formatter = default_table_feature_detail_function, // TODO: implement proper function .v30_flags = DDCA_RW | DDCA_NORMAL_TABLE, .v22_flags = DDCA_RW | DDCA_SIMPLE_NC, }, { .code=0xd2, // exists in 3.0, not in 2.0, assume exists in 2.1 .vcp_spec_groups = VCP_SPEC_MISC, .desc = "Read an Asset Tag to/from the display", .v21_name = "Asset Tag", .v21_flags = DDCA_RW | DDCA_NORMAL_TABLE, .table_formatter = default_table_feature_detail_function, }, { .code=0xd4, .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_IMAGE, // 2.0: MISC, 3.0: IMAGE .desc="Stereo video mode", .v20_name = "Stereo video mode", .v20_flags = DDCA_RW | DDCA_COMPLEX_NC, .nontable_formatter = format_feature_detail_sl_byte, // TODO: implement proper function }, { .code=0xd6, // DONE .vcp_spec_groups = VCP_SPEC_MISC | VCP_SPEC_CONTROL, // 2.0: MISC, 3.0: CONTROL .default_sl_values = xd6_power_mode_values, .desc = "DPM and DPMS status", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Power mode", }, { .code=0xd7, // DONE - identical in 2.0, 3.0, 2.2 .vcp_spec_groups = VCP_SPEC_MISC, // 2.0, 3.0, 2.2 .default_sl_values = xd7_aux_power_output_values, .desc="Controls an auxiliary power output from a display to a host device", .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Auxiliary power output", }, { .code=0xda, // DONE .vcp_spec_groups = VCP_SPEC_GEOMETRY | VCP_SPEC_IMAGE, // 2.0: IMAGE, 3.0: GEOMETRY .vcp_subsets = VCP_SUBSET_CRT, .desc = "Controls scan characteristics (aka format)", .default_sl_values = xda_scan_mode_values, .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Scan format", // name differs in 3.0, assume changed as of 2.1 .v21_name = "Scan mode", }, { .code=0xdb, .vcp_spec_groups = VCP_SPEC_CONTROL, // 3.0 // defined in 3.0, not in 2.0, assume present in 2.1 .vcp_subsets = VCP_SUBSET_TV, .desc = "Controls aspects of the displayed image (TV applications)", .default_sl_values = xdb_image_mode_values, .v21_flags = DDCA_RW | DDCA_SIMPLE_NC, .v21_name = "Image Mode", }, { .code=0xdc, .vcp_spec_groups = VCP_SPEC_IMAGE, // defined in 2.0, 3.0 has different name, more values //.name="Display application", .default_sl_values=xdc_display_application_values, .desc="Type of application used on display", // my desc .v20_flags = DDCA_RW | DDCA_SIMPLE_NC, .v20_name = "Display Mode", .v30_name = "Display Application", }, { .code=0xde, // code 0xde has a completely different name and definition in v2.0 // vs v3.0/2.2 // 2.0: Operation Mode, W/O single byte value per xde_wo_operation_mode_values // 3.0, 2.2: Scratch Pad: 2 bytes of volatile storage for use of software applications // Did the definition really change so radically, or is the 2.0 spec a typo. // What to do for 2.1? Assume same as 3.0,2.2 .vcp_spec_groups = VCP_SPEC_MISC, // 2.0, 3.0, 2.2 .desc = "Operation mode (2.0) or scratch pad (3.0/2.2)", .nontable_formatter = format_feature_detail_debug_sl_sh, .v20_flags = DDCA_WO | DDCA_WO_NC, .v20_name = "Operation Mode", .v21_flags = DDCA_RW | DDCA_COMPLEX_NC, .v21_name = "Scratch Pad", }, { .code=0xdf, .vcp_spec_groups = VCP_SPEC_MISC, // 2.0 .nontable_formatter=format_feature_detail_version, .desc = "MCCS version", .v20_flags = DDCA_RO | DDCA_COMPLEX_NC, .v20_name = "VCP Version", } }; // #pragma GCC diagnostic pop int vcp_feature_code_count = sizeof(vcp_code_table)/sizeof(VCP_Feature_Table_Entry); #ifdef DEVELOPMENT_ONLY // // Functions for validating vcp_code_table[] // // Intended for use only during development // int check_one_version_flags( DDCA_Version_Feature_Flags vflags, char * which_flags, VCP_Feature_Table_Entry * pentry) { int ct = 0; if (vflags && !(vflags & DDCA_DEPRECATED)) { if (vflags & DDCA_STD_CONT) ct++; if (vflags & DDCA_COMPLEX_CONT) ct++; if (vflags & DDCA_SIMPLE_NC) ct++; if (vflags & DDCA_COMPLEX_NC) ct++; if (vflags & DDCA_WO_NC) ct++; if (vflags & DDCA_NORMAL_TABLE) ct++; if (vflags & DDCA_WO_TABLE) ct++; if (ct != 1) { fprintf( stderr, "code: 0x%02x, exactly 1 of VCP2_STD_CONT, VCP2_COMPLEX_CONT, VCP2_SIMPLE_NC, " "VCP2_COMPLEX_NC, VCP2_TABLE, VCP2_WO_TABLE must be set in %s\n", pentry->code, which_flags); ct = -1; } if (vflags & DDCA_SIMPLE_NC) { if (!pentry->default_sl_values) { fprintf( stderr, "code: 0x%02x, .flags: %s, VCP2_SIMPLE_NC set but .default_sl_values == NULL\n", pentry->code, which_flags); ct = -2; } } else if (vflags & DDCA_COMPLEX_NC) { if (!pentry->nontable_formatter) { fprintf( stderr, "code: 0x%02x, .flags: %s, VCP2_COMPLEX_NC set but .nontable_formatter == NULL\n", pentry->code, which_flags); ct = -2; } } else if (vflags & DDCA_COMPLEX_CONT) { if (!pentry->nontable_formatter) { fprintf( stderr, "code: 0x%02x, .flags: %s, VCP2_COMPLEX_CONT set but .nontable_formatter == NULL\n", pentry->code, which_flags); ct = -2; } } // // no longer an error. get_table_feature_detail_function() sets default // else if (vflags & VCP2_TABLE) { // if (!pentry->table_formatter) { // fprintf( // stderr, // "code: 0x%02x, .flags: %s, VCP2_TABLE set but .table_formatter == NULL\n", // pentry->code, which_flags); // ct = -2; // } // } } return ct; } /* If the flags has anything set, and is not deprecated, checks that * exactly 1 of DDCA_RO, DDCA_WO, DDCA_RW is set * * Returns: 1 of a value is set, 0 if no value set, -1 if * more than 1 value set */ int check_version_rw_flags( DDCA_Version_Feature_Flags vflags, char * which_flags, VCP_Feature_Table_Entry * entry) { int ct = 0; if (vflags && !(vflags & DDCA_DEPRECATED)) { if (vflags & DDCA_RO) ct++; if (vflags & DDCA_WO) ct++; if (vflags & DDCA_RW) ct++; if (ct != 1) { fprintf(stderr, "code: 0x%02x, exactly 1 of DDCA_RO, DDCA_WO, DDCA_RW must be set in non-zero %s_flags\n", entry->code, which_flags); ct = -1; } } return ct; } void validate_vcp_feature_table() { bool debug = false; DBGMSF(debug, "Starting"); bool ok = true; bool ok2 = true; int ndx = 0; // return; // *** TEMP *** int total_ct = 0; for (;ndx < vcp_feature_code_count;ndx++) { VCP_Feature_Table_Entry * pentry = &vcp_code_table[ndx]; int cur_ct; cur_ct = check_version_rw_flags(pentry->v20_flags, "v20_flags", pentry); if (cur_ct < 0) ok = false; else total_ct += cur_ct; cur_ct = check_version_rw_flags(pentry->v21_flags, "v21_flags", pentry); if (cur_ct < 0) ok = false; else total_ct += cur_ct; cur_ct = check_version_rw_flags(pentry->v30_flags, "v30_flags", pentry); if (cur_ct < 0) ok = false; else total_ct += cur_ct; cur_ct = check_version_rw_flags(pentry->v22_flags, "v22_flags", pentry); if (cur_ct < 0) ok = false; else total_ct += cur_ct; if (ok && total_ct == 0) { fprintf(stderr, "RW, RO, RW not set in any version specific flags for feature 0x%02x\n", pentry->code); ok = false; } total_ct = 0; cur_ct = check_one_version_flags(pentry->v20_flags, ".v20_flags", pentry); if (cur_ct < 0) ok2 = false; else total_ct += 1; cur_ct = check_one_version_flags(pentry->v21_flags, ".v21_flags", pentry); if (cur_ct < 0) ok2 = false; else total_ct += 1; cur_ct = check_one_version_flags(pentry->v30_flags, ".v30_flags", pentry); if (cur_ct < 0) ok2 = false; else total_ct += 1; cur_ct = check_one_version_flags(pentry->v22_flags, ".v22_flags", pentry); if (cur_ct < 0) ok2 = false; else total_ct += 1; if (total_ct == 0 && ok2) { fprintf(stderr, "code: 0x%02x, Type not specified in any vnn_flags\n", pentry->code); ok2 = false; } } if (!(ok && ok2)) // assert(false); PROGRAM_LOGIC_ERROR(NULL); } // End of functions for validating vcp_code_table #endif /* Initialize the vcp_feature_codes module. * Must be called before any other function. */ void init_vcp_feature_codes() { #ifdef DEVELOPMENT_ONLY validate_vcp_feature_table(); // enable for development #endif for (int ndx=0; ndx < vcp_feature_code_count; ndx++) { memcpy( vcp_code_table[ndx].marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4); } } ddcutil-0.8.6/src/vcp/vcp_feature_set.c0000644000175000001440000002466713226776100015016 00000000000000/* vcp_feature_set.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include "util/report_util.h" #include "base/core.h" #include "vcp/vcp_feature_set.h" #define VCP_FEATURE_SET_MARKER "FSET" struct vcp_feature_set { char marker[4]; VCP_Feature_Subset subset; GPtrArray * members; }; /* Free only synthetic VCP_Feature_Table_Entrys, * not ones in the permanent data structure. */ void free_transient_vcp_entry(gpointer ptr) { // DBGMSG("Starting. ptr=%p", ptr); assert(ptr); VCP_Feature_Table_Entry * pfte = (VCP_Feature_Table_Entry *) ptr; // DBGMSG("pfte=%p, marker = %.4s %s", pfte, pfte->marker, hexstring(pfte->marker,4)); assert(memcmp(pfte->marker, VCP_FEATURE_TABLE_ENTRY_MARKER, 4) == 0); if (pfte->vcp_global_flags & DDCA_SYNTHETIC) { free_synthetic_vcp_entry(pfte); } } void free_vcp_feature_set(VCP_Feature_Set fset) { if (fset) { struct vcp_feature_set * pset = (struct vcp_feature_set *) fset; assert( memcmp(pset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); if (pset->members) { g_ptr_array_set_free_func(pset->members, free_transient_vcp_entry); g_ptr_array_free(pset->members, true); } free(pset); } } VCP_Feature_Set create_feature_set(VCP_Feature_Subset subset_id, DDCA_MCCS_Version_Spec vcp_version) { assert(subset_id); bool debug = true; DBGMSF(debug, "Starting. subset_id=%s(0x%04x), vcp_version=%d.%d", feature_subset_name(subset_id), subset_id, vcp_version.major, vcp_version.minor); struct vcp_feature_set * fset = calloc(1,sizeof(struct vcp_feature_set)); memcpy(fset->marker, VCP_FEATURE_SET_MARKER, 4); fset->subset = subset_id; fset->members = g_ptr_array_sized_new(30); if (subset_id == VCP_SUBSET_SCAN || subset_id == VCP_SUBSET_MFG) { int ndx = 0; if (subset_id == VCP_SUBSET_MFG) ndx = 0xe0; for (; ndx < 256; ndx++) { Byte id = ndx; // DBGMSF(debug, "examining id 0x%02x", id); // n. this is a pointer into permanent data structures, should not be freed: VCP_Feature_Table_Entry* vcp_entry = vcp_find_feature_by_hexid(id); // original code looks at VCP2_READABLE, output level if (vcp_entry) { if ( !is_feature_table_by_vcp_version(vcp_entry, vcp_version) || get_output_level() >= DDCA_OL_VERBOSE) g_ptr_array_add(fset->members, vcp_entry); } else { g_ptr_array_add(fset->members, vcp_create_dummy_feature_for_hexid(id)); if (ndx >= 0xe0 && (get_output_level() >= DDCA_OL_VERBOSE) ) { // for manufacturer specific features, probe as both table and non-table // Only probe table if --verbose, output is confusing otherwise g_ptr_array_add(fset->members, vcp_create_table_dummy_feature_for_hexid(id)); } } } } else { int known_feature_ct = vcp_get_feature_code_count(); int ndx = 0; for (ndx=0; ndx < known_feature_ct; ndx++) { VCP_Feature_Table_Entry * vcp_entry = vcp_get_feature_table_entry(ndx); assert(vcp_entry); DDCA_Version_Feature_Flags vflags = 0; bool showit = false; switch(subset_id) { case VCP_SUBSET_PRESET: showit = vcp_entry->vcp_spec_groups & VCP_SPEC_PRESET; break; case VCP_SUBSET_TABLE: vflags = get_version_specific_feature_flags(vcp_entry, vcp_version); showit = vflags & DDCA_TABLE; break; case VCP_SUBSET_KNOWN: case VCP_SUBSET_ALL: case VCP_SUBSET_SUPPORTED: showit = true; break; case VCP_SUBSET_COLOR: case VCP_SUBSET_PROFILE: case VCP_SUBSET_LUT: case VCP_SUBSET_TV: case VCP_SUBSET_AUDIO: case VCP_SUBSET_WINDOW: case VCP_SUBSET_DPVL: case VCP_SUBSET_CRT: showit = vcp_entry->vcp_subsets & subset_id; break; case VCP_SUBSET_SCAN: // will never happen, inserted to avoid compiler warning case VCP_SUBSET_MFG: case VCP_SUBSET_SINGLE_FEATURE: case VCP_SUBSET_NONE: break; } if (showit) { g_ptr_array_add(fset->members, vcp_entry); } } } return fset; } VCP_Feature_Set create_single_feature_set_by_vcp_entry(VCP_Feature_Table_Entry * vcp_entry) { struct vcp_feature_set * fset = calloc(1,sizeof(struct vcp_feature_set)); memcpy(fset->marker, VCP_FEATURE_SET_MARKER, 4); fset->members = g_ptr_array_sized_new(1); fset->subset = VCP_SUBSET_SINGLE_FEATURE; g_ptr_array_add(fset->members, vcp_entry); return fset; } /* Creates a VCP_Feature_Set for a single VCP code * * Arguments: * id feature id * force indicates behavior if feature id not found in vcp_feature_table, * if true, creates a feature set using a dummy feature table entry * if false, returns NULL * * Returns: feature set containing a single feature * NULL if the feature not found and force not specified */ VCP_Feature_Set create_single_feature_set_by_hexid(Byte id, bool force) { struct vcp_feature_set * fset = NULL; VCP_Feature_Table_Entry* vcp_entry = NULL; if (force) vcp_entry = vcp_find_feature_by_hexid_w_default(id); else vcp_entry = vcp_find_feature_by_hexid(id); if (vcp_entry) fset = create_single_feature_set_by_vcp_entry(vcp_entry); return fset; } /* Creates a VCP_Feature_Set from an external feature specification * * Arguments: * fsref external feature set descriptor * force indicates behavior in the case of a single feature code * if the feature id is not found in vcp_feature_table, * if true, creates a feature set using a dummy feature table entry * if false, returns NULL * * Returns: feature set containing a single feature * NULL if the feature not found and force not specified */ VCP_Feature_Set create_feature_set_from_feature_set_ref( Feature_Set_Ref * fsref, DDCA_MCCS_Version_Spec vcp_version, bool force) { struct vcp_feature_set * fset = NULL; if (fsref->subset == VCP_SUBSET_SINGLE_FEATURE) fset = create_single_feature_set_by_hexid(fsref->specific_feature, force); else fset = create_feature_set(fsref->subset, vcp_version); return fset; } VCP_Feature_Set create_single_feature_set_by_charid(Byte id, bool force) { // TODO: copy and modify existing code: return NULL; } static inline struct vcp_feature_set * unopaque_feature_set( VCP_Feature_Set feature_set) { struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); return fset; } void free_feature_set(VCP_Feature_Set feature_set) { struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); int ndx = 0; // free all generated members for (; ndx < fset->members->len; ndx++) { VCP_Feature_Table_Entry * vcp_entry = NULL; vcp_entry = g_ptr_array_index(fset->members,ndx); if (vcp_entry->vcp_global_flags & DDCA_SYNTHETIC) { // free_vcp_feature_table_entry(vcp_entry); // UNIMPLEMENTED } } fset->marker[3] = 'x'; free(fset); } VCP_Feature_Table_Entry * get_feature_set_entry( VCP_Feature_Set feature_set, unsigned index) { struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); VCP_Feature_Table_Entry * ventry = NULL; if (index >= 0 || index < fset->members->len) ventry = g_ptr_array_index(fset->members,index); return ventry; } int get_feature_set_size(VCP_Feature_Set feature_set) { struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); return fset->members->len; } VCP_Feature_Subset get_feature_set_subset_id(VCP_Feature_Set feature_set) { struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); return fset->subset; } void report_feature_set(VCP_Feature_Set feature_set, int depth) { struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); int ndx = 0; for (; ndx < fset->members->len; ndx++) { VCP_Feature_Table_Entry * vcp_entry = NULL; vcp_entry = g_ptr_array_index(fset->members,ndx); rpt_vstring(depth, "VCP code: %02X: %s", vcp_entry->code, get_non_version_specific_feature_name(vcp_entry) ); } } void filter_feature_set(VCP_Feature_Set feature_set, VCP_Feature_Set_Filter_Func func) { bool debug = false; struct vcp_feature_set * fset = (struct vcp_feature_set *) feature_set; assert( fset && memcmp(fset->marker, VCP_FEATURE_SET_MARKER, 4) == 0); for (int ndx = fset->members->len -1; ndx >= 0; ndx--) { VCP_Feature_Table_Entry * vcp_entry = NULL; vcp_entry = g_ptr_array_index(fset->members,ndx); if (!func(vcp_entry)) { DBGMSF(debug, "Removing entry"); // memory leak? g_ptr_array_remove_index(fset->members, ndx); if (vcp_entry->vcp_global_flags & DDCA_SYNTHETIC) { free_synthetic_vcp_entry(vcp_entry); } } } } ddcutil-0.8.6/src/vcp/vcp_feature_values.c0000644000175000001440000003226613223460523015510 00000000000000/* vcp_feature_values.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include "util/data_structures.h" #include "util/report_util.h" #include "util/string_util.h" #include "base/ddc_packets.h" #include "vcp/vcp_feature_values.h" char * vcp_value_type_name(DDCA_Vcp_Value_Type value_type) { char * result = NULL; switch (value_type) { case DDCA_NON_TABLE_VCP_VALUE: result = "Non Table"; break; case DDCA_TABLE_VCP_VALUE: result = "Table"; break; } return result; } char * ddca_vcp_value_type_name(DDCA_Vcp_Value_Type value_type) { char * result = ""; switch(value_type) { case DDCA_NON_TABLE_VCP_VALUE: result = "DDCA_NON_TABLE_VCP_VALUE"; break; case DDCA_TABLE_VCP_VALUE: result = "DDCA_TABLE_VCP_VALUE"; break; default: result = "invalid value"; } return result; } // TODO: MERGE dbgrpt_ddca_single_vcp_value(), report_single_vcp_value() void dbgrpt_ddca_single_vcp_value( DDCA_Single_Vcp_Value * valrec, int depth) { int d1 = depth + 1; int d2 = depth + 2; rpt_vstring(depth, "DDCA_Single_Vcp_Value at %p:", valrec); if (valrec) { rpt_vstring(d1, "Opcode: 0x%02x", valrec->opcode); rpt_vstring(d1, "Value type %d - %s", valrec->value_type, ddca_vcp_value_type_name(valrec->value_type)); if (valrec->value_type == DDCA_TABLE_VCP_VALUE) { rpt_vstring(d1, "Bytes:"); rpt_hex_dump(valrec->val.t.bytes, valrec->val.t.bytect, d2); } else if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { #ifdef WORDS_BIGENDIAN rpt_label (d1, "Struct is big-endian"); #else rpt_label (d1, "Struct is little-endian"); #endif rpt_vstring(d1, "max_val: %d - 0x%04x", valrec->val.c.max_val, valrec->val.c.max_val); rpt_vstring(d1, "cur_val: %d - 0x%04x", valrec->val.c.cur_val, valrec->val.c.cur_val); rpt_vstring(d1, "mh: 0x%02x", valrec->val.nc.mh); rpt_vstring(d1, "ml: 0x%02x", valrec->val.nc.ml); rpt_vstring(d1, "sh: 0x%02x", valrec->val.nc.sh); rpt_vstring(d1, "sl: 0x%02x", valrec->val.nc.sl); } } } void report_single_vcp_value(DDCA_Single_Vcp_Value * valrec, int depth) { int d1 = depth+1; rpt_vstring(depth, "Single_Vcp_Value at %p:", valrec); rpt_vstring(d1, "opcode=0x%02x, value_type=%s (0x%02x)", valrec->opcode, vcp_value_type_name(valrec->value_type), valrec->value_type); if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { rpt_vstring(d1, "mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x", valrec->val.nc.mh, valrec->val.nc.ml, valrec->val.nc.sh, valrec->val.nc.sl); rpt_vstring(d1, "max_val=%d (0x%04x), cur_val=%d (0x%04x)", valrec->val.c.max_val, valrec->val.c.max_val, valrec->val.c.cur_val, valrec->val.c.cur_val); } else { assert(valrec->value_type == DDCA_TABLE_VCP_VALUE); rpt_hex_dump(valrec->val.t.bytes, valrec->val.t.bytect, d1); } } // must be #define, not const int, since used in buffer declaration #define SUMMARIZE_SINGLE_VCP_VALUE_BUFFER_SIZE 101 // to expose an int rather than a define in the header file const int summzrize_single_vcp_value_buffer_size = SUMMARIZE_SINGLE_VCP_VALUE_BUFFER_SIZE; char * summarize_single_vcp_value_r(DDCA_Single_Vcp_Value * valrec, char * buffer, int bufsz) { bool debug = false; DBGMSF(debug, "Starting. buffer=%p, bufsz=%d", buffer, bufsz); if (buffer) { assert(bufsz >= SUMMARIZE_SINGLE_VCP_VALUE_BUFFER_SIZE); *buffer = '\0'; if (valrec) { if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { snprintf(buffer, bufsz, "opcode=0x%02x, " "mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x, " "max_val=%d (0x%04x), cur_val=%d (0x%04x)", valrec->opcode, valrec->val.nc.mh, valrec->val.nc.ml, valrec->val.nc.sh, valrec->val.nc.sl, valrec->val.c.max_val, valrec->val.c.max_val, valrec->val.c.cur_val, valrec->val.c.cur_val ); // should never happen, but in case of string too long buffer[bufsz-1] = '\0'; } else { assert(valrec->value_type == DDCA_TABLE_VCP_VALUE); snprintf(buffer, bufsz, "opcode=0x%02x, value_type=Table, bytect=%d, ...", valrec->opcode, valrec->val.t.bytect ); // easier just to convert the whole byte array then take what can fit char * buf0 = hexstring2( valrec->val.t.bytes, valrec->val.t.bytect, NULL, // sepstr, true, // uppercase, NULL, // allocate buffer, 0); // bufsz int space_remaining = bufsz - strlen(buffer); if ( strlen(buf0) < space_remaining ) strcat(buffer, buf0); else { strncat(buffer, buf0, space_remaining-4); strcat(buffer, "..."); } free(buf0); } } } return buffer; } char * summarize_single_vcp_value(DDCA_Single_Vcp_Value * valrec) { static char buffer[SUMMARIZE_SINGLE_VCP_VALUE_BUFFER_SIZE]; return summarize_single_vcp_value_r(valrec, buffer, sizeof(buffer)); } // ignoring Buffer * since it only exists temporarily for transition void free_single_vcp_value(DDCA_Single_Vcp_Value * vcp_value) { if (vcp_value->value_type == DDCA_TABLE_VCP_VALUE) { if (vcp_value->val.t.bytes) free(vcp_value->val.t.bytes); } free(vcp_value); } // wrap free_single_vcp_value() in signature of GDestroyNotify() void free_single_vcp_value_func(gpointer data) { free_single_vcp_value((DDCA_Single_Vcp_Value *) data); } DDCA_Single_Vcp_Value * create_nontable_vcp_value( Byte feature_code, Byte mh, Byte ml, Byte sh, Byte sl) { DDCA_Single_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Single_Vcp_Value)); valrec->value_type = DDCA_NON_TABLE_VCP_VALUE; valrec->opcode = feature_code; valrec->val.nc.mh = mh; valrec->val.nc.ml = ml; valrec->val.nc.sh = sh; valrec->val.nc.sl = sl; // not needed thanks to overlay // valrec->val.nt.max_val = mh <<8 | ml; // valrec->val.nt.cur_val = sh <<8 | sl; return valrec; } DDCA_Single_Vcp_Value * create_cont_vcp_value( Byte feature_code, ushort max_val, ushort cur_val) { DDCA_Single_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Single_Vcp_Value)); valrec->value_type = DDCA_NON_TABLE_VCP_VALUE; valrec->opcode = feature_code; // not needed thanks to overlay // valrec->val.nc.mh = max_val >> 8; // valrec->val.nc.ml = max_val & 0x0f; // valrec->val.nc.sh = cur_val >> 8; // valrec->val.nc.sl = cur_val & 0x0f; valrec->val.c.max_val = max_val; valrec->val.c.cur_val = cur_val; return valrec; } DDCA_Single_Vcp_Value * create_table_vcp_value_by_bytes( Byte feature_code, Byte * bytes, ushort bytect) { DDCA_Single_Vcp_Value * valrec = calloc(1,sizeof(DDCA_Single_Vcp_Value)); valrec->value_type = DDCA_TABLE_VCP_VALUE; valrec->opcode = feature_code; valrec->val.t.bytect = bytect; valrec->val.t.bytes = malloc(bytect); memcpy(valrec->val.t.bytes, bytes, bytect); return valrec; } DDCA_Single_Vcp_Value * create_table_vcp_value_by_buffer(Byte feature_code, Buffer * buffer) { return create_table_vcp_value_by_bytes(feature_code, buffer->bytes, buffer->len); } DDCA_Single_Vcp_Value * create_single_vcp_value_by_parsed_vcp_response( Byte feature_id, Parsed_Vcp_Response * presp) { DDCA_Single_Vcp_Value * valrec = NULL; if (presp->response_type == DDCA_NON_TABLE_VCP_VALUE) { assert(presp->non_table_response->valid_response); assert(presp->non_table_response->supported_opcode); assert(feature_id == presp->non_table_response->vcp_code); valrec = create_nontable_vcp_value( feature_id, presp->non_table_response->mh, presp->non_table_response->ml, presp->non_table_response->sh, presp->non_table_response->sl ); // assert(valrec->val.c.max_val == presp->non_table_response->max_value); // assert(valrec->val.c.cur_val == presp->non_table_response->cur_value); } else { assert(presp->response_type == DDCA_TABLE_VCP_VALUE); valrec = create_table_vcp_value_by_buffer(feature_id, presp->table_response); } return valrec; } // temp for aid in conversion Parsed_Vcp_Response * single_vcp_value_to_parsed_vcp_response(DDCA_Single_Vcp_Value * valrec) { Parsed_Vcp_Response * presp = calloc(1, sizeof(Parsed_Vcp_Response)); presp->response_type = valrec->value_type; if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { presp->non_table_response = calloc(1, sizeof(Parsed_Nontable_Vcp_Response)); presp->non_table_response->cur_value = valrec->val.c.cur_val; presp->non_table_response->max_value = valrec->val.c.max_val; presp->non_table_response->mh = valrec->val.nc.mh; presp->non_table_response->ml = valrec->val.nc.ml; presp->non_table_response->sh = valrec->val.nc.sh; presp->non_table_response->sl = valrec->val.nc.sl; presp->non_table_response->supported_opcode = true; presp->non_table_response->valid_response = true; presp->non_table_response->vcp_code = valrec->opcode; } else { assert(valrec->value_type == DDCA_TABLE_VCP_VALUE); Buffer * buf2 = buffer_new(valrec->val.t.bytect, __func__); buffer_put(buf2, valrec->val.t.bytes, valrec->val.t.bytect); buffer_free(buf2,__func__); } return presp; } Nontable_Vcp_Value * single_vcp_value_to_nontable_vcp_value(DDCA_Single_Vcp_Value * valrec) { Nontable_Vcp_Value * non_table_response = calloc(1, sizeof(Nontable_Vcp_Value)); assert (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE); non_table_response->cur_value = valrec->val.c.cur_val; non_table_response->max_value = valrec->val.c.max_val; non_table_response->mh = valrec->val.nc.mh; non_table_response->ml = valrec->val.nc.ml; non_table_response->sh = valrec->val.nc.sh; non_table_response->sl = valrec->val.nc.sl; non_table_response->vcp_code = valrec->opcode; return non_table_response; } /** Converts a #DDCA_Single_Vcp_Value to #DDCA_Any_Vcp_Value * * \param valrec pointer to #DDCA_Single_Vcp_Value to convert * \return converted value */ DDCA_Any_Vcp_Value * single_vcp_value_to_any_vcp_value(DDCA_Single_Vcp_Value * valrec) { DDCA_Any_Vcp_Value * anyval = calloc(1, sizeof(DDCA_Any_Vcp_Value)); anyval->opcode = valrec->opcode; anyval->value_type = valrec->value_type; if (valrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { anyval->val.c_nc.mh = valrec->val.nc.mh; anyval->val.c_nc.ml = valrec->val.nc.ml; anyval->val.c_nc.sh = valrec->val.nc.sh; anyval->val.c_nc.sl = valrec->val.nc.sl; } else { // DDCA_TABLE_VCP_VALUE anyval->val.t.bytect = valrec->val.t.bytect; anyval->val.t.bytes = valrec->val.t.bytes; } return anyval; } Vcp_Value_Set vcp_value_set_new(int initial_size){ GPtrArray* ga = g_ptr_array_sized_new(initial_size); g_ptr_array_set_free_func(ga, free_single_vcp_value_func); return ga; } void free_vcp_value_set(Vcp_Value_Set vset){ g_ptr_array_free(vset, true); } void vcp_value_set_add(Vcp_Value_Set vset, DDCA_Single_Vcp_Value * pval){ g_ptr_array_add(vset, pval); } int vcp_value_set_size(Vcp_Value_Set vset){ return vset->len; } DDCA_Single_Vcp_Value * vcp_value_set_get(Vcp_Value_Set vset, int ndx){ assert(0 <= ndx && ndx < vset->len); return g_ptr_array_index(vset, ndx); } void report_vcp_value_set(Vcp_Value_Set vset, int depth) { rpt_vstring(depth, "Vcp_Value_Set at %p", vset); rpt_vstring(depth+1, "value count: %d", vset->len); int ndx = 0; for(;ndxlen; ndx++) { report_single_vcp_value( g_ptr_array_index(vset, ndx), depth+1); } } ddcutil-0.8.6/src/vcp/ddc_command_codes.h0000644000175000001440000000423413230445447015240 00000000000000/* ddc_command_codes.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_COMMAND_CODES_H_ #define DDC_COMMAND_CODES_H_ // // MCCS Command and Response Codes // // Used in 3 ways: // - to identify commands within ddcutil // - as identifiers in command request and response packets // - in capabilities string #define CMD_VCP_REQUEST 0x01 #define CMD_VCP_RESPONSE 0x02 #define CMD_VCP_SET 0x03 #define CMD_TIMING_REPLY 0x06 #define CMD_TIMING_REQUEST 0x07 #define CMD_VCP_RESET 0x09 #define CMD_SAVE_SETTINGS 0x0c #define CMD_SELF_TEST_REPLY 0xa1 #define CMD_SELF_TEST_REQUEST 0xb1 #define CMD_ID_REPLY 0xe1 #define CMD_TABLE_READ_REQUST 0xe2 #define CMD_CAPABILITIES_REPLY 0xe3 #define CMD_TABLE_READ_REPLY 0xe4 #define CMD_TABLE_WRITE 0xe7 #define CMD_ID_REQUEST 0xf1 #define CMD_CAPABILITIES_REQUEST 0xf3 #define CMD_ENABLE_APP_REPORT 0xf5 typedef struct { Byte cmd_code; char * name; } Cmd_Code_Table_Entry; extern int ddc_cmd_code_count; // number of entries in command code table char * ddc_cmd_code_name(Byte command_id); Cmd_Code_Table_Entry * get_ddc_cmd_struct_by_id(Byte char_code); Cmd_Code_Table_Entry * get_ddc_cmd_struct_by_index(int ndx); // void list_cmd_codes(); #endif /* DDC_COMMAND_CODES_H_ */ ddcutil-0.8.6/src/vcp/vcp_feature_set.h0000644000175000001440000000415213230445447015010 00000000000000/* vcp_feature_set.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef VCP_FEATURE_SET_H_ #define VCP_FEATURE_SET_H_ #include #include #include "util/coredefs.h" #include "base/feature_sets.h" #include "vcp/vcp_feature_codes.h" typedef void * VCP_Feature_Set; // make underlying data structure opaque typedef bool (*VCP_Feature_Set_Filter_Func)(VCP_Feature_Table_Entry * ventry); void free_vcp_feature_set(VCP_Feature_Set fset); VCP_Feature_Set create_feature_set(VCP_Feature_Subset subset, DDCA_MCCS_Version_Spec vcp_version); VCP_Feature_Set create_single_feature_set_by_vcp_entry(VCP_Feature_Table_Entry * vcp_entry); VCP_Feature_Set create_single_feature_set_by_hexid(Byte id, bool force); VCP_Feature_Table_Entry * get_feature_set_entry(VCP_Feature_Set feature_set, unsigned index); int get_feature_set_size(VCP_Feature_Set feature_set); VCP_Feature_Subset get_feature_set_subset_id(VCP_Feature_Set feature_set); void report_feature_set(VCP_Feature_Set feature_set, int depth); VCP_Feature_Set create_feature_set_from_feature_set_ref( Feature_Set_Ref * fsref, DDCA_MCCS_Version_Spec vcp_version, bool force); void filter_feature_set(VCP_Feature_Set fset, VCP_Feature_Set_Filter_Func func); #endif /* VCP_FEATURE_SET_H_ */ ddcutil-0.8.6/src/vcp/parse_capabilities.h0000644000175000001440000000453713230445447015464 00000000000000/* parse_capabilities.h * * Parse the capabilities string. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #ifndef PARSE_CAPABILITIES_H_ #define PARSE_CAPABILITIES_H_ #include #include "util/data_structures.h" #include "base/core.h" #include "base/displays.h" #include "base/vcp_version.h" #define PARSED_CAPABILITIES_MARKER "CAPA" /** Contains parsed capabilities information */ typedef struct { char marker[4]; // always "CAPA" char * raw_value; char * mccs_version_string; bool raw_cmds_segment_seen; bool raw_vcp_features_seen; bool raw_value_synthesized; Byte_Value_Array commands; // each stored byte is command id GPtrArray * vcp_features; // entries are Capabilities_Feature_Record * DDCA_MCCS_Version_Spec parsed_mccs_version; } Parsed_Capabilities; Parsed_Capabilities* parse_capabilities_buffer(Buffer * capabilities); Parsed_Capabilities* parse_capabilities_string(char * capabilities); void report_parsed_capabilities(Parsed_Capabilities* pcaps); void free_parsed_capabilities(Parsed_Capabilities * pcaps); Byte_Bit_Flags parsed_capabilities_feature_ids(Parsed_Capabilities * pcaps, bool readable_only); bool parsed_capabilities_may_support_table_commands(Parsed_Capabilities * pcaps); // Tests void test_segments(); void test_parse_caps(); #endif /* PARSE_CAPABILITIES_H_ */ ddcutil-0.8.6/src/vcp/parsed_capabilities_feature.h0000644000175000001440000000411113230445447017327 00000000000000/* parsed_capabilities_feature.h * * * Copyright (C) 2015-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Contains the parsed description of a VCP feature extracted from a capabilities string. */ #ifndef PARSED_CAPABILITIES_H #define PARSED_CAPABILITIES_H #include "util/data_structures.h" #include "base/core.h" #include "base/feature_sets.h" // Used when parsing capabilities string #define CAPABILITIES_FEATURE_MARKER "VCPF" /** Parsed description of a VCP Feature in a capabilities string. */ typedef struct { char marker[4]; ///< always "VCPF" Byte feature_id; ///< VCP feature code #ifdef OLD_BVA Byte_Value_Array values; #endif Byte_Bit_Flags bbflags; // alternative char * value_string; ///< value substring from capabilities string } Capabilities_Feature_Record; Capabilities_Feature_Record * new_capabilities_feature( Byte feature_id, char * value_string_start, int value_string_len); void free_capabilities_feature( Capabilities_Feature_Record * vfr); void report_capabilities_feature( Capabilities_Feature_Record * vfr, DDCA_MCCS_Version_Spec vcp_version, int depth); #endif /* PARSED_CAPABILITIES_H */ ddcutil-0.8.6/src/vcp/vcp_feature_codes.h0000644000175000001440000002204513230445447015313 00000000000000/* vcp_feature_codes.h * * Contains tables describing VCP feature codes, and functions to interpret * those tables. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * VCP Feature Code Table and related functions */ #ifndef VCP_FEATURE_CODES_H_ #define VCP_FEATURE_CODES_H_ #include #include "public/ddcutil_types.h" #include "util/string_util.h" #include "base/core.h" #include "base/ddc_packets.h" #include "base/feature_sets.h" #include "vcp/vcp_feature_values.h" // // VCP Feature Interpretation // // Examples of features that create need for complex data structures: // // x62: Audio Volume: // v 2.0: C // v 3.0: NC Values x00 and xff are reserved, x01..xfe are a continuous range // // xdf: VCP Version: // NC, uses both high and low bytes // MCCS specification group to which feature belongs // Note a function can appear in multiple groups, e.g. in different spec versions // Should probably have been made version specific, but it's not worth redoing typedef enum { VCP_SPEC_PRESET = 0x80 , // Section 8.1 Preset Operations VCP_SPEC_IMAGE = 0x40 , // Section 8.2 Image Adjustment VCP_SPEC_CONTROL = 0x20 , // Section 8.3 Display Control VCP_SPEC_GEOMETRY = 0x10 , // Section 8.4 Geometry VCP_SPEC_MISC = 0x08 , // Section 8.5 Miscellaneous Functions VCP_SPEC_AUDIO = 0x04 , // Section 8.6 Audio Functions VCP_SPEC_DPVL = 0x02 , // Section 8.7 DPVL Functions VCP_SPEC_MFG = 0x01 , // Section 8.8 Manufacturer Specific VCP_SPEC_WINDOW = 0x8000 , // Table 5 in MCCS 2.0 spec } Vcp_Spec_Ids; // Set these bits in a flag byte to indicate the MCCS versions for which a feature is valid // #define MCCS_V10 0x01 // #define MCCS_V20 0x02 // #define MCCS_V21 0x04 // #define MCCS_V30 0x08 // #define MCCS_V22 0x10 typedef bool (*Format_Normal_Feature_Detail_Function) ( Nontable_Vcp_Value* code_info, DDCA_MCCS_Version_Spec vcp_version, char * buffer, int bufsz); typedef bool (*Format_Table_Feature_Detail_Function) ( Buffer * data_bytes, DDCA_MCCS_Version_Spec vcp_version, char ** p_result_buffer); extern DDCA_Feature_Value_Entry * pxc8_display_controller_type_values; // To consider: // In retrospect this is probably better, but not worth redoing // typedef struct { // char * name; // VCP_Feature_Subset subsets; // Version_Feature_Flags flags; // Feature_Value_Entry * sl_values; // } Version_Specific_Info; #define VCP_FEATURE_TABLE_ENTRY_MARKER "VFTE" typedef struct { char marker[4]; Byte code; char * desc; Format_Normal_Feature_Detail_Function nontable_formatter; Format_Table_Feature_Detail_Function table_formatter; DDCA_Global_Feature_Flags vcp_global_flags; ushort vcp_spec_groups; VCP_Feature_Subset vcp_subsets; char * v20_name; char * v21_name; char * v30_name; char * v22_name; DDCA_Version_Feature_Flags v20_flags; DDCA_Version_Feature_Flags v21_flags; DDCA_Version_Feature_Flags v30_flags; DDCA_Version_Feature_Flags v22_flags; DDCA_Feature_Value_Entry * default_sl_values; DDCA_Feature_Value_Entry * v21_sl_values; DDCA_Feature_Value_Entry * v30_sl_values; DDCA_Feature_Value_Entry * v22_sl_values; } VCP_Feature_Table_Entry; // // Functions that return or destroy a VCP_Feature_Table_Entry // void free_synthetic_vcp_entry( VCP_Feature_Table_Entry * vfte); VCP_Feature_Table_Entry * vcp_get_feature_table_entry(int ndx); VCP_Feature_Table_Entry * vcp_create_dummy_feature_for_hexid( DDCA_Vcp_Feature_Code id); VCP_Feature_Table_Entry * vcp_create_table_dummy_feature_for_hexid( DDCA_Vcp_Feature_Code id); VCP_Feature_Table_Entry * vcp_find_feature_by_hexid( DDCA_Vcp_Feature_Code id); VCP_Feature_Table_Entry * vcp_find_feature_by_hexid_w_default( DDCA_Vcp_Feature_Code id); // // Functions to extract information from a VCP_Feature_Table_Entry // bool has_version_specific_features( VCP_Feature_Table_Entry * vfte); DDCA_MCCS_Version_Spec get_highest_non_deprecated_version( VCP_Feature_Table_Entry * vfte); bool is_version_conditional_vcp_type( VCP_Feature_Table_Entry * vfte); bool is_feature_supported_in_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); bool is_feature_readable_by_vcp_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); bool is_feature_writable_by_vcp_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); bool is_feature_table_by_vcp_version( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); DDCA_Version_Feature_Flags get_version_specific_feature_flags( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); DDCA_Version_Feature_Flags get_version_sensitive_feature_flags( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); DDCA_Feature_Value_Entry * get_version_specific_sl_values( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); DDCA_Feature_Value_Entry * get_version_sensitive_sl_values( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); char * get_version_sensitive_feature_name( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); char * get_version_specific_feature_name( VCP_Feature_Table_Entry * vfte, DDCA_MCCS_Version_Spec vcp_version); char * get_non_version_specific_feature_name( VCP_Feature_Table_Entry * pvft_entry); // // Functions that query the feature table by VCP feature code // char* get_feature_name_by_id_only( DDCA_Vcp_Feature_Code feature_code); char* get_feature_name_by_id_and_vcp_version( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Spec vspec); #ifdef OLD DDCA_Version_Feature_Info * get_version_specific_feature_info( DDCA_Vcp_Feature_Code feature_code, bool with_default, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id); DDCA_Version_Feature_Info * get_version_sensitive_feature_info( DDCA_Vcp_Feature_Code feature_code, bool with_default, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id); #endif DDCA_Version_Feature_Info * get_version_feature_info( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Id mccs_version_id, bool with_default, bool version_sensitive); void free_version_feature_info( DDCA_Version_Feature_Info * info); DDCA_Feature_Value_Entry * find_feature_values( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Spec vcp_version); DDCA_Feature_Value_Entry * find_feature_values_for_capabilities( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Spec vcp_version); // // Report Functions // void report_vcp_feature_table_entry( VCP_Feature_Table_Entry * vfte, int depth); void report_version_feature_info( DDCA_Version_Feature_Info * info, int depth); void vcp_list_feature_codes(FILE * fh); // // Miscellaneous Functions // char * get_feature_value_name( DDCA_Feature_Value_Entry * value_entries, Byte value_id); bool vcp_format_feature_detail( VCP_Feature_Table_Entry * vcp_entry, DDCA_MCCS_Version_Spec vcp_version, DDCA_Single_Vcp_Value * valrec, char * * aformatted_data ); int vcp_get_feature_code_count(); void init_vcp_feature_codes(); #endif /* VCP_FEATURE_CODES_H_ */ ddcutil-0.8.6/src/vcp/vcp_feature_values.h0000644000175000001440000001342213230445447015514 00000000000000/* vcp_feature_values.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef VCP_FEATURE_VALUES_H_ #define VCP_FEATURE_VALUES_H_ #include #include "ddcutil_types.h" #include "util/coredefs.h" #include "util/data_structures.h" #include "base/ddc_packets.h" // Removed from API due to complexity. Used only internally. // TODO: replace with DDCA_Any_Vcp_Value /** Represents a single VCP value of any type */ typedef struct { DDCA_Vcp_Feature_Code opcode; /**< VCP feature code */ DDCA_Vcp_Value_Type value_type; // probably a different type would be better union { struct { uint8_t * bytes; /**< pointer to bytes of table value */ uint16_t bytect; /**< number of bytes in table value */ } t; /**< table value */ struct { uint16_t max_val; /**< maximum value (mh, ml bytes) for continuous value */ uint16_t cur_val; /**< current value (sh, sl bytes) for continuous value */ } c; /**< continuous (C) value */ struct { // __BYTE_ORDER__ ifdef ensures proper overlay of ml/mh on max_val, sl/sh on cur_val #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint8_t ml; /**< ML byte for NC value */ uint8_t mh; /**< MH byte for NC value */ uint8_t sl; /**< SL byte for NC value */ uint8_t sh; /**< SH byte for NC value */ #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; #else #error "Unexpected byte order value: __BYTE_ORDER__" #endif } nc; /**< non-continuous (NC) value */ } val; } DDCA_Single_Vcp_Value; /** Represents a single non-table VCP value */ typedef struct { DDCA_Vcp_Feature_Code feature_code; union { struct { uint16_t max_val; /**< maximum value (mh, ml bytes) for continuous value */ uint16_t cur_val; /**< current value (sh, sl bytes) for continuous value */ } c; /**< continuous (C) value */ struct { // Ensure proper overlay of ml/mh on max_val, sl/sh on cur_val #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ uint8_t ml; /**< ML byte for NC value */ uint8_t mh; /**< MH byte for NC value */ uint8_t sl; /**< SL byte for NC value */ uint8_t sh; /**< SH byte for NC value */ #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; #else #error "Unexpected byte order value: __BYTE_ORDER__" #endif } nc; /**< non-continuous (NC) value */ } val; } DDCA_Non_Table_Value_Response; char * vcp_value_type_name(DDCA_Vcp_Value_Type value_type); DDCA_Single_Vcp_Value * create_nontable_vcp_value( Byte feature_code, Byte mh, Byte ml, Byte sh, Byte sl); DDCA_Single_Vcp_Value * create_cont_vcp_value( Byte feature_code, ushort max_val, ushort cur_val); DDCA_Single_Vcp_Value * create_table_vcp_value_by_bytes( Byte feature_code, Byte * bytes, ushort bytect); DDCA_Single_Vcp_Value * create_table_vcp_value_by_buffer( Byte feature_code, Buffer* buffer); DDCA_Single_Vcp_Value * create_single_vcp_value_by_parsed_vcp_response( Byte feature_id, Parsed_Vcp_Response * presp); Parsed_Vcp_Response * single_vcp_value_to_parsed_vcp_response( DDCA_Single_Vcp_Value * valrec); DDCA_Any_Vcp_Value * single_vcp_value_to_any_vcp_value( DDCA_Single_Vcp_Value * valrec); // Simple stripped-down version of Parsed_Nontable_Vcp_Response // for use within vcp_feature_codes.c typedef struct { Byte vcp_code; ushort max_value; ushort cur_value; // for new way Byte mh; Byte ml; Byte sh; Byte sl; } Nontable_Vcp_Value; Nontable_Vcp_Value * single_vcp_value_to_nontable_vcp_value(DDCA_Single_Vcp_Value * valrec); void free_single_vcp_value(DDCA_Single_Vcp_Value * vcp_value); void dbgrpt_ddca_single_vcp_value(DDCA_Single_Vcp_Value * valrec, int depth); void report_single_vcp_value( DDCA_Single_Vcp_Value * valrec, int depth); extern const int summzrize_single_vcp_value_buffer_size; char * summarize_single_vcp_value_r(DDCA_Single_Vcp_Value * valrec, char * buffer, int bufsz); char * summarize_single_vcp_value(DDCA_Single_Vcp_Value * valrec); typedef GPtrArray * Vcp_Value_Set; Vcp_Value_Set vcp_value_set_new(int initial_size); void free_vcp_value_set(Vcp_Value_Set vset); void vcp_value_set_add(Vcp_Value_Set vset, DDCA_Single_Vcp_Value * pval); int vcp_value_set_size(Vcp_Value_Set vset); DDCA_Single_Vcp_Value * vcp_value_set_get(Vcp_Value_Set vset, int ndx); void report_vcp_value_set(Vcp_Value_Set vset, int depth); #endif /* SRC_VCP_VCP_FEATURE_VALUES_H_ */ ddcutil-0.8.6/src/i2c/0000755000175000001440000000000013230445447011424 500000000000000ddcutil-0.8.6/src/i2c/Makefile.am0000644000175000001440000000062613226543742013406 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall AM_CFLAGS += -Werror AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libi2c.la libi2c_la_SOURCES = \ i2c_base_io.c \ i2c_bus_core.c \ i2c_do_io.c ddcutil-0.8.6/src/i2c/Makefile.in0000644000175000001440000005150013230171237013403 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand subdir = src/i2c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libi2c_la_LIBADD = am_libi2c_la_OBJECTS = i2c_base_io.lo i2c_bus_core.lo i2c_do_io.lo libi2c_la_OBJECTS = $(am_libi2c_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libi2c_la_SOURCES) DIST_SOURCES = $(libi2c_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall -Werror -Wpedantic $(am__append_1) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libi2c.la libi2c_la_SOURCES = \ i2c_base_io.c \ i2c_bus_core.c \ i2c_do_io.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/i2c/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/i2c/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libi2c.la: $(libi2c_la_OBJECTS) $(libi2c_la_DEPENDENCIES) $(EXTRA_libi2c_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libi2c_la_OBJECTS) $(libi2c_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i2c_base_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i2c_bus_core.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i2c_do_io.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: ddcutil-0.8.6/src/i2c/i2c_base_io.c0000644000175000001440000002366513214516372013660 00000000000000/* i2c_base_io.c * * Basic functions for writing to and reading from the I2C bus, * using alternative mechanisms. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Basic functions for writing to and reading from the I2C bus using * alternative mechanisms. */ /** \cond */ #include #include #include #include #include #include #include #include /** \endcond */ #include "util/coredefs.h" #include "util/string_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/execution_stats.h" #include "base/feature_sets.h" #include "base/linux_errno.h" #include "i2c/wrap_i2c-dev.h" #include "i2c/i2c_base_io.h" // // Basic functions for reading and writing to I2C bus. // /** Writes to i2c bus using write() * * @param fh file handle * @param bytect number of bytes to write * @param pbytes pointer to bytes to write * * @retval 0 success * @retval DDCRC_BAD_BYTECT incorrect number of bytes written * @retval -errno negative Linux error number */ Status_Errno_DDC write_writer(int fh, int bytect, Byte * pbytes) { bool debug = false; int rc = write(fh, pbytes, bytect); // per write() man page: // if >= 0, number of bytes actually written, must be <= bytect // if -1, error occurred, errno is set if (rc >= 0) { if (rc == bytect) rc = 0; else rc = DDCRC_BAD_BYTECT; } else { // rc < 0 int errsv = errno; DBGMSF(debug, "write() returned %d, errno=%s", rc, linux_errno_desc(errsv)); rc = -errsv; } return rc; } /** Reads from I2C bus using read() * * @param fh file handle * @param bytect number of bytes to read * @param readbuf read bytes into this buffer * * @retval 0 success * @retval DDCRC_BAD_BYTECT incorrect number of bytes read * @retval -errno negative Linux errno value */ Status_Errno_DDC read_reader(int fh, int bytect, Byte * readbuf) { bool debug = false; int rc = read(fh, readbuf, bytect); // per read() man page: // if >= 0, number of bytes actually read // if -1, error occurred, errno is set if (rc >= 0) { if (rc == bytect) rc = 0; else rc = DDCRC_BAD_BYTECT; } else { // rc < 0 int errsv = errno; DBGMSF(debug, "read() returned %d, errno=%s", rc, linux_errno_desc(errsv)); rc = -errsv; } return rc; } #ifdef FOR_REFERENCE /* * I2C Message - used for pure i2c transaction, also from /dev interface */ struct i2c_msg { __u16 addr; /* slave address */ unsigned short flags; #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ #define I2C_M_RD 0x01 #define I2C_M_NOSTART 0x4000 #define I2C_M_REV_DIR_ADDR 0x2000 #define I2C_M_IGNORE_NAK 0x1000 #define I2C_M_NO_RD_ACK 0x0800 short len; /* msg length */ char *buf; /* pointer to msg data */ }; #endif /** Writes to I2C bus using ioctl(I2C_RDWR) * * @param fh file handle * @param bytect number of bytes to write * @param pbytes pointer to bytes to write * * @retval 0 success * @retval <0 negative Linux errno value */ Status_Errno_DDC ioctl_writer(int fh, int bytect, Byte * pbytes) { bool debug = false; DBGMSF(debug, "Starting. fh=%d, bytect=%d, pbytes=%p", fh, bytect, pbytes); struct i2c_msg messages[1]; struct i2c_rdwr_ioctl_data msgset; messages[0].addr = 0x37; messages[0].flags = 0; messages[0].len = bytect; // On Ubuntu and SuSE?, i2c_msg is defined in i2c-dev.h, with char *buf // On Fedora, i2c_msg is defined in i2c.h, and it's --u8 * buf #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpointer-sign" messages[0].buf = (char *) pbytes; #pragma GCC diagnostic pop msgset.msgs = messages; msgset.nmsgs = 1; // ioctl works, but valgrind complains about uninitialized parm // printf("(%s) messages=%p, messages[0]=%p, messages[0].buf=%p\n", // __func__, messages, &messages[0], messages[0].buf); // printf("(%s) msgset=%p, msgset.msgs=%p, msgset.msgs[0]=%p, msgset.msgs[0].buf=%p\n", // __func__, &msgset, msgset.msgs, &msgset.msgs[0], msgset.msgs[0].buf); // per ioctl() man page: // if success: // normally: 0 // occasionally >0 is output parm // if error: // -1, errno is set // 11/15: as seen: always returns 1 for success int rc = ioctl(fh, I2C_RDWR, &msgset); int errsv = errno; if (rc < 0) { if (debug) { REPORT_IOCTL_ERROR("I2C_RDWR", errno); } } // DBGMSG("ioctl(..I2C_RDWR..) returned %d", rc); if (rc > 0) { // what should a positive value be equal to? not bytect if (rc != 1) DBGMSG("ioctl() write returned %d", rc); rc = 0; } else if (rc < 0) { // rc = modulate_rc(-errno, RR_ERRNO); rc = -errsv; } DBGMSF(debug, "Returning %d", rc); return rc; } /** Reads from I2C bus using ioctl(I2C_RDWR) * * @param fh file handle * @param bytect number of bytes to read * @param readbuf read bytes into this buffer * * @retval 0 success * @retval <0 negative Linux errno value */ Status_Errno_DDC ioctl_reader(int fh, int bytect, Byte * readbuf) { bool debug = true; // DBGMSG("Starting"); struct i2c_msg messages[1]; struct i2c_rdwr_ioctl_data msgset; messages[0].addr = 0x37; messages[0].flags = I2C_M_RD; messages[0].len = bytect; // On Ubuntu and SuSE?, i2c_msg is defined in i2c-dev.h, with char *buf // On Fedora, i2c_msg is defined in i2c.h, and it's --u8 * buf #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpointer-sign" messages[0].buf = (char *) readbuf; #pragma GCC diagnostic pop msgset.msgs = messages; msgset.nmsgs = 1; // per ioctl() man page: // if success: // normally: 0 // occasionally >0 is output parm // if error: // -1, errno is set int rc = ioctl(fh, I2C_RDWR, &msgset); int errsv = errno; if (rc < 0) { if (debug) { REPORT_IOCTL_ERROR("I2C_RDWR", errno); } } // DBGMSG("ioctl(..I2C_RDWR..) returned %d", rc); if (rc > 0) { // always see rc == 1 if (rc != 1) DBGMSG("ioctl rc = %d, bytect =%d", rc, bytect); rc = 0; } else if (rc < 0) rc = -errsv; return rc; } #ifdef WONT_COMPILE // i2c_sumbus_write_i2c_block_data_writer, and _reader are retained only for // possible further exploration. They do not work. // Worse: 12/3/15: i2c_smbus_write_i2c_block_data, i2c_smbus_read_i2c_block_data not defined on // Fedora if using system /usr/include/linux/i2c-dev.h, i2c.h // Write to I2C bus using i2c_smbus_write_i2c_block_data() // 11/2015: fails: Status_Errno_DDC i2c_smbus_write_i2c_block_data_writer(int fh, int bytect, Byte * bytes_to_write) { bool debug = true; int rc = i2c_smbus_write_i2c_block_data(fh, bytes_to_write[0], // cmd bytect-1, // len of values bytes_to_write+1); // values if (rc < 0) { int errsv = errno; if (debug) DBGMSG("i2c_smbus_write_i2c_block_data() returned %d, errno=%s", rc, linux_errno_desc(errsv)); // set rc to -errno? // rc = modulate_rc(-errsv, RR_ERRNO); rc = -errsv; } return rc; } // Read from I2C bus using i2c_smbus_read_i2c_block_data() // i2c_smbus_read_i2c_block_data can't handle capabilities fragments 32 bytes in size, since with // "envelope" the packet exceeds the i2c_smbus_read_i2c_block_data 32 byte limit Status_Errno_DDC i2c_smbus_read_i2c_block_data_reader(int fh, int bytect, Byte * readbuf) { bool debug = true; const int MAX_BYTECT = 256; assert(bytect <= MAX_BYTECT); Byte workbuf[MAX_BYTECT+1]; Byte zeroByte = 0x00; // can't handle 32 byte fragments from capabilities reply int rc = i2c_smbus_read_i2c_block_data(fh, zeroByte, // cmd byte bytect, workbuf); #ifdef WRONG if (rc > 0) { int errsv = errno; // always see rc=32, bytect=39 // but leading byte of response is not 0 DBGMSG("i2c_smbus_read_i2c_block_data() returned %d, bytect=%d", rc, bytect); hex_dump(workbuf, bytect); errno = errsv; rc = 0; int ndx = 0; // n no leading 0 byte for (ndx=0; ndx < bytect; ndx++) readbuf[ndx] = workbuf[ndx+0]; } else #endif if (rc == 0) { assert(workbuf[0] == zeroByte); // whatever in cmd byte returned as first byte of buffer int ndx = 0; for (ndx=0; ndx < bytect; ndx++) readbuf[ndx] = workbuf[ndx+1]; } else if (rc < 0) { int errsv = errno; if (debug) DBGMSG("i2c_smbus_read_i2c_block_data() returned %d, errno=%s", rc, linux_errno_desc(errsv)); // set rc to -errno? // rc = modulate_rc(-errsv, RR_ERRNO); rc = -errno; } return rc; } #endif ddcutil-0.8.6/src/i2c/i2c_bus_core.c0000644000175000001440000012633513226557604014064 00000000000000/* i2c_bus_core.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * I2C bus detection and inspection */ /** \cond */ #include #include #include #include // #include #include #include #include #include #include #include /** \endcond */ #include "util/debug_util.h" #include "util/failsim.h" #include "util/file_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/sysfs_util.h" #include "util/udev_i2c_util.h" #include "util/utilrpt.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/linux_errno.h" #include "base/parms.h" #include "base/sleep.h" #include "base/status_code_mgt.h" #include "i2c/i2c_do_io.h" #include "i2c/wrap_i2c-dev.h" #include "i2c/i2c_bus_core.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_I2C; /** All I2C buses. GPtrArray of pointers to #I2C_Bus_Info */ static GPtrArray * i2c_buses = NULL; /** Global variable. Controls whether function #i2c_set_addr() attempts retry * after EBUSY error by changing ioctl op I2C_SLAVE to I2C_SLAVE_FORCE. */ bool i2c_force_slave_addr_flag = false; // // Basic I2C bus operations // /** Open an I2C bus device. * * @param busno bus number * @param callopts call option flags, controlling failure action * * @retval >=0 file descriptor * @retval -errno negative Linux errno if open fails and CALLOPT_ERR_ABORT not set in callopts */ int i2c_open_bus(int busno, Byte callopts) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "busno=%d, callopts=0x%02x", busno, callopts); char filename[20]; int file; snprintf(filename, 19, "/dev/i2c-%d", busno); RECORD_IO_EVENT( IE_OPEN, ( file = open(filename, (callopts & CALLOPT_RDONLY) ? O_RDONLY : O_RDWR) ) ); // per man open: // returns file descriptor if successful // -1 if error, and errno is set int errsv = errno; if (file < 0) { #ifdef OLD if (callopts & CALLOPT_ERR_ABORT) { TERMINATE_EXECUTION_ON_ERROR("Open failed for %s. errno=%s\n", filename, linux_errno_desc(errsv)); } #endif if (callopts & CALLOPT_ERR_MSG) { f0printf(FERR, "Open failed for %s: errno=%s\n", filename, linux_errno_desc(errsv)); } file = -errsv; } DBGTRC(debug, TRACE_GROUP, "Returning file descriptor: %d", file); return file; } /** Closes an open I2C bus device. * * @param fd file descriptor * @param busno bus number (for error messages), if -1, ignore * @param callopts call option flags, controlling failure action * * @retval 0 success * @retval <0 negative Linux errno value close*( fails and CALLOPT_ERR_ABORT not set in callopts */ Status_Errno i2c_close_bus(int fd, int busno, Call_Options callopts) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. fd=%d, busno=%d, callopts=%s", fd, busno, interpret_call_options_t(callopts)); Status_Errno result = 0; int rc = 0; #ifdef ALTERNATIVE // get file name from descriptor instead of requiring busno parm char * i2c_fn; rc = filename_for_fd(fd, &i2c_fn); assert(rc == 0); DBGMSG("i2c_fn = %s", i2c_fn); free(i2c_fn); #endif RECORD_IO_EVENT(IE_CLOSE, ( rc = close(fd) ) ); assert( rc == 0 || rc == -1); // per documentation int errsv = errno; if (rc < 0) { // EBADF (9) fd isn't a valid open file descriptor // EINTR (4) close() interrupted by a signal // EIO (5) I/O error char workbuf[80]; if (busno >= 0) snprintf(workbuf, 80, "Close failed for bus /dev/i2c-%d. errno=%s", busno, linux_errno_desc(errsv)); else snprintf(workbuf, 80, "Bus device close failed. errno=%s", linux_errno_desc(errsv)); #ifdef OLD if (callopts & CALLOPT_ERR_ABORT) TERMINATE_EXECUTION_ON_ERROR(workbuf); #endif if (callopts & CALLOPT_ERR_MSG) f0printf(FERR, "%s\n", workbuf); result = -errsv; } assert(result <= 0); DBGTRC(debug, TRACE_GROUP, "Returning: %d", result); return result; } /** Sets I2C slave address to be used on subsequent calls * * @param file file descriptor for open /dev/i2c-n * @param addr slave address * @param callopts call option flags, controlling failure action\n * if CALLOPT_FORCE set, use IOCTL op I2C_SLAVE_FORCE\n * to take control even if address is in use by another driver * * @retval 0 if success * @retval <0 negative Linux errno, if ioctl call fails and CALLOPT_ERR_ABORT not set in callopts * * \remark * Errors which are recovered are counted here using COUNT_STATUS_CODE(). * The final status code is left for the caller to count */ Status_Errno i2c_set_addr(int file, int addr, Call_Options callopts) { bool debug = false; #ifdef FOR_TESTING bool force_i2c_slave_failure = false; #endif callopts |= CALLOPT_ERR_MSG; // temporary DBGMSF(debug, "file=%d, addr=0x%02x, i2c_force_slave_addr_flag=%s, callopts=%s", file, addr, bool_repr(i2c_force_slave_addr_flag), interpret_call_options_t(callopts) ); // FAILSIM; Status_Errno result = 0; int rc = 0; int errsv = 0; uint16_t op = I2C_SLAVE; retry: errno = 0; RECORD_IO_EVENT( IE_OTHER, ( rc = ioctl(file, op, addr) ) ); #ifdef FOR_TESTING if (force_i2c_slave_failure) { if (op == I2C_SLAVE) { DBGMSG("Forcing pseudo failure"); rc = -1; errno=EBUSY; } } #endif errsv = errno; if (rc < 0) { if ( callopts & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR( (op == I2C_SLAVE) ? "I2C_SLAVE" : "I2C_SLAVE_FORCE", errno); #ifdef OLD report_ioctl_error(errsv, __func__, __LINE__-13, __FILE__, /*fatal=*/ callopts&CALLOPT_ERR_ABORT); else if (callopts & CALLOPT_ERR_ABORT) DDC_ABORT(DDCL_INTERNAL_ERROR); #endif if (errsv == EBUSY && i2c_force_slave_addr_flag && op == I2C_SLAVE) { DBGMSG("Retrying using IOCTL op I2C_SLAVE_FORCE for address 0x%02x", addr ); // normally errors counted at higher level, but in this case it would be lost because of retry COUNT_STATUS_CODE(-errsv); op = I2C_SLAVE_FORCE; debug = true; // force final message for clarity goto retry; } result = -errsv; } if (result || debug) { printf("(%s) addr = 0x%02x. Returning %d\n", __func__, addr, result); // show_backtrace(1); } assert(result <= 0); return result; } // // I2C Bus Inspection - Functionality Flags // // Functions and data structures for interpreting the I2C bus functionality flags. // They are overly complex for production use. They were created during development // to facilitate exploratory programming. // Note 2 entries for I2C_FUNC_I2C. Usage must take this into account. Value_Name_Title_Table functionality_table2 = { // flag I2C function name VNT(I2C_FUNC_I2C , "ioctl_write"), VNT(I2C_FUNC_I2C , "ioctl_read"), VNT(I2C_FUNC_10BIT_ADDR , NULL), VNT(I2C_FUNC_PROTOCOL_MANGLING , NULL), VNT(I2C_FUNC_SMBUS_PEC , "i2c_smbus_pec"), VNT(I2C_FUNC_SMBUS_BLOCK_PROC_CALL , "i2c_smbus_block_proc_call"), VNT(I2C_FUNC_SMBUS_QUICK , "i2c_smbus_quick"), VNT(I2C_FUNC_SMBUS_READ_BYTE , "i2c_smbus_read_byte"), VNT(I2C_FUNC_SMBUS_WRITE_BYTE , "i2c_smbus_write_byte"), VNT(I2C_FUNC_SMBUS_READ_BYTE_DATA , "i2c_smbus_read_byte_data"), VNT(I2C_FUNC_SMBUS_WRITE_BYTE_DATA , "i2c_smbus_write_byte_data"), VNT(I2C_FUNC_SMBUS_READ_WORD_DATA , "i2c_smbus_read_word_data"), VNT(I2C_FUNC_SMBUS_WRITE_WORD_DATA , "i2c_smbus_write_word_data"), VNT(I2C_FUNC_SMBUS_PROC_CALL , "i2c_smbus_proc_call"), VNT(I2C_FUNC_SMBUS_READ_BLOCK_DATA , "i2c_smbus_read_block_data"), VNT(I2C_FUNC_SMBUS_WRITE_BLOCK_DATA , "i2c_smbus_write_block_data"), VNT(I2C_FUNC_SMBUS_READ_I2C_BLOCK , "i2c_smbus_read_i2c_block_data"), VNT(I2C_FUNC_SMBUS_WRITE_I2C_BLOCK , "i2c_smbus_write_i2c_block_data"), VNT_END }; // Separate table for interpreting functionality flags. Value_Name_Table functionality_flag_table = { VN(I2C_FUNC_I2C ), //0x00000001 VN(I2C_FUNC_10BIT_ADDR ), //0x00000002 VN(I2C_FUNC_PROTOCOL_MANGLING ), //0x00000004 /* I2C_M_IGNORE_NAK etc. */ VN(I2C_FUNC_SMBUS_PEC ), //0x00000008 // VN(I2C_FUNC_NOSTART ), //0x00000010 /* I2C_M_NOSTART */ // i2c-tools 4.0 // VN(I2C_FUNC_SLAVE ), //0x00000020 // i2c-tools 4.0 {0x00000010, "I2C_FUNC_NOSTART", NULL }, {0x00000020, "I2C_FUNC_SLAVE", NULL }, VN(I2C_FUNC_SMBUS_BLOCK_PROC_CALL ), //0x00008000 /* SMBus 2.0 */ VN(I2C_FUNC_SMBUS_QUICK ), //0x00010000 VN(I2C_FUNC_SMBUS_READ_BYTE ), //0x00020000 VN(I2C_FUNC_SMBUS_WRITE_BYTE ), //0x00040000 VN(I2C_FUNC_SMBUS_READ_BYTE_DATA ), //0x00080000 VN(I2C_FUNC_SMBUS_WRITE_BYTE_DATA ), //0x00100000 VN(I2C_FUNC_SMBUS_READ_WORD_DATA ), //0x00200000 VN(I2C_FUNC_SMBUS_WRITE_WORD_DATA ), //0x00400000 VN(I2C_FUNC_SMBUS_PROC_CALL ), //0x00800000 VN(I2C_FUNC_SMBUS_READ_BLOCK_DATA ), //0x01000000 VN(I2C_FUNC_SMBUS_WRITE_BLOCK_DATA ), //0x02000000 VN(I2C_FUNC_SMBUS_READ_I2C_BLOCK ), //0x04000000 /* I2C-like block xfer */ VN(I2C_FUNC_SMBUS_WRITE_I2C_BLOCK ), //0x08000000 /* w/ 1-byte reg. addr. */ // VN(I2C_FUNC_SMBUS_HOST_NOTIFY ), //0x10000000 // i2c-tools 4.0 {0x10000000, "I2C_FUNC_SMBUS_HOST_NOTIFY", NULL}, VN_END }; /** Gets the I2C functionality flags for an open I2C bus, * specified by its file descriptor. * * @param fd file descriptor * @return functionality flags */ unsigned long i2c_get_functionality_flags_by_fd(int fd) { bool debug = false; DBGMSF(debug, "Starting.", NULL); unsigned long funcs; int rc; RECORD_IO_EVENT(IE_OTHER, ( rc = ioctl(fd, I2C_FUNCS, &funcs) ) ); // int errsv = errno; if (rc < 0) { REPORT_IOCTL_ERROR("I2C_FUNCS", errno); funcs = 0; } DBGMSF(debug, "Functionality for file descriptor %d: %lu, 0x%0lx", fd, funcs, funcs); return funcs; } /** Returns a string representation of functionality flags. * * @param functionality long int of flags * @return string representation of flags */ char * i2c_interpret_functionality_flags(unsigned long functionality) { // HACK ALERT: There are 2 entries for bit I2C_FUNC_I2C in functionality_table, // one for function name ioctl_read and another for function name ioctl_write // These are at indexes 0 and 1. For our purposes here we only want to check // each bit once, so we start at index 1 instead of 0. // return vnt_interpret_flags(functionality, functionality_table2+1, false, ", "); return vnt_interpret_flags(functionality, functionality_flag_table, false, ", "); } /** Reports functionality flags. * * The output is multiline. * * @param functionality flags to report * @param maxline maximum length of 1 line * @param depth logical indentation depth */ void i2c_report_functionality_flags(long functionality, int maxline, int depth) { bool debug = false; DBGMSF(debug, "Starting. functionality=0x%016x, maxline=%d", functionality, maxline); char * buf0 = i2c_interpret_functionality_flags(functionality); DBGMSF(debug, "buf0=|%s|", buf0); char * header = "Functionality: "; int hdrlen = strlen(header); int maxpiece = maxline - ( rpt_get_indent(depth) + hdrlen); Null_Terminated_String_Array ntsa = strsplit_maxlength( buf0, maxpiece, " "); int ntsa_ndx = 0; while (true) { char * s = ntsa[ntsa_ndx++]; if (!s) break; // printf("(%s) header=|%s|, s=|%s|\n", __func__, header, s); rpt_vstring(depth, "%-*s%s", hdrlen, header, s); // printf("(%s) s = %p\n", __func__, s); if (strlen(header) > 0) header = ""; } free(buf0); ntsa_free(ntsa, /* free_strings */ true); DBGMSF(debug, "Done", NULL); } // // I2C Bus Inspection - Slave Addresses // #ifdef UNUSED /* Checks each address on an I2C bus to see if a device exists. * The bus device has already been opened. * * Arguments: * fd file descriptor for open bus object * * Returns: * 128 byte array of booleans, byte n is true iff a device is * detected at bus address n * * This "exploratory" function is not currently used but is * retained for diagnostic purposes. * * TODO: exclude reserved I2C bus addresses from check */ static bool * i2c_detect_all_slave_addrs_by_fd(int fd) { bool debug = false; DBGMSF(debug, "Starting. fd=%d", fd); assert (fd >= 0); bool * addrmap = NULL; unsigned char byte_to_write = 0x00; int addr; addrmap = calloc(I2C_SLAVE_ADDR_MAX, sizeof(bool)); //bool addrmap[128] = {0}; for (addr = 3; addr < I2C_SLAVE_ADDR_MAX; addr++) { int rc; i2c_set_addr(fd, addr, CALLOPT_ERR_ABORT || CALLOPT_ERR_MSG); rc = invoke_i2c_reader(fd, 1, &byte_to_write); if (rc >= 0) addrmap[addr] = true; } DBGMSF(debug, "Returning %p", addrmap); return addrmap; } /* Examines all possible addresses on an I2C bus. * * Arguments: * busno bus number * * Returns: * 128 byte boolean array, * NULL if unable to open I2C bus * * This "exploratory" function is not currently used but is * retained for diagnostic purposes. */ bool * i2c_detect_all_slave_addrs(int busno) { bool debug = false; DBGMSF(debug, "Starting. busno=%d", busno); int file = i2c_open_bus(busno, CALLOPT_ERR_MSG); // return if failure bool * addrmap = NULL; if (file >= 0) { addrmap = i2c_detect_all_slave_addrs_by_fd(file); i2c_close_bus(file, busno, CALLOPT_ERR_ABORT); } DBGMSF(debug, "Returning %p", addrmap); return addrmap; } #endif /** Checks DDC related addresses on an I2C bus to see if the addresses are active. * The bus device has already been opened. * * \param fd file descriptor for open i2c device * \param presult where to return result byte * \return status code, 0 if success * * Sets: * Returns byte with flags possibly set: * I2C_BUS_ADDR_0x30 true if addr x30 responds (EDID block selection) * I2C_BUS_ADDR_0x50 true if addr x50 responds (EDID) * I2C_BUS_ADDR_0x37 true if addr x37 responds (DDC commands) */ // static Status_Errno_DDC i2c_detect_ddc_addrs_by_fd(int fd, Byte * presult) { bool debug = false; DBGMSF(debug, "Starting. fd=%d", fd); assert(fd >= 0); unsigned char result = 0x00; Byte readbuf; // 1 byte buffer Byte writebuf = {0x00}; Status_Errno_DDC base_rc = 0; base_rc = i2c_set_addr(fd, 0x30, CALLOPT_ERR_MSG); // CALLOPT_ERR_MSG temporary if (base_rc < 0) { goto bye; } base_rc = invoke_i2c_writer(fd, 1, &writebuf); // DBGMSG("invoke_i2c_writer() returned %s", psc_desc(rc)); if (base_rc == 0) result |= I2C_BUS_ADDR_0X30; base_rc = i2c_set_addr(fd, 0x50, CALLOPT_ERR_MSG); // CALLOPT_ERR_MSG temporary if (base_rc < 0) { goto bye; } base_rc = invoke_i2c_reader(fd, 1, &readbuf); if (base_rc == 0) result |= I2C_BUS_ADDR_0X50; base_rc = i2c_set_addr(fd, 0x37, CALLOPT_ERR_MSG); // CALLOPT_ERR_MSG temporary if (base_rc < 0) { goto bye; } base_rc = invoke_i2c_reader(fd, 1, &readbuf); // DBGMSG("call_read() returned %d", rc); // 11/2015: DDCRC_READ_ALL_ZERO currently set only in ddc_packet_io.c: if (base_rc == 0 || base_rc == DDCRC_READ_ALL_ZERO) result |= I2C_BUS_ADDR_0X37; base_rc = 0; bye: if (base_rc != 0) result = 0x00; *presult = result; DBGMSF(debug, "Done. Returning base_rc=%d, *presult = 0x%02x", base_rc, *presult); return base_rc; } // // I2C Bus Inspection - EDID Retrieval // /** Gets EDID bytes of a monitor on an open I2C device. * * @param fd file descriptor for open /dev/i2c-n * @param rawedid buffer in which to return first 128 bytes of EDID * * @retval 0 success * @retval <0 error */ Public_Status_Code i2c_get_raw_edid_by_fd(int fd, Buffer * rawedid) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Getting EDID for file %d", fd); bool conservative = true; assert(rawedid->buffer_size >= 128); Public_Status_Code rc; rc = i2c_set_addr(fd, 0x50, CALLOPT_ERR_MSG); if (rc < 0) { goto bye; } // 10/23/15, try disabling sleep before write if (conservative) sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, "before write"); Byte byte_to_write = 0x00; int max_tries = 3; for (int tryctr = 0; tryctr < max_tries; tryctr++) { rc = invoke_i2c_writer(fd, 1, &byte_to_write); if (rc == 0) { rc = invoke_i2c_reader(fd, 128, rawedid->bytes); assert(rc <= 0); if (rc == 0) { rawedid->len = 128; if (debug) { DBGMSG("call_read returned:", NULL); dbgrpt_buffer(rawedid, 1); DBGMSG("edid checksum = %d", edid_checksum(rawedid->bytes) ); } Byte checksum = edid_checksum(rawedid->bytes); if (checksum != 0) { // possible if successfully read bytes from i2c bus with no monitor // attached - the bytes will be junk. // e.g. nouveau driver, Quadro card, on blackrock DBGTRC(debug, TRACE_GROUP, "Invalid EDID checksum %d, expected 0.", checksum); rawedid->len = 0; rc = DDCRC_EDID; } } if (rc == 0) break; } if (tryctr < max_tries) DBGTRC(debug, TRACE_GROUP, "Retrying EDID read. tryctr=%d, max_tries=%d", tryctr, max_tries); } bye: if (rc < 0) rawedid->len = 0; DBGTRC(debug, TRACE_GROUP, "Returning %s. edidbuf contents:", psc_desc(rc)); if (debug || IS_TRACING()) { buffer_dump(rawedid); } return rc; } /** Returns a parsed EDID record for the monitor on an I2C bus. * * @param fd file descriptor for open /dev/i2c-n * @param edid_ptr_loc where to return pointer to newly allocated #Parsed_Edid, * or NULL if error * * @return status code */ Public_Status_Code i2c_get_parsed_edid_by_fd(int fd, Parsed_Edid ** edid_ptr_loc) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. fd=%d\n", fd); Parsed_Edid * edid = NULL; Buffer * rawedidbuf = buffer_new(128, NULL); Public_Status_Code rc = i2c_get_raw_edid_by_fd(fd, rawedidbuf); if (rc == 0) { edid = create_parsed_edid(rawedidbuf->bytes); if (debug) { if (edid) report_parsed_edid(edid, false /* dump hex */, 0); else DBGMSG("create_parsed_edid() returned NULL", NULL); } if (!edid) rc = DDCRC_EDID; } else if (rc == DDCRC_EDID) { DBGTRC(debug, TRACE_GROUP, "i2c_get_raw_edid_by_fd() returned %s", psc_desc(rc)); } buffer_free(rawedidbuf, NULL); DBGTRC(debug, TRACE_GROUP, "Returning %p", edid); *edid_ptr_loc = edid; return rc; } // // I2C Bus Inspection - Fill in and report Bus_Info // /** Allocates and initializes a new #I2C_Bus_Info struct * * @param busno I2C bus number * @return newly allocated #I2C_Bus_Info */ static I2C_Bus_Info * i2c_new_bus_info(int busno) { I2C_Bus_Info * businfo = calloc(1, sizeof(I2C_Bus_Info)); memcpy(businfo->marker, I2C_BUS_INFO_MARKER, 4); businfo->busno = busno; return businfo; } /** Inspects an I2C bus. * * Takes the number of the bus to be inspected from the #I2C_Bus_Info struct passed * as an argument. * * @param bus_info pointer to #I2C_Bus_Info struct in which information will be set */ static void i2c_check_bus(I2C_Bus_Info * bus_info) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. busno=%d, buf_info=%p", bus_info->busno, bus_info ); assert(bus_info); assert( memcmp(bus_info->marker, I2C_BUS_INFO_MARKER, 4) == 0); int file = 0; if (!(bus_info->flags & I2C_BUS_PROBED)) { DBGMSF(debug, "Probing", NULL); bus_info->flags |= I2C_BUS_PROBED; // unnecessary, bus_info is already filtered // probing hangs on PowerMac if i2c device is SMU // if (!is_ignorable_i2c_device(bus_info->busno)) { file = i2c_open_bus(bus_info->busno, CALLOPT_ERR_MSG); // returns if failure if (file >= 0) { bus_info->flags |= I2C_BUS_ACCESSIBLE; Byte ddc_addr_flags = 0x00; Status_Errno_DDC psc = i2c_detect_ddc_addrs_by_fd(file, &ddc_addr_flags); if (psc != 0) { DBGMSF(debug, "detect_ddc_addrs_by_fd() returned %d", psc); f0printf(FERR, "Failure detecting bus addresses for /dev/i2c-%d: status code=%s\n", bus_info->busno, psc_desc(psc)); goto bye; } bus_info->flags |= ddc_addr_flags; // DBGMSF(debug, "Calling i2c_get_functionality_flags_by_fd()..."); bus_info->functionality = i2c_get_functionality_flags_by_fd(file); // DBGMSF(debug, "i2c_get_functionality_flags_by_fd() returned %lu", bus_info->functionality); if (bus_info->flags & I2C_BUS_ADDR_0X50) { // Have seen case of nouveau driver with Quadro card where // there's a bus that has no monitor but responds to the X50 probe // of detect_ddc_addrs_by_fd() and then returns a garbage EDID // when the bytes are read in i2c_get_parsed_edid_by_fd() // TODO: handle case of i2c_get_parsed_edid_by_fd() returning NULL // but should never fail if detect_ddc_addrs_by_fd() succeeds psc = i2c_get_parsed_edid_by_fd(file, &bus_info->edid); if (psc != 0) { DBGMSF(debug, "i2c_get_parsed_edid_by_fd() returned %d", psc); f0printf(FERR, "Failure getting EDID for /dev/i2c-%d: status code=%s\n", bus_info->busno, psc_desc(psc)); goto bye; } // bus_info->flags |= I2C_BUS_EDID_CHECKED; } #ifdef NO // test is being made in ddc_displays.c if (bus_info->flags & I2C_BUS_ADDR_0X37) { // have seen case where laptop display reports addr 37 active, but // it doesn't respond to DDC // TODO: sanity check for DDC goes here // or make this check at a higher level, since I2c doesn't understand DDC } #endif } } // } bye: if (file >= 0) i2c_close_bus(file, bus_info->busno, CALLOPT_ERR_MSG); DBGTRC(debug, TRACE_GROUP, "Done. flags=0x%02x", bus_info->flags ); } static void i2c_free_bus_info(I2C_Bus_Info * bus_info) { if (bus_info) { if ( memcmp(bus_info->marker, "BINx", 4) != 0) { // just ignore if already freed assert( memcmp(bus_info->marker, I2C_BUS_INFO_MARKER, 4) == 0); if (bus_info->edid) free_parsed_edid(bus_info->edid); bus_info->marker[3] = 'x'; free(bus_info); } } } // // Bus Reports // // Why are there 2 functions? Consolidate? // only difference is that i2c_debugreport_bus_info() shows EDID #ifdef UNUSED void i2c_dbgreport_bus_info_flags(I2C_Bus_Info * bus_info, int depth) { bool debug = false; DBGMSF(debug, "Starting. bus_info=%p"); rpt_vstring(depth, "Bus /dev/i2c-%d found: %s", bus_info->busno, bool_repr(bus_info->flags&I2C_BUS_EXISTS)); rpt_vstring(depth, "Bus /dev/i2c-%d probed: %s", bus_info->busno, bool_repr(bus_info->flags&I2C_BUS_PROBED )); if ( bus_info->flags & I2C_BUS_PROBED ) { rpt_vstring(depth, "Address 0x30 present: %s", bool_repr(bus_info->flags & I2C_BUS_ADDR_0X30)); rpt_vstring(depth, "Address 0x37 present: %s", bool_repr(bus_info->flags & I2C_BUS_ADDR_0X37)); rpt_vstring(depth, "Address 0x50 present: %s", bool_repr(bus_info->flags & I2C_BUS_ADDR_0X50)); } i2c_report_functionality_flags(bus_info->functionality, /* maxline */ 90, depth); DBGMSF(false, "Done"); } #endif /** Reports on a single I2C bus. * * \param bus_info pointer to Bus_Info structure describing bus * \param depth logical indentation depth * * \remark * The format of the output as well as its extent is controlled by get_output_level(). - no longer! */ // used by dbgreport_display_ref() in ddc_displays.c, always OL_VERBOSE // used by debug code within this file // used by i2c_report_buses() in this file, which is called by query_i2c_buses() in query_sysenv.c, always OL_VERBOSE void i2c_dbgrpt_bus_info(I2C_Bus_Info * bus_info, int depth) { bool debug = false; DBGMSF(debug, "bus_info=%p", bus_info); assert(bus_info); // rpt_nl(); rpt_vstring(depth, "Bus /dev/i2c-%d found: %s", bus_info->busno, bool_repr(bus_info->flags&I2C_BUS_EXISTS)); rpt_vstring(depth, "Bus /dev/i2c-%d probed: %s", bus_info->busno, bool_repr(bus_info->flags&I2C_BUS_PROBED )); if ( bus_info->flags & I2C_BUS_PROBED ) { rpt_vstring(depth, "Address 0x30 present: %s", bool_repr(bus_info->flags & I2C_BUS_ADDR_0X30)); rpt_vstring(depth, "Address 0x37 present: %s", bool_repr(bus_info->flags & I2C_BUS_ADDR_0X37)); rpt_vstring(depth, "Address 0x50 present: %s", bool_repr(bus_info->flags & I2C_BUS_ADDR_0X50)); i2c_report_functionality_flags(bus_info->functionality, /* maxline */ 90, depth); if ( bus_info->flags & I2C_BUS_ADDR_0X50) { if (bus_info->edid) { report_parsed_edid(bus_info->edid, true /* verbose */, depth); } } } DBGMSF(debug, "Done", NULL); } /** Reports a single active display. * * Output is written to the current report destination. * * @param businfo bus record * @param depth logical indentation depth */ // used by detect, interrogate commands, C API void i2c_report_active_display(I2C_Bus_Info * businfo, int depth) { DDCA_Output_Level output_level = get_output_level(); rpt_vstring(depth, "I2C bus: /dev/i2c-%d", businfo->busno); if (output_level >= DDCA_OL_NORMAL) rpt_vstring(depth, "Supports DDC: %s", bool_repr(businfo->flags & I2C_BUS_ADDR_0X37)); if (output_level >= DDCA_OL_VERBOSE) { rpt_vstring(depth+1, "I2C address 0x30 (EDID block#) present: %-5s", bool_repr(businfo->flags & I2C_BUS_ADDR_0X30)); rpt_vstring(depth+1, "I2C address 0x37 (DDC) present: %-5s", bool_repr(businfo->flags & I2C_BUS_ADDR_0X37)); rpt_vstring(depth+1, "I2C address 0x50 (EDID) present: %-5s", bool_repr(businfo->flags & I2C_BUS_ADDR_0X50)); char fn[PATH_MAX]; // yes, PATH_MAX is dangerous, but not as used here sprintf(fn, "/sys/bus/i2c/devices/i2c-%d/name", businfo->busno); char * sysattr_name = file_get_first_line(fn, /* verbose*/ false); rpt_vstring(depth+1, "%s: %s", fn, sysattr_name); free(sysattr_name); } if (businfo->edid) { switch(output_level) { case DDCA_OL_TERSE: rpt_vstring(depth, "Monitor: %s:%s:%s", businfo->edid->mfg_id, businfo->edid->model_name, businfo->edid->serial_ascii); break; case DDCA_OL_NORMAL: report_parsed_edid(businfo->edid, false, depth); break; case DDCA_OL_VERBOSE: report_parsed_edid(businfo->edid, true, depth); break; } } } // // Simple Bus Detection // /** Checks if an I2C bus with a given number exists. * * @param busno bus number * * @return true/false */ bool i2c_device_exists(int busno) { bool result = false; bool debug = false; int errsv; char namebuf[20]; struct stat statbuf; int rc = 0; sprintf(namebuf, "/dev/i2c-%d", busno); errno = 0; rc = stat(namebuf, &statbuf); errsv = errno; if (rc == 0) { DBGMSF(debug, "Found %s", namebuf); result = true; } else { DBGMSF(debug, "stat(%s) returned %d, errno=%s", namebuf, rc, linux_errno_desc(errsv) ); } DBGMSF(debug, "busno=%d, returning %s", busno, bool_repr(result) ); return result; } /** Returns the number of I2C buses on the system, by looking for * devices named /dev/i2c-n. * * Note that no attempt is made to open the devices. */ int i2c_device_count() { bool debug = false; int busct = 0; for (int busno=0; busno < I2C_BUS_MAX; busno++) { if (i2c_device_exists(busno)) busct++; } DBGTRC(debug, TRACE_GROUP, "Returning %d", busct ); return busct; } // // Bus inventory // int i2c_detect_buses() { bool debug = false; DBGMSF(debug, "Starting. i2c_buses = %p", i2c_buses); if (!i2c_buses) { Byte_Value_Array i2c_bus_bva = get_i2c_device_numbers_using_udev(false); // TODO: set free function i2c_buses = g_ptr_array_sized_new(bva_length(i2c_bus_bva)); for (int ndx = 0; ndx < bva_length(i2c_bus_bva); ndx++) { int busno = bva_get(i2c_bus_bva, ndx); DBGMSF(debug, "busno = %d", busno); I2C_Bus_Info * businfo = i2c_new_bus_info(busno); businfo->flags = I2C_BUS_EXISTS; i2c_check_bus(businfo); if (debug) i2c_dbgrpt_bus_info(businfo, 0); g_ptr_array_add(i2c_buses, businfo); } } int result = i2c_buses->len; DBGMSF(debug, "Returning: %d", result); return result; } I2C_Bus_Info * detect_single_bus(int busno) { bool debug = false; DBGMSF(debug, "Starting. busno = %d", busno); I2C_Bus_Info * businfo = NULL; if (i2c_device_exists(busno) ) { businfo = i2c_new_bus_info(busno); businfo->flags = I2C_BUS_EXISTS; i2c_check_bus(businfo); if (debug) i2c_dbgrpt_bus_info(businfo, 0); } DBGMSF(debug, "Done. busnp=%d, returning: %p", busno, businfo); return businfo; } // // Bus_Info retrieval // // Simple Bus_Info retrieval /** Retrieves bus information by its index in the i2c_buses array * * @param busndx * * @return pointer to Bus_Info struct for the bus,\n * NULL if invalid index */ I2C_Bus_Info * i2c_get_bus_info_by_index(int busndx) { assert(busndx >= 0); assert(i2c_buses); bool debug = false; DBGMSF(debug, "Starting. busndx=%d", busndx ); I2C_Bus_Info * bus_info = NULL; int busct = i2c_buses->len; assert(busndx < busct); bus_info = g_ptr_array_index(i2c_buses, busndx); // report_businfo(busInfo); if (debug) { DBGMSG("flags=0x%02x", bus_info->flags); DBGMSG("flags & I2C_BUS_PROBED = 0x%02x", (bus_info->flags & I2C_BUS_PROBED) ); } assert( bus_info->flags & I2C_BUS_PROBED ); #ifdef OLD if (!(bus_info->flags & I2C_BUS_PROBED)) { // DBGMSG("Calling check_i2c_bus()"); i2c_check_bus(bus_info); } #endif DBGMSF(debug, "busndx=%d, returning %p", busndx, bus_info ); return bus_info; } /** Retrieves bus information by I2C bus number. * * If the bus information does not already exist in the #I2C_Bus_Info struct for the * bus, it is calculated by calling check_i2c_bus() * * @param busno bus number * * @return pointer to Bus_Info struct for the bus,\n * NULL if invalid bus number */ I2C_Bus_Info * i2c_find_bus_info_by_busno(int busno) { bool debug = false; DBGMSF(debug, "Starting. busno=%d", busno); assert(i2c_buses); // fails if using temporary dref I2C_Bus_Info * result = NULL; for (int ndx = 0; ndx < i2c_buses->len; ndx++) { I2C_Bus_Info * cur_info = g_ptr_array_index(i2c_buses, ndx); if (cur_info->busno == busno) { result = cur_info; break; } } DBGMSF(debug, "Done. Returning: %p", result); return result; } // Generalized Bus_Info search // // Overkill for current use. // Was coded at the time when selecting display by criteria occurred at the i2c/ad/usb // level rather than in ddc_displays.c. // Still used by USB layer as a fallback to find the EDID by model etc. // if the EDID can't be gotten from USB services. typedef struct { int busno; const char * mfg_id; const char * model_name; const char * serial_ascii; const Byte * edidbytes; Byte options; } I2C_Bus_Selector; static void report_i2c_bus_selector(I2C_Bus_Selector * sel, int depth) { int d1 = depth+1; int d2 = depth+2; rpt_structure_loc("I2C_Bus_Selector", sel, depth); rpt_int("busno", NULL, sel->busno, d1); rpt_str("mfg_id", NULL, sel->mfg_id, d1); rpt_str("model_name", NULL, sel->model_name, d1); rpt_str("serial_ascii", NULL, sel->serial_ascii, d1); rpt_structure_loc("edidbytes", sel->edidbytes, d1); if (sel->edidbytes) rpt_hex_dump(sel->edidbytes, 128, d2); } static void init_i2c_bus_selector(I2C_Bus_Selector* sel) { assert(sel); memset(sel, 0, sizeof(I2C_Bus_Selector)); sel->busno = -1; } // Note: No need for free_i2c_bus_selector() function since strings and memory // pointed to by selector are always in other data structures /* Tests if a bus_info table entry matches the criteria of a selector. * * Arguments: * bus_info pointer to Bus_Info instance to test * sel selection criteria * * Returns: true/false */ static bool bus_info_matches_selector(I2C_Bus_Info * bus_info, I2C_Bus_Selector * sel) { bool debug = false; if (debug) { DBGMSG("Starting", NULL); i2c_dbgrpt_bus_info(bus_info, 1); } assert( bus_info && sel); assert( sel->busno >= 0 || sel->mfg_id || sel->model_name || sel->serial_ascii || sel->edidbytes); bool result = false; // does the bus represent a valid display? if (sel->options & DISPSEL_VALID_ONLY) { if (!(bus_info->flags & I2C_BUS_ADDR_0X37)) goto bye; } bool some_test_passed = false; if (sel->busno >= 0) { DBGMSF(debug, "bus_info->busno = %d", bus_info->busno); if (sel->busno != bus_info->busno) { result = false; goto bye; } DBGMSF(debug, "busno test passed", NULL); some_test_passed = true; } Parsed_Edid * edid = bus_info->edid; // will be NULL for I2C bus with no monitor if (sel->mfg_id && strlen(sel->mfg_id) > 0) { if ((!edid) || strlen(edid->mfg_id) == 0 || !streq(sel->mfg_id, edid->mfg_id) ) { result = false; goto bye; } some_test_passed = true; } if (sel->model_name && strlen(sel->model_name) > 0) { if ((!edid) || strlen(edid->model_name) == 0 || !streq(sel->model_name, edid->model_name) ) { result = false; goto bye; } some_test_passed = true; } if (sel->serial_ascii && strlen(sel->serial_ascii) > 0) { if ((!edid) || strlen(edid->serial_ascii) == 0 || !streq(sel->serial_ascii, edid->serial_ascii) ) { result = false; goto bye; } some_test_passed = true; } if (sel->edidbytes) { if ((!edid) || !memcmp(sel->edidbytes, edid->bytes, 128) != 0 ) { result = false; goto bye; } some_test_passed = true; } if (some_test_passed) result = true; bye: DBGMSF(debug, "Returning: %s", bool_repr(result)); return result; } /* Finds the first Bus_Info instance that matches a selector * * Arguments: * sel pointer to selection criteria * * Returns: pointer to Bus_Info instance if found, NULL if not */ static I2C_Bus_Info * find_bus_info_by_selector(I2C_Bus_Selector * sel) { assert(sel); bool debug = false; if (debug) { DBGMSG("Starting.", NULL); report_i2c_bus_selector(sel, 1); } I2C_Bus_Info * bus_info = NULL; assert(i2c_buses); int busct = i2c_buses->len; for (int ndx = 0; ndx < busct; ndx++) { I2C_Bus_Info * cur_info = g_ptr_array_index(i2c_buses, ndx); if (bus_info_matches_selector(cur_info, sel)) { bus_info = cur_info; break; } } DBGMSF(debug, "returning %p", bus_info ); if (debug && bus_info) { i2c_dbgrpt_bus_info(bus_info, 1); } return bus_info; } // Finally, functions that use the generalized bus selection mechanism /** Retrieves bus information by some combination of the monitor's * mfg id, model name and/or serial number. * * @param mfg_id 3 character manufacturer id * @param model monitor model (as listed in the EDID) * @param sn monitor ascii serial number (as listed in the EDID) * @param findopts selector options * * @return pointer to Bus_Info struct for the bus,\n * NULL if not found * * @remark used by get_fallback_hiddev_edid() in usb_edid.c */ I2C_Bus_Info * i2c_find_bus_info_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn, Byte findopts) { bool debug = false; DBGMSF(debug, "Starting. mfg_id=|%s|, model=|%s|, sn=|%s|", mfg_id, model, sn ); assert(mfg_id || model || sn); // loosen the requirements I2C_Bus_Selector sel; init_i2c_bus_selector(&sel); sel.mfg_id = mfg_id; sel.model_name = model; sel.serial_ascii = sn; sel.options = findopts; I2C_Bus_Info * result = find_bus_info_by_selector(&sel); DBGMSF(debug, "Returning: %p", result ); return result; } // // I2C Bus Inquiry // #ifdef UNUSED /** Checks whether an I2C bus supports DDC. * * @param busno I2C bus number * @param callopts standard call options, used to control error messages * * @return true or false */ bool i2c_is_valid_bus(int busno, Call_Options callopts) { bool emit_error_msg = callopts & CALLOPT_ERR_MSG; bool debug = false; if (debug) { char * s = interpret_call_options_a(callopts); DBGMSG("Starting. busno=%d, callopts=%s", busno, s); free(s); } bool result = false; char * complaint = NULL; // Bus_Info * businfo = i2c_get_bus_info(busno, DISPSEL_NONE); I2C_Bus_Info * businfo = i2c_find_bus_info_by_busno(busno); if (debug && businfo) i2c_dbgrpt_bus_info(businfo, 1); bool overridable = false; if (!businfo) complaint = "I2C bus not found:"; else if (!(businfo->flags & I2C_BUS_EXISTS)) complaint = "I2C bus not found: /dev/i2c-%d\n"; else if (!(businfo->flags & I2C_BUS_ACCESSIBLE)) complaint = "Inaccessible I2C bus:"; else if (!(businfo->flags & I2C_BUS_ADDR_0X50)) { complaint = "No monitor found on bus"; overridable = true; } else if (!(businfo->flags & I2C_BUS_ADDR_0X37)) complaint = "Cannot communicate DDC on I2C bus slave address 0x37"; else result = true; if (complaint && emit_error_msg) { f0printf(FERR, "%s /dev/i2c-%d\n", complaint, busno); } if (complaint && overridable && (callopts & CALLOPT_FORCE)) { f0printf(FERR, "Continuing. --force option was specified.\n"); result = true; } DBGMSF(debug, "Returning %s", bool_repr(result)); return result; } #endif /** Reports I2C buses. * * @param report_all if false, only reports buses with monitors,\n * if true, reports all detected buses * @param depth logical indentation depth * * @return count of reported buses * * @remark * Used by query-sysenv.c, always OL_VERBOSE */ int i2c_report_buses(bool report_all, int depth) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. report_all=%s\n", bool_repr(report_all)); assert(i2c_buses); int busct = i2c_buses->len; int reported_ct = 0; puts(""); if (report_all) rpt_vstring(depth,"Detected %d I2C buses:", busct); else rpt_vstring(depth, "I2C buses with monitors detected at address 0x50:"); for (int ndx = 0; ndx < busct; ndx++) { I2C_Bus_Info * busInfo = g_ptr_array_index(i2c_buses, ndx); if ( (busInfo->flags & I2C_BUS_ADDR_0X50) || report_all) { rpt_nl(); i2c_dbgrpt_bus_info(busInfo, depth); reported_ct++; } } if (reported_ct == 0) rpt_vstring(depth, " No buses\n"); DBGTRC(debug, TRACE_GROUP, "Done. Returning %d\n", reported_ct); return reported_ct; } // // For test driver use only // static bool is_function_supported(int busno, char * funcname) { bool debug = false; DBGMSF(debug, "Starting. busno=%d, funcname=%s", busno, funcname); bool result = true; if ( !streq(funcname, "read") && !streq(funcname, "write") ) { uint32_t func_bit = vnt_find_id( functionality_table2, funcname, true, // search title field false, // ignore_case, 0x00); // default_id); if (!func_bit) { DBGMSG("Unrecognized function name: %s", funcname); result = false; goto bye; } // DBGMSG("functionality=0x%lx, func_table_entry->bit=-0x%lx", bus_infos[busno].functionality, func_table_entry->bit); // Bus_Info * bus_info = i2c_get_bus_info(busno, DISPSEL_NONE); // Bus_Info * bus_info = i2c_get_bus_info_new(busno); I2C_Bus_Info * bus_info = detect_single_bus(busno); if ( !bus_info ) { DBGMSG("Invalid bus: /dev/i2c-%d", busno); result = false; } else // add unneeded else clause to avoid clang warning result = (bus_info->functionality & func_bit) != 0; i2c_free_bus_info(bus_info); } bye: DBGMSF(debug, "busno=%d, funcname=%s, returning %d", busno, funcname, result); return result; } /** Verify that the specified I2C write and read functions are supported. * * This function is used in test management. * * @param busno I2C bus number * @param write_func_name write function name * @param read_func_name read function name * * @return true/false */ bool i2c_verify_functions_supported(int busno, char * write_func_name, char * read_func_name) { // printf("(%s) Starting. busno=%d, write_func_name=%s, read_func_name=%s\n", // __func__, busno, write_func_name, read_func_name); bool write_supported = is_function_supported(busno, write_func_name); bool read_supported = is_function_supported(busno, read_func_name); if (!write_supported) printf("Unsupported write function: %s\n", write_func_name ); if (!read_supported) printf("Unsupported read function: %s\n", read_func_name ); bool result =write_supported && read_supported; // DBGMSG("returning %d", result); return result; } ddcutil-0.8.6/src/i2c/i2c_do_io.c0000644000175000001440000001017413226557567013355 00000000000000/* i2c_do_io.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Allows for alternative mechanisms to read and write to the IC2 bus. */ /** \cond */ #include #include /** \endcond */ #include "util/string_util.h" #include "base/core.h" #include "base/parms.h" #include "base/status_code_mgt.h" #include "i2c/i2c_base_io.h" #include "i2c/i2c_do_io.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_I2C; I2C_IO_Strategy i2c_file_io_strategy = { write_writer, read_reader, "read_writer", "read_reader" }; I2C_IO_Strategy i2c_ioctl_io_strategy = { ioctl_writer, ioctl_reader, "ioctl_writer", "ioctl_reader" }; static I2C_IO_Strategy * i2c_io_strategy = &i2c_file_io_strategy; // default strategy /** Sets an alternative I2C IO strategy. * * @param strategy_id I2C IO strategy id */ void i2c_set_io_strategy(I2C_IO_Strategy_Id strategy_id) { switch (strategy_id) { case (I2C_IO_STRATEGY_FILEIO): i2c_io_strategy = &i2c_file_io_strategy; break; case (I2C_IO_STRATEGY_IOCTL): i2c_io_strategy= &i2c_ioctl_io_strategy; break; } } /** Writes to the I2C bus, using the function specified in the * currently active strategy. * * @param fh file handle for open /dev/i2c bus * @param bytect number of bytes to write * @param bytes_to_write pointer to bytes to be written * @return status code */ Status_Errno_DDC invoke_i2c_writer( int fh, int bytect, Byte * bytes_to_write) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "writer=%s, bytes_to_write=%s", i2c_io_strategy->i2c_writer_name, hexstring_t(bytes_to_write, bytect)); Status_Errno_DDC rc; RECORD_IO_EVENT( IE_WRITE, ( rc = i2c_io_strategy->i2c_writer(fh, bytect, bytes_to_write ) ) ); // DBGMSF(debug, "writer() function returned %d", rc); assert (rc <= 0); DBGTRC(debug, TRACE_GROUP, "Returning rc=%s", psc_desc(rc)); return rc; } /** Reads from the I2C bus, using the function specified in the * currently active strategy. * * @param fh file handle for open /dev/i2c bus * @param bytect number of bytes to read * @param readbuf location where bytes will be read to * @return status code */ Status_Errno_DDC invoke_i2c_reader( int fh, int bytect, Byte * readbuf) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "reader=%s, bytect=%d", i2c_io_strategy->i2c_reader_name, bytect); Status_Errno_DDC rc; RECORD_IO_EVENT( IE_READ, ( rc = i2c_io_strategy->i2c_reader(fh, bytect, readbuf) ) ); assert (rc <= 0); DBGTRC(debug, TRACE_GROUP, "Returning rc=%s", psc_desc(rc)); return rc; } #ifdef TEST_THAT_DIDNT_WORK // fails Status_Errno_DDC invoke_single_byte_i2c_reader( int fh, int bytect, Byte * readbuf) { bool debug = false; DBGMSF(debug, "bytect=%d", bytect); Status_Errno_DDC psc = 0; int ndx = 0; for (;ndx < bytect; ndx++) { psc = invoke_i2c_reader(fh, 1, readbuf+ndx); if (psc != 0) break; // call_tuned_sleep_i2c(SE_POST_READ); } DBGMSF(debug, "Returning psc=%s", psc_desc(psc)); return psc; } #endif ddcutil-0.8.6/src/i2c/wrap_i2c-dev.h0000644000175000001440000000403713230445447014003 00000000000000/* wrap_i2c-dev.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef WRAP_I2C_DEV_H_ #define WRAP_I2C_DEV_H_ /* Including file i2c-dev.h presents multiple issues. * This header file addresses those issues in one place. * * Currently this file is included by i2c_base_io.c and i2c_do_io.c. * * This code is in a separate file instead of an existing header * file because it is not part of the public interface of any * header file. */ // On Fedora 23 and SUSE 13.2, there is no problem with NULL. // But on Fedora 22 and SUSE 13.1, we get an error that NULL is // undefined. Including stddef.h does not solve the problem - apparently // the dummy version in /usr/include/linux/i2c-dev.h is picked up. // This hack seems to solve that problem. #ifndef NULL #define NULL ((void*)0) #endif // On Fedora, i2c-dev.h is minimal. i2c.h is required for struct i2c_msg and // other stuff. On Ubuntu and SuSE, including both causes redefinition errors. // If I2C_FUNC_I2C is not defined, the definition is present in the full version // of i2c-dev.h but not in the abbreviated version, so i2c.h must be included. #include #ifndef I2C_FUNC_I2C #include #endif #endif /* WRAP_I2C_DEV_H_ */ ddcutil-0.8.6/src/i2c/i2c_base_io.h0000644000175000001440000000371113230445447013655 00000000000000/* i2c_base_io.h * * Low level functions for writing to and reading from the I2C bus, * using various mechanisms. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Low level functions for writing to and reading from the I2C bus, * using various mechanisms. */ #ifndef I2C_BASE_IO_H_ #define I2C_BASE_IO_H_ #include "util/coredefs.h" #include "base/status_code_mgt.h" /** Function template for I2C write function */ typedef Status_Errno_DDC (*I2C_Writer)(int fh, int bytect, Byte * bytes_to_write); /** Function template for I2C read function */ typedef Status_Errno_DDC (*I2C_Reader)(int fh, int bytect, Byte * readbuf); Status_Errno_DDC write_writer(int fh, int bytect, Byte * pbytes); Status_Errno_DDC read_reader (int fh, int bytect, Byte * readbuf); Status_Errno_DDC ioctl_writer(int fh, int bytect, Byte * pbytes); Status_Errno_DDC ioctl_reader(int fh, int bytect, Byte * readbuf); // Don't work: Status_Errno_DDC i2c_smbus_write_i2c_block_data_writer(int fh, int bytect, Byte * bytes_to_write); Status_Errno_DDC i2c_smbus_read_i2c_block_data_reader(int fh, int bytect, Byte * readbuf); #endif /* I2C_BASE_IO_H_ */ ddcutil-0.8.6/src/i2c/i2c_do_io.h0000644000175000001440000000404713230445447013350 00000000000000/* i2c_do_io.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ #ifndef I2C_DO_IO_H_ #define I2C_DO_IO_H_ #include "util/coredefs.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" #include "i2c/i2c_base_io.h" /** Describes one I2C IO strategy */ typedef struct { I2C_Writer i2c_writer; ///< writer function I2C_Reader i2c_reader; ///< read function char * i2c_writer_name; ///< write function name char * i2c_reader_name; ///< read function name } I2C_IO_Strategy; // may need to move this definition to base /** I2C IO strategy ids */ typedef enum { I2C_IO_STRATEGY_FILEIO, ///< use file write() and read() I2C_IO_STRATEGY_IOCTL} ///< use ioctl(I2C_RDWR) I2C_IO_Strategy_Id; void i2c_set_io_strategy(I2C_IO_Strategy_Id strategy_id); Status_Errno_DDC invoke_i2c_writer( int fh, int bytect, Byte * bytes_to_write); Status_Errno_DDC invoke_i2c_reader( int fh, int bytect, Byte * readbuf); #ifdef TEST_THAT_DIDNT_WORK Status_Errno_DDC invoke_single_byte_i2c_reader( int fh, int bytect, Byte * readbuf); #endif #endif /* I2C_DO_IO_H_ */ ddcutil-0.8.6/src/i2c/i2c_bus_core.h0000644000175000001440000001016413230445447014055 00000000000000/* i2c_bus_core.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * I2C bus detection and inspection */ #ifndef I2C_BUS_CORE_H_ #define I2C_BUS_CORE_H_ /** \cond */ // #include // #include #include #include /** \endcond */ #include "util/edid.h" #include "util/data_structures.h" #include "base/core.h" #include "base/displays.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" /** \def I2C_BUS_MAX maximum number of i2c buses this code supports */ #define I2C_BUS_MAX 32 /** \def I2C_SLAVE_ADDR_MAX Addresses on an I2C bus are 7 bits in size */ #define I2C_SLAVE_ADDR_MAX 128 // Controls whether function #i2c_set_addr() retries from EBUSY error by // changing ioctl op I2C_SLAVE to op I2C_SLAVE_FORCE. extern bool i2c_force_slave_addr_flag; // Basic I2C bus operations int i2c_open_bus(int busno, Call_Options callopts); Status_Errno i2c_close_bus(int fd, int busno, Call_Options callopts); Status_Errno i2c_set_addr(int fd, int addr, Call_Options callopts); // Bus functionality flags unsigned long i2c_get_functionality_flags_by_fd(int fd); char * i2c_interpret_functionality_flags(unsigned long functionality); void i2c_report_functionality_flags(long functionality, int maxline, int depth); bool i2c_verify_functions_supported(int busno, char * write_func_name, char * read_func_name); // EDID inspection Public_Status_Code i2c_get_raw_edid_by_fd(int fd, Buffer * rawedid); Public_Status_Code i2c_get_parsed_edid_by_fd(int fd, Parsed_Edid ** edid_ptr_loc); // Retrieve and inspect bus information #define I2C_BUS_EXISTS 0x80 #define I2C_BUS_ACCESSIBLE 0x40 #define I2C_BUS_ADDR_0X50 0x20 ///< detected I2C bus address 0x50 #define I2C_BUS_ADDR_0X37 0x10 #define I2C_BUS_ADDR_0X30 0x08 // write-only addr to specify EDID block number #define I2C_BUS_PROBED 0x01 // has bus been checked? #define I2C_BUS_INFO_MARKER "BINF" /** Information about one I2C bus */ typedef struct { char marker[4]; ///< always "BINF" int busno; ///< I2C device number, i.e. N for /dev/i2c-N unsigned long functionality; ///< i2c bus functionality flags Parsed_Edid * edid; ///< parsed EDID, if slave address x50 active Byte flags; ///< I2C_BUS_* flags } I2C_Bus_Info; void i2c_dbgrpt_bus_info(I2C_Bus_Info * bus_info, int depth); void i2c_report_active_display(I2C_Bus_Info * businfo, int depth); // Simple bus detection, no side effects bool i2c_device_exists(int busno); int i2c_device_count(); // simple /dev/i2c-n count, no side effects // Bus inventory - detect and probe buses int i2c_detect_buses(); // creates internal array of Bus_Info for I2C buses I2C_Bus_Info * detect_single_bus(int busno); // Simple Bus_Info retrieval I2C_Bus_Info * i2c_get_bus_info_by_index(int busndx); I2C_Bus_Info * i2c_find_bus_info_by_busno(int busno); // Complex Bus_Info retrieval I2C_Bus_Info * i2c_find_bus_info_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn, Byte findopts); // Reports all detected i2c buses: int i2c_report_buses(bool report_all, int depth); #endif /* I2C_BUS_CORE_H_ */ ddcutil-0.8.6/src/adl/0000755000175000001440000000000013230445447011507 500000000000000ddcutil-0.8.6/src/adl/adl_impl/0000755000175000001440000000000013230445447013270 500000000000000ddcutil-0.8.6/src/adl/adl_impl/adl_aux_intf.c0000644000175000001440000001726113101546540016011 00000000000000/* adl_aux_intf.c */ /** \file * Functions in this file were originally part of adl_inf.c, * but with code refactoring are now only called from tests. */ /* * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \cond */ #include #include #include #include /** \endcond */ #include "util/string_util.h" #include "base/ddc_packets.h" #include "base/parms.h" #include "base/sleep.h" #include "adl/adl_impl/adl_friendly.h" #include "adl/adl_impl/adl_intf.h" #include "adl/adl_shim.h" #include "adl/adl_impl/adl_aux_intf.h" /** * @remark 10/2015: only used in adl_tests.c */ Base_Status_ADL adl_ddc_write_only_with_retry( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen) { if (adl_debug) { char * s = hexstring(pSendMsgBuf, sendMsgLen); DBGMSG("Starting. iAdapterIndex=%d, iDisplayIndex=%d, sendMsgLen=%d, pSendMsgBuf->%s", iAdapterIndex, iDisplayIndex, sendMsgLen, s); free(s); } int maxTries = 2; int tryctr = 0; bool can_retry = true; Base_Status_ADL rc; for (tryctr=0; tryctr < maxTries && can_retry; tryctr++) { rc = adl_ddc_write_only(iAdapterIndex, iDisplayIndex, pSendMsgBuf, sendMsgLen); if (rc == -1) { sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, "after adl_DDC_write_only"); } else can_retry=false; } if (adl_debug) DBGMSG("Returning %d. tryctr=%d", rc, tryctr); return rc; } /** * @remark 10/2015: only used in adl_tests.c */ Base_Status_ADL adl_ddc_write_read_with_retry( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect) { bool debug = false; if (debug) { char * s = hexstring(pSendMsgBuf, sendMsgLen); DBGMSG("Starting. iAdapterIndex=%d, iDisplayIndex=%d, sendMsgLen=%d, pSendMsgBuf->%s, *pRcvBytect=%d", iAdapterIndex, iDisplayIndex, sendMsgLen, s, *pRcvBytect); free(s); } int maxTries = 2; int tryctr = 0; bool can_retry = true; Base_Status_ADL rc; for (tryctr=0; tryctr < maxTries && can_retry; tryctr++) { rc = adl_ddc_write_read(iAdapterIndex, iDisplayIndex, pSendMsgBuf, sendMsgLen, pRcvMsgBuf, pRcvBytect); if (rc == -1) { sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, "after adl_DDC_write_read"); } else can_retry=false; } if (debug) DBGMSG("Returning %d. tryctr=%d", rc, tryctr); return rc; } /** * @remark 10/2015: unused */ Base_Status_ADL adl_ddc_write_read_with_retry_onecall( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect) { if (adl_debug) { char * s = hexstring(pSendMsgBuf, sendMsgLen); DBGMSG("Starting. iAdapterIndex=%d, iDisplayIndex=%d, sendMsgLen=%d, pSendMsgBuf->%s, *pRcvBytect=%d", iAdapterIndex, iDisplayIndex, sendMsgLen, s, *pRcvBytect); free(s); } int maxTries = 2; int tryctr = 0; bool can_retry = true; Base_Status_ADL rc; for (tryctr=0; tryctr < maxTries && can_retry; tryctr++) { rc = adl_ddc_write_read_onecall(iAdapterIndex, iDisplayIndex, pSendMsgBuf, sendMsgLen, pRcvMsgBuf, pRcvBytect); if (rc == -1) { sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_RETRY, __func__, "retry timeout"); } else can_retry=false; } if (adl_debug) DBGMSG("Returning %d. tryctr=%d", rc, tryctr); return rc; } // // Top level functions to read and write VCP values // typedef struct { Byte mHi; Byte mLo; Byte sHi; Byte sLo; } Raw_GetVCP_Response_Data; /** * @remark 10/2015: unused */ Base_Status_ADL adl_ddc_get_vcp(int iAdapterIndex, int iDisplayIndex, Byte vcp_feature_code, bool onecall) { if (adl_debug) { DBGMSG("Starting adapterNdx=%d, displayNdx=%d, vcp_feature_code=0x%02x", iAdapterIndex, iDisplayIndex, vcp_feature_code ); } unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command vcp_feature_code, // 0x00, // checksum, to be set }; ddc_cmd_bytes[5] = ddc_checksum(ddc_cmd_bytes, 5, false); // calculate DDC checksum on all bytes // assert(ddc_cmd_bytes[5] == 0xac); // correct value for feature code 0x10 int sendCt = sizeof(ddc_cmd_bytes); assert (sendCt == 6); Byte rcvBuf[32]; int rcvCt = 16; Base_Status_ADL rc; if (adl_debug) { char * s = hexstring(ddc_cmd_bytes, sendCt); DBGMSG("Writing: %s ", s ); free(s); } if (onecall) rc = adl_ddc_write_read_onecall( // alt: call "with_retry" version iAdapterIndex, iDisplayIndex, ddc_cmd_bytes, sendCt, rcvBuf, &rcvCt); else rc = adl_ddc_write_read( // alt: call "with_retry" version iAdapterIndex, iDisplayIndex, ddc_cmd_bytes, sendCt, rcvBuf, &rcvCt); if (rc == 0) { if (adl_debug) { DBGMSG("Data returned: " ); hex_dump(rcvBuf, rcvCt); } // Need to perform error checking on result // *(ulMaxVal) = (ucGetCommandReplyRead[GETRP_MAXHIGH_OFFSET] << 8 |ucGetCommandReplyRead[GETRP_MAXLOW_OFFSET]); // *(ulCurVal) = (ucGetCommandReplyRead[GETRP_CURHIGH_OFFSET] << 8 |ucGetCommandReplyRead[GETRP_CURLOW_OFFSET]); } return rc; } /** * @remark 10/2015: only used in adl_tests.c */ Base_Status_ADL adl_ddc_set_vcp(int iAdapterIndex, int iDisplayIndex, Byte vcp_feature_code, int newval) { if (adl_debug) DBGMSG("Starting adapterNdx=%d, displayNdx=%d, vcp_feature_code=0x%02x", iAdapterIndex, iDisplayIndex, vcp_feature_code ); unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x04, // number of DDC data bytes, with high bit set 0x03, // DDC Set Feature Command vcp_feature_code, // newval & 0xff00 >> 8, newval & 0xff, 0x00, // checksum, to be set }; ddc_cmd_bytes[7] = ddc_checksum(ddc_cmd_bytes, 7, false); // calculate DDC checksum on all bytes int sendCt = sizeof(ddc_cmd_bytes); assert (sendCt == 8); Base_Status_ADL rc = adl_ddc_write_only(iAdapterIndex, iDisplayIndex, ddc_cmd_bytes, sendCt); sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_POST_SETVCP_WRITE, __func__, "after adl_DDC_write_only"); if (adl_debug) DBGMSG("Returning %d ", rc ); return rc; } ddcutil-0.8.6/src/adl/adl_impl/adl_errors.c0000644000175000001440000001434613101546540015511 00000000000000/* adl_errors.c * * Interpret ADL error codes * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * ADL Error Number Services */ /** \cond */ #include // for NULL #include /** \endcond */ #include "util/string_util.h" #include "base/adl_errors.h" #include "base/status_code_mgt.h" #define EDENTRY(id,desc) {id, #id, desc} static Status_Code_Info adl_status_desc[] = { EDENTRY(ADL_OK_WAIT, "All ok, but need to wait"), // 4 EDENTRY(ADL_OK_RESTART, "All ok, but need restart"), // 3 EDENTRY(ADL_OK_MODE_CHANGE, "All OK, but need mode change" ), // 2 EDENTRY(ADL_OK_WARNING, "All OK, but with warning" ), // 1 EDENTRY(ADL_OK, "Function completed successfully" ), // 0 EDENTRY(ADL_ERR, "Generic error (see adl_defines.h)" ), // -11 EDENTRY(ADL_ERR_NOT_INIT, "ADL not initialized" ), EDENTRY(ADL_ERR_INVALID_PARAM, "Invalid parameter" ), EDENTRY(ADL_ERR_INVALID_PARAM_SIZE, "A parameter size is invalid" ), EDENTRY(ADL_ERR_INVALID_ADL_IDX , "Invalid ADL index" ), EDENTRY(ADL_ERR_INVALID_CONTROLLER_IDX , "Invalid controller index" ), // n. ADL_ERR_INVALID_DIPLAY_IDX is actual value in adl_defines.h EDENTRY(ADL_ERR_INVALID_DIPLAY_IDX, "Invalid display index" ), EDENTRY(ADL_ERR_NOT_SUPPORTED, "Function not supported by the driver"), EDENTRY(ADL_ERR_NULL_POINTER, "Null Pointer error"), // -9 EDENTRY(ADL_ERR_DISABLED_ADAPTER, "Can't be made due to disabled adapter"), // -10 EDENTRY(ADL_ERR_INVALID_CALLBACK, "Invalid callback"), // -11 EDENTRY(ADL_ERR_RESOURCE_CONFLICT, "Display resource conflict"), // -12 EDENTRY(ADL_ERR_SET_INCOMPLETE, "Failed to update some values. (see adl_definess.h)"), // -20 EDENTRY(ADL_ERR_NO_XDISPLAY, "There's no XDisplay in Linux console environment"), // -21 }; #undef EDENTRY static const int adl_status_desc_ct = sizeof(adl_status_desc)/sizeof(Status_Code_Info); #define WORKBUF_SIZE 100 static char workbuf[WORKBUF_SIZE]; static Status_Code_Info dummy_adl_status_desc; static char buf2[20]; /** Given an unmodulated ADL status code, return its * Status_Code_Info struct. * * @param errnum unmodulated ADL status code * @return pointer to #Status_Code_Info struct describing the code. * NULL if code not found */ Status_Code_Info * find_adl_status_description(Base_Status_ADL errnum) { Status_Code_Info * result = NULL; int ndx; for (ndx=0; ndx < adl_status_desc_ct; ndx++) { if (errnum == adl_status_desc[ndx].code) { result = &adl_status_desc[ndx]; break; } } return result; } /** Given an unmodulated ADL status code, return its * Status_Code_Info struct. * * If the error code is unrecognized, a dummy struct is initializaed and * returmed. The contents of this struct are valid until the next call * to this function. * * @param errnum unmodulated ADL status code * @return pointer to #Status_Code_Info struct describing the code */ Status_Code_Info * get_adl_status_description(Base_Status_ADL errnum) { Status_Code_Info * result = NULL; result = find_adl_status_description(errnum); if (!result) { result = &dummy_adl_status_desc; result->code = errnum; char * s = "Unknown ADL status code"; result->description = s; snprintf(buf2,20, "%d",errnum); result->name = buf2; snprintf(workbuf, WORKBUF_SIZE, "(%d) %s\n", errnum, result->description); } return result; } // n. called from main before command line parsed, trace control not yet set up void init_adl_errors() { #ifdef OLD register_retcode_desc_finder(RR_ADL, get_adl_status_description, false); // finder_arg_is_modulated #endif } /** Gets the (unmodulated) ADL error number for a symbolic name. * * @param adl_error_name symbolic name, e.g. ADL_ERR_NOT_SUPPORTED * @param p_adl_error_number where to return error number * @return true if symbolic name found, false if not */ bool adl_error_name_to_number( const char * adl_error_name, Base_Status_ADL * p_adl_error_number) { int result = 0; bool found = false; for (int ndx = 0; ndx < adl_status_desc_ct; ndx++) { if ( streq(adl_status_desc[ndx].name, adl_error_name) ) { result = adl_status_desc[ndx].code; found = true; break; } } *p_adl_error_number = result; return found; } /** Gets the (modulated) ADL error number for a symbolic name. * * @param adl_error_name symbolic name, e.g. ADL_ERR_NOT_SUPPORTED * @param p_adl_error_number where to return error number * @return true if symbolic name found, false if not */ bool adl_error_name_to_modulated_number( const char * adl_error_name, Modulated_Status_ADL * p_adl_error_number) { int result = 0; bool found = adl_error_name_to_number(adl_error_name, &result); if (found) { result = modulate_rc(result, RR_ADL); } *p_adl_error_number = result; return found; } ddcutil-0.8.6/src/adl/adl_impl/adl_intf.c0000644000175000001440000011650713213715236015143 00000000000000/* adl_intf.c * * Interface to ADL (AMD Display Library) for fglrx * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ /** \cond */ #include #include // dyopen, dysym, dyclose #include #include #include /** \endcond */ #include "util/device_id_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "base/ddc_packets.h" #include "base/parms.h" #include "base/sleep.h" #include "adl/adl_impl/adl_friendly.h" #include "adl/adl_impl/adl_report.h" #include "adl/adl_impl/adl_sdk_includes.h" #include "adl/adl_impl/adl_intf.h" #pragma GCC diagnostic ignored "-Wpointer-sign" // // ADL framework shim functions // // Memory allocation function void* __stdcall ADL_Main_Memory_Alloc ( int iSize ) { // DBGMSG("iSize=%d", iSize ); void* lpBuffer = malloc ( iSize ); // DBGMSG("Returning: %p" , lpBuffer); return lpBuffer; } // Optional Memory de-allocation function void __stdcall ADL_Main_Memory_Free ( void** pBuffer ) { // DBGMSG("pBuffer=%p, *pBuffer=%p ", pBuffer, *pBuffer ); if ( NULL != *pBuffer ) { free ( *pBuffer ); *pBuffer = NULL; } } // Equivalent function in Linux: void * GetProcAddress(void * pLibrary, const char * name) { return dlsym(pLibrary, name); } // // Module globals // static Trace_Group TRACE_GROUP = TRC_ADL; // trace class for this file static bool module_initialized = false; static bool adl_linked = false;; // declared extern in adl_friendly.h, referenced in adl_services.c bool adl_debug = false; // declared extern in adl_friendly.h, referenced in adl_tests.c: Adl_Procs* adl; ADL_Display_Rec active_displays[MAX_ACTIVE_DISPLAYS]; int active_display_ct = 0; // // Call stats // #ifdef OLD // dummy value for timing_stats in case init_adl_call_stats() is never called. // Without it, macro RECORD_TIMING_STATS_NOERROR would have to test that // both timing_stats and pTimingStat->p are not null. static ADL_Call_Stats dummystats = { .pread_write_stats = NULL, .pother_stats = NULL, .stats_active = false }; static ADL_Call_Stats* timing_stats = &dummystats; static bool gather_timing_stats = false; void init_adl_call_stats(ADL_Call_Stats * pstats) { // DBGMSG("Starting. pstats = %p", timing_stats); assert(pstats); timing_stats = pstats; gather_timing_stats = true;; // pstats->stat_group_name = "ADL call"; } #endif // // Module initialization // /** Checks if the ADL environment has been initialized. * * @return true/false */ bool adl_is_available() { return (module_initialized); } /* Finds the ADL library and dynamically loads it * * Arguments: * pLocAdl_Procs return function table here * verbose if true, verbose messages * * Returns: * 0 loaded * 1 Library not found * -1 error loading function */ static int link_adl(Adl_Procs** pLocAdl_Procs, bool verbose) { bool debug = false; DBGMSF(debug, "Starting." ); Adl_Procs* adl = calloc(1, sizeof(Adl_Procs)); int result = 0; #define LOADFUNC(_n_) \ do { \ DBGMSF(debug, "Loading function %s", #_n_); \ adl->_n_ = dlsym(adl->hDLL, #_n_); \ if (!adl->_n_) { \ SEVEREMSG("ADL error: loading symbol %s\n", #_n_); \ result = -1; \ } \ } while (0) adl->hDLL = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL); if (!adl->hDLL) { if (verbose) printf("ADL library libatiadlxx.so not found.\n" ); // this is a user error msg result = 1; } else { LOADFUNC(ADL_Main_Control_Create); LOADFUNC(ADL_Main_Control_Destroy); LOADFUNC(ADL_Adapter_NumberOfAdapters_Get); LOADFUNC(ADL_Adapter_AdapterInfo_Get); LOADFUNC( ADL_Adapter_VideoBiosInfo_Get ); LOADFUNC(ADL2_Adapter_VideoBiosInfo_Get ); LOADFUNC(ADL_Display_NumberOfDisplays_Get); LOADFUNC(ADL_Display_DisplayInfo_Get); LOADFUNC(ADL_Display_ColorCaps_Get ); LOADFUNC(ADL_Display_Color_Get ); LOADFUNC(ADL_Display_Color_Set ); LOADFUNC(ADL2_Display_ColorCaps_Get ); LOADFUNC(ADL2_Display_Color_Get ); LOADFUNC(ADL2_Display_Color_Set ); // I2C, DDC, and EDID APIs LOADFUNC(ADL2_Display_WriteAndReadI2CRev_Get ); LOADFUNC( ADL_Display_WriteAndReadI2CRev_Get ); LOADFUNC(ADL2_Display_WriteAndReadI2C ); LOADFUNC( ADL_Display_WriteAndReadI2C ); LOADFUNC(ADL2_Display_DDCBlockAccess_Get); LOADFUNC( ADL_Display_DDCBlockAccess_Get); LOADFUNC(ADL2_Display_DDCInfo_Get ); LOADFUNC( ADL_Display_DDCInfo_Get ); LOADFUNC(ADL2_Display_DDCInfo2_Get ); LOADFUNC( ADL_Display_DDCInfo2_Get ); LOADFUNC(ADL2_Display_EdidData_Get ); LOADFUNC( ADL_Display_EdidData_Get ); // Linux only APIs LOADFUNC(ADL2_Adapter_XScreenInfo_Get ); LOADFUNC( ADL_Adapter_XScreenInfo_Get ); LOADFUNC(ADL2_Display_XrandrDisplayName_Get ); LOADFUNC( ADL_Display_XrandrDisplayName_Get ); } DBGMSF(debug, "adl->ADL_Main_Control_Create = %p ", adl->ADL_Main_Control_Create ); if (result == 0) { *pLocAdl_Procs = adl; } else { free(adl); *pLocAdl_Procs = NULL; } DBGMSF(debug, "Returning %d, *pLocAdl_Procs=%p ", result, *pLocAdl_Procs ) ; return result; #undef LOADFUNC } /* Initialize the ADL framework. * * Returns: * true if successful, false if not */ static bool init_framework() { bool ok = true; int rc; // Initialize ADL. The second parameter is 1, which means: // retrieve adapter information only for adapters that are physically present and enabled in the system if (adl_debug) { DBGMSG("adl=%p", adl ); DBGMSG("adl->ADL_Main_Control_Create=%p ", adl->ADL_Main_Control_Create ); } RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1) ) ); // rc = adl->ADL_Main_Control_Create(ADL_Main_Memory_Alloc, 1) ; if (rc != ADL_OK) { if (rc == ADL_ERR_NO_XDISPLAY) { fprintf(stderr, "No X display found by ADL. Apparently running in console environment. (ADL_ERR_NO_XDISPLAY)\n"); } else fprintf(stderr, "ADL Initialization Error! ADL_Main_Control_Create() returned: %d.\n", rc); ok = false; } return ok; } #ifdef UNUSED bool isConnectedAndMapped(ADLDisplayInfo * pDisplayInfo) { // DBGMSG("Startimg. " ); bool result = true; // Use the display only if it's connected AND mapped (iDisplayInfoValue: bit 0 and 1 ) if ( ( ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED ) != ( (ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED) & pDisplayInfo->iDisplayInfoValue ) ) { // DBGMSG("Display not connected or not mapped" ); result = false; // Skip the not connected or not mapped displays } // DBGMSG("Returning %d ", result ); return result; } #endif static bool is_active_display(int iAdapterIndex, ADLDisplayInfo * pDisplayInfo) { // DBGMSG("Startimg. " ); bool result = true; // Use the display only if it's connected AND mapped (iDisplayInfoValue: bit 0 and 1 ) if ( ( ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED ) != ( (ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED) & pDisplayInfo->iDisplayInfoValue ) ) { // DBGMSG("Display not connected or not mapped" ); result = false; // Skip the not connected or not mapped displays } // Is the display mapped to this adapter? This test is too restrictive and may not be needed. // Appears necessary (SAR) - otherwise get additional displays else if ( iAdapterIndex != pDisplayInfo->displayID.iDisplayLogicalAdapterIndex ) { // DBGMSG("Display not mapped to this adapter " ); result = false; } // DBGMSG("Returning %d ", result ); return result; } /* Scan for attached displays * * Information about displays found is accumulated in global variables * active_displays and active_display_ct. * * Returns: * true if successful, false if not */ static bool scan_for_displays() { bool debug = false; debug = adl_debug || debug; DBGMSF(debug, "Starting." ); int rc; int iNumberAdapters; AdapterInfo * pAdapterInfo; bool ok = true; // Obtain the number of adapters for the system RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Adapter_NumberOfAdapters_Get ( &iNumberAdapters ) ) ); if (rc != ADL_OK) { DBGMSG("Cannot get the number of adapters! ADL_Adapter_NumberOfAdapaters_Get() returned %d", rc); ok = false; } // DBGMSG("Found %d adapters", iNumberAdapters ); if ( 0 < iNumberAdapters ) { pAdapterInfo = malloc ( sizeof (AdapterInfo) * iNumberAdapters ); memset( pAdapterInfo,'\0', sizeof (AdapterInfo) * iNumberAdapters ); // Get the AdapterInfo structure for all adapters in the system RECORD_IO_EVENT( IE_OTHER, ( adl->ADL_Adapter_AdapterInfo_Get(pAdapterInfo, sizeof (AdapterInfo) * iNumberAdapters) ) ); // Repeat for all available adapters in the system int adapterNdx, displayNdx; // counters for looping int iAdapterIndex; int iDisplayIndex; int displayCtForAdapter; ADLDisplayInfo * pAdlDisplayInfo = NULL; for (adapterNdx = 0; adapterNdx < iNumberAdapters; adapterNdx++ ) { // printf("Adapter loop index: %d\n", adapterNdx ); AdapterInfo * pAdapter = &pAdapterInfo[adapterNdx]; if (adl_debug) report_adl_AdapterInfo(pAdapter, 1); iAdapterIndex = pAdapter->iAdapterIndex; assert(iAdapterIndex == adapterNdx); // just an observation #ifdef REFERENCE typedef struct ADLBiosInfo { char strPartNumber[ADL_MAX_PATH]; ///< Part number. char strVersion[ADL_MAX_PATH]; ///< Version number. char strDate[ADL_MAX_PATH]; ///< BIOS date in yyyy/mm/dd hh:mm format. } ADLBiosInfo, *LPADLBiosInfo; #endif #ifdef WORKS_BUT_NOT_VERY_USEFUL_INFO ADLBiosInfo adlBiosInfo; RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Adapter_VideoBiosInfo_Get ( iAdapterIndex, &adlBiosInfo) // fill in the struct ) ); if (rc != ADL_OK) { DBGMSG("ADL_Adapter_VideoBiosInfo_Get() returned %d", rc); continue; } else { // TEMP // not very useful info, is it even worth saving in ADL_Display_Rec? // printf("VideoBiosInfo\n"); // printf(" PartNumber: %s\n", adlBiosInfo.strPartNumber); // printf(" Version: %s\n", adlBiosInfo.strVersion); // printf(" Date: %s\n", adlBiosInfo.strDate); } #endif pAdlDisplayInfo = NULL; // set to NULL before calling ADL_Display_DisplayInfo_Get() RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Display_DisplayInfo_Get ( iAdapterIndex, &displayCtForAdapter, // return number of displays detected here &pAdlDisplayInfo, // return pointer to retrieved displayinfo array here 0) // do not force detection ) ); if (rc != ADL_OK) { DBGMSG("ADL_Display_DisplayInfo_Get() returned %d", rc); continue; } // DBGMSG("ADL_Display_DisplayInfo_Get() succeeded, displayCtForAdapter=%d", displayCtForAdapter ); for ( displayNdx = 0; displayNdx < displayCtForAdapter; displayNdx++ ) { // DBGMSG("adapter loop index = %d, display loop index = %d ", adapterNdx, displayNdx); ADLDisplayInfo * pCurDisplayInfo = &pAdlDisplayInfo[displayNdx]; iDisplayIndex = pCurDisplayInfo->displayID.iDisplayLogicalIndex; // DBGMSG("iAdapterIndex=%d, iDisplayIndex=%d", iAdapterIndex, iDisplayIndex ); if (debug) { DBGMSG("iAdapterIndex=%d, iDisplayIndex=%d", iAdapterIndex, iDisplayIndex ); report_adl_ADLDisplayInfo(pCurDisplayInfo, 2); } char xrandrname[100] = {0}; RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Display_XrandrDisplayName_Get( iAdapterIndex, iDisplayIndex, xrandrname, 100) ) ); if (rc != 0) DBGMSG("ADL_Display_XrandrDisplayName_Get() returned %d\n ", rc ); // if (rc == 0) // DBGMSG("ADL_Display_XrandrDisplayName_Get returned xrandrname=|%s|", xrandrname ); if (is_active_display(iAdapterIndex, pCurDisplayInfo)) { // if (isConnectedAndMapped(pCurDisplayInfo) ) { // DBGMSG("Found active display. iAdapterIndex=%d, iDisplayIndex=%d", iAdapterIndex, iDisplayIndex ); assert(active_display_ct < MAX_ACTIVE_DISPLAYS); ADL_Display_Rec * pCurActiveDisplay = &active_displays[active_display_ct]; pCurActiveDisplay->iAdapterIndex = iAdapterIndex; pCurActiveDisplay->iDisplayIndex = iDisplayIndex; pCurActiveDisplay->iVendorID = pAdapter->iVendorID; pCurActiveDisplay->pstrAdapterName = strdup(pAdapter->strAdapterName); pCurActiveDisplay->pstrDisplayName = strdup(pAdapter->strDisplayName); ADLDisplayEDIDData * pEdidData = calloc(1, sizeof(ADLDisplayEDIDData)); pEdidData->iSize = sizeof(ADLDisplayEDIDData); pEdidData->iFlag = 0; pEdidData->iBlockIndex = 0; // critical RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Display_EdidData_Get(iAdapterIndex, iDisplayIndex, pEdidData) ) ); if (rc != ADL_OK) { DBGMSG("ADL_Display_EdidData_Get() returned %d", rc ); pCurActiveDisplay->pAdlEdidData = NULL; free(pEdidData); } else { // puts("EdidData_Get succeeded"); // reportDisplayEDIDData(pEdidData,3); pCurActiveDisplay->pAdlEdidData = pEdidData; Byte * pEdidBytes = (Byte *) &(pEdidData->cEDIDData); Parsed_Edid * pEdid = create_parsed_edid(pEdidBytes); if (!pEdid) { DBGMSG("Error parsing EDID"); pCurActiveDisplay->pAdlEdidData = NULL; free(pEdidData); } else { memcpy(pCurActiveDisplay->mfg_id, pEdid->mfg_id, sizeof(pCurActiveDisplay->mfg_id)); memcpy(pCurActiveDisplay->model_name, pEdid->model_name, sizeof(pCurActiveDisplay->model_name)); memcpy(pCurActiveDisplay->serial_ascii, pEdid->serial_ascii, sizeof(pCurActiveDisplay->serial_ascii)); // should use snprintf to ensure no buffer overflow: memcpy(pCurActiveDisplay->xrandr_name, xrandrname, sizeof(pCurActiveDisplay->xrandr_name)); pCurActiveDisplay->pEdid = pEdid; } } ADLDDCInfo2 * pDDCInfo2 = calloc(1, sizeof(ADLDDCInfo2)); RECORD_IO_EVENT( IE_OTHER, ( rc = adl->ADL_Display_DDCInfo2_Get(iAdapterIndex, iDisplayIndex, pDDCInfo2) ) ); if (rc != ADL_OK) { DBGMSG("ADL_Display_DDCInfo2_Get() returned %d", rc ); pCurActiveDisplay->pAdlDDCInfo2 = NULL; free(pDDCInfo2); pCurActiveDisplay->supports_ddc = false; } else { // DBGMSG("ADL_DISPLAY_DDCInfo2_Get succeeded"); // report_adl_ADLDDCInfo2(pDDCInfo2, false /* verbose */, 3); pCurActiveDisplay->pAdlDDCInfo2 = pDDCInfo2; // This is less useful than the name suggests. // Dell 1905FP does not support DDC, but returns true. // Needs further checking to confirm that DDC supported pCurActiveDisplay->supports_ddc = (pDDCInfo2->ulSupportsDDC) ? true : false; } active_display_ct++; } // is_active_display } // iNumDisplays free(pAdlDisplayInfo); pAdlDisplayInfo = NULL; } // iNumberAdapters } // iNumberAdapters > 0 DBGMSF(debug, "Returning %d", ok ); return ok; } /** This is the main function for initializing the ADL environment. * * Must be called before any function other than is_adl_available(). * * It is not an error if this function is called multiple times. * * Performs the following steps: * - checks if ADL tracing is in effect * - dynamically links the ADL library * - initializes the framework * - scans for ADL monitors * * @retval true if initialization succeeded, or already initialized * @retval false initialization failed * * Returns: * true if initialization successful, false if not */ bool adl_initialize() { if (module_initialized) { return true; } // A hack, to reuse all the if (debug) ... tracing code without converting // it to use TRCMSG. The debug flag is made global to the module. adl_debug = IS_TRACING(); // DBGMSG("adl_debug=%d", adl_debug); int rc; bool ok = false; rc = link_adl(&adl, false /* verbose */); if (rc != 0 && adl_debug) DBGMSG("link_adl() failed " ); if (rc == 0) { adl_linked = true; ok = init_framework(); if (ok) { ok = scan_for_displays(); // DBGMSG("init_adl_new() returned %d", ok ); } } if (ok) { module_initialized = true; } return ok; } /** Releases the ADL framework */ void adl_release() { RECORD_IO_EVENT( IE_OTHER, ( adl->ADL_Main_Control_Destroy() ) ); // adl->ADL_Main_Control_Destroy(); dlclose(adl->hDLL); free(adl); module_initialized = false; } // // Report on active displays // /** Returns a #Parsed_Edid for an ADL display * * @param iAdapterIndex adapter number * @param iDisplayIndex display number * @return pointer to #Parsed_Edid, NULL if display not found * * The #Parsed_Edid found should not be freed by the caller. */ Parsed_Edid* adl_get_parsed_edid_by_adlno( int iAdapterIndex, int iDisplayIndex) { Parsed_Edid* parsedEdid = NULL; ADL_Display_Rec * pAdlRec = adl_get_display_by_adlno( iAdapterIndex, iDisplayIndex, false); if (pAdlRec) { parsedEdid = pAdlRec->pEdid; } return parsedEdid; } #ifdef DEPRECATED // use get_ParsedEdid_for_adlno DisplayIdInfo* get_adl_display_id_info(int iAdapterIndex, int iDisplayIndex) { DisplayIdInfo * pIdInfo = NULL; Parsed_Edid * pEdid = adl_get_parsed_edid_by_adlno(iAdapterIndex, iDisplayIndex); if (pEdid) { pIdInfo = calloc(1, sizeof(DisplayIdInfo)); memcpy(pIdInfo->mfg_id, pEdid->mfg_id, sizeof(pIdInfo->mfg_id)); memcpy(pIdInfo->model_name, pEdid->model_name, sizeof(pIdInfo->model_name)); memcpy(pIdInfo->serial_ascii, pEdid->serial_ascii, sizeof(pIdInfo->serial_ascii)); memcpy(pIdInfo->edid_bytes, pEdid->bytes, 128); } return pIdInfo; } #endif /** Describes a display, specified by a pointer to its ADL_Display_Rec, * using report functions. * * Output is written to the currently active report destination. * * @param pdisp points to ADL_Display_Rec for the display * @param depth logical indentation depth */ void adl_report_active_display(ADL_Display_Rec * pdisp, int depth) { DDCA_Output_Level output_level = get_output_level(); rpt_vstring(depth, "ADL Adapter number: %d", pdisp->iAdapterIndex); rpt_vstring(depth, "ADL Display number: %d", pdisp->iDisplayIndex); // Can be true even if doesn't support DDC, e.g. Dell 1905FP // avoid confusion - do not display // if (output_level >= OL_VERBOSE) // rpt_vstring(depth, "Supports DDC: %s", (pdisp->supports_ddc) ? "true" : "false"); if (output_level == DDCA_OL_TERSE) rpt_vstring(depth, "Monitor: %s:%s:%s", pdisp->mfg_id, pdisp->model_name, pdisp->serial_ascii); rpt_vstring(depth, "Xrandr name: %s", pdisp->xrandr_name); if (output_level >= DDCA_OL_NORMAL) { bool dump_edid = (output_level >= DDCA_OL_VERBOSE); report_parsed_edid(pdisp->pEdid, dump_edid /* verbose */, depth); } if (output_level >= DDCA_OL_VERBOSE) { devid_ensure_initialized(); Pci_Usb_Id_Names pci_id_names = devid_get_pci_names((ushort) pdisp->iVendorID, 0, 0, 0, 1); char * vendor_name = (pci_id_names.vendor_name) ? pci_id_names.vendor_name : "unknown vendor"; rpt_vstring(depth, "Vendor id: 0x%04x %s", pdisp->iVendorID, vendor_name); // waste of space to reserve full ADL_MAX_PATH for each field if (pdisp->pstrAdapterName) rpt_vstring(depth, "Adapter name: %s", pdisp->pstrAdapterName); if (pdisp->pstrDisplayName) rpt_vstring(depth, "Display name: %s", pdisp->pstrDisplayName); } } /** Describes a display, specified by its index in the list of displays, * using report functions. * * Output is written to the currently active report destination. * * @param ndx index into array of active ADL displays * @param depth logical indentation depth */ void adl_report_active_display_by_index( int ndx, int depth) { assert(ndx >= 0 && ndx < active_display_ct); ADL_Display_Rec * pdisp = &active_displays[ndx]; adl_report_active_display(pdisp, depth); } /* Describes a display, sepecified by an adapter number/display number pair, * using report functions. * * Output is written to the currently active report destination. * * @param iAdapterIndex adapter number * @param iDisplayIndex display number for adapter * @param depth logical indentation depth */ void adl_report_active_display_by_adlno( int iAdapterIndex, int iDisplayIndex, int depth) { ADL_Display_Rec * pdisp = adl_get_display_by_adlno(iAdapterIndex, iDisplayIndex, false /* emit_error_msg */); if (!pdisp) rpt_vstring(depth, "ADL display %d.%d not found", iAdapterIndex, iDisplayIndex); else adl_report_active_display(pdisp, depth); } /** Show information about attached ADL displays. * * Output is written using report functions. * * @return number of active displays */ int adl_report_active_displays() { if (adl_linked) { rpt_vstring(0, "\nDisplays connected to AMD proprietary driver: %s", (active_display_ct == 0) ? "None" : ""); rpt_vstring(0, ""); if (active_display_ct > 0) { int ndx; for (ndx=0; ndx < active_display_ct; ndx++) { ADL_Display_Rec * pdisp = &active_displays[ndx]; adl_report_active_display(pdisp, 0); rpt_vstring(0,""); } } } return active_display_ct; } int adl_get_active_display_ct() { return active_display_ct; } ADL_Display_Rec * adl_get_active_display_rec(int ndx){ return &active_displays[ndx]; } #ifdef OLD /** Returns a #Display_Info_List describing the detected ADL displays. * * @return #Display_Info_List */ Display_Info_List adl_get_valid_displays() { Display_Info_List info_list = {0,NULL}; Display_Info * info_recs = calloc(active_display_ct, sizeof(Display_Info)); int ndx = 0; for (ndx=0; ndx < active_display_ct; ndx++) { ADL_Display_Rec * pdisp = &active_displays[ndx]; info_recs[ndx].dref = create_adl_display_ref(pdisp->iAdapterIndex, pdisp->iDisplayIndex); info_recs[ndx].edid = pdisp->pEdid; memcpy(info_recs[ndx].marker, DISPLAY_INFO_MARKER, 4); } info_list.info_recs = info_recs; info_list.ct = active_display_ct; // DBGMSG("Done. Returning:"); // report_display_info_list(&info_list, 0); return info_list; } #endif #ifdef REFERENCE typedef struct { Display_Ref * dref; Parsed_Edid * edid; } Display_Info; typedef struct { int ct; Display_Info * info_recs; } Display_Info_List; #endif /* Reports the contents of a #ADL_Display_Rec, describing a single active display. * This is a debugging functions. * * Output is written using report functions. * * @param pRec pointer to display record * @param verbose if true, show additional detail * @param depth logical indentation depth */ void report_adl_display_rec( ADL_Display_Rec * pRec, bool verbose, int depth) { verbose=false; rpt_structure_loc("AdlDisplayRec", pRec, depth); int d = depth+1; rpt_int( "iAdapterIndex", NULL, pRec->iAdapterIndex, d); rpt_int( "iDisplayIndex", NULL, pRec->iDisplayIndex, d); rpt_int( "supportsDDC", "does display support DDC", pRec->supports_ddc, d); rpt_str( "mfg_id", "manufacturer id", pRec->mfg_id, d); rpt_str( "model_name", NULL, pRec->model_name, d); rpt_str( "serial_ascii", NULL, pRec->serial_ascii, d); rpt_int( "iVendorID", "vendor id (as decimal)", pRec->iVendorID, d); rpt_str( "strAdapterName", "video card name", pRec->pstrAdapterName, d); rpt_str( "pstrDisplayName", NULL, pRec->pstrDisplayName, d); if (verbose) { report_adl_ADLDisplayEDIDData(pRec->pAdlEdidData, d+1); report_adl_ADLDDCInfo2(pRec->pAdlDDCInfo2, false /* verbose */, d+1); } } #ifdef REF int iVendorID; // e.g. 4098 // waste of space to reserve full ADL_MAX_PATH for each field char * pstrAdapterName; char * pstrDisplayName; #endif /** Gets video card information for the specified adapter number/display number pair. * * @param iAdapterIndex adapter number * @param iDisplayIndex display number * @param card_info pointer to existing #Video_Card_Info struct where * information is returned * * @return ADL status code * * @todo * A pointer to a newly allocated string for the adapter name is returned * in card_info. This is a memory leak. */ Base_Status_ADL adl_get_video_card_info_by_adlno( int iAdapterIndex, int iDisplayIndex, Video_Card_Info * card_info) { assert( card_info != NULL && memcmp(card_info->marker, VIDEO_CARD_INFO_MARKER, 4) == 0); int rc = 0; ADL_Display_Rec * pAdlRec = adl_get_display_by_adlno(iAdapterIndex, iDisplayIndex, true /* emit_error_msg */); if (!pAdlRec) { // issue error message for impossible case: PROGRAM_LOGIC_ERROR("Invalid Display_Handle %d.%d", iAdapterIndex, iDisplayIndex); rc = ADL_ERR_INVALID_ADL_IDX; } // assignments wrapped in unnecessary else{} clause to avoid clang warning // about possible null dereference in case pAdlRec is NULL else { card_info->vendor_id = pAdlRec->iVendorID; card_info->adapter_name = strdup(pAdlRec->pstrAdapterName); card_info->driver_name = "AMD proprietary driver"; } return rc; } // // Find display // /** Finds ADL display by adapter number/display number * * @param iAdapterIndex ADL adapter number * @param iDisplayIndex ADLdisplay number * @param emit_error_msg if true, emit messages for errors * * @return pointer to #ADL_Display_Rec describing the display, * NULL if not found * * The returned pointer points to a permanently allocated #ADL_Display_Rec. * It should not be freed by the caller. */ ADL_Display_Rec * adl_get_display_by_adlno( int iAdapterIndex, int iDisplayIndex, bool emit_error_msg) { ADL_Display_Rec * result = NULL; if (active_display_ct == 0) { if (emit_error_msg) f0printf(FERR, "No ADL displays found\n"); } else { int ndx; for (ndx = 0; ndx < active_display_ct; ndx++) { ADL_Display_Rec * pdisp = &active_displays[ndx]; if (iAdapterIndex == pdisp->iAdapterIndex && iDisplayIndex == pdisp->iDisplayIndex ) { result = pdisp; break; } } if (!result && emit_error_msg) f0printf(FERR, "ADL display %d.%d not found.\n", iAdapterIndex, iDisplayIndex); } return result; } /** Finds ADL display by some combination of manufacturer id, model name and serial number * * @param mfg_id 3 character manufacturer id * @param model model name string * @param sn serial number string * * @return pointer to #ADL_Display_Rec describing the display, * NULL if not found */ ADL_Display_Rec * adl_find_display_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn) { // DBGMSG("Starting. mode=%s, sn=%s ", model, sn ); ADL_Display_Rec * result = NULL; bool some_test_passed = false; bool some_test_failed = false; int ndx; for (ndx = 0; ndx < active_display_ct; ndx++) { ADL_Display_Rec * pdisp = &active_displays[ndx]; if ( mfg_id && strlen(mfg_id) > 0) { if ( streq(mfg_id, pdisp->mfg_id) ) some_test_passed = true; else some_test_failed = true; } if ( model && strlen(model) > 0) { if ( streq(model, pdisp->model_name) ) some_test_passed = true; else some_test_failed = true; } if ( sn && strlen(sn) > 0) { if ( streq(sn, pdisp->serial_ascii) ) some_test_passed = true; else some_test_failed = true; } if (some_test_passed && !some_test_failed) // if (streq(model,pdisp->model_name) && // streq(sn, pdisp->serial_ascii) ) { result = pdisp; break; } } // DBGMSG("Returning: %p ", result ); return result; } /** Finds ADL display by EDID * * @param pEdidBytes pointer to 128 byte EDID * * @return pointer to #ADL_Display_Rec describing the display, * NULL if not found */ ADL_Display_Rec * adl_find_display_by_edid( const Byte * pEdidBytes) { // DBGMSG("Starting. mode=%s, sn=%s ", model, sn ); ADL_Display_Rec * result = NULL; int ndx; for (ndx = 0; ndx < active_display_ct; ndx++) { ADL_Display_Rec * pdisp = &active_displays[ndx]; // need to check AdlEdidData fields for valid data present? if ( memcmp(pEdidBytes, pdisp->pAdlEdidData->cEDIDData, 128) == 0 ) { result = pdisp; break; } } // DBGMSG("Returning: %p ", result ); return result; } /** Verifies that an ( adapter number,display number) pair specifies an active ADL display * * @param iAdapterIndex ADL adapter number * @param iDisplayIndex ADL display number * @param emit_error_msg if true, emit error messages * * @return true if an active display, false if not */ bool adl_is_valid_adlno( int iAdapterIndex, int iDisplayIndex, bool emit_error_msg) { return (adl_get_display_by_adlno(iAdapterIndex, iDisplayIndex, emit_error_msg) != NULL); } // // Wrapper ADL read and write functions // // // Use ADL_Display_DDCBlockAccess_Get() to write and read DDC packets // /** Wrapper for ADL_Display_DDCBlockAccess_Get(). * * Used locally and in ADL tests */ Base_Status_ADL call_ADL_Display_DDCBlockAccess_Get( int iAdapterIndex, int iDisplayIndex, int iOption, int iCommandIndex, int iSendMsgLen, char * lpucSendMsgBuf, int * iRecvMsgLen, char * lpucRcvMsgBuf) { assert(module_initialized); int rc; if (adl_debug) { DBGMSG("iAdapterIndex=%d, iDisplayIndex=%d, iOption=%d, xxx=%d, iSendMsgLen=%d lpucSemdMsgBuf=%p," " *piRecvMsgLen=%d, lpucRcvMsgBuf=%p\n", iAdapterIndex, iDisplayIndex, iOption, iCommandIndex, iSendMsgLen, lpucSendMsgBuf, *iRecvMsgLen, lpucRcvMsgBuf); if (lpucSendMsgBuf) { char * hs = hexstring(lpucSendMsgBuf, iSendMsgLen); DBGMSG("lpucSendMsgBuf -> %s ", hs ); free(hs); } if (lpucRcvMsgBuf) { char * hs = hexstring(lpucRcvMsgBuf, *iRecvMsgLen); DBGMSG("lpucRecvMsgBuf -> %s ", hs ); free(hs); } } RECORD_IO_EVENT( IE_WRITE_READ, ( rc = adl->ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, iOption, iCommandIndex, iSendMsgLen, lpucSendMsgBuf, iRecvMsgLen, lpucRcvMsgBuf) ) ); // rc = adl->ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, iOption, xxx, // iSendMsgLen, lpucSendMsgBuf, iRecvMsgLen, lpucRcvMsgBuf); if (adl_debug) { if (lpucRcvMsgBuf) { char * hs = hexstring(lpucRcvMsgBuf, *iRecvMsgLen); DBGMSG("lpucRecvMsgBuf -> %s ", hs ); free(hs); } DBGMSG("Returning %d", rc); } return rc; } /** Writes a DDC packet to the specified ADL display * * @param iAdapterIndex ADL adapter number * @param iDisplayIndex ADL display number * @param pSendMsgBuf pointer to bytes to write * @param sendMsgLen number of bytes to write * * @return ADL status code * * @remark 10/2015: called locally and from ddc_packet_io.c */ Base_Status_ADL adl_ddc_write_only( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen) { assert(module_initialized); // char * s = hexstring(pSendMsgBuf, sendMsgLen); // printf("(%s) Starting. iAdapterIndex=%d, iDisplayIndex=%d, sendMsgLen=%d, pSendMsgBuf->%s\n", // __func__, iAdapterIndex, iDisplayIndex, sendMsgLen, s); // free(s); int iRev = 0; int rc = call_ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, sendMsgLen, pSendMsgBuf, &iRev, NULL); // note_io_event(IE_WRITE_ONLY, __func__); // DBGMSG("Returning %d. ", rc); return rc; } /** Reads a DDC packet from the specified ADL display * * @param iAdapterIndex ADL adapter number * @param iDisplayIndex ADL display number * @param pRcvMsgBuf pointer to buffer in which to return packet * @param pRcvBytect pointer to integer in which packet length returned * * @return ADL status code */ Base_Status_ADL adl_ddc_read_only( int iAdapterIndex, int iDisplayIndex, Byte * pRcvMsgBuf, int * pRcvBytect) { assert(module_initialized); if (adl_debug) { DBGMSG("Starting. iAdapterIndex=%d, iDisplayIndex=%d, pRcvButect=%d", iAdapterIndex, iDisplayIndex, *pRcvBytect); } Byte sendMsgBuf[] = {0x6f}; int rc = call_ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, 1, sendMsgBuf, pRcvBytect, pRcvMsgBuf); if (adl_debug) { DBGMSG("Returning %d. ", rc); if (rc == 0) { char * s = hexstring(pRcvMsgBuf, *pRcvBytect); DBGMSG("*pRcvBytect=%d, pRevMsgBuf->%s ",*pRcvBytect, s ); free(s); } } return rc; } /** Performs and DDC write followed by a DDC read. * * @param iAdapterIndex ADL adapter number * @param iDisplayIndex ADL display number * @param pSendMsgBuf buffer containing bytes to send * @param sendMsgLen number of bytes to send * @param pRcvMsgBuf where to return bytes read * @param pRcvBytect where to return number of bytes read * * @return ADL status code * * @remark 10/2015: called from adl_services.c and ddc_packet_io.c */ Base_Status_ADL adl_ddc_write_read( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect) { assert(module_initialized); if (adl_debug) { char * s = hexstring(pSendMsgBuf, sendMsgLen); DBGMSG("Starting. iAdapterIndex=%d, iDisplayIndex=%d, sendMsgLen=%d, pSendMsgBuf->%s, *pRcvBytect=%d", iAdapterIndex, iDisplayIndex, sendMsgLen, s, *pRcvBytect); free(s); } int rc; rc = adl_ddc_write_only(iAdapterIndex, iDisplayIndex, pSendMsgBuf, sendMsgLen); if (rc == 0) { sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, "after write"); rc = adl_ddc_read_only(iAdapterIndex, iDisplayIndex, pRcvMsgBuf, pRcvBytect); } if (adl_debug) { DBGMSG("Returning %d. ", rc); if (rc == 0) { char * s = hexstring(pRcvMsgBuf, *pRcvBytect); DBGMSG("pRevMsgBuf->%s ",s ); free(s); } } return rc; } /** Attempts to perform a DDC write followed by a DDC read using * a single call to ADL_Display_DDCBlockAccess_Get((). * * However, appears to just return the bytes written. * * DO NOT USE * * @param iAdapterIndex ADL adapter number * @param iDisplayIndex ADL display number * @param pSendMsgBuf buffer containing bytes to send * @param sendMsgLen number of bytes to send * @param pRcvMsgBuf where to return bytes read * @param pRcvBytect where to return number of bytes read * * @return ADL status code * * @remark 10/2015: only called in adl_aux_intf.c */ Base_Status_ADL adl_ddc_write_read_onecall( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect) { assert(module_initialized); if (adl_debug) { char * s = hexstring(pSendMsgBuf, sendMsgLen); DBGMSG("Starting. iAdapterIndex=%d, iDisplayIndex=%d, sendMsgLen=%d, pSendMsgBuf->%s, *pRcvBytect=%d", iAdapterIndex, iDisplayIndex, sendMsgLen, s, *pRcvBytect); free(s); } // try to write and read in one call int rc = call_ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, sendMsgLen, pSendMsgBuf, pRcvBytect, pRcvMsgBuf); if (adl_debug) { DBGMSG("Returning %d. ", rc); if (rc == 0) { char * s = hexstring(pRcvMsgBuf, *pRcvBytect); DBGMSG("pRevMsgBuf->%s ",s ); free(s); } } return rc; } ddcutil-0.8.6/src/adl/adl_impl/adl_report.c0000644000175000001440000006455413101546540015516 00000000000000/* adl_report.c * * Report on data structures in ADL SDK * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Reports on data structures in ADL SDK. * * Used only for development and debugging. */ /** \cond */ #include #include #include #include /** \endcond */ #include "util/edid.h" #include "util/string_util.h" #include "base/core.h" #include "adl/adl_impl/adl_sdk_includes.h" #include "adl/adl_impl/adl_report.h" #ifdef REFERENCE /// \defgroup define_edid_flags Values for ulDDCInfoFlag /// defines for ulDDCInfoFlag EDID flag // @{ #define ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE (1 << 0) #define ADL_DISPLAYDDCINFOEX_FLAG_EDIDEXTENSION (1 << 1) #define ADL_DISPLAYDDCINFOEX_FLAG_DIGITALDEVICE (1 << 2) #define ADL_DISPLAYDDCINFOEX_FLAG_HDMIAUDIODEVICE (1 << 3) #define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORTS_AI (1 << 4) #define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC601 (1 << 5) #define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC709 (1 << 6) // @} #endif #ifdef REFERENCE /////////////////////////////////////////////////////////////////////////// // ADL_DISPLAY_DISPLAYINFO_ Definitions // for ADLDisplayInfo.iDisplayInfoMask and ADLDisplayInfo.iDisplayInfoValue // (bit-vector) /////////////////////////////////////////////////////////////////////////// /// \defgroup define_displayinfomask Display Info Mask Values // @{ #define ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED 0x00000001 #define ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED 0x00000002 #define ADL_DISPLAY_DISPLAYINFO_NONLOCAL 0x00000004 #define ADL_DISPLAY_DISPLAYINFO_FORCIBLESUPPORTED 0x00000008 #define ADL_DISPLAY_DISPLAYINFO_GENLOCKSUPPORTED 0x00000010 #define ADL_DISPLAY_DISPLAYINFO_MULTIVPU_SUPPORTED 0x00000020 #define ADL_DISPLAY_DISPLAYINFO_LDA_DISPLAY 0x00000040 #define ADL_DISPLAY_DISPLAYINFO_MODETIMING_OVERRIDESSUPPORTED 0x00000080 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_SINGLE 0x00000100 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_CLONE 0x00000200 /// Legacy support for XP #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2VSTRETCH 0x00000400 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2HSTRETCH 0x00000800 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_EXTENDED 0x00001000 /// More support manners #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCH1GPU 0x00010000 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCHNGPU 0x00020000 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED2 0x00040000 #define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED3 0x00080000 /// Projector display type #define ADL_DISPLAY_DISPLAYINFO_SHOWTYPE_PROJECTOR 0x00100000 #endif #define FLAG_INFO(name,info) {#name, info, name} // TODO: If code is cleaned up, replace with a Value_Name_Title table. Flag_Info all_flags[] = { // ulDDCInfoFlag {"ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE", NULL, ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE }, {"ADL_DISPLAYDDCINFOEX_FLAG_EDIDEXTENSION", NULL, ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE }, {"ADL_DISPLAYDDCINFOEX_FLAG_DIGITALDEVICE", NULL, ADL_DISPLAYDDCINFOEX_FLAG_DIGITALDEVICE }, {"ADL_DISPLAYDDCINFOEX_FLAG_HDMIAUDIODEVICE", NULL, ADL_DISPLAYDDCINFOEX_FLAG_HDMIAUDIODEVICE }, {"ADL_DISPLAYDDCINFOEX_FLAG_SUPPORTS_AI", NULL, ADL_DISPLAYDDCINFOEX_FLAG_SUPPORTS_AI }, {"ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC601", NULL, ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC601 }, {"ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC709", NULL, ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC709 }, // ADLDisplayInfo.iDisplayInfoMask, .iDisplayInfoValue // @{ FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_NONLOCAL , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_FORCIBLESUPPORTED , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_GENLOCKSUPPORTED , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MULTIVPU_SUPPORTED , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_LDA_DISPLAY , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MODETIMING_OVERRIDESSUPPORTED , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_SINGLE , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_CLONE , NULL), /// Legacy support for XP FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2VSTRETCH , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2HSTRETCH , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_EXTENDED , NULL), /// More support manners FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCH1GPU , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCHNGPU , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED2 , NULL), FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED3 , NULL), /// Projector display type FLAG_INFO(ADL_DISPLAY_DISPLAYINFO_SHOWTYPE_PROJECTOR , NULL), }; #define all_flags_ct ( sizeof(all_flags)/sizeof(Flag_Info) ) Flag_Dictionary all_flags_dict = { all_flags_ct, all_flags }; char * ddcInfoFlagNames[] = { "ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE", "ADL_DISPLAYDDCINFOEX_FLAG_EDIDEXTENSION", "ADL_DISPLAYDDCINFOEX_FLAG_DIGITALDEVICE", "ADL_DISPLAYDDCINFOEX_FLAG_HDMIAUDIODEVICE", "ADL_DISPLAYDDCINFOEX_FLAG_SUPPORTS_AI", "ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC601", "ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC709" }; Flag_Name_Set ddcInfoFlagNameSet = { sizeof(ddcInfoFlagNames)/sizeof(char *), ddcInfoFlagNames }; char * displayInfoValueNames[] = { "ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED", "ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED", "ADL_DISPLAY_DISPLAYINFO_NONLOCAL", "ADL_DISPLAY_DISPLAYINFO_FORCIBLESUPPORTED", "ADL_DISPLAY_DISPLAYINFO_GENLOCKSUPPORTED", "ADL_DISPLAY_DISPLAYINFO_MULTIVPU_SUPPORTED", "ADL_DISPLAY_DISPLAYINFO_LDA_DISPLAY", "ADL_DISPLAY_DISPLAYINFO_MODETIMING_OVERRIDESSUPPORTED", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_SINGLE", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_CLONE", /// Legacy support for XP "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2VSTRETCH", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2HSTRETCH", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_EXTENDED", /// More support manners "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCH1GPU", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCHNGPU", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED2", "ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED3", /// Projector display type "ADL_DISPLAY_DISPLAYINFO_SHOWTYPE_PROJECTOR", }; Flag_Name_Set displayInfoFlagNameSet = {sizeof(displayInfoValueNames)/sizeof(char*), displayInfoValueNames}; #ifdef REFERENCE typedef struct AdapterInfo { /// \ALL_STRUCT_MEM /// Size of the structure. int iSize; /// The ADL index handle. One GPU may be associated with one or two index handles int iAdapterIndex; /// The unique device ID associated with this adapter. char strUDID[ADL_MAX_PATH]; /// The BUS number associated with this adapter. int iBusNumber; /// The driver number associated with this adapter. int iDeviceNumber; /// The function number. int iFunctionNumber; /// The vendor ID associated with this adapter. int iVendorID; /// Adapter name. char strAdapterName[ADL_MAX_PATH]; /// Display name. For example, "\\Display0" for Windows or ":0:0" for Linux. char strDisplayName[ADL_MAX_PATH]; /// Present or not; 1 if present and 0 if not present.It the logical adapter is present, the display name such as \\.\Display1 can be found from OS int iPresent; // @} #if defined (_WIN32) || defined (_WIN64) /// \WIN_STRUCT_MEM /// Exist or not; 1 is exist and 0 is not present. int iExist; /// Driver registry path. char strDriverPath[ADL_MAX_PATH]; /// Driver registry path Ext for. char strDriverPathExt[ADL_MAX_PATH]; /// PNP string from Windows. char strPNPString[ADL_MAX_PATH]; /// It is generated from EnumDisplayDevices. int iOSDisplayIndex; // @} #endif /* (_WIN32) || (_WIN64) */ #if defined (LINUX) /// \LNX_STRUCT_MEM /// Internal X screen number from GPUMapInfo (DEPRICATED use XScreenInfo) int iXScreenNum; /// Internal driver index from GPUMapInfo int iDrvIndex; /// \deprecated Internal x config file screen identifier name. Use XScreenInfo instead. char strXScreenConfigName[ADL_MAX_PATH]; // @} #endif /* (LINUX) */ } AdapterInfo, *LPAdapterInfo; #endif /** */ void report_adl_AdapterInfo(AdapterInfo * pAdapterInfo, int depth) { rpt_structure_loc("AdapterInfo", pAdapterInfo, depth); printf(" iSize (size of structure): %d\n", pAdapterInfo->iSize); printf(" iAdapterIndex (ADL index handle): %d\n", pAdapterInfo->iAdapterIndex); printf(" strUUID (UUID for this adapter): %s\n", pAdapterInfo->strUDID); printf(" iBusNumber (bus number for this adapter): %d\n", pAdapterInfo->iBusNumber); printf(" iDeviceNumber (device number for this adapter): %d\n", pAdapterInfo->iDeviceNumber); printf(" iFunctionNumber (function number): %d\n", pAdapterInfo->iFunctionNumber); printf(" iVendorID (vendor ID): %d\n", pAdapterInfo->iVendorID); printf(" strAdapterName (adapter name): %s\n", pAdapterInfo->strAdapterName); printf(" strDisplayName (display name): %s\n", pAdapterInfo->strDisplayName); printf(" iPresent (is logical adapter present) %d\n", pAdapterInfo->iPresent); printf(" iXScreenNum (deprecated, use XScreenInfo): %d\n", pAdapterInfo->iXScreenNum); printf(" iDrvIndex (internal driver index from GPUMapInfo): %d\n", pAdapterInfo->iDrvIndex); printf(" strXScreenConfigName (deprecated, use XSCreenInfo): %s\n", pAdapterInfo->strXScreenConfigName); } #ifdef REFERENCE ///////////////////////////////////////////////////////////////////////////////////////////// ///\brief Structure containing information about the display device. /// /// This structure is used to store display device information /// such as display index, type, name, connection status, mapped adapter and controller indexes, /// whether or not multiple VPUs are supported, local display connections or not (through Lasso), etc. /// This information can be returned to the user. Alternatively, it can be used to access various driver calls to set /// or fetch various display device related settings upon the user's request. /// \nosubgrouping //////////////////////////////////////////////////////////////////////////////////////////// typedef struct ADLDisplayID { /// The logical display index belonging to this adapter. int iDisplayLogicalIndex; ///\brief The physical display index. /// For example, display index 2 from adapter 2 can be used by current adapter 1.\n /// So current adapter may enumerate this adapter as logical display 7 but the physical display /// index is still 2. int iDisplayPhysicalIndex; /// The persistent logical adapter index for the display. int iDisplayLogicalAdapterIndex; ///\brief The persistent physical adapter index for the display. /// It can be the current adapter or a non-local adapter. \n /// If this adapter index is different than the current adapter, /// the Display Non Local flag is set inside DisplayInfoValue. int iDisplayPhysicalAdapterIndex; } ADLDisplayID, *LPADLDisplayID; #endif /** */ void report_adl_ADLDisplayID(ADLDisplayID * pADLDisplayID, int depth) { rpt_structure_loc("ADLDisplayID", pADLDisplayID, depth); int d = depth + 1; rpt_int("iDisplayLogicalIndex", "logical display index for this adapter", pADLDisplayID->iDisplayLogicalIndex, d); rpt_int("iDisplayPhysicalIndex", "physical display index", pADLDisplayID->iDisplayPhysicalIndex, d); rpt_int("iDisplayLogicalAdapterIndex", "persistent logical adapter index", pADLDisplayID->iDisplayLogicalAdapterIndex, d); rpt_int("iDisplayPhysicalAdapterIndex", NULL, pADLDisplayID->iDisplayPhysicalAdapterIndex,d); } #ifdef REFERENCE ///////////////////////////////////////////////////////////////////////////////////////////// ///\brief Structure containing information about the display device. /// /// This structure is used to store various information about the display device. This /// information can be returned to the user, or used to access various driver calls to set /// or fetch various display-device-related settings upon the user's request /// \nosubgrouping //////////////////////////////////////////////////////////////////////////////////////////// typedef struct ADLDisplayInfo { /// The DisplayID structure ADLDisplayID displayID; ///\deprecated The controller index to which the display is mapped.\n Will not be used in the future\n int iDisplayControllerIndex; /// The display's EDID name. char strDisplayName[ADL_MAX_PATH]; /// The display's manufacturer name. char strDisplayManufacturerName[ADL_MAX_PATH]; /// The Display type. For example: CRT, TV, CV, DFP. int iDisplayType; /// The display output type. For example: HDMI, SVIDEO, COMPONMNET VIDEO. int iDisplayOutputType; /// The connector type for the device. int iDisplayConnector; ///\brief The bit mask identifies the number of bits ADLDisplayInfo is currently using. \n /// It will be the sum all the bit definitions in ADL_DISPLAY_DISPLAYINFO_xxx. int iDisplayInfoMask; /// The bit mask identifies the display status. \ref define_displayinfomask int iDisplayInfoValue; } ADLDisplayInfo, *LPADLDisplayInfo; #endif #ifdef reference /// \defgroup define_display_type Display Type /// Define Monitor/CRT display type // @{ /// Define Monitor display type #define ADL_DT_MONITOR 0 /// Define TV display type #define ADL_DT_TELEVISION 1 /// Define LCD display type #define ADL_DT_LCD_PANEL 2 /// Define DFP display type #define ADL_DT_DIGITAL_FLAT_PANEL 3 /// Define Componment Video display type #define ADL_DT_COMPONENT_VIDEO 4 /// Define Projector display type #define ADL_DT_PROJECTOR 5 // @} /// \defgroup define_display_connection_type Display Connection Type // @{ /// Define unknown display output type #define ADL_DOT_UNKNOWN 0 /// Define composite display output type #define ADL_DOT_COMPOSITE 1 /// Define SVideo display output type #define ADL_DOT_SVIDEO 2 /// Define analog display output type #define ADL_DOT_ANALOG 3 /// Define digital display output type #define ADL_DOT_DIGITAL 4 // @} /// \defgroup define_displayinfo_connector Display Connector Type /// defines for ADLDisplayInfo.iDisplayConnector // @{ #define ADL_DISPLAY_CONTYPE_UNKNOWN 0 #define ADL_DISPLAY_CONTYPE_VGA 1 #define ADL_DISPLAY_CONTYPE_DVI_D 2 #define ADL_DISPLAY_CONTYPE_DVI_I 3 #define ADL_DISPLAY_CONTYPE_ATICVDONGLE_NTSC 4 #define ADL_DISPLAY_CONTYPE_ATICVDONGLE_JPN 5 #define ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_JPN 6 #define ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_NTSC 7 #define ADL_DISPLAY_CONTYPE_PROPRIETARY 8 #define ADL_DISPLAY_CONTYPE_HDMI_TYPE_A 10 #define ADL_DISPLAY_CONTYPE_HDMI_TYPE_B 11 #define ADL_DISPLAY_CONTYPE_SVIDEO 12 #define ADL_DISPLAY_CONTYPE_COMPOSITE 13 #define ADL_DISPLAY_CONTYPE_RCA_3COMPONENT 14 #define ADL_DISPLAY_CONTYPE_DISPLAYPORT 15 #define ADL_DISPLAY_CONTYPE_EDP 16 #define ADL_DISPLAY_CONTYPE_WIRELESSDISPLAY 17 // @} #endif static char * displayTypeNames[] = { "ADL_DT_MONITOR", "ADL_DT_TELEVISION", "ADL_DT_LCD_PANEL", "ADL_DT_DIGITAL_FLAT_PANEL", "ADL_DT_COMPONENT_VIDEO", "ADL_DT_PROJECTOR" }; static int displayTypeNameCt = sizeof(displayTypeNames)/sizeof(char *); static char * displayOutputTypeNames[] = { "ADL_DOT_UNKNOWN", "ADL_DOT_COMPOSITY", "ADL_DOT_SVIDEO", "ADL_DOT_ANALOG", "ADL_DOT_DIGITAL" }; static int displayOutputTypeNameCt = sizeof(displayOutputTypeNames)/sizeof(char *); static char * displayConnectorTypeNames[] = { "ADL_DISPLAY_CONTYPE_UNKNOWN", // 0 "ADL_DISPLAY_CONTYPE_VGA", // 1 "ADL_DISPLAY_CONTYPE_DVI_D", // 2 "ADL_DISPLAY_CONTYPE_DVI_I", // 3 "ADL_DISPLAY_CONTYPE_ATICVDONGLE_NTSC", // 4 "ADL_DISPLAY_CONTYPE_ATICVDONGLE_JPN", // 5 "ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_JPN", // 6 "ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_NTSC", // 7 "ADL_DISPLAY_CONTYPE_PROPRIETARY", // 8 "INVALID CODE", // 9 - not defined "ADL_DISPLAY_CONTYPE_HDMI_TYPE_A", // 10 "ADL_DISPLAY_CONTYPE_HDMI_TYPE_B", // 11 "ADL_DISPLAY_CONTYPE_SVIDEO", // 12 "ADL_DISPLAY_CONTYPE_COMPOSITE", // 13 "ADL_DISPLAY_CONTYPE_RCA_3COMPONENT", // 14 "ADL_DISPLAY_CONTYPE_DISPLAYPORT", // 15 "ADL_DISPLAY_CONTYPE_EDP", // 16 "ADL_DISPLAY_CONTYPE_WIRELESSDISPLAY" // 17 }; static int displayConnectorTypeNamesCt = sizeof(displayConnectorTypeNames) / sizeof(char *); /** */ char * displayTypeName(int iDisplayType) { assert(0 <= iDisplayType && iDisplayType < displayTypeNameCt); return displayTypeNames[iDisplayType]; } /** */ char * displayOutputTypeName(int iDisplayOutputType) { assert(0 <= iDisplayOutputType && iDisplayOutputType < displayOutputTypeNameCt); return displayOutputTypeNames[iDisplayOutputType]; } /** */ char * displayConnectorTypeName(int iDisplayConnector) { assert(0 <= iDisplayConnector && iDisplayConnector < displayConnectorTypeNamesCt); return displayConnectorTypeNames[iDisplayConnector]; } /** */ void report_adl_ADLDisplayInfo(ADLDisplayInfo * pADLDisplayInfo, int depth) { rpt_structure_loc("ADLDisplayInfo", pADLDisplayInfo, depth); if (pADLDisplayInfo) { rpt_title("ADLDisplayID:", depth+1); report_adl_ADLDisplayID(&pADLDisplayInfo->displayID,depth+2); int d = depth+1; rpt_int("iDisplayControllerIndex", "deprecated", pADLDisplayInfo->iDisplayControllerIndex, d); rpt_str("strDisplayName", "EDID name", pADLDisplayInfo->strDisplayName, d); rpt_str("strDisplayManufacturerName", "display mfg name", pADLDisplayInfo->strDisplayManufacturerName, d); rpt_mapped_int("iDisplayType", "e.g. CRT, DFP", pADLDisplayInfo->iDisplayType, displayTypeName, d); rpt_mapped_int("iDisplayOutputType", "e.g. HDMI", pADLDisplayInfo->iDisplayOutputType, displayOutputTypeName, d); rpt_mapped_int("iDisplayConnector", "connector type", pADLDisplayInfo->iDisplayConnector, displayConnectorTypeName, d); rpt_int_as_hex("iDisplayInfoMask", "bits ADLDisplayInfo using", pADLDisplayInfo->iDisplayInfoMask, d); rpt_ifval2("iDisplayInfoMask", "bits ADLDisplayInfo using", pADLDisplayInfo->iDisplayInfoMask, &displayInfoFlagNameSet, &all_flags_dict, d); rpt_int_as_hex("iDisplayInfoValue", "display status", pADLDisplayInfo->iDisplayInfoValue, d); rpt_ifval2("iDisplayInfoValue", "display status", pADLDisplayInfo->iDisplayInfoValue, &displayInfoFlagNameSet, &all_flags_dict, d); } } #ifdef REFERENCE ///////////////////////////////////////////////////////////////////////////////////////////// ///\brief Structure containing information about EDID data. /// /// This structure is used to store the information about EDID data for the adapter. /// This structure is used by the ADL_Display_EdidData_Get() and ADL_Display_EdidData_Set() functions. /// \nosubgrouping //////////////////////////////////////////////////////////////////////////////////////////// typedef struct ADLDisplayEDIDData { /// Size of the structure int iSize; /// Set to 0 int iFlag; /// Size of cEDIDData. Set by ADL_Display_EdidData_Get() upon return int iEDIDSize; /// 0, 1 or 2. If set to 3 or above an error ADL_ERR_INVALID_PARAM is generated int iBlockIndex; /// EDID data char cEDIDData[ADL_MAX_EDIDDATA_SIZE]; /// Reserved int iReserved[4]; }ADLDisplayEDIDData; #endif /** */ void report_adl_ADLDisplayEDIDData(ADLDisplayEDIDData * pEDIDData, int depth) { rpt_structure_loc("ADLDisplayEDIDData", pEDIDData, depth); if (pEDIDData) { int d = depth+1; rpt_int( "iSize", "size of structure", pEDIDData->iSize, d); rpt_int_as_hex("iFlag", "", pEDIDData->iFlag, d); rpt_int( "iEDIDSize", "size of cEDIDData", pEDIDData->iEDIDSize, d); rpt_int( "iBlockIndex", "0,1,2", pEDIDData->iBlockIndex, d); printf("%*scEDIDData:\n", rpt_get_indent(d), ""); hex_dump((unsigned char *) pEDIDData->cEDIDData, ADL_MAX_EDIDDATA_SIZE); } } #ifdef REFERENCE ///////////////////////////////////////////////////////////////////////////////////////////// ///\brief Structure containing DDC information. /// /// This structure is used to store various DDC information that can be returned to the user. /// Note that all fields of type int are actually defined as unsigned int types within the driver. /// \nosubgrouping //////////////////////////////////////////////////////////////////////////////////////////// typedef struct ADLDDCInfo2 { /// Size of the structure int ulSize; /// Indicates whether the attached display supports DDC. If this field is zero on return, no other DDC /// information fields will be used. int ulSupportsDDC; /// Returns the manufacturer ID of the display device. Should be zeroed if this information is not available. int ulManufacturerID; /// Returns the product ID of the display device. Should be zeroed if this information is not available. int ulProductID; /// Returns the name of the display device. Should be zeroed if this information is not available. char cDisplayName[ADL_MAX_DISPLAY_NAME]; /// Returns the maximum Horizontal supported resolution. Should be zeroed if this information is not available. int ulMaxHResolution; /// Returns the maximum Vertical supported resolution. Should be zeroed if this information is not available. int ulMaxVResolution; /// Returns the maximum supported refresh rate. Should be zeroed if this information is not available. int ulMaxRefresh; /// Returns the display device preferred timing mode's horizontal resolution. int ulPTMCx; /// Returns the display device preferred timing mode's vertical resolution. int ulPTMCy; /// Returns the display device preferred timing mode's refresh rate. int ulPTMRefreshRate; /// Return EDID flags. int ulDDCInfoFlag; // Returns 1 if the display supported packed pixel, 0 otherwise int bPackedPixelSupported; // Returns the Pixel formats the display supports \ref define_ddcinfo_pixelformats int iPanelPixelFormat; /// Return EDID serial ID. int ulSerialID; // Reserved for future use int iReserved[26]; } ADLDDCInfo2, *LPADLDDCInfo2; #endif /** */ void report_adl_ADLDDCInfo2( ADLDDCInfo2 * pStruct, bool verbose, int depth) { rpt_structure_loc("ADLDDCInfo2", pStruct, depth); int d = depth+1; rpt_int( "ulSize", "size of structure", pStruct->ulSize, d); rpt_int( "ulSupportsDDC", "does display support DDC", pStruct->ulSupportsDDC, d); if (pStruct->ulSupportsDDC) { rpt_int( "ulManufacturerID", "manufacturer id", pStruct->ulManufacturerID, d); rpt_int_as_hex("ulManufacturerID", "manufacturer id", pStruct->ulManufacturerID, d); ushort us = pStruct->ulManufacturerID; char parsedMfgId[4]; parse_mfg_id_in_buffer((Byte*)&us, parsedMfgId, sizeof(parsedMfgId)); rpt_str( "ulManufacturerID", "manufacturer id", parsedMfgId, d); rpt_int( "ulProductID", "product id", pStruct->ulProductID, d); rpt_str( "cDisplayName", "name of display device", pStruct->cDisplayName, d); if (verbose) { rpt_int( "ulMaxHResolution", "max horizontal resolution", pStruct->ulMaxHResolution, d); rpt_int( "ulMaxVResolution", "max vertical resolution", pStruct->ulMaxVResolution, d); rpt_int( "ulMaxRefresh", "max refresh rate", pStruct->ulMaxRefresh, d); rpt_int( "ulPTMCx", "preferred horizontal res", pStruct->ulPTMCx, d); rpt_int( "ulPTMCy", "preferred vertical res", pStruct->ulPTMCy, d); rpt_int( "ulPTMRefreshRate", "preferred refresh rate", pStruct->ulPTMRefreshRate, d); } rpt_int_as_hex("ulDDCInfoFlag", "EDID flags", pStruct->ulDDCInfoFlag, d); rpt_ifval2("ulDDCInfoFlag", "EDID flags", pStruct->ulDDCInfoFlag, &ddcInfoFlagNameSet, &all_flags_dict, d); if (verbose) { rpt_int("bPackedPixelSupported", "supports packed pixel?", pStruct->bPackedPixelSupported, d); rpt_int_as_hex("iPanelPixelFormat", "pixel formats supported", pStruct->iPanelPixelFormat, d); } rpt_int( "ulSerialID", "EDID serial ID", pStruct->ulSerialID, d); } } ddcutil-0.8.6/src/adl/adl_impl/adl_shim.c0000644000175000001440000002132313230445447015135 00000000000000/* adl_shim.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Implementation of interface in adl/adl_shim.h for use when building * **ddcutil** with ADL support. */ /** \cond */ #include #include #include // wchar_t, needed by adl_structures.h #include #include /** \endcond */ #include "public/ddcutil_types.h" #include "util/edid.h" #include "util/report_util.h" #include "util/string_util.h" #include "base/core.h" #include "base/displays.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" #include "adl/adl_impl/adl_intf.h" #include "adl/adl_shim.h" // Initialization /** Wrappers adl_intf function adl_is_available(). * * @return true if ADL interface has been initialized, false if not */ bool adlshim_is_available() { bool result = adl_is_available(); // DBGMSG("Returning: %s", bool_repr(result)); return result; } /** Initialize the ADL subsystem. Wrappers function adl_initialize(). * * Must be called before any other function (except adlshim_is_available()): * * @retval true success * @retval false failure */ bool adlshim_initialize() { bool result = adl_initialize(); // DBGMSG("Returning: %s", bool_repr(result)); return result; } void adlshim_release() { adl_release(); } // Report on active displays Parsed_Edid* adlshim_get_parsed_edid_by_adlno(int iAdapterIndex, int iDisplayIndex) { return adl_get_parsed_edid_by_adlno(iAdapterIndex, iDisplayIndex); } Parsed_Edid* adlshim_get_parsed_edid_by_display_handle( Display_Handle * dh) { assert(dh && dh->dref && dh->dref->io_path.io_mode == DDCA_IO_ADL); return adl_get_parsed_edid_by_adlno( dh->dref->io_path.path.adlno.iAdapterIndex, dh->dref->io_path.path.adlno.iDisplayIndex); } Parsed_Edid* adlshim_get_parsed_edid_by_display_ref( Display_Ref * dref) { assert(dref && dref->io_path.io_mode == DDCA_IO_ADL); return adl_get_parsed_edid_by_adlno(dref->io_path.path.adlno.iAdapterIndex, dref->io_path.path.adlno.iDisplayIndex); } #ifdef UNUSED // needed? void adlshim_show_active_display_by_adlno(int iAdapterIndex, int iDisplayIndex, int depth) { return adl_report_active_display_by_adlno(iAdapterIndex, iDisplayIndex, depth); } #endif void adlshim_report_active_display_by_display_ref(Display_Ref * dref, int depth) { assert(dref && dref->io_path.io_mode == DDCA_IO_ADL); return adl_report_active_display_by_adlno( dref->io_path.path.adlno.iAdapterIndex, dref->io_path.path.adlno.iDisplayIndex, depth); } // Find and validate display bool adlshim_is_valid_display_ref(Display_Ref * dref, bool emit_error_msg) { assert(dref && dref->io_path.io_mode == DDCA_IO_ADL); // assert(dref->ddc_io_mode == DDC_IO_ADL); // ASSERT_DISPLAY_IO_MODE(dref, DDCA_IO_ADL); return adl_is_valid_adlno( dref->io_path.path.adlno.iAdapterIndex, dref->io_path.path.adlno.iDisplayIndex, emit_error_msg); } #ifdef OLD // used by get_fallback_hiddev_edid() in usb_edid.c Display_Ref * adlshim_find_display_by_mfg_model_sn(const char * mfg_id, const char * model, const char * sn) { Display_Ref * dref = NULL; ADL_Display_Rec * adl_rec = adl_find_display_by_mfg_model_sn(mfg_id, model, sn); if (adl_rec) dref = create_adl_display_ref(adl_rec->iAdapterIndex, adl_rec->iDisplayIndex); return dref; } #endif // used by get_fallback_hiddev_edid() in usb_edid.c DDCA_Adlno adlshim_find_adlno_by_mfg_model_sn(const char * mfg_id, const char * model, const char * sn) { DDCA_Adlno result = {-1,-1}; ADL_Display_Rec * adl_rec = adl_find_display_by_mfg_model_sn(mfg_id, model, sn); if (adl_rec) { result.iAdapterIndex = adl_rec->iAdapterIndex; result.iDisplayIndex = adl_rec->iDisplayIndex; } return result; } #ifdef OLD Display_Ref * adlshim_find_display_by_edid(const Byte * pEdidBytes) { Display_Ref * dref = NULL; ADL_Display_Rec * adl_rec = adl_find_display_by_edid(pEdidBytes); if (adl_rec) dref = create_adl_display_ref(adl_rec->iAdapterIndex, adl_rec->iDisplayIndex); return dref; } #endif #ifdef OLD Display_Info_List adlshim_get_valid_displays() { return adl_get_valid_displays(); } #endif int adlshim_get_valid_display_ct() { return adl_get_active_display_ct(); } GPtrArray * adlshim_get_valid_display_details() { GPtrArray * pa = g_ptr_array_new(); int ct = adl_get_active_display_ct(); for (int ndx = 0; ndx < ct; ndx++) { ADL_Display_Rec * irec = adl_get_active_display_rec(ndx); ADL_Display_Detail * orec = calloc(1, sizeof(ADL_Display_Detail)); memcpy(orec->marker, ADL_DISPLAY_DETAIL_MARKER, 4); orec->iAdapterIndex = irec->iAdapterIndex; orec->iDisplayIndex = irec->iDisplayIndex; orec->supports_ddc = irec->supports_ddc; orec->pEdid = irec->pEdid; orec->xrandr_name = strdup(irec->xrandr_name); g_ptr_array_add(pa, orec); } return pa; } void adlshim_report_adl_display_detail(ADL_Display_Detail * detail, int depth) { int d1 = depth+1; rpt_structure_loc("ADL_Display_Detail", detail, depth); rpt_int("iAdapterIndex", NULL, detail->iAdapterIndex, d1); rpt_int("iDisplayIndex", NULL, detail->iDisplayIndex, d1); rpt_bool("supports ddc", NULL, detail->supports_ddc, d1); rpt_str("xrandr_name", NULL, detail->xrandr_name, d1); report_parsed_edid(detail->pEdid, true, d1); } /** Get video card information for an ADL display. * * @param dh display handle * @param card_info pointer to Video_Card_Info struct to be filled in * @return modulated ADL status code */ Modulated_Status_ADL adlshim_get_video_card_info( Display_Handle * dh, Video_Card_Info * card_info) { Base_Status_ADL adlrc = adl_get_video_card_info_by_adlno( dh->dref->io_path.path.adlno.iAdapterIndex, dh->dref->io_path.path.adlno.iDisplayIndex, card_info); return modulate_rc(adlrc, RR_ADL); } // Read from and write to the display /** Issues a DDC write through ADL. * * @param dh display handle * @param pSendMsgBuf pointer to bytes to send * @param sendMsgLen number of bytes to send * * @return modulated ADL status code */ Modulated_Status_ADL adlshim_ddc_write_only( Display_Handle* dh, Byte * pSendMsgBuf, int sendMsgLen) { assert(dh && dh->dref && dh->dref->io_path.io_mode == DDCA_IO_ADL); Base_Status_ADL adlrc = adl_ddc_write_only( dh->dref->io_path.path.adlno.iAdapterIndex, dh->dref->io_path.path.adlno.iDisplayIndex, pSendMsgBuf, sendMsgLen); return modulate_rc(adlrc, RR_ADL); } /** Issues a DDC read through ADL. * * @param dh display handle * @param pRcvMsgBuf pointer to buffer in which to return data read * @param pRcvBytect pointer to location where number of bytes read is stored * * @return modulated ADL status code */ Modulated_Status_ADL adlshim_ddc_read_only( Display_Handle* dh, Byte * pRcvMsgBuf, int * pRcvBytect) { assert(dh && dh->dref && dh->dref->io_path.io_mode == DDCA_IO_ADL); Base_Status_ADL adlrc = adl_ddc_read_only( dh->dref->io_path.path.adlno.iAdapterIndex, dh->dref->io_path.path.adlno.iDisplayIndex, pRcvMsgBuf, pRcvBytect); return modulate_rc(adlrc, RR_ADL); } //Base_Status_ADL adl_ddc_write_read( // int iAdapterIndex, // int iDisplayIndex, // Byte * pSendMsgBuf, // int sendMsgLen, // Byte * pRcvMsgBuf, // int * pRcvBytect); //Base_Status_ADL adl_ddc_write_read_onecall( // int iAdapterIndex, // int iDisplayIndex, // Byte * pSendMsgBuf, // int sendMsgLen, // Byte * pRcvMsgBuf, // int * pRcvBytect); ddcutil-0.8.6/src/adl/adl_impl/adl_aux_intf.h0000644000175000001440000000336113230445447016021 00000000000000/* adl_aux_intf.h */ /** \file * Functions in this file were originally part of adl_inf.c, * but with code refactoring are now only called from tests. */ /* * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef ADL_AUX_INTF_H_ #define ADL_AUX_INTF_H_ #include "base/core.h" #include "base/status_code_mgt.h" Base_Status_ADL adl_ddc_write_only_with_retry( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen); Base_Status_ADL adl_ddc_write_read_with_retry( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect); Base_Status_ADL adl_ddc_get_vcp(int iAdapterIndex, int iDisplayIndex, Byte vcp_feature_code, bool onecall); Base_Status_ADL adl_ddc_set_vcp(int iAdapterIndex, int iDisplayIndex, Byte vcp_feature_code, int newval); #endif /* ADL_AUX_INTF_H_ */ ddcutil-0.8.6/src/adl/adl_impl/adl_friendly.h0000644000175000001440000001551113230445447016020 00000000000000/* adl_friendly.h */ /** \file * Type definitions, function declarations, etc that should be private to adl_intf.c, * but need to be visible to other ADL related files, particularly tests. */ /* * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef ADL_FRIENDLY_H_ #define ADL_FRIENDLY_H_ #include "base/core.h" #include "adl/adl_impl/adl_intf.h" #include "adl/adl_impl/adl_sdk_includes.h" #define MAX_ACTIVE_DISPLAYS 16 typedef struct { // bool initialized; void *hDLL; int ( *ADL_Main_Control_Create ) (ADL_MAIN_MALLOC_CALLBACK, int iEnumConnectedAdapters ); int ( *ADL_Main_Control_Destroy ) (); int ( *ADL_Adapter_NumberOfAdapters_Get)(int *lpNumAdapters); int ( *ADL_Adapter_AdapterInfo_Get)(LPAdapterInfo lpInfo, int iInputSize); int ( *ADL_Adapter_VideoBiosInfo_Get)(int iAdapterIndex, ADLBiosInfo* lpBiosInfo); int ( *ADL2_Adapter_VideoBiosInfo_Get)(ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLBiosInfo* lpBiosInfo); int ( *ADL_Display_NumberOfDisplays_Get)(int iAdapterIndex, int *lpNumDisplays); int ( *ADL_Display_DisplayInfo_Get)(int iAdapterIndex, int *lpNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect); int ( *ADL_Display_ColorCaps_Get ) (int, int, int *, int *); int ( *ADL_Display_Color_Get ) ( int, int, int, int *, int *, int *, int *, int * ); int ( *ADL_Display_Color_Set ) ( int, int, int, int ); int ( *ADL2_Display_ColorCaps_Get ) (ADL_CONTEXT_HANDLE context, int, int, int *, int *); int ( *ADL2_Display_Color_Get ) (ADL_CONTEXT_HANDLE context, int, int, int, int *, int *, int *, int *, int * ); int ( *ADL2_Display_Color_Set ) (ADL_CONTEXT_HANDLE context, int, int, int, int ); // I2C, DDC, and EDID APIs int ( *ADL2_Display_WriteAndReadI2CRev_Get ) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int * lpMajor, int * lpMinor); int ( * ADL_Display_WriteAndReadI2CRev_Get ) (int iAdapterIndex, int * lpMajor, int * lpMinor); int ( *ADL2_Display_WriteAndReadI2C ) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, ADLI2C * pii2C); int ( * ADL_Display_WriteAndReadI2C ) (int iAdapterIndex, ADLI2C * pii2C); int ( *ADL2_Display_DDCBlockAccess_Get) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, int iOption, int iCommandIndex, int iSendMsgLen, char * lpucSendMsgBuf, int * lpulRecvMsgLen, char * lpucRecvMsgBuf ); int ( * ADL_Display_DDCBlockAccess_Get) ( int iAdapterIndex, int iDisplayIndex, int iOption, int iCommandIndex, int iSendMsgLen, char * lpucSendMsgBuf, int * lpulRecvMsgLen, char * lpucRecvMsgBuf ); int ( *ADL2_Display_DDCInfo_Get ) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDDCInfo * lpinfo); int ( * ADL_Display_DDCInfo_Get ) ( int iAdapterIndex, int iDisplayIndex, ADLDDCInfo * lpinfo); int ( *ADL2_Display_DDCInfo2_Get ) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDDCInfo2 * lpinfo); int ( * ADL_Display_DDCInfo2_Get ) ( int iAdapterIndex, int iDisplayIndex, ADLDDCInfo2 * lpinfo); int ( *ADL2_Display_EdidData_Get ) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData* lpEDIDData); int ( * ADL_Display_EdidData_Get ) ( int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData* lpEDIDData); // Linux only APIs int ( *ADL2_Adapter_XScreenInfo_Get ) (ADL_CONTEXT_HANDLE context, XScreenInfo * lpXScreeninfo, int inputSize); int ( * ADL_Adapter_XScreenInfo_Get ) ( XScreenInfo * lpXScreeninfo, int inputSize); int ( *ADL2_Display_XrandrDisplayName_Get ) (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int iDisplayIndex, char * lpXrandrDisplayName, int iBuffSize); int ( * ADL_Display_XrandrDisplayName_Get ) ( int iAdapterIndex, int iDisplayIndex, char * lpXrandrDisplayName, int iBuffSize); } Adl_Procs; // defined in adl_intf.c: extern Adl_Procs* adl; extern int active_display_ct; extern ADL_Display_Rec active_displays[MAX_ACTIVE_DISPLAYS]; int call_ADL_Display_DDCBlockAccess_Get( int iAdapterIndex, int iDisplayIndex, int iOption, int xxx, int iSendMsgLen, char * lpucSendMsgBuf, int * iRecvMsgLen, char * lpucRcvMsgBuf); #endif /* ADL_FRIENDLY_H_ */ ddcutil-0.8.6/src/adl/adl_impl/adl_intf.h0000644000175000001440000001112113230445447015135 00000000000000/* adl_intf.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ #ifndef ADL_INTF_H_ #define ADL_INTF_H_ /** \cond */ #include #include #include // wchar_t, needed by adl_structures.h /** \endcond */ #include "util/edid.h" #include "base/core.h" #include "base/displays.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" #include "adl/adl_impl/adl_sdk_includes.h" /** Describes an ADL display. * * Used only within ADL implementation code and tests */ typedef struct { int iAdapterIndex; int iDisplayIndex; bool supports_ddc; ADLDisplayEDIDData * pAdlEdidData; ADLDDCInfo2 * pAdlDDCInfo2; char mfg_id[4]; char model_name[14]; char serial_ascii[14]; char xrandr_name[16]; // what is correct maximum size? Parsed_Edid * pEdid; // additional fields added 12/2015 for further exploration int iVendorID; // e.g. 4098 // waste of space to reserve full ADL_MAX_PATH for each field char * pstrAdapterName; char * pstrDisplayName; // char strAdapterName[ADL_MAX_PATH]; // e.g. "AMD Radeon HD 6420" // char strDisplayName[ADL_MAX_PATH]; // e.g. :0.0 #ifdef UNUSED int iBusNumber; // don't think this is I2C bus int iFunctionNumber; // not useful int iDrvIndex; #endif } ADL_Display_Rec; // Initialization bool adl_is_available(); // must be called before any other function (except is_adl_available()): bool adl_initialize(); void adl_release(); // Report on active displays Parsed_Edid* adl_get_parsed_edid_by_adlno(int iAdapterIndex, int iDisplayIndex); void adl_report_active_display(ADL_Display_Rec * pdisp, int depth); void adl_report_active_display_by_index(int ndx, int depth); void adl_report_active_display_by_adlno(int iAdapterIndex, int iDisplayIndex, int depth); int adl_report_active_displays(); // returns number of active displays void report_adl_display_rec(ADL_Display_Rec * pRec, bool verbose, int depth); Base_Status_ADL adl_get_video_card_info_by_adlno( int iAdapterIndex, int iDisplayIndex, Video_Card_Info * card_info); // Find and validate display bool adl_is_valid_adlno(int iAdapterIndex, int iDisplayIndex, bool emit_error_msg); ADL_Display_Rec * adl_get_display_by_adlno(int iAdapterIndex, int iDisplayIndex, bool emit_error_msg); ADL_Display_Rec * adl_find_display_by_mfg_model_sn(const char * mfg_id, const char * model, const char * sn); ADL_Display_Rec * adl_find_display_by_edid(const Byte * pEdidBytes); #ifdef OLd Display_Info_List adl_get_valid_displays(); #endif // new int adl_get_active_display_ct(); ADL_Display_Rec * adl_get_active_display_rec(int ndx); // Read from and write to the display Base_Status_ADL adl_ddc_write_only( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen); Base_Status_ADL adl_ddc_read_only( int iAdapterIndex, int iDisplayIndex, Byte * pRcvMsgBuf, int * pRcvBytect); Base_Status_ADL adl_ddc_write_read( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect); Base_Status_ADL adl_ddc_write_read_onecall( int iAdapterIndex, int iDisplayIndex, Byte * pSendMsgBuf, int sendMsgLen, Byte * pRcvMsgBuf, int * pRcvBytect); #endif /* ADL_INTF_H_ */ ddcutil-0.8.6/src/adl/adl_impl/adl_report.h0000644000175000001440000000314013230445447015512 00000000000000/* adl_report.h * * Report on data structures in ADL SDK * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Reports on data structures in ADL SDK. * * Used only for development and debugging. */ #ifndef ADL_REPORT_H_ #define ADL_REPORT_H_ /** \cond */ #include /** \endcond */ #include "util/report_util.h" #include "adl/adl_impl/adl_sdk_includes.h" void report_adl_AdapterInfo(AdapterInfo * pAdapterInfo, int depth); void report_adl_ADLDisplayID(ADLDisplayID * pADLDisplayID, int depth); void report_adl_ADLDisplayInfo(ADLDisplayInfo * pADLDisplayInfo, int depth); void report_adl_ADLDisplayEDIDData(ADLDisplayEDIDData * pEDIDData, int depth); void report_adl_ADLDDCInfo2( ADLDDCInfo2 * pStruct, bool verbose, int depth); #endif /* ADL_REPORT_H_ */ ddcutil-0.8.6/src/adl/adl_impl/adl_sdk_includes.h0000644000175000001440000000245413230445447016655 00000000000000/* adl_sdk_includes.h */ /** \file * Includes all header files from the ADL SDK, setting defines appropriately */ /* * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef ADL_SDK_INCLUDES_H_ #define ADL_SDK_INCLUDES_H_ /** \cond */ #include // wchar_t, needed by adl_structures.h /** \endcond */ #include #define LINUX #include #include #include "adl/adl_impl/adl_wrapmccs.h" #endif /* ADL_SDK_INCLUDES_H_ */ ddcutil-0.8.6/src/adl/adl_impl/adl_wrapmccs.h0000644000175000001440000000233513230445447016023 00000000000000/* adl_wrapmccs.h */ /* \file * File mccs.h from the ADL SDK lacks ifdef tests, which * can cause double inclusion resulting in errors. This * file should be included wherever mccs.h is needed. */ /* * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef ADL_WRAPMCCS_H_ #define ADL_WRAPMCCS_H_ typedef void * HMODULE; // needed by mccs.h #include #endif /* ADL_WRAPMCCS_H_ */ ddcutil-0.8.6/src/adl/adl_mock_impl/0000755000175000001440000000000013230445447014301 500000000000000ddcutil-0.8.6/src/adl/adl_mock_impl/adl_mock_shim.c0000644000175000001440000001065313230445447017163 00000000000000/* * adl_mock_shim.c * * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Mock implementation of ADL functions for use when **ddcutil** * is built without ADL support. Thse functions satisfy the * dynamic linker. */ /** \cond */ #include #include #include #include // wchar_t, needed by adl_structures.h /** \endcond */ #include "util/edid.h" #include "base/core.h" #include "base/displays.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" #include "adl/adl_shim.h" // Initialization bool adl_debug; /** Indicates if ADL support is available. * Always returns **false**, since this is a mock * implementation to satisfy the dynamic linker. * * @retval false */ bool adlshim_is_available() { return false; } /** Mock implementation of ADL Initialization. * Always returns **false** to indicate failure. * * @retval false */ bool adlshim_initialize() { return false; } // Report on active displays /** Mock implementation. * @retval NULL */ Parsed_Edid* adlshim_get_parsed_edid_by_adlno( int iAdapterIndex, int iDisplayIndex) { return NULL; } /** Mock implementation. * @retval NULL */ Parsed_Edid* adlshim_get_parsed_edid_by_display_handle( Display_Handle * dh) { return NULL; } /** Mock implementation. * @retval NULL */ Parsed_Edid* adlshim_get_parsed_edid_by_display_ref( Display_Ref * dref) { return NULL; } /** Mock implemention. Does nothing. */ void adlshim_report_active_display_by_display_ref( Display_Ref * dref, int depth) { } // Find and validate display /** Mock implementation. * @retval false */ bool adlshim_is_valid_display_ref( Display_Ref * dref, bool emit_error_msg) { return false; } #ifdef OLD /** Mock implementation. * @retval NULL */ Display_Ref * adlshim_find_display_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn) { return NULL; } #endif /** Mock implementation. * @retval {-1,-1} */ DDCA_Adlno adlshim_find_adlno_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn) { DDCA_Adlno result = {-1,-1}; return result; } #ifdef OLD /** Mock implementation to satisfy dynamic linker. * * @param pEdidBytes pointer to 128 byte EDID * @retval NULL */ Display_Ref * adlshim_find_display_by_edid(const Byte * pEdidBytes) { return NULL; } #endif #ifdef OLD /** Mock implementation to satisfy dynamic linker. * @return empty list */ Display_Info_List adlshim_get_valid_displays() { Display_Info_List info_list = {0,NULL}; return info_list; } #endif void adlshim_report_adl_display_detail(ADL_Display_Detail * detail, int depth) { } // new int adlshim_get_valid_display_ct() { return 0; } // new GPtrArray * adlshim_get_valid_display_details() { return g_ptr_array_new(); } /** Mock implementation to satisfy dynamic linker. Never called. */ Modulated_Status_ADL adlshim_get_video_card_info( Display_Handle * dh, Video_Card_Info * card_info) { assert(false); return 0; } // Read from and write to the display /** Mock implementation to satisfy dynamic linker. Never called. */ Modulated_Status_ADL adlshim_ddc_write_only( Display_Handle* dh, Byte * pSendMsgBuf, int sendMsgLen) { assert(false); return 0; // return code to avoid compile warning } /** Mock implementation to satisfy dynamic linker. Never called. */ Modulated_Status_ADL adlshim_ddc_read_only( Display_Handle* dh, Byte * pRcvMsgBuf, int * pRcvBytect) { assert(false); return 0; } ddcutil-0.8.6/src/adl/adl_mock_impl/adl_mock_errors.c0000644000175000001440000000411013101546540017517 00000000000000/* adl_mock_errors.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Mock ADL Error Number Services */ /** \cond */ #include #include /** \endcond */ #include "base/adl_errors.h" void init_adl_errors() {} /** Mock implementation if **get_adl_status_description()**. * * @param errnum unmodulated ADL status code * @retval NULL */ Status_Code_Info * get_adl_status_description( Base_Status_ADL errnum) { return NULL; } /** Mock implementation of **adl_error_name_to_number()**. * * @param adl_error_name symbolic name, e.g. ADL_ERR_NOT_SUPPORTED * @param p_adl_error_number where to return error number * @retval false */ bool adl_error_name_to_number( const char * adl_error_name, Base_Status_ADL * p_adl_error_number) { *p_adl_error_number = 0; return false; } /** Mock implementation of **adl_error_name_to_modulated_number()**. * * @param adl_error_name symbolic name, e.g. ADL_ERR_NOT_SUPPORTED * @param p_adl_error_number where to return error number * @retval false */ bool adl_error_name_to_modulated_number( const char * adl_error_name, Modulated_Status_ADL * p_adl_error_number) { *p_adl_error_number = 0; return false; } ddcutil-0.8.6/src/adl/Makefile.am0000644000175000001440000000114313213306116013450 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CPPFLAGS += -I@ADL_HEADER_DIR@ AM_CFLAGS = -Wall AM_CFLAGS += -Werror if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libadl.la libadl_la_SOURCES = if HAVE_ADL_COND libadl_la_SOURCES += \ adl_impl/adl_aux_intf.c \ adl_impl/adl_errors.c \ adl_impl/adl_intf.c \ adl_impl/adl_report.c \ adl_impl/adl_shim.c else libadl_la_SOURCES += \ adl_mock_impl/adl_mock_shim.c \ adl_mock_impl/adl_mock_errors.c endif ddcutil-0.8.6/src/adl/Makefile.in0000644000175000001440000005710013230171236013467 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand @HAVE_ADL_COND_TRUE@am__append_2 = \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_aux_intf.c \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_errors.c \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_intf.c \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_report.c \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_shim.c @HAVE_ADL_COND_FALSE@am__append_3 = \ @HAVE_ADL_COND_FALSE@ adl_mock_impl/adl_mock_shim.c \ @HAVE_ADL_COND_FALSE@ adl_mock_impl/adl_mock_errors.c subdir = src/adl ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libadl_la_LIBADD = am__libadl_la_SOURCES_DIST = adl_impl/adl_aux_intf.c \ adl_impl/adl_errors.c adl_impl/adl_intf.c \ adl_impl/adl_report.c adl_impl/adl_shim.c \ adl_mock_impl/adl_mock_shim.c adl_mock_impl/adl_mock_errors.c am__dirstamp = $(am__leading_dot)dirstamp @HAVE_ADL_COND_TRUE@am__objects_1 = adl_impl/adl_aux_intf.lo \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_errors.lo \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_intf.lo \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_report.lo \ @HAVE_ADL_COND_TRUE@ adl_impl/adl_shim.lo @HAVE_ADL_COND_FALSE@am__objects_2 = adl_mock_impl/adl_mock_shim.lo \ @HAVE_ADL_COND_FALSE@ adl_mock_impl/adl_mock_errors.lo am_libadl_la_OBJECTS = $(am__objects_1) $(am__objects_2) libadl_la_OBJECTS = $(am_libadl_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libadl_la_SOURCES) DIST_SOURCES = $(am__libadl_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public -I@ADL_HEADER_DIR@ AM_CFLAGS = -Wall -Werror $(am__append_1) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libadl.la libadl_la_SOURCES = $(am__append_2) $(am__append_3) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/adl/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/adl/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } adl_impl/$(am__dirstamp): @$(MKDIR_P) adl_impl @: > adl_impl/$(am__dirstamp) adl_impl/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) adl_impl/$(DEPDIR) @: > adl_impl/$(DEPDIR)/$(am__dirstamp) adl_impl/adl_aux_intf.lo: adl_impl/$(am__dirstamp) \ adl_impl/$(DEPDIR)/$(am__dirstamp) adl_impl/adl_errors.lo: adl_impl/$(am__dirstamp) \ adl_impl/$(DEPDIR)/$(am__dirstamp) adl_impl/adl_intf.lo: adl_impl/$(am__dirstamp) \ adl_impl/$(DEPDIR)/$(am__dirstamp) adl_impl/adl_report.lo: adl_impl/$(am__dirstamp) \ adl_impl/$(DEPDIR)/$(am__dirstamp) adl_impl/adl_shim.lo: adl_impl/$(am__dirstamp) \ adl_impl/$(DEPDIR)/$(am__dirstamp) adl_mock_impl/$(am__dirstamp): @$(MKDIR_P) adl_mock_impl @: > adl_mock_impl/$(am__dirstamp) adl_mock_impl/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) adl_mock_impl/$(DEPDIR) @: > adl_mock_impl/$(DEPDIR)/$(am__dirstamp) adl_mock_impl/adl_mock_shim.lo: adl_mock_impl/$(am__dirstamp) \ adl_mock_impl/$(DEPDIR)/$(am__dirstamp) adl_mock_impl/adl_mock_errors.lo: adl_mock_impl/$(am__dirstamp) \ adl_mock_impl/$(DEPDIR)/$(am__dirstamp) libadl.la: $(libadl_la_OBJECTS) $(libadl_la_DEPENDENCIES) $(EXTRA_libadl_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libadl_la_OBJECTS) $(libadl_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f adl_impl/*.$(OBJEXT) -rm -f adl_impl/*.lo -rm -f adl_mock_impl/*.$(OBJEXT) -rm -f adl_mock_impl/*.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@adl_impl/$(DEPDIR)/adl_aux_intf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl_impl/$(DEPDIR)/adl_errors.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl_impl/$(DEPDIR)/adl_intf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl_impl/$(DEPDIR)/adl_report.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl_impl/$(DEPDIR)/adl_shim.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl_mock_impl/$(DEPDIR)/adl_mock_errors.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl_mock_impl/$(DEPDIR)/adl_mock_shim.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf adl_impl/.libs adl_impl/_libs -rm -rf adl_mock_impl/.libs adl_mock_impl/_libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f adl_impl/$(DEPDIR)/$(am__dirstamp) -rm -f adl_impl/$(am__dirstamp) -rm -f adl_mock_impl/$(DEPDIR)/$(am__dirstamp) -rm -f adl_mock_impl/$(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 \ mostlyclean-am distclean: distclean-am -rm -rf adl_impl/$(DEPDIR) adl_mock_impl/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf adl_impl/$(DEPDIR) adl_mock_impl/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: ddcutil-0.8.6/src/adl/adl_shim.h0000644000175000001440000001023513230445447013361 00000000000000/* adl_shim.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Interface to ADL services * * Will be implemented by either adl/adl_impl/adl_shim.c or adl/adl_mock_impl/adl_mock_shim.c */ #ifndef ADL_SHIM_H_ #define ADL_SHIM_H_ /** \cond */ #include #include // wchar_t, needed by adl_structures.h #include /** \endcond */ #include "util/edid.h" #include "base/core.h" #include "base/displays.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" // Initialization extern bool adl_debug; bool adlshim_is_available(); // must be called before any other function (except is_adl_available()): bool adlshim_initialize(); // Report on active displays Parsed_Edid* adlshim_get_parsed_edid_by_adlno( int iAdapterIndex, int iDisplayIndex); Parsed_Edid* adlshim_get_parsed_edid_by_display_handle( Display_Handle * dh); Parsed_Edid* adlshim_get_parsed_edid_by_display_ref( Display_Ref * dref); // void adl_show_active_display(ADL_Display_Rec * pdisp, int depth); // void adl_show_active_display_by_index(int ndx, int depth); // void adlshim_show_active_display_by_adlno(int iAdapterIndex, int iDisplayIndex, int depth); void adlshim_report_active_display_by_display_ref( Display_Ref * dref, int depth); // int adl_show_active_displays(); // returns number of active displays // void report_adl_display_rec(ADL_Display_Rec * pRec, bool verbose, int depth); // Find and validate display // bool adlshim_is_valid_adlno(int iAdapterIndex, int iDisplayIndex, bool emit_error_msg); bool adlshim_is_valid_display_ref( Display_Ref * dref, bool emit_error_msg); // ADL_Display_Rec * adl_get_display_by_adlno(int iAdapterIndex, int iDisplayIndex, bool emit_error_msg); #ifdef OLD Display_Ref * adlshim_find_display_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn); #endif DDCA_Adlno adlshim_find_adlno_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn); #ifdef OLD Display_Ref * adlshim_find_display_by_edid( const Byte * pEdidBytes); #endif #ifdef OLD Display_Info_List adlshim_get_valid_displays(); #endif Modulated_Status_ADL adlshim_get_video_card_info( Display_Handle * dh, Video_Card_Info * card_info); // Read from and write to the display Modulated_Status_ADL adlshim_ddc_write_only( Display_Handle* dh, Byte * pSendMsgBuf, int sendMsgLen); Modulated_Status_ADL adlshim_ddc_read_only( Display_Handle * dh, Byte * pRcvMsgBuf, int * pRcvBytect); #define ADL_DISPLAY_DETAIL_MARKER "ADTD" /** Public description of one ADL display */ typedef struct { char marker[4]; ///< always "ADTD" int iAdapterIndex; ///< ADL adapter number int iDisplayIndex; ///< ADL display number bool supports_ddc; ///< does display support DDC? char * xrandr_name; ///< XRandR name Parsed_Edid * pEdid; ///< pointer to parsed EDID } ADL_Display_Detail; void adlshim_report_adl_display_detail(ADL_Display_Detail * detail, int depth); int adlshim_get_valid_display_ct(); GPtrArray * adlshim_get_valid_display_details(); #endif /* ADL_SHIM_H_ */ ddcutil-0.8.6/src/usb/0000755000175000001440000000000013230445447011540 500000000000000ddcutil-0.8.6/src/usb/Makefile.am0000644000175000001440000000135513226560134013514 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand clean-local: @echo "(src/usb/Makefile) clean-local" mostlyclean-local: @echo "(src/usb/Makefile) mostlyclean-local" distclean-local: @echo "(src/usb/Makefile) distclean-local" dist-hook: @echo "(src/usb/Makefile) dist-hook. top_distdir=$(top_distdir) distdir=$(distdir)" find $(distdir) -name "*.o" find $(distdir) -name "*.lo" if ENABLE_USB_COND # Intermediate library noinst_LTLIBRARIES = libusb.la libusb_la_SOURCES = \ usb_base.c \ usb_edid.c \ usb_displays.c \ usb_vcp.c endif ddcutil-0.8.6/src/usb/Makefile.in0000644000175000001440000005335413230171237013530 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand subdir = src/usb ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libusb_la_LIBADD = am__libusb_la_SOURCES_DIST = usb_base.c usb_edid.c usb_displays.c \ usb_vcp.c @ENABLE_USB_COND_TRUE@am_libusb_la_OBJECTS = usb_base.lo usb_edid.lo \ @ENABLE_USB_COND_TRUE@ usb_displays.lo usb_vcp.lo libusb_la_OBJECTS = $(am_libusb_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_USB_COND_TRUE@am_libusb_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libusb_la_SOURCES) DIST_SOURCES = $(am__libusb_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall -Wpedantic $(am__append_1) CLEANFILES = \ *expand # Intermediate library @ENABLE_USB_COND_TRUE@noinst_LTLIBRARIES = libusb.la @ENABLE_USB_COND_TRUE@libusb_la_SOURCES = \ @ENABLE_USB_COND_TRUE@usb_base.c \ @ENABLE_USB_COND_TRUE@usb_edid.c \ @ENABLE_USB_COND_TRUE@usb_displays.c \ @ENABLE_USB_COND_TRUE@usb_vcp.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/usb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/usb/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libusb.la: $(libusb_la_OBJECTS) $(libusb_la_DEPENDENCIES) $(EXTRA_libusb_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libusb_la_rpath) $(libusb_la_OBJECTS) $(libusb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb_base.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb_displays.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb_edid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb_vcp.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am dist-hook distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am .PRECIOUS: Makefile clean-local: @echo "(src/usb/Makefile) clean-local" mostlyclean-local: @echo "(src/usb/Makefile) mostlyclean-local" distclean-local: @echo "(src/usb/Makefile) distclean-local" dist-hook: @echo "(src/usb/Makefile) dist-hook. top_distdir=$(top_distdir) distdir=$(distdir)" find $(distdir) -name "*.o" find $(distdir) -name "*.lo" # 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: ddcutil-0.8.6/src/usb/usb_base.c0000644000175000001440000001730013213617477013415 00000000000000/* usb_base.c * * Functions that open and close USB HID devices, and that wrap * hiddev ioctl() calls. * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include "util/string_util.h" #include "usb_util/hiddev_util.h" #include "base/core.h" #include "base/execution_stats.h" #include "base/linux_errno.h" #include "usb/usb_base.h" // Trace class for this file // static Trace_Group TRACE_GROUP = TRC_USB; // currently unused // In keeping with the style of Linux USB code, this module prefers // "struct xxx {}" to "typedef {} xxx" // // Basic USB HID Device Operations // /* Open a USB device * * Arguments: * hiddev_devname * readonly if true, open read only * if false, open for reading and writing * emit_error_msg if true, output message if error * * Returns: * file descriptor ( >= 0) if success * -errno if failure * */ int usb_open_hiddev_device( char * hiddev_devname, Call_Options calloptions) { bool debug = false; DBGMSF(debug, "hiddev_devname=%s, calloptions=0x%02x (%s)", hiddev_devname, calloptions, interpret_call_options_t(calloptions) ); int file; int mode = (calloptions & CALLOPT_RDONLY) ? O_RDONLY : O_RDWR; RECORD_IO_EVENT( IE_OPEN, ( file = open(hiddev_devname, mode) ) ); // per man open: // returns file descriptor if successful // -1 if error, and errno is set if (file < 0) { int errsv = errno; #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) TERMINATE_EXECUTION_ON_ERROR( "Open failed for %s: errno=%s", hiddev_devname, linux_errno_desc(errsv)); #endif if (calloptions & CALLOPT_ERR_MSG) f0printf(FERR, "Open failed for %s: errno=%s\n", hiddev_devname, linux_errno_desc(errsv)); file = -errsv; } DBGMSF(debug, "open() finished, file=%d", file); if (file >= 0) { // Solves problem of ddc detect not getting edid unless ddcutil env called first int rc = ioctl(file, HIDIOCINITREPORT); if (rc < 0) { int errsv = errno; // call should never fail. always wrote an error message REPORT_IOCTL_ERROR("HIDIOCGREPORT", errsv); close(file); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif file = -errsv; } } DBGMSF(debug, "Returning file descriptor: %d", file); return file; } /* Closes an open USB device. * * Arguments: * fd file descriptor for open hiddev device * device_fn * if NULL, ignore * failure_action if true, exit if close fails * * Returns: * 0 if success * -errno if close fails and exit on failure was not specified */ Status_Errno usb_close_device( int fd, char * device_fn, Call_Options calloptions) { bool debug = false; DBGMSF(debug, "Starting. fd=%d, device_fn=%s, calloptions=0x%02x", fd, device_fn, calloptions); errno = 0; int rc = 0; RECORD_IO_EVENT(IE_CLOSE, ( rc = close(fd) ) ); int errsv = errno; assert(rc<=0); if (rc < 0) { // EBADF fd isn't a valid open file descriptor // EINTR close() interrupted by a signal // EIO I/O error char workbuf[300]; if (device_fn) snprintf(workbuf, 300, "Close failed for USB device %s. errno=%s", device_fn, linux_errno_desc(errsv)); else snprintf(workbuf, 300, "USB device close failed. errno=%s", linux_errno_desc(errsv)); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) TERMINATE_EXECUTION_ON_ERROR(workbuf); #endif if (calloptions & CALLOPT_ERR_MSG) fprintf(stderr, "%s\n", workbuf); rc = -errsv; } assert(rc <= 0); return rc; } // // Wrapper hiddev ioctl calls // Status_Errno hiddev_get_device_info( int fd, struct hiddev_devinfo * dev_info, Byte calloptions) { assert(dev_info); int rc = ioctl(fd, HIDIOCGDEVINFO, dev_info); if (rc != 0) { int errsv = errno; if (calloptions & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR("HIDIOCGDEVINFO", errsv); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif rc = -errsv; } assert(rc <= 0); return rc; } Status_Errno hiddev_get_report_info(int fd, struct hiddev_report_info * rinfo, Byte calloptions) { assert(rinfo); int rc = ioctl(fd, HIDIOCGREPORTINFO, rinfo); if (rc < -1) { // -1 means no more reports int errsv = errno; if (calloptions & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR("HIDIOCGREPORTINFO", errsv); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif rc = -errsv; } return rc; } Status_Errno hiddev_get_field_info(int fd, struct hiddev_field_info * finfo, Byte calloptions) { int saved_field_index = finfo->field_index; int rc = ioctl(fd, HIDIOCGFIELDINFO, finfo); if (rc != 0) { int errsv = errno; if (calloptions & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR("HIDIOCGFIELDINFO", errsv); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif } assert(rc == 0); if (finfo->field_index != saved_field_index && (calloptions & CALLOPT_WARN_FINDEX)) { printf("(%s) !!! ioctl(HIDIOCGFIELDINFO) changed field_index from %d to %d\n", __func__, saved_field_index, finfo->field_index); printf("(%s) finfo.maxusage=%d\n", __func__, finfo->maxusage); } return rc; } Status_Errno hiddev_get_usage_code(int fd, struct hiddev_usage_ref * uref, Byte calloptions) { int rc = ioctl(fd, HIDIOCGUCODE, uref); // Fills in usage code if (rc != 0) { int errsv = errno; if (calloptions & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR("HIDIOCGUCODE", errsv); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif rc = -errsv; } return rc; } Status_Errno hiddev_get_usage_value(int fd, struct hiddev_usage_ref * uref, Byte calloptions) { int rc = ioctl(fd, HIDIOCGUSAGE, uref); if (rc != 0) { int errsv = errno; if (calloptions & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR("HIDIOCGUSAGE", errsv); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif rc = -errsv; } return rc; } Status_Errno hiddev_get_report(int fd, struct hiddev_report_info * rinfo, Byte calloptions) { int rc = ioctl(fd, HIDIOCGUCODE, rinfo); if (rc != 0) { int errsv = errno; if (calloptions & CALLOPT_ERR_MSG) REPORT_IOCTL_ERROR("HIDIOCGREPORT", errsv); #ifdef OLD if (calloptions & CALLOPT_ERR_ABORT) DDC_ABORT(errsv); #endif rc = -errsv; } return rc; } ddcutil-0.8.6/src/usb/usb_edid.c0000644000175000001440000003060113226561012013372 00000000000000/* usb_edid.c * * Functions to get EDID for USB connected monitors * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include // #include #include "util/device_id_util.h" #include "util/report_util.h" #include "util/string_util.h" #ifdef USE_X11 #include "util/x11_util.h" // for EDID fallback #endif #include "usb_util/hiddev_reports.h" #include "usb_util/hiddev_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/execution_stats.h" #include "base/linux_errno.h" #include "i2c/i2c_bus_core.h" // for EDID fallback #include "adl/adl_shim.h" // for EDID fallback #include "usb/usb_base.h" #include "usb/usb_edid.h" // Trace class for this file // Doesn't work // Avoid unused variable warning if all debug code turned off // #pragma GCC diagnostic push // #pragma GCC diagnostic ignored "-Wunused-variable" // static Trace_Group TRACE_GROUP = TRC_USB; // #pragma GCC diagnostic pop static Trace_Group TRACE_GROUP = TRC_USB; void usb_edid_unused_function_to_avoid_unused_variable_warning() { printf("0x%02x\n",TRACE_GROUP); } // struct model_sn_pair struct model_sn_pair { char * model; char * sn; }; void free_model_sn_pair(struct model_sn_pair * p) { if (p) { free(p->model); free(p->sn); free(p); } } void report_model_sn_pair(struct model_sn_pair * p, int depth) { int d1 = depth+1; rpt_structure_loc("struct model_sn_pair",p, depth); rpt_vstring(d1, "model: %s", p->model); rpt_vstring(d1, "sn: %s", p->sn); } // // EIZO Specific Functions // /* Locates the EIZO specific HID report that returns the model and serial number. * * Arguments: * fd file descriptor for open USB HID device * * Returns: pointer to a newly allocated struct hid_field_locator */ struct hid_field_locator * find_eizo_model_sn_report(int fd) { bool debug = false; struct hid_field_locator * loc = NULL; struct hiddev_devinfo dev_info; int rc = hiddev_get_device_info(fd, &dev_info, CALLOPT_ERR_MSG); if (rc != 0) goto bye; if (dev_info.vendor == 0x056d && dev_info.product == 0x0002) { loc = hiddev_find_report(fd, HID_REPORT_TYPE_FEATURE, 0xff000035, /*match_all_ucodes=*/false); } bye: if (debug) { printf("(%s) Returning: %p\n", __func__, (void*)loc); // if (loc) // report_hid_field_locator(loc,2); } return loc; } #ifdef UNUSED bool is_eizo_monitor(int fd) { bool debug = false; bool result = false; struct hiddev_devinfo dev_info; int rc = ioctl(fd, HIDIOCGDEVINFO, &dev_info); if (rc != 0) { REPORT_IOCTL_ERROR("HIDIOCGDEVINFO", rc); goto bye; } if (dev_info.vendor == 0x056d && dev_info.product == 0x0002) result = true; bye: DBGMSF(debug, "Returning %s", bool_repr(result)); return result; } #endif /* Gets the module and serial number of an Eizo monitor using an Eizo specific report. * * Finds the specific report, then reads it. * * Alternatively: * Obtains the values by requesting the value of the usage code for the strings, * leaving it to hiddev to find the required report. * * Arguments: * fd file descriptor of open USB HID device for an Eizo monitor * * Returns: model and serial number strings */ struct model_sn_pair * get_eizo_model_sn_by_report(int fd) { bool debug = false; DBGMSF0(debug, "Starting"); struct model_sn_pair* result = NULL; Buffer * modelsn = NULL; Buffer * modelsn2 = NULL; struct hid_field_locator * loc = find_eizo_model_sn_report(fd); // DBGMSF(debug, "find_eizo_model_sn_report() returned: %p", loc); if (loc) modelsn = hiddev_get_multibyte_report_value_by_hid_field_locator(fd, loc); modelsn2 = hiddev_get_multibyte_value_by_ucode( fd, 0xff000035, // usage code 16); // num_values if (modelsn2 && modelsn2->len >= 16) buffer_set_length(modelsn2, 16); // printf("modelsn:\n"); // buffer_dump(modelsn); // printf("modelsn2:\n"); // buffer_dump(modelsn2); assert(buffer_eq(modelsn, modelsn2)); if (modelsn2) buffer_free(modelsn2, __func__); if (modelsn) { assert(modelsn->len >= 16); result = calloc(1, sizeof(struct model_sn_pair)); result->model = calloc(1,9); result->sn = calloc(1,9); memcpy(result->sn, modelsn->bytes,8); result->sn[8] = '\0'; memcpy(result->model, modelsn->bytes+8, 8); result->model[8] = '\0'; rtrim_in_place(result->sn); rtrim_in_place(result->model); free(modelsn); } if (loc) free_hid_field_locator(loc); if (debug) { if (result) { printf("(%s) Returning: %p -> mode=|%s|, sn=|%s|\n", __func__, (void*) result, result->model, result->sn); // report_model_sn_pair(result, 1); } else printf("(%s) Returning: %p\n", __func__, (void*) result); } return result; } // // EDID Retrieval // #ifdef USE_X11 /* Obtains EDID from X11. * * Arguments: * model_name * sn_ascii * * Returns: parsed EDID if found */ Parsed_Edid * get_x11_edid_by_model_sn(char * model_name, char * sn_ascii) { bool debug = false; DBGMSF(debug, "Starting. model_name=|%s|, sn_ascii=|%s|", model_name, sn_ascii); Parsed_Edid * parsed_edid = NULL; GPtrArray* edid_recs = get_x11_edids(); // puts(""); // printf("EDIDs reported by X11 for connected xrandr outputs:\n"); // DBGMSG("Got %d X11_Edid_Recs\n", edid_recs->len); for (int ndx=0; ndx < edid_recs->len; ndx++) { X11_Edid_Rec * prec = g_ptr_array_index(edid_recs, ndx); // printf(" Output name: %s -> %p\n", prec->output_name, prec->edid); // hex_dump(prec->edid, 128); DBGMSF(debug, "Comparing EDID for xrandr output: %s", prec->output_name); parsed_edid = create_parsed_edid(prec->edidbytes); if (parsed_edid) { if (debug) { bool verbose_edid = false; report_parsed_edid(parsed_edid, verbose_edid, 2 /* depth */); } if (streq(parsed_edid->model_name, model_name) && streq(parsed_edid->serial_ascii, sn_ascii) ) { g_strlcpy(parsed_edid->edid_source, "X11", EDID_SOURCE_FIELD_SIZE); DBGMSF(debug, "Found matching EDID from X11\n", __func__); break; } free_parsed_edid(parsed_edid); } else { if (debug || get_output_level() >= DDCA_OL_VERBOSE) { DBGMSG("Unparsable EDID for output name: %s -> %p\n", prec->output_name, prec->edidbytes); rpt_hex_dump(prec->edidbytes, 128, /*depth=*/ 1); } } } #ifdef MOCK_DATA_FOR_DEVELOPMENT if (!parsed_edid && edid_recs->len > 0) { printf("(%s) HACK FOR TESTING: Using last X11 EDID\n", __func__); X11_Edid_Rec * prec = g_ptr_array_index(edid_recs, edid_recs->len-1); parsed_edid = create_parsed_edid(prec->edidbytes); } #endif g_ptr_array_free(edid_recs, true); DBGMSF(debug, "returning %p", parsed_edid); return parsed_edid; } #endif Parsed_Edid * get_fallback_hiddev_edid(int fd, struct hiddev_devinfo * dev_info) { bool debug = false; DBGMSF0(debug, "Starting"); Parsed_Edid * parsed_edid = NULL; char * edid_source; struct model_sn_pair * model_sn = NULL; // Special handling for Eizo monitors if (dev_info->vendor == 0x056d && dev_info->product == 0x0002) { // if is EIZO monitor? printf("(%s) *** Special fixup for Eizo monitor ***\n", __func__); model_sn = get_eizo_model_sn_by_report(fd); if (model_sn) { // Should there be a ddc level function to find non-usb EDID? I2C_Bus_Info * bus_info = i2c_find_bus_info_by_mfg_model_sn( NULL, // mfg_id model_sn->model, model_sn->sn, DISPSEL_NONE); if (bus_info) { printf("(%s) Using EDID for /dev/i2c-%d\n", __func__, bus_info->busno); parsed_edid = bus_info->edid; edid_source = "I2C"; // g_strlcpy(parsed_edid->edid_source, "I2C", EDID_SOURCE_FIELD_SIZE); // result = NULL; // for testing - both i2c and X11 methods work } else { // ADL #ifdef OLD Display_Ref * dref = adlshim_find_display_by_mfg_model_sn( NULL, // mfg_id model_sn->model, model_sn->sn); parsed_edid = adlshim_get_parsed_edid_by_display_ref(dref); #endif DDCA_Adlno adlno = adlshim_find_adlno_by_mfg_model_sn( NULL, // mfg_id model_sn->model, model_sn->sn); if (adlno.iAdapterIndex >= 0) { // {-1,-1} means unset parsed_edid = adlshim_get_parsed_edid_by_adlno(adlno.iAdapterIndex, adlno.iDisplayIndex); edid_source = "ADL"; // g_strlcpy(parsed_edid->edid_source, "ADL", EDID_SOURCE_FIELD_SIZE); } // memory leak: not freeing dref because don't want to clobber parsed_edid // need to review Display_Ref lifecycle } } } #ifdef USE_X11 if (!parsed_edid && model_sn) { parsed_edid = get_x11_edid_by_model_sn(model_sn->model, model_sn->sn); edid_source = "X11"; } #endif if (model_sn) free_model_sn_pair(model_sn); if (parsed_edid) g_strlcpy(parsed_edid->edid_source, edid_source, EDID_SOURCE_FIELD_SIZE); DBGMSF(debug, "Returning: %p", parsed_edid); return parsed_edid; } /* Retrieves the EDID (128 bytes) from a hiddev device representing a HID * compliant monitor. * * Arguments: * fd file descriptor * * Returns: * pointer to Buffer struct containing the EDID * * It is the responsibility of the caller to free the returned buffer. */ Parsed_Edid * get_hiddev_edid_with_fallback(int fd, struct hiddev_devinfo * dev_info) { bool debug = false; if (debug) { DBGMSG0("Starting"); report_hiddev_devinfo(dev_info, true, 1); } Parsed_Edid * parsed_edid = NULL; Buffer * edid_buffer = get_hiddev_edid(fd); // in hiddev_util.c // try alternative - both work, pick one Buffer * edid_buf2 = hiddev_get_multibyte_value_by_ucode(fd, 0x00800002, 128); if (edid_buffer && edid_buffer->len > 128) buffer_set_length(edid_buffer,128); // printf("edid_buffer:\n"); // buffer_dump(edid_buffer); // printf("edid_buf2:\n"); // buffer_dump(edid_buf2); assert(buffer_eq(edid_buffer, edid_buf2)); buffer_free(edid_buf2, __func__); if (edid_buffer) { parsed_edid = create_parsed_edid(edid_buffer->bytes); // copies bytes if (!parsed_edid) { DBGMSF0(debug, "get_hiddev_edid() returned invalid EDID"); // if debug or verbose, dump the bad edid ?? // if (debug || get_output_level() >= OL_VERBOSE) { // } } else g_strlcpy(parsed_edid->edid_source, "USB", EDID_SOURCE_FIELD_SIZE); buffer_free(edid_buffer, __func__); edid_buffer = NULL; } if (!parsed_edid) parsed_edid = get_fallback_hiddev_edid(fd, dev_info); DBGMSF(debug, "Returning: %p", parsed_edid); return parsed_edid; } ddcutil-0.8.6/src/usb/usb_displays.c0000644000175000001440000006064313226562267014343 00000000000000/* usb_displays.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ /** \cond */ #include #include #include #include #include #include #include /** \endcond */ #include "util/device_id_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/udev_util.h" #include "util/udev_usb_util.h" #include "usb_util/hiddev_reports.h" #include "usb_util/hiddev_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/execution_stats.h" #include "base/linux_errno.h" #include "usb/usb_base.h" #include "usb/usb_edid.h" #include "usb/usb_displays.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_USB; // may be unused if all diagnostics turned off // n. #pragma GCC diagnostic ignored "-Wunused-variable" not working void usb_core_unused_function_to_avoid_unused_variable_warning() { printf("0x%02x\n",TRACE_GROUP); } // // Forward declarations // static GPtrArray * get_usb_monitor_list(); // returns array of Usb_Monitor_Info // Global variables static GPtrArray * usb_monitors = NULL; // array of Usb_Monitor_Info #define HID_USAGE_PAGE_MASK 0xffff0000 #define HID_UP_MONITOR 0x00800000 #define HID_UP_MONITOR_ENUM 0x00810000 #define HID_UP_MONITOR_VESA 0x00820000 // In keeping with the style of Linux USB code, this module prefers // "struct xxx {}" to "typedef {} xxx" // // Data Structures // // Report and manage data structures for this module. // Some data structures are defined here, others in usb_core.h // /* Reports contents of usb_monitor_vcp_rec struct * * Arguments: * vcprec * depth * * Returns: nothing */ static void report_usb_monitor_vcp_rec(Usb_Monitor_Vcp_Rec * vcprec, int depth) { const int d1 = depth+1; rpt_structure_loc("Usb_Monitor_Vcp_Rec", vcprec, depth); rpt_vstring(d1, "%-20s: %-4.4s", "marker", vcprec->marker); rpt_vstring(d1, "%-20s: 0x%02x", "vcp_code", vcprec->vcp_code); rpt_vstring(d1, "%-20s: %d", "report_type", vcprec->report_type); rpt_vstring(d1, "%-20s: %d", "report_id", vcprec->report_id); rpt_vstring(d1, "%-20s: %d", "field_index", vcprec->field_index); rpt_vstring(d1, "%-20s: %d", "usage_index", vcprec->usage_index); // to be completed rpt_structure_loc("struct hiddev_report_info", vcprec->rinfo, d1); rpt_structure_loc("struct hiddev_field_info ", vcprec->finfo, d1); rpt_structure_loc("struct hiddev_usage_ref ", vcprec->uref, d1); } /* Reports contents of Usb_Monitor_Info struct * * Arguments: * moninfo pointer to Monitor_Info * depth logical indentation depth * * Returns: nothing */ void report_usb_monitor_info(Usb_Monitor_Info * moninfo, int depth) { const int d1 = depth+1; const int d2 = depth+2; rpt_structure_loc("Usb_Monitor_Info", moninfo, d1); rpt_vstring(d1, "%-20s: %-4.4s", "marker", moninfo->marker); rpt_vstring(d1, "%-20s: %s", "hiddev_device_name", moninfo->hiddev_device_name); rpt_vstring(d1, "%-20s: %p", "edid", moninfo->edid); rpt_vstring(d1, "%-20s: %p", "hiddev_devinfo", moninfo->hiddev_devinfo); rpt_title("Non-empty vcp_codes entries:", d1); int feature_code; for (feature_code = 0; feature_code < 256; feature_code++) { GPtrArray * monrecs = moninfo->vcp_codes[feature_code]; if (monrecs) { rpt_vstring(d1, "vcp feature code 0x%02x has %d records:", feature_code, monrecs->len); for (int ndx=0; ndxlen; ndx++) { report_usb_monitor_vcp_rec( g_ptr_array_index(monrecs, ndx), d2); } } } } /* Reports on an array of Usb_Monitor_info structs * * Arguments: * monitors pointer to GPtrArray of pointer to struct Usb_Monitor_Info * depth logical indentation depth * * Returns: nothing */ // static void report_usb_monitors(GPtrArray * monitors, int depth) { const int d1 = depth+1; rpt_vstring(depth, "GPtrArray of %d Usb_Monitor_Info at %p", monitors->len, monitors); for (int ndx = 0; ndx < monitors->len; ndx++) { report_usb_monitor_info( g_ptr_array_index(monitors, ndx), d1); } } // // HID Report Inquiry // /* Locates all USB HID reports relating to querying and setting VCP feature values. * * Returns: array of Usb_Monitor_Vcp_Rec for each usage */ GPtrArray * collect_vcp_reports(int fd) { bool debug = false; GPtrArray * vcp_reports = g_ptr_array_new(); for (__u32 report_type = HID_REPORT_TYPE_MIN; report_type <= HID_REPORT_TYPE_MAX; report_type++) { int reportinfo_rc = 0; struct hiddev_report_info rinfo = { .report_type = report_type, .report_id = HID_REPORT_ID_FIRST }; while (reportinfo_rc >= 0) { // printf("(%s) Report counter %d, report_id = 0x%08x %s\n", // __func__, rptct, rinfo.report_id, interpret_report_id(rinfo.report_id)); errno = 0; // eliminated CALLOPT_ERR_ABORT: reportinfo_rc = hiddev_get_report_info(fd, &rinfo, CALLOPT_ERR_MSG); // reportinfo_rc = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); if (reportinfo_rc != 0) { // no more reports assert( reportinfo_rc == -1); break; } // result->report_id = rinfo.report_id; if (rinfo.num_fields == 0) break; int fndx, undx; for (fndx = 0; fndx < rinfo.num_fields; fndx++) { // printf("(%s) field index = %d\n", __func__, fndx); struct hiddev_field_info finfo = { .report_type = rinfo.report_type, .report_id = rinfo.report_id, .field_index = fndx }; Byte callopts = CALLOPT_ERR_MSG; // | CALLOPT_ERR_ABORT; if (debug) callopts |= CALLOPT_WARN_FINDEX; int rc = hiddev_get_field_info(fd, &finfo, callopts); if (rc < 0) continue; if (finfo.application != 0x00800001) // USB Monitor Page/Monitor Control continue; for (undx = 0; undx < finfo.maxusage; undx++) { struct hiddev_usage_ref uref = { .report_type = rinfo.report_type, // rinfo.report_type; .report_id = rinfo.report_id, // rinfo.report_id; .field_index = fndx, .usage_index = undx }; int rc = hiddev_get_usage_code(fd, &uref, CALLOPT_ERR_MSG); // |CALLOPT_ERR_ABORT); if (rc < 0) continue; if ( (uref.usage_code & 0xffff0000) != 0x00820000) // Monitor VESA Virtual Controls page continue; Byte vcp_feature = uref.usage_code & 0xff; Usb_Monitor_Vcp_Rec * vcprec = calloc(1, sizeof(Usb_Monitor_Vcp_Rec)); memcpy(vcprec->marker, USB_MONITOR_VCP_REC_MARKER, 4); vcprec->vcp_code = vcp_feature; vcprec->report_type = report_type; vcprec->report_id = rinfo.report_id; vcprec->field_index = fndx; vcprec->usage_index = undx; struct hiddev_report_info * infoptr = malloc(sizeof(struct hiddev_report_info)); memcpy(infoptr, &rinfo, sizeof(struct hiddev_report_info)); vcprec->rinfo = infoptr; struct hiddev_field_info * fptr = malloc(sizeof(struct hiddev_field_info)); memcpy(fptr, &finfo, sizeof(struct hiddev_field_info)); vcprec->finfo = fptr; struct hiddev_usage_ref * uptr = malloc(sizeof(struct hiddev_usage_ref)); memcpy(uptr, &uref, sizeof(struct hiddev_usage_ref)); vcprec->uref = uptr;; g_ptr_array_add(vcp_reports, vcprec); } // loop over usages } // loop over fields rinfo.report_id |= HID_REPORT_ID_NEXT; } } return vcp_reports; } // // Capabilities // /** Creates a capabilities string for the USB device. * * Returns: synthesized capabilities string, containing only a vcp segment * * Note that the USB HID Monitor spec does not define a capabilities report. * * It is the responsibility of the caller to free the returned string. */ static char * usb_synthesize_capabilities_string(Usb_Monitor_Info * moninfo) { assert(moninfo); char buf[1000]; strcpy(buf,"(vcp("); bool firstcode = true; int curlen = 5; for (int feature_code=0; feature_code < 256; feature_code++) { if (moninfo->vcp_codes[feature_code]) { if (firstcode) firstcode = false; else { strcpy(buf+curlen, " "); curlen++; } sprintf(buf+curlen, "%02x", feature_code); curlen += 2; } } strcpy(buf+curlen, "))"); char * result = strdup(buf); return result; } // // Probe HID devices, create USB_Mon_Info data stuctures // /* Examines all hiddev devices to see if they are USB HID compliant monitors. * If so, obtains the EDID, determines which reports to use for VCP feature * values, etc. * * Returns: array of pointers to USB_Mon_Info records * * The result is cached in global variable usb_monitors */ GPtrArray * get_usb_monitor_list() { bool debug = false; DBGMSF0(debug, "Starting..."); DDCA_Output_Level ol = get_output_level(); if (usb_monitors) // already initialized? return usb_monitors; usb_monitors = g_ptr_array_new(); GPtrArray * hiddev_names = get_hiddev_device_names(); for (int devname_ndx = 0; devname_ndx < hiddev_names->len; devname_ndx++) { char * hiddev_fn = g_ptr_array_index(hiddev_names, devname_ndx); DBGMSF(debug, "Examining device: %s", hiddev_fn); // will need better message handling for API Byte calloptions = CALLOPT_RDONLY; if (ol >= DDCA_OL_VERBOSE) calloptions |= CALLOPT_ERR_MSG; int fd = usb_open_hiddev_device(hiddev_fn, calloptions); if (fd < 0 && ol >= DDCA_OL_VERBOSE) { Usb_Detailed_Device_Summary * devsum = lookup_udev_usb_device_by_devname(hiddev_fn); if (devsum) { // report_usb_detailed_device_summary(devsum, 2); f0printf(FERR, " USB bus %s, device %s, vid:pid: %s:%s - %s:%s\n", devsum->busnum_s, devsum->devnum_s, devsum->vendor_id, devsum->product_id, devsum->vendor_name, devsum->product_name); free_usb_detailed_device_summary(devsum); } } else if (fd > 1) { // fd == 0 should never occur // Declare variables here and initialize them to NULL so that code at label close: works struct hiddev_devinfo * devinfo = NULL; char * cgname = NULL; Parsed_Edid * parsed_edid = NULL; GPtrArray * vcp_reports = NULL; Usb_Monitor_Info * moninfo = NULL; cgname = get_hiddev_name(fd); // HIDIOCGNAME devinfo = calloc(1,sizeof(struct hiddev_devinfo)); if ( hiddev_get_device_info(fd, devinfo, CALLOPT_ERR_MSG) != 0 ) goto close; if (!is_hiddev_monitor(fd)) goto close; parsed_edid = get_hiddev_edid_with_fallback(fd, devinfo); if (!parsed_edid) { f0printf(FERR, "Monitor on device %s reports no EDID or has invalid EDID. Ignoring.\n", hiddev_fn); goto close; } vcp_reports = collect_vcp_reports(fd); moninfo = calloc(1,sizeof(Usb_Monitor_Info)); memcpy(moninfo->marker, USB_MONITOR_INFO_MARKER, 4); moninfo-> hiddev_device_name = strdup(hiddev_fn); moninfo->edid = parsed_edid; moninfo->hiddev_devinfo = devinfo; devinfo = NULL; // so that struct not freed // Distribute the accumulated vcp reports by feature code for (int ndx = 0; ndx < vcp_reports->len; ndx++) { Usb_Monitor_Vcp_Rec * cur_vcp_rec = g_ptr_array_index(vcp_reports, ndx); Byte curvcp = cur_vcp_rec->vcp_code; GPtrArray * cur_code_table_entry = moninfo->vcp_codes[curvcp]; if (!cur_code_table_entry) { cur_code_table_entry = g_ptr_array_new(); moninfo->vcp_codes[curvcp] = cur_code_table_entry; } g_ptr_array_add(cur_code_table_entry, cur_vcp_rec); } // free vcp_reports without freeing the entries, which are now pointed to // by moninfo->vcp_codes // n. no free function set g_ptr_array_free(vcp_reports, true); g_ptr_array_add(usb_monitors, moninfo); close: if (devinfo) free(devinfo); if (cgname) free(cgname); usb_close_device(fd, hiddev_fn, CALLOPT_NONE); // return error if failure } // monitor opened } // loop over device names g_ptr_array_set_free_func(hiddev_names, free); g_ptr_array_free(hiddev_names, true); if (debug) { DBGMSG("Returning %d monitors ", usb_monitors->len); // report_usb_monitors(usb_monitors,1); } return usb_monitors; } // // Functions to find Usb_Monitor_Info for a display // static Usb_Monitor_Info * usb_find_monitor_by_busnum_devnum(int busnum, int devnum) { bool debug = false; DBGMSF(debug, "Starting. busnum=%d, devnum=%d", busnum, devnum); assert(usb_monitors); Usb_Monitor_Info * result = NULL; for (int ndx = 0; ndx < usb_monitors->len; ndx++) { struct usb_monitor_info * curmon = g_ptr_array_index(usb_monitors, ndx); struct hiddev_devinfo * devinfo = curmon->hiddev_devinfo; if (busnum == devinfo->busnum && devnum == devinfo->devnum) { result = curmon; break; } } DBGMSF(debug, "Returning %p", result); return result; } static Usb_Monitor_Info * usb_find_monitor_by_display_ref(Display_Ref * dref) { bool debug = false; DBGMSF(debug, "Starting. dref = %s", dref_repr_t(dref)); assert(dref->io_path.io_mode == DDCA_IO_USB); Usb_Monitor_Info * result = usb_find_monitor_by_busnum_devnum(dref->usb_bus, dref->usb_device); DBGMSF(debug, "Returning %p", result); return result; } Usb_Monitor_Info * usb_find_monitor_by_display_handle(Display_Handle * dh) { // printf("(%s) Starting. dh=%p\n", __func__, dh); bool debug = false; DBGMSF(debug, "Starting. dh = %s", dh_repr(dh)); assert(dh && dh->dref); assert(dh->dref->io_path.io_mode == DDCA_IO_USB); Usb_Monitor_Info * result = NULL; result = usb_find_monitor_by_busnum_devnum(dh->dref->usb_bus, dh->dref->usb_device); DBGMSF(debug, "Returning %p", result); return result; } #ifdef APPARENTLY_UNUSED char * get_hiddev_devname_by_display_ref(Display_Ref * dref) { Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_ref(dref); char * result = moninfo->hiddev_device_name; DBGMSG("dref=%s, returning: %s", dref_short_name(dref), result); return result; } #endif // // Display_Info_list Functions // #ifdef UNUSED /* Returns a list of all valid USB HID compliant monitors, * in a form expected by higher levels of ddcutil, namely * a collection of Display_Refs * * Arguments: none * * Returns: Display_Info_List of Display_Refs */ Display_Info_List usb_get_valid_displays() { // static GPtrArray * usb_monitors; // array of Usb_Monitor_Info bool debug = false; GPtrArray * all_usb_monitors = get_usb_monitor_list(); Display_Info_List info_list = {0,NULL}; Display_Info info_recs[256]; // coverity flags uninitialized scalar DBGMSF(debug, "Found %d USB displays", __func__, usb_monitors->len); info_list.info_recs = calloc(usb_monitors->len,sizeof(Display_Info)); for (int ndx=0; ndxlen; ndx++) { Usb_Monitor_Info * curmon = g_ptr_array_index(usb_monitors,ndx); Display_Ref * dref = create_usb_display_ref( curmon->hiddev_devinfo->busnum, curmon->hiddev_devinfo->devnum, curmon->hiddev_device_name); info_recs[ndx].dispno = -1; // not yet set info_recs[ndx].dref = dref; info_recs[ndx].edid = curmon->edid; memcpy(info_recs[ndx].marker, DISPLAY_INFO_MARKER, 4); } memcpy(info_list.info_recs, info_recs, (usb_monitors->len)*sizeof(Display_Info)); info_list.ct = usb_monitors->len; if (debug) { DBGMSG("Done. Returning:"); report_display_info_list(&info_list, 1); } return info_list; } #endif // *** Functions to return a Display_Ref for a USB monitor *** #ifdef PRE_DISPLAY_REF static Display_Ref * create_display_ref_from_usb_monitor_info(Usb_Monitor_Info * moninfo) { // hacky - to be cleaned up Display_Ref * dref = create_usb_display_ref(moninfo->hiddev_devinfo->busnum, moninfo->hiddev_devinfo->devnum, moninfo->hiddev_device_name); return dref; } Display_Ref * usb_find_display_by_mfg_model_sn(const char * mfg_id, const char * model, const char * sn) { Display_Ref * result = NULL; Usb_Monitor_Info * found_monitor = NULL; GPtrArray * all_usb_monitors = get_usb_monitor_list(); for (int ndx=0; ndxlen; ndx++) { Usb_Monitor_Info * curmon = g_ptr_array_index(all_usb_monitors, ndx); bool some_test_passed = false; bool some_test_failed = false; if (mfg_id && strlen(mfg_id) > 0) { if ( streq(mfg_id, curmon->edid->mfg_id) ) some_test_passed = true; else some_test_failed = false; } if (model && strlen(model) > 0) { if ( streq(model, curmon->edid->model_name) ) some_test_passed = true; else some_test_failed = false; } if (sn && strlen(sn) > 0) { if ( streq(sn, curmon->edid->serial_ascii) ) some_test_passed = true; else some_test_failed = false; } // if ( strcmp(model, curmon->edid->model_name) == 0 && // strcmp(sn, curmon->edid->serial_ascii) == 0 // ) if (some_test_passed && !some_test_failed) { found_monitor = curmon; break; } } if (found_monitor) result = create_display_ref_from_usb_monitor_info(found_monitor); return result; } Display_Ref * usb_find_display_by_busnum_devnum(int busnum, int devnum) { Display_Ref * result = NULL; Usb_Monitor_Info * found_monitor = NULL; GPtrArray * all_usb_monitors = get_usb_monitor_list(); for (int ndx=0; ndxlen; ndx++) { Usb_Monitor_Info * curmon = g_ptr_array_index(all_usb_monitors, ndx); if ( curmon->hiddev_devinfo->busnum == busnum && curmon->hiddev_devinfo->devnum == devnum ) { found_monitor = curmon; break; } } if (found_monitor) result = create_display_ref_from_usb_monitor_info(found_monitor); return result; } Display_Ref * usb_find_display_by_edid(const Byte * edidbytes) { Display_Ref * result = NULL; Usb_Monitor_Info * found_monitor = NULL; GPtrArray * all_usb_monitors = get_usb_monitor_list(); for (int ndx=0; ndxlen; ndx++) { Usb_Monitor_Info * curmon = g_ptr_array_index(all_usb_monitors, ndx); if ( memcmp(edidbytes, curmon->edid->bytes, 128) == 0) { found_monitor = curmon; break; } } if (found_monitor) result = create_display_ref_from_usb_monitor_info(found_monitor); return result; } #endif bool usb_is_valid_display_ref(Display_Ref * dref, bool emit_error_msg) { bool result = true; if (!usb_find_monitor_by_display_ref(dref)) { result = false; if (emit_error_msg) fprintf(stderr, "Invalid Display_Ref\n"); } return result; } void usb_show_active_display_by_display_ref(Display_Ref * dref, int depth) { DDCA_Output_Level output_level = get_output_level(); rpt_vstring(depth, "USB bus:device: %d:%d", dref->usb_bus, dref->usb_device); Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_ref(dref); #ifdef OLD if (output_level == DDCA_OL_TERSE || output_level == OL_PROGRAM) #else if (output_level == DDCA_OL_TERSE) #endif rpt_vstring(depth, "Monitor: %s:%s:%s", moninfo->edid->mfg_id, moninfo->edid->model_name, moninfo->edid->serial_ascii); Pci_Usb_Id_Names usb_names = devid_get_usb_names(moninfo->hiddev_devinfo->vendor, moninfo->hiddev_devinfo->product, 0, 2); char vname[80] = {'\0'}; char dname[80] = {'\0'}; if (usb_names.vendor_name) snprintf(vname, 80, "(%s)", usb_names.vendor_name); if (usb_names.device_name) snprintf(dname, 80, "(%s)", usb_names.device_name); if (output_level >= DDCA_OL_NORMAL) { rpt_vstring(depth, "Device name: %s", dref->usb_hiddev_name); rpt_vstring(depth, "Vendor id: %04x %s", moninfo->hiddev_devinfo->vendor & 0xffff, vname); rpt_vstring(depth, "Product id: %04x %s", moninfo->hiddev_devinfo->product & 0xffff, dname); bool dump_edid = (output_level >= DDCA_OL_VERBOSE); report_parsed_edid(moninfo->edid, dump_edid /* verbose */, depth); } } // // Get monitor information by Display_Ref or Display_Handle // (for hiding Usb_Monitor_Info from higher software levels) // Parsed_Edid * usb_get_parsed_edid_by_display_ref(Display_Ref * dref) { Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_ref(dref); return moninfo->edid; } Parsed_Edid * usb_get_parsed_edid_by_display_handle(Display_Handle * dh) { Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_handle(dh); return moninfo->edid; } char * usb_get_capabilities_string_by_display_handle(Display_Handle * dh) { Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_handle(dh); assert(dh); return usb_synthesize_capabilities_string(moninfo); } // // *** Miscellaneous services *** // /* Tests if a hiddev device (specified by its name) appears to * be a USB HID compliant monitor. * * This stripped down test implements the ddcutil chkusbmon command, * which is intended for use in a udev rules test. * * Arguments: * device_name e.g. /dev/usb/hiddev3 * * Returns: true if device is a monitor, * false if not, or unable to open device * * Note that messages will not appear when this function runs as part * of normal udev execution. They are intended to aid in debugging. */ bool check_usb_monitor( char * device_name ) { assert(device_name); bool debug = false; DDCA_Output_Level ol = get_output_level(); if (debug) ol = DDCA_OL_VERBOSE; DBGMSF(debug, "Examining device: %s", device_name); bool result = false; int fd = open(device_name, O_RDONLY); if (fd < 1) { if (ol >= DDCA_OL_VERBOSE) printf("Unable to open device %s: %s\n", device_name, strerror(errno)); goto exit; } result = is_hiddev_monitor(fd); close(fd); if (ol >= DDCA_OL_VERBOSE) { if (result) printf("Device %s appears to be a USB HID compliant monitor.\n", device_name); else printf("Device %s is not a USB HID compliant monitor.\n", device_name); } exit: return result; } ddcutil-0.8.6/src/usb/usb_vcp.c0000644000175000001440000005674013226561123013274 00000000000000/* usb_vcp.c * * Get and set VCP feature codes for USB connected monitors. * * * Copyright (C) 2017-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ /** \cond */ #include #include #include #include #include #include #include #include /** \endcond */ #include "util/report_util.h" #include "util/string_util.h" #include "usb_util/hiddev_reports.h" #include "usb_util/hiddev_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/execution_stats.h" #include "base/linux_errno.h" #include "usb/usb_displays.h" #include "usb/usb_vcp.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_USB; // // Get and set HID usage values, parameterized only by HID data structures // /* Gets the value of usage by specifying the usage code * * Arguments: * fd file descriptor for open hiddev device * report_type HID_REPORT_TYPE_FEATURE or HID_REPORT_TYPE_OUTPUT * usage_code usage code to get * maxval where to return maximum values * curval where to return current value * * Returns: status code */ Public_Status_Code usb_get_usage_value_by_report_type_and_ucode( int fd, __u32 report_type, __u32 usage_code, __s32 * maxval, __s32 * curval) { bool debug = false; DBGMSF(debug, "Starting. fd=%d, report_type=%d, usage_code=0x%08x", fd, report_type, usage_code); Public_Status_Code psc = 0; Status_Errno rc; *curval = 0; // so there's a definite value in case of failure ... *maxval = 0; // avoids complaints by clang analyzer assert(report_type == HID_REPORT_TYPE_FEATURE || report_type == HID_REPORT_TYPE_INPUT); // *** CG19 *** struct hiddev_usage_ref uref = {0}; uref.report_type = report_type; uref.report_id = HID_REPORT_ID_UNKNOWN; uref.usage_code = usage_code; rc = hiddev_get_usage_value(fd, &uref, CALLOPT_NONE); // rc = ioctl(fd, HIDIOCGUSAGE, &uref); // Fills in usage value if (rc != 0) { // Problem: errno=22 (invalid argument) can mean the usage code is invalid, // i.e. invalid feature code, or another arg error which indicates a programming error // occasionally errno = 22 invalid argument - for Battery System Page: Run Time to Empty if (-rc == EINVAL) { if (debug) REPORT_IOCTL_ERROR("HIDIOCGUSAGE", -rc); psc = DDCRC_DETERMINED_UNSUPPORTED; } else { REPORT_IOCTL_ERROR("HIDIOCGUSAGE", -rc); // occasionally see -1, errno = 22 invalid argument - for Battery System Page: Run Time to Empty // gsc = modulate_rc(-errsv, RR_ERRNO); psc = rc; } if (debug) { DBGMSG0("After hid_get_usage_value():"); report_hiddev_usage_ref(&uref, 1); } // printf("(%s) errsv=%d, gsc=%d\n", __func__, errsv, gsc); goto bye; } *curval = uref.value; if (debug) report_hiddev_usage_ref(&uref, 1); struct hiddev_field_info finfo = {0}; finfo.report_type = uref.report_type; finfo.report_id = uref.report_id; finfo.field_index = uref.field_index; // ? rc = ioctl(fd, HIDIOCGFIELDINFO, &finfo); // Fills in usage value if (rc != 0) { int errsv = errno; REPORT_IOCTL_ERROR("HIDIOCGFIELDINFO", errsv); // occasionally see -1, errno = 22 invalid argument - for Battery System Page: Run Time to Empty // gsc = modulate_rc(-errsv, RR_ERRNO); psc = -errsv; // printf("(%s) errsv=%d, gsc=%d\n", __func__, errsv, gsc); goto bye; } if (debug) report_hiddev_field_info(&finfo, 1); // per spec, logical max/min bound the values in the report, // physical min/max bound the "real world" units // if physical min/max = 0, set physical to logical // So we should use logical max as ddc maxval. // But logical_minimum can be < 0 per USB spec, // in which case the value in the report is interpreted as a // 2's complement number. How to handle this? // Map to a range >= 0? e.g. -128..127 -> 0..255 __s32 maxval1 = finfo.logical_maximum; __s32 maxval2 = finfo.physical_maximum; DBGMSF(debug, "logical_maximum: %d", maxval1); DBGMSF(debug, "physical_maximum: %d", maxval2); *maxval = finfo.logical_maximum; if (finfo.logical_minimum < 0) { DBGMSG("Unexpected: logical_minimum (%d) for field is < 0", finfo.logical_minimum); } psc = 0; bye: DBGMSF(debug, "Returning: %s", psc_desc(psc)); return psc; } /* Sets the value of usage, with explicit report field, and usage indexes * * Arguments: * fd file descriptor for open hiddev device * report_type HID_REPORT_TYPE_FEATURE or HID_REPORT_TYPE_OUTPUT * report_id report number * field_idx field number * usage_idx usage number * value value to set * * Returns: status code * * Adapted from usbmonctl */ Status_Errno set_control_value(int fd, int report_type, int report_id, int field_ndx, int usage_ndx, int value) { bool debug = false; DBGMSF(debug, "Starting. fd=%d, report_type=%d, report_id=%d, field_ndx=%d, usage_ndx=%d, value=%d", fd, report_type, report_type, field_ndx, usage_ndx, value); int rc; Status_Errno result = 0; struct hiddev_report_info rinfo = { .report_type = report_type, .report_id = report_id, }; struct hiddev_usage_ref uref = { .report_type = report_type, .report_id = report_id, .field_index = field_ndx, .usage_index = usage_ndx, .value = value, }; if (debug) { DBGMSG0("Before HIDIOCSUSAGE"); report_hiddev_usage_ref(&uref, 1); } if ((rc=ioctl(fd, HIDIOCSUSAGE, &uref)) < 0) { result = -errno; REPORT_IOCTL_ERROR("HIDIOCSUSAGE", errno); goto bye; } if ((rc=ioctl(fd, HIDIOCSREPORT, &rinfo)) < 0) { result = -errno; REPORT_IOCTL_ERROR("HIDIOCGUSAGE", errno); goto bye; } result = 0; bye: DBGMSF(debug, "Returning: %d", result); return result; } /* Sets the value of usage based on its usage code. * It is left to hiddev to determine the actual report field, and usage indexes * * Arguments: * fd file descriptor for open hiddev device * report_type HID_REPORT_TYPE_FEATURE or HID_REPORT_TYPE_OUTPUT * report_id report number * field_idx field number * usage_idx usage number * value value to set * * Returns: status code */ Public_Status_Code set_usage_value_by_report_type_and_ucode( int fd, __u32 report_type, __u32 usage_code, __s32 value) { bool debug = false; DBGMSF(debug, "Starting. fd=%d, report_type=%d, usage_code=0x%08x, value=%d", fd, report_type, usage_code, value); int rc; Public_Status_Code psc = 0; struct hiddev_usage_ref uref = { .report_type = report_type, .report_id = HID_REPORT_ID_UNKNOWN, .usage_code = usage_code, .value = value, }; if (debug) { DBGMSG0("Before HIDIOCSUSAGE"); report_hiddev_usage_ref(&uref, 1); } if ((rc=ioctl(fd, HIDIOCSUSAGE, &uref)) < 0) { psc = -errno; REPORT_IOCTL_ERROR("HIDIOCSUSAGE", errno); goto bye; } // if (debug) { // DBGMSG("HIDIOCSUSAGE succeeded"); // report_hiddev_usage_ref(&uref, 1); // } // need to get the actual report_id - HIDIOCSREPORT fails if HID_REPORT_ID_UNKNOWN psc = hiddev_get_usage_value(fd, &uref, CALLOPT_ERR_MSG); // should never fail, deleted CALLOPT_ERR_ABORT // if (debug) { // DBGMSG("After get_hid_usage_value()"); // report_hiddev_usage_ref(&uref, 1); // } if (psc < 0) // should never occur goto bye; struct hiddev_report_info rinfo = { .report_type = report_type, .report_id = uref.report_id }; if ((rc=ioctl(fd, HIDIOCSREPORT, &rinfo)) < 0) { psc = -errno; REPORT_IOCTL_ERROR("HIDIOCSREPORT", errno); goto bye; } psc = 0; bye: DBGMSF(debug, "Returning: %s", psc_desc(psc) ); return psc; } // // Get and set based on a Usb_Monitor_Vcp_Rec // /* Gets the current value of a usage, as identified by a Usb_Monitor_Vcp_Rec * * Arguments: * fd file descriptor for open hiddev device * vcprec pointer to a Usb_Monitor_Vcp_Rec identifying the value to retrieve * maxval address at which to return max value of the usage * curval address at which to return the current value of the usage * * Returns: status code * * Calls to this function are valid only for Feature or Input reports. */ Public_Status_Code usb_get_usage_value_by_vcprec( int fd, Usb_Monitor_Vcp_Rec * vcprec, __s32 * maxval, __s32 * curval) { bool debug = false; DBGMSF(debug, "Starting. fd=%d, vcprec=%p", fd, vcprec); Public_Status_Code psc = 0; int rc; assert(vcprec->rinfo->report_type == vcprec->report_type); assert(vcprec->rinfo->report_type == HID_REPORT_TYPE_FEATURE || vcprec->rinfo->report_type == HID_REPORT_TYPE_INPUT); // *** CG19 *** assert(vcprec->rinfo->report_id == vcprec->report_id); DBGMSF(debug, "report_type=%d (%s), report_id=%d, field_index=%d, usage_index=%d", vcprec->report_type, hiddev_report_type_name(vcprec->report_type), vcprec->report_id, vcprec->field_index, vcprec->usage_index); rc = hiddev_get_report(fd, vcprec->rinfo, CALLOPT_ERR_MSG); // |CALLOPT_ERR_ABORT); if (rc < 0) { psc = rc; goto bye; } __s32 maxval1 = vcprec->finfo->logical_maximum; __s32 maxval2 = vcprec->finfo->physical_maximum; DBGMSF(debug, "logical_maximum: %d", maxval1); DBGMSF(debug, "physical_maximum: %d", maxval2); *maxval = vcprec->finfo->logical_maximum; if (vcprec->finfo->logical_minimum < 0) { DBGMSG("Unexpected: logical_minmum (%d) is < 0", vcprec->finfo->logical_minimum); } struct hiddev_usage_ref * uref = vcprec->uref; #ifdef DISABLE uref->report_type = vcprec->report_type; uref->report_id = vcprec->report_id; uref->field_index = vcprec->field_index; uref->usage_index = vcprec->usage_index; #endif if (debug) report_hiddev_usage_ref(uref, 1); psc = hiddev_get_usage_value(fd, uref, CALLOPT_ERR_MSG); // rc = ioctl(fd, HIDIOCGUSAGE, uref); // Fills in usage value if (psc != 0) { // REPORT_IOCTL_ERROR("HIDIOCGUSAGE", rc); // occasionally see -1, errno = 22 invalid argument - for Battery System Page: Run Time to Empty // gsc = modulate_rc(-errsv, RR_ERRNO); } else { DBGMSF(debug, "usage_index=%d, value = 0x%08x",uref->usage_index, uref->value); *curval = uref->value; } bye: DBGMSF(debug, "Returning: %s", psc_desc(psc) ); return psc; } /* Sets the value of a usage, as identified by a Usb_Monitor_Vcp_Rec * * Arguments: * fd file descriptor for open hiddev device * vcprec pointer to a Usb_Monitor_Vcp_Rec identifying the usage to set * new_value new value * * Returns: status code * * Calls to this function are valid only for Feature or Output reports. */ Public_Status_Code usb_set_usage_value_by_vcprec( int fd, Usb_Monitor_Vcp_Rec * vcprec, __s32 new_value) { bool debug = false; DBGMSF(debug, "Starting. fd=%d, vcprec=%p", fd, vcprec); Public_Status_Code psc = 0; assert(vcprec->rinfo->report_type == vcprec->report_type); assert(vcprec->report_type == HID_REPORT_TYPE_FEATURE || vcprec->report_type == HID_REPORT_TYPE_OUTPUT); // CG19 assert(vcprec->rinfo->report_id == vcprec->report_id); DBGMSF(debug, "report_type=%d (%s), report_id=%d, field_index=%d, usage_index=%d, new_value=%d", vcprec->report_type, hiddev_report_type_name(vcprec->report_type), vcprec->report_id, vcprec->field_index, vcprec->usage_index, new_value); Status_Errno rc = set_control_value(fd, vcprec->report_type, vcprec->report_id, vcprec->field_index, vcprec->usage_index, new_value); if (rc < 0) psc = rc; // to simplify // gsc = modulate_rc(rc, RR_ERRNO); DBGMSF(debug, "Returning: %s", psc_desc(psc)); return psc; } // // High level getters/setters // /* Gets the value for a non-table feature. * * Arguments: * dh handle for open display * feature_code * ppInterpretedCode where to return result * * Returns: * status code */ Public_Status_Code usb_get_nontable_vcp_value( Display_Handle * dh, Byte feature_code, Parsed_Nontable_Vcp_Response** ppInterpretedCode) { bool debug = false; // Trace_Group tg = TRACE_GROUP; if (debug) tg = 0xFF; // TRCMSGTG(tg, "Reading feature 0x%02x, dh=%p, dh->dref=%p", feature_code, dh, dh->dref); DBGTRC(debug, TRACE_GROUP, "Reading feature 0x%02x, dh=%p, dh->dref=%p", feature_code, dh, dh->dref); assert(dh->dref->io_path.io_mode == DDCA_IO_USB); // if (!dh->dref) { // DGBMSF(debug, "HACK: getting value for uninitialized dh->dref"); // --- // } Public_Status_Code psc = DDCRC_REPORTED_UNSUPPORTED; // = 0; // Output_Level output_level = get_output_level(); Parsed_Nontable_Vcp_Response * parsed_response = NULL; // DBGMSF(debug, "wolf 2. dh=%p, dh->dref=%p", dh, dh->dref); // Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_ref(dh->dref); Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_handle(dh); assert(moninfo); __s32 maxval = 0; // initialization logically unnecessary, but avoids clang scan warning __s32 curval = 0; // ditto bool use_alt_method = true; if (use_alt_method) { __u32 usage_code = 0x0082 << 16 | feature_code; psc = usb_get_usage_value_by_report_type_and_ucode( dh->fh, HID_REPORT_TYPE_FEATURE, usage_code, &maxval, &curval); if (psc != 0) psc = usb_get_usage_value_by_report_type_and_ucode( dh->fh, HID_REPORT_TYPE_INPUT, usage_code, &maxval, &curval); } else { // find the field record GPtrArray * vcp_recs = moninfo->vcp_codes[feature_code]; if (!vcp_recs) { DBGMSF(debug, "Unrecognized feature code 0x%02x", feature_code); psc = DDCRC_REPORTED_UNSUPPORTED; } else { // DBGMSF(debug, "reading value"); // for testing purposes, try using each entry // usage 0 returns correct value, usage 1 returns 0 // is usage 1 for writing? for (int ndx=0; ndxlen; ndx++) { int ndx = 0; Usb_Monitor_Vcp_Rec * vcprec = g_ptr_array_index(vcp_recs,ndx); assert( memcmp(vcprec->marker, USB_MONITOR_VCP_REC_MARKER,4) == 0 ); if (vcprec->report_type == HID_REPORT_TYPE_OUTPUT) continue; psc = usb_get_usage_value_by_vcprec(dh->fh, vcprec, &maxval, &curval); DBGMSF(debug, "usb_get_usage() usage index: %d returned %d, maxval=%d, curval=%d", vcprec->usage_index, psc, maxval, curval); if (psc == 0) break; } } } if (psc == 0) { parsed_response = calloc(1, sizeof(Parsed_Nontable_Vcp_Response)); parsed_response->vcp_code = feature_code; parsed_response->valid_response = true; parsed_response->supported_opcode = true; parsed_response->cur_value = curval; parsed_response->max_value = maxval; parsed_response->mh = (maxval >> 8) & 0xff; parsed_response->ml = maxval & 0xff; parsed_response->sh = (curval >> 8) & 0xff; parsed_response->sl = curval & 0xff; } DBGTRC(debug, TRACE_GROUP, "Returning %s, *ppinterpreted_code=%p", psc_desc(psc), parsed_response); *ppInterpretedCode = parsed_response; return psc; } /* Gets the value of a VCP feature. * * Arguments: * dh handle for open display * feature_code feature code id * call_type indicates whether table or non-table * pvalrec location where to return newly allocated result * * Returns: * status code * * The caller is responsible for freeing the value result returned. */ // only changes from get_vcp_value are function names Public_Status_Code usb_get_vcp_value( Display_Handle * dh, Byte feature_code, DDCA_Vcp_Value_Type call_type, DDCA_Single_Vcp_Value ** pvalrec) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. Reading feature 0x%02x", feature_code); Public_Status_Code psc = 0; #ifdef FUTURE Buffer * buffer = NULL; #endif Parsed_Nontable_Vcp_Response * parsed_nontable_response = NULL; DDCA_Single_Vcp_Value * valrec = NULL; switch (call_type) { case (DDCA_NON_TABLE_VCP_VALUE): psc = usb_get_nontable_vcp_value( dh, feature_code, &parsed_nontable_response); if (psc == 0) { valrec = create_nontable_vcp_value( feature_code, parsed_nontable_response->mh, parsed_nontable_response->ml, parsed_nontable_response->sh, parsed_nontable_response->sl); free(parsed_nontable_response); } break; case (DDCA_TABLE_VCP_VALUE): #ifdef FUTURE psc = usb_get_table_vcp_value( dh, feature_code, &buffer); if (psc == 0) { valrec = create_table_vcp_value_by_buffer(feature_code, buffer); buffer_free(buffer, __func__); } #endif psc = DDCRC_REPORTED_UNSUPPORTED; // TEMP - should test known features first break; } *pvalrec = valrec; DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", psc_desc(psc) ); if (psc == 0 && debug) report_single_vcp_value(valrec,1); assert( (psc == 0 && *pvalrec) || (psc != 0 && !*pvalrec) ); return psc; } /* Sets the value for a non-table feature. * * Arguments: * dh handle for open display * feature_code * new_value value to set * * Returns: * status code */ Public_Status_Code usb_set_nontable_vcp_value( Display_Handle * dh, Byte feature_code, int new_value) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Setting feature 0x%02x, dh=%p, dh->dref=%p, new_value=%d", feature_code, dh, dh->dref, new_value); Public_Status_Code psc = DDCRC_REPORTED_UNSUPPORTED; // = 0; assert(dh->dref->io_path.io_mode == DDCA_IO_USB); Usb_Monitor_Info * moninfo = usb_find_monitor_by_display_handle(dh); assert(moninfo); bool use_alt = true; if (use_alt) { __u32 usage_code = 0x0082 << 16 | feature_code; psc = set_usage_value_by_report_type_and_ucode( dh->fh, HID_REPORT_TYPE_FEATURE, usage_code, new_value); // if (gsc != 0) // gsc = set_usage_value_by_report_type_and_ucode(dh->fh, HID_REPORT_TYPE_OUTPUT, usage_code, new_value); // if (gsc == modulate_rc(EINVAL, RR_ERRNO)) // gsc = DDCRC_REPORTED_UNSUPPORTED; if (psc == -EINVAL) psc = DDCRC_REPORTED_UNSUPPORTED; } else { // find the field record GPtrArray * vcp_recs = moninfo->vcp_codes[feature_code]; if (!vcp_recs) { DBGMSF(debug, "Unrecognized feature code 0x%02x", feature_code); psc = DDCRC_REPORTED_UNSUPPORTED; } else { DBGMSF0(debug, "setting value"); // for testing purposes, try using each entry // for reading, usage 0 returns correct value, usage 1 returns 0 // is usage 1 for writing? // when writing, usage 0 works properly // usage 1, at least for brightness, sets control to max value for (int ndx=0; ndxlen; ndx++) { Usb_Monitor_Vcp_Rec * vcprec = g_ptr_array_index(vcp_recs,ndx); assert( memcmp(vcprec->marker, USB_MONITOR_VCP_REC_MARKER,4) == 0 ); if (vcprec->report_type == HID_REPORT_TYPE_INPUT) continue; psc = usb_set_usage_value_by_vcprec(dh->fh, vcprec, new_value); DBGMSF(debug, "usb_set_usage() usage index: %d returned %s", vcprec->usage_index, psc_desc(psc) ); if (psc == 0) break; } } } DBGTRC(debug, TRACE_GROUP, "Returning %s", psc_desc(psc)); return psc; } /* Sets a VCP feature value. * * Arguments: * dh display handle for open display * vrec pointer to value record * * Returns: * status code */ Public_Status_Code usb_set_vcp_value( // changed from set_vcp_value() Display_Handle * dh, DDCA_Single_Vcp_Value * vrec) { Public_Status_Code psc = 0; if (vrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { psc = usb_set_nontable_vcp_value(dh, vrec->opcode, vrec->val.c.cur_val); // function name changed } else { assert(vrec->value_type == DDCA_TABLE_VCP_VALUE); // gsc = usb_set_table_vcp_value(dh, vrec->opcode, vrec->val.t.bytes, vrec->val.t.bytect); psc = DDCL_UNIMPLEMENTED; } return psc; } // // Special case: get VESA version // // 7/2016: this code is based on USB HID Monitor spec. // have yet to see a monitor that supports VESA Version usage code __s32 usb_get_vesa_version_by_report_type(int fd, __u32 report_type) { bool debug = false; __s32 maxval; __s32 curval; Public_Status_Code psc = usb_get_usage_value_by_report_type_and_ucode( fd, report_type, 0x00800004, &maxval, &curval); if (psc != 0 && debug) { DBGMSG("report_type=%s, usb_get_usage_alt() status code %s", hiddev_report_type_name(report_type), psc_desc(psc) ); } // DBGMSF(debug, "report_type=%s, returning: 0x%08x", report_type_name(report_type), curval); return curval; } __s32 usb_get_vesa_version(int fd) { bool debug = false; __s32 vesa_ver = usb_get_vesa_version_by_report_type(fd, HID_REPORT_TYPE_FEATURE); if (!vesa_ver) vesa_ver = usb_get_vesa_version_by_report_type(fd, HID_REPORT_TYPE_INPUT); // DBGMSF(debug, "VESA version from usb_get_vesa_version_by_report_type(): 0x%08x", vesa_ver); DBGMSF(debug, "returning: 0x%08x", vesa_ver); return vesa_ver; } ddcutil-0.8.6/src/usb/usb_edid.h0000644000175000001440000000222013230445447013403 00000000000000/* usb_edid.h * * Functions to get EDID for USB connected monitors * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef USB_EDID_H_ #define USB_EDID_H_ #include #include "util/edid.h" Parsed_Edid * get_hiddev_edid_with_fallback(int fd, struct hiddev_devinfo * dev_info); #endif /* USB_EDID_H_ */ ddcutil-0.8.6/src/usb/usb_base.h0000644000175000001440000000416013230445447013415 00000000000000/* usb_base.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef USB_BASE_H_ #define USB_BASE_H_ #include #include "util/coredefs.h" #ifdef UNUSED #define REPORT_IOCTL_ERROR_AND_QUIT(_ioctl_name, _rc) \ do { \ printf("(%s) ioctl(%s) returned %d (0x%08x), errno=%d: %s\n", \ __func__, \ _ioctl_name, \ _rc, \ _rc, \ errno, \ strerror(errno) \ ); \ ddc_abort(errno); \ } while(0) #endif int usb_open_hiddev_device(char * hiddev_devname, Byte calloptions); Status_Errno usb_close_device(int fd, char * device_fn, Byte calloptions); Status_Errno hiddev_get_device_info(int fd, struct hiddev_devinfo * dinfo, Byte calloptions); Status_Errno hiddev_get_report_info(int fd, struct hiddev_report_info * rinfo, Byte calloptions); Status_Errno hiddev_get_field_info( int fd, struct hiddev_field_info * finfo, Byte calloptions); Status_Errno hiddev_get_usage_code( int fd, struct hiddev_usage_ref * uref, Byte calloptions); Status_Errno hiddev_get_usage_value(int fd, struct hiddev_usage_ref * uref, Byte calloptions); Status_Errno hiddev_get_report( int fd, struct hiddev_report_info * rinfo, Byte calloptions); #endif /* USB_BASE_H_ */ ddcutil-0.8.6/src/usb/usb_displays.h0000644000175000001440000000641013230445447014333 00000000000000/* usb_displays.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ #ifndef USB_DISPLAYS_H_ #define USB_DISPLAYS_H_ /** \cond */ #include #include // for __u32 /** \endcond */ #include "util/coredefs.h" #include "base/core.h" #include "base/displays.h" #include "base/ddc_packets.h" #include "vcp/vcp_feature_values.h" #include "usb/usb_base.h" bool check_usb_monitor( char * device_name ); #ifdef OLD Display_Info_List usb_get_valid_displays(); #endif bool usb_is_valid_display_ref(Display_Ref * dref, bool emit_error_msg); void usb_show_active_display_by_display_ref(Display_Ref * dref, int depth); #ifdef PRE_DISPLAY_REV Display_Ref * usb_find_display_by_mfg_model_sn(const char * mfg_id, const char * model, const char * sn); Display_Ref * usb_find_display_by_edid(const Byte * edidbytes); Display_Ref * usb_find_display_by_busnum_devnum(int busnum, int devnum); #endif Parsed_Edid * usb_get_parsed_edid_by_display_ref( Display_Ref * dref); Parsed_Edid * usb_get_parsed_edid_by_display_handle(Display_Handle * dh); char * usb_get_capabilities_string_by_display_handle(Display_Handle * dh); // struct defs here for sharing with usb_vcp /* Used to record hiddev settings for reading and * writing a VCP feature code */ #define USB_MONITOR_VCP_REC_MARKER "UMVR" typedef struct usb_monitor_vcp_rec { char marker[4]; Byte vcp_code; __u32 report_type; // type? // have both indexes and struct pointers - redundant int report_id; int field_index; int usage_index; struct hiddev_report_info * rinfo; struct hiddev_field_info * finfo; struct hiddev_usage_ref * uref; } Usb_Monitor_Vcp_Rec; /* Describes a USB connected monitor. */ #define USB_MONITOR_INFO_MARKER "UMNF" typedef struct usb_monitor_info { char marker[4]; char * hiddev_device_name; Parsed_Edid * edid; struct hiddev_devinfo * hiddev_devinfo; // a flagrant waste of space, avoid premature optimization GPtrArray * vcp_codes[256]; // array of Usb_Monitor_Vcp_Rec * } Usb_Monitor_Info; void report_usb_monitor_info(Usb_Monitor_Info * moninfo, int depth); Usb_Monitor_Info * usb_find_monitor_by_display_handle(Display_Handle * dh); GPtrArray * get_usb_monitor_list(); #endif /* USB_DISPLAYS_H_ */ ddcutil-0.8.6/src/usb/usb_vcp.h0000644000175000001440000000406413230445447013276 00000000000000/* usb_vcp.h * * Get and set VCP feature codes for USB connected monitors. * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef USB_VCP_H_ #define USB_VCP_H_ #include #include "util/coredefs.h" #include "base/displays.h" #include "base/ddc_packets.h" #include "vcp/vcp_feature_values.h" Public_Status_Code usb_get_usage_value_by_report_type_and_ucode( int fd, __u32 report_type, __u32 usage_code, __s32 * maxval, __s32 * curval); Public_Status_Code usb_get_nontable_vcp_value( Display_Handle * dh, Byte feature_code, Parsed_Nontable_Vcp_Response** ppInterpretedCode); Public_Status_Code usb_get_vcp_value( Display_Handle * dh, Byte feature_code, DDCA_Vcp_Value_Type call_type, DDCA_Single_Vcp_Value ** pvalrec); Public_Status_Code usb_set_nontable_vcp_value( Display_Handle * dh, Byte feature_code, int new_value); Public_Status_Code usb_set_vcp_value( Display_Handle * dh, DDCA_Single_Vcp_Value * valrec); __s32 usb_get_vesa_version(int fd); #endif /* USB_VCP_H_ */ ddcutil-0.8.6/src/ddc/0000755000175000001440000000000013230445447011501 500000000000000ddcutil-0.8.6/src/ddc/Makefile.am0000644000175000001440000000135613226545363013465 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public if HAVE_ADL_COND AM_CPPFLAGS += \ -I@ADL_HEADER_DIR@ endif AM_CFLAGS = -Wall AM_CFLAGS += -Werror AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libddc.la libddc_la_SOURCES = \ ddc_async.c \ ddc_displays.c \ ddc_dumpload.c \ ddc_multi_part_io.c \ ddc_output.c \ ddc_packet_io.c \ ddc_read_capabilities.c \ ddc_services.c \ ddc_strategy.c \ ddc_vcp.c \ ddc_vcp_version.c \ ddc_try_stats.c ddcutil-0.8.6/src/ddc/Makefile.in0000644000175000001440000005402013230171237013460 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @HAVE_ADL_COND_TRUE@am__append_1 = \ @HAVE_ADL_COND_TRUE@ -I@ADL_HEADER_DIR@ @ENABLE_CALLGRAPH_COND_TRUE@am__append_2 = -fdump-rtl-expand subdir = src/ddc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libddc_la_LIBADD = am_libddc_la_OBJECTS = ddc_async.lo ddc_displays.lo ddc_dumpload.lo \ ddc_multi_part_io.lo ddc_output.lo ddc_packet_io.lo \ ddc_read_capabilities.lo ddc_services.lo ddc_strategy.lo \ ddc_vcp.lo ddc_vcp_version.lo ddc_try_stats.lo libddc_la_OBJECTS = $(am_libddc_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libddc_la_SOURCES) DIST_SOURCES = $(libddc_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public $(am__append_1) AM_CFLAGS = -Wall -Werror -Wpedantic $(am__append_2) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libddc.la libddc_la_SOURCES = \ ddc_async.c \ ddc_displays.c \ ddc_dumpload.c \ ddc_multi_part_io.c \ ddc_output.c \ ddc_packet_io.c \ ddc_read_capabilities.c \ ddc_services.c \ ddc_strategy.c \ ddc_vcp.c \ ddc_vcp_version.c \ ddc_try_stats.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/ddc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/ddc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libddc.la: $(libddc_la_OBJECTS) $(libddc_la_DEPENDENCIES) $(EXTRA_libddc_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libddc_la_OBJECTS) $(libddc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_async.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_displays.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_dumpload.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_multi_part_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_output.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_packet_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_read_capabilities.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_services.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_strategy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_try_stats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_vcp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddc_vcp_version.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: ddcutil-0.8.6/src/ddc/ddc_async.c0000644000175000001440000000571313224461437013522 00000000000000/* ddc_async.c * * * Copyright (C) 2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Experimental async code */ #include #include #include "base/core.h" #include "ddc_vcp.h" #include "ddc_async.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_DDC; #define ASYNC_GETVCP_DATA_MARKER "GVCP" typedef struct { char marker[4]; Display_Handle * dh; Byte feature_code; DDCA_Vcp_Value_Type call_type; DDCA_Notification_Func callback_func; } Async_Getvcp_Data; // function to be run in thread gpointer threaded_get_vcp_value(gpointer data) { bool debug = true; Async_Getvcp_Data * parms = data; assert(memcmp(parms->marker, ASYNC_GETVCP_DATA_MARKER, 4) == 0 ); Public_Status_Code psc = 0; DDCA_Single_Vcp_Value * valrec = NULL; DDCA_Any_Vcp_Value * anyval = NULL; Error_Info * ddc_excp = get_vcp_value( parms->dh, parms->feature_code, parms->call_type, &valrec); if (ddc_excp) { psc = ERRINFO_STATUS(ddc_excp); ERRINFO_FREE_WITH_REPORT(ddc_excp, debug || IS_TRACING() || report_freed_exceptions); } else { // convert valrec = DDCA_Any_Vcp_Value anyval = single_vcp_value_to_any_vcp_value(valrec); psc = 0; // free(valrec); // ??? what of table bytes } parms->callback_func(psc, anyval); // g_thread_exit(NULL); return NULL; } Error_Info * start_get_vcp_value( Display_Handle * dh, Byte feature_code, DDCA_Vcp_Value_Type call_type, DDCA_Notification_Func callback_func) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. Reading feature 0x%02x, dh=%s, dh->fh=%d", feature_code, dh_repr_t(dh), dh->fh); Error_Info * ddc_excp = NULL; Async_Getvcp_Data parms; parms.call_type = call_type; parms.feature_code = feature_code; parms.dh = dh; parms.callback_func = callback_func; // GThread * th = g_thread_new( "getvcp", threaded_get_vcp_value, &parms); return ddc_excp; } ddcutil-0.8.6/src/ddc/ddc_displays.c0000644000175000001440000010171413227337345014236 00000000000000/* ddc_displays.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Access displays, whether DDC, ADL, or USB */ #include /** \cond */ #include #include #include // glib-2.0/ to make eclipse happy #include #include #include "util/debug_util.h" #include "util/error_info.h" #include "util/failsim.h" #include "util/report_util.h" #include "util/udev_usb_util.h" #include "util/udev_util.h" /** \endcond */ #include "base/adl_errors.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/linux_errno.h" #include "base/parms.h" #include "vcp/vcp_feature_codes.h" #include "i2c/i2c_bus_core.h" #include "i2c/i2c_do_io.h" #include "adl/adl_shim.h" #ifdef HAVE_ADL #include "adl/adl_impl/adl_intf.h" #endif #ifdef USE_USB #include "usb/usb_displays.h" #endif #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp.h" #include "ddc/ddc_vcp_version.h" #include "ddc/ddc_displays.h" // Trace class for this file // static Trace_Group TRACE_GROUP = TRC_DDC; // currently unused static GPtrArray * all_displays = NULL; // all detected displays static int dispno_max = 0; // highest assigned display number static int async_threshold = DISPLAY_CHECK_ASYNC_THRESHOLD; void ddc_set_async_threshold(int threshold) { // DBGMSG("threshold = %d", threshold); async_threshold = threshold; } #ifdef OLD // NOTICE EXTENDED REMARKS IN COMMENTS, MAY WANT TO PRESERVE /** Checks that DDC communication is working by trying to read the value * of feature x10 (brightness). * * \param dh #Display_Handle of open display * \retval true communication successful * \retval false communication failed * * \remark * It has been observed that DDC communication can fail even if slave address x37 * is valid on the I2C bus. * \remark * ADL does not notice that a reported display, e.g. Dell 1905FP, does not support * DDC. * \remark * If a validly structured DDC response is received, e.g. with the unsupported feature * bit set or a DDC Null response, communication is considered successful. * \remark * Output level should have been set <= DDCA_OL_NORMAL prior to this call since * verbose output is distracting. */ static bool check_ddc_communication(Display_Handle * dh) { bool debug = false; DBGMSF(debug, "Starting. dh=%s", dh_repr_t(dh)); bool result = true; DDCA_Single_Vcp_Value * pvalrec; // verbose output is distracting since this function is called when querying for other things // DDCA_Output_Level olev = get_output_level(); // if (olev == DDCA_OL_VERBOSE) // set_output_level(DDCA_OL_NORMAL); Public_Status_Code psc = get_vcp_value(dh, 0x10, DDCA_NON_TABLE_VCP_VALUE, &pvalrec); // if (olev == DDCA_OL_VERBOSE) // set_output_level(olev); if (psc != 0 && psc != DDCRC_REPORTED_UNSUPPORTED && psc != DDCRC_DETERMINED_UNSUPPORTED) { result = false; DBGMSF(debug, "Error getting value for brightness VCP feature 0x10. gsc=%s\n", psc_desc(psc) ); } DBGMSF(debug, "Returning: %s", bool_repr(result)); return result; } #endif #ifdef OLD /** Checks whether the monitor uses a DDC Null response to report * an unsupported VCP code by attempting to read feature 0x00. * * \param dh #Display_Handle of monitor * \retval true DDC Null Response was received * \retval false any other response * * \remark * Monitors should set the unsupported feature bit in a valid DDC * response, but a few monitors (mis)use the Null Response instead. * \remark * Note that this test is not perfect, as a Null Response might * in fact indicate a transient error, but that is rare. * \remark * Output level should have been set <= DDCA_OL_NORMAL prior to this call since * verbose output is distracting. */ static bool check_monitor_ddc_null_response(Display_Handle * dh) { assert(dh); assert(dh->dref); bool debug = false; DBGMSF(debug, "Starting. dh=%s", dh_repr_t(dh)); bool result = false; if (dh->dref->io_mode != DDCA_IO_USB) { DDCA_Single_Vcp_Value * pvalrec; // // verbose output is distracting since this function is called when querying for other things // DDCA_Output_Level olev = get_output_level(); // if (olev == DDCA_OL_VERBOSE) // set_output_level(DDCA_OL_NORMAL); Public_Status_Code psc = get_vcp_value(dh, 0x00, DDCA_NON_TABLE_VCP_VALUE, &pvalrec); // if (olev == DDCA_OL_VERBOSE) // set_output_level(olev); if (psc == DDCRC_NULL_RESPONSE) { result = true; } else if (psc != 0 && psc != DDCRC_REPORTED_UNSUPPORTED && psc != DDCRC_DETERMINED_UNSUPPORTED) { DBGMSF(debug, "Unexpected status getting value for non-existent VCP feature 0x00. gsc=%s\n", psc_desc(psc) ); } } DBGMSF(debug, "Returning: %s", bool_repr(result)); return result; } #endif #ifdef OLD /** Collects most initial monitor checks to perform them on a single open of the * monitor device, and to avoid repeating them. * * Performs the following tests: * - Checks that DDC communication is working. * - Checks if the monitor uses DDC Null Response to indicate invalid VCP code * - Queries the VCP (MCCS) version. * * \param dh pointer to #Display_Handle for open monitor device * \return **true** if DDC communication with the display succeeded, **false** otherwise. */ bool initial_checks_by_dh_old(Display_Handle * dh) { bool debug = false; DBGMSF(debug, "Starting. dh=%s", dh_repr_t(dh)); if (!(dh->dref->flags & DREF_DDC_COMMUNICATION_CHECKED)) { if (check_ddc_communication(dh)) dh->dref->flags |= DREF_DDC_COMMUNICATION_WORKING; dh->dref->flags |= DREF_DDC_COMMUNICATION_CHECKED; } bool communication_working = dh->dref->flags & DREF_DDC_COMMUNICATION_WORKING; if (communication_working) { if (!(dh->dref->flags & DREF_DDC_NULL_RESPONSE_CHECKED)) { if (check_monitor_ddc_null_response(dh) ) dh->dref->flags |= DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED; dh->dref->flags |= DREF_DDC_NULL_RESPONSE_CHECKED; } if ( vcp_version_is_unqueried(dh->dref->vcp_version)) { dh->dref->vcp_version = get_vcp_version_by_display_handle(dh); // dh->vcp_version = dh->dref->vcp_version; } } DBGMSF(debug, "Returning: %s", bool_repr(communication_working)); return communication_working; } #endif /** Collects initial monitor checks to perform them on a single open of the * monitor device, and to avoid repeating them. * * Performs the following tests: * - Checks that DDC communication is working. * - Checks if the monitor uses DDC Null Response to indicate invalid VCP code * * \param dh pointer to #Display_Handle for open monitor device * \return **true** if DDC communication with the display succeeded, **false** otherwise. * * \remark * Sets bits in dh->dref->flags * * \remark * It has been observed that DDC communication can fail even if slave address x37 * is valid on the I2C bus. * \remark * ADL does not notice that a reported display, e.g. Dell 1905FP, does not support * DDC. * \remark * Monitors are supposed to set the unsupported feature bit in a valid DDC * response, but a few monitors (mis)use the Null Response instead to indicate * an unsupported feature. * \remark * Note that the test here is not perfect, as a Null Response might * in fact indicate a transient error, but that is rare. * \remark * Output level should have been set <= DDCA_OL_NORMAL prior to this call since * verbose output is distracting. */ bool initial_checks_by_dh(Display_Handle * dh) { bool debug = false; DBGMSF(debug, "Starting. dh=%s", dh_repr_t(dh)); assert(dh); DDCA_Single_Vcp_Value * pvalrec; if (!(dh->dref->flags & DREF_DDC_COMMUNICATION_CHECKED)) { Public_Status_Code psc = 0; Error_Info * ddc_excp = get_vcp_value(dh, 0x00, DDCA_NON_TABLE_VCP_VALUE, &pvalrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; DBGMSF(debug, "get_vcp_value() for feature 0x00 returned: %s", psc_desc(psc)); if (psc == DDCRC_RETRIES && debug) DBGMSG(" Try errors: %s", errinfo_causes_string(ddc_excp)); if (psc == DDCRC_NULL_RESPONSE || psc == DDCRC_ALL_RESPONSES_NULL || psc == 0 || psc == DDCRC_REPORTED_UNSUPPORTED || psc == DDCRC_DETERMINED_UNSUPPORTED) { dh->dref->flags |= DREF_DDC_COMMUNICATION_WORKING; if (psc == DDCRC_NULL_RESPONSE || psc == DDCRC_ALL_RESPONSES_NULL) dh->dref->flags |= DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED; } dh->dref->flags |= DREF_DDC_COMMUNICATION_CHECKED; dh->dref->flags |= DREF_DDC_NULL_RESPONSE_CHECKED; // redundant with refactoring } bool communication_working = dh->dref->flags & DREF_DDC_COMMUNICATION_WORKING; // commented out - defer checking version until actually needed to avoid // additional DDC io during monitor detection // if (communication_working) { // if ( vcp_version_is_unqueried(dh->dref->vcp_version)) { // dh->dref->vcp_version = get_vcp_version_by_display_handle(dh); // // dh->vcp_version = dh->dref->vcp_version; // } // } DBGMSF(debug, "Returning: %s", bool_repr(communication_working)); return communication_working; } /** Given a #Display_Ref, opens the monitor device and calls #initial_checks_by_dh() * to perform initial monitor checks. * * \param dref pointer to #Display_Ref for monitor * \return **true** if DDC communication with the display succeeded, **false** otherwise. */ bool initial_checks_by_dref(Display_Ref * dref) { bool result = false; Display_Handle * dh = NULL; Public_Status_Code psc = 0; psc = ddc_open_display(dref, CALLOPT_ERR_MSG, &dh); // deleted CALLOPT_ERR_ABORT if (psc == 0) { result = initial_checks_by_dh(dh); ddc_close_display(dh); } return result; } // function to be run in thread void * threaded_initial_checks_by_dref(gpointer data) { Display_Ref * dref = data; assert(memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0 ); initial_checks_by_dref(dref); // g_thread_exit(NULL); return NULL; } // // Functions to get display information // /** Gets a list of all detected displays, whether they support DDC or not. * * Initializes the list of detected monitors if necessary. * * \return **GPtrArray of #Display_Ref instances */ GPtrArray * ddc_get_all_displays() { // ddc_ensure_displays_detected(); assert(all_displays); return all_displays; } /** Gets the controller firmware version as a string * * \param dh pointer to display handle * \return pointer to character string, which is valid until the next * call to this function. * * \remark * Consider caching the value in dh->dref */ char * get_firmware_version_string(Display_Handle * dh) { bool debug = false; static char version[40]; DDCA_Single_Vcp_Value * valrec; Public_Status_Code psc = 0; Error_Info * ddc_excp = get_vcp_value( dh, 0xc9, // firmware detection DDCA_NON_TABLE_VCP_VALUE, &valrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (psc != 0) { strcpy(version, "Unspecified"); if (psc != DDCRC_REPORTED_UNSUPPORTED && psc != DDCRC_DETERMINED_UNSUPPORTED) { DBGMSF(debug, "get_vcp_value(0xc9) returned %s", psc_desc(psc)); strcpy(version, "DDC communication failed"); } } else { snprintf(version, sizeof(version), "%d.%d", valrec->val.nc.sh, valrec->val.nc.sl); } return version; } /** Gets the controller manufacturer name for an open display. * * \param dh pointer to display handle * \return pointer to character string, which is valid until the next * call to this function. * * \remark * Consider caching the value in dh->dref */ char * get_controller_mfg_string(Display_Handle * dh) { bool debug = false; static char mfg_name_buf[100] = ""; char * mfg_name = NULL; DDCA_Single_Vcp_Value * valrec; Public_Status_Code psc = 0; Error_Info * ddc_excp = get_vcp_value(dh, 0xc8, DDCA_NON_TABLE_VCP_VALUE, &valrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (psc == 0) { DDCA_Feature_Value_Entry * vals = pxc8_display_controller_type_values; mfg_name = get_feature_value_name( vals, valrec->val.nc.sl); if (!mfg_name) { snprintf(mfg_name_buf, sizeof(mfg_name_buf), "Unrecognized manufacturer code 0x%02x", valrec->val.nc.sl); mfg_name = mfg_name_buf; } } else if (psc == DDCRC_REPORTED_UNSUPPORTED || psc == DDCRC_DETERMINED_UNSUPPORTED) { mfg_name = "Unspecified"; } else { DBGMSF(debug, "get_nontable_vcp_value(0xc8) returned %s", psc_desc(psc)); if (debug) DBGMSG(" Try errors: %s", errinfo_causes_string(ddc_excp)); mfg_name = "DDC communication failed"; } return mfg_name; } /** Shows information about a display, specified by a #Display_Ref * * Output is written using report functions * * \param dref pointer to display reference * \param depth logical indentation depth */ void ddc_report_display_by_dref(Display_Ref * dref, int depth) { bool debug = false; DBGMSF0(debug, "Starting"); assert(dref); assert(memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0); int d1 = depth+1; switch(dref->dispno) { case -1: rpt_vstring(depth, "Invalid display"); break; case 0: // valid display, no assigned display number d1 = depth; // adjust indent ?? break; default: // normal case rpt_vstring(depth, "Display %d", dref->dispno); } switch(dref->io_path.io_mode) { case DDCA_IO_DEVI2C: // i2c_report_active_display_by_busno(dref->io_path.io.i2c_busno, d1); { I2C_Bus_Info * curinfo = dref->detail2; assert(curinfo); assert(memcmp(curinfo, I2C_BUS_INFO_MARKER, 4) == 0); i2c_report_active_display(curinfo, d1); } break; case DDCA_IO_ADL: adlshim_report_active_display_by_display_ref(dref, d1); break; case DDCA_IO_USB: #ifdef USE_USB usb_show_active_display_by_display_ref(dref, d1); #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif break; } assert( dref->flags & DREF_DDC_COMMUNICATION_CHECKED); DDCA_Output_Level output_level = get_output_level(); if (output_level >= DDCA_OL_NORMAL) { if (!(dref->flags & DREF_DDC_COMMUNICATION_WORKING) ) { rpt_vstring(d1, "DDC communication failed"); if (output_level >= DDCA_OL_VERBOSE) { if (streq(dref->pedid->model_name, "Unspecified") && streq(dref->pedid->serial_ascii, "Unspecified") ) { rpt_vstring(d1, "This appears to be a laptop display. Laptop displays do not support DDC/CI."); } else rpt_vstring(d1, "Is DDC/CI enabled in the monitor's on-screen display?"); } } else { DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_ref(dref); // DBGMSG("vspec = %d.%d", vspec.major, vspec.minor); if ( vspec.major == 0) rpt_vstring(d1, "VCP version: Detection failed"); else rpt_vstring(d1, "VCP version: %d.%d", vspec.major, vspec.minor); if (output_level >= DDCA_OL_VERBOSE) { // n. requires write access since may call get_vcp_value(), which does a write Display_Handle * dh = NULL; Public_Status_Code psc = ddc_open_display(dref, CALLOPT_ERR_MSG, &dh); if (psc != 0) { rpt_vstring(d1, "Error opening display %s, error = %s", dref_short_name_t(dref), psc_desc(psc)); } else { // display controller mfg, firmware version rpt_vstring(d1, "Controller mfg: %s", get_controller_mfg_string(dh) ); rpt_vstring(d1, "Firmware version: %s", get_firmware_version_string(dh));; ddc_close_display(dh); } if (dref->io_path.io_mode != DDCA_IO_USB) rpt_vstring(d1, "Monitor returns DDC Null Response for unsupported features: %s", bool_repr(dh->dref->flags & DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED)); } } } DBGMSF0(debug, "Done"); } /** Reports all displays found. * * Output is written to the current report destination using * report functions. * * @param valid_displays_only if **true**, report only valid displays\n * if **false**, report all displays * @param depth logical indentation depth * * @return total number of displays reported */ int ddc_report_displays(bool valid_displays_only, int depth) { bool debug = false; DBGMSF0(debug, "Starting"); ddc_ensure_displays_detected(); int display_ct = 0; for (int ndx=0; ndxlen; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); assert(memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0); if (dref->dispno > 0 || !valid_displays_only) { display_ct++; ddc_report_display_by_dref(dref, depth); rpt_title("",0); } } if (display_ct == 0) rpt_vstring(depth, "No %sdisplays found", (valid_displays_only) ? "active " : ""); DBGMSF(debug, "Done. Returning: %d", display_ct); return display_ct; } /** Debugging function to display the contents of a #Display_Ref. * * \param dref pointer to #Display_Ref * \param depth logical indentation depth */ void dbgreport_display_ref(Display_Ref * dref, int depth) { int d1 = depth+1; int d2 = depth+2; // no longer needed for i2c_dbgreport_bus_info() // DDCA_Output_Level saved_output_level = get_output_level(); // set_output_level(DDCA_OL_VERBOSE); rpt_structure_loc("Display_Ref", dref, depth); rpt_int("dispno", NULL, dref->dispno, d1); // rpt_vstring(d1, "dref: %p:", dref->dref); dbgrpt_display_ref(dref, d1); rpt_vstring(d1, "edid: %p (Skipping report)", dref->pedid); // report_parsed_edid(drec->edid, false, d1); rpt_vstring(d1, "io_mode: %s", io_mode_name(dref->io_path.io_mode)); // rpt_vstring(d1, "flags: 0x%02x", drec->flags); switch(dref->io_path.io_mode) { case(DDCA_IO_DEVI2C): rpt_vstring(d1, "I2C bus information: "); I2C_Bus_Info * businfo = dref->detail2; assert( memcmp(businfo->marker, I2C_BUS_INFO_MARKER, 4) == 0); i2c_dbgrpt_bus_info(businfo, d2); break; case(DDCA_IO_ADL): #ifdef HAVE_ADL rpt_vstring(d1, "ADL device information: "); ADL_Display_Detail * adl_detail = dref->detail2; assert(memcmp(adl_detail->marker, ADL_DISPLAY_DETAIL_MARKER, 4) == 0); adlshim_report_adl_display_detail(adl_detail, d2); #endif break; case(DDCA_IO_USB): #ifdef USE_USB rpt_vstring(d1, "USB device information: "); Usb_Monitor_Info * moninfo = dref->detail2; assert(memcmp(moninfo->marker, USB_MONITOR_INFO_MARKER, 4) == 0); report_usb_monitor_info(moninfo, d2); #else PROGRAM_LOGIC_ERROR("Built without USB support"); #endif break; } // set_output_level(saved_output_level); } /** Debugging function to report a collection of #Display_Ref. * * \param recs pointer to collection of #Display_Ref * \param depth logical indentation depth */ void debug_report_display_refs(GPtrArray * recs, int depth) { assert(recs); rpt_vstring(depth, "Reporting %d Display_Ref instances", recs->len); for (int ndx = 0; ndx < recs->len; ndx++) { Display_Ref * drec = g_ptr_array_index(recs, ndx); assert( memcmp(drec->marker, DISPLAY_REF_MARKER, 4) == 0); rpt_nl(); dbgreport_display_ref(drec, depth+1); } } // // Monitor selection // /** Display selection criteria */ typedef struct { int dispno; int i2c_busno; int iAdapterIndex; int iDisplayIndex; int hiddev; int usb_busno; int usb_devno; char * mfg_id; char * model_name; char * serial_ascii; Byte * edidbytes; } Display_Criteria; /** Allocates a new #Display_Criteria and initializes it to contain no criteria. * * \return initialized #Display_Criteria */ static Display_Criteria * new_display_criteria() { Display_Criteria * criteria = calloc(1, sizeof(Display_Criteria)); criteria->dispno = -1; criteria->i2c_busno = -1; criteria->iAdapterIndex = -1; criteria->iDisplayIndex = -1; criteria->hiddev = -1; criteria->usb_busno = -1; criteria->usb_devno = -1; return criteria; } /** Checks if a given #Display_Ref satisfies all the criteria specified in a * #Display_Criteria struct. * * \param drec pointer to #Display_Ref to test * \param criteria pointer to criteria * \retval true all specified criteria match * \retval false at least one specified criterion does not match * * \remark * In the degenerate case that no criteria are set in **criteria**, returns true. */ static bool ddc_check_display_ref(Display_Ref * dref, Display_Criteria * criteria) { assert(dref && criteria); bool result = false; if (criteria->dispno >= 0 && criteria->dispno != dref->dispno) goto bye; if (criteria->i2c_busno >= 0) { if (dref->io_path.io_mode != DDCA_IO_DEVI2C || dref->io_path.path.i2c_busno != criteria->i2c_busno) goto bye; } if (criteria->iAdapterIndex >= 0) { if (dref->io_path.io_mode != DDCA_IO_ADL || dref->io_path.path.adlno.iAdapterIndex != criteria->iAdapterIndex) goto bye; } if (criteria->iDisplayIndex >= 0) { if (dref->io_path.io_mode != DDCA_IO_ADL || dref->io_path.path.adlno.iDisplayIndex != criteria->iDisplayIndex) goto bye; } if (criteria->hiddev >= 0) { if (dref->io_path.io_mode != DDCA_IO_USB) goto bye; char buf[40]; snprintf(buf, 40, "%s/hiddev%d", usb_hiddev_directory(), criteria->hiddev); Usb_Monitor_Info * moninfo = dref->detail2; assert(memcmp(moninfo->marker, USB_MONITOR_INFO_MARKER, 4) == 0); if (!streq( moninfo->hiddev_device_name, buf)) goto bye; } if (criteria->usb_busno >= 0) { if (dref->io_path.io_mode != DDCA_IO_USB) goto bye; // Usb_Monitor_Info * moninfo = drec->detail2; // assert(memcmp(moninfo->marker, USB_MONITOR_INFO_MARKER, 4) == 0); // if ( moninfo->hiddev_devinfo->busnum != criteria->usb_busno ) if ( dref->usb_bus != criteria->usb_busno ) goto bye; } if (criteria->usb_devno >= 0) { if (dref->io_path.io_mode != DDCA_IO_USB) goto bye; // Usb_Monitor_Info * moninfo = drec->detail2; // assert(memcmp(moninfo->marker, USB_MONITOR_INFO_MARKER, 4) == 0); // if ( moninfo->hiddev_devinfo->devnum != criteria->usb_devno ) if ( dref->usb_device != criteria->usb_devno ) goto bye; } if (criteria->hiddev >= 0) { if (dref->io_path.io_mode != DDCA_IO_USB) goto bye; if ( dref->io_path.path.hiddev_devno != criteria->hiddev ) goto bye; } if (criteria->mfg_id && (strlen(criteria->mfg_id) > 0) && !streq(dref->pedid->mfg_id, criteria->mfg_id) ) goto bye; if (criteria->model_name && (strlen(criteria->model_name) > 0) && !streq(dref->pedid->model_name, criteria->model_name) ) goto bye; if (criteria->serial_ascii && (strlen(criteria->serial_ascii) > 0) && !streq(dref->pedid->serial_ascii, criteria->serial_ascii) ) goto bye; if (criteria->edidbytes && memcmp(dref->pedid->bytes, criteria->edidbytes, 128) != 0) goto bye; result = true; bye: return result; } void async_scan(GPtrArray * all_displays) { bool debug = false; DBGMSF(debug, "Starting. all_displays=%p, display_count=%d", all_displays, all_displays->len); GPtrArray * threads = g_ptr_array_new(); for (int ndx = 0; ndx < all_displays->len; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); assert( memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0 ); GThread * th = g_thread_new( dref_repr_t(dref), threaded_initial_checks_by_dref, dref); g_ptr_array_add(threads, th); } DBGMSF(debug, "Started %d threads", threads->len); for (int ndx = 0; ndx < threads->len; ndx++) { GThread * thread = g_ptr_array_index(threads, ndx); g_thread_join(thread); } DBGMSF0(debug, "Threads joined"); #ifdef OLD for (int ndx = 0; ndx < all_displays->len; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); assert( memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0 ); if (dref->flags & DREF_DDC_COMMUNICATION_WORKING) { dref->dispno = ++dispno_max; } else { dref->dispno = -1; } } #endif DBGMSF0(debug, "Done"); } void non_async_scan(GPtrArray * all_displays) { bool debug = false; DBGMSF(debug, "Starting. checking %d displays", all_displays->len); for (int ndx = 0; ndx < all_displays->len; ndx++) { Display_Ref * dref = g_ptr_array_index(all_displays, ndx); assert( memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0 ); initial_checks_by_dref(dref); #ifdef OLD if (dref->flags & DREF_DDC_COMMUNICATION_WORKING) { dref->dispno = ++dispno_max; } else { dref->dispno = -1; } #endif } DBGMSF0(debug, "Done"); } static Display_Ref * ddc_find_display_ref_by_criteria(Display_Criteria * criteria) { Display_Ref * result = NULL; for (int ndx = 0; ndx < all_displays->len; ndx++) { Display_Ref * drec = g_ptr_array_index(all_displays, ndx); assert(memcmp(drec->marker, DISPLAY_REF_MARKER, 4) == 0); if (ddc_check_display_ref(drec, criteria)) { result = drec; break; } } return result; } /** Searches the master display list for a display matching the * specified #Display_Identifier, returning its #Display_Ref * * \param did display identifier to search for * \return #Display_Ref for the display. * * \remark * The returned value is a pointer into an internal data structure * and should not be freed by the caller. */ Display_Ref * ddc_find_display_ref_by_display_identifier(Display_Identifier * did) { bool debug = false; DBGMSF0(debug, "Starting"); if (debug) dbgrpt_display_identifier(did, 1); Display_Ref * result = NULL; Display_Criteria * criteria = new_display_criteria(); switch(did->id_type) { case DISP_ID_BUSNO: criteria->i2c_busno = did->busno; break; case DISP_ID_ADL: criteria->iAdapterIndex = did->iAdapterIndex; criteria->iDisplayIndex = did->iDisplayIndex; break; case DISP_ID_MONSER: criteria->mfg_id = did->mfg_id; criteria->model_name = did->model_name; criteria->serial_ascii = did->serial_ascii; break; case DISP_ID_EDID: criteria->edidbytes = did->edidbytes; break; case DISP_ID_DISPNO: criteria->dispno = did->dispno; break; case DISP_ID_USB: criteria->usb_busno = did->usb_bus; criteria->usb_devno = did->usb_device; break; case DISP_ID_HIDDEV: criteria->hiddev = did->hiddev_devno; } result = ddc_find_display_ref_by_criteria(criteria); // Is this the best location in the call chain to make this check? if (result && (result->dispno < 0)) { DBGMSF0(debug, "Found a display that doesn't support DDC. Ignoring."); result = NULL; } free(criteria); // do not free pointers in criteria, they are owned by Display_Identifier if (debug) { if (result) { DBGMSG0("Done. Returning: "); dbgreport_display_ref(result, 1); } else DBGMSG0("Done. Returning NULL"); } return result; } /** Searches the detected displays for one matching the criteria in a * #Display_Identifier. * * \param pdid pointer to a #Display_Identifier * \param callopts standard call options * \return pointer to #Display_Ref for the display, NULL if not found * * \todo * If the criteria directly specify an access path * (e.g. I2C bus number) and CALLOPT_FORCE specified, then create a * temporary #Display_Ref, bypassing the list of detected monitors. */ Display_Ref * get_display_ref_for_display_identifier( Display_Identifier* pdid, Call_Options callopts) { Display_Ref * dref = ddc_find_display_ref_by_display_identifier(pdid); if ( !dref && (callopts & CALLOPT_ERR_MSG) ) { f0printf(FERR, "Display not found\n"); } return dref; } /** Detects all connected displays by querying the I2C, ADL, and USB subsystems. * * \return array of #Display_Ref */ GPtrArray * ddc_detect_all_displays() { bool debug = false; DBGMSF0(debug, "Starting"); GPtrArray * display_list = g_ptr_array_new(); int busct = i2c_detect_buses(); // DBGMSF(debug, "i2c_detect_buses() returned: %d", busct); int busndx = 0; for (busndx=0; busndx < busct; busndx++) { I2C_Bus_Info * businfo = i2c_get_bus_info_by_index(busndx); if ( (businfo->flags & I2C_BUS_ADDR_0X50) && businfo->edid ) { Display_Ref * dref = create_bus_display_ref(businfo->busno); dref->dispno = -1; dref->pedid = businfo->edid; // needed? // drec->detail.bus_detail = businfo; dref->detail2 = businfo; dref->flags |= DREF_DDC_IS_MONITOR_CHECKED; dref->flags |= DREF_DDC_IS_MONITOR; g_ptr_array_add(display_list, dref); } } GPtrArray * all_adl_details = adlshim_get_valid_display_details(); int adlct = all_adl_details->len; for (int ndx = 0; ndx < adlct; ndx++) { ADL_Display_Detail * detail = g_ptr_array_index(all_adl_details, ndx); Display_Ref * dref = create_adl_display_ref(detail->iAdapterIndex, detail->iDisplayIndex); dref->dispno = -1; dref->pedid = detail->pEdid; // needed? // drec->detail.adl_detail = detail; dref->detail2 = detail; dref->flags |= DREF_DDC_IS_MONITOR_CHECKED; dref->flags |= DREF_DDC_IS_MONITOR; g_ptr_array_add(display_list, dref); } #ifdef USE_USB GPtrArray * usb_monitors = get_usb_monitor_list(); // DBGMSF(debug, "Found %d USB displays", usb_monitors->len); for (int ndx=0; ndxlen; ndx++) { Usb_Monitor_Info * curmon = g_ptr_array_index(usb_monitors,ndx); assert(memcmp(curmon->marker, USB_MONITOR_INFO_MARKER, 4) == 0); Display_Ref * dref = create_usb_display_ref( curmon->hiddev_devinfo->busnum, curmon->hiddev_devinfo->devnum, curmon->hiddev_device_name); dref->dispno = -1; dref->pedid = curmon->edid; // drec->detail.usb_detail = curmon; dref->detail2 = curmon; dref->flags |= DREF_DDC_IS_MONITOR_CHECKED; dref->flags |= DREF_DDC_IS_MONITOR; g_ptr_array_add(display_list, dref); } #endif // verbose output is distracting within scans // saved and reset here to that async threads are not adjusting output level DDCA_Output_Level olev = get_output_level(); if (olev == DDCA_OL_VERBOSE) set_output_level(DDCA_OL_NORMAL); if (display_list->len >= async_threshold && all_adl_details->len == 0) // if (true) async_scan(display_list); else non_async_scan(display_list); if (olev == DDCA_OL_VERBOSE) set_output_level(olev); // assign display numbers for (int ndx = 0; ndx < display_list->len; ndx++) { Display_Ref * dref = g_ptr_array_index(display_list, ndx); assert( memcmp(dref->marker, DISPLAY_REF_MARKER, 4) == 0 ); if (dref->flags & DREF_DDC_COMMUNICATION_WORKING) { dref->dispno = ++dispno_max; } else { dref->dispno = -1; } } // if (debug) { // DBGMSG("Displays detected:"); // report_display_recs(display_list, 1); // } DBGMSF(debug, "Done. Detected %d valid displays", dispno_max); return display_list; } /** Initializes the master display list. * * Does nothing if the list has already been initialized. */ void ddc_ensure_displays_detected() { if (!all_displays) { i2c_detect_buses(); all_displays = ddc_detect_all_displays(); } } ddcutil-0.8.6/src/ddc/ddc_dumpload.c0000644000175000001440000006356213226555770014226 00000000000000/* dumpload.c * * Load/store VCP settings from/to file. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ /** \cond */ #include #include #include #include #include // PATH_MAX, NAME_MAX #include #include #include #include /** \endcond */ #include "util/file_util.h" #include "util/glib_util.h" #include "util/glib_string_util.h" #include "util/report_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/displays.h" #include "base/parms.h" #include "base/status_code_mgt.h" #include "base/vcp_version.h" #include "i2c/i2c_bus_core.h" #include "ddc/ddc_displays.h" #include "ddc/ddc_edid.h" #include "ddc/ddc_output.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_read_capabilities.h" #include "ddc/ddc_vcp.h" #include "ddc/ddc_vcp_version.h" #include "ddc/ddc_dumpload.h" /** Frees a #Dumpload_Data struct. The underlying Vcp_Value_set is also freed. * * @param data pointer to #Dumpload_Data struct to free,\n * if NULL, do nothing */ void free_dumpload_data(Dumpload_Data * data) { if (data) { if (data->vcp_values) free_vcp_value_set(data->vcp_values); free(data); } } /** Reports the contents of a #Dumpload_Data struct * * Arguments: * data pointer to #Dumpload_Data struct * depth logical indentation depth */ void report_dumpload_data(Dumpload_Data * data, int depth) { int d1 = depth+1; rpt_structure_loc("Dumpload_Data", data, depth); // rptIval("busno", NULL, data->busno, d1); // TODO: timestamp_millis // TODO: show abbreviated edidstr rpt_str( "mfg_id", NULL, data->mfg_id, d1); rpt_str( "model", NULL, data->model, d1); rpt_str( "serial_ascii", NULL, data->serial_ascii, d1); rpt_str( "edid", NULL, data->edidstr, d1); rpt_str( "vcp_version", NULL, format_vspec(data->vcp_version), d1); rpt_int( "vcp_value_ct", NULL, data->vcp_value_ct, d1); rpt_structure_loc("vcp_values", data->vcp_values, d1); if (data->vcp_values) report_vcp_value_set(data->vcp_values, d1); } /** Given an array of strings stored in a GPtrArray, * convert it a #Dumpload_Data struct. * * @param garray array of strings * * @return pointer to newly allocated Dumpload_Data struct, or * NULL if the data is not valid. * It is the responsibility of the caller to free this struct. */ Dumpload_Data* create_dumpload_data_from_g_ptr_array(GPtrArray * garray) { bool debug = false; DBGMSF0(debug, "Starting."); Dumpload_Data * data = calloc(1, sizeof(Dumpload_Data)); bool valid_data = true; // default: data->vcp_version.major = 2; data->vcp_version.minor = 0; data->vcp_values = vcp_value_set_new(15); // 15 = initial size int ct; int linectr = 0; while ( linectr < garray->len ) { char * line = NULL; char s0[32], s1[257], s2[16]; char * head; char * rest; line = g_ptr_array_index(garray,linectr); linectr++; *s0 = '\0'; *s1 = '\0'; *s2 = '\0'; head = line; while (*head == ' ') head++; ct = sscanf(head, "%31s %256s %15s", s0, s1, s2); if (ct > 0 && *s0 != '*' && *s0 != '#') { if (ct == 1) { printf("Invalid data at line %d: %s\n", linectr, line); valid_data = false; } else { rest = head + strlen(s0);; while (*rest == ' ') rest++; char * last = rest + strlen(rest) - 1; // we already parsed a second token, so don't need to worry that last becomes < head while (*last == ' ' || *last == '\n') { *last-- = '\0'; } // DBGMSG("rest=|%s|", rest ); if (streq(s0, "BUS")) { // ignore // ct = sscanf(s1, "%d", &data->busno); // if (ct == 0) { // fprintf(stderr, "Invalid bus number at line %d: %s\n", linectr, line); // valid_data = false; // } } else if (streq(s0, "EDID") || streq(s0, "EDIDSTR")) { strncpy(data->edidstr, s1, sizeof(data->edidstr)); } else if (streq(s0, "MFG_ID")) { strncpy(data->mfg_id, s1, sizeof(data->mfg_id)); } else if (streq(s0, "MODEL")) { strncpy(data->model, rest, sizeof(data->model)); } else if (streq(s0, "SN")) { strncpy(data->serial_ascii, rest, sizeof(data->serial_ascii)); } else if (streq(s0, "VCP_VERSION")) { data->vcp_version = parse_vspec(s1); // using VCP_SPEC_UNKNOWN as value when invalid, // what if monitor had no version, so 0.0 was output? if ( vcp_version_eq( data->vcp_version, VCP_SPEC_UNKNOWN) ) { f0printf(FERR, "Invalid VCP VERSION at line %d: %s\n", linectr, line); valid_data = false; } } else if (streq(s0, "TIMESTAMP_TEXT") || streq(s0, "TIMESTAMP_MILLIS") ) { // do nothing, just recognize valid field } else if (streq(s0, "VCP")) { if (ct != 3) { f0printf(FERR, "Invalid VCP data at line %d: %s\n", linectr, line); valid_data = false; } else { // found feature id and value Byte feature_id; bool ok = hhs_to_byte_in_buf(s1, &feature_id); if (!ok) { f0printf(FERR, "Invalid opcode at line %d: %s", linectr, s1); valid_data = false; } else { // valid opcode DDCA_Single_Vcp_Value * valrec = NULL; // look up opcode, is it valid? // table values need special handling // Problem: without VCP version, can't look up feature in // VCP code table and definitively know if it's a table feature. // One solution: rework data structures to parse later // second solution: vcp version in dumpload data VCP_Feature_Table_Entry * pvft_entry = vcp_find_feature_by_hexid_w_default(feature_id); bool is_table_feature = is_feature_table_by_vcp_version( pvft_entry,data->vcp_version); if (is_table_feature) { // s2 is hex string Byte * ba; int bytect = hhs_to_byte_array(s2, &ba); if (bytect < 0) { f0printf(FERR, "Invalid hex string value for opcode at line %d: %s\n", linectr, line); valid_data = false; } else { valrec = create_table_vcp_value_by_bytes( feature_id, ba, bytect); free(ba); } } else { // non-table feature ushort feature_value; ct = sscanf(s2, "%hu", &feature_value); if (ct == 0) { f0printf(FERR, "Invalid value for opcode at line %d: %s\n", linectr, line); valid_data = false; } else { // good opcode and value // TODO: opcode and value should be saved in local vars valrec = create_cont_vcp_value( feature_id, 0, // max_val, unused for LOADVCP feature_value); } } // non-table feature if (valrec) { data->vcp_value_ct++; vcp_value_set_add(data->vcp_values, valrec); } } // valid opcode } // found feature id and value } // VCP else { f0printf(FERR, "Unexpected field \"%s\" at line %d: %s\n", s0, linectr, line ); valid_data = false; } } // more than 1 field on line } // non-comment line } // one line of file if (!valid_data) { if (data) { free_dumpload_data(data); data = NULL; } } return data; } /** Sets multiple VCP values. * * @param dh display handle * @param vset values to set * @return #Ddc_Error reflecting the first error, or NULL if no errors * * This function stops applying values on the first error encountered, and * returns the value of that error as its status code. */ Error_Info * ddc_set_multiple( Display_Handle* dh, Vcp_Value_Set vset) { Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; int value_ct = vcp_value_set_size(vset); int ndx; for (ndx=0; ndx < value_ct; ndx++) { DDCA_Single_Vcp_Value * vrec = vcp_value_set_get(vset, ndx); Byte feature_code = vrec->opcode; #ifdef OLD assert(vrec->value_type == DDCA_NON_TABLE_VCP_VALUE); // Table not yet implemented ushort new_value = vrec->val.c.cur_val; psc = set_nontable_vcp_value(dh, feature_code, new_value); if (psc != 0) { f0printf(FERR, "Error setting value %d for VCP feature code 0x%02x: %s\n", new_value, feature_code, psc_desc(psc) ); f0printf(FERR, "Terminating."); break; } #endif // HACK: will this affect intermittent error of silently failing sets? // pointless, ddc_it2_write_only) calls call_tuned_sleep() after write // if (ndx > 0) { // sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, "before set_vcp_value()"); // } ddc_excp = set_vcp_value(dh, vrec); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (ddc_excp) { f0printf(FERR, "Error setting value for VCP feature code 0x%02x: %s\n", feature_code, psc_desc(psc) ); if (psc == DDCRC_RETRIES) f0printf(FERR, " Try errors: %s\n", errinfo_causes_string(ddc_excp)); f0printf(FERR, "Terminating."); break; } } // for loop return ddc_excp; } /** Applies VCP settings from a #Dumpload_Data struct to * the monitor specified in that data structure. * * @param pdata pointer to #Dumpload_Data instance * @param dh display handle for open display, * if NULL, open the find the display based on the identifiers * in the data and open it * * @return #Ddc_Error describing the first error, or NULL if no error */ Error_Info * loadvcp_by_dumpload_data( Dumpload_Data * pdata, Display_Handle * dh) { assert(pdata); bool debug = false; if (debug) { DBGMSG("Loading VCP settings for monitor \"%s\", sn \"%s\", dh=%p \n", pdata->model, pdata->serial_ascii, dh); report_dumpload_data(pdata, 0); } Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; Display_Handle * dh_argument = dh; if (dh) { // If explicit display specified, check that the data is valid for it assert(dh->dref->pedid); bool ok = true; if ( !streq(dh->dref->pedid->model_name, pdata->model) ) { f0printf(FERR, "Monitor model in data (%s) does not match that for specified device (%s)\n", pdata->model, dh->dref->pedid->model_name); ok = false; } if (!streq(dh->dref->pedid->serial_ascii, pdata->serial_ascii) ) { f0printf(FERR, "Monitor serial number in data (%s) does not match that for specified device (%s)\n", pdata->serial_ascii, dh->dref->pedid->serial_ascii); ok = false; } if (!ok) { psc = DDCRC_INVALID_DISPLAY; goto bye; } } else if ( strlen(pdata->mfg_id) + strlen(pdata->model) + strlen(pdata->serial_ascii) == 0) { // Pathological. Someone's been messing with the VCP file. f0printf(FERR, "Monitor manufacturer id, model, and serial number all missing from input.\n"); psc = DDCRC_INVALID_DISPLAY; goto bye; } else { // no Display_Ref passed as argument, just use the identifiers in the data to pick the display Display_Identifier * did = create_mfg_model_sn_display_identifier( pdata->mfg_id, pdata->model, pdata->serial_ascii); assert(did); Display_Ref * dref = get_display_ref_for_display_identifier( did, CALLOPT_NONE); free_display_identifier(did); if (!dref) { f0printf(FERR, "Monitor not connected: %s - %s \n", pdata->model, pdata->serial_ascii ); psc = DDCRC_INVALID_DISPLAY; goto bye; } // return code == 0 iff dh set ddc_open_display(dref, CALLOPT_ERR_MSG, &dh); if (!dh) { psc = DDCRC_INVALID_DISPLAY; goto bye; } } ddc_excp = ddc_set_multiple(dh, pdata->vcp_values); psc = (ddc_excp) ? ddc_excp->status_code : 0; // close the display only if this function opened it if (!dh_argument) ddc_close_display(dh); bye: DBGMSF(debug, "Returning: %s", psc_desc(psc)); if (psc == DDCRC_RETRIES && debug) DBGMSG(" Try errors: %s", errinfo_causes_string(ddc_excp)); return ddc_excp;; } /** Reads the monitor identification and VCP values from a null terminated * string array and applies those values to the selected monitor. * * \param ntsa null terminated array of strings * \param dh display handle * \return pointer to #Ddc_Error describing the first error, NULL if if success */ Error_Info * loadvcp_by_ntsa( Null_Terminated_String_Array ntsa, Display_Handle * dh) { bool debug = false; DDCA_Output_Level output_level = get_output_level(); bool verbose = (output_level >= DDCA_OL_VERBOSE); // DBGMSG("output_level=%d, verbose=%d", output_level, verbose); if (debug) { DBGMSG("Starting. ntsa=%p", ntsa); verbose = true; } Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; GPtrArray * garray = ntsa_to_g_ptr_array(ntsa); Dumpload_Data * pdata = create_dumpload_data_from_g_ptr_array(garray); DBGMSF(debug, "create_dumpload_data_from_g_ptr_array() returned %p", pdata); if (!pdata) { f0printf(FERR, "Unable to load VCP data from string\n"); psc = DDCRC_INVALID_DATA; ddc_excp = errinfo_new(psc, __func__); } else { if (verbose) { f0printf(FOUT, "Loading VCP settings for monitor \"%s\", sn \"%s\" \n", pdata->model, pdata->serial_ascii); rpt_push_output_dest(FOUT); report_dumpload_data(pdata, 0); rpt_pop_output_dest(); } ddc_excp = loadvcp_by_dumpload_data(pdata, dh); free_dumpload_data(pdata); } return ddc_excp; } /** Reads the monitor identification and VCP values from a single string * whose fields are separated by ';' and applies those values to the * selected monitor. * * \param catenated data string * \param dh display handle * \return pointer to #Ddc_Error describing first error, NULL if success */ // n. called from ddct_public: Error_Info * loadvcp_by_string( char * catenated, Display_Handle * dh) { Null_Terminated_String_Array nta = strsplit(catenated, ";"); Error_Info * ddc_excp = loadvcp_by_ntsa(nta, dh); ntsa_free(nta, /* free_strings */ true); return ddc_excp; } // // Dumpvcp // // // Support for dumpvcp command and returning profile info as string in API // /** Formats a timestamp in a way usable in a filename, specifically: * YYYMMDD-HHMMSS * * \param time_millis timestamp in milliseconds * \param buf buffer in which to return the formatted timestamp * \param bufsz buffer size * \return formatted timestamp * * \remark * If buf == NULL or bufsz == 0, then this function allocates a buffer. * It is the responsibility of the caller to free this buffer. */ char * format_timestamp(time_t time_millis, char * buf, int bufsz) { if (bufsz == 0 || buf == NULL) { bufsz = 128; buf = calloc(1, bufsz); } struct tm tm = *localtime(&time_millis); snprintf(buf, bufsz, "%4d%02d%02d-%02d%02d%02d", tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec ); return buf; } #ifdef UNUSED /* Returns monitor identification information in an array of strings. * The strings are written in the format of the DUMPVCP command. * * Arguments: * dh display handle for monitor * vals GPtrArray to which the identification strings are appended. * * Returns: nothing */ void collect_machine_readable_monitor_id(Display_Handle * dh, GPtrArray * vals) { char buf[400]; int bufsz = sizeof(buf)/sizeof(char); Parsed_Edid * edid = ddc_get_parsed_edid_by_display_handle(dh); snprintf(buf, bufsz, "MFG_ID %s", edid->mfg_id); g_ptr_array_add(vals, strdup(buf)); snprintf(buf, bufsz, "MODEL %s", edid->model_name); g_ptr_array_add(vals, strdup(buf)); snprintf(buf, bufsz, "SN %s", edid->serial_ascii); g_ptr_array_add(vals, strdup(buf)); char hexbuf[257]; hexstring2(edid->bytes, 128, NULL /* no separator */, true /* uppercase */, hexbuf, 257); snprintf(buf, bufsz, "EDID %s", hexbuf); g_ptr_array_add(vals, strdup(buf)); } #endif /** Appends TIMESTAMP_TEXT and TIMESTAMP_MILLIS lines to an array of strings. * The strings are written in the format of the DUMPVCP command. * * \param time_millis timestamp in milliseconds * \param vals GPtrArray to which the timestamp strings are appended. */ void collect_machine_readable_timestamp(time_t time_millis, GPtrArray* vals) { // temporarily use same output format as filename, but format the // date separately here for flexibility char timestamp_buf[30]; // n. since buffer provided, format_timestamp() does not allocate format_timestamp(time_millis, timestamp_buf, sizeof(timestamp_buf)); char buf[400]; int bufsz = sizeof(buf)/sizeof(char); snprintf(buf, bufsz, "TIMESTAMP_TEXT %s", timestamp_buf ); g_ptr_array_add(vals, strdup(buf)); snprintf(buf, bufsz, "TIMESTAMP_MILLIS %ld", time_millis); g_ptr_array_add(vals, strdup(buf)); } #ifdef UNUSED // for completeness, currently unused /* Save profile related information (timestamp, monitor identification, * VCP values) in external form in a GPtrArray of string. * * Arguments: * dh display handle * time_millis timestamp in milliseconds * pvals Location of newly allocated GptrArray * * Returns: * status code * * It is the responsibility of the caller to free the newly allocated * GPtrArray. */ Public_Status_Code collect_profile_related_values( Display_Handle* dh, time_t timestamp_millis, GPtrArray** pvals) { bool debug = false; DBGMSF0(debug, "Starting"); assert( get_output_level() == OL_PROGRAM); Public_Status_Code psc = 0; GPtrArray * vals = g_ptr_array_sized_new(50); collect_machine_readable_timestamp(timestamp_millis, vals); collect_machine_readable_monitor_id(dh, vals); psc = show_vcp_values( dh, VCP_SUBSET_PROFILE, vals, false /* force_show_unsupported */); *pvals = vals; if (debug) { DBGMSG("Done. *pvals->len=%d *pvals: ", vals->len); int ndx = 0; for (;ndx < vals->len; ndx++) { DBGMSG(" |%s|", g_ptr_array_index(vals,ndx) ); } } return psc; } #endif /** Primary function for the DUMPVCP command. * * Writes DUMPVCP data to the in-core Dumpload_Data structure * * \param dh display handle for connected display * \param pdumpload_data address at which to return pointer to newly allocated * Dumpload_Data struct. It is the responsibility of the * caller to free this data structure. * \return status code */ Public_Status_Code dumpvcp_as_dumpload_data( Display_Handle * dh, Dumpload_Data** pdumpload_data) { bool debug = false; DBGMSF0(debug, "Starting"); Public_Status_Code psc = 0; Dumpload_Data * dumped_data = calloc(1, sizeof(Dumpload_Data)); // timestamp: dumped_data->timestamp_millis = time(NULL); dumped_data->vcp_version = get_vcp_version_by_display_handle(dh); // use function to ensure set // identification information from edid: // Parsed_Edid * edid = ddc_get_parsed_edid_by_display_handle(dh); Parsed_Edid * edid = dh->dref->pedid; assert(edid); memcpy(dumped_data->mfg_id, edid->mfg_id, sizeof(dumped_data->mfg_id)); memcpy(dumped_data->model, edid->model_name, sizeof(dumped_data->model)); memcpy(dumped_data->serial_ascii, edid->serial_ascii, sizeof(dumped_data->serial_ascii)); memcpy(dumped_data->edidbytes, edid->bytes, 128); assert(sizeof(dumped_data->edidstr) == 257); hexstring2(edid->bytes, 128, NULL /* no separator */, true /* uppercase */, dumped_data->edidstr, 257); // VCP values Vcp_Value_Set vset = vcp_value_set_new(50); psc = collect_raw_subset_values( dh, VCP_SUBSET_PROFILE, vset, true, // ignore_unsupported FERR); if (psc == 0) { dumped_data->vcp_values = vset; // NOTE REFERENCE, BE CAREFUL WHEN FREE dumped_data->vcp_value_ct = vcp_value_set_size(vset); } if (psc != 0 && dumped_data) free(dumped_data); else *pdumpload_data = dumped_data; if (debug) { DBGMSG("Returning: %s, *pdumpload_data=%p", psc_desc(psc), *pdumpload_data); report_dumpload_data(*pdumpload_data, 1); } return psc; } /** Converts a Dumpload_Data structure to an array of strings * * \param data pointer to Dumpload_Data instance * \return array of strings * * \remark * Note that the result shares no memory with data */ GPtrArray * convert_dumpload_data_to_string_array(Dumpload_Data * data) { bool debug = false; DBGMSF(debug, "Starting. data=%p", data); assert(data); if (debug) report_dumpload_data(data, 1); GPtrArray * strings = g_ptr_array_sized_new(30); collect_machine_readable_timestamp(data->timestamp_millis, strings); char buf[300]; int bufsz = sizeof(buf)/sizeof(char); snprintf(buf, bufsz, "MFG_ID %s", data->mfg_id); g_ptr_array_add(strings, strdup(buf)); snprintf(buf, bufsz, "MODEL %s", data->model); g_ptr_array_add(strings, strdup(buf)); snprintf(buf, bufsz, "SN %s", data->serial_ascii); g_ptr_array_add(strings, strdup(buf)); char hexbuf[257]; hexstring2(data->edidbytes, 128, NULL /* no separator */, true /* uppercase */, hexbuf, 257); snprintf(buf, bufsz, "EDID %s", hexbuf); g_ptr_array_add(strings, strdup(buf)); if (!vcp_version_eq(data->vcp_version, VCP_SPEC_UNKNOWN)) { snprintf(buf, bufsz, "VCP_VERSION %d.%d", data->vcp_version.major, data->vcp_version.minor); g_ptr_array_add(strings, strdup(buf)); } for (int ndx=0; ndx < data->vcp_values->len; ndx++) { // n. get_formatted_value_for_feature_table_entry() also has code for table type values DDCA_Single_Vcp_Value * vrec = vcp_value_set_get(data->vcp_values,ndx); char buf[200]; snprintf(buf, 200, "VCP %02X %5d", vrec->opcode, vrec->val.c.cur_val); g_ptr_array_add(strings, strdup(buf)); } return strings; } /** Returns the output of the DUMPVCP command a single string. * Each field is separated by a semicolon. * * The caller is responsible for freeing the returned string. * * \param dh display handle of open monitor * \param pstring location at which to return string * \return status code */ // n. called from ddct_public.c // move to glib_util.c? Public_Status_Code dumpvcp_as_string(Display_Handle * dh, char ** pstring) { bool debug = false; DBGMSF0(debug, "Starting"); Public_Status_Code psc = 0; Dumpload_Data * data = NULL; *pstring = NULL; psc = dumpvcp_as_dumpload_data(dh, &data); if (psc == 0) { GPtrArray * strings = convert_dumpload_data_to_string_array(data); *pstring = join_string_g_ptr_array(strings, ";"); free_dumpload_data(data); } DBGMSF(debug, "Returning: %s, *pstring=|%s|", psc_desc(psc), *pstring); return psc; } ddcutil-0.8.6/src/ddc/ddc_multi_part_io.c0000644000175000001440000004136513226556004015254 00000000000000/* ddc_multi_part_io.c * * Handles multi-part reads and writes used for Table features and * Capabilities. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Multi-part DDC reads and writes used for Table features and * Capabilities retrieval. */ /** \cond */ #include #include #include #include #include #include "util/string_util.h" /** \endcond */ #include "base/core.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/execution_stats.h" #include "base/parms.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_try_stats.h" #include "ddc/ddc_multi_part_io.h" // Trace management static Trace_Group TRACE_GROUP = TRC_DDC; // Retry management and statistics /** \def MAX_MAX_MULTI_EXCHANGE_TRIES * Maximum value to which maximum number of capabilities exchange tries can be set */ #define MAX_MAX_MULTI_EXCHANGE_TRIES MAX_MAX_TRIES /* from parms.h */ /** \def Maximum number of capabilities exchange tries allowed. Can be adjusted. */ static int max_multi_part_read_tries = MAX_MULTI_EXCHANGE_TRIES; static int max_multi_part_write_tries = MAX_MULTI_EXCHANGE_TRIES; static void * multi_part_read_stats_rec = NULL; static void * multi_part_write_stats_rec = NULL; /** Resets the statistics for multi-part reads */ void ddc_reset_multi_part_read_stats() { if (multi_part_read_stats_rec) try_data_reset(multi_part_read_stats_rec); else multi_part_read_stats_rec = try_data_create("multi-part read exchange", max_multi_part_read_tries); } /** Resets the statistics for multi-part writes */ void ddc_reset_multi_part_write_stats() { if (multi_part_write_stats_rec) try_data_reset(multi_part_write_stats_rec); else multi_part_write_stats_rec = try_data_create("multi-part write exchange", max_multi_part_write_tries); } /** Reports the statistics for multi-part reads */ void ddc_report_multi_part_read_stats(int depth) { assert(multi_part_read_stats_rec); try_data_report(multi_part_read_stats_rec, depth); } /** Reports the statistics for multi-part writes */ void ddc_report_multi_part_write_stats(int depth) { assert(multi_part_write_stats_rec); try_data_report(multi_part_write_stats_rec, depth); } /** Resets the maximum number of multi-part read exchange tries allowed. * @param ct new maximum number, must be <= #MAX_MAX_MULTI_EXCHANGE_TRIES */ void ddc_set_max_multi_part_read_tries(int ct) { assert(ct > 0 && ct <= MAX_MAX_MULTI_EXCHANGE_TRIES); max_multi_part_read_tries = ct; if (multi_part_read_stats_rec) try_data_set_max_tries(multi_part_read_stats_rec, ct); } /** Resets the maximum number of multi-part write exchange tries allowed. * @param ct new maximum number, must be <= #MAX_MAX_MULTI_EXCHANGE_TRIES */ void ddc_set_max_multi_part_write_tries(int ct) { assert(ct > 0 && ct <= MAX_MAX_MULTI_EXCHANGE_TRIES); max_multi_part_write_tries = ct; if (multi_part_write_stats_rec) try_data_set_max_tries(multi_part_write_stats_rec, ct); } /** Gets the current maximum number of multi-part read exchange tries allowed * @return maximum number of tries */ int ddc_get_max_multi_part_read_tries() { return max_multi_part_read_tries; } /** Gets the current maximum number of multi-part write exchange tries allowed * @return maximum number of tries */ int ddc_get_max_multi_part_write_tries() { return max_multi_part_write_tries; } /** Makes one attempt to read the entire capabilities string or table feature value * * @param dh display handle for open i2c or adl device * @param request_type DDC_PACKET_TYPE_CAPABILITIES_REQUEST or DDC_PACKET_TYPE_TABLE_REQD_REQUEST * @param request_subtype VCP feature code for table read, ignore for capabilities * @param all_zero_response_ok if true, an all zero response is not regarded * as an error * @param accumulator buffer in which to return result * * @return status code */ Error_Info * try_multi_part_read( Display_Handle * dh, Byte request_type, Byte request_subtype, bool all_zero_response_ok, Buffer * accumulator) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. request_type=0x%02x, request_subtype=x%02x, all_zero_response_ok=%s, accumulator=%p", request_type, request_subtype, bool_repr(all_zero_response_ok), accumulator); const int MAX_FRAGMENT_SIZE = 32; const int readbuf_size = 6 + MAX_FRAGMENT_SIZE + 1; Public_Status_Code psc = 0; Error_Info * excp = NULL; DDC_Packet * request_packet_ptr = NULL; DDC_Packet * response_packet_ptr = NULL; request_packet_ptr = create_ddc_multi_part_read_request_packet( request_type, request_subtype, 0, "try_multi_part_read"); buffer_set_length(accumulator,0); int cur_offset = 0; bool complete = false; while (!complete && !excp) { // loop over fragments DBGTRC(debug, TRC_NONE, "Top of fragment loop", NULL); int fragment_size; update_ddc_multi_part_read_request_packet_offset(request_packet_ptr, cur_offset); response_packet_ptr = NULL; Byte expected_response_type = (request_type == DDC_PACKET_TYPE_CAPABILITIES_REQUEST) ? DDC_PACKET_TYPE_CAPABILITIES_RESPONSE : DDC_PACKET_TYPE_TABLE_READ_RESPONSE; Byte expected_subtype = request_subtype; // 0x00 for capabilities, VCP feature code for table read excp = ddc_write_read_with_retry( dh, request_packet_ptr, readbuf_size, expected_response_type, expected_subtype, all_zero_response_ok, &response_packet_ptr ); psc = (excp) ? excp->status_code : 0; DBGTRC(debug, TRC_NONE, "ddc_write_read_with_retry() request_type=0x%02x, request_subtype=0x%02x, returned %s", request_type, request_subtype, errinfo_summary(excp)); if (excp) { // if (psc != 0) { if (response_packet_ptr) free_ddc_packet(response_packet_ptr); continue; } assert(response_packet_ptr); assert(!excp && psc == 0); if ( IS_TRACING_BY_FUNC_OR_FILE() || debug ) { DBGMSG0("After try_write_read():"); report_interpreted_multi_read_fragment(response_packet_ptr->parsed.multi_part_read_fragment, 0); } Interpreted_Multi_Part_Read_Fragment * aux_data_ptr = response_packet_ptr->parsed.multi_part_read_fragment; int display_current_offset = aux_data_ptr->fragment_offset; if (display_current_offset != cur_offset) { DBGTRC(debug, TRC_NONE, "display_current_offset %d != cur_offset %d", display_current_offset, cur_offset); psc = DDCRC_MULTI_PART_READ_FRAGMENT; excp = errinfo_new(psc, __func__); COUNT_STATUS_CODE(psc); } else { DBGTRC(debug, TRC_NONE, "display_current_offset = %d matches cur_offset", display_current_offset); fragment_size = aux_data_ptr->fragment_length; // *** DBGTRC(debug, TRC_NONE, "fragment_size = %d", fragment_size); if (fragment_size == 0) { complete = true; // redundant } else { buffer_append(accumulator, aux_data_ptr->bytes, fragment_size); cur_offset = cur_offset + fragment_size; if ( IS_TRACING_BY_FUNC_OR_FILE() || debug ) { DBGMSG("Currently assembled fragment: |%.*s|", accumulator->len, accumulator->bytes); DBGMSG("cur_offset = %d", cur_offset); } all_zero_response_ok = false; // accept all zero response only on first fragment } } free_ddc_packet(response_packet_ptr); } // while loop assembling fragments free_ddc_packet(request_packet_ptr); DBGTRC(debug, TRACE_GROUP, "Returning %s", errinfo_summary(excp)); return excp; } /** Gets the DDC capabilities string for a monitor, performing retries if necessary. * * @param dh handle of open display * @param request_type * @param request_subtype VCP function code for table read, ignore for capabilities * @param all_zero_response_ok if true, zero response is not an error * @param pp_buffer address at which to return newly allocated #Buffer in which * result is returned * * @retval NULL success * @retval #Ddc_Error containing status DDCRC_UNSUPPORTED does not support Capabilities Request * @retval #Ddc_Error containing status DDCRC_TRIES maximum retries exceeded: */ Error_Info * multi_part_read_with_retry( Display_Handle * dh, Byte request_type, Byte request_subtype, // VCP feature code for table read, ignore for capabilities bool all_zero_response_ok, Buffer** pp_buffer) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. request_type=0x%02x, request_subtype=0x%02x, all_zero_response_ok=%s" ", max_multi_part_read_tries=%d", request_type, request_subtype, bool_repr(all_zero_response_ok), max_multi_part_read_tries); Public_Status_Code rc = -1; // dummy value for first call of while loop Error_Info * ddc_excp = NULL; // Public_Status_Code try_status_codes[MAX_MAX_TRIES]; Error_Info * try_errors[MAX_MAX_TRIES]; int tryctr = 0; bool can_retry = true; Buffer * accumulator = buffer_new(2048, "multi part read buffer"); while (tryctr < max_multi_part_read_tries && rc < 0 && can_retry) { DBGTRC(debug, TRC_NEVER, "Start of while loop. try_ctr=%d, max_multi_part_read_tries=%d", tryctr, max_multi_part_read_tries); ddc_excp = try_multi_part_read( dh, request_type, request_subtype, all_zero_response_ok, accumulator); try_errors[tryctr] = ddc_excp; rc = (ddc_excp) ? ddc_excp->status_code : 0; if (rc == DDCRC_NULL_RESPONSE) { // generally means this, but could conceivably indicate a protocol error. // try multiple times to ensure it's really unsupported? // just pass DDCRC_NULL_RESPONSE up the chain // rc = DDCRC_DETERMINED_UNSUPPORTED; // COUNT_STATUS_CODE(rc); // double counting? can_retry = false; } else if (rc == DDCRC_READ_ALL_ZERO) { can_retry = false; // just pass DDCRC_READ_ALL_ZERO up the chain: // rc = DDCRC_DETERMINED_UNSUPPORTED; // ?? // COUNT_STATUS_CODE(rc); // double counting? } else if (rc == DDCRC_ALL_TRIES_ZERO) { can_retry = false; // just pass it up // rc = DDCRC_DETERMINED_UNSUPPORTED; // ?? // COUNT_STATUS_CODE(rc); // double counting? } tryctr++; } assert( (rc<0 && ddc_excp) || (rc==0 && !ddc_excp) ); DBGTRC(debug, TRC_NEVER, "After try loop. tryctr=%d, rc=%d. ddc_excp=%p", tryctr, rc, ddc_excp); if (debug) { for (int ndx = 0; ndx < tryctr; ndx++) { DBGMSG("try_errors[%d] = %p", ndx, try_errors[ndx]); } } if (rc < 0) { buffer_free(accumulator, "capabilities buffer, error"); accumulator = NULL; if (tryctr >= max_multi_part_read_tries) rc = DDCRC_RETRIES; ddc_excp = errinfo_new_with_causes(rc, try_errors, tryctr, __func__); if (rc != try_errors[tryctr-1]->status_code) COUNT_STATUS_CODE(rc); // new status code, count it } else { for (int ndx = 0; ndx < tryctr-1; ndx++) { // errinfo_free(try_errors[ndx]); ERRINFO_FREE_WITH_REPORT(try_errors[ndx], debug || IS_TRACING() || report_freed_exceptions); } } // if counts for DDCRC_ALL_TRIES_ZERO? try_data_record_tries(multi_part_read_stats_rec, rc, tryctr); *pp_buffer = accumulator; DBGTRC(debug, TRACE_GROUP, "Returning: %s", errinfo_summary(ddc_excp)); return ddc_excp; } /** Makes one attempt to write an entire VCP Table value * * @param dh display handle for open i2c or adl device * @param vcp_code VCP feature code * @param value_to_set Table feature value * * @return status code */ Error_Info * try_multi_part_write( Display_Handle * dh, Byte vcp_code, Buffer * value_to_set) { bool debug = false; Byte request_type = DDC_PACKET_TYPE_TABLE_WRITE_REQUEST; Byte request_subtype = vcp_code; DBGTRC(debug, TRACE_GROUP, "Starting. request_type=0x%02x, request_subtype=x%02x, accumulator=%p", request_type, request_subtype, value_to_set); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; int MAX_FRAGMENT_SIZE = 32; int max_fragment_size = MAX_FRAGMENT_SIZE - 4; // hack // const int writebbuf_size = 6 + MAX_FRAGMENT_SIZE + 1; DDC_Packet * request_packet_ptr = NULL; int bytes_remaining = value_to_set->len; int offset = 0; while (bytes_remaining >= 0 && psc == 0) { int bytect_to_write = (bytes_remaining <= max_fragment_size) ? bytes_remaining : max_fragment_size; request_packet_ptr = create_ddc_multi_part_write_request_packet( DDC_PACKET_TYPE_TABLE_WRITE_REQUEST, vcp_code, // request_subtype, offset, value_to_set->bytes+offset, bytect_to_write, __func__); ddc_excp = ddc_write_only_with_retry(dh, request_packet_ptr); psc = (ddc_excp) ? ddc_excp->status_code : 0; free_ddc_packet(request_packet_ptr); assert( (!ddc_excp && psc == 0) || (ddc_excp && psc!=0) ); if (!ddc_excp) { if (bytect_to_write == 0) // if just wrote final empty segment to indicate done break; offset += bytect_to_write; bytes_remaining -= bytect_to_write; } } DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", errinfo_summary(ddc_excp)); assert( (ddc_excp && psc<0) || (!ddc_excp && psc==0) ); return ddc_excp; } /** Writes a VCP table feature, with retry. * * @param dh display handle * @param vcp_code VCP feature code to write * @param value_to_set bytes of Table feature * @return NULL if success, pointer to #Ddc_Error if failure */ Error_Info * multi_part_write_with_retry( Display_Handle * dh, Byte vcp_code, Buffer * value_to_set) { bool debug = false; if (IS_TRACING()) puts(""); DBGTRC(debug, TRACE_GROUP, "Starting. dh=%s, vcp_code=0x%02x", dh_repr_t(dh), vcp_code); Public_Status_Code rc = -1; // dummy value for first call of while loop Error_Info * ddc_excp = NULL; Error_Info * try_errors[MAX_MAX_TRIES]; int tryctr = 0; bool can_retry = true; while (tryctr < max_multi_part_write_tries && rc < 0 && can_retry) { DBGTRC(debug, TRACE_GROUP, "Start of while loop. try_ctr=%d, max_multi_part_write_tries=%d", tryctr, max_multi_part_write_tries); ddc_excp = try_multi_part_write( dh, vcp_code, value_to_set); try_errors[tryctr] = ddc_excp; rc = (ddc_excp) ? ddc_excp->status_code : 0; assert( (ddc_excp && rc<0) || (!ddc_excp && rc==0) ); // TODO: What rc values set can_retry = false? tryctr++; } assert( (ddc_excp && rc < 0) || (!ddc_excp && rc==0) ); if (rc < 0) { if (can_retry) rc = DDCRC_RETRIES; ddc_excp= errinfo_new_with_causes(rc, try_errors, tryctr, __func__); if (rc != try_errors[tryctr-1]->status_code) COUNT_STATUS_CODE(rc); // new status code, count it } else { for (int ndx=0; ndx * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #include /** \cond */ #include #include #include #include #include #include "util/error_info.h" #include "util/report_util.h" #include "base/adl_errors.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/linux_errno.h" #include "base/parms.h" #include "base/sleep.h" #include "i2c/i2c_bus_core.h" #include "i2c/i2c_do_io.h" #include "adl/adl_shim.h" #ifdef USE_USB #include "usb/usb_displays.h" #include "usb/usb_vcp.h" #endif #include "vcp/parse_capabilities.h" #include "ddc/ddc_edid.h" #include "ddc/ddc_multi_part_io.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp.h" #include "ddc/ddc_vcp_version.h" #include // Trace class for this file static Trace_Group TRACE_GROUP = TRC_DDC; // Standard format strings for reporting feature codes. const char* FMT_CODE_NAME_DETAIL_WO_NL = "VCP code 0x%02x (%-30s): %s"; const char* FMT_CODE_NAME_DETAIL_W_NL = "VCP code 0x%02x (%-30s): %s\n"; // // VCP Feature Table inquiry // /* Checks if a feature is a table type feature, given * the VCP version of a monitor. * * For a handful of features, whether the feature is of * type Table varies based on the the VCP version. This * function encapsulates that check. * * Arguments: * frec pointer to VCP feature table entry * dh display handle of monitor * * Returns: * true if the specified feature is a table feature, * false if not */ bool is_table_feature_by_display_handle( VCP_Feature_Table_Entry * frec, Display_Handle * dh) { // bool debug = false; bool result = false; DDCA_MCCS_Version_Spec vcp_version = get_vcp_version_by_display_handle(dh); DDCA_Version_Feature_Flags feature_flags = get_version_sensitive_feature_flags(frec, vcp_version); assert(feature_flags); result = (feature_flags & DDCA_TABLE); // DBGMSF(debug, "returning: %d", result); return result; } // For possible future use - currently unused Public_Status_Code check_valid_operation_by_feature_rec_and_version( VCP_Feature_Table_Entry * frec, DDCA_MCCS_Version_Spec vcp_version, DDCA_Version_Feature_Flags operation_flags) { DDCA_Version_Feature_Flags feature_flags = get_version_sensitive_feature_flags(frec, vcp_version); assert(feature_flags); ushort rwflags = operation_flags & DDCA_RW; ushort typeflags = operation_flags & (DDCA_NORMAL_TABLE | DDCA_CONT | DDCA_NC); Public_Status_Code result = DDCL_INVALID_OPERATION; if ( (feature_flags & rwflags) && (feature_flags & typeflags) ) result = 0; return result; } Public_Status_Code check_valid_operation_by_feature_id_and_dh( Byte feature_id, Display_Handle * dh, DDCA_Version_Feature_Flags operation_flags) { Public_Status_Code result = 0; VCP_Feature_Table_Entry * frec = vcp_find_feature_by_hexid(feature_id); if (!frec) result = DDCL_UNKNOWN_FEATURE; else { DDCA_MCCS_Version_Spec vcp_version = get_vcp_version_by_display_handle(dh); result = check_valid_operation_by_feature_rec_and_version(frec, vcp_version, operation_flags); } return result; } // // Get raw VCP feature values // /* Get the raw value (i.e. bytes) for a feature table entry. * * Convert and refine status codes, issue error messages. * * Arguments; * dh display handle * frec pointer to VCP_Feature_Table_Entry for feature * ignore_unsupported if false, issue error message for unsupported feature * pvalrec location where to return pointer to feature value * msg_fh file handle for error messages * * Returns: * status code */ Public_Status_Code get_raw_value_for_feature_table_entry( Display_Handle * dh, VCP_Feature_Table_Entry * frec, bool ignore_unsupported, DDCA_Single_Vcp_Value ** pvalrec, FILE * msg_fh) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting", NULL); assert(dh); assert(dh->dref); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); char * feature_name = get_version_sensitive_feature_name(frec, vspec); Byte feature_code = frec->code; bool is_table_feature = is_table_feature_by_display_handle(frec, dh); DDCA_Vcp_Value_Type feature_type = (is_table_feature) ? DDCA_TABLE_VCP_VALUE : DDCA_NON_TABLE_VCP_VALUE; DDCA_Output_Level output_level = get_output_level(); DDCA_Single_Vcp_Value * valrec = NULL; if (dh->dref->io_path.io_mode == DDCA_IO_USB) { #ifdef USE_USB psc = usb_get_vcp_value( dh, feature_code, feature_type, &valrec); if (psc != 0) ddc_excp = errinfo_new(psc, __func__); #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else { ddc_excp = get_vcp_value( dh, feature_code, feature_type, &valrec); psc = ERRINFO_STATUS(ddc_excp); } assert ( (psc==0 && valrec) || (psc!=0 && !valrec) ); switch(psc) { case 0: break; case DDCRC_INVALID_DATA: if (output_level >= DDCA_OL_NORMAL) f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, "Invalid response"); break; case DDCRC_NULL_RESPONSE: // for unsupported features, some monitors return null response rather than a valid response // with unsupported feature indicator set if (!ignore_unsupported) { f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, "Unsupported feature code (Null response)"); } COUNT_STATUS_CODE(DDCRC_DETERMINED_UNSUPPORTED); psc = DDCRC_DETERMINED_UNSUPPORTED; break; case DDCRC_READ_ALL_ZERO: // treat as invalid response if not table type? if (!ignore_unsupported) { f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, "Unsupported feature code (All zero response)"); } psc = DDCRC_DETERMINED_UNSUPPORTED; COUNT_STATUS_CODE(DDCRC_DETERMINED_UNSUPPORTED); break; case DDCRC_RETRIES: f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, "Maximum retries exceeded"); break; case DDCRC_REPORTED_UNSUPPORTED: case DDCRC_DETERMINED_UNSUPPORTED: if (!ignore_unsupported) { f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, "Unsupported feature code"); } break; default: { char buf[200]; snprintf(buf, 200, "Invalid response. status code=%s, %s", psc_desc(psc), dh_repr_t(dh)); f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, buf); } } *pvalrec = valrec; DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s, *pvalrec=%p", psc_desc(psc), *pvalrec); assert( (psc == 0 && *pvalrec) || (psc != 0 && !*pvalrec) ); if (*pvalrec && (debug || IS_TRACING())) { dbgrpt_ddca_single_vcp_value(*pvalrec, 1); } if (ddc_excp) { #ifdef OLD if (debug || IS_TRACING() || report_freed_exceptions) { DBGMSG("Freeing exception:"); errinfo_report(ddc_excp, 1); } errinfo_free(ddc_excp); #endif ERRINFO_FREE_WITH_REPORT(ddc_excp, debug || IS_TRACING() || report_freed_exceptions); } return psc; } /* Gather values for the features in a feature set. * * Arguments: * dh display handle * feature_set feature set identifying features to be queried * vset append values retrieved to this value set * ignore_unsupported unsupported features are not an error * msg_fh destination for error messages * * Returns: * status code */ Public_Status_Code collect_raw_feature_set_values( Display_Handle * dh, VCP_Feature_Set feature_set, Vcp_Value_Set vset, bool ignore_unsupported, // if false, is error if unsupported FILE * msg_fh) { Public_Status_Code master_status_code = 0; bool debug = false; DBGMSF0(debug, "Starting."); int features_ct = get_feature_set_size(feature_set); // needed when called from C API, o.w. get get NULL response for first feature // DBGMSG("Inserting sleep() before first call to get_raw_value_for_feature_table_entry()"); // sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, "initial"); int ndx; for (ndx=0; ndx< features_ct; ndx++) { VCP_Feature_Table_Entry * entry = get_feature_set_entry(feature_set, ndx); DBGMSF(debug,"ndx=%d, feature = 0x%02x", ndx, entry->code); DDCA_Single_Vcp_Value * pvalrec; Public_Status_Code cur_status_code = get_raw_value_for_feature_table_entry( dh, entry, ignore_unsupported, &pvalrec, msg_fh); if (cur_status_code == 0) { vcp_value_set_add(vset, pvalrec); } else if ( (cur_status_code == DDCRC_REPORTED_UNSUPPORTED || cur_status_code == DDCRC_DETERMINED_UNSUPPORTED ) && ignore_unsupported ) { // no problem } else { master_status_code = cur_status_code; break; } } return master_status_code; } /* Gather values for the features in a named feature subset * * Arguments: * dh display handle * subset feature set identifier * vset append values retrieved to this value set * ignore_unsupported unsupported features are not an error * msg_fh destination for error messages * * Returns: * status code */ Public_Status_Code collect_raw_subset_values( Display_Handle * dh, VCP_Feature_Subset subset, Vcp_Value_Set vset, bool ignore_unsupported, FILE * msg_fh) { Public_Status_Code psc = 0; bool debug = false; DBGMSF(debug, "Starting. subset=%d dh=%s", subset, dh_repr(dh) ); DDCA_MCCS_Version_Spec vcp_version = get_vcp_version_by_display_handle(dh); // DBGMSG("VCP version = %d.%d", vcp_version.major, vcp_version.minor); VCP_Feature_Set feature_set = create_feature_set(subset, vcp_version); if (debug) report_feature_set(feature_set, 0); psc = collect_raw_feature_set_values( dh, feature_set, vset, ignore_unsupported, msg_fh); free_vcp_feature_set(feature_set); DBGMSF0(debug, "Done"); return psc; } // // Get formatted feature values // Public_Status_Code get_formatted_value_for_feature_table_entry( Display_Handle * dh, VCP_Feature_Table_Entry * vcp_entry, bool suppress_unsupported, bool prefix_value_with_feature_code, char ** pformatted_value, FILE * msg_fh) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. suppress_unsupported=%s", bool_repr(suppress_unsupported)); Public_Status_Code psc = 0; *pformatted_value = NULL; DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); Byte feature_code = vcp_entry->code; char * feature_name = get_version_sensitive_feature_name(vcp_entry, vspec); bool is_table_feature = is_table_feature_by_display_handle(vcp_entry, dh); DDCA_Vcp_Value_Type feature_type = (is_table_feature) ? DDCA_TABLE_VCP_VALUE : DDCA_NON_TABLE_VCP_VALUE; DDCA_Output_Level output_level = get_output_level(); if (output_level >= DDCA_OL_VERBOSE) { fprintf(msg_fh, "\nGetting data for %s VCP code 0x%02x - %s:\n", (is_table_feature) ? "table" : "non-table", feature_code, feature_name); } DDCA_Single_Vcp_Value * pvalrec = NULL; // bool ignore_unsupported = !(output_level >= DDCA_OL_NORMAL && !suppress_unsupported); bool ignore_unsupported = suppress_unsupported; psc = get_raw_value_for_feature_table_entry( dh, vcp_entry, ignore_unsupported, &pvalrec, (output_level == DDCA_OL_TERSE) ? NULL : msg_fh); // msg_fh); assert( (psc==0 && (feature_type == pvalrec->value_type)) || (psc!=0 && !pvalrec) ); if (psc == 0) { // if (!is_table_feature && output_level >= OL_VERBOSE) { // if (!is_table_feature && debug) { if (output_level >= DDCA_OL_VERBOSE || debug) { rpt_push_output_dest(msg_fh); // report_single_vcp_value(pvalrec, 0); rpt_vstring(0, "Raw value: %s", summarize_single_vcp_value(pvalrec)); rpt_pop_output_dest(); } if (output_level == DDCA_OL_TERSE) { if (is_table_feature) { // output VCP code hex values of bytes int bytect = pvalrec->val.t.bytect; int hexbufsize = bytect * 3; char * hexbuf = calloc(hexbufsize, sizeof(char)); char space = ' '; // n. buffer passed to hexstring2(), so no allocation hexstring2(pvalrec->val.t.bytes, bytect, &space, false /* upper case */, hexbuf, hexbufsize); char * formatted = calloc(hexbufsize + 20, sizeof(char)); snprintf(formatted, hexbufsize+20, "VCP %02X T x%s\n", feature_code, hexbuf); *pformatted_value = formatted; free(hexbuf); } else { // OL_PROGRAM, not table feature DDCA_Version_Feature_Flags vflags = get_version_sensitive_feature_flags(vcp_entry, vspec); char buf[200]; assert(vflags & (DDCA_CONT | DDCA_SIMPLE_NC | DDCA_COMPLEX_NC)); if (vflags & DDCA_CONT) { snprintf(buf, 200, "VCP %02X C %d %d", vcp_entry->code, pvalrec->val.c.cur_val, pvalrec->val.c.max_val); } else if (vflags & DDCA_SIMPLE_NC) { snprintf(buf, 200, "VCP %02X SNC x%02x", vcp_entry->code, pvalrec->val.nc.sl); } else { assert(vflags & DDCA_COMPLEX_NC); snprintf(buf, 200, "VCP %02X CNC x%02x x%02x x%02x x%02x", vcp_entry->code, pvalrec->val.nc.mh, pvalrec->val.nc.ml, pvalrec->val.nc.sh, pvalrec->val.nc.sl ); } *pformatted_value = strdup(buf); } } else { bool ok; char * formatted_data = NULL; ok = vcp_format_feature_detail( vcp_entry, vspec, pvalrec, &formatted_data); // DBGMSG("vcp_format_feature_detail set formatted_data=|%s|", formatted_data); if (!ok) { f0printf(msg_fh, FMT_CODE_NAME_DETAIL_W_NL, feature_code, feature_name, "!!! UNABLE TO FORMAT OUTPUT"); psc = DDCRC_INTERPRETATION_FAILED; // TODO: retry with default output function } if (ok) { if (prefix_value_with_feature_code) { *pformatted_value = calloc(1, strlen(formatted_data) + 50); snprintf(*pformatted_value, strlen(formatted_data) + 49, FMT_CODE_NAME_DETAIL_WO_NL, feature_code, feature_name, formatted_data); free(formatted_data); } else { *pformatted_value = formatted_data; } } } // normal (non OL_PROGRAM) output } else { // error // if output_level >= DDCA_OL_NORMAL, get_raw_value_for_feature_table_entry() already issued message if (output_level == DDCA_OL_TERSE && !suppress_unsupported) { f0printf(msg_fh, "VCP %02X ERR\n", vcp_entry->code); } } if (pvalrec) free_single_vcp_value(pvalrec); // TRCMSGTG(tg, "Done. Returning: %s, *pformatted_value=|%s|", gsc_desc(gsc), *pformatted_value); DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s, *pformatted_value=|%s|", psc_desc(psc), *pformatted_value); return psc; } Public_Status_Code show_feature_set_values( Display_Handle * dh, VCP_Feature_Set feature_set, GPtrArray * collector, // if null, write to FOUT // bool force_show_unsupported, // deprecated Feature_Set_Flags flags, Byte_Value_Array features_seen) // if non-null, collect list of features seen { Public_Status_Code master_status_code = 0; bool debug = false; char * s0 = feature_set_flag_names(flags); DBGMSF(debug, "Starting. flags=%s, collector=%p", s0, collector); free(s0); VCP_Feature_Subset subset_id = get_feature_set_subset_id(feature_set); DDCA_Output_Level output_level = get_output_level(); bool show_unsupported = false; if ( (flags & FSF_SHOW_UNSUPPORTED) || output_level >= DDCA_OL_VERBOSE || subset_id == VCP_SUBSET_SINGLE_FEATURE ) show_unsupported = true; bool suppress_unsupported = !show_unsupported; DDCA_MCCS_Version_Spec vcp_version = get_vcp_version_by_display_handle(dh); bool prefix_value_with_feature_code = true; // TO FIX FILE * msg_fh = FOUT; // TO FIX int features_ct = get_feature_set_size(feature_set); DBGMSF(debug, "features_ct=%d", features_ct); int ndx; for (ndx=0; ndx< features_ct; ndx++) { VCP_Feature_Table_Entry * entry = get_feature_set_entry(feature_set, ndx); DBGMSF(debug,"ndx=%d, feature = 0x%02x", ndx, entry->code); if (!is_feature_readable_by_vcp_version(entry, vcp_version)) { // confuses the output if suppressing unsupported if (show_unsupported) { char * feature_name = get_version_sensitive_feature_name(entry, vcp_version); DDCA_Version_Feature_Flags vflags = get_version_sensitive_feature_flags(entry, vcp_version); char * msg = (vflags & DDCA_DEPRECATED) ? "Deprecated" : "Write-only feature"; f0printf(FOUT, FMT_CODE_NAME_DETAIL_W_NL, entry->code, feature_name, msg); } } else { bool skip_feature = false; if (subset_id != VCP_SUBSET_SINGLE_FEATURE && is_feature_table_by_vcp_version(entry, vcp_version) && (flags & FSF_NOTABLE) ) { skip_feature = true; } if (!skip_feature) { char * formatted_value = NULL; Public_Status_Code psc = get_formatted_value_for_feature_table_entry( dh, entry, suppress_unsupported, prefix_value_with_feature_code, &formatted_value, msg_fh); assert( (psc==0 && formatted_value) || (psc!=0 && !formatted_value) ); if (psc == 0) { if (collector) g_ptr_array_add(collector, formatted_value); else f0printf(FOUT, "%s\n", formatted_value); free(formatted_value); if (features_seen) bbf_set(features_seen, entry->code); // note that feature was read } else { // or should I check features_ct == 1? VCP_Feature_Subset subset_id = get_feature_set_subset_id(feature_set); if (subset_id == VCP_SUBSET_SINGLE_FEATURE) master_status_code = psc; else { if ( (psc != DDCRC_REPORTED_UNSUPPORTED) && (psc != DDCRC_DETERMINED_UNSUPPORTED) ) { if (master_status_code == 0) master_status_code = psc; } } } } // !skip_feature } DBGMSF(debug,"ndx=%d, feature = 0x%02x Done", ndx, entry->code); } // loop over features DBGMSF(debug, "Returning: %s", psc_desc(master_status_code)); return master_status_code; } #ifdef FUTURE //typedef bool (*VCP_Feature_Set_Filter_Func)(VCP_Feature_Table_Entry * ventry); bool hack42(VCP_Feature_Table_Entry * ventry) { bool debug = false; bool result = true; // if (ventry->code >= 0xe0) { // is everything promoted to int before comparison? if ( (ventry->vcp_global_flags & DDCA_SYNTHETIC) && (ventry->v20_flags & DDCA_NORMAL_TABLE) ) { result = false; DBGMSF(debug, "Returning false for vcp code 0x%02x", ventry->code); } return result; } #endif /* Shows the VCP values for all features in a VCP feature subset. * * Arguments: * dh display handle for open display * subset feature subset id * collector accumulates output // if null, write to FOUT * force_show_unsupported * features_seen if non-null, collect ids of features that exist * * Returns: * status code */ Public_Status_Code show_vcp_values( Display_Handle * dh, VCP_Feature_Subset subset, GPtrArray * collector, // not used // bool force_show_unsupported, // deprecated Feature_Set_Flags flags, Byte_Bit_Flags features_seen) { Public_Status_Code psc = 0; bool debug = false; if (debug) { char * s0 = feature_set_flag_names(flags); DBGMSG("Starting. subset=%d, flags=%s, dh=%s", subset, s0, dh_repr(dh) ); free(s0); } DDCA_MCCS_Version_Spec vcp_version = get_vcp_version_by_display_handle(dh); // DBGMSG("VCP version = %d.%d", vcp_version.major, vcp_version.minor); VCP_Feature_Set feature_set = create_feature_set(subset, vcp_version); #ifdef FUTURE Parsed_Capabilities * pcaps = NULL; // TODO: HOW TO GET Parsed_Capabilities?, will only be set for probe/interrogate // special case, if scanning, don't try to do a table read of manufacturer specific // features if it's clear that table read commands are unavailable // convoluted solution to avoid passing additional argument to create_feature_set() if (subset == VCP_SUBSET_SCAN && !parsed_capabilities_may_support_table_commands(pcaps)) { filter_feature_set(feature_set, hack42); } #endif if (debug) report_feature_set(feature_set, 0); psc = show_feature_set_values( dh, feature_set, collector, flags, features_seen); free_vcp_feature_set(feature_set); DBGMSF0(debug, "Done"); return psc; } ddcutil-0.8.6/src/ddc/ddc_packet_io.c0000644000175000001440000007513113227337527014351 00000000000000/* ddc_packet_io.c * * Functions for performing DDC packet IO, using either the I2C bus API * or the ADL API, as appropriate. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Functions for performing DDC packet IO, using either the I2C bus API * or the ADL API, as appropriate. Handles I2C bus retry. */ // N. ddc_open_display() and ddc_close_display() handle case USB, but the // packet functions are for I2C and ADL only. Consider splitting. /** \cond */ #include #include #include #include #include #include #include #include #include #include #include "util/debug_util.h" #include "util/string_util.h" #include "util/utilrpt.h" /** \endcond */ #include "base/ddc_errno.h" #include "base/displays.h" #include "base/execution_stats.h" #include "base/parms.h" #include "base/status_code_mgt.h" #include "i2c/i2c_bus_core.h" #include "i2c/i2c_do_io.h" #include "adl/adl_shim.h" #ifdef USE_USB #include "usb/usb_displays.h" #endif #include "ddc/ddc_try_stats.h" #include "ddc/ddc_packet_io.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_DDC; #ifdef DEPRECATED // Deprecated - use all_bytes_zero() in string_util.c // Tests if a range of bytes is entirely 0 bool all_zero(Byte * bytes, int bytect) { bool result = true; int ndx = 0; for (; ndx < bytect; ndx++) { if (bytes[ndx] != 0x00) { result = false; break; } } return result; } #endif // Test for DDC null message #ifdef UNUSED bool is_ddc_null_message(Byte * packet) { return (packet[0] == 0x6f && packet[1] == 0x6e && packet[2] == 0x80 && packet[3] == 0xbe ); } #endif // // Open/Close Display // /** Opens a DDC display. * * \param dref display reference * \param callopts call option flags * \param pdh address at which to return display handle * * Returns: * status code * * Notes: * Will abort if open fails and CALLOPT_ERR_ABORT set */ Public_Status_Code ddc_open_display( Display_Ref * dref, Call_Options callopts, Display_Handle** pdh) { bool debug = false; DBGMSF(debug, "Opening display %s, callopts=%s", dref_repr_t(dref), interpret_call_options_t(callopts) ); Display_Handle * dh = NULL; Public_Status_Code psc = 0; switch (dref->io_path.io_mode) { case DDCA_IO_DEVI2C: { int fd = i2c_open_bus(dref->io_path.path.i2c_busno, callopts); if (fd < 0) { // will be < 0 if open_i2c_bus failed and CALLOPT_ERR_ABORT not set psc = fd; goto bye; } DBGMSF(debug, "Calling set_addr(0x37) for %s", dref_repr_t(dref)); Status_Errno base_rc = i2c_set_addr(fd, 0x37, callopts); if (base_rc != 0) { assert(base_rc < 0); close(fd); psc = base_rc; goto bye; } // Is this needed? // 10/24/15, try disabling: // sleepMillisWithTrace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); dh = create_bus_display_handle_from_display_ref(fd, dref); // n. sets dh->dref = dref // n. sets // Bus_Info * bus_info = i2c_get_bus_info(dref->io_path.path.i2c_busno, DISPSEL_VALID_ONLY); // or DISPSEL_NONE? // Bus_Info * bus_info = i2c_get_bus_info_new(dref->io_path.path.i2c_busno); // or DISPSEL_NONE? I2C_Bus_Info * bus_info = dref->detail2; assert(bus_info); // need to convert to a test? assert( memcmp(bus_info, I2C_BUS_INFO_MARKER, 4) == 0); dref->pedid = bus_info->edid; if (!dref->pedid) { // How is this even possible? // 1/2017: Observed with x260 laptop and Ultradock, See ddcutil user report. // close(fd) fails DBGMSG("No EDID for device on bus /dev/i2c-%d", dref->io_path.path.i2c_busno); if (!(callopts & CALLOPT_FORCE)) { close(fd); psc = DDCRC_EDID; goto bye; } else DBGMSG0("Continuing"); } } break; case DDCA_IO_ADL: dh = create_adl_display_handle_from_display_ref(dref); // n. sets dh->dref = dref dref->pedid = adlshim_get_parsed_edid_by_display_handle(dh); break; case DDCA_IO_USB: #ifdef USE_USB { DBGMSF(debug, "Opening USB device: %s", dref->usb_hiddev_name); assert(dref->usb_hiddev_name); // if (!dref->usb_hiddev_name) { // HACK // DBGMSG("HACK FIXUP. dref->usb_hiddev_name"); // dref->usb_hiddev_name = get_hiddev_devname_by_display_ref(dref); // } int fd = usb_open_hiddev_device(dref->usb_hiddev_name, callopts); if (fd < 0) { psc = fd; goto bye; } dh = create_usb_display_handle_from_display_ref(fd, dref); dref->pedid = usb_get_parsed_edid_by_display_handle(dh); } #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif break; } // switch assert(!dh || dh->dref->pedid); // needed? for both or just I2C? // sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); if (dref->io_path.io_mode != DDCA_IO_USB) call_tuned_sleep_i2c(SE_POST_OPEN); // report_display_handle(pDispHandle, __func__); bye: if (psc != 0) COUNT_STATUS_CODE(psc); *pdh = dh; assert(psc <= 0); DBGMSF(debug, "Done. Returning: %s, *pdh=%d", psc_desc(psc), *pdh); return psc; } /* Closes a DDC display. * * Arguments: * dh display handle * * Logs status code but continues execution if error. */ void ddc_close_display(Display_Handle * dh) { bool debug = false; if (debug) { DBGMSG0("Starting."); dbgrpt_display_handle(dh, __func__, 1); } switch(dh->dref->io_path.io_mode) { case DDCA_IO_DEVI2C: { Status_Errno rc = i2c_close_bus(dh->fh, dh->dref->io_path.path.i2c_busno, CALLOPT_NONE); // return error if failure if (rc != 0) { assert(rc < 0); DBGMSG("close_i2c_bus returned %d", rc); COUNT_STATUS_CODE(rc); } dh->fh = -1; // indicate invalid, in case we try to continue using dh break; } case DDCA_IO_ADL: break; // nothing to do case DDCA_IO_USB: #ifdef USE_USB { Status_Errno rc = usb_close_device(dh->fh, dh->dref->usb_hiddev_name, CALLOPT_NONE); // return error if failure if (rc != 0) { assert(rc < 0); DBGMSG("usb_close_device returned %d", rc); COUNT_STATUS_CODE(rc); } dh->fh = -1; break; } #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } //switch free_display_handle(dh); } // // Retry Management and Statistics // // constants in parms.h: static int max_write_only_exchange_tries = MAX_WRITE_ONLY_EXCHANGE_TRIES; static int max_write_read_exchange_tries = MAX_WRITE_READ_EXCHANGE_TRIES; static void * write_read_stats_rec = NULL; static void * write_only_stats_rec = NULL; void ddc_reset_write_read_stats() { if (write_read_stats_rec) try_data_reset(write_read_stats_rec); else write_read_stats_rec = try_data_create("ddc write/read", max_write_read_exchange_tries); } void ddc_report_write_read_stats(int depth) { assert(write_read_stats_rec); try_data_report(write_read_stats_rec, depth); } void ddc_reset_write_only_stats() { if (write_only_stats_rec) try_data_reset(write_only_stats_rec); else write_only_stats_rec = try_data_create("ddc write only", max_write_only_exchange_tries); } void ddc_report_write_only_stats(int depth) { assert(write_only_stats_rec); try_data_report(write_only_stats_rec, depth); } void ddc_set_max_write_only_exchange_tries(int ct) { assert(ct > 0 && ct <= MAX_MAX_TRIES); max_write_only_exchange_tries = ct; if (write_only_stats_rec) try_data_set_max_tries(write_only_stats_rec, ct); } int ddc_get_max_write_only_exchange_tries() { return max_write_only_exchange_tries; } void ddc_set_max_write_read_exchange_tries(int ct) { assert(ct > 0 && ct <= MAX_MAX_TRIES); max_write_read_exchange_tries = ct; if (write_read_stats_rec) try_data_set_max_tries(write_read_stats_rec, ct); } int ddc_get_max_write_read_exchange_tries() { return max_write_read_exchange_tries; } // work in progress // typedef for ddc_i2c_write_read_raw, ddc_adl_write_read_raw, ddc_write_read_raw typedef Public_Status_Code (*Write_Read_Raw_Function)( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte * readbuf, int * pbytes_received ); // // Write and read operations that take DDC_Packets // /* Writes a DDC request packet to an open I2C bus * and returns the raw response. * * Arguments: * dh display handle for open I2C bus * request_packet_ptr DDC packet to write * max_read_bytes maximum number of bytes to read * readbuf where to return response * pbytes_received where to write count of bytes received * (always equal to max_read_bytes * * Returns: * 0 if success * -errno if error in write * DDCRC_READ_ALL_ZERO */ static Public_Status_Code ddc_i2c_write_read_raw( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte * readbuf, int * pbytes_received ) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. dh=%s, readbuf=%p",dh_repr_t(dh), readbuf); // DBGMSG("request_packet_ptr=%p", request_packet_ptr); // dump_packet(request_packet_ptr); assert(dh); assert(dh->dref); assert(dh->dref->io_path.io_mode == DDCA_IO_DEVI2C); // ASSERT_DISPLAY_IO_MODE(dh, DDCA_IO_DEVI2C); #ifdef TEST_THAT_DIDNT_WORK bool single_byte_reads = false; // doesn't work #endif Status_Errno_DDC rc = invoke_i2c_writer( dh->fh, get_packet_len(request_packet_ptr)-1, get_packet_start(request_packet_ptr)+1 ); DBGMSF(debug, "invoke_i2c_writer() returned %d\n", rc); if (rc == 0) { call_tuned_sleep_i2c(SE_WRITE_TO_READ); // ALTERNATIVE_THAT_DIDNT_WORK: // if (single_byte_reads) // fails // rc = invoke_single_byte_i2c_reader(dh->fh, max_read_bytes, readbuf); // else rc = invoke_i2c_reader(dh->fh, max_read_bytes, readbuf); // try adding sleep to see if improves capabilities read for P2411H call_tuned_sleep_i2c(SE_POST_READ); if (rc == 0 && all_bytes_zero(readbuf, max_read_bytes)) { DDCMSG(debug, "All zero response detected in %s", __func__); rc = DDCRC_READ_ALL_ZERO; // printf("(%s) All zero response.", __func__ ); // DBGMSG("Request was: %s", // hexstring(get_packet_start(request_packet_ptr)+1, get_packet_len(request_packet_ptr)-1)); } } if (rc < 0) { COUNT_STATUS_CODE(rc); } DBGTRC(debug, TRACE_GROUP, "Done. psc=%s", psc_desc(rc)); return rc; } /* Writes a DDC request packet to an ADL display, * and returns the raw response. * * Arguments: * dh display handle ADL device * request_packet_ptr DDC packet to write * max_read_bytes maximum number of bytes to read * readbuf where to return response * pbytes_received where to write count of bytes received * * Returns: * 0 if success * modulated ADL status code otherwise * * Negative ADL status codes indicate errors * Positive values indicate success but with * additional information. Never seen. How to handle? */ static Public_Status_Code ddc_adl_write_read_raw( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte * readbuf, int * pbytes_received ) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. Using adl_ddc_write_only() and adl_ddc_read_only() dh=%s", dh_repr_t(dh)); assert(dh && dh->dref && dh->dref->io_path.io_mode == DDCA_IO_ADL); // ASSERT_DISPLAY_IO_MODE(dh, DDCA_IO_ADL); Public_Status_Code psc = adlshim_ddc_write_only( dh, get_packet_start(request_packet_ptr), // n. no adjustment, unlike i2c version get_packet_len(request_packet_ptr) ); if (psc < 0) { DBGTRC(debug, TRACE_GROUP, "adl_ddc_write_only() returned gsc=%d\n", psc); } else { call_tuned_sleep_adl(SE_WRITE_TO_READ); psc = adlshim_ddc_read_only( dh, readbuf, pbytes_received); // note_io_event(IE_READ_AFTER_WRITE, __func__); if (psc < 0) { DBGTRC(debug, TRACE_GROUP, "adl_ddc_read_only() returned %d\n", psc); } else { if ( all_bytes_zero(readbuf+1, max_read_bytes-1)) { psc = DDCRC_READ_ALL_ZERO; DDCMSG(debug, "All zero response.", NULL); COUNT_STATUS_CODE(psc); } else if (memcmp(get_packet_start(request_packet_ptr), readbuf, get_packet_len(request_packet_ptr)) == 0) { // is this a DDC error or a programming bug? DDCMSG(debug, "Bytes read same as bytes written.", __func__ ); psc = DDCRC_READ_EQUALS_WRITE; COUNT_STATUS_CODE(psc); } else { psc = 0; } } } if (psc < 0) log_status_code(psc, __func__); DBGTRC(debug, TRACE_GROUP, "Done. rc=%s\n", psc_desc(psc)); return psc; } static Public_Status_Code ddc_write_read_raw( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte * readbuf, int * p_rcvd_bytes_ct ) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. dh=%s, readbuf=%p, max_read_bytes=%d", dh_repr_t(dh), readbuf, max_read_bytes); if (debug) { DBGMSG0("request_packer_ptr->raw_bytes:"); dbgrpt_buffer(request_packet_ptr->raw_bytes, 1); } Public_Status_Code psc; // This function should not be called for USB assert(dh->dref->io_path.io_mode == DDCA_IO_DEVI2C || dh->dref->io_path.io_mode == DDCA_IO_ADL); if (dh->dref->io_path.io_mode == DDCA_IO_DEVI2C) { psc = ddc_i2c_write_read_raw( dh, request_packet_ptr, max_read_bytes, readbuf, p_rcvd_bytes_ct ); } else { psc = ddc_adl_write_read_raw( dh, request_packet_ptr, max_read_bytes, readbuf, p_rcvd_bytes_ct ); } DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", psc_desc(psc)); if (psc == 0) { DBGTRC(debug, TRACE_GROUP, " readbuf: %s", hexstring3_t(readbuf, *p_rcvd_bytes_ct, " ", 4, false)); // hexstring_t(readbuf, *pbytes_received)); } return psc; } /** Writes a DDC request packet to a monitor and provides basic response parsing * based whether the response type is continuous, non-continuous, or table. * * \param dh display handle (for either I2C or ADL device) * \param request_packet_ptr DDC packet to write * \param max_read_bytes maximum number of bytes to read * \param expected_response_type expected response type to check for * \param expected_subtype expected subtype to check for * \param response_packet_ptr_loc where to write address of response packet received * * \return >= 0 if success (positive values possible for ADL?)\n * modulated ADL status code if ADL error or special success case\n * -errno for Linux errors\n * as from #create_ddc_typed_response_packet() * \remark * Issue: positive ADL codes, need to handle? */ Error_Info * ddc_write_read( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte expected_response_type, Byte expected_subtype, DDC_Packet ** response_packet_ptr_loc ) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. dh=%s", dh_repr_t(dh) ); Byte * readbuf = calloc(1, max_read_bytes); int bytes_received = max_read_bytes; Public_Status_Code psc; *response_packet_ptr_loc = NULL; psc = ddc_write_read_raw( dh, request_packet_ptr, max_read_bytes, readbuf, &bytes_received ); if (psc >= 0) { // readbuf[0] = 0x6e; // hex_dump(readbuf, bytes_received+1); psc = create_ddc_typed_response_packet( readbuf, bytes_received, expected_response_type, expected_subtype, __func__, response_packet_ptr_loc); DBGTRC(debug, TRACE_GROUP, "create_ddc_typed_response_packet() returned %s, *response_packet_ptr_loc=%p", ddcrc_desc(psc), *response_packet_ptr_loc ); if (psc != 0 && *response_packet_ptr_loc) { // paranoid, should never occur free(*response_packet_ptr_loc); *response_packet_ptr_loc = NULL; } } free(readbuf); // or does response_packet_ptr_loc point into here? // already done: // if (rc != 0) // COUNT_STATUS_CODE(rc); // If a DDC status code, has already been counted when set. what about RR_ADL? // if (psc < 0 && get_modulation(psc) != RR_DDC) // COUNT_STATUS_CODE(psc); Error_Info * excp = NULL; if (psc < 0) excp = errinfo_new(psc, __func__); DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", errinfo_summary(excp) ); if (psc == 0 && (IS_TRACING() || debug) ) dbgrpt_packet(*response_packet_ptr_loc, 1); return excp; } /** Wraps #ddc_write_read() in retry logic. * * \param dh display handle (for either I2C or ADL device) * \param request_packet_ptr DDC packet to write * \param max_read_bytes maximum number of bytes to read * \param expected_response_type expected response type to check for * \param expected_subtype expected subtype to check for * \param all_zero_response_ok treat a response of all 0s as valid * \param response_packet_ptr_loc where to write address of response packet received * * \return pointer to #Ddc_Error if failure, NULL if success * * \remark * status code from #ddc_write_read() may be positive for positive ADL status code ?? * status code from #ddc_write_read() if exactly 1 pass through try loop\n * DDCRC_RETRIES, DDCRC_ALL_TRIES_ZERO, DDCRC_ALL_RESPONES_NULL if maximum tries exceeded * *\remark * Issue: positive ADL codes, need to handle? * \remark * The maximum number of tries is set in global variable max_write_read_exchange_tries. */ Error_Info * ddc_write_read_with_retry( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte expected_response_type, Byte expected_subtype, bool all_zero_response_ok, DDC_Packet ** response_packet_ptr_loc ) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. dh=%s, all_zero_response_ok=%s", dh_repr_t(dh), bool_repr(all_zero_response_ok) ); assert(dh->dref->io_path.io_mode != DDCA_IO_USB); // show_backtrace(1); // will be false on initial call to verify DDC communication // bool null_response_checked = dh->dref->flags & DREF_DDC_NULL_RESPONSE_CHECKED; // unused bool retry_null_response = !(dh->dref->flags & DREF_DDC_USES_NULL_RESPONSE_FOR_UNSUPPORTED); Public_Status_Code psc; int tryctr; bool retryable; int ddcrc_read_all_zero_ct = 0; int ddcrc_null_response_ct = 0; int ddcrc_null_response_max = (retry_null_response) ? 3 : 0; Error_Info * try_errors[MAX_MAX_TRIES]; assert(max_write_read_exchange_tries > 0); // to avoid clang warning for (tryctr=0, psc=-999, retryable=true; tryctr < max_write_read_exchange_tries && psc < 0 && retryable; tryctr++) { DBGMSF(debug, "Start of try loop, tryctr=%d, max_write_read_echange_tries=%d, rc=%d, retryable=%d", tryctr, max_write_read_exchange_tries, psc, retryable ); Error_Info * cur_excp = ddc_write_read( dh, request_packet_ptr, max_read_bytes, expected_response_type, expected_subtype, response_packet_ptr_loc); psc = (cur_excp) ? cur_excp->status_code : 0; try_errors[tryctr] = cur_excp; if (psc == 0 && ddcrc_null_response_ct > 0) { DBGMSG("%s, ddc_write_read() succeeded after %d sleep and retry for DDC Null Response", dh_repr_t(dh), ddcrc_null_response_ct); } if (psc < 0) { // n. ADL status codes have been modulated DBGMSF(debug, "ddc_write_read() returned %s", psc_desc(psc) ); COUNT_RETRYABLE_STATUS_CODE(psc); if (dh->dref->io_path.io_mode == DDCA_IO_DEVI2C) { // The problem: Does NULL response indicate an error condition, or // is the monitor using NULL response to indicate unsupported? // Acer monitor uses NULL response instead of setting the unsupported // flag in a valid response if (psc == DDCRC_NULL_RESPONSE) { retryable = (ddcrc_null_response_ct++ < ddcrc_null_response_max); DBGMSF(debug, "DDCRC_NULL_RESPONSE, retryable=%s", bool_repr(retryable)); if (retryable) { if (ddcrc_null_response_ct == 1 && get_output_level() >= DDCA_OL_VERBOSE) f0printf(FOUT, "Extended delay as recovery from DDC Null Response...\n"); call_dynamic_tuned_sleep_i2c(SE_DDC_NULL, ddcrc_null_response_ct); } } // when is DDCRC_READ_ALL_ZERO actually an error vs the response of the monitor instead of NULL response? // On Dell monitors (P2411, U3011) all zero response occurs on unsupported Table features // But also seen as a bad response else if ( psc == DDCRC_READ_ALL_ZERO) retryable = (all_zero_response_ok) ? false : true; else if (psc == -EIO) retryable = false; // ?? else if (psc == -EBADF) retryable = false; else if (psc == -ENXIO) // no such device or address, i915 driver retryable = false; else retryable = true; // for now // try exponential backoff on all errors, not just SE_DDC_NULL // if (retryable) // call_dynamic_tuned_sleep_i2c(SE_DDC_NULL, tryctr+1); } else { // DDC_IO_ADL // TODO more detailed tests if (psc == DDCRC_NULL_RESPONSE) retryable = false; else if (psc == DDCRC_READ_ALL_ZERO) retryable = true; else retryable = false; } if (psc == DDCRC_READ_ALL_ZERO) ddcrc_read_all_zero_ct++; } // rc < 0 } DBGTRC(debug, TRC_NEVER, "After try loop. tryctr=%d, psc=%d, retryable=%s", tryctr, psc, bool_repr(retryable)); if (debug) { for (int ndx = 0; ndx < tryctr; ndx++) { DBGMSG("try_errors[%d] = %p", ndx, try_errors[ndx]); } } // Using new Ddc_Error mechanism Error_Info * ddc_excp = NULL; if (psc < 0) { // int last_try_index = tryctr-1; DBGTRC(debug, TRACE_GROUP, "After try loop. tryctr=%d, retryable=%s", tryctr, bool_repr(retryable)); if (retryable) psc = DDCRC_RETRIES; else if (ddcrc_read_all_zero_ct == max_write_read_exchange_tries) psc = DDCRC_ALL_TRIES_ZERO; else if (ddcrc_null_response_ct > ddcrc_null_response_max) psc = DDCRC_ALL_RESPONSES_NULL; ddc_excp = errinfo_new_with_causes(psc, try_errors, tryctr, __func__); if (psc != try_errors[tryctr-1]->status_code) COUNT_STATUS_CODE(psc); // new status code, count it } else { for (int ndx = 0; ndx < tryctr-1; ndx++) { // errinfo_free(try_errors[ndx]); ERRINFO_FREE_WITH_REPORT(try_errors[ndx], debug || IS_TRACING() || report_freed_exceptions); } } try_data_record_tries(write_read_stats_rec, psc, tryctr); DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", errinfo_summary(ddc_excp)); return ddc_excp; } /* Writes a DDC request packet to an open I2C bus. * * Arguments: * fh Linux file handle for open I2C bus * request_packet_ptr DDC packet to write * * Returns: * 0 if success * -errno if error */ Public_Status_Code ddc_i2c_write_only( int fh, DDC_Packet * request_packet_ptr ) { bool debug = false; DBGTRC0(debug, TRACE_GROUP, "Starting."); if (debug) dbgrpt_packet(request_packet_ptr, 1); Status_Errno_DDC rc = invoke_i2c_writer(fh, get_packet_len(request_packet_ptr)-1, get_packet_start(request_packet_ptr)+1 ); if (rc < 0) log_status_code(rc, __func__); Sleep_Event_Type sleep_type = (request_packet_ptr->type == DDC_PACKET_TYPE_SAVE_CURRENT_SETTINGS ) ? SE_POST_SAVE_SETTINGS : SE_POST_WRITE; call_tuned_sleep_i2c(sleep_type); DBGTRC(debug, TRACE_GROUP, "Done. rc=%s\n", psc_desc(rc) ); return rc; } /* Writes a DDC request packet to a monitor * * \param dh Display_Handle for open I2C or ADL device * \param request_packet_ptr DDC packet to write * \return NULL if success, #Ddc_Error if error */ Error_Info * ddc_write_only( Display_Handle * dh, DDC_Packet * request_packet_ptr) { bool debug = false; DBGTRC0(debug, TRACE_GROUP, "Starting."); Public_Status_Code psc = 0; assert(dh->dref->io_path.io_mode != DDCA_IO_USB); if (dh->dref->io_path.io_mode == DDCA_IO_DEVI2C) { psc = ddc_i2c_write_only(dh->fh, request_packet_ptr); } else { psc = adlshim_ddc_write_only( dh, get_packet_start(request_packet_ptr), get_packet_len(request_packet_ptr) // get_packet_start(request_packet_ptr)+1, // get_packet_len(request_packet_ptr)-1 ); if (psc > 0) { DBGMSG("Unusual positive return code from ADL: %d", psc); psc = 0; } } Error_Info * ddc_excp = NULL; if (psc) ddc_excp = errinfo_new(psc, __func__); DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", errinfo_summary(ddc_excp)); return ddc_excp; } /* Wraps ddc_write_only() in retry logic. * * \param dh display handle (for either I2C or ADL device) * \param request_packet_ptr DDC packet to write * \return pointer to #Ddc_Error if failure, NULL if success * * The maximum number of tries allowed has been set in global variable * max_write_only_exchange_tries. */ Error_Info * ddc_write_only_with_retry( Display_Handle * dh, DDC_Packet * request_packet_ptr ) { bool debug = false; DBGTRC0(debug, TRACE_GROUP, "Starting." ); assert(dh->dref->io_path.io_mode != DDCA_IO_USB); Public_Status_Code psc; int tryctr; bool retryable; Error_Info * try_errors[MAX_MAX_TRIES]; assert(max_write_only_exchange_tries > 0); for (tryctr=0, psc=-999, retryable=true; tryctr < max_write_only_exchange_tries && psc < 0 && retryable; tryctr++) { DBGMSF(debug, "Start of try loop, tryctr=%d, max_write_only_exchange_tries=%d, rc=%d, retryable=%d", tryctr, max_write_only_exchange_tries, psc, retryable ); Error_Info * cur_excp = ddc_write_only(dh, request_packet_ptr); psc = (cur_excp) ? cur_excp->status_code : 0; try_errors[tryctr] = cur_excp; if (psc < 0) { COUNT_RETRYABLE_STATUS_CODE(psc); if (dh->dref->io_path.io_mode == DDCA_IO_DEVI2C) { if (psc < 0) { if (psc != -EIO) retryable = false; } } else { if (psc < 0) { // no logic in ADL case to test for continuing to retry, should there be ??? // is it even meaningful to retry for ADL? // retryable = true; // *** TEMP *** } } } // rc < 0 // try_status_codes[tryctr] = psc; // for future Ddc_Error mechanism } Error_Info * ddc_excp = NULL; if (psc < 0) { // now: // tryctr = number of tries // tryctr-1 = index of last try // tryctr == max_write_only_exchange_tries && retryable // tryctr < max_write_only_exchange_tries && !retryable // tryctr == max_write_only_exchange_tries && !retryable // int last_try_index = tryctr-1; DBGTRC(debug, TRACE_GROUP, "After try loop. tryctr=%d, retryable=%s", tryctr, bool_repr(retryable)); if (retryable) psc = DDCRC_RETRIES; ddc_excp = errinfo_new_with_causes(psc, try_errors, tryctr, __func__); if (psc != try_errors[tryctr-1]->status_code) COUNT_STATUS_CODE(psc); // new status code, count it } else { for (int ndx = 0; ndx < tryctr; ndx++) { // errinfo_free(try_errors[ndx]); ERRINFO_FREE_WITH_REPORT(try_errors[ndx], debug || IS_TRACING() || report_freed_exceptions); } } try_data_record_tries(write_only_stats_rec, psc, tryctr); DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", errinfo_summary(ddc_excp)); return ddc_excp; } ddcutil-0.8.6/src/ddc/ddc_read_capabilities.c0000644000175000001440000001207713224161553016026 00000000000000/* ddc_read_capabilities.c * * Functions to obtain the capabilities string for a display. * These functions are in a separate source file to simplify * the acyclic graph of #includes within the ddc source directory. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #include /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/data_structures.h" #include "util/report_util.h" #include "base/core.h" #include "base/ddc_errno.h" #ifdef USE_USB #include "usb/usb_displays.h" #endif #include "ddc/ddc_multi_part_io.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_read_capabilities.h" // Direct writes to stdout/stderr: none // // Capabilities Related Functions // /* Executes the VCP Get Capabilities command to obtain the * capabilities string. The string is returned in null terminated * form in a Buffer struct. It is the responsibility of the caller to * free this struct. * * Arguments: * dh pointer to display handle * ppCapabilitiesBuffer address at which to return pointer to allocated Buffer * retry_history if non-null, collects retryable errors * * Returns: * status code */ static Error_Info * get_capabilities_buffer( Display_Handle * dh, Buffer** ppCapabilitiesBuffer) { Public_Status_Code psc; Error_Info * ddc_excp = NULL; ddc_excp = multi_part_read_with_retry( dh, DDC_PACKET_TYPE_CAPABILITIES_REQUEST, 0x00, // no subtype for capabilities false, // !all_zero_response_ok ppCapabilitiesBuffer); Buffer * cap_buffer = *ppCapabilitiesBuffer; // psc = (ddc_excp) ? ddc_excp->psc: 0; psc = ERRINFO_STATUS(ddc_excp); assert(psc <= 0); if (psc == 0) { // trim trailing blanks and nulls int len = buffer_length(*ppCapabilitiesBuffer); while ( len > 0 ) { Byte ch = cap_buffer->bytes[len-1]; if (ch == ' ' || ch == '\0') len--; else break; } // since buffer contains a string, put a single null at end buffer_set_byte(cap_buffer, len, '\0'); buffer_set_length(cap_buffer, len+1); } return ddc_excp; } /* Gets the capabilities string for a display. * * The value is cached as this is an expensive operation. * * Arguments: * dh display handle * pcaps location where to return pointer to capabilities string. * retry_history if non-null, collects retryable errors * * Returns: * status code * * The returned pointer points to a string that is part of the * display handle. It should NOT be freed by the caller. */ Error_Info * get_capabilities_string( Display_Handle * dh, char** pcaps) { assert(dh); assert(dh->dref); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; if (!dh->dref->capabilities_string) { if (dh->dref->io_path.io_mode == DDCA_IO_USB) { #ifdef USE_USB // newly created string, can just reference dh->dref->capabilities_string = usb_get_capabilities_string_by_display_handle(dh); #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else { Buffer * pcaps_buffer; ddc_excp = get_capabilities_buffer(dh, &pcaps_buffer); // psc = (ddc_excp) ? ddc_excp->psc : 0; psc = ERRINFO_STATUS(ddc_excp); if (psc == 0) { dh->dref->capabilities_string = strdup((char *) pcaps_buffer->bytes); buffer_free(pcaps_buffer,__func__); } } } *pcaps = dh->dref->capabilities_string; return ddc_excp; } Error_Info * get_capabilities_string_by_dref(Display_Ref * dref, char **pcaps) { assert(dref); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; if (!dref->capabilities_string) { Display_Handle * dh = NULL; psc = ddc_open_display(dref, CALLOPT_NONE, &dh); if (psc == 0) { ddc_excp = get_capabilities_string(dh, &dref->capabilities_string); ddc_close_display(dh); } else ddc_excp = errinfo_new(psc, __func__); } *pcaps = dref->capabilities_string; return ddc_excp; } ddcutil-0.8.6/src/ddc/ddc_services.c0000664000175000001440000000776013226556051014235 00000000000000/* ddc_services.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * DDC initialization and configuration, statistics management */ /** \cond */ #include /** \endcond */ #include "util/report_util.h" #include "base/adl_errors.h" #include "base/base_init.h" #include "base/parms.h" #include "base/sleep.h" #include "vcp/vcp_feature_codes.h" #include "i2c/i2c_do_io.h" #include "adl/adl_shim.h" #include "ddc/ddc_multi_part_io.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_services.h" // // Statistics // /** Resets all DDC level statistics */ void ddc_reset_ddc_stats() { ddc_reset_write_only_stats(); ddc_reset_write_read_stats(); ddc_reset_multi_part_read_stats(); ddc_reset_multi_part_write_stats(); } /** Reports all DDC level statistics * \param depth logical indentation depth */ void ddc_report_ddc_stats(int depth) { rpt_nl(); // retry related stats ddc_report_max_tries(0); ddc_report_write_only_stats(0); ddc_report_write_read_stats(0); ddc_report_multi_part_read_stats(0); ddc_report_multi_part_write_stats(0); } /** Resets all statistics */ void ddc_reset_stats_main() { ddc_reset_ddc_stats(); reset_execution_stats(); } /** Master function for reporting statistics. * * \param stats bitflags indicating which statistics to report * \param depth logical indentation depth */ void ddc_report_stats_main(DDCA_Stats_Type stats, int depth) { if (stats & DDCA_STATS_TRIES) { ddc_report_ddc_stats(depth); } if (stats & DDCA_STATS_ERRORS) { rpt_nl(); ; show_all_status_counts(); // error code counts } if (stats & DDCA_STATS_CALLS) { rpt_nl(); report_sleep_strategy_stats(depth); rpt_nl(); report_io_call_stats(depth); rpt_nl(); report_sleep_stats(depth); } if (stats & (DDCA_STATS_ELAPSED | DDCA_STATS_CALLS)) { rpt_nl(); report_elapsed_stats(depth); } } /** Reports the current max try settings. * * \param depth logical indentation depth */ void ddc_report_max_tries(int depth) { rpt_vstring(depth, "Maximum Try Settings:"); rpt_vstring(depth, "Operation Type Current Default"); rpt_vstring(depth, "Write only exchange tries: %8d %8d", ddc_get_max_write_only_exchange_tries(), MAX_WRITE_ONLY_EXCHANGE_TRIES); rpt_vstring(depth, "Write read exchange tries: %8d %8d", ddc_get_max_write_read_exchange_tries(), MAX_WRITE_READ_EXCHANGE_TRIES); rpt_vstring(depth, "Multi-part read exchange tries: %8d %8d", ddc_get_max_multi_part_read_tries(), MAX_MULTI_EXCHANGE_TRIES); rpt_vstring(depth, "Multi-part write exchange tries: %8d %8d", ddc_get_max_multi_part_write_tries(), MAX_MULTI_EXCHANGE_TRIES); } /** Master initialization function for DDC services */ void init_ddc_services() { bool debug = false; DBGMSF0(debug, "Executing"); // i2c: i2c_set_io_strategy(DEFAULT_I2C_IO_STRATEGY); // adl: init_adl_errors(); adl_debug = debug; // turn on adl initialization tracing adlshim_initialize(); // ddc: ddc_reset_ddc_stats(); init_vcp_feature_codes(); } ddcutil-0.8.6/src/ddc/ddc_strategy.c0000644000175000001440000000336213224161572014242 00000000000000/* ddc_strategy.h * * * Copyright (C) 2015-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ /** \cond */ #include /** \endcond */ #include "ddc/ddc_strategy.h" // keep in sync w DDC_IO_Mode DDC_Strategy ddc_strategies[] = { {DDCA_IO_DEVI2C, NULL, NULL }, {DDCA_IO_ADL, NULL, NULL }, {DDCA_IO_USB, NULL, NULL } }; void validate_ddc_strategies() { assert( ddc_strategies[DDCA_IO_DEVI2C].io_mode == DDCA_IO_DEVI2C); assert( ddc_strategies[DDCA_IO_ADL].io_mode == DDCA_IO_ADL); assert( ddc_strategies[DDCA_IO_USB].io_mode == DDCA_IO_USB); } DDC_Raw_Writer ddc_raw_writer(Display_Handle * dh) { assert(dh && dh->dref); return ddc_strategies[dh->dref->io_path.io_mode].writer; } DDC_Raw_Reader ddc_raw_reader(Display_Handle * dh) { assert(dh && dh->dref); return ddc_strategies[dh->dref->io_path.io_mode].reader; } void init_ddc_strategies() { validate_ddc_strategies(); } ddcutil-0.8.6/src/ddc/ddc_vcp.c0000644000175000001440000005066713226556113013203 00000000000000/* ddc_vcp.c * * Virtual Control Panel access * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Virtual Control Panel access */ #include /** \cond */ #include #include #include #include #include #include #include #include "util/error_info.h" #include "util/report_util.h" #include "util/utilrpt.h" /** \endcond */ #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/displays.h" #include "base/status_code_mgt.h" #include "i2c/i2c_bus_core.h" #include "adl/adl_shim.h" #ifdef USE_USB #include "usb/usb_displays.h" #include "usb/usb_vcp.h" #endif #include "vcp/vcp_feature_codes.h" #include "ddc/ddc_multi_part_io.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp_version.h" #include "ddc/ddc_vcp.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_DDC; // // Save Control Settings // /** Executes the DDC Save Control Settings command. * * \param dh handle of open display device * \return NULL if success, pointer to #Ddc_Error if failure */ Error_Info * save_current_settings( Display_Handle * dh) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Invoking DDC Save Current Settings command. dh=%s", dh_repr_t(dh)); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; if (dh->dref->io_path.io_mode == DDCA_IO_USB) { // command line parser should block this case PROGRAM_LOGIC_ERROR("MCCS over USB does not have Save Current Settings command", NULL); ddc_excp = errinfo_new(DDCL_UNIMPLEMENTED, __func__); } else { DDC_Packet * request_packet_ptr = create_ddc_save_settings_request_packet("save_current_settings:request packet"); // DBGMSG("create_ddc_save_settings_request_packet returned packet_ptr=%p", request_packet_ptr); // dump_packet(request_packet_ptr); ddc_excp = ddc_write_only_with_retry(dh, request_packet_ptr); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (request_packet_ptr) free_ddc_packet(request_packet_ptr); } DBGTRC(debug, TRACE_GROUP, "Returning %s", psc_desc(psc)); if ( (debug||IS_TRACING()) && ddc_excp) errinfo_report(ddc_excp, 0); return ddc_excp; } // // Set VCP feature value // /** Sets a non-table VCP feature value. * * \param dh display handle for open display * \param feature_code VCP feature code * \param new_value new value * \return NULL if success, * pointer to #Ddc_Error from #ddc_write_only_with_retry() if failure */ Error_Info * set_nontable_vcp_value( Display_Handle * dh, Byte feature_code, int new_value) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Writing feature 0x%02x , new value = %d, dh=%s", feature_code, new_value, dh_repr_t(dh) ); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; if (dh->dref->io_path.io_mode == DDCA_IO_USB) { #ifdef USE_USB psc = usb_set_nontable_vcp_value(dh, feature_code, new_value); #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else { DDC_Packet * request_packet_ptr = create_ddc_setvcp_request_packet(feature_code, new_value, "set_vcp:request packet"); // DBGMSG("create_ddc_getvcp_request_packet returned packet_ptr=%p", request_packet_ptr); // dump_packet(request_packet_ptr); ddc_excp = ddc_write_only_with_retry(dh, request_packet_ptr); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (request_packet_ptr) free_ddc_packet(request_packet_ptr); } DBGTRC(debug, TRACE_GROUP, "Returning %s", psc_desc(psc)); if ( psc==DDCRC_RETRIES && (debug || IS_TRACING()) ) DBGMSG(" Try errors: %s", errinfo_causes_string(ddc_excp)); return ddc_excp; } /** Sets a table VCP feature value. * * \param dh display handle for open display * \param feature_code VCP feature code * \param bytes pointer to table bytes * \param bytect number of bytes * \return NULL if success * DDCL_UNIMPLEMENTED if io mode is USB * #Ddc_Error from #multi_part_write_with_retry() otherwise */ Error_Info * set_table_vcp_value( Display_Handle * dh, Byte feature_code, Byte * bytes, int bytect) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Writing feature 0x%02x , bytect = %d", feature_code, bytect); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; if (dh->dref->io_path.io_mode == DDCA_IO_USB) { #ifdef USE_USB psc = DDCL_UNIMPLEMENTED; #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else { // TODO: clean up function signatures // pointless wrapping in a Buffer just to unwrap Buffer * new_value = buffer_new_with_value(bytes, bytect, __func__); ddc_excp = multi_part_write_with_retry(dh, feature_code, new_value); psc = (ddc_excp) ? ddc_excp->status_code : 0; buffer_free(new_value, __func__); } DBGTRC(debug, TRACE_GROUP, "Returning: %s", psc_desc(psc)); if ( (debug || IS_TRACING()) && psc == DDCRC_RETRIES ) DBGMSG(" Try errors: %s", errinfo_causes_string(ddc_excp)); return ddc_excp; } static bool verify_setvcp = false; /** Sets the setvcp verification setting. * * If enabled, setvcp will read the feature value from the monitor after * writing it, to ensure the monitor has actually changed the feature value. * * \param onoff **true** for enabled, **false** for disabled. */ void set_verify_setvcp(bool onoff) { bool debug = false; DBGMSF(debug, "Setting verify_setvcp = %s", bool_repr(onoff)); verify_setvcp = onoff; } /** Gets the current setvcp verification setting. * * \return **true** if setvcp verification enabled\n * **false** if not */ bool get_verify_setvcp() { return verify_setvcp; } static bool is_rereadable_feature( Display_Handle * dh, DDCA_Vcp_Feature_Code opcode) { bool debug = false; DBGMSF(debug, "Starting opcode = 0x%02x", opcode); bool result = false; // readable features that should not be read after write DDCA_Vcp_Feature_Code unrereadable_features[] = { 0x02, // new control value 0x03, // soft controls 0x60, // input source ??? }; VCP_Feature_Table_Entry * vfte = vcp_find_feature_by_hexid(opcode); DBGMSF(debug, "vfte=%p", vfte); if (vfte) { assert(opcode < 0xe0); DDCA_MCCS_Version_Spec vspec = get_vcp_version_by_display_handle(dh); // ensure dh->vcp_version set DBGMSF(debug, "vspec = %d.%d", vspec.major, vspec.minor); // hack, make a guess if ( vcp_version_eq(vspec, VCP_SPEC_UNKNOWN) || vcp_version_eq(vspec, VCP_SPEC_UNQUERIED )) vspec = VCP_SPEC_V22; // if ( !vcp_version_eq(vspec, VCP_SPEC_UNKNOWN) && // !vcp_version_eq(vspec, VCP_SPEC_UNQUERIED )) // { result = is_feature_readable_by_vcp_version(vfte, vspec); DBGMSF(debug, "vspec=%d.%d, readable feature = %s", vspec.major, vspec.minor, bool_repr(result)); // } } if (result) { for (int ndx = 0; ndx < ARRAY_SIZE(unrereadable_features); ndx++) { if ( unrereadable_features[ndx] == opcode ) { result = false; DBGMSF(debug, "Unreadable opcode 0x%02x", opcode); break; } } } DBGMSF(debug, "Returning: %s", bool_repr(result)); return result; } static bool single_vcp_value_equal( DDCA_Single_Vcp_Value * vrec1, DDCA_Single_Vcp_Value * vrec2) { assert(vrec1 && vrec2); // no implementation for degenerate cases bool debug = false; bool result = false; if (vrec1->opcode == vrec2->opcode && vrec1->value_type == vrec2->value_type) { switch(vrec1->value_type) { case(DDCA_NON_TABLE_VCP_VALUE): // only check SL byte which would be set for any VCP, monitor result = (vrec1->val.nc.sl == vrec2->val.nc.sl); break; case(DDCA_TABLE_VCP_VALUE): result = (vrec1->val.t.bytect == vrec2->val.t.bytect) && (memcmp(vrec1->val.t.bytes, vrec2->val.t.bytes, vrec1->val.t.bytect) == 0 ); } } DBGMSF(debug, "Returning: %s", bool_repr(result)); return result; } // TODO: Consider wrapping set_vcp_value() in set_vcp_value_with_retry(), which would // retry in case verification fails /** Sets a VCP feature value. * * \param dh display handle for open display * \param vrec pointer to value record * \return NULL if success, pointer to #Ddc_Error if failure * * If write verification is turned on, reads the feature value after writing it * to ensure the display has actually changed the value. */ Error_Info * set_vcp_value( Display_Handle * dh, DDCA_Single_Vcp_Value * vrec) { bool debug = false; DBGMSF0(debug, "Starting. "); FILE * fout = FOUT; if ( get_output_level() < DDCA_OL_VERBOSE ) fout = NULL; Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; if (vrec->value_type == DDCA_NON_TABLE_VCP_VALUE) { ddc_excp = set_nontable_vcp_value(dh, vrec->opcode, vrec->val.c.cur_val); psc = (ddc_excp) ? ddc_excp->status_code : 0; } else { assert(vrec->value_type == DDCA_TABLE_VCP_VALUE); ddc_excp = set_table_vcp_value(dh, vrec->opcode, vrec->val.t.bytes, vrec->val.t.bytect); psc = (ddc_excp) ? ddc_excp->status_code : 0; } if (!ddc_excp && verify_setvcp) { if (is_rereadable_feature(dh, vrec->opcode) ) { f0printf(fout, "Verifying that value of feature 0x%02x successfully set...\n", vrec->opcode); DDCA_Single_Vcp_Value * newval = NULL; ddc_excp = get_vcp_value( dh, vrec->opcode, vrec->value_type, &newval); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (ddc_excp) { f0printf(fout, "(%s) Read after write failed. get_vcp_value() returned: %s\n", __func__, psc_desc(psc)); if (psc == DDCRC_RETRIES) f0printf(fout, "(%s) Try errors: %s\n", __func__, errinfo_causes_string(ddc_excp)); // psc = DDCRC_VERIFY; } else { assert(vrec && newval); // silence clang complaint if (! single_vcp_value_equal(vrec,newval)) { psc = DDCRC_VERIFY; ddc_excp = errinfo_new(DDCRC_VERIFY, __func__); f0printf(fout, "Current value does not match value set.\n"); } else { f0printf(fout, "Verification succeeded\n"); } } } else { f0printf(fout, "Feature 0x%02x does not support verification\n", vrec->opcode); // rpt_vstring(0, "Feature 0x%02x does not support verification", vrec->opcode); } } DBGMSF(debug, "Returning: %s", psc_desc(psc)); return ddc_excp; } // // Get VCP values // /** Gets the value for a non-table feature. * * \param dh handle for open display * \param feature_code VCP feature code * \param ppInterpretedCode where to return parsed respons * \return NULL if success, pointer to #Ddc_Error if failure * * It is the responsibility of the caller to free the parsed response. * * The value pointed to by ppInterpretedCode is non-null iff the returned status code is 0. */ Error_Info * get_nontable_vcp_value( Display_Handle * dh, DDCA_Vcp_Feature_Code feature_code, Parsed_Nontable_Vcp_Response** ppInterpretedCode) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Reading feature 0x%02x", feature_code); Public_Status_Code psc = 0; Error_Info * excp = NULL; Parsed_Nontable_Vcp_Response * parsed_response = NULL; DDC_Packet * request_packet_ptr = NULL; DDC_Packet * response_packet_ptr = NULL; request_packet_ptr = create_ddc_getvcp_request_packet( feature_code, "get_vcp_by_DisplayRef:request packet"); // dump_packet(request_packet_ptr); Byte expected_response_type = DDC_PACKET_TYPE_QUERY_VCP_RESPONSE; Byte expected_subtype = feature_code; int max_read_bytes = 20; // actually 3 + 8 + 1, or is it 2 + 8 + 1? // retry: // psc = ddc_write_read_with_retry( excp = ddc_write_read_with_retry( dh, request_packet_ptr, max_read_bytes, expected_response_type, expected_subtype, false, // all_zero_response_ok &response_packet_ptr ); if (debug || IS_TRACING() ) { if (psc != 0) DBGMSG("perform_ddc_write_read_with_retry() returned %s, reponse_packet_ptr=%p", psc_desc(psc), response_packet_ptr); } // psc = (excp) ? excp->psc : 0; if (!excp) { assert(response_packet_ptr); // dump_packet(response_packet_ptr); psc = get_interpreted_vcp_code(response_packet_ptr, true /* make_copy */, &parsed_response); // ??? if (psc == 0) { #ifdef NO_LONGER_NEEDED if (parsed_response->vcp_code != feature_code) { DBGMSG("!!! WTF! requested feature_code = 0x%02x, but code in response is 0x%02x", feature_code, parsed_response->vcp_code); call_tuned_sleep_i2c(SE_POST_READ); goto retry; } #endif if (!parsed_response->valid_response) { psc = DDCRC_INVALID_DATA; excp = errinfo_new(psc, __func__); } else if (!parsed_response->supported_opcode) { psc = DDCRC_REPORTED_UNSUPPORTED; excp = errinfo_new(psc, __func__); } if (psc != 0) { free(parsed_response); parsed_response = NULL; } } else { excp = errinfo_new(psc, __func__); } } if (request_packet_ptr) free_ddc_packet(request_packet_ptr); if (response_packet_ptr) free_ddc_packet(response_packet_ptr); if (debug || IS_TRACING() ) { if (excp) { DBGMSG("Error reading feature x%02x. Returning exception: ", feature_code); errinfo_report(excp, 1); } else { DBGMSG("Success reading feature x%02x. *ppinterpreted_code=%p", feature_code, parsed_response); } } *ppInterpretedCode = parsed_response; assert( (!excp && parsed_response) || (excp && !parsed_response)); return excp; } /** Gets the value of a table feature in a newly allocated Buffer struct. * It is the responsibility of the caller to free the Buffer. * * \param dh display handle * \param feature_code VCP feature code * \param pp_table_bytes location at which to save address of newly allocated Buffer * \return NULL if success, pointer to #Ddc_Error if failure */ Error_Info * get_table_vcp_value( Display_Handle * dh, Byte feature_code, Buffer** pp_table_bytes) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. Reading feature 0x%02x", feature_code); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; DDCA_Output_Level output_level = get_output_level(); Buffer * paccumulator = NULL; ddc_excp = multi_part_read_with_retry( dh, DDC_PACKET_TYPE_TABLE_READ_REQUEST, feature_code, true, // all_zero_response_ok &paccumulator); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (debug || psc != 0) { DBGTRC(debug, TRACE_GROUP, "perform_ddc_write_read_with_retry() returned %s", psc_desc(psc)); } if (psc == 0) { *pp_table_bytes = paccumulator; if (output_level >= DDCA_OL_VERBOSE) { DBGMSG0("Bytes returned on table read:"); dbgrpt_buffer(paccumulator, 1); } } DBGTRC(debug, TRACE_GROUP, "Done. rc=%s, *pp_table_bytes=%p", psc_desc(psc), *pp_table_bytes); DBGTRC(debug, TRACE_GROUP, "Returning: %s", errinfo_summary(ddc_excp)); return ddc_excp; } /** Gets the value of a VCP feature. * * \param dh handle for open display * \param feature_code feature code id * \param call_type indicates whether table or non-table * \param pvalrec location where to return newly allocated #DDCA_Single_Vcp_Value * \return NULL if success, pointer to #Ddc_Error if failure * * The value pointed to by pvalrec is non-null iff the returned status code is 0. * * The caller is responsible for freeing the value pointed returned at pvalrec. */ Error_Info * get_vcp_value( Display_Handle * dh, Byte feature_code, DDCA_Vcp_Value_Type call_type, DDCA_Single_Vcp_Value ** pvalrec) { bool debug = false; DBGTRC(debug, TRACE_GROUP, "Starting. Reading feature 0x%02x, dh=%s, dh->fh=%d", feature_code, dh_repr_t(dh), dh->fh); Public_Status_Code psc = 0; Error_Info * ddc_excp = NULL; Buffer * buffer = NULL; Parsed_Nontable_Vcp_Response * parsed_nontable_response = NULL; // vs interpreted .. DDCA_Single_Vcp_Value * valrec = NULL; // why are we coming here for USB? if (dh->dref->io_path.io_mode == DDCA_IO_USB) { #ifdef USE_USB DBGMSF0(debug, "USB case"); switch (call_type) { case (DDCA_NON_TABLE_VCP_VALUE): psc = usb_get_nontable_vcp_value( dh, feature_code, &parsed_nontable_response); // if (psc == 0) { valrec = create_nontable_vcp_value( feature_code, parsed_nontable_response->mh, parsed_nontable_response->ml, parsed_nontable_response->sh, parsed_nontable_response->sl); free(parsed_nontable_response); } break; case (DDCA_TABLE_VCP_VALUE): psc = DDCL_UNIMPLEMENTED; ddc_excp = errinfo_new(DDCL_UNIMPLEMENTED, __func__); break; } #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else { switch (call_type) { case (DDCA_NON_TABLE_VCP_VALUE): ddc_excp = get_nontable_vcp_value( dh, feature_code, &parsed_nontable_response); psc = (ddc_excp) ? ddc_excp->status_code : 0; if (!ddc_excp) { valrec = create_nontable_vcp_value( feature_code, parsed_nontable_response->mh, parsed_nontable_response->ml, parsed_nontable_response->sh, parsed_nontable_response->sl); free(parsed_nontable_response); } break; case (DDCA_TABLE_VCP_VALUE): ddc_excp = get_table_vcp_value( dh, feature_code, &buffer); psc = ERRINFO_STATUS(ddc_excp); if (!ddc_excp) { valrec = create_table_vcp_value_by_buffer(feature_code, buffer); buffer_free(buffer, __func__); } break; } } // non USB *pvalrec = valrec; DBGTRC(debug, TRACE_GROUP, "Done. psc=%s", psc_desc(psc) ); if (psc == 0 && debug) report_single_vcp_value(valrec,1); assert( (psc == 0 && *pvalrec) || (psc != 0 && !*pvalrec) ); DBGTRC(debug, TRACE_GROUP, "Done. Returning: %s", errinfo_summary(ddc_excp)); return ddc_excp; } ddcutil-0.8.6/src/ddc/ddc_vcp_version.c0000644000175000001440000001440413226556077014746 00000000000000/* ddc_vcp_version.c * * Functions to obtain the VCP (MCCS) version for a display. * These functions are in a separate source file to simplify * the acyclic graph of #includes within the ddc source directory. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include /** \cond */ #include #include #include "util/error_info.h" /** \endcond */ #include "base/core.h" #include "base/ddc_errno.h" #include "base/displays.h" #include "base/status_code_mgt.h" #ifdef USE_USB #include "usb/usb_vcp.h" #endif #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp.h" #include "ddc/ddc_vcp_version.h" // // Functions for VCP (MCCS) version // /* Gets the VCP version. * * Because the VCP version is used repeatedly for interpreting other * VCP feature values, it is cached. * * Arguments: * dh display handle * * Returns: * Version_Spec struct containing version, contains 0.0 if version * could not be retrieved (pre MCCS v2) */ DDCA_MCCS_Version_Spec get_vcp_version_by_display_handle(Display_Handle * dh) { bool debug = false; // TMI DBGMSF(debug, "Starting. dh=%s, dh->dref->vcp_version = %d.%d, %s", dh_repr(dh), dh->dref->vcp_version.major, dh->dref->vcp_version.minor, format_vspec(dh->dref->vcp_version)); if (vcp_version_is_unqueried(dh->dref->vcp_version)) { if (debug) { DBGMSG0("Starting. vcp_version not set"); dbgrpt_display_handle(dh, /*msg=*/ NULL, 1); } dh->dref->vcp_version = VCP_SPEC_UNKNOWN; if (dh->dref->io_path.io_mode == DDCA_IO_USB) { #ifdef USE_USB // DBGMSG("Trying to get VESA version..."); __s32 vesa_ver = usb_get_vesa_version(dh->fh); DBGMSF(debug, "VESA version from usb_get_vesa_version(): 0x%08x", vesa_ver); if (vesa_ver) { DBGMSF(debug, "VESA version from usb_get_vesa_version(): 0x%08x", vesa_ver); dh->dref->vcp_version.major = (vesa_ver >> 8) & 0xff; dh->dref->vcp_version.minor = vesa_ver & 0xff; } else { DBGMSF0(debug, "Error detecting VESA version using usb_get_vesa_version()"); } #else PROGRAM_LOGIC_ERROR("ddcutil not built with USB support"); #endif } else { // normal case, not USB DDCA_Single_Vcp_Value * pvalrec; // verbose output is distracting since this function is called when // querying for other things DDCA_Output_Level olev = get_output_level(); if (olev == DDCA_OL_VERBOSE) set_output_level(DDCA_OL_NORMAL); Public_Status_Code psc = 0; Error_Info * ddc_excp = get_vcp_value(dh, 0xdf, DDCA_NON_TABLE_VCP_VALUE, &pvalrec); // psc = (ddc_excp) ? ddc_excp->psc : 0; psc = ERRINFO_STATUS(ddc_excp); DBGMSF(debug, "get_vcp_value() returned %s", psc_desc(psc)); if (debug && psc == DDCRC_RETRIES) DBGMSG(" Try errors: %s", errinfo_causes_string(ddc_excp)); if (olev == DDCA_OL_VERBOSE) set_output_level(olev); if (psc == 0) { dh->dref->vcp_version.major = pvalrec->val.nc.sh; dh->dref->vcp_version.minor = pvalrec->val.nc.sl; DBGMSF(debug, "Set dh->dref->vcp_version to %d.%d, %s", dh->dref->vcp_version.major, dh->dref->vcp_version.minor, format_vspec(dh->dref->vcp_version) ); } else { // happens for pre MCCS v2 monitors DBGMSF(debug, "Error detecting VCP version using VCP feature 0xdf. psc=%s", psc_desc(psc) ); } } DBGMSF(debug, "Non-cache lookup returning: %d.%d", dh->dref->vcp_version.major, dh->dref->vcp_version.minor); } // DBGMSF(debug, "Returning: %d.%d", dh->dref->vcp_version.major, dh->dref->vcp_version.minor); assert( !vcp_version_eq(dh->dref->vcp_version, VCP_SPEC_UNQUERIED) ); // if (debug) { // DBGMSG("Done."); // report_display_handle(dh, /*msg=*/ NULL, 1); // } DBGMSF(debug, "Returning dh->dref->vcp_version = %d.%d, %s", dh->dref->vcp_version.major, dh->dref->vcp_version.minor, format_vspec(dh->dref->vcp_version)); return dh->dref->vcp_version; } /* Gets the VCP version. * * Because the VCP version is used repeatedly for interpreting other * VCP feature values, it is cached. * * Arguments: * dref display reference * * Returns: * Version_Spec struct containing version, contains 0.0 if version * could not be retrieved (pre MCCS v2) */ DDCA_MCCS_Version_Spec get_vcp_version_by_display_ref(Display_Ref * dref) { bool debug = false; DBGMSF(debug, "Starting. dref=%p, dref->vcp_version = %d.%d", dref, dref->vcp_version.major, dref->vcp_version.minor); // ddc_open_display() should not fail assert(dref->flags & DREF_DDC_COMMUNICATION_WORKING); if (vcp_version_is_unqueried(dref->vcp_version)) { Display_Handle * dh = NULL; // no need to check return code since aborting if error // shouuld never fail, since open already succeeded Public_Status_Code psc = ddc_open_display(dref, CALLOPT_ERR_MSG, &dh); assert(psc == 0); dref->vcp_version = get_vcp_version_by_display_handle(dh); ddc_close_display(dh); } assert( !vcp_version_eq(dref->vcp_version, VCP_SPEC_UNQUERIED) ); DBGMSF(debug, "Returning: %d.%d", dref->vcp_version.major, dref->vcp_version.minor); return dref->vcp_version; } ddcutil-0.8.6/src/ddc/ddc_try_stats.c0000644000175000001440000001521613226556064014443 00000000000000/* ddc_try_stats.c * * Maintains statistics on DDC retries. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \cond */ #include #include #include #include #include /** \endcond */ #include "util/report_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/parms.h" #include "ddc/ddc_try_stats.h" #define MAX_STAT_NAME_LENGTH 31 static char * TAG_VALUE = "STAT"; static GMutex try_data_mutex; static bool debug_mutex = false; typedef struct { char tag[4]; char stat_name[MAX_STAT_NAME_LENGTH+1]; int max_tries; int counters[MAX_MAX_TRIES+2]; } Try_Data; // counters usage: // 0 number of failures because of fatal errors // 1 number of failures because retry exceeded // n>1 number of successes after n-1 tries, // e.g. if succeed after 1 try, recorded in counter 2 /* Allocates and initializes a Try_Data data structure * * Arguments: * stat_name name of the statistic being recorded * max_tries maximum number of tries * * Returns: * opaque pointer to the allocated data structure */ void * try_data_create(char * stat_name, int max_tries) { assert(strlen(stat_name) <= MAX_STAT_NAME_LENGTH); assert(0 <= max_tries && max_tries <= MAX_MAX_TRIES); Try_Data* try_data = calloc(1,sizeof(Try_Data)); memcpy(try_data->tag, TAG_VALUE,4); strcpy(try_data->stat_name, stat_name); try_data->max_tries = max_tries; // DBGMSG("try_data->counters[MAX_MAX_TRIES+1]=%d, MAX_MAX_TRIES=%d", try_data->counters[MAX_MAX_TRIES+1], MAX_MAX_TRIES); return try_data; } static inline Try_Data * unopaque(void * opaque_ptr) { Try_Data * try_data = (Try_Data*) opaque_ptr; assert(try_data && memcmp(try_data->tag, TAG_VALUE, 4) == 0); return try_data; } int try_data_get_max_tries(void * stats_rec) { Try_Data * try_data = unopaque(stats_rec); return try_data->max_tries; } void try_data_set_max_tries(void * stats_rec, int new_max_tries) { bool debug = false || debug_mutex; DBGMSF0(debug, "Starting"); Try_Data * try_data = unopaque(stats_rec); assert(new_max_tries >= 1 && new_max_tries <= MAX_MAX_TRIES); g_mutex_lock(&try_data_mutex); try_data->max_tries = new_max_tries; g_mutex_unlock(&try_data_mutex); DBGMSF0(debug, "Done"); } void try_data_reset(void * stats_rec) { bool debug = false || debug_mutex; DBGMSF0(debug, "Starting"); Try_Data * try_data = unopaque(stats_rec); g_mutex_lock(&try_data_mutex); for (int ndx=0; ndx < MAX_MAX_TRIES+1; ndx++) try_data->counters[ndx] = 0; g_mutex_unlock(&try_data_mutex); DBGMSF0(debug, "Done"); } static void record_successful_tries(void * stats_rec, int tryct){ bool debug = false || debug_mutex; DBGMSF0(debug, "Starting"); Try_Data * try_data = unopaque(stats_rec); assert(0 < tryct && tryct <= try_data->max_tries); g_mutex_lock(&try_data_mutex); try_data->counters[tryct+1] += 1; g_mutex_unlock(&try_data_mutex); DBGMSF0(debug, "Done"); } static void record_failed_max_tries(void * stats_rec) { bool debug = false || debug_mutex; DBGMSF0(debug, "Starting"); Try_Data * try_data = unopaque(stats_rec); g_mutex_lock(&try_data_mutex); try_data->counters[1] += 1; g_mutex_unlock(&try_data_mutex); DBGMSF0(debug, "Done"); } static void record_failed_fatally(void * stats_rec) { bool debug = false || debug_mutex; DBGMSF0(debug, "Starting"); Try_Data * try_data = unopaque(stats_rec); g_mutex_lock(&try_data_mutex); try_data->counters[0] += 1; g_mutex_unlock(&try_data_mutex); DBGMSF0(debug, "Done"); } void try_data_record_tries(void * stats_rec, int rc, int tryct) { // DBGMSG("stats_rec=%p, rc=%d, tryct=%d", stats_rec, rc, tryct); Try_Data * try_data = unopaque(stats_rec); // TODO: eliminate function calls if (rc == 0) { record_successful_tries(try_data, tryct); } // else if (tryct == try_data->max_tries) { // fragile, but eliminates testing for max_tries: else if (rc == DDCRC_RETRIES || rc == DDCRC_ALL_TRIES_ZERO) { record_failed_max_tries(try_data); } else { record_failed_fatally(try_data); } } // used to test whether there's anything to report int try_data_get_total_attempts(void * stats_rec) { Try_Data * try_data = unopaque(stats_rec); int total_attempts = 0; int ndx; for (ndx=0; ndx <= try_data->max_tries+1; ndx++) { total_attempts += try_data->counters[ndx]; } return total_attempts; } /** Reports a statistics record. * * Output is written to the current FOUT destination. * * \param stats_rec opaque reference to stats record * \param depth logical indentation depth * * \remark * Why does this data structure need to be opaque? (4/2017) */ void try_data_report(void * stats_rec, int depth) { int d1 = depth+1; Try_Data * try_data = unopaque(stats_rec); rpt_nl(); rpt_vstring(depth, "Retry statistics for %s", try_data->stat_name); if (try_data_get_total_attempts(stats_rec) == 0) { rpt_vstring(d1, "No tries attempted"); } else { int total_successful_attempts = 0; rpt_vstring(d1, "Max tries allowed: %d", try_data->max_tries); rpt_vstring(d1, "Successful attempts by number of tries required:"); int ndx; for (ndx=2; ndx <= try_data->max_tries+1; ndx++) { total_successful_attempts += try_data->counters[ndx]; // DBGMSG("ndx=%d", ndx); rpt_vstring(d1, " %2d: %3d", ndx-1, try_data->counters[ndx]); } rpt_vstring(d1, "Total: %3d", total_successful_attempts); rpt_vstring(d1, "Failed due to max tries exceeded: %3d", try_data->counters[1]); rpt_vstring(d1, "Failed due to fatal error: %3d", try_data->counters[0]); rpt_vstring(d1, "Total attempts: %3d", try_data_get_total_attempts(stats_rec)); } } ddcutil-0.8.6/src/ddc/ddc_vcp_version.h0000644000175000001440000000230513230445447014741 00000000000000/* ddc_vcp_version.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_VCP_VERSION_H_ #define DDC_VCP_VERSION_H_ #include "base/displays.h" #include "base/vcp_version.h" DDCA_MCCS_Version_Spec get_vcp_version_by_display_handle(Display_Handle * dh); DDCA_MCCS_Version_Spec get_vcp_version_by_display_ref( Display_Ref * dref); #endif /* DDC_VCP_VERSION_H_ */ ddcutil-0.8.6/src/ddc/ddc_edid.h0000644000175000001440000000223313230445447013311 00000000000000/* ddc_edid.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #ifndef DDC_EDID_H_ #define DDC_EDID_H_ #include "base/displays.h" #ifdef UNUSED Parsed_Edid* ddc_get_parsed_edid_by_display_handle(Display_Handle * dh); Parsed_Edid* ddc_get_parsed_edid_by_display_ref(Display_Ref * dref); #endif #endif /* DDC_EDID_H_ */ ddcutil-0.8.6/src/ddc/ddc_output.h0000644000175000001440000000532113230445447013745 00000000000000/* ddc_output.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_OUTPUT_H_ #define DDC_OUTPUT_H_ #include #include #include #include "base/core.h" #include "base/displays.h" #include "base/status_code_mgt.h" #include "vcp/vcp_feature_codes.h" #include "vcp/vcp_feature_set.h" #include "vcp/vcp_feature_values.h" // TODO: Should probably be in a more general location // Standard printf format strings for reporting feature codes values. extern const char* FMT_CODE_NAME_DETAIL_W_NL; extern const char* FMT_CODE_NAME_DETAIL_WO_NL; #ifdef FUTURE // not currently used Public_Status_Code check_valid_operation_by_feature_rec_and_version( VCP_Feature_Table_Entry * feature_rec, Version_Spec vcp_version, Version_Feature_Flags operation_flags); // not currently used Public_Status_Code check_valid_operation_by_feature_id_and_dh( Byte feature_id, Display_Handle * dh, Version_Feature_Flags operation_flags); #endif Public_Status_Code collect_raw_subset_values( Display_Handle * dh, VCP_Feature_Subset subset, Vcp_Value_Set vset, bool ignore_unsupported, FILE * msg_fh); Public_Status_Code get_formatted_value_for_feature_table_entry( Display_Handle * dh, VCP_Feature_Table_Entry * vcp_entry, bool suppress_unsupported, bool prefix_value_with_feature_code, char ** pformatted_value, FILE * msg_fh); Public_Status_Code show_vcp_values( Display_Handle * dh, VCP_Feature_Subset subset, GPtrArray * collector, // bool force_show_unsupported, // deprecated Feature_Set_Flags flags, Byte_Bit_Flags features_seen); #endif /* DDC_OUTPUT_H_ */ ddcutil-0.8.6/src/ddc/ddc_services.h0000644000175000001440000000231113230445447014224 00000000000000/* ddc_services.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_SERVICES_H_ #define DDC_SERVICES_H_ #include void init_ddc_services(); void ddc_reset_ddc_stats(); void ddc_reset_stats_main(); void ddc_reset_stats_main(); void ddc_report_stats_main(DDCA_Stats_Type stats, int depth); void ddc_report_max_tries(int depth); #endif /* DDC_SERVICES_H_ */ ddcutil-0.8.6/src/ddc/ddc_strategy.h0000644000175000001440000000301713230445447014247 00000000000000/* ddc_strategy.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #ifndef DDC_STRATEGY_H_ #define DDC_STRATEGY_H_ #include "util/coredefs.h" #include "base/displays.h" #include "base/status_code_mgt.h" // For future use void init_ddc_strategies(); typedef Public_Status_Code (*DDC_Raw_Writer)(Display_Handle * dh, int bytect, Byte * bytes); typedef Public_Status_Code (*DDC_Raw_Reader)(Display_Handle * dh, int bufsize, Byte * buffer); typedef struct { DDCA_IO_Mode io_mode; DDC_Raw_Writer writer; DDC_Raw_Reader reader; } DDC_Strategy; DDC_Raw_Writer ddc_raw_writer(Display_Handle * dh); DDC_Raw_Reader ddc_raw_reader(Display_Handle * dh); #endif /* DDC_STRATEGY_H_ */ ddcutil-0.8.6/src/ddc/ddc_try_stats.h0000644000175000001440000000265713230445447014452 00000000000000/* ddc_try_stats.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef TRY_STATS_H_ #define TRY_STATS_H_ #define MAX_STAT_NAME_LENGTH 31 // Returns an opaque pointer to a Try_Data data structure void * try_data_create(char * stat_name, int max_tries); void try_data_reset(void * stats_rec); void try_data_record_tries(void * stats_rec, int rc, int tryct); int try_data_get_total_attempts(void * stats_rec); void try_data_report(void * stats_rec, int depth); int try_data_get_max_tries(void * stats_rec); void try_data_set_max_tries(void* stats_rec,int new_max_tries); #endif /* TRY_STATS_H_ */ ddcutil-0.8.6/src/ddc/ddc_displays.h0000644000175000001440000000413113230445447014233 00000000000000/* ddc_displays.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #ifndef DDC_DISPLAYS_H_ #define DDC_DDC_DISPLAYS_H_ #include "public/ddcutil_types.h" #include "base/core.h" #include "base/displays.h" #include "i2c/i2c_bus_core.h" #include "adl/adl_shim.h" #include "usb/usb_displays.h" void ddc_set_async_threshold(int threshold); bool initial_checks_by_dref(Display_Ref * dref); GPtrArray * ddc_get_all_displays(); // returns GPtrArray of Display_Ref instances, including invalid displays int ddc_report_active_displays(int depth); #define DDC_REPORT_ALL_DISPLAYS false #define DDC_REPORT_VALID_DISPLAYS_ONLY true int ddc_report_displays(bool valid_only, int depth); Display_Ref* get_display_ref_for_display_identifier( Display_Identifier* pdid, Call_Options callopts); Display_Ref* ddc_find_display_by_dispno( int dispno); Display_Ref* ddc_find_display_by_mfg_model_sn( const char * mfg_id, const char * model, const char * sn, Byte findopts); Display_Ref* ddc_find_display_by_edid( const Byte * pEdidBytes, Byte findopts); void dbgreport_display_ref(Display_Ref * drec, int depth); GPtrArray * ddc_detect_all_displays(); void ddc_ensure_displays_detected(); #endif /* DDC_DISPLAYS_H_ */ ddcutil-0.8.6/src/ddc/ddc_dumpload.h0000644000175000001440000000547713230445447014226 00000000000000/* ddc_dumpload.h * * Load/store VCP settings from/to file. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Load/store VCP settings to/from file. */ #ifndef DDC_DUMPLOAD_H_ #define DDC_DUMPLOAD_H_ /** \cond */ #include #include "util/error_info.h" /** \endcond */ #include "base/displays.h" #include "base/status_code_mgt.h" #include "vcp/vcp_feature_values.h" /** Internal form data structure used to hold data being loaded. Whatever the external form, a file or a string, it is converted to **Dumpload_Data** and then written to the monitor. */ typedef struct { time_t timestamp_millis; ///< creation timestamp Byte edidbytes[128]; ///< 128 byte EDID, char edidstr[257]; ///< 128 byte EDID as hex string (for future use) char mfg_id[4]; ///< 3 character manufacturer id (from EDID) char model[14]; ///< model string (from EDID) char serial_ascii[14]; ///< serial number string (from EDID) DDCA_MCCS_Version_Spec vcp_version; ///< monitor VCP/MCCS version int vcp_value_ct; ///< number of VCP values Vcp_Value_Set vcp_values; ///< VCP values } Dumpload_Data; void report_dumpload_data(Dumpload_Data * data, int depth); void free_dumpload_data(Dumpload_Data * pdata); char * format_timestamp(time_t time_millis, char * buf, int bufsz); Error_Info * loadvcp_by_dumpload_data( Dumpload_Data* pdata, Display_Handle * dh); Error_Info * loadvcp_by_string( char * catenated, Display_Handle * dh); Dumpload_Data* create_dumpload_data_from_g_ptr_array(GPtrArray * garray); GPtrArray * convert_dumpload_data_to_string_array(Dumpload_Data * data); Public_Status_Code dumpvcp_as_dumpload_data( Display_Handle * dh, Dumpload_Data** pdumpload_data); Public_Status_Code dumpvcp_as_string( Display_Handle * dh, char** result); #endif /* DDC_DUMPLOAD_H_ */ ddcutil-0.8.6/src/ddc/ddc_multi_part_io.h0000644000175000001440000000411113230445447015250 00000000000000/* ddc_multi_part_io.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Capabilities read and Table feature read/write that require multiple * reads and writes for completion. */ #ifndef DDC_MULTI_PART_IO_H_ #define DDC_MULTI_PART_IO_H_ /** \cond */ #include #include "util/error_info.h" #include "util/data_structures.h" /** \endcond */ #include "base/displays.h" #include "base/status_code_mgt.h" // Statistics void ddc_reset_multi_part_read_stats(); void ddc_reset_multi_part_write_stats(); void ddc_report_multi_part_read_stats(int depth); void ddc_report_multi_part_write_stats(int depth); // Retry management void ddc_set_max_multi_part_read_tries(int ct); int ddc_get_max_multi_part_read_tries(); void ddc_set_max_multi_part_write_tries(int ct); int ddc_get_max_multi_part_write_tries(); Error_Info * multi_part_read_with_retry( Display_Handle * dh, Byte request_type, Byte request_subtype, // VCP feature code for table read, ignore for capabilities bool all_zero_response_ok, Buffer** ppbuffer); Error_Info * multi_part_write_with_retry( Display_Handle * dh, Byte vcp_code, Buffer * value_to_set); #endif /* DDC_MULTI_PART_IO_H_ */ ddcutil-0.8.6/src/ddc/ddc_packet_io.h0000644000175000001440000000525513230445447014351 00000000000000/* ddc_packet_io.h * * Functions for performing DDC packet IO, using either the I2C bus API * or the ADL API, as appropriate. * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_PACKET_IO_H_ #define DDC_PACKET_IO_H_ #include #include "util/error_info.h" #include "base/core.h" #include "base/ddc_packets.h" #include "base/displays.h" // bool all_zero(Byte * bytes, int bytec); Public_Status_Code ddc_open_display( Display_Ref * dref, Call_Options callopts, Display_Handle** pdh); void ddc_close_display(Display_Handle * dh); // Retry management void ddc_set_max_write_only_exchange_tries(int ct); int ddc_get_max_write_only_exchange_tries(); void ddc_set_max_write_read_exchange_tries(int ct); int ddc_get_max_write_read_exchange_tries(); // Retry statistics void ddc_reset_write_only_stats(); void ddc_report_write_only_stats(int depth); void ddc_reset_write_read_stats(); void ddc_report_write_read_stats(int depth); Error_Info * ddc_write_only( Display_Handle * dh, DDC_Packet * request_packet_ptr); Error_Info * ddc_write_only_with_retry( Display_Handle * dh, DDC_Packet * request_packet_ptr); Error_Info * ddc_write_read( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte expected_response_type, Byte expected_subtype, DDC_Packet ** response_packet_ptr_loc ); Error_Info * ddc_write_read_with_retry( Display_Handle * dh, DDC_Packet * request_packet_ptr, int max_read_bytes, Byte expected_response_type, Byte expected_subtype, bool all_zero_response_ok, // bool retry_null_response, DDC_Packet ** response_packet_ptr_loc ); #endif /* DDC_PACKET_IO_H_ */ ddcutil-0.8.6/src/ddc/ddc_read_capabilities.h0000644000175000001440000000236513230445447016036 00000000000000/* ddc_read_capabilities.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #ifndef DDC_READ_CAPABILITIES_H_ #define DDC_READ_CAPABILITIES_H_ #include "../util/error_info.h" #include "base/displays.h" #include "base/status_code_mgt.h" // Get capability string for monitor. Error_Info * get_capabilities_string( Display_Handle * dh, char** pcaps); #endif /* DDC_READ_CAPABILITIES_H_ */ ddcutil-0.8.6/src/ddc/ddc_vcp.h0000644000175000001440000000416713230445447013204 00000000000000/* ddc_vcp.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file */ #ifndef DDC_VCP_H_ #define DDC_VCP_H_ /** \cond */ #include #include "util/error_info.h" /** \endcond */ #include "base/core.h" #include "base/displays.h" #include "base/status_code_mgt.h" #include "vcp/vcp_feature_codes.h" #include "vcp/vcp_feature_values.h" void set_verify_setvcp(bool onoff); bool get_verify_setvcp(); Error_Info * save_current_settings( Display_Handle * dh); Error_Info * set_nontable_vcp_value( Display_Handle * dh, Byte feature_code, int new_value); Error_Info * set_vcp_value( Display_Handle * dh, DDCA_Single_Vcp_Value * vrec); Error_Info * get_table_vcp_value( Display_Handle * dh, Byte feature_code, Buffer** pp_table_bytes); Error_Info * get_nontable_vcp_value( Display_Handle * dh, Byte feature_code, Parsed_Nontable_Vcp_Response** pp_parsed_response); Error_Info * get_vcp_value( Display_Handle * dh, Byte feature_code, DDCA_Vcp_Value_Type call_type, DDCA_Single_Vcp_Value ** pvalrec); #endif /* DDC_VCP_H_ */ ddcutil-0.8.6/src/ddc/ddc_async.h0000644000175000001440000000243113230445447013521 00000000000000/* ddc_async.h * * * Copyright (C) 2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_ASYNC_H_ #define DDC_ASYNC_H_ #include "public/ddcutil_types.h" #include "util/coredefs.h" #include "util/error_info.h" #include "base/displays.h" Error_Info * start_get_vcp_value( Display_Handle * dh, Byte feature_code, DDCA_Vcp_Value_Type call_type, DDCA_Notification_Func callback_func); #endif /* DDC_ASYNC_H_ */ ddcutil-0.8.6/src/test/0000755000175000001440000000000013230445447011726 500000000000000ddcutil-0.8.6/src/test/adl/0000755000175000001440000000000013230445447012466 500000000000000ddcutil-0.8.6/src/test/adl/adl_tests.c0000644000175000001440000006036213032550072014532 00000000000000/* adl_tests.c * * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include // for wchar_t in adl_structures.h #include #include #include "util/string_util.h" #include "util/report_util.h" #include "base/core.h" #include "base/ddc_packets.h" #include "base/parms.h" #include "base/sleep.h" #include "adl/adl_impl/adl_sdk_includes.h" #include "adl/adl_impl/adl_intf.h" #include "adl/adl_impl/adl_friendly.h" #include "adl/adl_impl/adl_report.h" #include "adl/adl_impl/adl_aux_intf.h" #include "test/adl/adl_from_sample.h" #include "test/adl/adl_tests.h" #pragma GCC diagnostic ignored "-Wpointer-sign" void get_luminosity_amd_sample(int adapterNdx, int displayNdx, int how, int sendOffset, bool sendChecksum) { printf("(%s) Starting adapterNdx=%d, displayNdx=%d, how=%d, sendOffset=%d, sendChecksum=%d\n", __func__, adapterNdx, displayNdx, how, sendOffset, sendChecksum ); // DDC_Packet * response_packet_ptr = NULL; // Byte luminosity_op_code = 0x10; int rc; #ifdef MAYBE unsigned char zeroBytes[4] = {0}; // 0x00; rc = write(fh, &zeroBytes[0], 1); // succeeds if <= 2 bytes, fails if >= 3 if (rc < 0) { printf("(%s) Bus reset failed. rc=%d, errno=%s. Terminating execution.\n", __func__, rc, errno_name(errno) ); exit(1); } printf("(%s) Initial write succeeded\n", __func__); #endif unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command 0x10, // Luminosity feature code 0x00, // checksum, to be set }; ddc_cmd_bytes[5] = ddc_checksum(ddc_cmd_bytes, 5, false); // calculate DDC checksum on all bytes assert(ddc_cmd_bytes[5] == 0xac); Byte readbuf[256]; int receivedCt; // rc = 0; if ( how == 0 ) { int sendCt = 6 - sendOffset; if (!sendChecksum) sendCt -= 1; printf("(%s) how=%d, sendOffset=%d, sendCt=%d. sendChecksum=%d\n", __func__, how, sendOffset, sendCt, sendChecksum ); // sendOffset=1, sendChecksum=true: rc=-3 // rc = write(fh, ddc_cmd_bytes+1, sizeof(ddc_cmd_bytes)-1); ADLI2C adli2c; adli2c.iSize = sizeof(adli2c); // ADL_DL_I2C_LINE_OEM, ADL_DL_LINE_OD_CONTROL, ADL_DL_LINE_OEM2 3,4,5,6 adli2c.iLine = ADL_DL_I2C_LINE_OEM; // ?? numerical value representing hardware I2c related to no iDisplay on arg? adli2c.iAddress = ddc_cmd_bytes[0]; // adli2c.iAddress = 0x37; adli2c.iOffset = 0; // ??? adli2c.iAction = ADL_DL_I2C_ACTIONWRITE; adli2c.iSpeed = 50; // ??? I2C clock speed adli2c.iDataSize = sendCt; // number of bytes to be send or received adli2c.pcData = ddc_cmd_bytes + sendOffset; // ??? rc = adl->ADL_Display_WriteAndReadI2C(adapterNdx, &adli2c); printf("(%s) ADL_Display_WriteAndReadI2C returned %d\n", __func__, rc ); if (rc == 0) { // usleep(DEFAULT_TIMEOUT); sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); ADLI2C adli2cResponse; adli2cResponse.iSize = sizeof(adli2cResponse); adli2cResponse.iLine = 0; // ?? numerical value representing hardware I2c adli2cResponse.iAddress = 0x6e; adli2cResponse.iOffset = 0; // ??? adli2cResponse.iAction = ADL_DL_I2C_ACTIONREAD; adli2cResponse.iSpeed = 0; // ??? I2C clock speed adli2cResponse.iDataSize = 16; // wrong number of bytes to be send or received ??? adli2cResponse.pcData = readbuf; rc = adl->ADL_Display_WriteAndReadI2C(adapterNdx, &adli2c); printf("(%s) ADL_Display_WriteAndReadI2C returned %d\n", __func__, rc ); if (rc == 0) { hex_dump(readbuf, 16); } } } else if (how == 1) { int sendCt = 6 - sendOffset; if (!sendChecksum) sendCt -= 1; printf("(%s) how=%d, sendOffset=%d, sendCt=%d. sendChecksum=%d\n", __func__, how, sendOffset, sendCt, sendChecksum ); receivedCt = sizeof(readbuf); //sendOffset = 2, sendChecksum=true, rc = -1 // rc = i2c_smbus_write_i2c_block_data(fh, ddc_cmd_bytes[1], sizeof(ddc_cmd_bytes)-2, ddc_cmd_bytes+2); rc = call_ADL_Display_DDCBlockAccess_Get( adapterNdx, displayNdx, 0, // iOption ADL_DDC_OPTION_SWITCHDDC2, ADL_DDC_RESTORECOMMAND 0, // iCommandIndex, 0 unless flag ADL_DDC_RESTORECOMMAND set sendCt, // iSendMsgLen ddc_cmd_bytes+sendOffset, // char * lpucSendMsgBuf start where? include checksum? &receivedCt, readbuf); printf("(%s) ADL_Display_DDCBlockAccess_Get() returned %d\n", __func__, rc ); if (rc == 0) { hex_dump(readbuf, 16); } } else { printf("(%s) processing how=2 \n", __func__ ); int sendCt = 6 - sendOffset; if (!sendChecksum) sendCt -= 1; printf("(%s) how=%d, sendOffset=%d, sendCt=%d. sendChecksum=%d\n", __func__, how, sendOffset, sendCt, sendChecksum ); char * s = hexstring(ddc_cmd_bytes+sendOffset, sendCt); printf("(%s) Writing: %s \n", __func__, s ); free(s); Byte readbuf2[MAXREADSIZE]; int rcvCt = MAXREADSIZE; /* rc = */ adl_ddc_write_read_with_retry( adapterNdx, displayNdx, ddc_cmd_bytes+sendOffset, sendCt, readbuf2, &rcvCt); rc = adl_ddc_write_only_with_retry(adapterNdx, displayNdx, ddc_cmd_bytes+sendOffset, sendCt); if (rc == 0) { printf("(%s) Data returned: \n", __func__ ); hex_dump(readbuf2, rcvCt); // *(ulMaxVal) = (ucGetCommandReplyRead[GETRP_MAXHIGH_OFFSET] << 8 |ucGetCommandReplyRead[GETRP_MAXLOW_OFFSET]); // *(ulCurVal) = (ucGetCommandReplyRead[GETRP_CURHIGH_OFFSET] << 8 |ucGetCommandReplyRead[GETRP_CURLOW_OFFSET]); } } #ifdef WORKS if (rc >= 0) { Byte * readbuf = (Byte *)calloc(sizeof(unsigned char),256); // Byte cmd_byte = 0x6e; printf("(%s) callling call_read \n", __func__ ); rc = call_read(fh, readbuf, 32, true); if (rc < 0) { printf("(%s) call_read returned %d, errno=%d. Terminating execution \n", __func__, rc, errno ); exit(1); } printf("(%s) call_read() returned %d \n", __func__, rc ); if (rc >= 0) { hex_dump(readbuf, rc); int rc2 = create_ddc_getvcp_response_packet( readbuf, 32, luminosity_op_code, "get_vcp:response packet", &response_packet_ptr); printf("(%s) create_ddc_getvcp_response_packet() returned %d\n", __func__, rc2); if (rc2 == 0) { Interpreted_Vcp_Code * interpretation_ptr = NULL; rc2 = get_interpreted_vcp_code(response_packet_ptr, false, &interpretation_ptr); if (rc2 == 0) { printf("(%s) interpretation_ptr=%p\n", __func__, interpretation_ptr); report_interpreted_vcp_code(interpretation_ptr); } // read_ok = true; } } // read_ok } // write_ok #endif #ifdef TODO hex_dump(readbuf,1+rc); assert(readbuf[1] == 0x6e); int ddc_data_length = readbuf[2] & 0x7f; assert(ddc_data_length == 8); assert(readbuf[3] == 0x02); // get feature response readbuf[0] = 0x50; // for calculating DDC checksum unsigned char calculated_checksum = ddc_checksum(readbuf, 11, false); if (readbuf[11] != calculated_checksum) { printf("(%s) Unexpected checksum. actual=0x%02x, calculated=0x%02x \n", __func__, readbuf[11], calculated_checksum ); } int max_val = (readbuf[7] << 8) + readbuf[8]; int cur_val = (readbuf[9] << 8) + readbuf[10]; printf("(%s) cur_val = %d, max_val = %d \n", __func__, cur_val, max_val ); } if (response_packet_ptr) free_ddc_packet(response_packet_ptr); #endif } void exercise_ad_calls(int iAdapterIndex, int iDisplayIndex) { int rc; int iColorCaps; int iCurrent, iDefault, iMin, iMax, iStep; int iValidBits; ADLDisplayEDIDData edid_data; ADLDDCInfo2 ddc_info2; printf("(%s) iAdapterIndex=%d, iDisplayIndex=%d\n", __func__, iAdapterIndex, iDisplayIndex ); rc = adl->ADL_Display_ColorCaps_Get( iAdapterIndex, iDisplayIndex, &iColorCaps, &iValidBits); printf("(%s) ADL_DisplayColorCaps returned %d\n", __func__, rc ); rc = adl->ADL_Display_Color_Get( iAdapterIndex, iDisplayIndex, ADL_DISPLAY_COLOR_BRIGHTNESS, &iCurrent, &iDefault, &iMin, &iMax, &iStep); printf("(%s) ADL_Display_Color_Get() returned %d\n", __func__, rc ); edid_data.iSize = sizeof(ADLDisplayEDIDData); edid_data.iFlag = 0; edid_data.iBlockIndex = 0; // critical rc = adl->ADL_Display_EdidData_Get(iAdapterIndex, iDisplayIndex, &edid_data); printf("(%s) ADL_Display_EdidData() returned %d\n", __func__, rc ); rc = adl->ADL_Display_DDCInfo2_Get(iAdapterIndex, iDisplayIndex, &ddc_info2); printf("(%s) ADL_Display_DDCInfo2_Get() returned %d\n", __func__, rc ); } void diddle_adl_brightness(int iAdapterIndex, int iDisplayIndex) { printf("(%s) Starting. iAdapterIndex=%d, iDisplayIndex=%d\n", __func__, iAdapterIndex, iDisplayIndex ); int iColorCaps; int iValidBits; int iCurrent, iDefault, iMin, iMax, iStep; int rc; adl->ADL_Display_ColorCaps_Get( iAdapterIndex, iDisplayIndex, &iColorCaps, &iValidBits); // Use only the valid bits from iColorCaps iColorCaps &= iValidBits; // Check if the display supports this particular capability if ( ADL_DISPLAY_COLOR_BRIGHTNESS & iColorCaps ) { // Get the Current display Brightness, Default value, Min, Max and Step rc = adl->ADL_Display_Color_Get( iAdapterIndex, iDisplayIndex, ADL_DISPLAY_COLOR_BRIGHTNESS, &iCurrent, &iDefault, &iMin, &iMax, &iStep); printf("(%s) ADL_Display_Color_Get() returned %d\n", __func__, rc ); if (rc == ADL_OK) { printf("(%s) Adjusting brightness. iAdapterIndex=%d, iDisplayIndex=%d \n", __func__, iAdapterIndex, iDisplayIndex ); // Set half of the Min brightness for .5 sec rc = adl->ADL_Display_Color_Set( iAdapterIndex, iDisplayIndex, ADL_DISPLAY_COLOR_BRIGHTNESS, iMin / 2 ); printf("(%s) ADL_Display_Color_Set returned %d\n", __func__, rc ); sleep_millis( 500 ); rc = adl->ADL_Display_Color_Set( iAdapterIndex, iDisplayIndex, ADL_DISPLAY_COLOR_BRIGHTNESS, iCurrent ); printf("(%s) ADL_Display_Color_Set returned %d\n", __func__, rc ); sleep_millis( 500 ); // Set a quarter of the Max brightness for .5 sec rc = adl->ADL_Display_Color_Set( iAdapterIndex, iDisplayIndex, ADL_DISPLAY_COLOR_BRIGHTNESS, iMax / 4 ); printf("(%s) ADL_Display_Color_Set returned %d\n", __func__, rc ); sleep_millis( 500 ); // Restore the current brightness of the display rc = adl->ADL_Display_Color_Set( iAdapterIndex, iDisplayIndex, ADL_DISPLAY_COLOR_BRIGHTNESS, iCurrent ); printf("(%s) ADL_Display_Color_Set returned %d\n", __func__, rc ); sleep_millis( 500 ); } } printf("(%s) Done \n", __func__ ); } void adapterDisplayProbeLoop(int maxAdapters, int maxDisplays) { puts("\n----------------------------------------------------------------------------"); puts("\nIterating over adapter and display numbers:"); ADLDisplayEDIDData edid_data; ADLDDCInfo2 ddc_info2; int rc; int iAd, iDis; for (iAd=0; iAd < maxAdapters; iAd++) { for (iDis=0; iDis < maxDisplays; iDis++) { printf("iAd=%d, iDis=%d\n", iAd, iDis); edid_data.iSize = sizeof(ADLDisplayEDIDData); edid_data.iFlag = 0; edid_data.iBlockIndex = 0; // critical rc = adl->ADL_Display_EdidData_Get(iAd, iDis, &edid_data); if (rc != ADL_OK) { printf("(%s) ADL_Display_EdidData_Get() returned %d\n", __func__, rc ); } else { puts("EdidData_Get succeeded"); report_adl_ADLDisplayEDIDData(&edid_data,1); } rc = adl->ADL_Display_DDCInfo2_Get(iAd, iDis, &ddc_info2); if (rc != ADL_OK) { printf("(%s) ADL_Display_DDCInfo2_Get() returned %d\n", __func__, rc ); } else { puts("ADL_DISPLAY_DDCInfo2_Get succeeded"); report_adl_ADLDDCInfo2(&ddc_info2, false /* verbose */, 1); } int iMajor, iMinor; rc = adl->ADL_Display_WriteAndReadI2CRev_Get(iAd, &iMajor, &iMinor); if (rc != ADL_OK) { printf("(%s) ADL_Display_WroteAmdReadI2CRev_Get() returned %d\n", __func__, rc ); } else { printf("ADL_DISPLAY_WroteAmdReadO2CRev_Get succeeded. I2C rev = %d.%d\n", iMajor, iMinor); } int ulMaxVal; int ulCurVal; rc = vGetVcpCommand(0x10, &ulMaxVal, &ulCurVal, iAd, iDis); if (rc != ADL_OK) { printf("(%s) vGetVcpCommand() returned %d\n", __func__, rc ); } else { printf("vGetVcpCommand() succeeded. ulMaxVal=%d, ulCurVal=%d\n", ulMaxVal, ulCurVal); } } } } int get_luminosity_using_vGetVcpCommand(int iAdapterIndex, int iDisplayIndex, int * pmaxval, int * pcurval) { printf("(%s) Getting luminosity using vGetVcpCommand() \n", __func__ ); int rc = vGetVcpCommand(0x10, pmaxval, pcurval, iAdapterIndex, iDisplayIndex); printf("(%s) vGetVcpCommand returned %d\n", __func__, rc ); if (rc == 0) { printf("(%s) *pmaxval=%d, *pcurval=%d \n", __func__, *pmaxval, *pcurval ); } sleep_millis(500); return rc; } int set_luminosity_using_vSetVcpCommand(int iAdapterIndex, int iDisplayIndex, int newval) { printf("(%s) Setting luminosity = %d using vSetVcpCommand() \n", __func__, newval ); int rc = vSetVcpCommand(0x10, newval, iAdapterIndex, iDisplayIndex); printf("(%s) vSetVcpCommand returned %d \n", __func__, rc ); sleep_millis(500); return rc; } void run_adapter_display_tests() { printf("(%s) Starting\n", __func__ ); int ndx = 0; // for (ndx = 0; ndx < activeDisplayCt2; ndx++) { for (ndx = 0; ndx < active_display_ct; ndx++) { puts(""); // printf("(%s) activeDisplay loop, ndx=%d \n", __func__, ndx ); ADL_Display_Rec * pDisp = &active_displays[ndx]; report_adl_display_rec(pDisp, false /* verbose */, 0); puts(""); int iAdapterIndex = pDisp->iAdapterIndex; int iDisplayIndex = pDisp->iDisplayIndex; printf("(%s) iAdapterIndex=%d, iDisplayIndex=%d\n", __func__, iAdapterIndex, iDisplayIndex ); printf("(%s) -------------> exercise_ad_calls\n", __func__ ); exercise_ad_calls(iAdapterIndex, iDisplayIndex); puts(""); // printf("(%s) -------------> diddleBrightness \n", __func__ ); // diddleBrightness(iAdapterIndex, iDisplayIndex); puts(""); printf("(%s) -------------> using vGetVcpCommand, vSetVcpCommand \n", __func__ ); // unsigned char vcpCode = 0x10; // unsigned int maxval = 2; // funny number for testing // unsigned int curval = 2; // get_luminosity_using_vGetVcpCommand(iAdapterIndex, iDisplayIndex, &maxval, &curval); // set_luminosity_using_vSetVcpCommand(iAdapterIndex, iDisplayIndex, 25); // get_luminosity_using_vGetVcpCommand(iAdapterIndex, iDisplayIndex, &maxval, &curval); set_luminosity_using_vSetVcpCommand(iAdapterIndex, iDisplayIndex, 230); // get_luminosity_using_vGetVcpCommand(iAdapterIndex, iDisplayIndex, &maxval, &curval); puts(""); printf("(%s) ---------------> using amd_adl_getVCP, onecall=false \n", __func__ ); // how, sendOffset, sendChecksum // get_luminosity_amd_sample(iAdapterIndex, iDisplayIndex, 2, 0, true); adl_ddc_set_vcp(iAdapterIndex, iDisplayIndex, 0x10, 225); // adl_DDC_getVCP(iAdapterIndex, iDisplayIndex, 0x10, false); puts(""); // printf("(%s) ---------------> using amd_adl_getVCP, onecall=true \n", __func__ ); // adl_DDC_getVCP(iAdapterIndex, iDisplayIndex, 0x10, true); puts(""); printf("(%s) -------------> exercise_ad_calls\n", __func__ ); exercise_ad_calls(iAdapterIndex, iDisplayIndex); puts(""); } } void adl_testmain() { adl_initialize(); if (active_display_ct > 0) { printf("(%s) activeDisplayCt2=%d\n", __func__, active_display_ct ); run_adapter_display_tests(); } adl_release(); } #ifdef OLD bool init_adl() { printf("(%s) Starting.\n", __func__ ); int rc; // Initialize ADL. The second parameter is 1, which means: // retrieve adapter information only for adapters that are physically present and enabled in the system printf("(%s) adl=%p\n", __func__, adl ); printf("(%s) adl->ADL_Main_Control_Create=%p \n", __func__, adl->ADL_Main_Control_Create ); rc = adl->ADL_Main_Control_Create (ADL_Main_Memory_Alloc, 1); if (rc != ADL_OK) { printf("ADL Initialization Error! ADL_Main_Control_Create() returned: %d.\n", rc); return false; } printf("(%s) ADL_Main_Control_Create succeeded.\n", __func__ ); // Obtain the number of adapters for the system rc = adl->ADL_Adapter_NumberOfAdapters_Get ( &iNumberAdapters ); if (rc != ADL_OK) { printf("Cannot get the number of adapters! ADL_Adapter_NumberOfAdapaters_Get() returned %d\n", rc); return false; } printf("(%s) Found %d adapters\n", __func__, iNumberAdapters ); if ( 0 < iNumberAdapters ) { lpAdapterInfo = malloc ( sizeof (AdapterInfo) * iNumberAdapters ); memset ( lpAdapterInfo,'\0', sizeof (AdapterInfo) * iNumberAdapters ); // Get the AdapterInfo structure for all adapters in the system adl->ADL_Adapter_AdapterInfo_Get (lpAdapterInfo, sizeof (AdapterInfo) * iNumberAdapters); } // Repeat for all available adapters in the system int iAdapterNo, iDisplayNo; int iAdapterIndex; int iDisplayIndex; int iCurrent, iDefault, iMin, iMax, iStep; for ( iAdapterNo = 0; iAdapterNo < iNumberAdapters; iAdapterNo++ ) { printf("Adapter: %d\n", iAdapterNo ); reportAdapterInfo(&lpAdapterInfo[ iAdapterNo], 0); iAdapterIndex = lpAdapterInfo[ iAdapterNo ].iAdapterIndex; assert(iAdapterIndex == iAdapterNo); printf("(%s) iAdapterIndex=%d\n", __func__, iAdapterIndex ); ADL_Main_Memory_Free ( &lpAdlDisplayInfo ); rc = adl->ADL_Display_DisplayInfo_Get ( lpAdapterInfo[iAdapterNo].iAdapterIndex, &iNumDisplays, &lpAdlDisplayInfo, 0); if (rc != ADL_OK) { printf("ADL_Display_DisplayInfo_Get() returned %d\n", rc); continue; } for ( iDisplayNo = 0; iDisplayNo < iNumDisplays; iDisplayNo++ ) { printf("(%s) adapter number = %d, display number: %d \n", __func__, iAdapterNo, iDisplayNo ); reportADLDisplayInfo(&lpAdlDisplayInfo[iDisplayNo], 0); // puts("Wolf 2"); // For each display, check its status. Use the display only if it's connected AND mapped (iDisplayInfoValue: bit 0 and 1 ) if ( ( ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED ) != ( (ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED) & lpAdlDisplayInfo[ iDisplayNo ].iDisplayInfoValue ) ) { printf("(%s) Display %d not connected or not mapped\n", __func__, iDisplayNo ); continue; // Skip the not connected or not mapped displays } // Is the display mapped to this adapter? This test is too restrictive and may not be needed. if ( iAdapterIndex != lpAdlDisplayInfo[ iDisplayNo ].displayID.iDisplayLogicalAdapterIndex ) { printf("(%s) Display not mapped to this adapter \n", __func__ ); continue; } iDisplayIndex = lpAdlDisplayInfo[ iDisplayNo ].displayID.iDisplayLogicalIndex; assert(activeDisplayCt < MAX_ACTIVE_DISPLAYS); activeDisplays[activeDisplayCt].iAdapterNo = iAdapterNo; activeDisplays[activeDisplayCt].iDisplayNo = iDisplayNo; activeDisplays[activeDisplayCt].iLogicalDisplayIndex = iDisplayIndex; activeDisplays[activeDisplayCt].displayID = lpAdlDisplayInfo[iDisplayNo].displayID; activeDisplayCt++; ADLDisplayEDIDData edid_data; // rc == -3: // rc = ADL_Display_EdidData_Get(iAdapterIndex, iDisplayIndex, &edid_data); // also rc == -3: rc = adl->ADL_Display_EdidData_Get(iAdapterNo, iDisplayNo, &edid_data); if (rc != ADL_OK) { printf("(%s) ADL_Display_EdidData_Get() returned %d\n", __func__, rc ); } else { puts("EdidData_Get succeeded"); report_adl_ADLDisplayEDIDData(&edid_data,1); } diddle_adl_brightness(iAdapterIndex, iDisplayIndex); } // iNumDisplays } // iNumberAdapters adapterDisplayProbeLoop(iNumberAdapters, 6); puts("--------------------------------------------------------------------"); printf("(%s) Active displays: \n", __func__ ); int activeDisplayNdx; for (activeDisplayNdx = 0; activeDisplayNdx < activeDisplayCt; activeDisplayNdx++) { printf("activeDisplayNdx=%d\n", activeDisplayNdx); ActiveDisplay * pad = &activeDisplays[activeDisplayNdx]; printf(" adapterNo=%d\n", pad->iAdapterNo); printf(" displayNo=%d\n", pad->iDisplayNo); printf(" logicalDisplayIndex=%d\n", pad->iLogicalDisplayIndex); reportADLDisplayID( &(pad->displayID), 2); int adNdx = pad->iAdapterNo; int dispNdx = pad->displayID.iDisplayLogicalIndex; printf(" Retrieving DDCInfo2 using adNdx=%d, dispNdx=%d\n", adNdx, dispNdx); rc = adl->ADL_Display_DDCInfo2_Get(adNdx, dispNdx, &ddc_info2); if (rc != ADL_OK) { printf("(%s) ADL_Display_DDCInfo2_Get() returned %d\n", __func__, rc ); } else { puts("ADL_DISPLAY_DDCInfo2_Get succeeded"); report_adl_ADLDDCInfo2(&ddc_info2, false /* verbose */, 1); } edid_data.iSize = sizeof(edid_data); edid_data.iFlag = 0; edid_data.iBlockIndex = 0; rc = adl->ADL_Display_EdidData_Get(adNdx, dispNdx, &edid_data); if (rc != ADL_OK) { printf("(%s) ADL_Display_EdidData_Get() returned %d\n", __func__, rc ); } else { puts("EdidData_Get succeeded"); report_adl_ADLDisplayEDIDData(&edid_data,1); } // get_luminosity_amd_sample(adNdx, dispNdx, 0); // how, startOffset, sendChecksum get_luminosity_amd_sample(adNdx, dispNdx, 0, 0, true); get_luminosity_amd_sample(adNdx, dispNdx, 0, 1, true); get_luminosity_amd_sample(adNdx, dispNdx, 0, 2, true); get_luminosity_amd_sample(adNdx, dispNdx, 1, 0, true); UCHAR ucVcp = 0x10; UINT ulMaxVal; UINT ulCurVal; vGetVcpCommand(ucVcp, &ulMaxVal, &ulCurVal, adNdx, dispNdx); printf("(%s) vGetVcpCommand() returned ulMaxVal=%d, ulCurVal=%d\n", __func__, ulMaxVal, ulCurVal ); // bool ok = vGetCapabilitiesCommand(VCP_CODE_CAPABILITIES, adNdx, dispNdx); // printf("(%s) vGetCapabilities() returned %d\n", __func__ , ok); } ADL_Main_Memory_Free ( &lpAdapterInfo ); ADL_Main_Memory_Free ( &lpAdlDisplayInfo ); return true; } #endif ddcutil-0.8.6/src/test/adl/adl_from_sample.c0000644000175000001440000002444412714521054015701 00000000000000/* adl_from_sample.c * * ADL DDC functions extracted from ADL sample code * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include "util/string_util.h" #include "base/core.h" #include "base/sleep.h" #include "adl/adl_impl/adl_sdk_includes.h" #include "adl/adl_impl/adl_intf.h" #include "test/adl/adl_from_sample.h" #define MAX_NUM_DISPLAY_DEVICES 16 //******************************** // Globals //******************************** UINT aAllConnectedDisplays[MAX_NUM_DISPLAY_DEVICES]; //int array of connected displays for each of the ATI devices (aligned with sDriverNames) ADLPROCS adlprocs = {0,0,0,0}; UCHAR ucSetCommandWrite[SETWRITESIZE] ={0x6e,0x51,0x84,0x03,0x00,0x00,0x00,0x00}; UCHAR ucGetCommandRequestWrite[GETRQWRITESIZE] ={0x6e,0x51,0x82,0x01,0x00,0x00}; UCHAR ucGetCommandCapabilitiesWrite[GETCAPWRITESIZE]={0x6e,0x51,0x83,0xf3,0x00,0x00,0x00}; UCHAR ucGetCommandReplyWrite[GETREPLYWRITESIZE] ={0x6f}; UCHAR ucGetCommandReplyRead[MAXREADSIZE]; UCHAR ucGlobalVcp = VCP_CODE_BRIGHTNESS; LPAdapterInfo lpAdapterInfo = NULL; LPADLDisplayInfo lpAdlDisplayInfo = NULL; char MonitorNames[MAX_NUM_DISPLAY_DEVICES] [128]; // Array of Monitor names #ifndef TRUE bool TRUE = true; bool FALSE = false; #endif // // v functions from ADL sample code // // Function: // void vGetCapabilitiesCommand // Purpose: // Get the MCCS capabilities // Input: UCHAR ucVcp, VCP code (CONTRAST, BRIGHTNESS, etc) // int iDisplayIndex, display index // Output: VOID bool vGetCapabilitiesCommand(UCHAR ucVcp, int iAdapterIndex, int iDisplayIndex) { unsigned int i; unsigned char chk=0; int val=0; int read_val=0; int temp_val=1; int replySize=0; bool ret=TRUE; ucGetCommandCapabilitiesWrite[CAP_LOW_OFFSET]=0; if (ucVcp == VCP_CODE_CAPABILITIES) replySize = GETREPLYCAPSIZEFIXED; else replySize = GETREPLYCAPSIZEVARIABLE; while(temp_val!=0) { // set the offset ucGetCommandCapabilitiesWrite[CAP_LOW_OFFSET]+=(UCHAR)val; // get checksum for ( i = 0; i < CAP_CHK_OFFSET; i++) chk=chk^ucGetCommandCapabilitiesWrite[i]; ucGetCommandCapabilitiesWrite[CAP_CHK_OFFSET] = chk; // write get capability with offset vWriteI2c((char*)&ucGetCommandCapabilitiesWrite[0], GETCAPWRITESIZE, iAdapterIndex, iDisplayIndex); sleep_millis(40); // initial read to get the length to determine actual read length vWriteAndReadI2c((char*)&ucGetCommandReplyWrite[0], GETREPLYWRITESIZE, (char*)&ucGetCommandReplyRead[0], replySize, iAdapterIndex, iDisplayIndex); if (ucVcp == VCP_CODE_CAPABILITIES_NEW) { // compute read length read_val= (int)ucGetCommandReplyRead[GETRP_LENGHTH_OFFSET] & 0x7F; read_val += 0x3; // re-write get capability with offset vWriteI2c((char*)&ucGetCommandCapabilitiesWrite[0],GETCAPWRITESIZE, iAdapterIndex, iDisplayIndex); sleep_millis(40); // read with actual read length computed from above vWriteAndReadI2c((char*)&ucGetCommandReplyWrite[0],GETREPLYWRITESIZE,(char*)&ucGetCommandReplyRead[0],read_val, iAdapterIndex, iDisplayIndex); } if ((int)ucGetCommandReplyRead[GETRP_LENGHTH_OFFSET] == 0) { ret=FALSE; break; } // compute new offset val=(int)ucGetCommandReplyRead[GETRP_LENGHTH_OFFSET]-0x83; temp_val=val; chk=0; } return ret; } // Function: // void vGetVcpCommand // Purpose: // Get the values from display based on which VCP code // Input: UCHAR ucVcp, VCP code (CONTRAST, BRIGHTNESS, etc) // int*ulMaxVal, return value of the max possible value to can be set // int*ulCurVal, return value of current set // int iDisplayIndex, display index // Output: VOID int vGetVcpCommand(UCHAR ucVcp, UINT * ulMaxVal, UINT * ulCurVal, int iAdapterIndex, int iDisplayIndex) { unsigned int i; unsigned char chk=0; int ADL_Err = ADL_ERR; printf("(%s) ucVcp=0x%02x, iAdapterIndex=%d, iDisplayIndex=%d\n", __func__, ucVcp, iAdapterIndex, iDisplayIndex ); // known values for testing: *ulMaxVal = 2; *ulCurVal = 2; sleep_millis(500); // added // adding initial write as per my posted example to i2c list // unsigned char zeroByte = 0x00; // int rc = vWriteI2c( &zeroByte, 1, iAdapterIndex, iDisplayIndex); // printf("(%s) vWriteI2c() of zeroByte returned %d \n", __func__, rc ); ucGetCommandRequestWrite[GETRQ_VCPCODE_OFFSET]=ucVcp; for( i = 0; i < GETRQ_CHK_OFFSET; i++) chk = chk ^ ucGetCommandRequestWrite[ i ]; ucGetCommandRequestWrite[GETRQ_CHK_OFFSET] = chk; // printf("(%s) DDC command to write: %s\n", __func__, hexstring(ucGetCommandRequestWrite, GETRQWRITESIZE) ); ADL_Err = vWriteI2c( (char*) &ucGetCommandRequestWrite[0], GETRQWRITESIZE, iAdapterIndex, iDisplayIndex); printf("(%s) vWriteI2c() returned %d\n", __func__, ADL_Err ); sleep_millis(40); if (ADL_Err == 0) { // for debugging: // printf("(%s) sizeof(ucGetCommandReplyRead)=%d, MAXREADSIZE=%d\n", __func__, sizeof(ucGetCommandReplyRead), MAXREADSIZE ); assert( sizeof(ucGetCommandReplyRead) == MAXREADSIZE); memset(ucGetCommandReplyRead, 0, sizeof(ucGetCommandReplyRead)); ADL_Err = vWriteAndReadI2c( (char*)&ucGetCommandReplyWrite[0], GETREPLYWRITESIZE, (char*) &ucGetCommandReplyRead[0], GETREPLYREADSIZE, iAdapterIndex, iDisplayIndex); printf("(%s) vWriteAndReadI2c() returned %d\n", __func__, ADL_Err ); if (ADL_Err == 0) { char * hs = hexstring(ucGetCommandReplyRead, GETREPLYREADSIZE); printf("(%s) Data returned: %s \n", __func__, hs ); // hex_dump(ucGetCommandReplyRead, GETREPLYREADSIZE); free(hs); } *(ulMaxVal) = (ucGetCommandReplyRead[GETRP_MAXHIGH_OFFSET] << 8 |ucGetCommandReplyRead[GETRP_MAXLOW_OFFSET]); *(ulCurVal) = (ucGetCommandReplyRead[GETRP_CURHIGH_OFFSET] << 8 |ucGetCommandReplyRead[GETRP_CURLOW_OFFSET]); } // printf("(%s) Returning ADL_Err=%d \n", __func__, ADL_Err ); return ADL_Err; } // // Function: // void vSetVcpCommand // Purpose: // Set the values from display based on which VCP code // Input: UCHAR ucVcp, VCP code (CONTRAST, BRIGHTNESS, etc) // int ulVal, which value to set // int iDisplayIndex, display index // Output: VOID // int vSetVcpCommand(UCHAR ucVcp, UINT ulVal, int iAdapterIndex, int iDisplayIndex) { printf("(%s) Starting. ucVcp=0x%02x, ulVal=%d \n", __func__, ucVcp, ulVal ); unsigned int i; unsigned char chk=0; int ADL_Err = ADL_ERR; ucSetCommandWrite[SET_VCPCODE_OFFSET] = ucVcp; ucSetCommandWrite[SET_LOW_OFFSET] = (char)(ulVal & 0x0ff); ucSetCommandWrite[SET_HIGH_OFFSET] = (char)((ulVal>>8) & 0x0ff); for( i = 0; i < SET_CHK_OFFSET; i++) chk=chk ^ ucSetCommandWrite[i]; ucSetCommandWrite[SET_CHK_OFFSET] = chk; ADL_Err = vWriteI2c( (char*)&ucSetCommandWrite[0], SETWRITESIZE, iAdapterIndex, iDisplayIndex); printf("(%s) vWriteI2c() returned %d\n", __func__, ADL_Err ); sleep_millis(50); return ADL_Err; } // Function: // void vWriteI2c // Purpose: // Write to and read from an i2s address // Input: char * lpucSendMsgBuf Data to write // int iSendMsgLen Length of data // int iAdapterIndex, int iDisplayIndex // Output: result code // int vWriteI2c(char * lpucSendMsgBuf, int iSendMsgLen, int iAdapterIndex, int iDisplayIndex) { sleep_millis(500); // added int iRev = 0; // return adlprocs.ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, iSendMsgLen, lpucSendMsgBuf, &iRev, NULL); // printf("(%s) iAdapterIndex=%d, iDisplayIndex=%d, receive buffer size = %d. receive buffer addr = NULL. Writing: %s\n", // __func__, iAdapterIndex, iDisplayIndex, iRev, hexstring(lpucSendMsgBuf, iSendMsgLen) ); // hex_dump(lpucSendMsgBuf, iSendMsgLen); int rc = call_ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, iSendMsgLen, lpucSendMsgBuf, &iRev, NULL); // printf("(%s) Returning %d\n", __func__, rc); return rc; } // Function: // void vWriteAndReadI2c // Purpose: // Write to and read from an i2s address // Input: char * lpucSendMsgBuf Data to write // int iSendMsgLen Length of data // char * lpucRecvMsgBuf Read buffer // int iRecvMsgLen Read buffer size // int iAdapterIndex, int iDisplayIndex // Output: result code // int vWriteAndReadI2c(char * lpucSendMsgBuf, int iSendMsgLen, char * lpucRecvMsgBuf, int iRecvMsgLen, int iAdapterIndex, int iDisplayIndex) { sleep_millis(500); // added // return adlprocs.ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, // iSendMsgLen, lpucSendMsgBuf, &iRecvMsgLen, lpucRecvMsgBuf); // printf("(%s) iAdapterIndex=%d, iDisplayIndex=%d, lpucRecvMsgBuf=%p, iRecvMsgLen=%d Writing: %s\n", // __func__, iAdapterIndex, iDisplayIndex, lpucRecvMsgBuf, iRecvMsgLen, hexstring(lpucSendMsgBuf, iSendMsgLen) ); // hex_dump(lpucSendMsgBuf, iSendMsgLen); int rc = call_ADL_Display_DDCBlockAccess_Get( iAdapterIndex, iDisplayIndex, 0, 0, iSendMsgLen, lpucSendMsgBuf, &iRecvMsgLen, lpucRecvMsgBuf); if (rc != 0) { char * hs = hexstring((Byte*)lpucRecvMsgBuf, iRecvMsgLen); printf("(%s) Value returned: %s \n", __func__, hs ); // hex_dump(lpucRecvMsgBuf, iRecvMsgLen); free(hs); } // printf("(%s) Returning %d\n", __func__, rc); return rc; } ddcutil-0.8.6/src/test/adl/adl_from_sample.h0000644000175000001440000000335313230445447015707 00000000000000/* adl_from_sample.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef ADL_FROM_SAMPLE_H_ #define ADL_FROM_SAMPLE_H_ #include "adl/adl_impl/adl_intf.h" #include "adl/adl_impl/adl_friendly.h" typedef unsigned int UINT; typedef unsigned char UCHAR; //******************************** // Prototypes //******************************** int vGetVcpCommand(UCHAR ucVcp, UINT * ulMaxVal, UINT * ulCurVal, int iAdapterIndex, int iDisplayIndex); int vSetVcpCommand(UCHAR ucVcp, UINT ulVal, int iAdapterIndex, int iDisplayIndex); bool vGetCapabilitiesCommand(UCHAR ucVcp, int iAdapterIndex, int iDisplayIndex); int vWriteI2c(char * lpucSendMsgBuf, int iSendMsgLen, int iAdapterIndex, int iDisplayIndex); int vWriteAndReadI2c(char *lpucSendMsgBuf, int iSendMsgLen, char * lpucRecvMsgBuf, int iRecvMsgLen, int iAdapterIndex, int iDisplayIndex); // bool InitADL(); // void FreeADL(); #endif /* ADL_FROM_SAMPLE_H_ */ ddcutil-0.8.6/src/test/adl/adl_tests.h0000644000175000001440000000235513230445447014546 00000000000000/* adl_tests.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef ADL_TESTS_H_ #define ADL_TESTS_H_ #include #include #include #define LINUX #include void adl_testmain(); void diddle_adl_brightness(int iAdapterIndex, int iDisplayIndex); void exercise_ad_calls(int iAdapterIndex, int iDisplayIndex); void run_adapter_display_tests(); #endif /* ADL_TESTS_H_ */ ddcutil-0.8.6/src/test/ddc/0000755000175000001440000000000013230445447012460 500000000000000ddcutil-0.8.6/src/test/ddc/ddc_capabilities_tests.c0000664000175000001440000000773013213467116017240 00000000000000/* ddc_capabilities_tests.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include "util/string_util.h" #include "base/ddc_packets.h" #include "base/parms.h" #include "base/sleep.h" #include "test/i2c/i2c_io_old.h" #include "i2c/i2c_bus_core.h" #include "test/ddc/ddc_capabilities_tests.h" // // Test driver for exploratory programming // void probe_get_capabilities(int busno, char* write_mode, char* read_mode, Byte addr) { printf("\n(probe_get_capabilities) busno=%d, write_mode=%s, read_mode=%s, addr=0x%02x\n", busno, write_mode, read_mode, addr); int file; int rc; unsigned char * readbuf; if (!i2c_verify_functions_supported(busno, write_mode, read_mode)) return; // For testing, just read first 32 bytes of capabilities unsigned char packet_bytes[] = {0x6e, 0x51, 0x83, 0xf3, 0x00, 0x00, 0x00}; packet_bytes[6] = ddc_checksum(packet_bytes, 6, false); int len_packet_bytes = sizeof(packet_bytes); file = i2c_open_bus(busno, CALLOPT_ERR_MSG); if (file < 0) return; printf("Setting addr to %02x\n", addr); rc = i2c_set_addr(file, addr,CALLOPT_ERR_MSG ); if (rc < 0) goto bye; // usleep(TIMEOUT); sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); // rc = perform_i2c_write(file, write_mode, len_packet_bytes-1, packet_bytes+1); set_i2c_write_mode(write_mode); rc = perform_i2c_write2(file, len_packet_bytes-1, packet_bytes+1, DDC_TIMEOUT_USE_DEFAULT); if (rc >= 0) { readbuf = (unsigned char *)calloc(sizeof(unsigned char),256); // Byte cmd_byte = 0x6e; set_i2c_read_mode(read_mode); rc = perform_i2c_read2(file, 200, readbuf, DDC_TIMEOUT_USE_DEFAULT); // rc = perform_i2c_read(file, read_mode, 200, readbuf); if (rc >= 0) hex_dump(readbuf, rc); } bye: close(file); } void test_get_capabilities_for_bus(int busno) { printf("\n========== Probing get capabilities =============\n"); // busno, write_mode, read_mode, addr, probe_get_capabilities(busno, "write", "read", 0x37); // busno=3, write succeeds // probe_get_capabilities(busno, "write", "read", 0x6e); // busno=3, write fails, ENXIO probe_get_capabilities(busno, "i2c_smbus_write_byte", "read", 0x37); probe_get_capabilities(busno, "i2c_smbus_write_byte_data", "read", 0x37); // probe_get_capabilities(busno, "i2c_smbus_write_block_data", "read", 0x37); // i2c_smbus_write_block_data always wrong probe_get_capabilities(busno, "i2c_smbus_write_i2c_block_data", "read", 0x37); // probe_get_capabilities(busno, "i2c_smbus_write_i2c_block_data", "i2c_smbus_read_block_data", 0x37); probe_get_capabilities(busno, "i2c_smbus_write_i2c_block_data", "i2c_smbus_read_i2c_block_data", 0x37); probe_get_capabilities(busno, "write", "i2c_smbus_read_byte", 0x37); probe_get_capabilities(busno, "write", "i2c_smbus_read_byte_data", 0x37); probe_get_capabilities(busno, "write", "i2c_smbus_read_i2c_block_data", 0x37); } ddcutil-0.8.6/src/test/ddc/ddc_vcp_tests.c0000644000175000001440000005564513213467475015415 00000000000000/* ddc_vcp_tests.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include #include "base/core.h" #include "base/ddc_packets.h" #include "base/linux_errno.h" #include "base/parms.h" #include "base/sleep.h" #include "vcp/vcp_feature_codes.h" #include "i2c/i2c_bus_core.h" #include "i2c/wrap_i2c-dev.h" #include "adl/adl_shim.h" #include "ddc/ddc_packet_io.h" #include "ddc/ddc_vcp.h" #include "test/i2c/i2c_io_old.h" #include "test/ddc/ddc_vcp_tests.h" // #define TIMEOUT 50000 char * hexstring0(unsigned char * bytes, int len) { int alloc_size = 3*len + 1; char* str_buf = malloc(alloc_size); int i; for (i = 0; i < len; i++) { snprintf(str_buf+3*i, alloc_size-3*i, "%02x ", bytes[i]); } str_buf[3*len-1] = 0x00; return str_buf; } int single_getvcp_call(int busno, unsigned char vcp_feature_code) { printf("\n(%s) Starting. vcp_feature_code=0x%02x\n", __func__, vcp_feature_code ); int ndx; unsigned char checksum; int rc; char devname[12]; snprintf(devname, 11, "/dev/i2c-%d", busno); int fh = open(devname, O_RDWR); if (fh < 0) { perror("Open failed"); return -1; } rc = ioctl(fh, I2C_SLAVE, 0x37); if (rc < 0) { perror("ioctl(I2C_SLAVE, 0x37) failed"); close(fh); return -1; } #ifdef NO // write seems to be necessary to reset monitor state unsigned char zeroByte = 0x00; // 0x00; rc = write(fh, &zeroByte, 1); if (rc < 0) { printf("(%s) Bus reset failed. rc=%d, errno=%d. \n", __func__, rc, errno ); return -1; } #endif // without this or 0 byte write, read() sometimes returns all 0 on P2411H usleep(50000); unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command vcp_feature_code, // 0x00, // checksum, to be set }; // unsigned char checksum0 = xor_bytes(ddc_cmd_bytes,5); checksum = ddc_checksum(ddc_cmd_bytes, 5, false); // calculate DDC checksum on all bytes // assert(checksum==checksum0); ddc_cmd_bytes[5] = ddc_cmd_bytes[0]; for (ndx=1; ndx < 5; ndx++) ddc_cmd_bytes[5] ^= ddc_cmd_bytes[ndx]; // calculate checksum // printf("(%s) ddc_cmd_bytes = %s \n", __func__ , hexstring(ddc_cmd_bytes,6) ); // printf("(%s) checksum=0x%02x, ddc_cmd_bytes[5]=0x%02x \n", __func__, checksum, ddc_cmd_bytes[5] ); // assert(ddc_cmd_bytes[5] == 0xac); assert(checksum == ddc_cmd_bytes[5]); int writect = sizeof(ddc_cmd_bytes)-1; rc = write(fh, ddc_cmd_bytes+1, writect); if (rc < 0) { printf("(%s) write() returned %d, errno=%d. \n", __func__, rc, errno); close(fh); return -1; } else if (rc != writect) { printf("(%s) write() returned %d, expected %d \n", __func__, rc, writect ); close(fh); return -1; } usleep(50000); unsigned char ddc_response_bytes[12]; int readct = sizeof(ddc_response_bytes)-1; rc = read(fh, ddc_response_bytes+1, readct); if (rc < 0) { printf("(%s) read() returned %d, errno=%d.\n", __func__, rc, errno ); close(fh); return -1; } else if (rc != readct) { printf("(%s) read() returned %d, should be %d \n", __func__, rc, readct ); close(fh); return -1; } // printf("(%s) read() returned %s\n", __func__, hexstring(ddc_response_bytes+1, readct) ); char * hs = hexstring0(ddc_response_bytes+1, readct); printf("(%s) read() returned %s\n", __func__, hs ); free(hs); // hex_dump(ddc_response_bytes,1+rc); int ddc_data_length = ddc_response_bytes[2] & 0x7f; // some monitors return a DDC null response to indicate an invalid request: if (ddc_response_bytes[1] == 0x6e && ddc_data_length == 0 && ddc_response_bytes[3] == 0xbe) { // 0xbe == checksum printf("(%s) Received DDC null response\n", __func__ ); close(fh); return -1; } bool response_ok = true; if (ddc_response_bytes[1] != 0x6e) { // assert(ddc_response_bytes[1] == 0x6e); printf("(%s) Invalid address byte in response, expected 06e, actual 0x%02x\n", __func__, ddc_response_bytes[1] ); response_ok = false; } if (ddc_data_length != 8) { printf("(%s) Invalid query VCP response length: %d\n", __func__, ddc_data_length ); response_ok = false; } if (ddc_response_bytes[3] != 0x02) { // get feature response printf("(%s) Expected 0x02 in feature response field, actual value 0x%02x\n", __func__, ddc_response_bytes[3] ); response_ok = false; } ddc_response_bytes[0] = 0x50; // for calculating DDC checksum // checksum0 = xor_bytes(ddc_response_bytes, sizeof(ddc_response_bytes)-1); unsigned char calculated_checksum = ddc_response_bytes[0]; for (ndx=1; ndx < 11; ndx++) calculated_checksum ^= ddc_response_bytes[ndx]; // printf("(%s) checksum0=0x%02x, calculated_checksum=0x%02x\n", __func__, checksum0, calculated_checksum ); if (ddc_response_bytes[11] != calculated_checksum) { printf("(%s) Unexpected checksum. actual=0x%02x, calculated=0x%02x \n", __func__, ddc_response_bytes[11], calculated_checksum ); response_ok = false; } if (response_ok) { if (ddc_response_bytes[4] == 0x00) { // valid VCP code // The interpretation for most VCP codes: int max_val = (ddc_response_bytes[7] << 8) + ddc_response_bytes[8]; int cur_val = (ddc_response_bytes[9] << 8) + ddc_response_bytes[10]; printf("(%s) cur_val = %d, max_val = %d \n", __func__, cur_val, max_val ); } else if (ddc_response_bytes[4] == 0x01) { // unsupported VCP code printf("(%s) Unspported VCP code: 0x%02x\n", __func__ , vcp_feature_code); } else { printf("(%s) Unexpected value in supported VCP code field: 0x%02x \n", __func__, ddc_response_bytes[4] ); response_ok = false; } } rc = 0; if (!response_ok) { // printf("(%s) Unexpected Get VCP response: %s \n", __func__, hexstring(ddc_response_bytes+1, sizeof(ddc_response_bytes)-1) );; rc = -1; } close(fh); return rc; } void demo_p2411_problem(int busno) { int tryct = 10; unsigned char vcp_codes[] = {0x10, // Luminosity 0x12, // Contrast 0x15}; // invalid int try_ndx, code_ndx = 0; for (code_ndx=0; code_ndx < sizeof(vcp_codes); code_ndx++){ for (try_ndx=0;try_ndx < tryct; try_ndx++) { single_getvcp_call(busno, vcp_codes[code_ndx]); } } } void probe_get_luminosity(int busno, char * write_mode, char * read_mode) { printf("\nReading luminosity for bus %d, write_mode=%s, read_mode=%s\n", busno, write_mode, read_mode); int rc; // int request_packet_size; int file; Byte luminosity_op_code = 0x10; if (!i2c_verify_functions_supported(busno, write_mode, read_mode)) return; DDC_Packet * request_packet_ptr = NULL; DDC_Packet * response_packet_ptr = NULL; request_packet_ptr = create_ddc_getvcp_request_packet(luminosity_op_code, "probe_get_luminosity"); // printf("(%s) create_ddc_getvcp_request_packet returned rc=%d, packet_ptr=%p\n", __func__, rc, request_packet_ptr); // dump_packet(request_packet_ptr); file = i2c_open_bus(busno, CALLOPT_ERR_MSG); if (file < 0) { return; } rc = i2c_set_addr(file, 0x37, CALLOPT_ERR_MSG); if (rc < 0) { free_ddc_packet(request_packet_ptr); goto bye; } assert(rc == 0); // CALLOPT_ERR_ABORT was set // usleep(DEFAULT_TIMEOUT); sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); printf("(%s) calling perform_write()\n", __func__); set_i2c_write_mode(write_mode); rc = perform_i2c_write2( file, get_packet_len(request_packet_ptr)-1, get_packet_start(request_packet_ptr)+1, DDC_TIMEOUT_USE_DEFAULT); // rc = perform_i2c_write(file, write_mode, get_packet_len(request_packet_ptr)-1, get_packet_start(request_packet_ptr)+1); free_ddc_packet(request_packet_ptr); if (rc >= 0) { Byte * readbuf = (Byte *)calloc(sizeof(unsigned char),256); // Byte cmd_byte = 0x6e; set_i2c_read_mode(read_mode); rc = perform_i2c_read2(file, 20, readbuf, DDC_TIMEOUT_USE_DEFAULT); // rc = perform_i2c_read(file, read_mode, 20, readbuf); if (rc >= 0) { hex_dump(readbuf, rc); printf("(%s) wolf 5\n", __func__); int rc2 = create_ddc_getvcp_response_packet( readbuf, 20, luminosity_op_code, "probe_get_luminosity result", &response_packet_ptr); printf("(%s) create_ddc_getvcp_response_packet() returned %d\n", __func__, rc2); if (rc2 == 0) { Parsed_Nontable_Vcp_Response * interpretation_ptr = NULL; rc2 = get_interpreted_vcp_code(response_packet_ptr, false, &interpretation_ptr); if (rc2 == 0) report_interpreted_nontable_vcp_response(interpretation_ptr, 0); free_ddc_packet(response_packet_ptr); } } // read_ok } // write_ok bye: close(file); } void get_luminosity_sample_code(int busno) { printf("(%s) Starting \n", __func__ ); char * writefunc = "write"; // writefunc = "i2c_smbus_write_i2c_block_data"; char * readfunc = "read"; // readfunc = "i2c_smbus_read_i2c_block_data"; DDC_Packet * response_packet_ptr = NULL; // Byte luminosity_op_code = 0x10; int rc; char devname[12]; snprintf(devname, 11, "/dev/i2c-%d", busno); int fh = open(devname, O_NONBLOCK|O_RDWR); if (fh < 0) { perror("Unable to open device"); return; } rc = ioctl(fh, I2C_SLAVE, 0x37); if (rc < 0) { perror("ioctl(I2C_SLAVE, 0x37) failed"); close(fh); return; } // try a read: unsigned char * readbuf = calloc(sizeof(unsigned char), 256); rc = read(fh, readbuf+1, 11); if (rc < 0) { printf("(%s) Initial read() returned %d, errno=%s. Terminating execution\n", __func__, rc, linux_errno_desc(errno) ); close(fh); exit(1); } printf("(%s) Initial read succeeded\n", __func__); unsigned char zeroBytes[4] = {0}; // 0x00; rc = write(fh, &zeroBytes[0], 1); // succeeds if <= 2 bytes, fails if >= 3 if (rc < 0) { printf("(%s) Bus reset failed. rc=%d, errno=%s. Terminating execution.\n", __func__, rc, linux_errno_desc(errno) ); exit(1); } printf("(%s) Initial write succeeded\n", __func__); unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command 0x10, // Luminosity feature code 0x00, // checksum, to be set }; ddc_cmd_bytes[5] = ddc_checksum(ddc_cmd_bytes, 5, false); // calculate DDC checksum on all bytes assert(ddc_cmd_bytes[5] == 0xac); // rc = 0; if (streq(writefunc,"write")) rc = write(fh, ddc_cmd_bytes+1, sizeof(ddc_cmd_bytes)-1); else #ifdef WONT_COMPILE_ON_FEDORA rc = i2c_smbus_write_i2c_block_data(fh, ddc_cmd_bytes[1], sizeof(ddc_cmd_bytes)-2, ddc_cmd_bytes+2); #endif rc = -1; if (rc < 0) { printf("(%s) Error %s(), returned %d, errno=%s. Terminating execution.\n", __func__, writefunc, rc, linux_errno_desc(errno)); exit(1); } printf("(%s) %s() returned %d \n", __func__, writefunc, rc ); usleep(500000); #ifdef WORKS if (rc >= 0) { Byte * readbuf = (Byte *)calloc(sizeof(unsigned char),256); // Byte cmd_byte = 0x6e; printf("(%s) callling call_read \n", __func__ ); rc = call_read(fh, readbuf, 32, true); if (rc < 0) { printf("(%s) call_read returned %d, errno=%d. Terminating execution \n", __func__, rc, errno ); exit(1); } printf("(%s) call_read() returned %d \n", __func__, rc ); if (rc >= 0) { hex_dump(readbuf, rc); int rc2 = create_ddc_getvcp_response_packet( readbuf, 32, luminosity_op_code, "get_vcp:response packet", &response_packet_ptr); printf("(%s) create_ddc_getvcp_response_packet() returned %d\n", __func__, rc2); if (rc2 == 0) { Parsed_Nontable_Vcp_Response * interpretation_ptr = NULL; rc2 = get_interpreted_vcp_code(response_packet_ptr, false, &interpretation_ptr); if (rc2 == 0) { printf("(%s) interpretation_ptr=%p\n", __func__, interpretation_ptr); report_interpreted_nontable_vcp_response(interpretation_ptr); } // read_ok = true; } } // read_ok } // write_ok #endif if (rc >= 0) { if (streq(readfunc, "read")) rc = read(fh, readbuf+1, 11); else { #ifdef OLD unsigned char cmd_byte = 0x00; // apparently ignored, can be anything rc = i2c_smbus_read_i2c_block_data(fh, cmd_byte, 11, readbuf+1); #endif rc = -1; } if (rc < 0) { printf("(%s) %s() returned %d, errno=%s. Terminating execution\n", __func__, readfunc, rc, linux_errno_desc(errno) ); close(fh); exit(1); } printf("(%s) %s() returned %d\n", __func__, readfunc, rc); hex_dump(readbuf,1+rc); assert(readbuf[1] == 0x6e); int ddc_data_length = readbuf[2] & 0x7f; assert(ddc_data_length == 8); assert(readbuf[3] == 0x02); // get feature response readbuf[0] = 0x50; // for calculating DDC checksum unsigned char calculated_checksum = ddc_checksum(readbuf, 11, false); if (readbuf[11] != calculated_checksum) { printf("(%s) Unexpected checksum. actual=0x%02x, calculated=0x%02x \n", __func__, readbuf[11], calculated_checksum ); } int max_val = (readbuf[7] << 8) + readbuf[8]; int cur_val = (readbuf[9] << 8) + readbuf[10]; printf("(%s) cur_val = %d, max_val = %d \n", __func__, cur_val, max_val ); } close(fh); if (response_packet_ptr) free_ddc_packet(response_packet_ptr); free(readbuf); } void get_luminosity_using_single_ioctl(int busno) { printf("(%s) Starting \n", __func__ ); bool debug = true; // Byte luminosity_op_code = 0x10; int rc; int errsv; // char * devname = malloc(12); char devname[12]; snprintf(devname, 11, "/dev/i2c-%d", busno); int fh = open(devname, O_RDWR); if (fh < 0) { perror("Unable to open device"); return; } rc = ioctl(fh, I2C_SLAVE, 0x37); if (rc < 0) { perror("ioctl(I2C_SLAVE, 0x37) failed"); close(fh); return; } unsigned char readbuf[256]; unsigned char zeroByte = 0x00; unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command 0x10, // Luminosity feature code 0x00, // checksum, to be set }; ddc_cmd_bytes[5] = ddc_checksum(ddc_cmd_bytes, 5, false); // calculate DDC checksum on all bytes assert(ddc_cmd_bytes[5] == 0xac); #ifdef FOR_REFERENCE /* * I2C Message - used for pure i2c transaction, also from /dev interface */ struct i2c_msg { __u16 addr; /* slave address */ unsigned short flags; #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ #define I2C_M_RD 0x01 #define I2C_M_NOSTART 0x4000 #define I2C_M_REV_DIR_ADDR 0x2000 #define I2C_M_IGNORE_NAK 0x1000 #define I2C_M_NO_RD_ACK 0x0800 short len; /* msg length */ char *buf; /* pointer to msg data */ }; #endif // rc = 0; // NB no usleeps() between write and read - should not work struct i2c_msg messages[3]; struct i2c_rdwr_ioctl_data msgset; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpointer-sign" messages[0].addr = 0x37; messages[0].flags = 0; messages[0].len = 1; messages[0].buf = (char *) &zeroByte; messages[1].addr = 0x37; messages[1].flags = 0; messages[1].len = sizeof(ddc_cmd_bytes)-1; messages[1].buf = (char *) ddc_cmd_bytes+1; messages[2].addr = 0x37; messages[2].flags = I2C_M_RD; messages[2].len = 12; messages[2].buf = (char *) readbuf+1; #pragma GCC diagnostic pop msgset.msgs = messages; msgset.nmsgs = 3; rc = ioctl(fh, I2C_RDWR, &msgset); errsv = errno; if (debug) printf("(%s) ioctl() returned %d, errno=%s\n", __func__, rc, linux_errno_desc(errsv) ); if (rc >= 0) { hex_dump(readbuf,12); assert(readbuf[1] == 0x6e); int ddc_data_length = readbuf[2] & 0x7f; assert(ddc_data_length == 8); assert(readbuf[3] == 0x02); // get feature response readbuf[0] = 0x50; // for calculating DDC checksum unsigned char calculated_checksum = ddc_checksum(readbuf, 11, false); if (readbuf[11] != calculated_checksum) { printf("(%s) Unexpected checksum. actual=0x%02x, calculated=0x%02x \n", __func__, readbuf[11], calculated_checksum ); } int max_val = (readbuf[7] << 8) + readbuf[8]; int cur_val = (readbuf[9] << 8) + readbuf[10]; printf("(%s) cur_val = %d, max_val = %d \n", __func__, cur_val, max_val ); } close(fh); } void demo_nvidia_bug_sample_code(int busno) { printf("\n(%s) Starting \n", __func__ ); char * writefunc = "write"; // writefunc = "i2c_smbus_write_i2c_block_data"; // char * readfunc = "read"; // readfunc = "i2c_smbus_read_i2c_block_data"; int rc; char devname[12]; snprintf(devname, 11, "/dev/i2c-%d", busno); int fh = open(devname, O_NONBLOCK|O_RDWR); if (fh < 0) { perror("Unable to open device"); return; } rc = ioctl(fh, I2C_SLAVE, 0x37); if (rc < 0) { printf("(%s) ioctl(I2C_SLAVE, 0x37) returned %d, errno=%s. Terminating execution \n", __func__, rc, linux_errno_desc(errno) ); close(fh); exit(1); } // try a read, it succeeds unsigned char * readbuf = calloc(sizeof(unsigned char), 256); rc = read(fh, readbuf+1, 1); if (rc < 0) { printf("(%s) read() returned %d, errno=%s. Terminating execution \n", __func__, rc, linux_errno_desc(errno) ); close(fh); exit(1); } printf("(%s) read succeeded. Address 0x37 active on %s\n", __func__, devname); unsigned char zeroBytes[5] = {0}; // 0x00; unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command 0x10, // Luminosity feature code 0x00, // checksum, to be set }; ddc_cmd_bytes[5] = ddc_checksum(ddc_cmd_bytes, 5, false); // calculate DDC checksum on all bytes assert(ddc_cmd_bytes[5] == 0xac); printf("\n(%s) Try writing fragments of DDC request string...\n", __func__ ); int bytect; for (bytect=sizeof(ddc_cmd_bytes)-1; bytect > 0; bytect--) { usleep(500000); errno = 0; rc = write(fh, ddc_cmd_bytes+1, bytect); if (rc == bytect) printf("(%s) bytect=%d, %s() returned rc=%d as expected\n", __func__, bytect, writefunc, rc); else if (rc < 0) printf("(%s) bytect=%d, Error. %s(), returned %d, errno=%s\n", __func__, bytect, writefunc, rc, linux_errno_desc(errno)); else printf("(%s) bytect=%d, Truly weird. rc=%d\n", __func__, bytect, rc); } printf("\n(%s) Try writing null bytes...\n", __func__ ); for (bytect=sizeof(zeroBytes); bytect > 0; bytect--) { usleep(500000); errno = 0; rc = write(fh, zeroBytes, bytect); if (rc == bytect) printf("(%s) bytect=%d, %s() returned rc=%d as expected\n", __func__, bytect, writefunc, rc); else if (rc < 0) printf("(%s) bytect=%d, Error. %s(), returned %d, errno=%s\n", __func__, bytect, writefunc, rc, linux_errno_desc(errno)); else printf("(%s) bytect=%d, Truly weird. rc=%d\n", __func__, bytect, rc); } free(readbuf); close(fh); } void test_get_luminosity_for_bus(int busno) { printf("\n========== Probing get luminosity =============\n"); // // banner blackrock probe_get_luminosity(busno, "write", "read"); // bad data ok // probe_get_luminosity(busno, "write", "i2c_smbus_read_byte"); // probe_get_luminosity(busno, "write", "i2c_smbus_read_byte_data"); // probe_get_luminosity(busno, "write", "i2c_smbus_read_block_data"); probe_get_luminosity(busno, "write", "i2c_smbus_read_i2c_block_data"); // EINVAL // probe_get_luminosity(busno, "i2c_smbus_write_byte", "read"); // probe_get_luminosity(busno, "i2c_smbus_write_byte", "i2c_smbus_read_i2c_block_data"); // probe_get_luminosity(busno, "i2c_smbus_write_byte_data", "read"); // probe_get_luminosity(busno, "i2c_smbus_write_byte_data", "i2c_smbus_read_i2c_block_data"); probe_get_luminosity(busno, "i2c_smbus_write_i2c_block_data", "read"); // EINVAL ok probe_get_luminosity(busno, "i2c_smbus_write_i2c_block_data", "i2c_smbus_read_i2c_block_data"); // EINVAL probe_get_luminosity(busno, "ioctl_write", "read"); probe_get_luminosity(busno, "ioctl_write", "ioctl_read"); probe_get_luminosity(busno, "write", "ioctl_read"); } ddcutil-0.8.6/src/test/ddc/ddc_capabilities_tests.h0000644000175000001440000000231213230445447017234 00000000000000/* ddc_capabilities_tests.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_CAPABILITIES_TESTS_H_ #define DDC_CAPABILITIES_TESTS_H_ #include // Exploratory programming and tests void probe_get_capabilities(int busno, char* write_mode, char* read_mode, Byte addr); void test_get_capabilities_for_bus(int busno); #endif /* DDC_CAPABILITIES_TESTS_H_ */ ddcutil-0.8.6/src/test/ddc/ddc_vcp_tests.h0000644000175000001440000000246113230445447015400 00000000000000/* ddc_vcp_tests.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_VCP_TESTS_H_ #define DDC_VCP_TESTS_H_ #include "test/ddc/ddc_vcp_tests.h" void get_luminosity_sample_code(int busno); void demo_nvidia_bug_sample_code(int busno); void get_luminosity_using_single_ioctl(int busno); void probe_get_luminosity(int busno, char * write_mode, char * read_mode); void test_get_luminosity_for_bus(int busno); void demo_p2411_problem(int busno); #endif /* DDC_VCP_TESTS_H_ */ ddcutil-0.8.6/src/test/i2c/0000755000175000001440000000000013230445447012403 500000000000000ddcutil-0.8.6/src/test/i2c/i2c_edid_tests.c0000664000175000001440000001734113213470020015345 00000000000000/* i2c_edid_tests.c * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include // usleep #include "util/string_util.h" #include "base/core.h" #include "base/parms.h" #include "base/sleep.h" #include "i2c/wrap_i2c-dev.h" #include "i2c/i2c_bus_core.h" #include "test/i2c/i2c_io_old.h" #include "test/i2c/i2c_edid_tests.h" // Test reading EDID using essentially the code in libxcm. void read_edid_ala_libxcm(int busno) { printf("\nReading EDID for bus %d using XcmDDC method\n", busno); int fd; char command[128] = {0}; int rc; Byte* edidbuf; fd = i2c_open_bus(busno, CALLOPT_ERR_MSG); if (fd < 0) return; rc = i2c_set_addr(fd, 0x50, CALLOPT_ERR_MSG); if (rc < 0) goto bye; // usleep(TIMEOUT); sleep_millis_with_trace(100, __func__, "before write()"); rc = write(fd, &command, 1); if (rc != 1) { printf("(%s) write returned %d\n", __func__, rc); puts(" "); } else { // usleep(TIMEOUT); sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); edidbuf = calloc(256, sizeof(Byte) ); rc = read(fd, edidbuf, 128); printf("(%s) read() returned %d\n", __func__, rc); if (rc >= 0) { hex_dump(edidbuf, rc); } free(edidbuf); } bye: close(fd); } // Test reading EDID using various methods. void probe_read_edid(int busno, char * write_mode, char * read_mode) { printf("\n(%s) Reading EDID for bus %d, write_mode=%s, read_mode=%s\n", __func__, busno, write_mode, read_mode); int rc; Byte* edidbuf; int errsv; int fd; // bool debug = true; Byte cmd_byte = 0xFF; // for cases where cmd byte must be passed fd = i2c_open_bus(busno, CALLOPT_ERR_MSG); if (fd < 0) return; rc = i2c_set_addr(fd, 0x50, CALLOPT_ERR_MSG); if (rc < 0) goto bye; // usleep(TIMEOUT); sleep_millis_with_trace(DDC_TIMEOUT_MILLIS_DEFAULT, __func__, NULL); Byte byte_to_write = 0x00; set_i2c_write_mode(write_mode); rc = perform_i2c_write2(fd, 1, &byte_to_write, DDC_TIMEOUT_USE_DEFAULT); // rc = perform_i2c_write(fd, write_mode, 1, &byte_to_write); if (rc == 0) { edidbuf = calloc(256, sizeof(Byte)); if ( streq(read_mode,"read") ) { rc = do_i2c_file_read(fd, 128, edidbuf, DDC_TIMEOUT_USE_DEFAULT); // Byte cmd_byte = 0x00; // ignored for call_read // rc = perform_read(file, "read", 128, edidbuf, cmd_byte); } else if ( streq(read_mode, "i2c_smbus_read_block_data") ) { printf("Reading edid using i2c_smbus_read_block_data\n"); errno = 0; #ifdef OLD rc = i2c_smbus_read_block_data(fd, (unsigned char) 0x00, edidbuf); #endif rc = -1; errsv = errno; printf("i2c_smbus_read_block_data returned %d, errno=%d\n", rc, errsv); } else if ( streq(read_mode,"i2c_smbus_read_byte") ) { int ndx; char byte; printf("Reading edid using i2c_smbus_read_byte()\n"); for(ndx=0; ndx<128;ndx++){ errno = 0; #ifdef OLD // not defined on Fedora rc = i2c_smbus_read_byte(fd); #endif rc = -1; errsv = errno; if (errno != 0 || rc == -1) printf("i2c_smbus_read_byte returned %d (%x), errno=%d\n", rc, rc, errsv); if (rc == -1) break; byte = rc & 0xff; edidbuf[ndx] = byte; } printf("Reading edid using i2c_smbus_read_byte() returning buffer of length %d\n", ndx); rc = ndx; } else if ( streq(read_mode, "i2c_smbus_read_byte_data") ) { int ndx; char byte; printf("Reading edid using i2c_smbus_read_byte_data(), cmd=0x%02x\n", cmd_byte); for (ndx=0; ndx<128;ndx++){ errno = 0; #ifdef OLD rc = i2c_smbus_read_byte_data(fd, cmd_byte); #endif rc = -1; // hack errsv = errno; if (errno != 0 || rc == -1) { printf("i2c_smbus_read_byte_data returned %d (0x%x), errno=%d\n", rc, rc, errsv); if (rc == -1) break; byte = rc & 0xff; edidbuf[ndx] = byte; } printf("Reading edid using i2c_smbus_read_byte_data() returning buffer of length %d\n", ndx); rc = ndx; } } else if ( streq(read_mode, "i2c_smbus_read_i2c_block_data") ) { #ifdef WONT_COMPILE_ON_FEDORA rc = do_i2c_smbus_read_i2c_block_data(fd, 32, edidbuf, DDC_TIMEOUT_USE_DEFAULT); #endif rc = -1; // hack } else { printf("Invalid read_mode: %s", write_mode); rc = -1; } if (rc > 0) { hex_dump(edidbuf,rc); } free(edidbuf); } bye: close(fd); } void test_read_edid_ala_libxcm() { read_edid_ala_libxcm(0); read_edid_ala_libxcm(1); read_edid_ala_libxcm(2); read_edid_ala_libxcm(3); read_edid_ala_libxcm(4); read_edid_ala_libxcm(5); read_edid_ala_libxcm(6); } void test_read_edid_for_bus(int busno) { // read_edid_ala_libxcm(0); // read_edid_ala_libxcm(3); // busno, write_mode, read_mode probe_read_edid(busno, "write", "read"); // works probe_read_edid(busno, "write", "i2c_smbus_read_block_data"); // fails probe_read_edid(busno, "i2c_smbus_write_byte", "read"); // works probe_read_edid(busno, "i2c_smbus_write_byte", "read"); // works probe_read_edid(busno, "i2c_smbus_write_byte", "i2c_smbus_read_block_data"); // fails: i2c_smbus_read_block_data unsupported probe_read_edid(busno, "i2c_smbus_write_byte", "i2c_smbus_read_byte"); // works probe_read_edid(busno, "i2c_smbus_write_byte", "i2c_smbus_read_byte"); // works probe_read_edid(busno, "i2c_smbus_write_byte", "i2c_smbus_read_byte_data"); // fails, all 0 probe_read_edid(busno, "None", "read"); // works probe_read_edid(busno, "None", "read"); // fails, all FF => write reqd before read probe_read_edid(busno, "None", "i2c_smbus_read_byte"); // works probe_read_edid(busno, "None", "i2c_smbus_read_byte"); // fails => initializer necessary when reading with i2c_smbus_read_byte probe_read_edid(busno, "None", "i2c_smbus_read_byte_data"); // fails all 0 probe_read_edid(busno, "i2c_smbus_write_byte", "i2c_smbus_read_i2c_block_data"); // fails: i2c_smbus_read_i2c_block_data() unsupported probe_read_edid(busno, "None", "i2c_smbus_read_i2c_block_data"); // rails: i2c_smbus_read_i2c_block_data() unsupported } ddcutil-0.8.6/src/test/i2c/i2c_io_old.c0000644000175000001440000002423713101546540014472 00000000000000/* i2c_io.c * * A framework for exercising the various calls that read and * write to the i2c bus, designed for use in test code. * * In normal code, set_i2c_write_mode() and set_i2c_read_mode() * can be called once to specify the write and read modes to * be used, and then perform_i2c_write2() and perform_i2c_read2() * are called without specifying the write or read mode each time. * * Since this is a framework for exploratory programming, the mode * identifiers are simply strings. * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include #include #include #include "util/string_util.h" #include "base/ddc_errno.h" #include "base/ddc_packets.h" #include "base/execution_stats.h" #include "base/linux_errno.h" #include "base/parms.h" #include "base/sleep.h" #include "base/status_code_mgt.h" #include "i2c/i2c_base_io.h" #include "test/i2c/i2c_io_old.h" // TraceControl i2c_write_trace_level = NEVER; // TraceControl i2c_read_trace_level = NEVER; static char * write_mode = DEFAULT_I2C_WRITE_MODE; static char * read_mode = DEFAULT_I2C_READ_MODE; void set_i2c_write_mode(char* mode) { write_mode = mode; } void set_i2c_read_mode(char* mode) { read_mode = mode; } // // Write to I2C bus // /* To make the various methods of reading and writing the I2C bus * interchangeable, these calls are encapsulated in functions whose * signatures are compatible with I2c_Writer and I2c_Reader. The * encapsulating functions have names of the form xxx_writer and xxx_reader. * * The functions are: * * I2C_Writer: * write_writer * ioctl_writer * i2c_smbus_write_i2c_block_data_writer * * I2C_Reader: * read_reader * ioctl_reader * i2c_smbus_read_i2c_block_data_reader * * The I2C_Writer (resp I2C_Reader) functions can then be invoked by * calling call_i2c_writer (resp call_i2c_reader) passing a function * pointer as a parameter. I2C_Writer and I2C_Reader perform common * services including tracing, timing, and sleeping after writes. * * The do_xxx variants call the corresponding base functions, but do * so indirectly through call_i2c_writer() and call_i2c_reader() in * order to gain the common services. For example, do_i2c_ioctl_write() * wraps ioctl_writer(). * * perform_i2c_write()/perform_i2c_read() also allow for invoking any of * the base functions. Whereas call_i2c_writer()/call_i2c_reader() take * function pointers as parameters, perform_i2c_xxx() are passed a string * name indicating the function to be chosen. perform_i2c_xxx() look up * the function pointer from the string name and invoke call_i2c_writer() * or call_i2c_reader(). The makes it easy for test frameworks to * dynamically choose which base read/write mechanism to choose. * * perform_i2c_write2()/perform_i2c_read2() are similar to perform_is2_write()/ * perform_i2c_read(), but instead determine the base function to be used * from global settings set by set_i2c_write_mode()/set_i2c_read_mode(). * */ Public_Status_Code call_i2c_writer( I2C_Writer writer, char * writer_name, int fh, int bytect, Byte * bytes_to_write, int sleep_millisec) { // bool debug = i2c_write_trace_level; bool debug = false; if (debug) { char * hs = hexstring(bytes_to_write, bytect); printf("(%s) writer=|%s|, bytes_to_write=%s\n", __func__, writer_name, hs); free(hs); } Public_Status_Code rc; RECORD_IO_EVENT(IE_WRITE, ( rc = writer(fh, bytect, bytes_to_write ) ) ); if (debug) printf("(%s) writer() function returned %d\n", __func__, rc); assert (rc <= 0); if (rc == 0) { if (sleep_millisec == DDC_TIMEOUT_USE_DEFAULT) sleep_millisec = DDC_TIMEOUT_MILLIS_DEFAULT; if (sleep_millisec != DDC_TIMEOUT_NONE) sleep_millis_with_trace(sleep_millisec, __func__, "after write"); } // rc = modulate_base_errno_ddc_to_global(rc); if (debug) printf("(%s) Returning rc=%d\n", __func__, rc); return rc; } Public_Status_Code call_i2c_reader( I2C_Reader reader, char * reader_name, int fh, int bytect, Byte * readbuf, int sleep_millisec) { // bool debug = i2c_write_trace_level; bool debug = false; if (debug) printf("(%s) reader=%s, bytect=%d\n", __func__, reader_name, bytect); Public_Status_Code rc; RECORD_IO_EVENT( IE_READ, ( rc = reader(fh, bytect, readbuf) ) ); if (debug) printf("(%s) reader() function returned %d\n", __func__, rc); assert (rc <= 0); if (rc == 0) { if (sleep_millisec == DDC_TIMEOUT_USE_DEFAULT) sleep_millisec = DDC_TIMEOUT_MILLIS_DEFAULT; if (sleep_millisec != DDC_TIMEOUT_NONE) sleep_millis_with_trace(sleep_millisec, __func__, "after read"); } // rc = modulate_base_errno_ddc_to_global(rc); if (debug ) printf("(%s) Returning rc=%d\n",__func__, rc); return rc; } Public_Status_Code do_i2c_file_write(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec) { return call_i2c_writer(write_writer, "write_writer", fh, bytect, bytes_to_write, sleep_millisec); } #ifdef WONT_COMPILE_ON_FEDORA Public_Status_Code do_i2c_smbus_write_i2c_block_data(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec) { return call_i2c_writer( i2c_smbus_write_i2c_block_data_writer, "i2c_smbus_write_i2c_block_data_writer", fh, bytect, bytes_to_write, sleep_millisec); } #endif Public_Status_Code do_i2c_ioctl_write(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec) { return call_i2c_writer(ioctl_writer, "ioctl_writer", fh, bytect, bytes_to_write, sleep_millisec); } Public_Status_Code do_i2c_file_read(int fh, int bytect, Byte * readbuf, int sleep_millisec) { return call_i2c_reader(read_reader, "read_reader", fh, bytect, readbuf, sleep_millisec); } #ifdef WONT_COMPILE_ON_FEDORA Public_Status_Code do_i2c_smbus_read_i2c_block_data(int fh, int bytect, Byte * readbuf, int sleep_millisec) { return call_i2c_reader( i2c_smbus_read_i2c_block_data_reader, "i2c_smbus_read_i2c_block_data_reader", fh, bytect, readbuf, sleep_millisec); } #endif Public_Status_Code do_i2c_ioctl_read(int fh, int bytect, Byte * readbuf, int sleep_millisec) { return call_i2c_reader(ioctl_reader, "ioctl_reader", fh, bytect, readbuf, sleep_millisec); } Public_Status_Code perform_i2c_write(int fh, char * write_mode, int bytect, Byte * bytes_to_write, int sleep_millisec) { // bool debug = i2c_write_trace_level; bool debug = false; if (debug) printf("(%s) Starting. write_mode=%s\n", __func__, write_mode); int rc = 0; I2C_Writer writer = NULL; if ( streq(write_mode, "write") ) writer = write_writer; #ifdef WONT_COMPILE_ON_FEDORA else if ( streq(write_mode, "i2c_smbus_write_i2c_block_data")) writer = i2c_smbus_write_i2c_block_data_writer; #endif else if ( streq(write_mode, "ioctl_write")) writer = ioctl_writer; if (writer) { rc = call_i2c_writer(writer, write_mode, fh, bytect, bytes_to_write, sleep_millisec); } else { printf("(%s) Unsupported write mode: %s\n", __func__, write_mode); rc = -DDCRC_INVALID_MODE; } if (debug) printf("(%s) Returning %d\n", __func__, rc); return rc; } Public_Status_Code perform_i2c_write2(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec) { return perform_i2c_write(fh, write_mode, bytect, bytes_to_write, sleep_millisec); } // Returns: -errno, DDCRC_BAD_BYTECT, DDCRC_INVALID_MODE (if invalid read mode) Public_Status_Code perform_i2c_read(int fh, char * read_mode, int bytect, Byte * readbuf, int sleep_millisec) { // bool debug = i2c_read_trace_level; bool debug = false; if (debug) printf("(%s) Starting. read_mode=%s\n", __func__, read_mode); int rc; I2C_Reader reader = NULL; if ( streq(read_mode, "read") ) reader = read_reader; #ifdef WONT_COMPILE_ON_FEDORA else if ( streq(read_mode, "i2c_smbus_read_i2c_block_data")) reader = i2c_smbus_read_i2c_block_data_reader; #endif else if ( streq(read_mode, "ioctl_read")) reader = ioctl_reader; // assert(reader); if (reader) { rc = call_i2c_reader(reader, read_mode, fh, bytect, readbuf, sleep_millisec); } else { printf("(%s) Unsupported read mode: %s\n", __func__, read_mode); rc = DDCRC_INVALID_MODE; } if (debug ) printf("(%s) Returning %d\n", __func__, rc); return rc; } /* Performs I2C read using the default read function. * * Arguments: * fh file handle for open I2C device * bytect number of bytes to read * readbuf address at which to store bytes * sleep_milliseconds milliseconds to sleep after read * may be DDC_TIMEOUT_USE_DEFAULT or DDC_TIMEOUT_NONE * * Returns: * 9 if success * modulated error number if error */ Public_Status_Code perform_i2c_read2(int fh, int bytect, Byte * readbuf, int sleep_millisec) { return perform_i2c_read(fh, read_mode, bytect, readbuf, sleep_millisec); } ddcutil-0.8.6/src/test/i2c/i2c_edid_tests.h0000644000175000001440000000241513230445447015362 00000000000000/* i2c_edid_tests.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef I2C_EDID_TESTS_H_ #define I2C_EDID_TESTS_H_ // Exploratory programming functions. // Just try to read the EDID and display the bytes. Nothing returned. void read_edid_ala_libxcm(int busno); void probe_read_edid(int busno, char * write_mode, char * read_mode); void test_read_edid_ala_libxcm(); void test_read_edid_for_bus(int busno); #endif /* I2C_EDID_TESTS_H_ */ ddcutil-0.8.6/src/test/i2c/i2c_io_old.h0000644000175000001440000000543513230445447014505 00000000000000/* i2c_io_old.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef PROBEI2C_I2C_IO #define PROBEI2C_I2C_IO #include #include "base/core.h" #include "base/execution_stats.h" #include "base/status_code_mgt.h" #include "i2c/i2c_base_io.h" // was in common.h #define MAX_I2C_MESSAGE_SIZE 131 // 127 + 4; void set_i2c_write_mode(char* mode); void set_i2c_read_mode(char* mode); Status_Errno_DDC call_i2c_writer( I2C_Writer writer, char * writer_name, int fh, int bytect, Byte * bytes_to_write, int sleep_millisec) ; Status_Errno_DDC call_i2c_reader( I2C_Reader reader, char * reader_name, int fh, int bytect, Byte * readbuf, int sleep_millisec); // // Write to I2C bus // Status_Errno_DDC do_i2c_file_write(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec); Status_Errno_DDC do_i2c_smbus_write_i2c_block_data(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec); Status_Errno_DDC do_i2c_ioctl_write(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec); Status_Errno_DDC perform_i2c_write(int fh, char * write_mode, int bytect, Byte * bytes_to_write, int sleep_millisec); Status_Errno_DDC perform_i2c_write2(int fh, int bytect, Byte * bytes_to_write, int sleep_millisec); // // Read from I2C bus // Status_Errno_DDC do_i2c_file_read(int fh, int bytect, Byte * readbuf, int sleep_millisec); Status_Errno_DDC do_i2c_smbus_read_i2c_block_data(int fh, int bytect, Byte * readbuf, int sleep_millisec); Status_Errno_DDC do_i2c_ioctl_read(int fh, int bytect, Byte * readbuf, int sleep_millisec); Status_Errno_DDC perform_i2c_read( int fh, char * read_mode, int bytect, Byte * readbuf, int sleep_millisec ); Status_Errno_DDC perform_i2c_read2(int fh, int bytect, Byte * readbuf, int sleep_millisec); #endif ddcutil-0.8.6/src/test/Makefile.am0000644000175000001440000000117213216171011013666 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public if HAVE_ADL_COND AM_CPPFLAGS += \ -I@ADL_HEADER_DIR@ endif AM_CFLAGS = -Wall -Werror if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand if INCLUDE_TESTCASES_COND # Intermediate library noinst_LTLIBRARIES = libtestcases.la libtestcases_la_SOURCES = \ ddc/ddc_capabilities_tests.c \ ddc/ddc_vcp_tests.c \ i2c/i2c_edid_tests.c \ i2c/i2c_io_old.c \ testcase_table.c \ testcases.c if HAVE_ADL_COND libtestcases_la_SOURCES += \ adl/adl_tests.c \ adl/adl_from_sample.c endif endif ddcutil-0.8.6/src/test/Makefile.in0000644000175000001440000006003013230171237013703 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @HAVE_ADL_COND_TRUE@am__append_1 = \ @HAVE_ADL_COND_TRUE@ -I@ADL_HEADER_DIR@ @ENABLE_CALLGRAPH_COND_TRUE@am__append_2 = -fdump-rtl-expand @HAVE_ADL_COND_TRUE@@INCLUDE_TESTCASES_COND_TRUE@am__append_3 = \ @HAVE_ADL_COND_TRUE@@INCLUDE_TESTCASES_COND_TRUE@adl/adl_tests.c \ @HAVE_ADL_COND_TRUE@@INCLUDE_TESTCASES_COND_TRUE@adl/adl_from_sample.c subdir = src/test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libtestcases_la_LIBADD = am__libtestcases_la_SOURCES_DIST = ddc/ddc_capabilities_tests.c \ ddc/ddc_vcp_tests.c i2c/i2c_edid_tests.c i2c/i2c_io_old.c \ testcase_table.c testcases.c adl/adl_tests.c \ adl/adl_from_sample.c am__dirstamp = $(am__leading_dot)dirstamp @HAVE_ADL_COND_TRUE@@INCLUDE_TESTCASES_COND_TRUE@am__objects_1 = adl/adl_tests.lo \ @HAVE_ADL_COND_TRUE@@INCLUDE_TESTCASES_COND_TRUE@ adl/adl_from_sample.lo @INCLUDE_TESTCASES_COND_TRUE@am_libtestcases_la_OBJECTS = \ @INCLUDE_TESTCASES_COND_TRUE@ ddc/ddc_capabilities_tests.lo \ @INCLUDE_TESTCASES_COND_TRUE@ ddc/ddc_vcp_tests.lo \ @INCLUDE_TESTCASES_COND_TRUE@ i2c/i2c_edid_tests.lo \ @INCLUDE_TESTCASES_COND_TRUE@ i2c/i2c_io_old.lo \ @INCLUDE_TESTCASES_COND_TRUE@ testcase_table.lo testcases.lo \ @INCLUDE_TESTCASES_COND_TRUE@ $(am__objects_1) libtestcases_la_OBJECTS = $(am_libtestcases_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 = @INCLUDE_TESTCASES_COND_TRUE@am_libtestcases_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtestcases_la_SOURCES) DIST_SOURCES = $(am__libtestcases_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public $(am__append_1) AM_CFLAGS = -Wall -Werror $(am__append_2) CLEANFILES = \ *expand # Intermediate library @INCLUDE_TESTCASES_COND_TRUE@noinst_LTLIBRARIES = libtestcases.la @INCLUDE_TESTCASES_COND_TRUE@libtestcases_la_SOURCES = \ @INCLUDE_TESTCASES_COND_TRUE@ ddc/ddc_capabilities_tests.c \ @INCLUDE_TESTCASES_COND_TRUE@ ddc/ddc_vcp_tests.c \ @INCLUDE_TESTCASES_COND_TRUE@ i2c/i2c_edid_tests.c \ @INCLUDE_TESTCASES_COND_TRUE@ i2c/i2c_io_old.c testcase_table.c \ @INCLUDE_TESTCASES_COND_TRUE@ testcases.c $(am__append_3) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } ddc/$(am__dirstamp): @$(MKDIR_P) ddc @: > ddc/$(am__dirstamp) ddc/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) ddc/$(DEPDIR) @: > ddc/$(DEPDIR)/$(am__dirstamp) ddc/ddc_capabilities_tests.lo: ddc/$(am__dirstamp) \ ddc/$(DEPDIR)/$(am__dirstamp) ddc/ddc_vcp_tests.lo: ddc/$(am__dirstamp) \ ddc/$(DEPDIR)/$(am__dirstamp) i2c/$(am__dirstamp): @$(MKDIR_P) i2c @: > i2c/$(am__dirstamp) i2c/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) i2c/$(DEPDIR) @: > i2c/$(DEPDIR)/$(am__dirstamp) i2c/i2c_edid_tests.lo: i2c/$(am__dirstamp) \ i2c/$(DEPDIR)/$(am__dirstamp) i2c/i2c_io_old.lo: i2c/$(am__dirstamp) i2c/$(DEPDIR)/$(am__dirstamp) adl/$(am__dirstamp): @$(MKDIR_P) adl @: > adl/$(am__dirstamp) adl/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) adl/$(DEPDIR) @: > adl/$(DEPDIR)/$(am__dirstamp) adl/adl_tests.lo: adl/$(am__dirstamp) adl/$(DEPDIR)/$(am__dirstamp) adl/adl_from_sample.lo: adl/$(am__dirstamp) \ adl/$(DEPDIR)/$(am__dirstamp) libtestcases.la: $(libtestcases_la_OBJECTS) $(libtestcases_la_DEPENDENCIES) $(EXTRA_libtestcases_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libtestcases_la_rpath) $(libtestcases_la_OBJECTS) $(libtestcases_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f adl/*.$(OBJEXT) -rm -f adl/*.lo -rm -f ddc/*.$(OBJEXT) -rm -f ddc/*.lo -rm -f i2c/*.$(OBJEXT) -rm -f i2c/*.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcase_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcases.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl/$(DEPDIR)/adl_from_sample.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@adl/$(DEPDIR)/adl_tests.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ddc/$(DEPDIR)/ddc_capabilities_tests.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ddc/$(DEPDIR)/ddc_vcp_tests.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@i2c/$(DEPDIR)/i2c_edid_tests.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@i2c/$(DEPDIR)/i2c_io_old.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf adl/.libs adl/_libs -rm -rf ddc/.libs ddc/_libs -rm -rf i2c/.libs i2c/_libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f adl/$(DEPDIR)/$(am__dirstamp) -rm -f adl/$(am__dirstamp) -rm -f ddc/$(DEPDIR)/$(am__dirstamp) -rm -f ddc/$(am__dirstamp) -rm -f i2c/$(DEPDIR)/$(am__dirstamp) -rm -f i2c/$(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 \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) adl/$(DEPDIR) ddc/$(DEPDIR) i2c/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) adl/$(DEPDIR) ddc/$(DEPDIR) i2c/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: ddcutil-0.8.6/src/test/testcase_table.c0000644000175000001440000000405713216157245015002 00000000000000/* testcase_table.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include "ddc/ddc_capabilities_tests.h" #include "ddc/ddc_vcp_tests.h" #include "i2c/i2c_edid_tests.h" #ifdef HAVE_ADL #include "adl/adl_tests.h" #endif #include "testcase_table.h" Testcase_Descriptor testcase_catalog[] = { {"get_luminosity_sample_code", DisplayRefBus, NULL, get_luminosity_sample_code, NULL, NULL}, #ifdef HAVE_ADL {"adl_testmain", DisplayRefNone, adl_testmain, NULL, NULL, NULL}, {"diddleBrightness", DisplayRefAdl, NULL, NULL, diddle_adl_brightness, NULL}, {"exercise_ad_calls", DisplayRefAdl, NULL, NULL, exercise_ad_calls, NULL}, {"run_adapter_display_tests", DisplayRefNone, run_adapter_display_tests, NULL, NULL, NULL}, #endif {"get_luminosity_using_single_ioctl", DisplayRefBus, NULL, get_luminosity_using_single_ioctl, NULL, NULL}, {"demo_nvidia_bug_sample_code", DisplayRefBus, NULL, demo_nvidia_bug_sample_code, NULL, NULL}, {"demo_p2411_problem", DisplayRefBus, NULL, demo_p2411_problem, NULL, NULL} }; int testcase_catalog_ct = sizeof(testcase_catalog)/sizeof(Testcase_Descriptor); ddcutil-0.8.6/src/test/testcases.c0000644000175000001440000001011513216157025014002 00000000000000/* testcases.c * * Dispatch test cases * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include "base/core.h" #include "adl/adl_shim.h" #ifdef HAVE_ADL #include "adl/adl_impl/adl_intf.h" #endif #include "test/testcase_table.h" #include void show_test_cases() { if (testcase_catalog_ct == 0) { printf("\nNo test cases\n"); } else { printf("\n Test Cases:\n"); int ndx = 0; // int testcase_catalog_ct = get_testcase_catalog_ct(); // Testcase_Descriptor ** testcase_catalog = get_testcase_catalog(); for (;ndx < testcase_catalog_ct; ndx++) { printf(" %d - %s\n", ndx+1, testcase_catalog[ndx].name); } } puts(""); } Testcase_Descriptor * get_testcase_descriptor(int testnum) { Testcase_Descriptor * result = NULL; // int testcase_catalog_ct = get_testcase_catalog_ct(); // Testcase_Descriptor ** testcase_catalog = get_testcase_catalog(); if (testnum > 0 && testnum <= testcase_catalog_ct) { result = &testcase_catalog[testnum-1]; } return result; } bool execute_testcase(int testnum, Display_Identifier* pdid) { bool ok = true; Testcase_Descriptor * pDesc = NULL; if (ok) { pDesc = get_testcase_descriptor(testnum); if (!pDesc) { printf("Invalid test number: %d\n", testnum); ok = false; } } if (ok) { if (pdid->id_type == DISP_ID_ADL && !adlshim_is_available()) { printf("ADL adapter.display numbers specified, but ADL is not available.\n"); ok = false; } } if (ok) { switch (pDesc->drefType) { case DisplayRefNone: pDesc->fp_noarg(); break; case DisplayRefBus: // if (parsedCmd->dref->ddc_io_mode == DDC_IO_ADL) { if (pdid->id_type != DISP_ID_BUSNO) { printf("Test %d requires bus number\n", testnum); ok = false; } else { // pDesc->fp_bus(parsedCmd->dref->busno); pDesc->fp_bus(pdid->busno); } break; case DisplayRefAdl: // if (parsedCmd->dref->ddc_io_mode == DDC_IO_DEVI2C) { if (pdid->id_type != DISP_ID_ADL) { printf("Test %d requires ADL adapter.display numbers\n", testnum); ok = false; } else { // pDesc->fp_adl(parsedCmd->dref->iAdapterIndex, parsedCmd->dref->iDisplayIndex); pDesc->fp_adl(pdid->iAdapterIndex, pdid->iDisplayIndex); } break; case DisplayRefAny: { // pDesc->fp_dr(parsedCmd->dref); Display_Ref* pdref = NULL; if (pdid->id_type == DISP_ID_ADL) { pdref = create_adl_display_ref(pdid->iAdapterIndex, pdid->iDisplayIndex); } else { pdref = create_bus_display_ref(pdid->busno); } pDesc->fp_dr(pdref); } break; default: PROGRAM_LOGIC_ERROR("Impossible display id type: %d\n", pDesc->drefType); ok = false; } // switch } return ok; } ddcutil-0.8.6/src/test/testcase_table.h0000644000175000001440000000347313230445447015010 00000000000000/* testcase_table.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef TESTCASE_TABLE_H_ #define TESTCASE_TABLE_H_ #include "base/displays.h" // type of display reference required/supported by the command typedef enum {DisplayRefNone, DisplayRefAny, DisplayRefBus, DisplayRefAdl} DisplayRefType; typedef void (*NoArgFunction)(); typedef void (*BusArgFunction)(int busno); typedef void (*AdlArgFunction)(int iAdapterIndex, int iDisplayIndex); typedef void (*DisplayRefArgFunction)(Display_Ref * dref); typedef struct { char * name; // testcase description DisplayRefType drefType; // should really be a union NoArgFunction fp_noarg; BusArgFunction fp_bus; AdlArgFunction fp_adl; DisplayRefArgFunction fp_dr; } Testcase_Descriptor; extern Testcase_Descriptor testcase_catalog[]; extern int testcase_catalog_ct; // Testcase_Descriptor ** get_testcase_catalog(); // int get_testcase_catalog_ct(); #endif /* TESTCASE_TABLE_H_ */ ddcutil-0.8.6/src/test/testcases.h0000644000175000001440000000216313230445447014017 00000000000000/* testcases.h * * Manages test cases * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef TESTCASES_H_ #define TESTCASES_H_ #include #include void show_test_cases(); bool execute_testcase(int testnum, Display_Identifier* pdid); #endif /* TESTCASES_H_ */ ddcutil-0.8.6/src/app_sysenv/0000755000175000001440000000000013230445447013136 500000000000000ddcutil-0.8.6/src/app_sysenv/Makefile.am0000644000175000001440000000152613226554663015124 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public if HAVE_ADL_COND AM_CPPFLAGS += \ -I@ADL_HEADER_DIR@ endif if USE_LIBDRM_COND AM_CPPFLAGS += \ $(LIBDRM_CFLAGS) endif AM_CFLAGS = -Wall AM_CFLAGS += -Werror AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libappsysenv.la libappsysenv_la_SOURCES = \ query_sysenv.c \ query_sysenv_access.c \ query_sysenv_base.c \ query_sysenv_dmidecode.c \ query_sysenv_i2c.c \ query_sysenv_logs.c \ query_sysenv_modules.c \ query_sysenv_procfs.c \ query_sysenv_sysfs.c \ query_sysenv_xref.c if ENABLE_USB_COND libappsysenv_la_SOURCES += \ query_sysenv_usb.c endif if USE_LIBDRM_COND libappsysenv_la_SOURCES += \ query_sysenv_drm.c endif ddcutil-0.8.6/src/app_sysenv/Makefile.in0000644000175000001440000005546013230171237015126 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @HAVE_ADL_COND_TRUE@am__append_1 = \ @HAVE_ADL_COND_TRUE@ -I@ADL_HEADER_DIR@ @USE_LIBDRM_COND_TRUE@am__append_2 = \ @USE_LIBDRM_COND_TRUE@ $(LIBDRM_CFLAGS) @ENABLE_CALLGRAPH_COND_TRUE@am__append_3 = -fdump-rtl-expand @ENABLE_USB_COND_TRUE@am__append_4 = \ @ENABLE_USB_COND_TRUE@ query_sysenv_usb.c @USE_LIBDRM_COND_TRUE@am__append_5 = \ @USE_LIBDRM_COND_TRUE@ query_sysenv_drm.c subdir = src/app_sysenv ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libappsysenv_la_LIBADD = am__libappsysenv_la_SOURCES_DIST = query_sysenv.c \ query_sysenv_access.c query_sysenv_base.c \ query_sysenv_dmidecode.c query_sysenv_i2c.c \ query_sysenv_logs.c query_sysenv_modules.c \ query_sysenv_procfs.c query_sysenv_sysfs.c query_sysenv_xref.c \ query_sysenv_usb.c query_sysenv_drm.c @ENABLE_USB_COND_TRUE@am__objects_1 = query_sysenv_usb.lo @USE_LIBDRM_COND_TRUE@am__objects_2 = query_sysenv_drm.lo am_libappsysenv_la_OBJECTS = query_sysenv.lo query_sysenv_access.lo \ query_sysenv_base.lo query_sysenv_dmidecode.lo \ query_sysenv_i2c.lo query_sysenv_logs.lo \ query_sysenv_modules.lo query_sysenv_procfs.lo \ query_sysenv_sysfs.lo query_sysenv_xref.lo $(am__objects_1) \ $(am__objects_2) libappsysenv_la_OBJECTS = $(am_libappsysenv_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libappsysenv_la_SOURCES) DIST_SOURCES = $(am__libappsysenv_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public $(am__append_1) $(am__append_2) AM_CFLAGS = -Wall -Werror -Wpedantic $(am__append_3) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libappsysenv.la libappsysenv_la_SOURCES = query_sysenv.c query_sysenv_access.c \ query_sysenv_base.c query_sysenv_dmidecode.c \ query_sysenv_i2c.c query_sysenv_logs.c query_sysenv_modules.c \ query_sysenv_procfs.c query_sysenv_sysfs.c query_sysenv_xref.c \ $(am__append_4) $(am__append_5) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/app_sysenv/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/app_sysenv/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libappsysenv.la: $(libappsysenv_la_OBJECTS) $(libappsysenv_la_DEPENDENCIES) $(EXTRA_libappsysenv_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libappsysenv_la_OBJECTS) $(libappsysenv_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_access.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_base.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_dmidecode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_drm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_i2c.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_logs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_modules.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_procfs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_sysfs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_usb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query_sysenv_xref.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: ddcutil-0.8.6/src/app_sysenv/query_sysenv.c0000644000175000001440000005456113225367155016014 00000000000000/* query_sysenv.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Primary file for the ENVIRONMENT command */ /** \cond */ #include // #define _GNU_SOURCE 1 // for function group_member #include #include #include #include #include "util/data_structures.h" #include "util/edid.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "util/sysfs_util.h" #ifdef PROBE_USING_SYSTEMD #include "util/systemd_util.h" #endif #ifdef USE_X11 #include "util/x11_util.h" #endif #include "util/udev_i2c_util.h" #include "util/udev_usb_util.h" /** \endcond */ #include "base/build_info.h" #include "base/core.h" #include "base/linux_errno.h" #ifdef HAVE_ADL #include "adl/adl_shim.h" #endif #include "query_sysenv_access.h" #include "query_sysenv_base.h" #include "query_sysenv_dmidecode.h" #include "query_sysenv_drm.h" #include "query_sysenv_i2c.h" #include "query_sysenv_logs.h" #include "query_sysenv_modules.h" #include "query_sysenv_procfs.h" #include "query_sysenv_sysfs.h" #include "query_sysenv_xref.h" #include "query_sysenv.h" /** Compile time and runtime checks of endianness. * * \param depth logical indentation depth */ static void report_endian(int depth) { int d1 = depth+1; rpt_title("Byte order checks:", depth); bool is_bigendian = (*(uint16_t *)"\0\xff" < 0x100); rpt_vstring(d1, "Is big endian (local test): %s", bool_repr(is_bigendian)); rpt_vstring(d1, "WORDS_BIGENDIAN macro (autoconf): " #ifdef WORDS_BIGENDIAN "defined" #else "not defined" #endif ); rpt_vstring(d1, "__BYTE_ORDER__ macro (gcc): " #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ "__ORDER_LITTLE_ENDIAN__" #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ "__ORDER_BIG_ENDIAN__" #elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__ "__ORDER_PDP_ENDIAN__" #else "unexpected value" #endif ); #ifdef REDUNDANT __u32 i = 1; bool is_bigendian2 = ( (*(char*)&i) == 0 ); rpt_vstring(d1, "Is big endian (runtime test): %s", bool_repr(is_bigendian2)); #endif } // // Higher level functions // /** Reports basic system information * * \param accum pointer to struct in which information is returned */ static void query_base_env(Env_Accumulator * accum) { int d0 = 0; int d1 = d0+1; rpt_vstring(d0, "ddcutil version: %s", BUILD_VERSION); rpt_nl(); sysenv_rpt_file_first_line("/proc/version", NULL, 0); char * expected_architectures[] = {"x86_64", "i386", "i686", "armv7l", "aarch64", "ppc64", NULL}; // n. alternative command "arch" not found on Arch Linux // uname -m machine hardware name // uname -p processor type (non-portable) // uname -i hardware platform (non-portable) accum->architecture = execute_shell_cmd_one_line_result("uname -m"); accum->distributor_id = execute_shell_cmd_one_line_result("lsb_release -s -i"); // e.g. Ubuntu, Raspbian char * release = execute_shell_cmd_one_line_result("lsb_release -s -r"); rpt_nl(); rpt_vstring(d0, "Architecture: %s", accum->architecture); rpt_vstring(d0, "Distributor id: %s", accum->distributor_id); rpt_vstring(d0, "Release: %s", release); if ( ntsa_find(expected_architectures, accum->architecture) >= 0) { rpt_vstring(d0, "Found a known architecture"); } else { rpt_vstring(d0, "Unexpected architecture %s. Please report.", accum->architecture); } accum->is_raspbian = accum->distributor_id && streq(accum->distributor_id, "Raspbian"); accum->is_arm = accum->architecture && ( str_starts_with(accum->architecture, "arm") || str_starts_with(accum->architecture, "aarch") ); free(release); #ifdef REDUNDANT rpt_nl(); rpt_vstring(0,"/etc/os-release..."); bool ok = execute_shell_cmd_rpt("grep PRETTY_NAME /etc/os-release", 1 /* depth */); if (!ok) rpt_vstring(1,"Unable to read PRETTY_NAME from /etc/os-release"); #endif rpt_nl(); sysenv_rpt_file_first_line("/proc/cmdline", NULL, d0); if (get_output_level() >= DDCA_OL_VERBOSE) { rpt_nl(); rpt_vstring(d0,"Processor information as reported by lscpu:"); bool ok = execute_shell_cmd_rpt("lscpu", 1); if (!ok) { // lscpu should always be there, but just in case: rpt_vstring(1, "Command lscpu not found"); rpt_nl(); rpt_title("Processor information from /proc/cpuinfo:", d0); // uniq because entries for each processor of a mulit-processor cpu execute_shell_cmd_rpt( "cat /proc/cpuinfo | grep vendor_id | uniq", d1); execute_shell_cmd_rpt( "cat /proc/cpuinfo | grep \"cpu family\" | uniq", d1); execute_shell_cmd_rpt( "cat /proc/cpuinfo | grep \"model[[:space:]][[:space:]]\" | uniq", d1); // "model" execute_shell_cmd_rpt( "cat /proc/cpuinfo | grep \"model name\" | uniq", d1); // "model name" } rpt_nl(); if (accum->is_arm) { rpt_vstring(d0, "Skipping dmidecode checks on architecture %s.", accum->architecture); } else { query_dmidecode(); } rpt_nl(); report_endian(d0); } } #ifdef OLD /* Checks for installed packages i2c-tools and libi2c-dev */ static void query_packages() { rpt_multiline(0, "ddcutil requiries package i2c-tools. Use both dpkg and rpm to look for it.", "While we're at it, check for package libi2c-dev which is used for building", "ddcutil.", NULL ); bool ok; // n. apt show produces warning msg that format of output may change. // better to use dpkg rpt_nl(); rpt_vstring(0,"Using dpkg to look for package i2c-tools..."); ok = execute_shell_cmd_rpt("dpkg --status i2c-tools", 1); if (!ok) rpt_vstring(0,"dpkg command not found"); else { execute_shell_cmd_rpt("dpkg --listfiles i2c-tools", 1); } rpt_nl(); rpt_vstring(0,"Using dpkg to look for package libi2c-dev..."); ok = execute_shell_cmd_rpt("dpkg --status libi2c-dev", 1); if (!ok) rpt_vstring(0,"dpkg command not found"); else { execute_shell_cmd_rpt("dpkg --listfiles libi2c-dev", 1); } rpt_nl(); rpt_vstring(0,"Using rpm to look for package i2c-tools..."); ok = execute_shell_cmd_rpt("rpm -q -l --scripts i2c-tools", 1); if (!ok) rpt_vstring(0,"rpm command not found"); } #endif /* Performs checks specific to the nvidia and fglrx proprietary video drivers. * * Arguments: * driver list list of loaded drivers * * Returns: nothing */ static void driver_specific_tests(struct driver_name_node * driver_list) { rpt_vstring(0,"Performing driver specific checks..."); bool found_driver_specific_checks = false; if (driver_name_list_find_prefix(driver_list, "nvidia")) { found_driver_specific_checks = true; rpt_nl(); rpt_vstring(0,"Checking for special settings for proprietary Nvidia driver "); rpt_vstring(0,"(Needed for some newer Nvidia cards)."); execute_shell_cmd_rpt("grep -iH i2c /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*", 1); } if (driver_name_list_find_prefix(driver_list, "fglrx")) { found_driver_specific_checks = true; rpt_nl(); rpt_vstring(0,"Performing ADL specific checks..."); #ifdef HAVE_ADL if (!adlshim_is_available()) { set_output_level(DDCA_OL_VERBOSE); // force error msg that names missing dll bool ok = adlshim_initialize(); if (!ok) printf("WARNING: Using AMD proprietary video driver fglrx but unable to load ADL library\n"); } #else rpt_vstring(0,"WARNING: Using AMD proprietary video driver fglrx but ddcutil built without ADL support"); #endif } if (!found_driver_specific_checks) rpt_vstring(0,"No driver specific checks apply."); } #ifdef USE_X11 // // Using X11 API // /* Reports EDIDs known to X11 * * Arguments: none * * Returns: nothing */ void query_x11() { GPtrArray* edid_recs = get_x11_edids(); rpt_nl(); rpt_vstring(0,"EDIDs reported by X11 for connected xrandr outputs:"); // DBGMSG("Got %d X11_Edid_Recs\n", edid_recs->len); for (int ndx=0; ndx < edid_recs->len; ndx++) { X11_Edid_Rec * prec = g_ptr_array_index(edid_recs, ndx); // printf(" Output name: %s -> %p\n", prec->output_name, prec->edid); // hex_dump(prec->edid, 128); rpt_vstring(1, "xrandr output: %s", prec->output_name); rpt_label (2, "Raw EDID:"); rpt_hex_dump(prec->edidbytes, 128, 2); Parsed_Edid * parsed_edid = create_parsed_edid(prec->edidbytes); if (parsed_edid) { report_parsed_edid_base( parsed_edid, true, // verbose false, // show_hex 2); // depth free_parsed_edid(parsed_edid); } else { rpt_label(2, "Unable to parse EDID"); // printf(" Unparsable EDID for output name: %s -> %p\n", prec->output_name, prec->edidbytes); // hex_dump(prec->edidbytes, 128); } rpt_nl(); Device_Id_Xref * xref = device_xref_get(prec->edidbytes); xref->xrandr_name = strdup(prec->output_name); } free_x11_edids(edid_recs); // Display * x11_disp = open_default_x11_display(); // GPtrArray * outputs = get_x11_connected_outputs(x11_disp); // close_x11_display(x11_disp); } #endif // // i2cdetect // /** Examines /dev/i2c devices using command i2cdetect, if it exists. * * \param i2c_device_numbers I2C bus numbers to check * */ static void query_using_i2cdetect(Byte_Value_Array i2c_device_numbers) { assert(i2c_device_numbers); int d0 = 0; int d1 = 1; rpt_vstring(d0,"Examining I2C buses using i2cdetect... "); if (bva_length(i2c_device_numbers) == 0) { rpt_vstring(d1, "No I2C buses found"); } else { for (int ndx=0; ndx< bva_length(i2c_device_numbers); ndx++) { int busno = bva_get(i2c_device_numbers, ndx); if (is_ignorable_i2c_device(busno)) { // calling i2cdetect for an SMBUs device fills dmesg with error messages rpt_nl(); rpt_vstring(d1, "Device /dev/i2c-%d is a SMBus or other ignorable device. Skipping i2cdetect.", busno); } else { char cmd[80]; snprintf(cmd, 80, "i2cdetect -y %d", busno); rpt_nl(); rpt_vstring(d1,"Probing bus /dev/i2c-%d using command \"%s\"", busno, cmd); int rc = execute_shell_cmd_rpt(cmd, 2 /* depth */); // DBGMSG("execute_shell_cmd(\"%s\") returned %d", cmd, rc); if (rc != 1) { rpt_vstring(d1,"i2cdetect command unavailable"); break; } } } } } /** Queries UDEV for devices in subsystem "i2c-dev". * Also looks for devices with name attribute "DPMST" */ static void probe_i2c_devices_using_udev() { char * subsys_name = "i2c-dev"; rpt_vstring(0,"Probing I2C devices using udev, susbsystem %s...", subsys_name); // probe_udev_subsystem() is in udev_util.c, which is only linked in if USE_USB // Detailed scan of I2C device information probe_udev_subsystem(subsys_name, /*show_usb_parent=*/ false, 1); rpt_nl(); GPtrArray * summaries = get_i2c_devices_using_udev(); report_i2c_udev_device_summaries(summaries, "Summary of udev I2C devices",1); for (int ndx = 0; ndx < summaries->len; ndx++) { Udev_Device_Summary * summary = g_ptr_array_index(summaries, ndx); assert( memcmp(summary->marker, UDEV_DEVICE_SUMMARY_MARKER, 4) == 0); int busno = udev_i2c_device_summary_busno(summary); Device_Id_Xref * xref = device_xref_find_by_busno(busno); if (xref) { xref->udev_name = strdup(summary->sysattr_name); xref->udev_syspath = strdup(summary->devpath); } else { // DBGMSG("Device_Id_Xref not found for busno %d", busno); } } free_udev_device_summaries(summaries); // ok if summaries == NULL rpt_nl(); char * nameattr = "DPMST"; rpt_vstring(0,"Looking for udev devices with name attribute %s...", nameattr); summaries = find_devices_by_sysattr_name(nameattr); report_i2c_udev_device_summaries(summaries, "Summary of udev DPMST devices...",1); free_udev_device_summaries(summaries); // ok if summaries == NULL } /** Analyze collected environment information, Make suggestions. * * \param accum accumulated environment information * \param depth logical indentation depth */ void final_analysis(Env_Accumulator * accum, int depth) { int d1 = depth + 1; int d2 = depth + 2; int d3 = depth + 3; // for testing: // accum->dev_i2c_common_group_name = NULL; // accum->module_i2c_dev_loaded_or_builtin = false; // accum->cur_user_all_devi2c_rw = false; // accum->all_dev_i2c_is_group_rw = false; bool odd_groups = accum->dev_i2c_common_group_name && !streq(accum->dev_i2c_common_group_name, "root") && !streq(accum->dev_i2c_common_group_name, "i2c"); bool msg_issued = false; rpt_vstring(depth, "Configuration suggestions:"); if (odd_groups) { rpt_label (d1, "Issue:"); rpt_label (d2, "/dev/i2c-N devices have non-standard or varying group names."); rpt_label (d2, "Suggestions are incomplete."); rpt_nl(); msg_issued = true; } // TODO: Also compare dev_i2c_devices vs sys_bus_i2c_devices ? if (bva_length(accum->dev_i2c_device_numbers) == 0 && accum->module_i2c_dev_needed && !accum->i2c_dev_loaded_or_builtin) { rpt_label (d1, "Issue:"); rpt_label (d2, "No /dev/i2c-N devices found."); rpt_vstring(d2, "%sI2C devices exist in /sys/bus/i2c", (accum->sysfs_i2c_devices_exist) ? "" : "No "); rpt_label (d2, "Module dev-i2c is required."); rpt_label (d2, "Module dev-i2c is not loaded"); rpt_label (d1, "Suggestion:"); rpt_label (d2, "Manually load module i2c-dev using the command:"); rpt_label (d3, "sudo modprobe i2c-dev"); rpt_label (d2, "If this solves the problem, put an entry in directory /etc/modules-load.d"); rpt_label (d2, "that will cause i2c-dev to be loaded. Type \"man modules-load.d\" for details"); rpt_nl(); msg_issued = true; } else { if (accum->cur_user_all_devi2c_rw) { // n. will be true if no /dev/i2c-N devices exist rpt_label(d1, "Current user has RW access to all /dev/i2c-N devices."); rpt_label(d1, "Skipping further group and permission checks."); rpt_nl(); msg_issued = true; } else { if (accum->cur_user_any_devi2c_rw) { rpt_label (d1, "Issue:"); rpt_multiline(d2, "Current user has RW access to some but not all /dev/i2c-N devices.", "If there is RW access to at least the /dev/i2c-N devices for connected monitors,", "this is not a problem.", "Remaining suggestions assume RW access is still to be established.", "", NULL ); msg_issued = true; } if (!accum->group_i2c_exists) { rpt_label (d1, "Issue:"); rpt_label (d2, "Group i2c does exist."); rpt_label (d1, "Suggestion:"); rpt_label (d2, "Create group i2c. To create group i2c, use command:"); rpt_label (d3, "sudo groupadd --system i2c"); rpt_label (d2, "Assign /dev/i2c-N devices to group i2c by adding a rule to /etc/udev/rules.d"); rpt_label (d2, "Add the current user to group i2c:"); rpt_label (d3, "sudo usermod -G i2c -a "); rpt_label (d2, "After this, you will have to logout and login again."); rpt_label (d2, "The changes to the user's group list are not read until a new login."); rpt_nl(); msg_issued = true; } else { // group i2c exists if (!accum->all_dev_i2c_has_group_i2c) { // Punt on odd case were some but not all /dev/i2c-N devices are in group i2c if (accum->any_dev_i2c_has_group_i2c) { rpt_label (d1, "Issue:"); rpt_multiline(d2, "Some but not all /dev/i2c-N devices have group i2c.", "If the /dev/i2c-N devices for connected monitors have group i2c," "this is not a problem. Remaining suggestions assume /dev/i2c-N " "devices require assignment to group i2c.", "", NULL ); // msg_issued = true; // redundant, clang complains } rpt_label (d1, "Issue:"); rpt_label (d2, "/dev/i2c-N devices not assigned to group i2c"); rpt_label (d1, "Suggestion:"); rpt_label (d2, "Assign /dev/i2c-N devices to group i2c by adding or editing a rule"); rpt_label (d2, "in /etc/udev/rules.d"); rpt_nl(); msg_issued = true; } // handle case of /dev/i2c-N devices have group i2c, but not RW if (!accum->cur_user_in_group_i2c) { rpt_label (d1, "Issue:"); rpt_label (d2, "Current user is not a member of group i2c"); rpt_label (d1, "Suggestion:"); rpt_label (d2, "Execute command:"); rpt_vstring(d3, "sudo usermod -G i2c -a %s", accum->cur_uname); rpt_label (d2, "After this, you will have to logout and login again."); rpt_label (d2, "The changes to the user's group list are not read until a new login."); rpt_nl(); msg_issued = true; } } if (!accum->all_dev_i2c_is_group_rw && !streq(accum->dev_i2c_common_group_name, "root")) { rpt_label (d1, "Issue:"); rpt_label (d2, "At least some /dev/i2c-N devices do not have group RW permission."); rpt_label (d1, "Suggestion:"); rpt_label (d2, "Set group RW access to /dev/i2c-N devices by adding or editing a rule"); rpt_label (d2, "in /etc/udev/rules.d"); rpt_nl(); msg_issued = true; } } } if (!msg_issued) { rpt_vstring(d1, "None"); rpt_nl(); } } // // Mainline // /* Master function to query the system environment * * Arguments: none * * Returns: nothing */ void query_sysenv() { device_xref_init(); Env_Accumulator * accumulator = env_accumulator_new(); rpt_nl(); rpt_vstring(0,"*** Basic System Information ***"); rpt_nl(); query_base_env(accumulator); rpt_nl(); rpt_vstring(0,"*** Primary Check 1: Identify video card and driver ***"); rpt_nl(); query_card_and_driver_using_sysfs(accumulator); rpt_nl(); rpt_vstring(0,"*** Primary Check 2: Check that /dev/i2c-* exist and writable ***"); rpt_nl(); accumulator->dev_i2c_device_numbers = identify_i2c_devices(); assert(accumulator->dev_i2c_device_numbers); // redundant // rpt_vstring(0, "Identified %d I2C devices", bva_length(accumulator->dev_i2c_device_numbers)); // rpt_nl(); check_i2c_devices(accumulator); rpt_nl(); rpt_vstring(0,"*** Primary Check 3: Check that module i2c_dev is loaded ***"); rpt_nl(); check_i2c_dev_module(accumulator, 0); rpt_nl(); rpt_vstring(0,"*** Primary Check 4: Driver specific checks ***"); rpt_nl(); driver_specific_tests(accumulator->driver_list); // TODO: move to end of function // Free the driver list created by query_card_and_driver_using_sysfs() // free_driver_name_list(accumulator->driver_list); // driver_list = NULL; #ifdef OLD rpt_nl(); rpt_vstring(0,"*** Primary Check 5: Installed packages ***"); rpt_nl(); query_packages(); rpt_nl(); #endif rpt_nl(); rpt_vstring(0,"*** Additional probes ***"); // printf("Gathering card and driver information...\n"); rpt_nl(); query_proc_modules_for_video(); if (!accumulator->is_arm) { // rpt_nl(); // query_card_and_driver_using_lspci(); //rpt_nl(); //query_card_and_driver_using_lspci_alt(); } rpt_nl(); query_loaded_modules_using_sysfs(); rpt_nl(); query_sys_bus_i2c(accumulator); DDCA_Output_Level output_level = get_output_level(); if (output_level >= DDCA_OL_VERBOSE) { rpt_nl(); query_proc_driver_nvidia(); rpt_nl(); query_i2c_buses(); rpt_nl(); rpt_vstring(0,"xrandr connection report:"); execute_shell_cmd_rpt("xrandr|grep connected", 1 /* depth */); rpt_nl(); rpt_vstring(0,"Checking for possibly conflicting programs..."); execute_shell_cmd_rpt("ps aux | grep ddccontrol | grep -v grep", 1); rpt_nl(); query_using_i2cdetect(accumulator->dev_i2c_device_numbers); raw_scan_i2c_devices(accumulator); #ifdef USE_X11 query_x11(); #endif // probe_udev_subsystem() is in udev_util.c, which is only linked in if USE_USB probe_i2c_devices_using_udev(); // temp // get_i2c_smbus_devices_using_udev(); probe_config_files(accumulator); probe_logs(accumulator); #ifdef USE_LIBDRM probe_using_libdrm(); #else rpt_vstring(0, "Not built with libdrm support. Skipping DRM related checks"); #endif query_drm_using_sysfs(); device_xref_report(0); } rpt_nl(); env_accumulator_report(accumulator, 0); rpt_nl(); final_analysis(accumulator, 0); env_accumulator_free(accumulator); // make Coverity happy } ddcutil-0.8.6/src/app_sysenv/query_sysenv_access.c0000644000175000001440000004050213226555426017324 00000000000000/* query_sysenv_access.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Checks on the the existence of and access to /dev/i2c devices */ /** \cond */ #include #include #include #include #include #include #include #include #include #include #include "util/file_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "util/udev_i2c_util.h" #include "base/linux_errno.h" /** \endcond */ #include "i2c/i2c_bus_core.h" #include "query_sysenv_access.h" /** Perform redundant checks as cross-verification */ bool redundant_i2c_device_identification_checks = true; // // Get list of /dev/i2c devices // // There are too many ways of doing this throughout the code. // Consolidate them here. (IN PROGRESS) // Byte_Value_Array get_i2c_devices_by_existence_test() { Byte_Value_Array bva = bva_create(); for (int busno=0; busno < I2C_BUS_MAX; busno++) { if (i2c_device_exists(busno)) { // if (!is_ignorable_i2c_device(busno)) bva_append(bva, busno); } } return bva; } Byte_Value_Array get_i2c_devices_by_ls() { Byte_Value_Array bva = bva_create(); int ival; // returns array of I2C bus numbers in string form, sorted in numeric order GPtrArray * busnums = execute_shell_cmd_collect("ls /dev/i2c* | cut -c 10- | sort -n"); if (!busnums) { rpt_vstring(1, "No I2C buses found"); goto bye; } if (busnums->len > 0) { bool isint = str_to_int(g_ptr_array_index(busnums,0), &ival); if (!isint) { rpt_vstring(1, "Apparently no I2C buses"); goto bye; } } for (int ndx = 0; ndx < busnums->len; ndx++) { char * sval = g_ptr_array_index(busnums, ndx); bool isint = str_to_int(sval, &ival); if (!isint) { rpt_vstring(1, "Parsing error. Invalid I2C bus number: %s", sval); } else { bva_append(bva, ival); // is_smbus_device_using_sysfs(ival); } } bye: if (busnums) g_ptr_array_free(busnums, true); return bva; } /** Consolidated function to identify I2C devices. * * \return #ByteValueArray of bus numbers for detected I2C devices */ // TODO: simplify, no longer need to test with multiple methods Byte_Value_Array identify_i2c_devices() { Byte_Value_Array i2c_device_numbers_result = NULL; // result Byte_Value_Array bva1 = NULL; Byte_Value_Array bva2 = NULL; Byte_Value_Array bva3 = NULL; Byte_Value_Array bva4 = NULL; bva1 = get_i2c_devices_by_existence_test(); if (redundant_i2c_device_identification_checks) { bva2 = get_i2c_devices_by_ls(); bva3 = get_i2c_device_numbers_using_udev(/* include_smbus= */ true); bva4 = get_i2c_device_numbers_using_udev_w_sysattr_name_filter(NULL); assert(bva_sorted_eq(bva1,bva2)); assert(bva_sorted_eq(bva1,bva3)); assert(bva_sorted_eq(bva1,bva4)); } i2c_device_numbers_result = bva1; if (redundant_i2c_device_identification_checks) { bva_free(bva2); bva_free(bva3); bva_free(bva4); } // DBGMSG("Identified %d I2C devices", bva_length(bva1)); return i2c_device_numbers_result; } /** Gets the username of the logged on user. * * \return user name * * The caller is responsible for freeing the returned string. */ static char * get_username(Env_Accumulator * accum) { #ifdef OLD rc = getlogin_r(username, sizeof(username)); printf("(%s) getlogin_r() returned %d, strlen(username)=%zd\n", __func__, rc, strlen(username)); if (rc == 0) printf("(%s) username = |%s|\n", __func__, username); // printf("\nLogged on user: %s\n", username); printf("(%s) getlogin() returned |%s|\n", __func__, getlogin()); char * cmd = "echo $LOGNAME"; printf("(%s) executing command: %s\n", __func__, cmd); bool ok = execute_shell_cmd_rpt(cmd, 0); printf("(%s) execute_shell_cmd() returned %s\n", __func__, bool_repr(ok)); #endif uid_t uid = getuid(); // uid_t euid = geteuid(); // printf("(%s) uid=%u, euid=%u\n", __func__, uid, euid); // gets logged on user name, user id, group id struct passwd * pwd = getpwuid(uid); rpt_vstring(0,"Current user: %s (%u)", pwd->pw_name, uid); rpt_nl(); char * uname = strdup(pwd->pw_name); accum->cur_uname = uname; accum->cur_uid = uid; return uname; } /** * * \param accum accumulates environment information * * \remark * Sets the following fields in **Env_Accumulator**: */ static void check_dev_i2c_access(Env_Accumulator * accum) { bool debug = false; DBGMSF0(debug, "Starting"); // bool all_i2c_rw = false; int busct = bva_length(accum->dev_i2c_device_numbers); int busct0 = i2c_device_count(); // simple count, no side effects, consider replacing with local code assert(busct == busct0); if (busct == 0 && !accum->dev_i2c_devices_required) { rpt_vstring(0,"WARNING: No /dev/i2c-* devices found"); } else { // all_i2c_rw = true; int busno; char fnbuf[20]; for (int ndx = 0; ndx < busct; ndx++) { busno = bva_get(accum->dev_i2c_device_numbers, ndx); // for (busno=0; busno < 32; busno++) { // if (i2c_device_exists(busno)) { snprintf(fnbuf, sizeof(fnbuf), "/dev/i2c-%d", busno); int rc; int errsv; DBGMSF(debug, "Calling access() for %s", fnbuf); rc = access(fnbuf, R_OK|W_OK); if (rc < 0) { errsv = errno; rpt_vstring(0,"Device %s is not readable and writable. Error = %s", fnbuf, linux_errno_desc(errsv) ); // all_i2c_rw = false; accum->cur_user_all_devi2c_rw = false; } else accum->cur_user_any_devi2c_rw = true; struct stat fs; rc = stat(fnbuf, &fs); if (rc < 0) { errsv = errno; rpt_vstring(0,"Error getting group information for device %s. Error = %s", fnbuf, linux_errno_desc(errsv) ); } else { bool cur_file_grp_rw = ( fs.st_mode & S_IRGRP ) && (fs.st_mode & S_IWGRP) ; struct group* grp; errno = 0; grp = getgrgid(fs.st_gid); if (!grp) { errsv = errno; rpt_vstring(0,"Error getting group information for group %d. Error = %s", fs.st_gid, linux_errno_desc(errsv) ); } else { char * gr_name = grp->gr_name; if (accum->dev_i2c_common_group_name) { if (!streq(accum->dev_i2c_common_group_name, gr_name)) { free(accum->dev_i2c_common_group_name); accum->dev_i2c_common_group_name = strdup("MIXED"); } } else accum->dev_i2c_common_group_name = strdup(gr_name); if (streq(gr_name, "i2c")) accum->any_dev_i2c_has_group_i2c = true; else accum->all_dev_i2c_has_group_i2c = false; DBGMSF(debug, "file=%s, st_gid=%d, gr_name=%s, cur_file_grp_rw=%s", fnbuf, fs.st_gid, gr_name, bool_repr(cur_file_grp_rw)); if (fs.st_gid != 0) { // root group is special case if (cur_file_grp_rw) accum->any_dev_i2c_is_group_rw = true; else accum->all_dev_i2c_is_group_rw = false; } } // } } } rpt_nl(); if (!accum->cur_user_all_devi2c_rw) { rpt_vstring( 0, "WARNING: Current user (%s) does not have RW access to all /dev/i2c-* devices.", accum->cur_uname); } else rpt_vstring(0,"Current user (%s) has RW access to all /dev/i2c-* devices.", // username); accum->cur_uname); } DBGMSF0(debug, "Done"); } /** Checks for group i2c and whether the current user is a * member of the group. * * \param accum accumulates environment information * * \remark * Sets the following fields in **Env_Accumulator**: * group_i2c_checked * group_i2c_exists * cur_user_in_group_i2c */ static void check_group_i2c(Env_Accumulator * accum, bool verbose) { bool debug = false; DBGMSF(debug, "Starting. verbose=%s", bool_repr(verbose)); // verbose = true; if (verbose) { rpt_nl(); rpt_vstring(0,"Checking for group i2c..."); } accum->group_i2c_checked = true; accum->group_i2c_exists = false; // avoid special value in gid_i2c // gid_t gid_i2c; struct group * pgi2c = getgrnam("i2c"); if (pgi2c) { if (verbose) rpt_vstring(0," Group i2c exists"); accum->group_i2c_exists = true; // gid_i2c = pgi2c->gr_gid; // DBGMSG("getgrnam returned gid=%d for group i2c", gid_i2c); // DBGMSG("getgrnam() reports members for group i2c: %s", *pgi2c->gr_mem); int ndx=0; char * curname; while ( (curname = pgi2c->gr_mem[ndx]) ) { rtrim_in_place(curname); // DBGMSG("member_names[%d] = |%s|", ndx, curname); if (streq(curname, accum->cur_uname)) { accum->cur_user_in_group_i2c = true; } ndx++; } if (verbose) { if (accum->cur_user_in_group_i2c) { rpt_vstring(1,"Current user %s is a member of group i2c", accum->cur_uname); } else { rpt_vstring(1, "WARNING: Current user %s is NOT a member of group i2c", accum->cur_uname); } } } else { if (verbose) rpt_label(1,"Group i2c does not exist"); } #ifdef BAD // getgroups, getgrouplist returning nonsense else { uid_t uid = geteuid(); gid_t gid = getegid(); struct passwd * pw = getpwuid(uid); printf("Effective uid %d: %s\n", uid, pw->pw_name); char * uname = strdup(pw->pw_name); struct group * pguser = getgrgid(gid); printf("Effective gid %d: %s\n", gid, pguser->gr_name); if (group_member(gid_i2c)) { printf("User %s (%d) is a member of group i2c (%d)\n", uname, uid, gid_i2c); } else { printf("WARNING: User %s (%d) is a not member of group i2c (%d)\n", uname, uid, gid_i2c); } size_t supp_group_ct = getgroups(0,NULL); gid_t * glist = calloc(supp_group_ct, sizeof(gid_t)); int rc = getgroups(supp_group_ct, glist); int errsv = errno; DBGMSF(debug, "getgroups() returned %d", rc); if (rc < 0) { DBGMSF(debug, "getgroups() returned %d", rc); } else { DBGMSG("Found %d supplementary group ids", rc); int ndx; for (ndx=0; ndxdriver_list** already set * * \remark * Sets: * accum->group_i2c_exists * accum->cur_user_in_group_i2c * accum->cur_user_any_devi2c_rw * accum->cur_user_all_devi2c_rw */ void check_i2c_devices(Env_Accumulator * accum) { bool debug = false; DBGMSF0(debug, "Starting"); // Env_Accumulator values already set assert(accum->dev_i2c_device_numbers); #ifdef UNNEEDED // defaults now set properly in Env_Environment allocation accum->dev_i2c_devices_required = true; accum->group_i2c_checked = false; accum->group_i2c_exists = false; accum->cur_user_in_group_i2c = false; accum->cur_user_any_devi2c_rw = false; accum->cur_user_all_devi2c_rw = true; // i.e. none fail the test accum->any_dev_i2c_has_group_i2c = false; accum->all_dev_i2c_has_group_i2c = true; accum->any_dev_i2c_is_group_rw = false; accum->all_dev_i2c_is_group_rw = true; #endif Driver_Name_Node * driver_list = accum->driver_list; get_username(accum); rpt_vstring(0,"Checking /dev/i2c-* devices..."); DDCA_Output_Level output_level = get_output_level(); bool just_fglrx = only_fglrx(driver_list); if (just_fglrx){ accum->dev_i2c_devices_required = false; rpt_nl(); rpt_vstring(0,"Apparently using only the AMD proprietary driver fglrx."); rpt_vstring(0,"Devices /dev/i2c-* are not required."); // TODO: delay leaving to properl set other variables if (output_level < DDCA_OL_VERBOSE) return; rpt_vstring(0, "/dev/i2c device detail is purely informational."); } rpt_nl(); rpt_multiline(0, "Unless the system is using the AMD proprietary driver fglrx, devices /dev/i2c-*", "must exist and the logged on user must have read/write permission for those", "devices (or at least those devices associated with monitors).", "", "Typically, this access is enabled by:", " - setting the group for /dev/i2c-* to i2c", " - setting group RW permissions for /dev/i2c-*", " - making the current user a member of group i2c", "", "Alternatively, this can be enabled by just giving everyone RW permission", "The following tests probe for these conditions.", NULL ); rpt_nl(); rpt_vstring(0,"Checking for /dev/i2c-* devices..."); execute_shell_cmd_rpt("ls -l /dev/i2c-*", 1); check_dev_i2c_access(accum); bool verbose = !accum->cur_user_all_devi2c_rw || output_level >= DDCA_OL_VERBOSE; check_group_i2c(accum, verbose); if (verbose) { check_udev(); } DBGMSF0(debug, "Done"); } ddcutil-0.8.6/src/app_sysenv/query_sysenv_base.c0000644000175000001440000004656113226555440017004 00000000000000/* query_sysenv_base.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Common sysenv functions */ /** \cond */ #include #include #include #include #include #include #include "util/data_structures.h" #include "util/file_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "base/core.h" /** \endcond */ #include "query_sysenv_base.h" static char * known_video_driver_modules[] = { "amdgpu", "fbdev", "fglrx", "fturbo", "i915", "mgag200", "nvidia", "nouveau", "radeon", "vboxvideo", "vc4", NULL }; static char * prefix_matches[] = { "amdgpu", "drm", "i2c", "video", "vc4", NULL }; static char * other_driver_modules[] = { "drm", // "eeprom", // not really interesting "i2c_algo_bit", "i2c_dev", "i2c_piix4", NULL }; /** Returns the null terminated list of known video driver names */ char ** get_known_video_driver_module_names() { return known_video_driver_modules; } /** Returns the null terminated list of match prefixes */ char ** get_prefix_match_names() { return prefix_matches; } /** Returns the null terminated list of names of other drivers of interest */ char ** get_other_driver_module_names() { return other_driver_modules; } /** Reports the first line of a file, indented under a title. * Issues a message if unable to read the file. * * \param fn file name * \param title title message * \param depth logical indentation depth */ void sysenv_rpt_file_first_line(char * fn, char * title, int depth) { int d1 = depth+1; if (title) rpt_title(title, depth); else rpt_vstring(depth, "%s:", fn); char * s = file_get_first_line(fn, true /* verbose */); if (s) rpt_title(s, d1); else rpt_vstring(d1, "Unable to read %s", fn); } /** Reports the contents of a file. * * \param dir_name directory name * \param simple_fn simple file name * \param verbose if ***true***, issue message if error * \param depth logical indentation depth */ bool sysenv_show_one_file(char * dir_name, char * simple_fn, bool verbose, int depth) { bool result = false; char fqfn[PATH_MAX+2]; // strcpy(fqfn,dir_name); g_strlcpy(fqfn, dir_name, PATH_MAX); // make coverity happy if (!str_ends_with(dir_name, "/")) strcat(fqfn,"/"); assert(strlen(fqfn) + strlen(simple_fn) <= PATH_MAX); // for Coverity strncat(fqfn,simple_fn, sizeof(fqfn)-(strlen(fqfn)+1)); // use strncat to make Coverity happy if (regular_file_exists(fqfn)) { rpt_vstring(depth, "%s:", fqfn); rpt_file_contents(fqfn, /*verbose=*/true, depth+1); result = true; } else if (verbose) rpt_vstring(depth, "File not found: %s", fqfn); return result; } /** Allocates and initializes a #Env_Accumulator data structure * * \return newly allocated struct */ Env_Accumulator * env_accumulator_new() { Env_Accumulator * accum = calloc(1, sizeof(Env_Accumulator)); memcpy(accum->marker, ENV_ACCUMULATOR_MARKER, 4); // Defaults that differ from 0 values set by calloc(): accum->dev_i2c_devices_required = true; // will be set false if any instance fails the test accum->cur_user_all_devi2c_rw = true; accum->all_dev_i2c_has_group_i2c = true; accum->all_dev_i2c_is_group_rw = true; return accum; } /** Frees the #Env_Accumulator data structure. * * \param accum pointer to data structure */ void env_accumulator_free(Env_Accumulator * accum) { if (accum) { free(accum->architecture); free(accum->distributor_id); free(accum->cur_uname); free(accum->dev_i2c_common_group_name); if (accum->dev_i2c_device_numbers) bva_free(accum->dev_i2c_device_numbers); if (accum->driver_list) driver_name_list_free(accum->driver_list); if (accum->sys_bus_i2c_device_numbers) bva_free(accum->sys_bus_i2c_device_numbers); free(accum); } } /*** Debugging report for the **Env_Accumulator** struct * * @param accum pointer to data structure * @param depth logical indentation depth */ void env_accumulator_report(Env_Accumulator * accum, int depth) { int d1 = depth+1; char * dev_i2c_device_numbers_string = ""; if (accum->dev_i2c_device_numbers) dev_i2c_device_numbers_string = bva_as_string(accum->dev_i2c_device_numbers, /*as_hex*/ false, " "); char * driver_names = ""; if (accum->driver_list) driver_names = driver_name_list_string(accum->driver_list); char * sys_bus_i2c_device_numbers_string = ""; if (accum->sys_bus_i2c_device_numbers) sys_bus_i2c_device_numbers_string = bva_as_string(accum->sys_bus_i2c_device_numbers, /*as_hex*/ false, " "); rpt_label(depth, "Env_Accumulator:"); rpt_vstring(d1, "%-30s %s", "architecture:", (accum->architecture) ? accum->architecture : ""); rpt_vstring(d1, "%-30s %s", "distributor_id", (accum->distributor_id) ? accum->distributor_id : ""); rpt_vstring(d1, "%-30s %s", "Drivers detected:", driver_names); rpt_vstring(d1, "%-30s %s", "/dev/i2c device numbers:", dev_i2c_device_numbers_string); rpt_vstring(d1, "%-30s %s", "sysfs_i2c_devices_exist:", bool_repr(accum->sysfs_i2c_devices_exist)); rpt_vstring(d1, "%-30s %s", "/sys/bus/i2c device numbers:", sys_bus_i2c_device_numbers_string); rpt_vstring(d1, "%-30s %s", "dev_i2c_devices_required:", bool_repr(accum->dev_i2c_devices_required)); rpt_vstring(d1, "%-30s %s", "module_i2c_dev_needed:", bool_repr(accum->module_i2c_dev_needed)); rpt_vstring(d1, "%-30s %s", "module_i2c_dev_builtin:", bool_repr(accum->module_i2c_dev_builtin)); rpt_vstring(d1, "%-30s %s", "loadable_i2c_dev_exists:", bool_repr(accum->loadable_i2c_dev_exists)); rpt_vstring(d1, "%-30s %s", "i2c_dev_loaded_or_builtin:", bool_repr(accum->i2c_dev_loaded_or_builtin)); rpt_vstring(d1, "%-30s %s", "group_i2c_checked:", bool_repr(accum->group_i2c_checked)); rpt_vstring(d1, "%-30s %s", "group_i2c_exists:", bool_repr(accum->group_i2c_exists)); rpt_vstring(d1, "%-30s %s", "dev_i2c_common_group_name:", accum->dev_i2c_common_group_name); rpt_vstring(d1, "%-30s %s", "all_dev_i2c_has_group_i2c:", bool_repr(accum->all_dev_i2c_has_group_i2c)); rpt_vstring(d1, "%-30s %s", "any_dev_i2c_has_group_i2c:", bool_repr(accum->any_dev_i2c_has_group_i2c)); rpt_vstring(d1, "%-30s %s", "all_dev_i2c_is_group_rw:", bool_repr(accum->all_dev_i2c_is_group_rw)); rpt_vstring(d1, "%-30s %s", "any_dev_i2c_is_group_rw:", bool_repr(accum->any_dev_i2c_is_group_rw)); rpt_vstring(d1, "%-30s %s", "cur_uname:", accum->cur_uname); rpt_vstring(d1, "%-30s %d", "cur_uid:", accum->cur_uid); rpt_vstring(d1, "%-30s %s", "cur_user_in_group_i2c:", bool_repr(accum->cur_user_in_group_i2c)); rpt_vstring(d1, "%-30s %s", "cur_user_any_devi2c_rw:", bool_repr(accum->cur_user_any_devi2c_rw)); rpt_vstring(d1, "%-30s %s", "cur_user_all_devi2c_rw:", bool_repr(accum->cur_user_all_devi2c_rw)); if (accum->dev_i2c_device_numbers) free(dev_i2c_device_numbers_string); if (accum->sys_bus_i2c_device_numbers) free(sys_bus_i2c_device_numbers_string); if (accum->driver_list) free(driver_names); } // Functions to query and free the linked list of detected driver names. // The list is created by executing function query_card_and_driver_using_sysfs(), // which is grouped with the sysfs functions. /** Searches the driver name list for a specified name * * \param head list head * \param driver_name name of driver to search for * \return pointer to node containing driver, NULL if not found */ Driver_Name_Node * driver_name_list_find_exact( Driver_Name_Node * head, char * driver_name) { Driver_Name_Node * cur_node = head; while (cur_node && !streq(cur_node->driver_name, driver_name)) cur_node = cur_node->next; return cur_node; } /** Checks if any driver name in the list of detected drivers starts with * the specified string. * * \param driver list head of linked list of driver names * \parar driver_prefix driver name prefix * \return pointer to first node satisfying the prefix match, NULL if none */ Driver_Name_Node * driver_name_list_find_prefix( Driver_Name_Node * head, char * driver_prefix) { Driver_Name_Node * curnode = head; while (curnode && !str_starts_with(curnode->driver_name, driver_prefix) ) curnode = curnode->next; // DBGMSG("driver_prefix=%s, returning %p", driver_prefix, curnode); return curnode; } /** Adds a driver name to the head of the linked list of driver names. * * If the specified name is already in the list it is not added again. * * \param headptr pointer to address of head of the list * \param driver_name name to add */ void driver_name_list_add(Driver_Name_Node ** headptr, char * driver_name) { // printf("(%s) Adding driver |%s|\n", __func__, driver_name); if (!driver_name_list_find_exact(*headptr, driver_name)) { Driver_Name_Node * newnode = calloc(1, sizeof(Driver_Name_Node)); newnode->driver_name = strdup(driver_name); newnode->next = *headptr; *headptr = newnode; } } /** Checks the list of detected drivers to see if AMD's proprietary * driver fglrx is the only driver. * * \param driver_list linked list of driver names * \return true if fglrx is the only driver, false otherwise */ bool only_fglrx(struct driver_name_node * driver_list) { int driverct = 0; bool fglrx_seen = false; struct driver_name_node * curnode = driver_list; while (curnode) { driverct++; if (str_starts_with(curnode->driver_name, "fglrx")) fglrx_seen = true; curnode = curnode->next; } bool result = (driverct == 1 && fglrx_seen); // DBGMSG("driverct = %d, returning %d", driverct, result); return result; } /** Checks the list of detected drivers to see if the proprietary * AMD and Nvidia drivers are the only ones. * * \param driver list linked list of driver names * \return true if both nvidia and fglrx are present and there are no other drivers, * false otherwise */ bool only_nvidia_or_fglrx(struct driver_name_node * driver_list) { int driverct = 0; bool other_driver_seen = false; struct driver_name_node * curnode = driver_list; while (curnode) { driverct++; if (!str_starts_with(curnode->driver_name, "fglrx") && !streq(curnode->driver_name, "nvidia") ) { other_driver_seen = true; } curnode = curnode->next; } bool result = (!other_driver_seen && driverct > 0); // DBGMSG("driverct = %d, returning %d", driverct, result); return result; } /** Frees the driver name list * * \param driver_list pointer to head of linked list of driver names */ void driver_name_list_free(struct driver_name_node * driver_list) { // Free the driver list struct driver_name_node * cur_node = driver_list; while (cur_node) { free(cur_node->driver_name); struct driver_name_node * next_node = cur_node->next; free(cur_node); cur_node = next_node; } } /** Returns a comma delimited list of all the driver names in a * driver name list. * * \param head pointer to head of list */ char * driver_name_list_string(Driver_Name_Node * head) { int reqd_sz = 1; // for trailing \0 Driver_Name_Node * cur = head; while (cur) { // printf("(%s) driver_name: |%s|\n", __func__, cur->driver_name); reqd_sz += strlen(cur->driver_name); if (cur != head) reqd_sz += 2; // for ", " cur = cur->next; } // printf("(%s) reqd_sz = %d\n", __func__, reqd_sz); char * result = malloc(reqd_sz); result[0] = '\0'; cur = head; while(cur) { if (cur != head) strcat(result, ", "); strcat(result, cur->driver_name); cur = cur->next; } assert(strlen(result) == reqd_sz-1); // printf("(%s) result: |%s|\n", __func__, result); return result; } /** Handles the boilerplate of iterating over a directory. * * \param dirname directory name * \param fn_filter tests the name of a file in a directory to see if should * be processe. If NULL, all files are processed. * \param func function to be called for each filename in the directory * \param accumulator pointer to a data structure passed * \param depth logical indentation depth */ void dir_foreach( char * dirname, Filename_Filter_Func fn_filter, Dir_Foreach_Func func, void * accumulator, int depth) { struct dirent *dent; DIR *d; d = opendir(dirname); if (!d) { rpt_vstring(depth,"Unable to open directory %s: %s", dirname, strerror(errno)); } else { while ((dent = readdir(d)) != NULL) { // DBGMSG("%s", dent->d_name); if (!streq(dent->d_name, ".") && !streq(dent->d_name, "..") ) { if (!fn_filter || fn_filter(dent->d_name)) { func(dirname, dent->d_name, accumulator, depth); } } } closedir(d); } } /** Deletes lines from a #GPtrArray of text lines. If filter terms * are specified, lines not satisfying any of the search terms are * deleted. Then, if **limit** is specified, at most the limit * number of lines are left. * * \param line_array GPtrArray of null-terminated strings * \param filter_terms null-terminated string array of terms * \param ignore_case if true, ignore case when testing filter terms * \param limit if 0, return all lines that pass filter terms * if > 0, return at most the first #limit lines that satisfy the filter terms * if < 0, return at most the last #limit lines that satisfy the filter terms * * \remark * Consider allowing filter_terms to be regular expressions. */ void filter_and_limit_g_ptr_array( GPtrArray * line_array, char ** filter_terms, bool ignore_case, int limit) { bool debug = false; DBGMSF(debug, "line_array=%p, ct(filter_terms)=%d, ignore_case=%s, limit=%d", line_array, ntsa_length(filter_terms), bool_repr(ignore_case), limit); if (debug) { // (const char **) cast to conform to strjoin() signature char * s = strjoin( (const char **) filter_terms, -1, ", "); DBGMSG("Filter terms: %s", s); free(s); }; #ifdef TOO_MUCH if (debug) { if (filter_terms) { printf("(%s) filter_terms:\n", __func__); ntsa_show(filter_terms); } } #endif // inefficient, just make it work for now for (int ndx = (line_array->len)-1 ; ndx >= 0; ndx--) { char * s = g_ptr_array_index(line_array, ndx); // DBGMSF(debug, "s=|%s|", s); bool keep = true; if (filter_terms) keep = apply_filter_terms(s, filter_terms, ignore_case); if (!keep) { g_ptr_array_remove_index(line_array, ndx); } } gaux_ptr_array_truncate(line_array, limit); DBGMSF(debug, "Done. line_array->len=%d", line_array->len); } /** Reads the contents of a file into a #GPtrArray of lines, optionally keeping only * those lines containing at least one on a list of terms. After filtering, the set * of returned lines may be further reduced to either the first or last n number of * lines. * * \param line_array #GPtrArray in which to return the lines read * \param fn file name * \param filter_terms #Null_Terminated_String_Away of filter terms * \param ignore_case ignore case when testing filter terms * \param limit if 0, return all lines that pass filter terms * if > 0, return at most the first #limit lines that satisfy the filter terms * if < 0, return at most the last #limit lines that satisfy the filter terms * \return if >= 0, number of lines before filtering and limit applied * if < 0, -errno * * \remark * This function was created because using grep in conjunction with pipes was * producing obscure shell errors. */ int read_file_with_filter( GPtrArray * line_array, char * fn, char ** filter_terms, bool ignore_case, int limit) { bool debug = false; DBGMSF(debug, "line_array=%p, fn=%s, ct(filter_terms)=%d, ignore_case=%s, limit=%d", line_array, fn, ntsa_length(filter_terms), bool_repr(ignore_case), limit); g_ptr_array_set_free_func(line_array, g_free); // in case not already set int rc = file_getlines(fn, line_array, /*verbose*/ true); DBGMSF(debug, "file_getlines() returned %d", rc); if (rc > 0) { filter_and_limit_g_ptr_array( line_array, filter_terms, ignore_case, limit); } else { // rc == 0 DBGMSF0(debug, "Empty file"); } DBGMSF(debug, "Returning: %d", rc); return rc; } /** Execute a shell command and return the contents in a newly allocated * #GPtrArray of lines. Optionally, keep only those lines containing at least * one in a list of terms. After filtering, the set of returned lines may * be further reduced to either the first or last n number of lines. * * \param cmd command to execute * \param fn file name * \param filter_terms #Null_Terminated_String_Away of filter terms * \param ignore_case ignore case when testing filter terms * \param limit if 0, return all lines that pass filter terms * if > 0, return at most the first #limit lines that satisfy the filter terms * if < 0, return at most the last #limit lines that satisfy the filter terms * \param result_loc address at which to return a pointer to the newly allocate #GPtrArray * \return if >= 0, number of lines before filtering and limit applied * if < 0, -errno */ int execute_cmd_collect_with_filter( char * cmd, char ** filter_terms, bool ignore_case, int limit, GPtrArray ** result_loc) { bool debug = false; DBGMSF(debug, "cmd|%s|, ct(filter_terms)=%d, ignore_case=%s, limit=%d", cmd, ntsa_length(filter_terms), bool_repr(ignore_case), limit); int rc = 0; GPtrArray *line_array = execute_shell_cmd_collect(cmd); if (!line_array) { rc = -1; } else { rc = line_array->len; if (rc > 0) { filter_and_limit_g_ptr_array( line_array, filter_terms, ignore_case, limit); } } *result_loc = line_array; DBGMSF(debug, "Returning: %d", rc); return rc; } ddcutil-0.8.6/src/app_sysenv/query_sysenv_dmidecode.c0000644000175000001440000001041713203271475017774 00000000000000/* query_sysenv_dmidecode.c * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * query dmidecode for the environment command */ /** \cond */ #include #include #include #include #include "util/data_structures.h" #include "util/report_util.h" #include "util/sysfs_util.h" #include "base/core.h" /** \endcond */ #include "query_sysenv_base.h" // // dmidecode related functions // // from dmidecode.c static const char *dmi_chassis_type(Byte code) { /* 7.4.1 */ static const char *type[] = { "Other", /* 0x01 */ "Unknown", "Desktop", "Low Profile Desktop", "Pizza Box", "Mini Tower", "Tower", "Portable", "Laptop", "Notebook", "Hand Held", "Docking Station", "All In One", "Sub Notebook", "Space-saving", "Lunch Box", "Main Server Chassis", /* CIM_Chassis.ChassisPackageType says "Main System Chassis" */ "Expansion Chassis", "Sub Chassis", "Bus Expansion Chassis", "Peripheral Chassis", "RAID Chassis", "Rack Mount Chassis", "Sealed-case PC", "Multi-system", "CompactPCI", "AdvancedTCA", "Blade", "Blade Enclosing", "Tablet", "Convertible", "Detachable", "IoT Gateway", "Embedded PC", "Mini PC", "Stick PC" /* 0x24 */ }; code &= 0x7F; /* bits 6:0 are chassis type, 7th bit is the lock bit */ if (code >= 0x01 && code <= 0x24) return type[code - 0x01]; return NULL; } /** Reports DMI information for the system. */ void query_dmidecode() { // Note: The alternative of calling execute_shell_cmd_collect() with the following // command fails if executing from a non-privileged account, which lacks permissions // for /dev/mem or /sys/firmware/dmi/tables/smbios_entry_point // char * cmd = "dmidecode | grep \"['Base Board Info'|'Chassis Info'|'System Info']\" -A2"; // GPtrArray * lines = execute_shell_cmd_collect(cmd); char * sysdir = "/sys/class/dmi/id"; rpt_title("DMI Information from /sys/class/dmi/id:", 0); char * dv = "(Unavailable)"; char buf[100]; int bufsz = 100; // verbose rpt_vstring(1, "%-25s %s","Motherboard vendor:", read_sysfs_attr_w_default_r(sysdir, "board_vendor", dv, buf, bufsz, false)); rpt_vstring(1, "%-25s %s","Motherboard product name:", read_sysfs_attr_w_default_r(sysdir, "board_name", dv, buf, bufsz, false)); rpt_vstring(1, "%-25s %s","System vendor:", read_sysfs_attr_w_default_r(sysdir, "sys_vendor", dv, buf, bufsz, false)); rpt_vstring(1, "%-25s %s","System product name:", read_sysfs_attr_w_default_r(sysdir, "product_name", dv, buf, bufsz, false)); rpt_vstring(1, "%-25s %s","Chassis vendor:", read_sysfs_attr_w_default_r(sysdir, "chassis_vendor",dv, buf, bufsz, false)); char * chassis_type_s = read_sysfs_attr(sysdir, "chassis_type", /*verbose=*/ true); char * chassis_desc = dv; char workbuf[100]; if (chassis_type_s) { int chassis_type_i = atoi(chassis_type_s); // TODO: use something safer? const char * chassis_type_name = dmi_chassis_type(chassis_type_i); if (chassis_type_name) snprintf(workbuf, 100, "%s - %s", chassis_type_s, chassis_type_name); else snprintf(workbuf, 100, "%s - Unrecognized value", chassis_type_s); chassis_desc = workbuf; } rpt_vstring(1, "%-25s %s", "Chassis type:", chassis_desc); } ddcutil-0.8.6/src/app_sysenv/query_sysenv_i2c.c0000644000175000001440000003014113226555454016537 00000000000000/* query_sysenv_i2c.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Check I2C devices using directly coded I2C calls */ /** \cond */ #include #include #include #include "util/edid.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/sysfs_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "base/linux_errno.h" #include "base/status_code_mgt.h" /** \endcond */ #include "i2c/i2c_bus_core.h" #include "query_sysenv_base.h" #include "query_sysenv_sysfs.h" #include "query_sysenv_xref.h" #include "query_sysenv_i2c.h" // Auxiliary function for raw_scan_i2c_devices() static bool is_i2c_device_rw(int busno) { bool debug = false; DBGMSF(debug, "Starting. busno=%d", busno); bool result = true; char fnbuf[PATH_MAX]; snprintf(fnbuf, sizeof(fnbuf), "/dev/i2c-%d", busno); int rc; int errsv; DBGMSF(debug, "Calling access() for %s", fnbuf); rc = access(fnbuf, R_OK|W_OK); if (rc < 0) { errsv = errno; rpt_vstring(0,"Device %s is not readable and writable. Error = %s", fnbuf, linux_errno_desc(errsv) ); result = false; } DBGMSF(debug, "Returning: %s", bool_repr(result)); return result; } // Auxiliary function for raw_scan_i2c_devices() // adapted from ddc_vcp_tests static Public_Status_Code try_single_getvcp_call( int fh, unsigned char vcp_feature_code, int depth) { bool debug = false; DBGMSF(debug, "Starting. vcp_feature_code=0x%02x", vcp_feature_code ); int ndx; Status_Errno rc = 0; // extra sleep time does not help P2411 #ifdef NO usleep(50000); // doesn't help // usleep(50000); // write seems to be necessary to reset monitor state unsigned char zeroByte = 0x00; // 0x00; rc = write(fh, &zeroByte, 1); if (rc < 0) { rpt_vstring(0,"(%s) Bus reset failed. rc=%d, errno=%d. ", __func__, rc, errno ); return -1; } #endif // without this or 0 byte write, read() sometimes returns all 0 on P2411H usleep(50000); // usleep(50000); unsigned char ddc_cmd_bytes[] = { 0x6e, // address 0x37, shifted left 1 bit 0x51, // source address 0x02 | 0x80, // number of DDC data bytes, with high bit set 0x01, // DDC Get Feature Command vcp_feature_code, // 0x00, // checksum, to be set }; // calculate checksum by XORing bytes 0..4 ddc_cmd_bytes[5] = ddc_cmd_bytes[0]; for (ndx=1; ndx < 5; ndx++) ddc_cmd_bytes[5] ^= ddc_cmd_bytes[ndx]; // calculate checksum int writect = sizeof(ddc_cmd_bytes)-1; rc = write(fh, ddc_cmd_bytes+1, writect); if (rc < 0) { int errsv = errno; DBGMSF(debug, "write() failed, errno=%s", linux_errno_desc(errsv)); rc = -errsv; goto bye; } if (rc != writect) { DBGMSF(debug, "write() returned %d, expected %d", rc, writect ); rc = DDCRC_BAD_BYTECT; goto bye; } usleep(50000); unsigned char ddc_response_bytes[12]; int readct = sizeof(ddc_response_bytes)-1; rc = read(fh, ddc_response_bytes+1, readct); if (rc < 0) { // printf("(%s) read() returned %d, errno=%d.\n", __func__, rc, errno ); int errsv = errno; DBGMSF(debug, "read() failed, errno=%s", linux_errno_desc(errsv)); rc = -errsv; goto bye; } char * hs = hexstring(ddc_response_bytes+1, rc); rpt_vstring(depth, "read() returned %s", hs ); free(hs); if (rc != readct) { DBGMSF(debug, "read() returned %d, should be %d", rc, readct ); rc = DDCRC_BAD_BYTECT; goto bye; } // printf("(%s) read() returned %s\n", __func__, hexstring(ddc_response_bytes+1, readct) ); if (debug) { char * hs = hexstring(ddc_response_bytes+1, readct); DBGMSF(debug, "read() returned %s", hs ); free(hs); // hex_dump(ddc_response_bytes,1+rc); } if ( all_bytes_zero( ddc_response_bytes+1, readct) ) { DBGMSF0(debug, "All bytes zero"); rc = DDCRC_READ_ALL_ZERO; goto bye; } int ddc_data_length = ddc_response_bytes[2] & 0x7f; // some monitors return a DDC null response to indicate an invalid request: if (ddc_response_bytes[1] == 0x6e && ddc_data_length == 0 && ddc_response_bytes[3] == 0xbe) // 0xbe == checksum { DBGMSF0(debug, "Received DDC null response"); rc = DDCRC_NULL_RESPONSE; goto bye; } if (ddc_response_bytes[1] != 0x6e) { // assert(ddc_response_bytes[1] == 0x6e); DBGMSF(debug, "Invalid address byte in response, expected 06e, actual 0x%02x", ddc_response_bytes[1] ); rc = DDCRC_INVALID_DATA; goto bye; } if (ddc_data_length != 8) { DBGMSF(debug, "Invalid query VCP response length: %d", ddc_data_length ); rc = DDCRC_BAD_BYTECT; goto bye; } if (ddc_response_bytes[3] != 0x02) { // get feature response DBGMSF(debug, "Expected 0x02 in feature response field, actual value 0x%02x", ddc_response_bytes[3] ); rc = DDCRC_INVALID_DATA; goto bye; } ddc_response_bytes[0] = 0x50; // for calculating DDC checksum // checksum0 = xor_bytes(ddc_response_bytes, sizeof(ddc_response_bytes)-1); unsigned char calculated_checksum = ddc_response_bytes[0]; for (ndx=1; ndx < 11; ndx++) calculated_checksum ^= ddc_response_bytes[ndx]; // printf("(%s) checksum0=0x%02x, calculated_checksum=0x%02x\n", __func__, checksum0, calculated_checksum ); if (ddc_response_bytes[11] != calculated_checksum) { DBGMSF(debug, "Unexpected checksum. actual=0x%02x, calculated=0x%02x", ddc_response_bytes[11], calculated_checksum ); rc = DDCRC_CHECKSUM; goto bye; } if (ddc_response_bytes[4] == 0x00) { // valid VCP code // The interpretation for most VCP codes: int max_val = (ddc_response_bytes[7] << 8) + ddc_response_bytes[8]; int cur_val = (ddc_response_bytes[9] << 8) + ddc_response_bytes[10]; DBGMSF(debug, "cur_val = %d, max_val = %d", cur_val, max_val ); rc = 0; } else if (ddc_response_bytes[4] == 0x01) { // unsupported VCP code DBGMSF(debug, "Unsupported VCP code: 0x%02x", vcp_feature_code); rc = DDCRC_REPORTED_UNSUPPORTED; } else { DBGMSF(debug, "Unexpected value in supported VCP code field: 0x%02x ", ddc_response_bytes[4] ); rc = DDCRC_INVALID_DATA; } bye: DBGMSF(debug, "Returning: %s", psc_desc(rc)); return rc; } /** Checks each I2C device. * * This function largely uses direct coding to probe the I2C buses. * Allows for trying to read x37 even if X50 fails, and provides clearer * diagnostic messages than relying entirely on normal code path. * * \param accum accumulates sysenv query information */ void raw_scan_i2c_devices(Env_Accumulator * accum) { bool debug = false; DBGMSF0(debug, "Starting"); int depth = 0; int d1 = depth+1; int d2 = depth+2; Parsed_Edid * edid = NULL; rpt_nl(); rpt_title("Performing basic scan of I2C devices using local sysenv functions...",depth); Buffer * buf0 = buffer_new(1000, __func__); int busct = 0; Public_Status_Code psc; Status_Errno rc; bool saved_i2c_force_slave_addr_flag = i2c_force_slave_addr_flag; for (int busno=0; busno < I2C_BUS_MAX; busno++) { if (i2c_device_exists(busno)) { busct++; rpt_nl(); rpt_vstring(d1, "Examining device /dev/i2c-%d...", busno); if (is_ignorable_i2c_device(busno)) { rpt_vstring(9, "Device /dev/i2c-%d is a SMBus or other ignorable device. Skipping.", busno); continue; } if (!is_i2c_device_rw(busno)) // issues message if not RW continue; int fd = i2c_open_bus(busno, CALLOPT_ERR_MSG); if (fd < 0) continue; // DBGMSG("Calling i2c_get_functionality_flags_by_fd()"); unsigned long functionality = i2c_get_functionality_flags_by_fd(fd); // DBGMSG("i2c_get_functionality_flags_by_fd() returned %ul", functionality); i2c_report_functionality_flags(functionality, 90, d2); // Base_Status_Errno rc = i2c_set_addr(fd, 0x50, CALLOPT_ERR_MSG); // TODO save force slave addr setting, set it for duration of call - do it outside loop psc = i2c_get_raw_edid_by_fd(fd, buf0); if (psc != 0) { rpt_vstring(d2, "Unable to read EDID, psc=%s", psc_desc(psc)); } else { rpt_vstring(d2, "Raw EDID:"); rpt_hex_dump(buf0->bytes, buf0->len, d2); edid = create_parsed_edid(buf0->bytes); if (edid) report_parsed_edid_base( edid, true, // verbose false, // show_edid d2); else rpt_vstring(d2, "Unable to parse EDID"); Device_Id_Xref * xref = device_xref_get(buf0->bytes); xref->i2c_busno = busno; } rpt_nl(); rpt_vstring(d2, "Trying simple VCP read of feature 0x10..."); rc = i2c_set_addr(fd, 0x37, CALLOPT_ERR_MSG); if (rc == 0) { int maxtries = 3; psc = -1; for (int tryctr=0; tryctr * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Query configuration files, logs, and output of logging commands. */ /** cond */ #include #include #include #include #include "util/data_structures.h" #include "util/file_util.h" #include "util/glib_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "base/core.h" #include "base/status_code_mgt.h" /** endcond */ #include "query_sysenv_base.h" #include "query_sysenv_logs.h" static bool probe_log( char * log_fn, char ** filter_terms, bool ignore_case, int limit, int depth) { bool debug = false; assert(log_fn); DBGMSF(debug, "Starting. log_fn=%s, filter_terms=%p, ignore_case=%s, limit=%d", log_fn, filter_terms, bool_repr(ignore_case), limit); bool file_found = false; int rc = 0; if (regular_file_exists(log_fn)) { rpt_vstring(depth, "Scanning file: %s", log_fn); if (limit < 0) { rpt_vstring(depth, "Limiting output to last %d relevant lines...", -limit); } else if (limit > 0) { rpt_vstring(depth, "Limiting output to first %d relevant lines...", limit); } GPtrArray * found_lines = g_ptr_array_new_full(1000, g_free); rc = read_file_with_filter(found_lines, log_fn, filter_terms, ignore_case, limit); if (rc < 0) { f0printf(FERR, "Error reading file: %s\n", psc_desc(rc)); } else if (rc == 0) { // rc >0 is the original number of lines rpt_title("Empty file", depth); file_found = true; } else if (found_lines->len == 0) { rpt_title("No lines found after filtering", depth); file_found = true; } else { for (int ndx = 0; ndx < found_lines->len; ndx++) { rpt_title(g_ptr_array_index(found_lines, ndx), depth+1); } file_found = true; } } else { rpt_vstring(depth, "File not found: %s", log_fn); rc = -ENOENT; } DBGMSF(debug, "rc=%d, file_found=%s", rc, bool_repr(file_found)); rpt_nl(); return file_found; } static bool probe_cmd( char * cmd, char ** filter_terms, bool ignore_case, int limit, int depth) { bool debug = false; assert(cmd); DBGMSF(debug, "Starting. cmd=%s, filter_terms=%p, ignore_case=%s, limit=%d", cmd, filter_terms, bool_repr(ignore_case), limit); rpt_vstring(depth, "Executing command: %s", cmd); if (limit < 0) { rpt_vstring(depth, "Limiting output to last %d relevant lines...", -limit); } else if (limit > 0) { rpt_vstring(depth, "Limiting output to first %d relevant lines...", limit); } GPtrArray * filtered_lines = NULL; int rc = execute_cmd_collect_with_filter(cmd, filter_terms, ignore_case, limit, &filtered_lines); if (rc < 0) { f0printf(FERR, "Error executing command: %s\n", psc_desc(rc)); } else if (rc == 0) { // rc >0 is the original number of lines rpt_title("No output", depth); } else if (filtered_lines->len == 0) { rpt_title("No lines found after filtering", depth); } else { for (int ndx = 0; ndx < filtered_lines->len; ndx++) { rpt_title(g_ptr_array_index(filtered_lines, ndx), depth+1); } } bool result = (rc >= 0); DBGMSF(debug, "rc=%d, returning %s", rc, bool_repr(result)); rpt_nl(); return result; } /** Scans log files for lines of interest. * * Depending on operating environment, some subset of * the following files and command output: * - dmesg * - journalctl * - /var/log/daemon.log * - /var/log/kern.log * - /var/log/messages * - /var/log/syslog * - /var/log/Xorg.0.log * * \param accum collected environment information */ void probe_logs(Env_Accumulator * accum) { // TODO: Function needs major cleanup int depth = 0; int d1 = depth+1; int d2 = depth+2; // DBGMSG("Starting"); // debug_output_dest(); rpt_nl(); rpt_title("Examining system logs...", depth); // TODO: Pick simpler data structures. Is Value_Name_Title_Table worth it? const Byte LOG_XORG = 0x80; const Byte LOG_DAEMON = 0x40; const Byte LOG_SYSLOG = 0x20; const Byte LOG_KERN = 0x10; const Byte LOG_JOURNALCTL = 0x08; const Byte LOG_MESSAGES = 0x04; const Byte LOG_DMESG = 0x02; Value_Name_Title_Table log_table = { VNT(LOG_DMESG, "dmesg" ), VNT(LOG_JOURNALCTL, "journalctl" ), VNT(LOG_DAEMON, "/var/log/daemon.log" ), VNT(LOG_KERN, "/var/log/kern.log" ), VNT(LOG_MESSAGES, "/var/log/messages" ), VNT(LOG_SYSLOG, "/var/log/syslog" ), VNT(LOG_XORG, "/var/log/Xorg.0.log"), VNT_END }; bool log_xorg_found = false; bool log_daemon_found = false; // Raspbian bool log_syslog_found = false; // Ubuntu, Raspbian bool log_kern_found = false; // Raspbian //bool log_journalctl_found = false; // Debian, Raspbian bool log_messages_found = false; // Raspbian bool log_dmesg_found = false; Byte logs_checked = 0x00; Byte logs_found = 0x00; #ifdef NO // Problem: dmesg can be filled w i2c errors from i2cdetect trying to // read an SMBus device // Disable prefix_matches until filter out SMBUS devices p = prefix_matches; #endif char * addl_matches[] = { "drm", "video", "eeprom", "i2c_", // was i2c_ NULL }; Null_Terminated_String_Array drivers_plus_addl_matches = ntsa_join(get_known_video_driver_module_names(), addl_matches, /*dup*/ false); // *** dmesg *** rpt_nl(); // first few lines of dmesg are lost. turning on any sort of debugging causes // them to reappear. apparently a NL in the stream does the trick. why? // it's a heisenbug. Just use the more verbose journalctl output logs_checked |= LOG_DMESG; rpt_title("Scanning dmesg output for I2C related entries...", depth+1); log_dmesg_found = probe_cmd( "dmesg", drivers_plus_addl_matches, true, // ignore_case 0, // no limit depth+1); if (log_dmesg_found) logs_found |= LOG_DMESG; // *** journalctl *** logs_checked |= LOG_JOURNALCTL; #ifdef ALT // if don't use this version, don't need to link with libsystemd DBGMSG("Using get_current_boot_messages..."); rpt_title("Checking journalctl for I2C related entries...", depth+1); GPtrArray * journalctl_msgs = get_current_boot_messages(drivers_plus_addl_matches, /* ignore case */true, 0); if (journalctl_msgs) { // log_journalctl_found = true; logs_found |= LOG_JOURNALCTL; for (int ndx = 0; ndx < journalctl_msgs->len; ndx++) { rpt_vstring(depth+2, "%s", g_ptr_array_index(journalctl_msgs, ndx)); } } rpt_nl(); #endif // has a few more lines from nvidia-persistence, lines have timestamp, hostname, and subsystem rpt_title("Scanning journalctl output for I2C related entries...", depth+1); log_dmesg_found = probe_cmd("journalctl --no-pager --boot", drivers_plus_addl_matches, /*ignore_case*/ true, 0, depth+1); if (log_dmesg_found) logs_found |= LOG_DMESG; rpt_nl(); // *** Xorg.0.log *** char * xorg_terms[] = { // "[Ll]oadModule:", // matches LoadModule, UnloadModule "LoadModule:", // matches LoadModule, UnloadModule // "[Ll]oading", // matches Loading Unloading "Loading", "driver for", "Matched .* as autoconfigured", "Loaded and initialized", "drm", "soc", "fbdev", // matches fbdevhw "vc4", "i2c", NULL }; // Null_Terminated_String_Array log_terms = all_terms; char * rasp_log_terms[] = { "i2c", NULL }; Null_Terminated_String_Array log_terms = ntsa_join(drivers_plus_addl_matches, rasp_log_terms, false); Null_Terminated_String_Array all_terms = log_terms; if (accum->is_arm) { logs_checked |= LOG_XORG; log_xorg_found = probe_log("/var/log/Xorg.0.log", xorg_terms, /*ignore_case*/ true, 0, depth+1); if (log_xorg_found) logs_found |= LOG_XORG; } else { logs_checked |= LOG_XORG; // rpt_vstring(depth+1, "Limiting output to 200 lines..."); log_xorg_found = probe_log("/var/log/Xorg.0.log", drivers_plus_addl_matches, /*ignore_case*/ true, 200, depth+1); if (log_xorg_found) logs_found |= LOG_XORG; } // ***/var/log/kern.log, /var/log/daemon.log, /var/log/syslog, /var/log/messages *** // Using our own code instead of shell to scan files log_messages_found = probe_log("/var/log/messages", log_terms, /*ignore_case*/ true, -40, d1); log_kern_found = probe_log("/var/log/kern.log", log_terms, /*ignore_case*/ true, -20, d1); log_daemon_found = probe_log("/var/log/daemon.log", log_terms, /*ignore_case*/ true, -10, d1); log_syslog_found = probe_log("/var/log/syslog", log_terms, /*ignore_case*/ true, -50, d1); logs_checked |= (LOG_MESSAGES | LOG_KERN | LOG_DAEMON | LOG_SYSLOG); if (log_messages_found) logs_found |= LOG_MESSAGES; if (log_kern_found) logs_found |= LOG_KERN; if (log_daemon_found) logs_found |= LOG_DAEMON; if (log_syslog_found) logs_found |= LOG_SYSLOG; // for now, just report the logs seen to avoid warning about unused vars #ifdef NO rpt_title("Log files found: ", depth); rpt_bool("dmesg" , NULL, log_dmesg_found, d1); rpt_bool("/var/log/messages" , NULL, log_messages_found, d1); rpt_bool("journalctl" , NULL, log_journalctl_found, d1); rpt_bool("/var/log/kern" , NULL, log_kern_found, d1); rpt_bool("/var/log/syslog" , NULL, log_syslog_found, d1); rpt_bool("/var/log/daemaon" , NULL, log_daemon_found, d1); rpt_bool("/var/log/Xorg.0.log" , NULL, log_xorg_found, d1); #endif rpt_nl(); rpt_title("Log Summary", d1); rpt_vstring(d2, "%-30s %-7s %-6s", "Log", "Checked", "Found"); rpt_vstring(d2, "%-30s %-7s %-6s", "===", "=======", "====="); for (Value_Name_Title * entry = log_table; entry->title; entry++) { rpt_vstring(d2, "%-30s %-7s %-6s", entry->title, bool_repr(logs_checked & entry->value), bool_repr(logs_found & entry->value)); } rpt_nl(); if (log_terms != all_terms) ntsa_free(log_terms, false); ntsa_free(all_terms, false); ntsa_free(drivers_plus_addl_matches, false); } /** Examines kernel configuration files and DKMS. * * \param accum accumulated environment */ void probe_config_files(Env_Accumulator * accum) { int depth = 0; // DBGMSG("Starting"); // debug_output_dest(); rpt_nl(); rpt_title("Examining configuration files...", depth); if (accum->is_arm) { rpt_title("Examining /boot/config.txt:", depth+1); execute_shell_cmd_rpt("egrep -i -edtparam -edtoverlay -edevice_tree /boot/config.txt | grep -v \"^ *#\"", depth+2); rpt_nl(); rpt_vstring(depth+1, "Looking for blacklisted drivers in /etc/modprobe.d:"); execute_shell_cmd_rpt("grep -ir blacklist /etc/modprobe.d | grep -v \"^ *#\"", depth+2); } else { rpt_nl(); rpt_vstring(0,"DKMS modules:"); execute_shell_cmd_rpt("dkms status", 1 /* depth */); rpt_nl(); rpt_vstring(0,"Kernel I2C configuration settings:"); // execute_shell_cmd_rpt("grep I2C /boot/config-$(uname -r)", 1 /* depth */); execute_shell_cmd_rpt("grep I2C_CHARDEV /boot/config-$(uname -r)", 1 /* depth */); rpt_nl(); rpt_vstring(0,"Kernel AMDGPU configuration settings:"); execute_shell_cmd_rpt("grep AMDGPU /boot/config-$(uname -r)", 1 /* depth */); rpt_nl(); // TMI: // rpt_vstring(0,"Full xrandr --props:"); // execute_shell_cmd_rpt("xrandr --props", 1 /* depth */); // rpt_nl(); } } ddcutil-0.8.6/src/app_sysenv/query_sysenv_modules.c0000644000175000001440000001621713225367107017535 00000000000000/* query_sysenv_modules.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Module checks */ /** \cond */ #include // #define _GNU_SOURCE 1 // for function group_member #include #include #include #include #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "util/sysfs_util.h" /** \endcond */ #include "base/core.h" #include "base/linux_errno.h" #include "query_sysenv_modules.h" /* Checks if a module is built in to the kernel. * * Arguments: * module_name simple module name, as it appears in the file system, e.g. i2c-dev * * Returns: true/false */ bool is_module_builtin(char * module_name) { bool debug = false; bool result = false; struct utsname utsbuf; int rc = uname(&utsbuf); assert(rc == 0); char modules_builtin_fn[100]; snprintf(modules_builtin_fn, 100, "/lib/modules/%s/modules.builtin", utsbuf.release); #ifdef OLD // TODO: replace shell command with API read and scan of file, // can use code from query_sysenv_logs.c char cmdbuf[200]; snprintf(cmdbuf, 200, "grep -H %s.ko %s", module_name, modules_builtin_fn); // DBGMSG("cmdbuf = |%s|", cmdbuf); GPtrArray * response = execute_shell_cmd_collect(cmdbuf); // internal rc = 0 if found, 256 if not found // returns 0 lines if not found // NULL response if command error // DBGMSG("execute_shell_cmd_collect() returned %d lines", response->len); // for (int ndx = 0; ndx < response->len; ndx++) { // puts(g_ptr_array_index(response, ndx)); // } result = (response && response->len > 0); g_ptr_array_free(response, true); #endif // new way char ko_name[40]; snprintf(ko_name, 40, "%s.ko", module_name); bool builtin2 = false; GPtrArray * lines = g_ptr_array_new_full(400, g_free); char * terms[2]; terms[0] = ko_name; terms[1] = NULL; int unfiltered_ct = read_file_with_filter(lines, modules_builtin_fn, terms, false, 0); if (unfiltered_ct < 0) { int errsv = errno; fprintf(FERR, "Error reading file %s: %s\n", modules_builtin_fn, linux_errno_desc(errsv)); fprintf(FERR, "Assuming module %s is not built in to kernsl\n", module_name); } else { // DBGMSG("lines->len=%d", lines->len); builtin2 = (lines->len == 1); } g_ptr_array_free(lines, true); // DBGMSG("builtin2=%s", bool_repr(builtin2)); result = builtin2; DBGMSF(debug, "module_name = %s, returning %s", module_name, bool_repr(result)); return result; } /* Checks if a loadable module exists * * Arguments: * module_name simple module name, as it appears in the file system, e.g. i2c-dev, * without .ko, .ko.xz * * Returns: true/false */ bool is_module_loadable(char * module_name, int depth) { bool debug = false; DBGMSF(debug, "Starting. module_name=%s", module_name); bool result = false; struct utsname utsbuf; int rc = uname(&utsbuf); assert(rc == 0); char module_name_ko[100]; g_snprintf(module_name_ko, 100, "%s.ko", module_name); char dirname[PATH_MAX]; g_snprintf(dirname, PATH_MAX, "/lib/modules/%s/kernel/drivers/i2c", utsbuf.release); struct dirent *dent; DIR *d; d = opendir(dirname); if (!d) { rpt_vstring(depth,"Unable to open directory %s: %s", dirname, strerror(errno)); } else { while ((dent = readdir(d)) != NULL) { // DBGMSG("%s", dent->d_name); if (!streq(dent->d_name, ".") && !streq(dent->d_name, "..") ) { if (str_starts_with(dent->d_name, module_name_ko)) { result = true; break; } } } closedir(d); } DBGMSF(debug, "Done. Returning: %s", bool_repr(result)); return result; } /* Checks if module i2c_dev is required and if so whether it is loaded. * Reports the result. * * \param accum collects environment information * \param depth logical indentation depth * * \remark * Sets #accum->module_i2c_dev_needed * #accum->module_i2c_dev_loaded * #accum->loadable_i2c_dev_exists */ void check_i2c_dev_module(Env_Accumulator * accum, int depth) { int d0 = depth; int d1 = depth+1; rpt_vstring(d0,"Checking for module i2c_dev..."); DDCA_Output_Level output_level = get_output_level(); accum->module_i2c_dev_needed = true; accum->i2c_dev_loaded_or_builtin = false; bool is_builtin = is_module_builtin("i2c-dev"); accum->module_i2c_dev_builtin = is_builtin; rpt_vstring(d1,"Module %s is %sbuilt into kernel", "i2c-dev", (is_builtin) ? "" : "NOT "); accum->loadable_i2c_dev_exists = is_module_loadable("i2c-dev", d1); if (!is_builtin) rpt_vstring(d1,"Loadable i2c-dev module %sfound", (accum->loadable_i2c_dev_exists) ? "" : "NOT "); bool is_loaded = is_module_loaded_using_sysfs("i2c_dev"); accum->i2c_dev_loaded_or_builtin = is_loaded || is_builtin; if (!is_builtin) rpt_vstring(d1,"Module %s is %sloaded", "i2c_dev", (is_loaded) ? "" : "NOT "); bool module_required = !only_nvidia_or_fglrx(accum->driver_list); if (!module_required) { rpt_nl(); rpt_vstring(d0,"Using only proprietary nvidia or fglrx driver. Module i2c_dev not required."); accum->module_i2c_dev_needed = false; } else if (!is_builtin) { if (bva_length(accum->dev_i2c_device_numbers) == 0 && !is_loaded ) { rpt_nl(); rpt_vstring(d0, "No /dev/i2c-N devices found, and module i2c_dev is not loaded."); rpt_nl(); } if ( !is_loaded || output_level >= DDCA_OL_VERBOSE) { rpt_nl(); rpt_vstring(0,"Check that kernel module i2c_dev is being loaded by examining files where this would be specified..."); execute_shell_cmd_rpt("grep -H i2c[-_]dev " "/etc/modules " "/etc/modules-load.d/*conf " "/run/modules-load.d/*conf " "/usr/lib/modules-load.d/*conf " , d1); rpt_nl(); rpt_vstring(0,"Check for any references to i2c_dev in /etc/modprobe.d ..."); execute_shell_cmd_rpt("grep -H i2c[-_]dev " "/etc/modprobe.d/*conf " "/run/modprobe.d/*conf " , d1); } } } ddcutil-0.8.6/src/app_sysenv/query_sysenv_procfs.c0000644000175000001440000001174113226555474017365 00000000000000/* query_sysenv_procfs.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Query environment using /proc file system */ /** \cond */ #include #include #include #include "util/data_structures.h" #include "util/file_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/sysfs_util.h" #include "base/core.h" /** \endcore */ #include "query_sysenv_base.h" #include "query_sysenv_procfs.h" /** Scans /proc/modules for information on loaded drivers of interest */ int query_proc_modules_for_video() { bool debug = false; DBGMSF0(debug, "Starting."); int d1 = 1; int rc = 0; GPtrArray * garray = g_ptr_array_sized_new(300); rpt_vstring(0,"Scanning /proc/modules for driver environment..."); int ct = file_getlines("/proc/modules", garray, true); if (ct < 0) rc = ct; else { int ndx = 0; for (ndx=0; ndxlen; ndx++) { char * curline = g_ptr_array_index(garray, ndx); char mod_name[32]; int mod_size; int mod_instance_ct; char mod_dependencies[500]; char mod_load_state[10]; // one of: Live Loading Unloading char mod_addr[30]; int piece_ct = sscanf(curline, "%s %d %d %s %s %s", mod_name, &mod_size, &mod_instance_ct, mod_dependencies, mod_load_state, mod_addr); if (piece_ct != 6) { DBGMSG("Unexpected error parsing /proc/modules. sscanf returned %d", piece_ct); } if (streq(mod_name, "drm") ) { rpt_vstring(d1,"Loaded drm module depends on: %s", mod_dependencies); } else if (streq(mod_name, "video") ) { rpt_vstring(d1,"Loaded video module depends on: %s", mod_dependencies); } else if (exactly_matches_any(mod_name, (const char **) get_known_video_driver_module_names()) >= 0 ) { rpt_vstring(d1,"Found video driver module: %s", mod_name); } else if ( starts_with_any(mod_name, (const char **) get_prefix_match_names()) >= 0 ) { rpt_vstring(d1,"Found other loaded module: %s", mod_name); } } } DBGMSF0(debug, "Done."); return rc; } /** Reports nvidia proprietary driver information by examining * /proc/driver/nvidia. */ bool query_proc_driver_nvidia() { bool debug = false; bool result = false; char * dn = "/proc/driver/nvidia/"; if ( directory_exists(dn) ) { rpt_vstring(0,"Examining /proc/driver/nvidia:"); result = true; sysenv_show_one_file(dn, "version", debug, 1); sysenv_show_one_file(dn, "registry", debug, 1); sysenv_show_one_file(dn, "params", debug, 1); char * dn_gpus = "/proc/driver/nvidia/gpus/"; if (directory_exists(dn_gpus)) { DIR * dp = opendir(dn_gpus); struct dirent * ep; while ( (ep = readdir(dp)) ) { if ( !streq(ep->d_name,".") && !streq(ep->d_name, "..") ) { rpt_vstring(1, "PCI bus id: %s", ep->d_name); char dirbuf[400]; strcpy(dirbuf, dn_gpus); strcat(dirbuf, ep->d_name); // printf("Reading directory: %s\n", dirbuf); // DIR * dp2 = opendir(dirbuf); // if (dp2) { // struct dirent * ep2; // printf("GPU: %s\n", ep->d_name); // while ( (ep2 = readdir(dp2)) ) { // if ( !streq(ep2->d_name,".") && !streq(ep2->d_name, "..") ) { // puts(ep2->d_name); // } // } // closedir(dp2); // } if ( directory_exists(dirbuf)) { sysenv_show_one_file(dirbuf, "information", debug, 1); sysenv_show_one_file(dirbuf, "registry", debug, 1); } } } closedir(dp); } } else { DBGMSF(debug, "Nvidia driver directory %s not found\n", dn); } return result; } ddcutil-0.8.6/src/app_sysenv/query_sysenv_sysfs.c0000644000175000001440000006350713226555406017242 00000000000000/* query_sysenv_sysfs.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Query environment using /sys file system */ /** \cond */ // #define _GNU_SOURCE // for basename #include #include #include #include #include #include #include #include "util/data_structures.h" #include "util/device_id_util.h" #include "util/file_util.h" #include "util/i2c_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "util/sysfs_util.h" #include "base/core.h" #include "base/linux_errno.h" /** \endcond */ #include "query_sysenv_base.h" #include "query_sysenv_xref.h" #include "query_sysenv_sysfs.h" // Notes on directory structure // // /sys/bus/pci/devices/0000:nn:nn.n/ // boot_vga 1 if the boot device, appears not exist ow // class 0x030000 for video // device hex PID // driver -> /sys/bus/pci/drivers/radeon // drm // card0 (dir) // controlD64 (dir) // controlD128 (dir) // enable // graphics (dir) // fb0 (dir) // i2c-n (dir) // device -> /sys/bus/pci/devices/0000:nn:nn.n // name // modalias // subsystem (dir) -> /sys/bus/pci // devices (dir) // drivers (dir) // subsystem_device // subsystem_vendor // vendor hex VID // // also of possible interest: // /sys/class/i2c-dev/i2c-*/name // refers to video driver or piix4_smbus // also accessed at: // /sys/bus/i2c/devices/i2c-*/name // /sys/bus/pci/drivers/nouveau // /sys/bus/pci/drivers/piix4_smbus // /sys/bus/pci/drivers/nouveau/0000:01:00.0 // /name // i2c-dev // /sys/module/nvidia // /sys/module/i2c_dev ? // /sys/module/... etc // Raspbian: // /sys/bus/platform/drivers/vc4_v3d // /sys/module/vc4 // Local conversion functions for data coming from sysfs, // which should always be valid. static ushort h2ushort(char * hval) { bool debug = false; int ct; ushort ival; ct = sscanf(hval, "%hx", &ival); assert(ct == 1); if (debug) DBGMSG("hhhh = |%s|, returning 0x%04x", hval, ival); return ival; } static unsigned h2uint(char * hval) { bool debug = false; int ct; unsigned ival; ct = sscanf(hval, "%x", &ival); assert(ct == 1); if (debug) DBGMSG("hhhh = |%s|, returning 0x%08x", hval, ival); return ival; } // Two ways to get the hex device identifiers. Both are ugly. // Reading modalias requires extracting values from a single string. // Reading individual ids from individual attributes is simpler, // but note the lack of error checking. // Pick your poison. /** Reads the device identifiers from directory * /sys/bus/pci/devices/nnnn:nn:nn.n/ using the individual vendor, device, * subsystem, and subsystem_device attributes. * * \param cur_dir_name directory name * \return struct containing the ids * * \remark * Note the struct itself is returned on the stack, not a pointer to a struct. * There is nothing to free. */ Device_Ids read_device_ids1(char * cur_dir_name) { Device_Ids result = {0}; char * vendor_id = read_sysfs_attr_w_default(cur_dir_name, "vendor", "0x00", true); char * device_id = read_sysfs_attr_w_default(cur_dir_name, "device", "0x00", true); char * subsystem_device = read_sysfs_attr_w_default(cur_dir_name, "subsystem_device", "0x00", true); char * subsystem_vendor = read_sysfs_attr_w_default(cur_dir_name, "subsystem_vendor", "0x00", true); result.vendor_id = h2ushort(vendor_id); result.device_id = h2ushort(device_id); result.subvendor_id = h2ushort(subsystem_vendor); result.subdevice_id = h2ushort(subsystem_device); free(vendor_id); free(device_id); free(subsystem_device); free(subsystem_vendor); return result; } /** Reads the device identifiers from the directory of a PCI device * (/sys/bus/pci/devices/nnnn:nn:nn.n/) by reading and parsing the modalias * attribute. * * \param cur_dir_name directory name * \return struct containing the ids * * \remark * Note the struct itself is returned on the stack, not a pointer to a struct. * There is nothing to free. */ Device_Ids read_device_ids2(char * cur_dir_name) { Device_Ids result = {0}; // TODO: Reimplement using proper parsing. See kernel file file2alias.c // See also: // http://people.skolelinux.org/pere/blog/Modalias_strings___a_practical_way_to_map__stuff__to_hardware.html char * modalias = read_sysfs_attr(cur_dir_name, "modalias", true); // printf("modalias: %s\n", modalias); if (modalias) { // printf("\nParsing modalias for values...\n"); char * colonpos = strchr(modalias, ':'); assert(colonpos); // coverity complains that strchr() might return NULL assert(*(colonpos+1) == 'v'); // vendor_id char * vendor_id = substr(colonpos, 2, 8); // printf("vendor_id: %s\n", vendor_id); assert(*(colonpos+10) == 'd'); char * device_id = lsub(colonpos+11,8); // printf("device_id: %s\n", device_id); assert( *(colonpos+19) == 's'); assert( *(colonpos+20) == 'v'); char * subsystem_vendor = lsub(colonpos+21,8); // printf("subsystem_vendor: %s\n", subsystem_vendor); assert( *(colonpos+29) == 's'); assert( *(colonpos+30) == 'd'); char * subsystem_device = lsub(colonpos+31,8); // printf("subsystem_device: %s\n", subsystem_device); assert( *(colonpos+39) == 'b'); assert( *(colonpos+40) == 'c'); // not used //char * base_class = lsub(colonpos+41,2); // printf("base_class: %s\n", base_class); // bytes 0-1 of value from class assert( *(colonpos+43) == 's'); assert( *(colonpos+44) == 'c'); // not used // char * sub_class = lsub(colonpos+45,2); // bytes 1-2 of value from class // printf("sub_class: %s\n", sub_class); assert( *(colonpos+47) == 'i'); // not used // char * interface_id = lsub(colonpos+48,2); // printf("interface_id: %s\n", interface_id); // bytes 4-5 of value from class? result.vendor_id = h2ushort(vendor_id); result.device_id = h2ushort(device_id); result.subvendor_id = h2ushort(subsystem_vendor); result.subdevice_id = h2ushort(subsystem_device); free(vendor_id); free(device_id); free(subsystem_vendor); free(subsystem_device); free(modalias); } return result; } #ifdef FUTURE_FRAGMENT void report_modalias(char * cur_dir_name, int depth) { char * modalias = read_sysfs_attr(cur_dir_name, "modalias", true); // printf("modalias: %s\n", modalias); if (modalias) { char * colonpos = strchr(modalias, ':'); assert(colonpos); // coverity complains that strchr() might return NULL if (!colonpos) { rpt_vstring(depth, "Unexpected modalias value: %s", modalias); } if (memcmp(modalias, "pci", (colonpos-1)-modalias) == 0) { // TO DO: properly refactor Device_Ids = read_device_ids2(cur_dir_name); // TOD: report it } else if (memcmp(modalias, "of", (colonpos-1)-modalias) == 0) { // format: of:NnameTtypeCclass // type may be "" // Cclass is optional // may repeat? char * re = "^of:N(.*)T(.*)" } else { rpt_vstring(depth, "modialias: %s", modalias); } } } #endif /** Reports one directory whose name is of the form /sys/bus/pci/devices/nnnn:nn:nn.n/driver * * Processes only files whose name is of the form i2c-n, * reporting the i2c-n dname and the the contained name attribute. * * This function is passed from #each_video_pci_device() to #dir_foreach() , * which in turn invokes this function. * * \param dirname always /sys/bus/pci/devices/nnnn:nn:nn.n/driver * \param fn fn, process only those of form i2c-n * \param accumulator accumulator struct * \param depth logical indentation depth */ void each_video_device_i2c(char * dirname, char * fn, void * accumulator, int depth) { bool debug = false; DBGMSF(debug, "dirname=%s, fn=%s", dirname, fn); if (str_starts_with(fn, "i2c")) { char cur_dir[PATH_MAX]; snprintf(cur_dir, PATH_MAX, "%s/%s", dirname, fn); char * name = read_sysfs_attr_w_default(cur_dir, "name","", false); rpt_vstring(depth, "I2C device: %-10s name: %s", fn, name); free(name); } } /** Reports the device identifiers in directory /sys/bus/pci/devices/nnnn:nn:nn.n * * Note that the devices/nnnn:nn:nn.n under /sys/bus/pci always has * vendor/device etc from modalias extracted into individual attributes. * Other device subdirectories do not necessarily have these attributes. * * \param sysfs_device_dir always /sys/bus/pck/devices/nnnn:nn:nn.n * \param depth logical indentation depth */ void report_device_identification(char * sysfs_device_dir, int depth) { bool debug = false; DBGMSF(debug, "sysfs_device_dir: %s", sysfs_device_dir); int d1 = depth+1; DBGMSF0(debug, "Reading device ids from individual attribute files..."); Device_Ids dev_ids = read_device_ids1(sysfs_device_dir); DBGMSF0(debug, "Reading device ids by parsing modalias attribute..."); Device_Ids dev_ids2 = read_device_ids2(sysfs_device_dir); assert(dev_ids.vendor_id == dev_ids2.vendor_id); assert(dev_ids.device_id == dev_ids2.device_id); assert(dev_ids.subvendor_id == dev_ids2.subvendor_id); assert(dev_ids.subdevice_id == dev_ids2.subdevice_id); bool pci_ids_ok = devid_ensure_initialized(); if (pci_ids_ok) { Pci_Usb_Id_Names names = devid_get_pci_names( dev_ids.vendor_id, dev_ids.device_id, dev_ids.subvendor_id, dev_ids.subdevice_id, 4); if (!names.vendor_name) names.vendor_name = "unknown vendor"; if (!names.device_name) names.device_name = "unknown device"; rpt_vstring(d1,"Vendor: x%04x %s", dev_ids.vendor_id, names.vendor_name); rpt_vstring(d1,"Device: x%04x %s", dev_ids.device_id, names.device_name); if (names.subsys_or_interface_name) rpt_vstring(d1,"Subvendor/Subdevice: %04x/%04x %s", dev_ids.subvendor_id, dev_ids.subdevice_id, names.subsys_or_interface_name); } else { rpt_vstring(d1,"Unable to find pci.ids file for name lookup."); rpt_vstring(d1,"Vendor: %04x ", dev_ids.vendor_id); rpt_vstring(d1,"Device: %04x ", dev_ids.device_id); rpt_vstring(d1,"Subvendor/Subdevice: %04x/%04x ", dev_ids.subvendor_id, dev_ids.subdevice_id); } } /** Returns the name for video class ids. * * Hardcoded because device_ids_util.c does not maintain the class * information that is maintained in file pci.ids. * * \param class_id * \return class name, "" if not a display controller class */ static char * video_device_class_name(unsigned class_id) { char * result = ""; switch(class_id >> 8) { case 0x0300: result = "VGA compatible controller"; break; case 0x0301: result = "XGA compatible controller"; break; case 0x0302: result = "3D controller"; break; case 0x0380: result = "Display controller"; break; default: if (class_id >> 16 == 0x03) result = "Unspecified display controller"; } return result; } /** Process attributes of a /sys/bus/pci/devices/nnnn:nn:nn.n directory.\ * * Ignores non-video devices, i.e. devices whose class does not begin * with x03. * * Called by #query_card_and_driver_using_sysfs() via #dir_foreach() * * \param dirname always /sys/bus/pci/devices * \param fn nnnn:nn:nn.n PCI device path * \param accum pointer to accumulator struct, may be NULL * \param depth logical indentation depth * * \remark * Adds detected driver to list of detected drivers */ void each_video_pci_device( char * dirname, char * fn, void * accumulator, int depth) { bool debug = false; DBGMSF(debug, "Starting. dirname=%s, fn=%s, accumulator=%p", dirname, fn, accumulator); int d1 = depth+1; Env_Accumulator * accum = accumulator; assert(accum && memcmp(accum->marker, ENV_ACCUMULATOR_MARKER, 4) == 0); char cur_dir_name[PATH_MAX]; sprintf(cur_dir_name, "%s/%s", dirname, fn); // DBGMSF(debug, "cur_dir_name: %s", cur_dir_name); char * device_class = read_sysfs_attr(cur_dir_name, "class", /*verbose=*/true); // DBGMSF(debug, "device_class: %s", device_class); if (!device_class) { rpt_vstring(depth, "Unexpected for %s: class not found", cur_dir_name); goto bye; } unsigned class_id = h2uint(device_class); // DBGMSF(debug, "class_id: 0x%08x", class_id); // if (str_starts_with(device_class, "0x03")) { if (class_id >> 16 == 0x03) { bool is_primary_video = false; switch(class_id >> 8) { case 0x0300: is_primary_video=true; break; case 0x0380: break; default: rpt_vstring(depth, "Unexpected class for video device: %s", device_class); } char * boot_vga = read_sysfs_attr_w_default(cur_dir_name, "boot_vga", "-1", false); // DBGMSG("boot_vga: %s", boot_vga); bool boot_vga_flag = (boot_vga && streq(boot_vga, "1")) ; rpt_vstring(depth, "%s video controller at PCI address %s (boot_vga flag is %sset)", (is_primary_video) ? "Primary" : "Secondary", fn, (boot_vga_flag) ? "" : "not "); rpt_vstring(d1, "Device class: x%06x %s", class_id, video_device_class_name(class_id)); report_device_identification(cur_dir_name, depth); // rpt_nl(); // rpt_vstring(d1,"Determining driver name and possibly version..."); char workfn[PATH_MAX]; sprintf(workfn, "%s/%s", cur_dir_name, "driver"); char resolved_path[PATH_MAX]; char * rpath = realpath(workfn, resolved_path); if (!rpath) { int errsv = errno; if (errsv == ENOENT) rpt_vstring(d1, "No driver"); else { rpt_vstring(d1, "realpath(%s) returned NULL, errno=%d (%s)", workfn, errsv, linux_errno_name(errsv)); } } else { // printf("realpath returned %s\n", rpath); // printf("%s --> %s\n",workfn, resolved_path); char * rp2 = strdup(rpath); char * driver_name = g_path_get_basename(rp2); rpt_vstring(d1, "Driver name: %s", driver_name); driver_name_list_add(&accum->driver_list, driver_name); free(rp2); free(driver_name); char driver_module_dir[PATH_MAX]; sprintf(driver_module_dir, "%s/driver/module", cur_dir_name); // printf("driver_module_dir: %s\n", driver_module_dir); char * driver_version = read_sysfs_attr(driver_module_dir, "version", false); if (driver_version) rpt_vstring(d1,"Driver version: %s", driver_version); else rpt_vstring(d1,"Driver version: Unable to determine"); // list associated I2C devices dir_foreach(cur_dir_name, NULL, each_video_device_i2c, NULL, d1); } free(boot_vga); } else if (str_starts_with(device_class, "0x0a")) { rpt_vstring(depth, "Encountered docking station (class 0x0a) device. dir=%s", cur_dir_name); } bye: return; } /** Process attributes of a /sys/bus/platform/drivers directory * * Only processes entry for driver vc4_v3d. * * Called by #query_card_and_driver_using_sysfs() via #dir_foreach() * * \param dirname always /sys/bus/platform/drivers * \param fn driver name * \param accum pointer to accumulator struct, may be NULL * \param depth logical indentation depth * * \remark * Adds detected driver to list of detected drivers */ void each_arm_driver(char * dirname, char * fn, void * accumulator, int depth) { bool debug = false; DBGMSF(debug, "Starting. dirname=%s, fn=%s, accumulator=%p", dirname, fn, accumulator); Env_Accumulator * accum = accumulator; assert(accumulator && memcmp(accum->marker, ENV_ACCUMULATOR_MARKER, 4) == 0); if (streq(fn, "vc4_v3d")) { char * driver_name = fn; rpt_vstring(depth, "Driver name: %s", driver_name); driver_name_list_add(&accum->driver_list, driver_name); } DBGMSF0(debug, "Done"); } /** Depending on architecture, examines /sys/bus/pci/devices or * /sub/bus/platform/drivers. * * \accum accum * * \remark * Updates list of detected drivers, accum->driver_list */ void query_card_and_driver_using_sysfs(Env_Accumulator * accum) { bool debug = false; DBGMSF(debug, "Starting. accum=%p", accum); rpt_vstring(0,"Obtaining card and driver information from /sys..."); if (accum->is_arm) { DBGMSF(debug, "Machine architecture is %s. Skipping /sys/bus/pci checks.", accum->architecture); char * platform_drivers_dir_name = "/sys/bus/platform/drivers"; dir_foreach(platform_drivers_dir_name, /*fn_filter*/ NULL, each_arm_driver, accum, 0); } else { char * pci_devices_dir_name = "/sys/bus/pci/devices"; dir_foreach(pci_devices_dir_name, /*fn_filter*/ NULL, each_video_pci_device, accum, 0); } } /** For each driver module name known to be relevant, checks /sys to * see if it is loaded. */ void query_loaded_modules_using_sysfs() { rpt_vstring(0,"Testing if modules are loaded using /sys..."); // known_video_driver_modules // other_driver_modules char ** pmodule_name = get_known_video_driver_module_names(); char * curmodule; int ndx; for (ndx=0; (curmodule=pmodule_name[ndx]) != NULL; ndx++) { bool is_loaded = is_module_loaded_using_sysfs(curmodule); // DBGMSF(debug, "is_loaded=%d", is_loaded); rpt_vstring(0," Module %-16s is %sloaded", curmodule, (is_loaded) ? "" : "NOT "); } pmodule_name = get_other_driver_module_names(); for (ndx=0; (curmodule=pmodule_name[ndx]) != NULL; ndx++) { bool is_loaded = is_module_loaded_using_sysfs(curmodule); rpt_vstring(0," Module %-16s is %sloaded", curmodule, (is_loaded) ? "" : "NOT "); } } /** Examines a single /dev/sub/i2c/devices/i2c-N directory. * * Called by #dir_foreach() from #query_sys_bus_i2c() * * \param dirname always /sys/bus/i2c/devices * \param fn i2c-0, i2c-1, ... * \param accumulator collects environment information * \param depth logical indentation depth * * \remark * Adds current bus number to **accumulator->sys_bus_i2c_device_numbers */ void each_i2c_device( char * dirname, // always /sys/bus/i2c/devices char * fn, // i2c-0, i2c-1, ... void * accumulator, int depth) { Env_Accumulator * accum = accumulator; char cur_dir_name[100]; sprintf(cur_dir_name, "%s/%s", dirname, fn); char * dev_name = read_sysfs_attr(cur_dir_name, "name", true); char buf[100]; snprintf(buf, 100, "%s/name:", cur_dir_name); rpt_vstring(depth, "%-34s %s", buf, dev_name); int busno = i2c_name_to_busno(fn); if (busno >= 0) bva_append(accum->sys_bus_i2c_device_numbers, busno); else DBGMSG("Unexpected /sys/bus/i2c/devices file name: %s", fn); accum->sysfs_i2c_devices_exist = true; } /** Examines /sys/bus/i2c/devices * * \param accumulator collects environment information * * \remark * Sets **accumulator->sys_bus_i2c_device_numbers** to sorted * array of detected I2C device numbers. */ void query_sys_bus_i2c(Env_Accumulator * accumulator) { accumulator->sys_bus_i2c_device_numbers = bva_create(); rpt_vstring(0,"Examining /sys/bus/i2c/devices..."); char * dname = "/sys/bus/i2c"; if (!directory_exists(dname)) { rpt_vstring(1, "Directory not found: %s", dname); } else { char * dname = "/sys/bus/i2c/devices"; accumulator->sysfs_i2c_devices_exist = false; dir_foreach(dname, NULL, each_i2c_device, accumulator, 1); if (!accumulator->sysfs_i2c_devices_exist) rpt_vstring(1, "No i2c devices found in %s", dname); bva_sort(accumulator->sys_bus_i2c_device_numbers); } } /** Examines /sys/class/drm */ void query_drm_using_sysfs() { struct dirent *dent; struct dirent *dent2; DIR *d; char *dname; char dnbuf[90]; const int cardname_sz = 20; char cardname[cardname_sz]; rpt_vstring(0,"Examining /sys/class/drm..."); dname = "/sys/class/drm"; d = opendir(dname); if (!d) { rpt_vstring(1, "drm not defined in sysfs. Unable to open directory %s: %s\n", dname, strerror(errno)); } else { closedir(d); int cardno = 0; for (;;cardno++) { snprintf(cardname, cardname_sz, "card%d", cardno); snprintf(dnbuf, 80, "/sys/class/drm/%s", cardname); d = opendir(dnbuf); if (!d) { // rpt_vstring(1, "Unable to open sysfs directory %s: %s\n", dnbuf, strerror(errno)); break; } else { while ((dent = readdir(d)) != NULL) { // DBGMSG("%s", dent->d_name); // char cur_fn[100]; if (str_starts_with(dent->d_name, cardname)) { rpt_vstring(1, "Found connector: %s", dent->d_name); char cur_dir_name[PATH_MAX]; g_snprintf(cur_dir_name, PATH_MAX, "%s/%s", dnbuf, dent->d_name); // char * s_dpms = read_sysfs_attr(cur_dir_name, "dpms", false); // rpt_vstring(1, "%s/dpms: %s", cur_dir_name, s_dpms); // char * s_enabled = read_sysfs_attr(cur_dir_name, "enabled", false); // rpt_vstring(1, "%s/enabled: %s", cur_dir_name, s_enabled); char * s_status = read_sysfs_attr(cur_dir_name, "status", false); rpt_vstring(2, "%s/status: %s", cur_dir_name, s_status); // edid present iff status == "connected" if (streq(s_status, "connected")) { GByteArray * gba_edid = read_binary_sysfs_attr( cur_dir_name, "edid", 128, /*verbose=*/ false); // hex_dump(gba_edid->data, gba_edid->len); #ifdef UNNEEDED rpt_vstring(2, "Raw EDID:"); rpt_hex_dump(gba_edid->data, gba_edid->len, 2); if (gba_edid->len >= 128) { Parsed_Edid * parsed_edid = create_parsed_edid(gba_edid->data); if (parsed_edid) { report_parsed_edid_base( parsed_edid, true, // verbose false, // show_hex 2); // depth free_parsed_edid(parsed_edid); } else { rpt_vstring(2, "Unable to parse EDID"); // printf(" Unparsable EDID for output name: %s -> %p\n", prec->output_name, prec->edidbytes); // hex_dump(prec->edidbytes, 128); } } #endif // look for i2c-n subdirectory, may or may not be present depending on driver // DBGMSG("cur_dir_name: %s", cur_dir_name); DIR* d2 = opendir(cur_dir_name); char * i2c_node_name = NULL; if (!d2) { rpt_vstring(1, "Unexpected error. Unable to open sysfs directory %s: %s\n", cur_dir_name, strerror(errno)); break; } else { while ((dent2 = readdir(d2)) != NULL) { // DBGMSG("%s", dent2->d_name); if (str_starts_with(dent2->d_name, "i2c")) { rpt_vstring(2, "I2C device: %s", dent2->d_name); i2c_node_name = strdup(dent2->d_name); break; } } closedir(d2); } // rpt_nl(); Device_Id_Xref * xref = device_xref_get(gba_edid->data); // xref->sysfs_drm_name = strdup(dent->d_name); xref->sysfs_drm_name = strdup(cur_dir_name); xref->sysfs_drm_i2c = i2c_node_name; g_byte_array_free(gba_edid, true); } rpt_nl(); } } closedir(d); } } if (cardno==0) rpt_vstring(1, "No drm class cards found in %s", dname); // closedir(d); } rpt_title("Query file system for i2c nodes under /sys/class/drm/card*...", 1); execute_shell_cmd_rpt("ls -ld /sys/class/drm/card*/card*/i2c*", 1); } ddcutil-0.8.6/src/app_sysenv/query_sysenv_xref.c0000644000175000001440000001501613203271475017023 00000000000000/* query_sysenv_xref.c * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Display identifier cross-reference */ /** \cond */ #include #include #include #include #include "util/report_util.h" #include "util/string_util.h" #include "base/core.h" /** \endcond */ #include "query_sysenv_xref.h" /** Collection of #Device_Id_Xref */ static GPtrArray * device_xref = NULL; void device_xref_init() { device_xref = g_ptr_array_new(); } /** Finds an existing cross-reference entry with the specified * 128 byte EDID value. * * \param raw_edid pointer to 128 byte EDID * \return pointer to existing #Device_Id_Xref,\n * NULL if not found */ Device_Id_Xref * device_xref_find(Byte * raw_edid) { Device_Id_Xref * result = NULL; for (int ndx = 0; ndx < device_xref->len; ndx++) { Device_Id_Xref * cur = g_ptr_array_index(device_xref, ndx); assert( memcmp(cur->marker, DEVICE_ID_XREF_MARKER, 4) == 0); if ( memcmp(cur->raw_edid, raw_edid, 128) == 0 ) { result = cur; break; } } return result; } /** Creates a new #Device_Id_Xref with the specified EDID value. * * \param raw_edid pointer 128 byte EDID * \return pointer to newly allocated #Device_Id_Xref */ Device_Id_Xref * device_xref_new(Byte * raw_edid) { Device_Id_Xref * xref = calloc(1, sizeof(Device_Id_Xref)); memcpy(xref->marker, DEVICE_ID_XREF_MARKER, 4); memcpy(xref->raw_edid, raw_edid, 128); xref->edid_tag = hexstring2(xref->raw_edid+124, 4, NULL, true, NULL, 0); xref->i2c_busno = -1; #ifdef ALTERNATIVE xref->sysfs_drm_busno = -1; #endif // DBGMSG("Created xref %p with tag: %s", xref, xref->edid_tag); return xref; } /** Returns the #Device_Id_Xref for the specified EDID value. * If the #Device_Id_Xref does not already exist, it is created * * \param raw_edid pointer 128 byte EDID * \return pointer to #Device_Id_Xref */ Device_Id_Xref * device_xref_get(Byte * raw_edid) { if (!device_xref) device_xref_init(); Device_Id_Xref * xref = device_xref_find(raw_edid); if (!xref) { xref = device_xref_new(raw_edid); g_ptr_array_add(device_xref, xref); } // else // DBGMSG("Found Device_Id_Xref %p for edid ...%s", xref, xref->edid_tag); return xref; } /** Find the #Device_Id_Xref for the specified I2C bus number * * \param busno I2C bus number * \return device identification cross-reference entry,\n * NULL if not found * */ Device_Id_Xref * device_xref_find_by_busno(int busno) { bool debug = false; Device_Id_Xref * result = NULL; for (int ndx = 0; ndx < device_xref->len; ndx++) { Device_Id_Xref * cur = g_ptr_array_index(device_xref, ndx); assert( memcmp(cur->marker, DEVICE_ID_XREF_MARKER, 4) == 0); if ( cur->i2c_busno == busno) { result = cur; break; } } if (debug) { if (result) DBGMSG("busno = %d, returning Device_Id_Xref %p for EDID ...%s", busno, result, result->edid_tag); else DBGMSG("busno = %d, not found", busno); } return result; } /** Reports the device identification cross-reference table. * * \param depth logical indentation depth */ void device_xref_report(int depth) { int d1 = depth+1; int d2 = depth+2; rpt_nl(); rpt_vstring(depth, "Device Identifier Cross Reference Report"); // rpt_nl(); // rpt_vstring(d1, "EDID Busno Xrandr DRM Udev name Udev Path"); for (int ndx = 0; ndx < device_xref->len; ndx++) { Device_Id_Xref * xref = g_ptr_array_index(device_xref, ndx); assert( memcmp(xref->marker, DEVICE_ID_XREF_MARKER, 4) == 0); Parsed_Edid * parsed_edid = create_parsed_edid(xref->raw_edid); #ifdef NO rpt_vstring(d1, "...%s %2d %-10s %-10s %-30s %s", xref->edid_tag, xref->i2c_busno, xref->xrandr_name, xref->drm_connector_name, xref->udev_name, xref->udev_syspath); if (parsed_edid) { rpt_vstring(d2, "Mfg: %s", parsed_edid->mfg_id); rpt_vstring(d2, "Model: %s", parsed_edid->model_name); rpt_vstring(d2, "SN: %s", parsed_edid->serial_ascii); } #endif rpt_nl(); if (parsed_edid) { rpt_vstring(d1, "EDID: ...%s Mfg: %-3s Model: %-13s SN: %-13s", xref->edid_tag, parsed_edid->mfg_id, parsed_edid->model_name, parsed_edid->serial_ascii); free_parsed_edid(parsed_edid); } else rpt_vstring(d1, "EDID: ...%s", xref->edid_tag); if (xref->i2c_busno == -1) rpt_vstring(d2, "I2C device: Not found"); else rpt_vstring(d2, "I2C device: /dev/i2c-%d", xref->i2c_busno); rpt_vstring(d2, "XrandR output: %s", xref->xrandr_name); rpt_vstring(d2, "DRM connector: %s", xref->drm_connector_name); // rpt_vstring(d2, "DRM path: %s", xref->drm_device_path); rpt_vstring(d2, "UDEV name: %s", xref->udev_name); rpt_vstring(d2, "UDEV syspath: %s", xref->udev_syspath); rpt_vstring(d2, "sysfs drm path: %s", xref->sysfs_drm_name); // pick one way or the other rpt_vstring(d2, "sysfs drm I2C: %s", xref->sysfs_drm_i2c); #ifdef ALTERNATIVE if (xref->sysfs_drm_busno == -1) rpt_vstring(d2, "sysfs drm bus: Not found"); else rpt_vstring(d2, "sysfs drm bus: i2c-%d", xref->sysfs_drm_busno); #endif // TEMP to screen scrape the EDID: // if (xref->raw_edid) { // char * s = hexstring2(xref->raw_edid, 128, // NULL, true, NULL, 0); // puts(s); // free(s); // } } } ddcutil-0.8.6/src/app_sysenv/query_sysenv_usb.c0000644000175000001440000002547213226555541016663 00000000000000/* query_usb_sysenv.c * * * Copyright (C) 2016-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Probe the USB environment */ #include // #define _GNU_SOURCE 1 // for function group_member /** \cond */ #include #include #include #include #include #include #include #include #include /** \endcond */ #include "util/file_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "util/sysfs_util.h" #include "util/udev_util.h" #include "util/udev_usb_util.h" #include "usb_util/hiddev_reports.h" #include "usb_util/hiddev_util.h" // #include "usb_util/hidapi_util.h" #include "usb_util/hidraw_util.h" // #include "util/libusb_reports.h" #include "usb_util/libusb_util.h" #include "usb_util/usb_hid_common.h" #include "base/core.h" #include "base/ddc_errno.h" // #include "base/linux_errno.h" #include "usb/usb_displays.h" #include "query_sysenv_usb.h" static bool is_hid_monitor_rdesc(const char * fn) { bool debug = false; bool result = false; char * first_line = file_get_first_line(fn, /*verbose=*/ true); DBGMSF(debug, "First line: %s", first_line); if ( first_line && str_starts_with( first_line, "05 80")) result = true; DBGMSF(debug, "fn=%s, returning: %s", fn, bool_repr(result)); return result; } /* Probe using the UHID debug interface in /sys/kernel/debug/hid * * For each HID device that's a monitor, displays the HID Report Descriptor. * * Arguments: * depth logical indentation depth * * Returns: nothing */ static void probe_uhid(int depth) { int d1 = depth+1; int d2 = depth+2; bool debug = false; DBGMSF0(debug, "Starting"); struct dirent * ep; char * dirname = "/sys/kernel/debug/hid/"; DIR * dp; dp = opendir(dirname); if (!dp) { int errsv = errno; rpt_vstring(depth, "Unable to open directory %s: %s", dirname, strerror(errsv)); } else { while ( (ep = readdir(dp))) { // puts(ep->d_name); char fqfn[PATH_MAX]; if (!streq(ep->d_name, ".") && !streq(ep->d_name, "..") ) { // file names look like: "0003:0424:3328:004D" // field 1: ? // field 2: vid // field 3: pid // field 4: appears to be a sequence number of some sort // increases with each call to ddcutil env -v snprintf(fqfn, PATH_MAX, "%s%s/rdesc", dirname, ep->d_name); // puts(fqfn); #ifdef FAILS puts(ep->d_name); printf("(%s) strlen(d_name) = %ld\n", __func__, strlen(ep->d_name)); uint16_t vid, pid, x, seq = 0; int ct = sscanf(ep->d_name, "%hX:%hX:%hX:%hX", &x, &vid, &pid, &seq); if (ct != 2) printf("(%s) sscanf failed, ct = %d\n", __func__, ct); else printf("(%s) sscanf ok, vid=0x%04x, pid=0x%04x\n", __func__, vid, pid); printf("(%s) x=0x%04x, vid=0x%04x, pid=0x%04x, seq=0x%04x\n", __func__,x,vid,pid,seq); // returns ct = 3, seq is unset, why? #endif bool is_monitor = is_hid_monitor_rdesc(fqfn); if (!is_monitor) { char * endptr; uint16_t vid = (uint16_t) strtoul(ep->d_name+5, &endptr, 16); uint16_t pid = (uint16_t) strtoul(ep->d_name+10, &endptr, 16); is_monitor = force_hid_monitor_by_vid_pid(vid, pid); } if (is_monitor) { rpt_nl(); rpt_vstring(d1, "%s:", fqfn); rpt_file_contents(fqfn, /*verbose=*/true, d2); } } } closedir(dp); } DBGMSF0(debug, "Done"); } /* Probe using the hiddev API * * Arguments: * depth logical indentation depth * * Returns: nothing */ static void probe_hiddev(int depth) { int d1 = depth+1; int rc; // rpt_vstring(0, "Checking for USB HID devices using hiddev..."); GPtrArray * hiddev_devices = get_hiddev_device_names(); rpt_vstring(depth, "Found %d USB HID devices.", hiddev_devices->len); for (int devndx=0; devndxlen; devndx++) { rpt_nl(); errno=0; char * curfn = g_ptr_array_index(hiddev_devices,devndx); int fd = usb_open_hiddev_device(curfn, CALLOPT_RDONLY); // do not emit error msg if (fd < 0) { // fd is -errno rpt_vstring(depth, "Unable to open device %s: %s", curfn, strerror(errno)); Usb_Detailed_Device_Summary * devsum = lookup_udev_usb_device_by_devname(curfn); if (devsum) { // report_usb_detailed_device_summary(devsum, 2); rpt_vstring(d1, "USB bus %s, device %s, vid:pid: %s:%s - %s:%s", devsum->busnum_s, devsum->devnum_s, devsum->vendor_id, devsum->product_id, devsum->vendor_name, devsum->product_name); free_usb_detailed_device_summary(devsum); } } else { char * cgname = get_hiddev_name(fd); struct hiddev_devinfo dev_info; errno = 0; rc = ioctl(fd, HIDIOCGDEVINFO, &dev_info); if (rc != 0) { rpt_vstring(d1, "Device %s, unable to retrieve information: %s", curfn, strerror(errno)); } else { char dev_summary[200]; snprintf(dev_summary, 200, "Device %s, devnum.busnum: %d.%d, vid:pid: %04x:%04x - %s", curfn, dev_info.busnum, dev_info.devnum, dev_info.vendor, dev_info.product & 0xffff, cgname); rpt_vstring(depth, "%s", dev_summary); bool b0 = is_hiddev_monitor(fd); if (b0) rpt_vstring(d1, "Identifies as a USB HID monitor"); else rpt_vstring(d1, "Not a USB HID monitor"); if (get_output_level() >= DDCA_OL_VERBOSE) { if (!b0) { b0 = force_hiddev_monitor(fd); if (b0) rpt_vstring(d1, "Device vid/pid matches exception list. Forcing report for device.\n"); } if (b0) { char * simple_devname = strstr(curfn, "hiddev"); Udev_Usb_Devinfo * dinfo = get_udev_usb_devinfo("usbmisc", simple_devname); if (dinfo) { // report_hidraw_devinfo(dinfo, d2); rpt_vstring( d1,"Busno:Devno as reported by get_udev_usb_devinfo() for %s: %03d:%03d", simple_devname, dinfo->busno, dinfo->devno); free(dinfo); } else rpt_vstring(d1, "Error getting busno:devno using get_udev_usb_devinfo()"); report_hiddev_device_by_fd(fd, d1); } } } free(cgname); close(fd); } } // n. free function was set at allocation time g_ptr_array_free(hiddev_devices, true); } /* Report information about USB connected monitors * * Arguments: none * * Returns: nothing */ static void query_usb_monitors() { rpt_nl(); rpt_vstring(0, "Checking for USB connected monitors..."); DDCA_Output_Level output_level = get_output_level(); rpt_nl(); rpt_vstring(1, "Using lsusb to summarize USB devices..."); execute_shell_cmd_rpt("lsusb|sort", 2); rpt_nl(); rpt_vstring(1, "USB device toplogy..."); execute_shell_cmd_rpt("lsusb -t", 2); rpt_nl(); rpt_vstring(1, "Listing /dev/usb..."); execute_shell_cmd_rpt("ls -l /dev/usb", 2); rpt_nl(); rpt_vstring(1, "Listing /dev/hiddev*..."); execute_shell_cmd_rpt("ls -l /dev/hiddev*", 2); rpt_nl(); rpt_vstring(1, "Listing /dev/bus/usb..."); execute_shell_cmd_rpt("ls -l /dev/bus/usb", 2); rpt_nl(); rpt_vstring(1, "Listing /dev/hidraw*..."); execute_shell_cmd_rpt("ls -l /dev/hidraw*", 2); rpt_nl(); if (output_level >= DDCA_OL_VERBOSE) { char * subsys_name = "usbmisc"; rpt_nl(); rpt_vstring(0, "Probing USB HID devices using udev, susbsystem %s...", subsys_name); probe_udev_subsystem(subsys_name, /*show_usb_parent=*/ true, 1); subsys_name = "hidraw"; rpt_nl(); rpt_vstring(0, "Probing USB HID devices using udev, susbsystem %s...", subsys_name); probe_udev_subsystem(subsys_name, /*show_usb_parent=*/ true, 1); } if (output_level >= DDCA_OL_VERBOSE) { // currently an overwhelming amount of information - need to display // only possible HID connected monitors rpt_nl(); rpt_vstring(0, "Probing possible HID monitors using libusb..."); probe_libusb(/*possible_monitors_only=*/ true, /*depth=*/ 1); rpt_nl(); rpt_vstring(0, "Checking for USB connected monitors on /dev/hidraw* ..."); probe_hidraw( true, // possible_monitors_only 1); // logical indentation depth // printf("\nProbing using hidapi...\n"); // don't use. wipes out /dev/hidraw and /dev/usb/hiddev devices it opens // no addional information. Feature values are returned as with libusb - // leading byte is report number // note that probe_hidapi() tests all possible report numbers, not just those // listed in the report descriptor. Found some additional reports in the // vendor specific range on the Apple Cinema display // probe_hidapi(1); } rpt_nl(); rpt_vstring(0, "Checking for USB HID devices using hiddev..."); probe_hiddev(1); rpt_nl(); rpt_vstring(0, "Checking for USB HID Report Descriptors in /sys/kernel/debug/hid..."); probe_uhid(1); } /* Master function to query USB aspects of the system environment * * Arguments: none * * Returns: nothing */ void query_usbenv() { query_usb_monitors(); } ddcutil-0.8.6/src/app_sysenv/query_sysenv_drm.c0000644000175000001440000005446113226555613016654 00000000000000/* query_drm_sysenv.c * * * Copyright (C) 2017-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * drm reporting for the environment command */ // #define _GNU_SOURCE /** \cond */ #include #include #include #include #include #include #include #include #include #include // NO. We want the versions in /usr/include/libdrm #ifdef NO #include #include #endif #include "util/edid.h" #include "util/file_util.h" #include "util/glib_util.h" #include "util/libdrm_util.h" #include "util/report_util.h" #include "util/string_util.h" #include "util/subprocess_util.h" #include "base/core.h" #include "base/linux_errno.h" /** \endcond */ #include "query_sysenv_xref.h" #include "query_sysenv_drm.h" // Trace class for this file static Trace_Group TRACE_GROUP = TRC_ENV; #ifdef REF // local copy for reference #define DRM_BUS_PCI 0 typedef struct _drmPciBusInfo { uint16_t domain; uint8_t bus; uint8_t dev; uint8_t func; } drmPciBusInfo, *drmPciBusInfoPtr; typedef struct _drmPciDeviceInfo { uint16_t vendor_id; uint16_t device_id; uint16_t subvendor_id; uint16_t subdevice_id; uint8_t revision_id; } drmPciDeviceInfo, *drmPciDeviceInfoPtr; typedef struct _drmDevice { char **nodes; /* DRM_NODE_MAX sized array */ int available_nodes; /* DRM_NODE_* bitmask */ int bustype; union { drmPciBusInfoPtr pci; } businfo; union { drmPciDeviceInfoPtr pci; } deviceinfo; } drmDevice, *drmDevicePtr; extern int drmGetDevice(int fd, drmDevicePtr *device); extern void drmFreeDevice(drmDevicePtr *device); #endif #ifdef UNUSED // can't find basename, roll our own char * basename0(char * fn) { char * result = NULL; if (fn) { int l = strlen(fn); if (l == 0) result = fn; else { char * p = fn+(l-1); while (*p != '/') { if (p == fn) { break; } p--; } result = (p == fn) ? p : p+1;; } } return result; } #endif char * drm_bus_type_name(uint8_t bus) { char * result = NULL; if (bus == DRM_BUS_PCI) result = "pci"; else result = "unk"; return result; } void report_drmVersion(drmVersion * vp, int depth) { rpt_vstring(depth, "Version: %d.%d.%d", vp->version_major, vp->version_minor, vp->version_patchlevel); rpt_vstring(depth, "Driver: %.*s", vp->name_len, vp->name); rpt_vstring(depth, "Date: %.*s", vp->date_len, vp->date); rpt_vstring(depth, "Description: %.*s", vp->desc_len, vp->desc); } /* Examines a single open DRM device. * * Arguments: * fd file handle of open DRM device * depth logical indentation depth * * Returns: nothing */ static void probe_open_device_using_libdrm(int fd, int depth) { int d1 = depth+1; int d2 = depth+2; int d3 = depth+3; bool debug = false; int rc; char * busid = NULL; // int errsv; rpt_nl(); DBGTRC(debug, TRACE_GROUP, "Starting. fd=%d", fd); // succeeds if run as root, fails w errno=EACCES(13) if not // but no effect on subsequent failures for nvidia // reviewed code in drm_ioctl.c. ioctl calls would fail with EACCES // if lack of master access were the cause #ifdef NO // fails on suse // rc is ioctl() return code, i.e. 0 or -1 for failure) // if -1, errno is set rc = drmSetMaster(fd); if (rc < 0) rpt_vstring(d1, "drmSetMaster() failed, errno=%s", linux_errno_desc(errno)); rpt_nl(); #endif // if returns NULL, errno is as set from the underlying ioctl() drmVersionPtr vp = drmGetVersion(fd); if (vp) { rpt_vstring(d1, "DRM driver version information:"); report_drmVersion(vp, d2); drmFreeVersion(vp); } else { rpt_vstring(d1, "Error calling drmGetVersion(). errno=%s", linux_errno_desc(errno)); } rpt_nl(); // fills in a hardcoded version number (currently 1.3.0), never fails // only fills in the major, minor, and patchLevel fields, others are always 0 vp = drmGetLibVersion(fd); // rpt_vstring(d1, "DRM library version information:"); // report_drmVersion(vp, d2); rpt_vstring(d1, "DRM library version: %d.%d.%d.", vp->version_major, vp->version_minor, vp->version_patchlevel); drmFreeVersion(vp); rpt_nl(); // returns null string if open() instead of drmOpen(,busid) used to to open // uses successive DRM_IOCTL_GET_UNIQUE calls busid = drmGetBusid(fd); if (busid) { rpt_vstring(d1, "DRM Busid: %s", busid); // drmFreeBusid(busid); } else { rpt_vstring(d1, "Error calling drmGetBusid(). errno=%s", linux_errno_desc(errno)); } char busid2[30] = ""; rpt_nl(); struct _drmDevice * ddev; // gets information about the opened DRM device // returns 0 on success, negative error code otherwise rc = drmGetDevice(fd, &ddev); if (rc < 0) { rpt_vstring(depth, "drmGetDevice() returned %d, interpreted as error code: %s", rc, linux_errno_desc(-rc)); } else { rpt_vstring(d1, "Device information:"); rpt_vstring(d2, "bustype: %d - %s", ddev->bustype, drm_bus_type_name(ddev->bustype)); #ifdef OLD rpt_vstring(d2, "bus,dev,domain,func: %d, %d, %d, %d", ddev->businfo.pci->bus, ddev->businfo.pci->dev, ddev->businfo.pci->domain, ddev->businfo.pci->func); #endif snprintf(busid2, sizeof(busid2), "%s:%04x:%02x:%02x.%d", drm_bus_type_name(ddev->bustype), ddev->businfo.pci->domain, ddev->businfo.pci->bus, ddev->businfo.pci->dev, ddev->businfo.pci->func); rpt_vstring(d2, "domain:bus:device.func: %04x:%02x:%02x.%d", ddev->businfo.pci->domain, ddev->businfo.pci->bus, ddev->businfo.pci->dev, ddev->businfo.pci->func); rpt_vstring(d2, "vendor vid:pid: 0x%04x:0x%04x", ddev->deviceinfo.pci->vendor_id, ddev->deviceinfo.pci->device_id); rpt_vstring(d2, "subvendor vid:pid: 0x%04x:0x%04x", ddev->deviceinfo.pci->subvendor_id, ddev->deviceinfo.pci->subdevice_id); rpt_vstring(d2, "revision id: 0x%04x", ddev->deviceinfo.pci->revision_id); drmFreeDevice(&ddev); } if (strlen(busid2) > 0) { rpt_nl(); // Notes from examining the code for drmCheckModesettingAvailable() // // Checks if a modesetting capable driver has been attached to the pci id // n.b. drmCheckModesettingSupport() takes a busid string as argument, not filename // // Returns 0 if bus id valid and modesetting supported // -EINVAL if invalid bus id // -ENOSYS if no modesetting support // does not set errno // parses busid using sscanf(busid, "pci:%04x:%02x:%02x.%d", &domain, &bus, &dev, &func); rpt_vstring(d1, "Is a modesetting capable driver attached to bus id: %s?", busid2); rpt_vstring(d1,"(calling drmCheckModesettingAvailable())"); rc = drmCheckModesettingSupported(busid2); switch (rc) { case (0): rpt_vstring(d2, "Yes"); break; case (-EINVAL): rpt_vstring(d2, "Invalid bus id (-EINVAL)"); break; case (-ENOSYS): rpt_vstring(d2, "Modesetting not supported (-ENOSYS)"); break; default: rpt_vstring(d2, "drmCheckModesettingSupported() returned undocumented status code %d", rc); } } #ifdef REF extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId); extern void drmModeFreeProperty(drmModePropertyPtr ptr); #endif rpt_nl(); rpt_vstring(d1, "Retrieving DRM resources..."); drmModeResPtr res = drmModeGetResources(fd); if (!res) { int errsv = errno; rpt_vstring(d1, "Failure retrieving DRM resources, errno=%s", linux_errno_desc(errno)); if (errsv == EINVAL) rpt_vstring(d1,"Driver apparently does not provide needed DRM ioctl calls"); goto bye; } if (debug) report_drmModeRes(res, d2); int edid_prop_id = 0; int subconnector_prop_id = 0; drmModePropertyPtr edid_prop_ptr = NULL; drmModePropertyPtr subconn_prop_ptr = NULL; rpt_nl(); rpt_vstring(d1, "Scanning defined properties..."); for (int prop_id = 0; prop_id < 200; prop_id++) { drmModePropertyPtr prop_ptr = drmModeGetProperty(fd, prop_id); if (prop_ptr) { if (debug) report_drm_modeProperty(prop_ptr, d2); else summarize_drm_modeProperty(prop_ptr, d2); // printf("prop_id=%d\n", prop_id); if (streq(prop_ptr->name, "EDID")) { // rpt_vstring(d1, "Found EDID property, prop_id=%d, prop_ptr->prop_id=%u", prop_id, prop_ptr->prop_id); edid_prop_id = prop_id; edid_prop_ptr = prop_ptr; } else if (streq(prop_ptr->name, "subconnector")) { // rpt_vstring(d1, "Found subconnector property, prop_id=%d, prop_ptr->prop_id=%u", prop_id, prop_ptr->prop_id); subconnector_prop_id = prop_id; subconn_prop_ptr = prop_ptr; } else { drmModeFreeProperty(prop_ptr); } } } #ifdef REF extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id); extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr); typedef struct _drmModePropertyBlob { uint32_t id; uint32_t length; void *data; } drmModePropertyBlobRes, *drmModePropertyBlobPtr; #endif rpt_nl(); rpt_vstring(d1, "Scanning connectors..."); for (int i = 0; i < res->count_connectors; ++i) { drmModeConnector * conn = drmModeGetConnector(fd, res->connectors[i]); if (!conn) { rpt_vstring(d1, "Cannot retrieve DRM connector id %d errno=%s", res->connectors[i], linux_errno_desc(errno)); continue; } if (debug) report_drmModeConnector(fd, conn, d1) ; char connector_name[100]; snprintf(connector_name, 100, "%s-%u", connector_type_title(conn->connector_type), conn->connector_type_id); rpt_vstring(d1, "%-20s %u", "connector_id:", conn->connector_id); // rpt_vstring(d2, "%-20s %s-%u", "connector name", connector_type_title(conn->connector_type), // conn->connector_type_id); rpt_vstring(d2, "%-20s %s", "connector name", connector_name); rpt_vstring(d2, "%-20s %d - %s", "connector_type:", conn->connector_type, connector_type_title(conn->connector_type)); rpt_vstring(d2, "%-20s %d", "connector_type_id:", conn->connector_type_id); rpt_vstring(d2, "%-20s %d - %s", "connection:", conn->connection, connector_status_title(conn->connection)); uint32_t encoder_id = conn->encoder_id; // current encoder rpt_vstring(d2, "%-20s %d", "encoder:", encoder_id); drmModeEncoderPtr penc = drmModeGetEncoder(fd, encoder_id); if (penc) { rpt_vstring(d3, "%-20s %d - %s", "encoder type (signal format):", penc->encoder_type, encoder_type_title(penc->encoder_type)); } else { rpt_vstring(d2, "Encoder with id %d not found", encoder_id); } for (int ndx = 0; ndx < conn->count_props; ndx++) { if (conn->props[ndx] == edid_prop_id) { rpt_vstring(d2, "EDID property"); uint64_t blob_id = conn->prop_values[ndx]; drmModePropertyBlobPtr blob_ptr = drmModeGetPropertyBlob(fd, blob_id); if (!blob_ptr) { rpt_vstring(d3, "Blob not found"); } else { // printf("blob_ptr->id = %d\n", blob_ptr->id); rpt_vstring(d3, "Raw property blob:"); report_drmModePropertyBlob(blob_ptr, d3); if (blob_ptr->length >= 128) { Parsed_Edid * parsed_edid = create_parsed_edid(blob_ptr->data); if (parsed_edid) { report_parsed_edid_base( parsed_edid, true, // verbose false, // show_raw d3); free_parsed_edid(parsed_edid); } Device_Id_Xref * xref = device_xref_get(blob_ptr->data); xref->drm_connector_name = strdup(connector_name); xref->drm_connector_type = conn->connector_type; // xref->drm_device_path = strdup(conn-> } drmModeFreePropertyBlob(blob_ptr); } } else if (conn->props[ndx] == subconnector_prop_id) { assert(subconn_prop_ptr); // if subconnector_prop_id found, subconn_prop_ptr must have been set uint32_t enum_value = conn->prop_values[ndx]; // printf("subconnector value: %d\n", enum_value); // assert(subconn_prop_ptr->flags & DRM_MODE_PROP_ENUM); // assert(enum_value < subconn_prop_ptr->count_enums); if (subconn_prop_ptr->flags & DRM_MODE_PROP_ENUM) { bool found = false; for (int i = 0; i < subconn_prop_ptr->count_enums && !found; i++) { if (subconn_prop_ptr->enums[i].value == enum_value) { rpt_vstring(d2, "Subconnector value = %d - %s", enum_value, subconn_prop_ptr->enums[i].name); found = true; } } if (!found) { rpt_vstring(d2, "Unrecognized subconnector value: %d", enum_value); } } else { rpt_vstring(d2, "Subconnector not type enum!. Value = %d", enum_value); } } #ifdef FUTURE else { drmModePropertyPtr prop_ptr = drmModeGetProperty(fd, conn->props[ndx]); if (prop_ptr) { // now in connector report function // report_property_value(dri_fd, prop_ptr, conn->prop_values[ndx], 1); // to implement: summarize_property_value(fd, prop_ptr, conn->prop_values[ndx], d2); drmModeFreeProperty(prop_ptr); } else { printf("Unrecognized property id: %d\n", conn->props[ndx]); } } #endif } } if (edid_prop_ptr) { drmModeFreeProperty(edid_prop_ptr); } if (subconn_prop_ptr) { drmModeFreeProperty(subconn_prop_ptr); } bye: DBGTRC0(debug, TRACE_GROUP, "Done"); rpt_nl(); return; } #ifdef NO // modified from libdrm test code kms.c static const char * const modules[] = { "i915", "radeon", "nouveau", #ifdef SKIP "vmwgfx", "omapdrm", "exynos", "tilcdc", "msm", "sti", "tegra", "imx-drm", "rockchip", "atmel-hlcdc", "fsl-dcu-drm", "vc4", #endif "nvidia_drm", "nvidia_modeset", "nvidia", NULL, }; int util_open(const char *device, const char *module) { int fd; if (module) { fd = drmOpen(module, device); if (fd < 0) { fprintf(stderr, "failed to open device '%s': %s\n", module, strerror(errno)); return -errno; } } else { unsigned int i; for (i = 0; i < ARRAY_SIZE(modules); i++) { printf("trying to open device %s using'%s'...", device, modules[i]); fd = drmOpen(modules[i], device); if (fd < 0) { printf("failed\n"); } else { printf("done\n"); break; } } if (fd < 0) { fprintf(stderr, "no device found\n"); return -ENODEV; } } return fd; } #endif /* Examines a single DRM device, specified by name. * * Arguments: * devname device name * depth logical indentation depth * * Returns: nothing */ static void probe_one_device_using_libdrm(char * devname, int depth) { rpt_vstring(depth, "Probing device %s...", devname); int fd = -1; // drmOpen() returns a file descriptor if successful, // if < 0, its an errno value // n. errno = -fd if a passthru, but will not be set if generated internally // within drmOpen (examined the code) // drmOopen() can also return DRM_ERR_NOT_ROOT (-1003) // DRM specific error numbers are in range -1001..-1005, // conflicts with our Global _Status_Code mapping #ifdef FAIL fd = drmOpen(bname, NULL); if (fd < 0) { rpt_vstring(depth, "Error opening device %s using drmOpen(), fd=%s", bname, linux_errno_desc(-fd)); } if (fd < 0) { fd = drmOpen(devname, NULL); if (fd < 0) { rpt_vstring(depth, "Error opening device %s using drmOpen(), fd=%s", devname, linux_errno_desc(-fd)); } } #endif #ifdef NO char * busid = "pci:0000:01:00.0"; // open succeeds using hardcoded busid, but doesn't solve problem of // driver not modesetting // but .. if this isn't used, drmGetBusid() fails // #ifdef WORKS_BUT_NOT_HELPFUL if (fd < 0) { fd = drmOpen(NULL, busid); if (fd < 0) { rpt_vstring(depth, "Error opening busid %s using drmOpen(), fd=%s", busid, linux_errno_desc(-fd)); } else { rpt_vstring(depth, "Successfully opened using drmOpen(NULL, \"%s\")\n", busid); } } // #endif if (fd < 0) { fd = util_open(busid, NULL); } #endif if (fd < 0) { errno = 0; fd = open(devname,O_RDWR | O_CLOEXEC); if (fd < 0) { rpt_vstring(depth+1, "Error opening device %s using open(), errno=%s", devname, linux_errno_desc(errno)); } else rpt_vstring(depth+1, "Open succeeded for device: %s", devname); } if (fd >= 0) { probe_open_device_using_libdrm(fd, depth); close(fd); } } /* Filter to find driN files using scandir() in get_filenames_by_filter() */ static int is_dri(const struct dirent *ent) { return !strncmp(ent->d_name, "card", strlen("card")); } /* Scans /dev/dri to obtain list of device names * * Returns: GPtrArray of device device names. */ GPtrArray * get_dri_device_names_using_filesys() { const char *dri_paths[] = { "/dev/dri/", NULL }; GPtrArray* dev_names = get_filenames_by_filter(dri_paths, is_dri); g_ptr_array_sort(dev_names, gaux_ptr_scomp); // needed? return dev_names; } /* Main function for probing device information, particularly EDIDs, * using libdrm. * * 2/2017: Nvidia's proprietary drm driver does not appear to * support the ioctls underlying the libdrm functions, and hence * the functions, set errno=22 (EINVAL). */ void probe_using_libdrm() { rpt_title("Probing connected monitors using libdrm...",0); if ( directory_exists("/proc/driver/nvidia/") ) { rpt_nl(); rpt_vstring(1,"Checking Nvidia options to see if experimental kernel modesetting enabled:"); char * cmd = "modprobe -c | grep \"^options nvidia\""; rpt_vstring(1, "Executing command: %s", cmd); execute_shell_cmd_rpt(cmd, 2 /* depth */); } // Check libdrm version, since there seems to be some sensitivity rpt_nl(); if (is_command_in_path("pkg-config")) { rpt_vstring(1, "Checking libdrm version using pkg-config..."); char * cmd = "pkg-config --modversion libdrm"; execute_shell_cmd_rpt(cmd, 2); } else { // try the most common distribution specific tools if (is_command_in_path("dpkg-query")) { char * cmd = "dpkg-query -l libdrm2 | grep ii"; rpt_vstring(1, "Checking libdrm version using dpkg-query..."); execute_shell_cmd_rpt(cmd, 2); } rpt_nl(); if (is_command_in_path("rpm")) { char * cmd = "rpm -qa | grep libdrm"; rpt_vstring(1, "Checking libdrm version using rpm..."); execute_shell_cmd_rpt(cmd, 2); } } // Examining the implementation in xf86drm.c, we see that // drmAvailable first calls drmOpenMinor(), then if that // succeeds calls drmGetVersion(). If both succeed, returns true. // n. drmOpenMinor() is a static function rpt_nl(); // returns 1 if the DRM driver is loaded, 0 otherwise int drm_available = drmAvailable(); rpt_vstring(1, "Has a DRM kernel driver been loaded? (drmAvailable()): %s", bool_repr(drm_available)); #ifdef DOESNT_WORK // function drmOpenMinor() is static if (!drm_available) { // try the functions that drmAvailable() calls to see where the failure is int fd = drmOpenMinor(0, 1, DRM_MODE_PRIMARY); if (fd < 0) { rpt_vstring(1, "drmOpenMinor() failed, errno=%s", linux_errno_desc(-fd)); } else { rpt_vstring(1, "drmOpenMinor() succeeded"); drmVersionPtr ver = drmGetVersion(fd); if (ver) { rpt_vstring(1, "drmGetVersion() succeeded"); drmFreeVersion(ver); } else { rpt_vstring(1, "drmGetVersion() failed"); } } } #endif GPtrArray * dev_names = get_dri_device_names_using_filesys(); for (int ndx = 0; ndx < dev_names->len; ndx++) { char * dev_name = g_ptr_array_index(dev_names, ndx); rpt_nl(); probe_one_device_using_libdrm( dev_name, 1); } g_ptr_array_free(dev_names, true); } ddcutil-0.8.6/src/app_sysenv/query_sysenv.h0000644000175000001440000000201013230445447015774 00000000000000/* query_sysenv.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef QUERY_SYSENV_H_ #define QUERY_SYSENV_H_ #include void query_sysenv(); #endif /* QUERY_SYSENV_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_access.h0000644000175000001440000000235713230445447017333 00000000000000/* query_sysenv_access.h * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Checks on the the existence of and access to /dev/i2c devices */ #ifndef SYSENV_ACCESS_H_ #define QUERY_SYSENV_ACCESS_H_ #include "util/data_structures.h" #include "app_sysenv/query_sysenv_base.h" Byte_Value_Array identify_i2c_devices(); void check_i2c_devices(Env_Accumulator * accum); #endif /* QUERY_SYSENV_ACCESS_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_base.h0000644000175000001440000001073513230445447017003 00000000000000/* query_sysenv_base.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * Base structures and functions for subsystem that diagnoses user configuration */ #ifndef QUERY_SYSENV_BASE_H_ #define QUERY_SYSENV_BASE_H_ /** \cond */ #include #include #include "util/data_structures.h" /** \endcond */ char ** get_known_video_driver_module_names(); char ** get_prefix_match_names(); char ** get_other_driver_module_names(); void sysenv_rpt_file_first_line(char * fn, char * title, int depth); bool sysenv_show_one_file(char * dir_name, char * simple_fn, bool verbose, int depth); /** Linked list of names of detected drivers */ typedef struct driver_name_node { char * driver_name; struct driver_name_node * next; } Driver_Name_Node; Driver_Name_Node * driver_name_list_find_exact( Driver_Name_Node * head, char * driver_name); Driver_Name_Node * driver_name_list_find_prefix(Driver_Name_Node * head, char * driver_prefix); void driver_name_list_add(Driver_Name_Node ** headptr, char * driver_name); void driver_name_list_free(Driver_Name_Node * driver_list); char * driver_name_list_string(Driver_Name_Node * head); bool only_fglrx(Driver_Name_Node * driver_list); bool only_nvidia_or_fglrx(Driver_Name_Node * driver_list); #define ENV_ACCUMULATOR_MARKER "ENVA" /** Collects system environment information */ typedef struct { char marker[4]; char * architecture; char * distributor_id; bool is_raspbian; bool is_arm; Byte_Value_Array dev_i2c_device_numbers; Driver_Name_Node * driver_list; bool sysfs_i2c_devices_exist; Byte_Value_Array sys_bus_i2c_device_numbers; bool group_i2c_checked; bool group_i2c_exists; bool dev_i2c_devices_required; bool all_dev_i2c_has_group_i2c; bool any_dev_i2c_has_group_i2c; char * dev_i2c_common_group_name; char * cur_uname; uid_t cur_uid; bool cur_user_in_group_i2c; bool cur_user_any_devi2c_rw; bool cur_user_all_devi2c_rw; bool module_i2c_dev_needed; bool loadable_i2c_dev_exists; bool module_i2c_dev_builtin; bool i2c_dev_loaded_or_builtin; // loaded or built-in bool any_dev_i2c_is_group_rw; bool all_dev_i2c_is_group_rw; } Env_Accumulator; Env_Accumulator * env_accumulator_new(); void env_accumulator_free(Env_Accumulator * accum); void env_accumulator_report(Env_Accumulator * accum, int depth); /** Signature of filename filter function passed to #dir_foreach(). */ typedef bool (*Filename_Filter_Func)(char * simple_fn); /** Signature of function called by #dir_foreach to process each file. */ typedef void (*Dir_Foreach_Func)(char * dirname, char * fn, void * accumulator, int depth); void dir_foreach( char * dirname, Filename_Filter_Func fn_filter, Dir_Foreach_Func func, void * accumulator, int depth); void filter_and_limit_g_ptr_array( GPtrArray * line_array, char ** filter_terms, bool ignore_case, int limit); int read_file_with_filter( GPtrArray * line_array, char * fn, char ** filter_terms, bool ignore_case, int limit); int execute_cmd_collect_with_filter( char * cmd, char ** filter_terms, bool ignore_case, int limit, GPtrArray ** result_loc); #endif /* QUERY_SYSENV_BASE_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_dmidecode.h0000644000175000001440000000213313230445447017777 00000000000000/* query_sysenv_dmidecode.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * dmidecode report for the environment command */ #ifndef QUERY_SYSENV_DMIDECODE_H_ #define QUERY_SYSENV_DMIDECODE_H_ void query_dmidecode(); #endif /* QUERY_SYSENV_DMIDECODE_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_drm.h0000644000175000001440000000207613230445447016652 00000000000000/* query_drm_sysenv.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * drm reporting for the environment command */ #ifndef QUERY_DRM_SYSENV_H_ #define QUERY_DRM_SYSENV_H_ void probe_using_libdrm(); #endif /* QUERY_DRM_SYSENV_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_i2c.h0000644000175000001440000000223313230445447016540 00000000000000/* query_sysenv_i2c.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Check I2C devices using directly coded I2C calls */ #ifndef QUERY_SYSENV_I2C_H_ #define QUERY_SYSENV_I2C_H_ #include "query_sysenv_base.h" void raw_scan_i2c_devices(Env_Accumulator * accum); void query_i2c_buses(); #endif /* QUERY_SYSENV_I2C_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_logs.h0000644000175000001440000000227213230445447017032 00000000000000/* query_sysenv_logs.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Query configuration files, logs, and output of logging commands. */ #ifndef QUERY_SYSENV_LOGS_H_ #define QUERY_SYSENV_LOGS_H_ #include "query_sysenv_base.h" void probe_logs(Env_Accumulator * accum); void probe_config_files(Env_Accumulator * accum); #endif /* QUERY_SYSENV_LOGS_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_procfs.h0000644000175000001440000000225513230445447017363 00000000000000/* query_sysenv_procfs.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Query environment using /proc file system */ #ifndef QUERY_SYSENV_PROCFS_H_ #define QUERY_SYSENV_PROCFS_H_ /** \cond */ #include /** \endcond */ int query_proc_modules_for_video(); bool query_proc_driver_nvidia(); #endif /* QUERY_SYSENV_PROCFS_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_sysfs.h0000644000175000001440000000275413230445447017242 00000000000000/* query_sysenv_sysfs.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Query environment using /sys file system */ #ifndef QUERY_SYSENV_SYSFS_H_ #define QUERY_SYSENV_SYSFS_H_ #include "query_sysenv_base.h" char * get_i2c_device_sysfs_name(int busno); typedef struct { ushort vendor_id; ushort device_id; ushort subdevice_id; // subsystem device id ushort subvendor_id; // subsystem vendor id } Device_Ids; void query_card_and_driver_using_sysfs(Env_Accumulator * accum); void query_loaded_modules_using_sysfs(); void query_sys_bus_i2c(Env_Accumulator * accum); void query_drm_using_sysfs(); #endif /* QUERY_SYSENV_SYSFS_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_usb.h0000644000175000001440000000200313230445447016647 00000000000000/* query_usb_sysenv.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef QUERY_USB_SYSENV_H_ #define QUERY_USB_SYSENV_H_ void query_usbenv(); #endif /* QUERY_USB_SYSENV_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_xref.h0000644000175000001440000000346013230445447017032 00000000000000/* query_sysenv_xref.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \file * */ #ifndef QUERY_SYSENV_XREF_H_ #define QUERY_SYSENV_XREF_H_ #include "util/edid.h" #define DEVICE_ID_XREF_MARKER "DXRF" /** Device identifier cross-reference entry */ typedef struct { char marker[4]; Byte raw_edid[128]; char * edid_tag; Parsed_Edid * parsed_edid; int i2c_busno; char * xrandr_name; char * udev_name; char * udev_syspath; char * drm_connector_name; int drm_connector_type; char * drm_device_path; char * sysfs_drm_name; char * sysfs_drm_i2c; // or save I2C bus number found? #ifdef ALTERNATIVE int sysfs_drm_busno; #endif } Device_Id_Xref; void device_xref_init(); Device_Id_Xref * device_xref_get(Byte * raw_edid); Device_Id_Xref * device_xref_find_by_busno(int busno); void device_xref_report(int depth); #endif /* QUERY_SYSENV_XREF_H_ */ ddcutil-0.8.6/src/app_sysenv/query_sysenv_modules.h0000644000175000001440000000236513230445447017541 00000000000000/* query_sysenv_modules.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /** \f * Module checks */ #ifndef QUERY_SYSENV_MODULES_H_ #define QUERY_SYSENV_MODULES_H_ #include #include "query_sysenv_base.h" bool is_module_builtin(char * module_name); bool is_module_loadable(char * module_name, int depth); void check_i2c_dev_module(Env_Accumulator * accum, int depth); #endif /* QUERY_SYSENV_MODULES_H_ */ ddcutil-0.8.6/src/cmdline/0000755000175000001440000000000013230445447012362 500000000000000ddcutil-0.8.6/src/cmdline/Makefile.am0000644000175000001440000000071413226574114014337 00000000000000AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall AM_CFLAGS += -Werror # flags g_option parser structs in cmd_parser_goption.c # AM_CFLAGS += -Wpedantic if ENABLE_CALLGRAPH_COND AM_CFLAGS += -fdump-rtl-expand endif CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libcmdline.la libcmdline_la_SOURCES = \ cmd_parser_aux.c \ cmd_parser_goption.c \ parsed_cmd.c ddcutil-0.8.6/src/cmdline/Makefile.in0000644000175000001440000005172113230171237014346 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ # flags g_option parser structs in cmd_parser_goption.c # AM_CFLAGS += -Wpedantic @ENABLE_CALLGRAPH_COND_TRUE@am__append_1 = -fdump-rtl-expand subdir = src/cmdline ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcmdline_la_LIBADD = am_libcmdline_la_OBJECTS = cmd_parser_aux.lo cmd_parser_goption.lo \ parsed_cmd.lo libcmdline_la_OBJECTS = $(am_libcmdline_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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcmdline_la_SOURCES) DIST_SOURCES = $(libcmdline_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ $(GLIB_CFLAGS) \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/public AM_CFLAGS = -Wall -Werror $(am__append_1) CLEANFILES = \ *expand # Intermediate Library noinst_LTLIBRARIES = libcmdline.la libcmdline_la_SOURCES = \ cmd_parser_aux.c \ cmd_parser_goption.c \ parsed_cmd.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/cmdline/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/cmdline/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-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}; \ } libcmdline.la: $(libcmdline_la_OBJECTS) $(libcmdline_la_DEPENDENCIES) $(EXTRA_libcmdline_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libcmdline_la_OBJECTS) $(libcmdline_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmd_parser_aux.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmd_parser_goption.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsed_cmd.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: ddcutil-0.8.6/src/cmdline/cmd_parser_aux.c0000644000175000001440000003624413226573741015457 00000000000000/* cmd_parser_aux.c * * Functions and strings that are independent of the parser * package used. * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include "util/string_util.h" #include "base/parms.h" #include "cmdline/cmd_parser_aux.h" // // Command Description data structure // static Cmd_Desc cmdinfo[] = { // cmd_id cmd_name minchars min_arg_ct max_arg_ct {CMDID_DETECT, "detect", 3, 0, 0}, {CMDID_CAPABILITIES, "capabilities", 3, 0, 0}, {CMDID_GETVCP, "getvcp", 3, 1, 1}, {CMDID_SETVCP, "setvcp", 3, 2, MAX_SETVCP_VALUES*2}, {CMDID_LISTVCP, "listvcp", 5, 0, 0}, #ifdef INCLUDE_TESTCASES {CMDID_TESTCASE, "testcase", 3, 1, 1}, {CMDID_LISTTESTS, "listtests", 5, 0, 0}, #endif {CMDID_LOADVCP, "loadvcp", 3, 1, 1}, {CMDID_DUMPVCP, "dumpvcp", 3, 0, 1}, {CMDID_INTERROGATE, "interrogate", 3, 0, 0}, {CMDID_ENVIRONMENT, "environment", 3, 0, 0}, {CMDID_USBENV, "usbenvironment", 6, 0, 0}, {CMDID_VCPINFO, "vcpinfo", 5, 0, 1}, {CMDID_READCHANGES, "watch", 3, 0, 0}, #ifdef USE_USB {CMDID_CHKUSBMON, "chkusbmon", 3, 1, 1}, #endif {CMDID_PROBE, "probe", 5, 0, 0}, {CMDID_SAVE_SETTINGS,"scs", 3, 0, 0}, }; static int cmdct = sizeof(cmdinfo)/sizeof(Cmd_Desc); void validate_cmdinfo() { int ndx = 0; for (; ndx < cmdct; ndx++) { assert( cmdinfo[ndx].max_arg_ct <= MAX_ARGS); } } void show_cmd_desc(Cmd_Desc * cmd_desc) { printf("CmdDesc at %p\n", (void*)cmd_desc); printf(" cmd_id: 0x%04x\n", cmd_desc->cmd_id); printf(" cmd_name: %s\n", cmd_desc->cmd_name); printf(" minchars: %d\n", cmd_desc->minchars); printf(" min_arg_ct: %d\n", cmd_desc->min_arg_ct); printf(" max_arg_ct: %d\n", cmd_desc->max_arg_ct); } Cmd_Desc * find_command(char * cmd) { Cmd_Desc * result = NULL; int ndx = 0; for (; ndx < cmdct; ndx++) { Cmd_Desc desc = cmdinfo[ndx]; if (is_abbrev(cmd, desc.cmd_name, desc.minchars)) { result = &cmdinfo[ndx]; } } // DBGMSG("cmd=|%s|, returning %p", cmd, result); return result; } Cmd_Desc * get_command(int cmdid) { bool debug = false; Cmd_Desc * result = NULL; int ndx = 0; for (; ndx < cmdct; ndx++) { Cmd_Desc desc = cmdinfo[ndx]; if (cmdid == desc.cmd_id) { result = &cmdinfo[ndx]; } } if (debug) { DBGMSG("cmdid=0x%04x, returning %p", cmdid, result); show_cmd_desc(result); } return result; } void init_cmd_parser_base() { validate_cmdinfo(); } bool all_digits(char * val, int ct) { bool debug = false; DBGMSF(debug, "ct-%d, val -> |%.*s|", ct, ct, val ); bool ok = true; int ndx; for (ndx = 0; ndx < ct; ndx++) { if ( !isdigit(*(val+ndx)) ) { ok = false; break; } } DBGMSF(debug, "Returning: %d ", ok ); return ok; } bool parse_dot_separated_arg(const char * val, int * piAdapterIndex, int * piDisplayIndex) { int rc = sscanf(val, "%d.%d", piAdapterIndex, piDisplayIndex); // DBGMSG("val=|%s| sscanf() returned %d ", val, rc ); bool ok = (rc == 2); return ok; } bool parse_colon_separated_arg(const char * val, int * pv1, int * pv2) { int rc = sscanf(val, "%d:%d", pv1, pv2); // DBGMSG("val=|%s| sscanf() returned %d ", val, rc ); bool ok = (rc == 2); return ok; } bool parse_int_arg(char * val, int * pIval) { int ct = sscanf(val, "%d", pIval); return (ct == 1); } typedef struct feature_subset_table_entry_s { VCP_Feature_Subset subset_id; Cmd_Id_Type valid_commands; int min_chars; char * subset_name; char * subset_desc; } Feature_Subset_Table_Entry; const Feature_Subset_Table_Entry subset_table[] = { {VCP_SUBSET_ALL, CMDID_GETVCP|CMDID_VCPINFO, 3, "ALL", "All known features"}, {VCP_SUBSET_SUPPORTED, CMDID_GETVCP, 3, "SUPPORTED", "All known features that are valid for the display"}, {VCP_SUBSET_SCAN, CMDID_GETVCP, 3, "SCAN", "All feature codes 00..FF, except those known to be WO"}, {VCP_SUBSET_KNOWN, CMDID_GETVCP|CMDID_VCPINFO, 3, "KNOWN", "All features known by ddcutil"}, {VCP_SUBSET_PROFILE, CMDID_GETVCP|CMDID_VCPINFO, 3, "PROFILE", "Features for color profile management"}, {VCP_SUBSET_COLOR, CMDID_GETVCP|CMDID_VCPINFO, 3, "COLOR", "Color related features"}, {VCP_SUBSET_LUT, CMDID_GETVCP|CMDID_VCPINFO, 3, "LUT", "LUT related features"}, {VCP_SUBSET_AUDIO, CMDID_GETVCP|CMDID_VCPINFO, 3, "AUDIO", "Audio related features"}, {VCP_SUBSET_WINDOW, CMDID_GETVCP|CMDID_VCPINFO, 3, "WINDOW", "Window related features"}, {VCP_SUBSET_TV, CMDID_GETVCP|CMDID_VCPINFO, 2, "TV", "TV related features"}, {VCP_SUBSET_PRESET, CMDID_VCPINFO, 3, "PRESET", "Presets"}, // all WO {VCP_SUBSET_MFG, CMDID_GETVCP, 3, "MANUFACTURER", "Manufacturer specific codes"}, {VCP_SUBSET_TABLE, CMDID_GETVCP|CMDID_VCPINFO, 3, "TABLE", "Table type features"}, }; const int subset_table_ct = sizeof(subset_table)/sizeof(Feature_Subset_Table_Entry); VCP_Feature_Subset find_subset(char * name, int cmd_id) { assert(name && (cmd_id == CMDID_GETVCP || cmd_id == CMDID_VCPINFO)); VCP_Feature_Subset result = VCP_SUBSET_NONE; char * us = strdup_uc(name); int ndx = 0; for (;ndx < subset_table_ct; ndx++) { if ( is_abbrev(us, subset_table[ndx].subset_name, subset_table[ndx].min_chars) ) { if (cmd_id & subset_table[ndx].valid_commands) result = subset_table[ndx].subset_id; break; } } free(us); return result; } bool parse_feature_id_or_subset(char * val, int cmd_id, Feature_Set_Ref * fsref) { bool debug = false; bool ok = true; VCP_Feature_Subset subset_id = find_subset(val, cmd_id); if (subset_id != VCP_SUBSET_NONE) fsref->subset = subset_id; else { Byte feature_hexid = 0; // temp ok = any_one_byte_hex_string_to_byte_in_buf(val, &feature_hexid); if (ok) { fsref->subset = VCP_SUBSET_SINGLE_FEATURE; fsref->specific_feature = feature_hexid; } } DBGMSF(debug, "Returning: %s", bool_repr(ok)); if (ok && debug) dbgrpt_feature_set_ref(fsref, 0); return ok; } // n. this function used to set the default output level based on the command // this is no longer necessary bool validate_output_level(Parsed_Cmd* parsed_cmd) { // printf("(%s) parsed_cmd->cmdid = %d, parsed_cmd->output_level = %s\n", // __func__, parsed_cmd->cmd_id, // output_level_name(parsed_cmd->output_level)); bool ok = true; // check that output_level consistent with cmd_id Byte valid_output_levels; // Byte default_output_level = OL_NORMAL; switch(parsed_cmd->cmd_id) { case (CMDID_DETECT): valid_output_levels = DDCA_OL_TERSE | DDCA_OL_NORMAL | DDCA_OL_VERBOSE; break; case (CMDID_GETVCP): valid_output_levels = DDCA_OL_TERSE | DDCA_OL_NORMAL | DDCA_OL_VERBOSE; break; case (CMDID_PROBE): // don't want to deal with how to report errors, handle write-only features // of machine readable output triggered by --terse valid_output_levels = DDCA_OL_NORMAL | DDCA_OL_VERBOSE; break; default: // default_output_level = OL_NORMAL; valid_output_levels = DDCA_OL_TERSE | DDCA_OL_NORMAL | DDCA_OL_VERBOSE; } if (!(parsed_cmd->output_level & valid_output_levels)) { printf("Output level invalid for command %s: %s\n", get_command(parsed_cmd->cmd_id)->cmd_name, output_level_name(parsed_cmd->output_level) ); ok = false; } return ok; } char * commands_list_help = "Commands:\n" " detect Detect monitors\n" " capabilities Query monitor capabilities string\n" // " info\n" // " listvcp\n" " vcpinfo (feature-code-or-group) Show VCP feature characteristics\n" " getvcp Get VCP feature value(s)\n" " setvcp Set VCP feature value\n" " dumpvcp (filename) Write profile related settings to file\n" " loadvcp Load profile related settings from file\n" #ifdef INCLUDE_TESTCASES " testcase \n" " listtests\n" #endif " environment Probe execution environment\n" #ifdef USE_USB " usbenv Probe for USB connected monitors\n" #endif " probe Probe monitor abilities\n" " interrogate Report everything possible\n" #ifdef USE_USB " chkusbmon Check if USB device is monitor (for UDEV)\n" #endif " watch Watch display for reported changes (under development)\n" "\n"; char * command_argument_help = "Command Arguments\n" " getvcp, vcpinfo:\n" " can be any of the following:\n" " - the hex feature code for a specific feature, with or without a leading 0x,\n" " e.g. 10 or 0x10\n" " - KNOWN - all feature codes known to ddcutil\n" " - ALL - like KNOWN, but implies --show-unsupported\n" " - SCAN - scan all feature codes 0x00..0xff\n" " - COLOR - all color related feature codes\n" " - PROFILE - color related codes for profile management\n" " - LUT - LUT related features\n" " - AUDIO - audio features\n" " - WINDOW - window operations (e.g. PIP)\n" " - TV - TV related settings\n" " - PRESET - MCCS codes classed as PRESET\n" " - MANUFACTURER - manufacturer specific codes\n" " - TABLE - table type features\n" " Keywords can be abbreviated to the first 3 characters.\n" " Case is ignored. e.g. \"COL\", \"pro\"\n" "\n" " setvcp:\n" " : hexadecimal feature code, with or without a leading 0x,\n" " e.g. 10 or 0x10\n" " : a decimal number in the range 0..255, or a single byte hex value,\n" " e.g. 0x80\n" ; char * monitor_selection_option_help = "Monitor Selection:\n" " The monitor to be communicated with can be specified using the following options:\n" " --display , where ranges from 1 to the number of\n" " displays detected\n" " --bus , for /dev/i2c-\n" #ifdef HAVE_ADL " --adl ., for monitors connected to an AMD video card\n" " running AMD's proprietary video driver (ADL is an acronym for AMD Display Library)\n" #endif #ifdef USE_USB " --usb ., for monitors communicating via USB\n" #endif " --edid , where is a 256 hex character representation of the\n" " 128 byte first block of the EDID\n" " --mfg , where is the 3 character manufacturer id reported by the EDID\n" " --model , where is as reported by the EDID\n" " --sn , where is the string form of the serial number\n" " reported by the EDID\n" " Options --mfg, --model and --sn may be combined.\n" "\n" ; char * tracing_comma_separated_option_help = "Tracing:\n" " The argument to --trace is a comma separated list of trace classes, surrounded by \n" " quotation marks if necessary." " e.g. --trace all, --trace \"I2C,ADL\"\n" " Valid trace classes are: BASE, I2C, ADL, DDC, TOP, ALL.\n" " Trace class names are not case sensitive.\n" " (Some trace classes are more useful than others.)\n" // "\n" ; char * tracing_multiple_call_option_help = "Trace by trace class:\n" " The argument to --trace is a trace class. Specify the --trace option multiple\n" " times to activate multiple trace classes, e.g. \"--trace i2c --trace ddc\"\n" " Valid trace classes are: BASE, I2C, ADL, DDC, TOP, ALL.\n" " Trace class names are not case sensitive.\n" " (Some trace classes are more useful than others.)\n" // "\n" ; char * trcfunc_multiple_call_option_help = "Trace by function name:\n" " The argument to --trcfunc is a function name. Specify the --trcfunc option multiple\n" " times to trace multiple functions, e.g. \"--trcfunc func1 --trcfunc func2\"\n" ; char * trcfile_multiple_call_option_help = "Trace by file name:\n" " The argument to --trcfile is a simple file name. Specify the --trcfile option multiple\n" " times to trace multiple functions, e.g. \"--trcfile ddc_edid.c --trcfile ddc_output.c\"\n" ; char * stats_multiple_call_option_help = "Stats:\n" " The argument to --stats is a statistics class. Specify the --stats option multiple\n" " times to activate multiple statistics classes, e.g. \"--stats calls --stats errors\"\n" " Valid statistics classes are: TRY, TRIES, ERRS, ERRORS, CALLS, ALL.\n" " Statistics class names are not case sensitive and can abbreviated to 3 characters.\n" " If no argument is specified, or ALL is specified, then all statistics classes are\n" " output.\n" ; char * maxtries_option_help = "Retries:\n" " The argument to --maxtries is a comma separated list of 3 values:\n" " maximum write-only exchange count\n" " maximum write-read exchange count\n" " maximum multi-part-read exchange count\n" " A value of \"\" or \".\" leaves the default value unchanged\n" " e.g. --retries \",.,15\" changes only the maximum multi-part-read exchange count" ; ddcutil-0.8.6/src/cmdline/cmd_parser_goption.c0000644000175000001440000006577613224277527016356 00000000000000/* cmd_parser_goption.c * * Parse the command line using the glib goption functions. * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include #include #include #include "util/string_util.h" #include "util/report_util.h" #include "base/build_info.h" #include "base/core.h" #include "base/displays.h" #include "base/parms.h" #include "cmdline/cmd_parser_aux.h" #include "cmdline/cmd_parser.h" #include "cmdline/parsed_cmd.h" // Variables used by callback functions static char * adlwork = NULL; static char * usbwork = NULL; static DDCA_Output_Level output_level = DDCA_OL_NORMAL; static int iAdapterIndex = -1; static int iDisplayIndex = -1; static DDCA_Stats_Type stats_work = DDCA_STATS_NONE; // not currently used // Callback function for processing an --adl argument gboolean adl_arg_func(const gchar* option_name, const gchar* value, gpointer data, GError** error) { bool debug = false; DBGMSF(debug, "option_name=|%s|, value|%s|, data=%p", option_name, value, data); adlwork = strdup(value); // alt way bool ok = parse_dot_separated_arg(value, &iAdapterIndex, &iDisplayIndex); if (ok) { DBGMSG("parsed adl = %d.%d", iAdapterIndex, iDisplayIndex); } if (!ok) { g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, "bad adl" ); } return ok; } // Callback function for processing --terse, --verbose and synonyms gboolean output_arg_func(const gchar* option_name, const gchar* value, gpointer data, GError** error) { bool debug = false; DBGMSF(debug, "option_name=|%s|, value|%s|, data=%p", option_name, value, data); bool ok = true; if (streq(option_name, "-v") || streq(option_name, "--verbose") ) output_level = DDCA_OL_VERBOSE; else if (streq(option_name, "-t") || streq(option_name, "--terse") || streq(option_name, "--brief") ) output_level = DDCA_OL_TERSE; #ifdef OLD else if (streq(option_name, "-p") || streq(option_name, "--program")) output_level = OL_PROGRAM; #endif else { PROGRAM_LOGIC_ERROR("Unexpected option_name: %s", option_name); g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, "PROGRAM LOGIC ERROR: Unexpected option_name: %s", option_name); ok = false; } return ok; } // Callback function for processing --stats gboolean stats_arg_func(const gchar* option_name, const gchar* value, gpointer data, GError** error) { bool debug = false; DBGMSF(debug,"option_name=|%s|, value|%s|, data=%p", option_name, value, data); bool ok = true; if (value) { char * v2 = strupper(strdup(value)); if ( streq(v2,"ALL") ) { stats_work |= DDCA_STATS_ALL; } else if (streq(v2,"TRY") || is_abbrev(v2, "TRIES",3)) { stats_work |= DDCA_STATS_TRIES; } else if ( is_abbrev(v2, "CALLS",3)) { stats_work |= DDCA_STATS_CALLS; } else if (streq(v2,"ERRS") || is_abbrev(v2, "ERRORS",3)) { stats_work |= DDCA_STATS_ERRORS; } else if ( is_abbrev(v2,"ELAPSED",3) || is_abbrev(v2, "TIME",3)) { stats_work |= DDCA_STATS_ELAPSED; } else ok = false; free(v2); } else { stats_work = DDCA_STATS_ALL; } if (!ok) { g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, "invalid stats type: %s", value ); } return ok; } /* Primary parsing function * * Arguments: * argc number of command line arguments * argv array of pointers to command line arguments * * Returns: * pointer to a Parsed_Cmd struct if parsing successful * NULL if execution should be terminated */ Parsed_Cmd * parse_command(int argc, char * argv[]) { bool debug = false; DBGMSF(debug, "Starting" ); validate_cmdinfo(); // assertions if (debug) { DBGMSG("argc=%d", argc); int ndx = 0; for (; ndx < argc; ndx++) { DBGMSG("argv[%d] = |%s|", ndx, argv[ndx]); } } Parsed_Cmd * parsed_cmd = new_parsed_cmd(); // parsed_cmd->pdid = create_dispno_display_identifier(1); // default monitor // DBGMSG("After new_parsed_cmd(), parsed_cmd->output_level_name = %s", output_level_name(parsed_cmd->output_level)); // gboolean stats_flag = false; gboolean ddc_flag = false; gboolean force_flag = false; gboolean force_slave_flag = false; gboolean show_unsupported_flag = false; gboolean version_flag = false; gboolean timestamp_trace_flag = false; gboolean verify_flag = false; gboolean noverify_flag = false; gboolean nodetect_flag = false; gboolean async_flag = false; gboolean report_freed_excp_flag = false; gboolean notable_flag = false; // gboolean myhelp_flag = false; // gboolean myusage_flag = false; char * mfg_id_work = NULL; char * modelwork = NULL; char * snwork = NULL; char * edidwork = NULL; // char * tracework = NULL; char** cmd_and_args = NULL; gchar** trace_classes = NULL; gchar** trace_functions = NULL; gchar** trace_filenames = NULL; gint buswork = -1; gint hidwork = -1; gint dispwork = -1; char * maxtrywork = NULL; gint sleep_strategy_work = -1; char * failsim_fn_work = NULL; // gboolean enable_failsim_flag = false; GOptionEntry option_entries[] = { // long_name short flags option-type gpointer description arg description // monitor selection options {"display", 'd', 0, G_OPTION_ARG_INT, &dispwork, "Display number", "number"}, {"dis", '\0', 0, G_OPTION_ARG_INT, &dispwork, "Display number", "number"}, {"bus", 'b', 0, G_OPTION_ARG_INT, &buswork, "I2C bus number", "busnum" }, {"hiddev", '\0', 0, G_OPTION_ARG_INT, &hidwork, "hiddev device number", "number" }, // {"adl", 'a', 0, G_OPTION_ARG_CALLBACK, adl_arg_func, "ADL adapter and display indexes", "adapterIndex.displayIndex"}, {"adl", 'a', 0, G_OPTION_ARG_STRING, &adlwork, "ADL adapter and display indexes", "adapterIndex.displayIndex"}, {"usb", 'u', 0, G_OPTION_ARG_STRING, &usbwork, "USB bus and device numbers", "busnum.devicenum"}, {"mfg", 'g', 0, G_OPTION_ARG_STRING, &mfg_id_work, "Monitor manufacturer code", "mfg_id"}, {"model", 'l', 0, G_OPTION_ARG_STRING, &modelwork, "Monitor model", "model name"}, {"sn", 'n', 0, G_OPTION_ARG_STRING, &snwork, "Monitor serial number", "serial number"}, {"edid", 'e', 0, G_OPTION_ARG_STRING, &edidwork, "Monitor EDID", "256 char hex string" }, // output control {"ddc", '\0', 0, G_OPTION_ARG_NONE, &ddc_flag, "Report DDC protocol and data errors", NULL}, {"verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, output_arg_func, "Show extended detail", NULL}, {"terse", 't', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, output_arg_func, "Show brief detail", NULL}, {"brief", '\0', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, output_arg_func, "Show brief detail", NULL}, {"show-unsupported", 'U', 0, G_OPTION_ARG_NONE, &show_unsupported_flag, "Report unsupported features", NULL}, {"notable", '\0', 0, G_OPTION_ARG_NONE, ¬able_flag, "Ignore table type feature codes", NULL}, // tuning {"maxtries",'\0', 0, G_OPTION_ARG_STRING, &maxtrywork, "Max try adjustment", "comma separated list" }, {"stats", 's', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, stats_arg_func, "Show retry statistics", "stats type"}, {"force-slave-address", '\0', 0, G_OPTION_ARG_NONE, &force_slave_flag, "Force I2C slave address", NULL}, {"force", 'f', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &force_flag, "Ignore certain checks", NULL}, {"verify", '\0', 0, G_OPTION_ARG_NONE, &verify_flag, "Read VCP value after setting it", NULL}, {"noverify",'\0', 0, G_OPTION_ARG_NONE, &noverify_flag, "Do not read VCP value after setting it", NULL}, {"nodetect",'\0', 0, G_OPTION_ARG_NONE, &nodetect_flag, "Skip initial monitor detection", NULL}, {"async", '\0', 0, G_OPTION_ARG_NONE, &async_flag, "Enable asynchronous display detection", NULL}, // debugging {"excp", '\0', 0, G_OPTION_ARG_NONE, &report_freed_excp_flag, "Report freed exceptions", NULL}, {"trace", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &trace_classes, "Trace classes", "trace class name" }, // {"trace", '\0', 0, G_OPTION_ARG_STRING, &tracework, "Trace classes", "comma separated list" }, {"trcfunc", '\0',0, G_OPTION_ARG_STRING_ARRAY, &trace_functions, "Trace functions", "function name" }, {"trcfile", '\0',0, G_OPTION_ARG_STRING_ARRAY, &trace_filenames, "Trace files", "file name" }, {"timestamp",'\0', 0, G_OPTION_ARG_NONE, ×tamp_trace_flag, "Prepend trace msgs with elapsed time", NULL}, {"ts", '\0', 0, G_OPTION_ARG_NONE, ×tamp_trace_flag, "Prepend trace msgs with elapsed time", NULL}, // {"myusage", '\0', 0, G_OPTION_ARG_NONE, &myusage_flag, "Show usage", NULL}, // {"myhelp", '\0', 0, G_OPTION_ARG_NONE, &myhelp_flag, "Show usage", NULL}, {"sleep-strategy", 'y', 0, G_OPTION_ARG_INT, &sleep_strategy_work, "Set sleep strategy", "strategy number" }, {"failsim", '\0', 0, G_OPTION_ARG_FILENAME, &failsim_fn_work, "Enable simulation", "control file name"}, // other {"version", 'V', 0, G_OPTION_ARG_NONE, &version_flag, "Show version information", NULL}, {G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &cmd_and_args, "ARGUMENTS description", "command [arguments...]"}, { NULL } }; GError* error = NULL; GOptionContext* context = g_option_context_new("- DDC query and manipulation"); g_option_context_add_main_entries(context, option_entries, NULL); // g_option_context_add_group(context, gtk_get_option_group(TRUE)); // comma delimited list of trace identifiers: // char * trace_group_string = strjoin(trace_group_names, trace_group_ct, ", "); // DBGMSG("traceGroupString = %s", traceGroupString); // const char * pieces[] = {tracing_option_help, " Recognized trace classes: ", trace_group_string, "\n\n"}; // tracing_option_help = strjoin(pieces, 4, NULL); // const char * pieces2[] = {command_argument_help, " Recognized trace classes: ", trace_group_string, "\n\n"}; // command_argument_help = strjoin(pieces, 4, NULL); const char * pieces3[] = {commands_list_help, command_argument_help}; char * help_summary = strjoin(pieces3, 2, NULL); const char * pieces4[] = {monitor_selection_option_help, tracing_multiple_call_option_help, "\n", trcfunc_multiple_call_option_help, "\n", trcfile_multiple_call_option_help, "\n", stats_multiple_call_option_help, "\n", maxtries_option_help}; char * help_description = strjoin(pieces4, 10, NULL); // on --help, comes after usage line, before option detail g_option_context_set_summary(context, help_summary); // on --help, comes at end after option detail g_option_context_set_description(context, help_description); g_option_context_set_help_enabled(context, true); // bool ok = false; bool ok = g_option_context_parse(context, &argc, &argv, &error); if (!ok) { fprintf(stderr, "Option parsing failed: %s\n", error->message); } // DBGMSG("buswork=%d", buswork); // DBGMSG("dispwork=%d", dispwork); // DBGMSG("stats_flag=%d", stats_flag); // DBGMSG("output_level=%d", output_level); // DBGMSG("stats3=0x%02x",stats_work); int explicit_display_spec_ct = 0; // number of ways the display is explicitly specified parsed_cmd->ddcdata = ddc_flag; // parsed_cmd->force = force_flag; parsed_cmd->force_slave_addr = force_slave_flag; // parsed_cmd->show_unsupported = show_unsupported_flag; parsed_cmd->output_level = output_level; parsed_cmd->stats_types = stats_work; parsed_cmd->sleep_strategy = sleep_strategy_work; parsed_cmd->timestamp_trace = timestamp_trace_flag; if (verify_flag) parsed_cmd->verify_setvcp = true; else if (noverify_flag) parsed_cmd->verify_setvcp = false; else parsed_cmd->verify_setvcp = true; parsed_cmd->nodetect = nodetect_flag; parsed_cmd->async = async_flag; parsed_cmd->report_freed_exceptions = report_freed_excp_flag; if (notable_flag) parsed_cmd->flags |= CMD_FLAG_NOTABLE; if (show_unsupported_flag) parsed_cmd->flags |= CMD_FLAG_SHOW_UNSUPPORTED; if (force_flag) parsed_cmd->flags |= CMD_FLAG_FORCE; if (failsim_fn_work) { #ifdef ENABLE_FAILSIM parsed_cmd->enable_failure_simulation = true; parsed_cmd->failsim_control_fn = failsim_fn_work; #else fprintf(stderr, "ddcutil not built with failure simulation support. --failsim option invalid.\n"); ok = false; #endif } // Create display identifier // // n. at this point parsed_cmd->pdid == NULL if (adlwork) { #ifdef HAVE_ADL if (debug) DBGMSG("adlwork = |%s|", adlwork); int iAdapterIndex; int iDisplayIndex; bool adlok = parse_dot_separated_arg(adlwork, &iAdapterIndex, &iDisplayIndex); if (!adlok) { printf("Invalid ADL argument: %s\n", adlwork ); ok = false; // DBGMSG("After ADL parse, ok=%d", ok); } else { // parsedCmd->dref = createAdlDisplayRef(iAdapterIndex, iDisplayIndex); // free(parsed_cmd->pdid); parsed_cmd->pdid = create_adlno_display_identifier(iAdapterIndex, iDisplayIndex); // new way } explicit_display_spec_ct++; #else fprintf(stderr, "ddcutil not built with support for AMD proprietary driver. --adl option invalid.\n"); ok = false; #endif } if (usbwork) { #ifdef USE_USB DBGMSF(debug, "usbwork = |%s|", usbwork); int busnum; int devicenum; bool arg_ok = parse_dot_separated_arg(usbwork, &busnum, &devicenum); if (!arg_ok) arg_ok = parse_colon_separated_arg(usbwork, &busnum, &devicenum); if (!arg_ok) { printf("Invalid USB argument: %s\n", usbwork ); ok = false; // DBGMSG("After USB parse, ok=%d", ok); } else { // avoid memory leak in case parsed_cmd->pdid set in more than 1 way if (parsed_cmd->pdid) { free_display_identifier(parsed_cmd->pdid); } parsed_cmd->pdid = create_usb_display_identifier(busnum, devicenum); } explicit_display_spec_ct++; #else fprintf(stderr, "ddcutil not built with support for USB connected monitors. --usb option invalid.\n"); ok = false; #endif } if (buswork >= 0) { // avoid memory leak in case parsed_cmd->pdid set in more than 1 way if (parsed_cmd->pdid) free_display_identifier(parsed_cmd->pdid); parsed_cmd->pdid = create_busno_display_identifier(buswork); explicit_display_spec_ct++; } if (hidwork >= 0) { // avoid memory leak in case parsed_cmd->pdid set in more than 1 way if (parsed_cmd->pdid) free_display_identifier(parsed_cmd->pdid); parsed_cmd->pdid = create_usb_hiddev_display_identifier(hidwork); explicit_display_spec_ct++; } if (dispwork >= 0) { // avoid memory leak in case parsed_cmd->pdid set in more than 1 way if (parsed_cmd->pdid) free_display_identifier(parsed_cmd->pdid); parsed_cmd->pdid = create_dispno_display_identifier(dispwork); explicit_display_spec_ct++; } if (edidwork) { if (strlen(edidwork) != 256) { fprintf(stderr, "EDID hex string not 256 characters\n"); ok = false; } else { Byte * pba = NULL; int bytect = hhs_to_byte_array(edidwork, &pba); if (bytect < 0 || bytect != 128) { fprintf(stderr, "Invalid EDID hex string\n"); ok = false; } else { // avoid memory leak in case parsed_cmd->pdid set in more than 1 way if (parsed_cmd->pdid) free_display_identifier(parsed_cmd->pdid); parsed_cmd->pdid = create_edid_display_identifier(pba); // new way } if (pba) free(pba); } explicit_display_spec_ct++; } if (mfg_id_work || modelwork || snwork) { // avoid memory leak in case parsed_cmd->pdid set in more than 1 way if (parsed_cmd->pdid) free_display_identifier(parsed_cmd->pdid); parsed_cmd->pdid = create_mfg_model_sn_display_identifier( mfg_id_work, modelwork, snwork); explicit_display_spec_ct++; } if (maxtrywork) { bool saved_debug = debug; debug = false; DBGMSF(debug, "retrywork, argument = |%s|", maxtrywork ); Null_Terminated_String_Array pieces = strsplit(maxtrywork, ","); int ntsal = ntsa_length(pieces); DBGMSF(debug, "ntsal=%d", ntsal ); if (ntsa_length(pieces) != 3) { fprintf(stderr, "--retries requires 3 values\n"); ok = false; } else { int ndx = 0; char trimmed_piece[10]; for (; pieces[ndx] != NULL; ndx++) { char * token = strtrim_r(pieces[ndx], trimmed_piece, 10); // DBGMSG("token=|%s|", token); if (strlen(token) > 0 && !streq(token,".")) { int ival; int ct = sscanf(token, "%d", &ival); if (ct != 1) { fprintf(stderr, "Invalid --maxtries value: %s\n", token); ok = false; } else if (ival > MAX_MAX_TRIES) { fprintf(stderr, "--maxtries value %d exceeds %d\n", ival, MAX_MAX_TRIES); ok = false; } else { parsed_cmd->max_tries[ndx] = ival; } } } assert(ndx == ntsal); } ntsa_free(pieces, /* free_strings */ true); DBGMSF(debug, "retries = %d,%d,%d", parsed_cmd->max_tries[0], parsed_cmd->max_tries[1], parsed_cmd->max_tries[2]); debug = saved_debug; } #ifdef COMMA_DELIMITED_TRACE if (tracework) { bool saved_debug = debug; debug = false; if (debug) DBGMSG("tracework, argument = |%s|", tracework ); strupper(tracework); Trace_Group traceClasses = 0x00; Null_Terminated_String_Array pieces = strsplit(tracework, ','); int ndx = 0; for (; pieces[ndx] != NULL; ndx++) { char * token = pieces[ndx]; // TODO: deal with leading or trailing whitespace DBGMSG("token=|%s|", token); if (streq(token, "ALL") || streq(token, "*")) traceClasses = 0xff; else { // DBGMSG("token: |%s|", token); Trace_Group tg = trace_class_name_to_value(token); // DBGMSG("tg=0x%02x", tg); if (tg) { traceClasses |= tg; } else { printf("Invalid trace group: %s\n", token); ok = false; } } } DBGMSG("ndx=%d", ndx); DBGMSG("ntsal=%d", ntsa_length(pieces) ); assert(ndx == ntsa_length(pieces)); ntsa_free(pieces); DBGMSG("traceClasses = 0x%02x", traceClasses); parsed_cmd->trace = traceClasses; debug = saved_debug; } #endif // #ifdef MULTIPLE_TRACE if (trace_classes) { Trace_Group traceClasses = 0x00; int ndx = 0; for (;trace_classes[ndx] != NULL; ndx++) { char * token = trace_classes[ndx]; strupper(token); // DBGMSG("token=|%s|", token); if (streq(token, "ALL") || streq(token, "*")) { traceClasses = TRC_ALWAYS; // 0xff } else { // DBGMSG("token: |%s|", token); Trace_Group tg = trace_class_name_to_value(token); // DBGMSG("tg=0x%02x", tg); if (tg) { traceClasses |= tg; } else { printf("Invalid trace group: %s\n", token); ok = false; } } } // DBGMSG("traceClasses = 0x%02x", traceClasses); parsed_cmd->trace = traceClasses; } // #endif if (trace_functions) { parsed_cmd->traced_functions = trace_functions; } if (trace_filenames) { parsed_cmd->traced_files = trace_filenames; } int rest_ct = 0; // don't pull debug into the if clause, need rest_ct to be set if (cmd_and_args) { for (; cmd_and_args[rest_ct] != NULL; rest_ct++) { DBGMSF(debug, "cmd_and_args[%d]: %s", rest_ct, cmd_and_args[rest_ct]); } } if (version_flag) { printf("ddcutil %s\n", BUILD_VERSION); // TODO: patch values at link time // printf("Built %s at %s\n", BUILD_DATE, BUILD_TIME); #ifdef HAVE_ADL printf("Built with support for AMD Display Library (AMD proprietary driver).\n"); #else printf("Built without support for AMD Display Library (AMD proprietary driver).\n"); #endif #ifdef USE_USB printf("Built with support for USB connected displays.\n"); #else printf("Built without support for USB connected displays.\n"); #endif #ifdef ENABLE_FAILSIM printf("Built with function failure simulation.\n"); #else printf("Built without function failure simulation.\n"); #endif #ifdef USE_LIBDRM printf("Built with libdrm services.\n"); #else printf("Built without libdrm services.\n"); #endif puts(""); // if no command specified, include license in version information and terminate if (rest_ct == 0) { puts("Copyright (C) 2015-2017 Sanford Rockowitz"); puts("License GPLv2: GNU GPL version 2 or later "); puts("This is free software: you are free to change and redistribute it."); puts("There is NO WARRANTY, to the extent permitted by law."); exit(0); } } // All options processed. Check for consistency, set defaults if (explicit_display_spec_ct > 1) { fprintf(stderr, "Monitor specified in more than one way\n"); free_display_identifier(parsed_cmd->pdid); parsed_cmd->pdid = NULL; ok = false; } // else if (explicit_display_spec_ct == 0) // parsed_cmd->pdid = create_dispno_display_identifier(1); // default monitor if (rest_ct == 0) { fprintf(stderr, "No command specified\n"); ok = false; } else { char * cmd = cmd_and_args[0];; if (debug) printf("cmd=|%s|\n", cmd); Cmd_Desc * cmdInfo = find_command(cmd); if (cmdInfo == NULL) { fprintf(stderr, "Unrecognized command: %s\n", cmd); ok = false; } else { if (debug) show_cmd_desc(cmdInfo); // process command args parsed_cmd->cmd_id = cmdInfo->cmd_id; // parsedCmd->argCt = cmdInfo->argct; int min_arg_ct = cmdInfo->min_arg_ct; int max_arg_ct = cmdInfo->max_arg_ct; int argctr = 1; while ( cmd_and_args[argctr] != NULL) { // printf("loop. argctr=%d\n", argctr); if (argctr > max_arg_ct) { fprintf(stderr, "Too many arguments\n"); ok = false; break; } char * thisarg = (char *) cmd_and_args[argctr]; // printf("thisarg |%s|\n", thisarg); char * argcopy = strdup(thisarg); parsed_cmd->args[argctr-1] = argcopy; argctr++; } parsed_cmd->argct = argctr-1; // no more arguments specified if (argctr <= min_arg_ct) { fprintf(stderr, "Missing argument(s)\n"); ok = false; } if ( ok && (parsed_cmd->cmd_id == CMDID_VCPINFO || parsed_cmd->cmd_id == CMDID_GETVCP) ) { Feature_Set_Ref * fsref = calloc(1, sizeof(Feature_Set_Ref)); char * val = (parsed_cmd->argct > 0) ? parsed_cmd->args[0] : "ALL"; ok = parse_feature_id_or_subset(val, parsed_cmd->cmd_id, fsref); DBGMSF(debug, "parse_feature_id_or_subset() returned: %d", ok); if (ok) parsed_cmd->fref = fsref; else printf("Invalid feature code or subset: %s\n", parsed_cmd->args[0]); } // validate options vs commands #ifdef OLD // unnecessary - validate_output_levels() handles this switch (parsed_cmd->cmd_id) { case (CMDID_PROBE): if (parsed_cmd->output_level == DDCA_OL_TERSE) { // don't want to deal with how to report errors, write-only features fprintf(stderr, "probe command: option --terse unsupported"); ok = false; } break; default: break; } #endif } // recognized command } if (ok) ok = validate_output_level(parsed_cmd); g_option_context_free(context); if (debug) dbgrpt_parsed_cmd(parsed_cmd, 0); if (!ok) { free_parsed_cmd(parsed_cmd); parsed_cmd = NULL; } DBGMSF(debug, "Returning: %p", parsed_cmd); return parsed_cmd; } ddcutil-0.8.6/src/cmdline/parsed_cmd.c0000644000175000001440000001325113224275746014557 00000000000000/* parsed_cmd.c * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include "util/data_structures.h" #include "util/glib_string_util.h" #include "util/report_util.h" #include "cmdline/parsed_cmd.h" // // Parsed_Cmd data structure // #ifdef FUTURE Value_Name_Table cmd_flag_table = { VNT(CMD_FLAG_DDCDATA, "report DDC errors"), VNT(CMD_FLAG_FORCE, "ignore certain errors"), VNT(CMD_FLAG_FORCE_SLAVE_ADDR, "force slave address setting"), VNT(CMD_FLAG_TIMESTAMP_TRACE, "include timestamp on trace messages"), VNT(CMD_FLAG_SHOW_UNSUPPORTED, "show unsupported VCP features"), VNT(CMD_FLAG_ENABLE_FAILSIM, "enable failure simulation"), VNT(CMD_FLAG_VERIFY, "read VCP features after setting them"), // etc }; #endif /* Allocates new Parsed_Cmd data structure, sets default values. * * Returns: * initialized ParsedCmd */ Parsed_Cmd * new_parsed_cmd() { // DBGMSG("Starting. file=%s", __FILE__); Parsed_Cmd * parsed_cmd = calloc(1, sizeof(Parsed_Cmd)); memcpy(parsed_cmd->marker, PARSED_CMD_MARKER, 4); // n. all flags are false, byte values 0, integers 0, pointers NULL because of calloc // parsed_cmd->output_level = OL_DEFAULT; parsed_cmd->output_level = DDCA_OL_NORMAL; parsed_cmd->sleep_strategy = -1; // use default parsed_cmd->nodetect = true; return parsed_cmd; } // Debugging function void dbgrpt_parsed_cmd(Parsed_Cmd * parsed_cmd, int depth) { int d1 = depth+1; int d2 = depth+2; rpt_structure_loc("Parsed_Cmd", parsed_cmd, depth); rpt_int_as_hex( "cmd_id", NULL, parsed_cmd->cmd_id, d1); rpt_structure_loc("pdid", parsed_cmd->pdid, d1); if (parsed_cmd->pdid) dbgrpt_display_identifier(parsed_cmd->pdid, d2); rpt_structure_loc("fref", parsed_cmd->fref, d1); if (parsed_cmd->fref) dbgrpt_feature_set_ref(parsed_cmd->fref, d2); rpt_int_as_hex( "stats", NULL, parsed_cmd->stats_types, d1); rpt_bool("ddcdata", NULL, parsed_cmd->ddcdata, d1); rpt_str( "output_level",NULL, output_level_name(parsed_cmd->output_level), d1); // rpt_bool("force", NULL, parsed_cmd->force, d1); rpt_bool("force_slave_addr", NULL, parsed_cmd->force_slave_addr, d1); // rpt_bool("show_unsupported", NULL, parsed_cmd->show_unsupported, d1); rpt_bool("verify_setvcp", NULL, parsed_cmd->verify_setvcp, d1); rpt_bool("timestamp_trace", NULL, parsed_cmd->timestamp_trace, d1); rpt_int_as_hex( "trace", NULL, parsed_cmd->trace, d1); if (parsed_cmd->traced_functions) { char * joined = g_strjoinv(", ", parsed_cmd->traced_functions); rpt_str("traced_functions", NULL, joined, d1); free(joined); } else rpt_str("traced_functions", NULL, "none", d1); if (parsed_cmd->traced_files) { char * joined = g_strjoinv(", ", parsed_cmd->traced_files); rpt_str("traced_files", NULL, joined, d1); free(joined); } else rpt_str("traced_files", NULL, "none", d1); rpt_int( "argct", NULL, parsed_cmd->argct, d1); int ndx = 0; for (ndx = 0; ndx < parsed_cmd->argct; ndx++) { printf(" argument %d: %s\n", ndx, parsed_cmd->args[ndx]); } char buf[20]; snprintf(buf,20, "%d,%d,%d", parsed_cmd->max_tries[0], parsed_cmd->max_tries[1], parsed_cmd->max_tries[2] ); rpt_str("max_retries", NULL, buf, d1); rpt_int("sleep_stragegy", NULL, parsed_cmd->sleep_strategy, d1); rpt_bool("enable_failure_simulation", NULL, parsed_cmd->enable_failure_simulation, d1); rpt_str("failsim_control_fn", NULL, parsed_cmd->failsim_control_fn, d1); rpt_bool("nodetect", NULL, parsed_cmd->nodetect, d1); rpt_bool("async", NULL, parsed_cmd->async, d1); rpt_bool("report_freed_exceptions", NULL, parsed_cmd->report_freed_exceptions, d1); rpt_bool("force", NULL, parsed_cmd->flags & CMD_FLAG_FORCE, d1); rpt_bool("notable", NULL, parsed_cmd->flags & CMD_FLAG_NOTABLE, d1); rpt_bool("show unsupported", NULL, parsed_cmd->flags & CMD_FLAG_SHOW_UNSUPPORTED, d1); #ifdef FUTURE char * interpreted_flags = vnt_interpret_flags(parsed_cmd->flags, cmd_flag_table, false, ", "); rpt_str("flags", NULL, interpreted_flags, d1); free(interpreted_flags); #endif } void free_parsed_cmd(Parsed_Cmd * parsed_cmd) { assert ( memcmp(parsed_cmd->marker,PARSED_CMD_MARKER,4) == 0); int ndx = 0; for (; ndx < parsed_cmd->argct; ndx++) free(parsed_cmd->args[ndx]); if (parsed_cmd->pdid) free_display_identifier(parsed_cmd->pdid); parsed_cmd->marker[3] = 'x'; free(parsed_cmd); } ddcutil-0.8.6/src/cmdline/cmd_parser.h0000644000175000001440000000224113230445447014571 00000000000000/* cmd_parser.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ // // This simple interface facilitated switching command parsers during // development. Candidate for removal. // #ifndef CMD_PARSER_H_ #define CMD_PARSER_H_ #include "cmdline/parsed_cmd.h" Parsed_Cmd * parse_command(int argc, char * argv[]); #endif /* CMD_PARSER_H_ */ ddcutil-0.8.6/src/cmdline/cmd_parser_aux.h0000644000175000001440000000440413230445447015451 00000000000000/* cmd_parser_aux.h * * Functions and strings that are independent of the parser * package used. * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ // Command parsing functions that are independent of the specific parser // being used. #ifndef CMD_PARSER_AUX_H_ #define CMD_PARSER_AUX_H_ #include #include "cmdline/parsed_cmd.h" typedef struct { int cmd_id; const char * cmd_name; int minchars; int min_arg_ct; int max_arg_ct; } Cmd_Desc; Cmd_Desc * find_command(char * cmd); Cmd_Desc * get_command(int cmdid); void show_cmd_desc(Cmd_Desc * cmd_desc); // debugging function void validate_cmdinfo(); bool all_digits(char * val, int ct); bool parse_dot_separated_arg( const char * val, int * pv1, int * pv2); bool parse_colon_separated_arg(const char * val, int * pv1, int * pv2); bool parse_int_arg(char * val, int * pIval); bool parse_feature_id_or_subset(char * val, int cmd_id, Feature_Set_Ref * fsref); bool validate_output_level(Parsed_Cmd* parsed_cmd); extern char * commands_list_help; extern char * command_argument_help; extern char * monitor_selection_option_help; extern char * tracing_comma_separated_option_help; extern char * tracing_multiple_call_option_help; extern char * trcfunc_multiple_call_option_help; extern char * trcfile_multiple_call_option_help; extern char * stats_multiple_call_option_help; extern char * maxtries_option_help; #endif /* CMD_PARSER_AUX_H_ */ ddcutil-0.8.6/src/cmdline/parsed_cmd.h0000644000175000001440000000675713230445447014573 00000000000000/* parsed_cmd.h * * * Copyright (C) 2014-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef PARSED_CMD_H_ #define PARSED_CMD_H_ #include #include #include "base/core.h" #include "base/displays.h" #include "base/parms.h" typedef enum { CMDID_NONE = 0x0000, CMDID_DETECT = 0x0001, CMDID_CAPABILITIES = 0x0002, CMDID_GETVCP = 0x0004, CMDID_SETVCP = 0x0008, CMDID_LISTVCP = 0x0010, CMDID_TESTCASE = 0x0020, CMDID_LISTTESTS = 0x0040, CMDID_LOADVCP = 0x0080, CMDID_DUMPVCP = 0x0100, CMDID_INTERROGATE = 0x0200, CMDID_ENVIRONMENT = 0x0400, CMDID_USBENV = 0x0800, CMDID_VCPINFO = 0x1000, CMDID_READCHANGES = 0x2000, CMDID_CHKUSBMON = 0x4000, CMDID_PROBE = 0x8000, CMDID_SAVE_SETTINGS = 0x010000, } Cmd_Id_Type; typedef enum { #ifdef FUTURE CMD_FLAG_DDCDATA = 0x0001, #endif CMD_FLAG_FORCE = 0x0002, #ifdef FUTURE CMD_FLAG_FORCE_SLAVE_ADDR = 0x0004, CMD_FLAG_TIMESTAMP_TRACE = 0x0008, #endif CMD_FLAG_SHOW_UNSUPPORTED = 0x0010, #ifdef FUTURE CMD_FLAG_ENABLE_FAILSIM = 0x0020, CMD_FLAG_VERIFY = 0x0040, CMD_FLAG_NODETECT = 0x0080, CMD_FLAG_ASYNC = 0x0100, CMD_FLAG_REPORT_FREED_EXCP = 0x2000, #endif CMD_FLAG_NOTABLE = 0x4000 } Parsed_Cmd_Flags; #define PARSED_CMD_MARKER "PCMD" typedef struct { char marker[4]; // always PCMD Cmd_Id_Type cmd_id; int argct; char * args[MAX_ARGS]; Feature_Set_Ref* fref; DDCA_Stats_Type stats_types; bool ddcdata; // bool force; bool force_slave_addr; bool timestamp_trace; // prepend trace and debug msgs with elapsed time // bool show_unsupported; bool enable_failure_simulation; bool verify_setvcp; bool nodetect; bool async; bool report_freed_exceptions; char * failsim_control_fn; Display_Identifier* pdid; Trace_Group trace; gchar ** traced_files; gchar ** traced_functions; DDCA_Output_Level output_level; int max_tries[3]; int sleep_strategy; uint16_t flags; // Parsed_Cmd_Flags } Parsed_Cmd; Parsed_Cmd * new_parsed_cmd(); void free_parsed_cmd(Parsed_Cmd * parsed_cmd); void dbgrpt_parsed_cmd(Parsed_Cmd * parsed_cmd, int depth); // debugging function #endif /* PARSED_CMD_H_ */ ddcutil-0.8.6/src/gobject_api/0000755000175000001440000000000013230445447013215 500000000000000ddcutil-0.8.6/src/gobject_api/Makefile.am0000644000175000001440000001514613213314314015165 00000000000000# Makefile for GObject introspection # Adapted from that for colord by Richard Hughes CLEANFILES = \ *expand clean-local: echo "(src/gobject_api/Makefile) clean-local" if ENABLE_SHARED_LIB_COND if ENABLE_GOBJECT_COND # The library that exposes the ddcutil GObject API lib_LTLIBRARIES = libddcgobj.la # Files implementing GObject API for introspection: gobject_api_sources = \ ddcg_structs.c \ ddcg_cont_response.c \ ddcg_context.c \ ddcg_display_handle.c \ ddcg_display_identifier.c \ ddcg_display_ref.c # if use ddcg_gobjects.h to pull in all the .h files, get strange errors re unexpected semicolons # gobject_api_headers = \ # gobject_api/ddcg_gobjects.h gobject_api_headers = \ ddcg_structs.h \ ddcg_cont_response.h \ ddcg_context.h \ ddcg_display_handle.h \ ddcg_display_identifier.h \ ddcg_display_ref.h \ ddcg_types.h libddcgobj_la_SOURCES = $(gobject_api_sources) # files only in goclient: # Normally, sample code would be in a separate directory. # gomain.c has been moved here to consolidate the mothballed GObject introspection code. goclient_SOURCES = \ gomain.c # # C Pre-Processor Flags: # AM_CPPFLAGS = \ -I$(top_srcdir) \ -I.. \ -I../public \ $(GOBJECT_CFLAGS) # Be careful about library ordering # A library must be listed AFTER any libraries that depend on it. # libcommon.la included because gobject code directly calls # dbgtrc and rpt_str, which are not exported by libddcutil libddcgobj_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la \ $(GOBJECT_LIBS) libddcgobj_la_LDFLAGS = libddcgobj_la_LDFLAGS += -export_symbols-regex '^ddc[tgs]_[^_]' # libddcgobj_la_LDFLAGS += -version-info '0:1:1' # libddcgobj_la_LDFLAGS += -export-dynamic # # Sample client program. # check_PROGRAMS = \ goclient # Compiler flags goclient_CFLAGS = $(AM_CFLAGS) # libddcutil is in the list because goclient uses function dbgtrc() goclient_LDADD = \ libddcgobj.la \ ../libddcutil.la \ $(GOBJECT_LIBS) # Comments from /usr/share/gobject-introspection-1.0/Makefile.introspection: # # * Input variables: # # INTROSPECTION_GIRS - List of GIRS that should be generated # INTROSPECTION_SCANNER - Command to invoke scanner, normally set by # GOBJECT_INTROSPECTION_REQUIRE/CHECK() in introspection.m4 # INTROSPECTION_SCANNER_ARGS - Additional args to pass in to the scanner # INTROSPECTION_SCANNER_ENV - Environment variables to set before running # the scanner # INTROSPECTION_COMPILER - Command to invoke compiler, normally set by # GOBJECT_INTROSPECTION_REQUIRE/CHECK() in introspection.m4 # INTROSPECTION_COMPILER_ARGS - Additional args to pass in to the compiler # # * Simple tutorial # # Add this to configure.ac: # -Wno-portability to AM_INIT_AUTOMAKE # GOBJECT_INTROSPECTION_CHECK([0.6.7]) # # Add this to Makefile.am where your library/program is built: # include $(INTROSPECTION_MAKEFILE) # INTROSPECTION_GIRS = YourLib-1.0.gir # YourLib-1.0.gir: libyourlib.la # YourLib_1_0_gir_NAMESPACE = YourLib # YourLib_1_0_gir_VERSION = 1.0 # YourLib_1_0_gir_LIBS = libyourlib.la # YourLib_1_0_gir_FILES = $(libyourlib_1_0_SOURCES) # girdir = $(datadir)/gir-1.0 # dist_gir_DATA = YourLib-1.0.gir # typelibdir = $(libdir)/girepository-1.0 # typelib_DATA = YourLib-1.0.typelib # CLEANFILES = $(dist_gir_DATA) $(typelib_DATA) # # And later in file: # # Creates a GIR by scanning C headers/sources # $(1) - Name of the gir file (output) # # If output is Gtk-2.0.gir then you should name the variables like # Gtk_2_0_gir_NAMESPACE, Gtk_2_0_gir_VERSION etc. # Required variables: # FILES - C sources and headers which should be scanned # # One of these variables are required: # LIBS - Library where the symbol represented in the gir can be found # PROGRAM - Program where the symbol represented in the gir can be found # # Optional variables # NAMESPACE - Namespace of the gir, first letter capital, # rest should be lower case, for instance: 'Gtk', 'Clutter', 'ClutterGtk'. # If not present the namespace will be fetched from the gir filename, # the part before the first dash. For 'Gtk-2.0', namespace will be 'Gtk'. # VERSION - Version of the gir, if not present, will be fetched from gir # filename, the part after the first dash. For 'Gtk-2.0', version will be '2.0'. # LIBTOOL - Command to invoke libtool, usually set by automake # SCANNERFLAGS - Flags to pass in to the scanner, see g-ir-scanner(1) for a list # CFLAGS - Flags to pass in to the parser when scanning headers # LDFLAGS - Linker flags used by the scanner # PACKAGES - list of pkg-config names which cflags are required to parse # the headers of this gir # INCLUDES - Gir files to include without the .gir suffix, for instance # GLib-2.0, Gtk-2.0. This is needed for all libraries which you depend on that # provides introspection information. # EXPORT_PACKAGES - list of pkg-config names that are provided by this gir. # By default the names in the PACKAGES variable will be used. -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = # INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --verbose --identifier-prefix=Ddcg --symbol-prefix=ddcg # INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --verbose INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --verbose INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --verbose introspection_sources = \ $(gobject_api_sources) \ $(gobject_api_headers) # add the target: ddcutil-1.0.gir: libddcgobj.la ../libddcutil.la ddcutil_1_0_gir_INCLUDES = GObject-2.0 ddcutil_1_0_gir_CFLAGS = $(AM_CPPFLAGS) # Colord_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 # Colord_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -DCD_DISABLE_DEPRECATED # ddcutil_1_0_gir_NAMESPACE=Ddcg # ddcutil_1_0_gir_VERSION=1.0 ddcutil_1_0_gir_SCANNERFLAGS = --identifier-prefix=Ddcg \ --symbol-prefix=ddcg \ --warn-all \ --add-include-path=$(srcdir) # Colord_1_0_gir_SCANNERFLAGS = --identifier-prefix=Cd \ # --symbol-prefix=cd \ # --warn-all \ # --add-include-path=$(srcdir) \ # --c-include="colord.h" ddcutil_1_0_gir_EXPORT_PACKAGES = ddcutil ddcutil_1_0_gir_LIBS = ../libddcutil.la libddcgobj.la ddcutil_1_0_gir_FILES = $(introspection_sources) INTROSPECTION_GIRS += ddcutil-1.0.gir girdir = $(datadir)/gir-1.0 # dist_gir_DATA=$(INTROSPECTION_GIRS) gir_DATA = $(INTROSPECTION_GIRS) typelibdir = $(libdir)/girepository-1.0 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(gir_DATA) $(typelib_DATA) # CLEANFILES += $(gir_DATA) $(typelib_DATA) *.log *.trs *.test endif endif ddcutil-0.8.6/src/gobject_api/Makefile.in0000644000175000001440000011665113230171237015205 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Makefile for GObject introspection # Adapted from that for colord by Richard Hughes 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_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@check_PROGRAMS = goclient$(EXEEXT) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@am__append_1 = $(gir_DATA) $(typelib_DATA) subdir = src/gobject_api ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ "$(DESTDIR)$(typelibdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@libddcgobj_la_DEPENDENCIES = ../libcommon.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ../libddcutil.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(am__DEPENDENCIES_1) am__libddcgobj_la_SOURCES_DIST = ddcg_structs.c ddcg_cont_response.c \ ddcg_context.c ddcg_display_handle.c ddcg_display_identifier.c \ ddcg_display_ref.c @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@am__objects_1 = ddcg_structs.lo \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_cont_response.lo \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_context.lo \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_handle.lo \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_identifier.lo \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_ref.lo @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@am_libddcgobj_la_OBJECTS = $(am__objects_1) libddcgobj_la_OBJECTS = $(am_libddcgobj_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 = libddcgobj_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libddcgobj_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@am_libddcgobj_la_rpath = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ -rpath \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(libdir) am__goclient_SOURCES_DIST = gomain.c @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@am_goclient_OBJECTS = goclient-gomain.$(OBJEXT) goclient_OBJECTS = $(am_goclient_OBJECTS) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@goclient_DEPENDENCIES = libddcgobj.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ../libddcutil.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(am__DEPENDENCIES_1) goclient_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(goclient_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@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libddcgobj_la_SOURCES) $(goclient_SOURCES) DIST_SOURCES = $(am__libddcgobj_la_SOURCES_DIST) \ $(am__goclient_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(gir_DATA) $(typelib_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ CLEANFILES = *expand $(am__append_1) # The library that exposes the ddcutil GObject API @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@lib_LTLIBRARIES = libddcgobj.la # Files implementing GObject API for introspection: @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@gobject_api_sources = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_structs.c \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_cont_response.c \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_context.c \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_handle.c \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_identifier.c \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_ref.c # if use ddcg_gobjects.h to pull in all the .h files, get strange errors re unexpected semicolons # gobject_api_headers = \ # gobject_api/ddcg_gobjects.h @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@gobject_api_headers = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_structs.h \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_cont_response.h \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_context.h \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_handle.h \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_identifier.h \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_display_ref.h \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcg_types.h @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@libddcgobj_la_SOURCES = $(gobject_api_sources) # files only in goclient: # Normally, sample code would be in a separate directory. # gomain.c has been moved here to consolidate the mothballed GObject introspection code. @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@goclient_SOURCES = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ gomain.c # # C Pre-Processor Flags: # @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@AM_CPPFLAGS = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ -I$(top_srcdir) \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ -I.. \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ -I../public \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(GOBJECT_CFLAGS) # Be careful about library ordering # A library must be listed AFTER any libraries that depend on it. # libcommon.la included because gobject code directly calls # dbgtrc and rpt_str, which are not exported by libddcutil @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@libddcgobj_la_LIBADD = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ../libcommon.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ../libddcutil.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(GOBJECT_LIBS) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@libddcgobj_la_LDFLAGS = -export_symbols-regex \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ '^ddc[tgs]_[^_]' # Compiler flags @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@goclient_CFLAGS = $(AM_CFLAGS) # libddcutil is in the list because goclient uses function dbgtrc() @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@goclient_LDADD = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ libddcgobj.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ../libddcutil.la \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(GOBJECT_LIBS) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@INTROSPECTION_GIRS = ddcutil-1.0.gir @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --verbose @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --verbose @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@introspection_sources = \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(gobject_api_sources) \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ $(gobject_api_headers) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ddcutil_1_0_gir_INCLUDES = GObject-2.0 @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ddcutil_1_0_gir_CFLAGS = $(AM_CPPFLAGS) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ddcutil_1_0_gir_SCANNERFLAGS = --identifier-prefix=Ddcg \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ --symbol-prefix=ddcg \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ --warn-all \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ --add-include-path=$(srcdir) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ddcutil_1_0_gir_EXPORT_PACKAGES = ddcutil @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ddcutil_1_0_gir_LIBS = ../libddcutil.la libddcgobj.la @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ddcutil_1_0_gir_FILES = $(introspection_sources) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@girdir = $(datadir)/gir-1.0 @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@gir_DATA = $(INTROSPECTION_GIRS) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@typelibdir = $(libdir)/girepository-1.0 @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/gobject_api/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/gobject_api/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-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}; \ } libddcgobj.la: $(libddcgobj_la_OBJECTS) $(libddcgobj_la_DEPENDENCIES) $(EXTRA_libddcgobj_la_DEPENDENCIES) $(AM_V_CCLD)$(libddcgobj_la_LINK) $(am_libddcgobj_la_rpath) $(libddcgobj_la_OBJECTS) $(libddcgobj_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_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 goclient$(EXEEXT): $(goclient_OBJECTS) $(goclient_DEPENDENCIES) $(EXTRA_goclient_DEPENDENCIES) @rm -f goclient$(EXEEXT) $(AM_V_CCLD)$(goclient_LINK) $(goclient_OBJECTS) $(goclient_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcg_cont_response.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcg_context.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcg_display_handle.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcg_display_identifier.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcg_display_ref.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ddcg_structs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/goclient-gomain.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< goclient-gomain.o: gomain.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goclient_CFLAGS) $(CFLAGS) -MT goclient-gomain.o -MD -MP -MF $(DEPDIR)/goclient-gomain.Tpo -c -o goclient-gomain.o `test -f 'gomain.c' || echo '$(srcdir)/'`gomain.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/goclient-gomain.Tpo $(DEPDIR)/goclient-gomain.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gomain.c' object='goclient-gomain.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) $(goclient_CFLAGS) $(CFLAGS) -c -o goclient-gomain.o `test -f 'gomain.c' || echo '$(srcdir)/'`gomain.c goclient-gomain.obj: gomain.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(goclient_CFLAGS) $(CFLAGS) -MT goclient-gomain.obj -MD -MP -MF $(DEPDIR)/goclient-gomain.Tpo -c -o goclient-gomain.obj `if test -f 'gomain.c'; then $(CYGPATH_W) 'gomain.c'; else $(CYGPATH_W) '$(srcdir)/gomain.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/goclient-gomain.Tpo $(DEPDIR)/goclient-gomain.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gomain.c' object='goclient-gomain.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) $(goclient_CFLAGS) $(CFLAGS) -c -o goclient-gomain.obj `if test -f 'gomain.c'; then $(CYGPATH_W) 'gomain.c'; else $(CYGPATH_W) '$(srcdir)/gomain.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-girDATA: $(gir_DATA) @$(NORMAL_INSTALL) @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(girdir)" || 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)$(girdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \ done uninstall-girDATA: @$(NORMAL_UNINSTALL) @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) install-typelibDATA: $(typelib_DATA) @$(NORMAL_INSTALL) @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || 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)$(typelibdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \ done uninstall-typelibDATA: @$(NORMAL_UNINSTALL) @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(typelibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-girDATA install-typelibDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ uninstall-typelibDATA .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool clean-local cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-girDATA install-html install-html-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip install-typelibDATA installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-girDATA \ uninstall-libLTLIBRARIES uninstall-typelibDATA .PRECIOUS: Makefile clean-local: echo "(src/gobject_api/Makefile) clean-local" # Comments from /usr/share/gobject-introspection-1.0/Makefile.introspection: # # * Input variables: # # INTROSPECTION_GIRS - List of GIRS that should be generated # INTROSPECTION_SCANNER - Command to invoke scanner, normally set by # GOBJECT_INTROSPECTION_REQUIRE/CHECK() in introspection.m4 # INTROSPECTION_SCANNER_ARGS - Additional args to pass in to the scanner # INTROSPECTION_SCANNER_ENV - Environment variables to set before running # the scanner # INTROSPECTION_COMPILER - Command to invoke compiler, normally set by # GOBJECT_INTROSPECTION_REQUIRE/CHECK() in introspection.m4 # INTROSPECTION_COMPILER_ARGS - Additional args to pass in to the compiler # # * Simple tutorial # # Add this to configure.ac: # -Wno-portability to AM_INIT_AUTOMAKE # GOBJECT_INTROSPECTION_CHECK([0.6.7]) # # Add this to Makefile.am where your library/program is built: # include $(INTROSPECTION_MAKEFILE) # INTROSPECTION_GIRS = YourLib-1.0.gir # YourLib-1.0.gir: libyourlib.la # YourLib_1_0_gir_NAMESPACE = YourLib # YourLib_1_0_gir_VERSION = 1.0 # YourLib_1_0_gir_LIBS = libyourlib.la # YourLib_1_0_gir_FILES = $(libyourlib_1_0_SOURCES) # girdir = $(datadir)/gir-1.0 # dist_gir_DATA = YourLib-1.0.gir # typelibdir = $(libdir)/girepository-1.0 # typelib_DATA = YourLib-1.0.typelib # CLEANFILES = $(dist_gir_DATA) $(typelib_DATA) # # And later in file: # # Creates a GIR by scanning C headers/sources # $(1) - Name of the gir file (output) # # If output is Gtk-2.0.gir then you should name the variables like # Gtk_2_0_gir_NAMESPACE, Gtk_2_0_gir_VERSION etc. # Required variables: # FILES - C sources and headers which should be scanned # # One of these variables are required: # LIBS - Library where the symbol represented in the gir can be found # PROGRAM - Program where the symbol represented in the gir can be found # # Optional variables # NAMESPACE - Namespace of the gir, first letter capital, # rest should be lower case, for instance: 'Gtk', 'Clutter', 'ClutterGtk'. # If not present the namespace will be fetched from the gir filename, # the part before the first dash. For 'Gtk-2.0', namespace will be 'Gtk'. # VERSION - Version of the gir, if not present, will be fetched from gir # filename, the part after the first dash. For 'Gtk-2.0', version will be '2.0'. # LIBTOOL - Command to invoke libtool, usually set by automake # SCANNERFLAGS - Flags to pass in to the scanner, see g-ir-scanner(1) for a list # CFLAGS - Flags to pass in to the parser when scanning headers # LDFLAGS - Linker flags used by the scanner # PACKAGES - list of pkg-config names which cflags are required to parse # the headers of this gir # INCLUDES - Gir files to include without the .gir suffix, for instance # GLib-2.0, Gtk-2.0. This is needed for all libraries which you depend on that # provides introspection information. # EXPORT_PACKAGES - list of pkg-config names that are provided by this gir. # By default the names in the PACKAGES variable will be used. @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@-include $(INTROSPECTION_MAKEFILE) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all --verbose --identifier-prefix=Ddcg --symbol-prefix=ddcg @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) --verbose @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # add the target: @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ ddcutil-1.0.gir: libddcgobj.la ../libddcutil.la @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # Colord_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # Colord_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -DCD_DISABLE_DEPRECATED @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # ddcutil_1_0_gir_NAMESPACE=Ddcg @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # ddcutil_1_0_gir_VERSION=1.0 @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # Colord_1_0_gir_SCANNERFLAGS = --identifier-prefix=Cd \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # --symbol-prefix=cd \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # --warn-all \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # --add-include-path=$(srcdir) \ @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # --c-include="colord.h" @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # dist_gir_DATA=$(INTROSPECTION_GIRS) @ENABLE_GOBJECT_COND_TRUE@@ENABLE_SHARED_LIB_COND_TRUE@ # CLEANFILES += $(gir_DATA) $(typelib_DATA) *.log *.trs *.test # 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: ddcutil-0.8.6/src/gobject_api/ddcg_structs.c0000644000175000001440000000310613216677166016002 00000000000000/* ddcg_structs.c * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include "base/core.h" #include "ddcg_structs.h" G_DEFINE_TYPE(DdcgDdcutilVersionSpec, ddcg_ddcutil_version_spec, G_TYPE_OBJECT) static void ddcg_ddcutil_version_spec_class_init(DdcgDdcutilVersionSpecClass * cls); static void ddcg_ddcutil_version_spec_init(DdcgDdcutilVersionSpec * ddcutil_version_spec); static void ddcg_ddcutil_version_spec_class_init(DdcgDdcutilVersionSpecClass * cls) { DBGMSG("Starting"); } static void ddcg_ddcutil_version_spec_init(DdcgDdcutilVersionSpec * ddcutil_version_spec) { DBGMSG("Starting"); // initialize the instance } DdcgDdcutilVersionSpec * ddcg_ddcutil_version_spec_new(void) { return g_object_new(DDCG_TYPE_DDCUTIL_VERSION_SPEC, NULL); } ddcutil-0.8.6/src/gobject_api/ddcg_cont_response.c0000644000175000001440000000760413224707352017151 00000000000000/* ddcg_cont_response.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include "util/report_util.h" #include "base/core.h" #include "gobject_api/ddcg_cont_response.h" typedef struct { // whatever } DdcgContResponsePrivate; /** * ddcg_cont_response_report: * @presp: * @depth: logical indentation depth * */ void ddcg_cont_response_report(DdcgContResponse * presp, int depth) { // g_return_if_fail( DDCG_IS_CONT_RESPONSE(presp) ); // flags failure, why? int d1 = depth+1; //int d2 = depth+2; rpt_vstring(depth, "DdcgContResponse at %p", presp); rpt_vstring(d1, "mh: 0x%02x", presp->mh); rpt_vstring(d1, "ml: 0x%02x", presp->ml); rpt_vstring(d1, "sh: 0x%02x", presp->sh); rpt_vstring(d1, "sl: 0x%02x", presp->sl); rpt_vstring(d1, "cur_value: %d", presp->cur_value); rpt_vstring(d1, "max_value: %d", presp->max_value); // rpt_vstring(d1, "pcontext: %p", presp->pcontext); // rpt_vstring(d1, "priv: %p", presp->priv); } G_DEFINE_TYPE (DdcgContResponse, ddcg_cont_response, G_TYPE_OBJECT); static void ddcg_cont_response_class_init(DdcgContResponseClass * cls); static void ddcg_cont_response_init(DdcgContResponse * cont_response); #ifdef UNUSED static void ddcg_cont_response_finalize(GObject * obj); #endif #ifdef NO static void ddcg_cont_response_constructed(GObject * obj) { DBGMSG("Starting"); // Update the object state depending on constructor properties // Chain up to parent constructed function to complete object initialization //G_OBJECT_CLASS(obj)->parent_class->constructed(obj); } #endif static void ddcg_cont_response_class_init(DdcgContResponseClass * cls) { DBGMSG("Starting"); #ifdef WONT_COMPILE GObjectClass * object_class = G_OBJECT_CLASS(cls); object_class->constructed = ddcg_cont_response_constructed; #endif // ddca_init(); // cls->class_initialized = true; // no member named class_initialized } static void ddcg_cont_response_init(DdcgContResponse * cont_response) { DBGMSG("Starting"); // initialize the instance } #ifdef UNUSED static void ddcg_cont_response_finalize(GObject * obj) { } #endif DdcgContResponse * ddcg_cont_response_new(void) { return g_object_new(DDCG_TYPE_CONT_RESPONSE, NULL); } /** * ddcg_cont_response_create: (constructor): * @mh: * @ml: * @sh: * @sl: * * Retrieve a raw non-table VCP feature value * * Returns: (transfer full): point to #DdcgContResponse */ DdcgContResponse * ddcg_cont_response_create( guint8 mh, guint8 ml, guint8 sh, guint8 sl) { DdcgContResponse * ddcg_response = NULL; // allocate a new DdcgContResponse instance ddcg_response = g_object_new(DDCG_TYPE_CONT_RESPONSE, NULL); // or set properties? ddcg_response->mh = mh; ddcg_response->ml = ml; ddcg_response->sh = sh; ddcg_response->sl = sl; ddcg_response->cur_value = sh << 8 | sl; ddcg_response->max_value = mh << 8 | ml; ddcg_cont_response_report(ddcg_response, 1); DBGMSG("Returning ddcg_response=%p", ddcg_response); return ddcg_response; } ddcutil-0.8.6/src/gobject_api/ddcg_context.c0000644000175000001440000001674113221435336015753 00000000000000/* ddcg_context.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include "base/core.h" #include "base/status_code_mgt.h" #include "ddcg_structs.h" #include "gobject_api/ddcg_context.h" #include "public/ddcutil_c_api.h" // // Build Information // #ifdef REF DDCA_Ddcutil_Version_Spec ddca_ddcutil_version(void); // ddcutil version const char * ddca_ddcutil_version_string(); #endif /** * ddcg_get_ddcutil_version_spec: * * Returns:(transfer none): pointer to struct of ints */ DdcgDdcutilVersionSpec * ddcg_get_ddcutil_version_spec(void) { DDCA_Ddcutil_Version_Spec vspec = ddca_ddcutil_version(); static DdcgDdcutilVersionSpec * gvspec = NULL; if (!gvspec) { gvspec = ddcg_ddcutil_version_spec_new(); gvspec->major = vspec.major; gvspec->minor = vspec.minor; gvspec->micro = vspec.micro; } return gvspec; } #ifdef NO /** * ddcg_get_ddcutil_version_spec2: * * Returns:(transfer none)(array fixed-size=3)(element-type gint) : pointer to struct of ints */ DdcgDdcutilVersionSpec2 ddcg_get_ddcutil_version_spec2(void) { DDCA_Ddcutil_Version_Spec vspec = ddca_ddcutil_version(); gint gvspec[3]; gvspec[0] = vspec.major; gvspec[1] = vspec.minor; gvspec[2] = vspec.micro; return gvspec; } #endif #ifdef NO // makes integer from pointer w/o a cast /** * ddcg_get_ddcutil_version_spec3: * * Returns:(transfer none)(array fixed-size=3)(element-type gint) : pointer to struct of ints */ gint ddcg_get_ddcutil_version_spec3(void) { DDCA_Ddcutil_Version_Spec vspec = ddca_ddcutil_version(); gint gvspec[3]; gvspec[0] = vspec.major; gvspec[1] = vspec.minor; gvspec[2] = vspec.micro; return gvspec; } #endif /** * ddcg_get_ddcutil_version_spec4: * * Returns:(transfer none)(array fixed-size=3)(element-type gint) : pointer to struct of ints */ gint * ddcg_get_ddcutil_version_spec4(void) { static gint gvspec[3]; DDCA_Ddcutil_Version_Spec vspec = ddca_ddcutil_version(); gvspec[0] = vspec.major; gvspec[1] = vspec.minor; gvspec[2] = vspec.micro; return gvspec; } /** * ddcg_get_ddcutil_version_string: * Returns: (transfer none): ddcutil version as a string */ const gchar * ddcg_get_ddcutil_version_string(void) { return ddca_ddcutil_version_string(); } /** * ddcg_get_build_options: * Returns: build flags */ const guint8 ddcg_get_build_options(void) { return ddca_build_options(); } // // Status Codes // /** * ddcg_rc_name: * @status_code: numeric status code * * Returns: symbolic name, e.g. EBUSY, DDCRC_INVALID_DATA * * Returns the symbolic name for a ddcutil status code */ const gchar * ddcg_rc_name(DdcgStatusCode status_code) { return ddca_rc_name(status_code); } /** * ddcg_rc_desc: * @status_code numeric status code * * Returns: explanation of status code, e.g. "device or resource busy" * * Returns explanation of status code */ const gchar * ddcg_rc_desc(DdcgStatusCode status_code) { return ddca_rc_desc(status_code); } #ifdef DOESNT_WORK struct _DdcgContextClass { GObjectClass parent_class; bool class_initialized; }; #endif struct _DdcgContext { GObject parent_instance; }; G_DEFINE_TYPE(DdcgContext, ddcg_context, G_TYPE_OBJECT) static void ddcg_context_class_init(DdcgContextClass * cls); static void ddcg_context_init(DdcgContext * context); #ifdef UNUSED static void ddcg_context_finalize(GObject * obj); #endif #ifdef NO static void ddcg_context_constructed(GObject * obj) { DBGMSG("Starting"); // Update the object state depending on constructor properties // Chain up to parent constructed function to complete object initialization G_OBJECT_CLASS(ddcg_context)->parent_class->constructed(obj)); } #endif static void ddcg_context_class_init(DdcgContextClass * cls) { DBGMSG("Starting"); #ifdef WONT_COMPILE GObjectClass * object_class = G_OBJECT_CLASS(cls); object_class->constructed = ddcg_context_constructed; #endif // ddca_init(); // cls->class_initialized = true; // no member named class_initialized } static void ddcg_context_init(DdcgContext * context) { DBGMSG("Starting"); // initialize the instance } #ifdef UNUSED static void ddcg_context_finalize(GObject * obj) { } #endif DdcgContext * ddcg_context_new(void) { return g_object_new(DDCG_TYPE_CONTEXT, NULL); } gint32 ddcg_context_get_max_max_tries( DdcgContext * ddcg_context) // GError ** error) { return ddca_max_max_tries(); } /** * ddcg_context_get_max_tries: * @ddcg_context context * @retry_type: retry type * * Returns: max tries for specified type */ gint32 ddcg_context_get_max_tries( DdcgContext * ddcg_context, DdcgRetryType retry_type) { return ddca_get_max_tries(retry_type); } /** * ddcg_context_set_max_tries: * @ddcg_context: context * @retry_type: type of retry * @max_tries: count to set * @error: (out): location where to return error * * Sets the retry count */ void ddcg_context_set_max_tries( DdcgContext * ddcg_context, DdcgRetryType retry_type, gint32 max_tries, GError ** error) { *error = NULL; DDCA_Status psc = ddca_set_max_tries(retry_type, max_tries); if (psc) { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, psc, "ddca_set_max_tries() returned ddct_status=%s", psc_desc(psc)); } } /** * ddcg_context_create_display_ref: * @ddcg_did: display identifier * @error: (out): location where to return error * * Creates a #DdcgDisplayRef from a #DdcgDisplayIdentifier. * * This may be a direct conversion (for busno or adlno) or may * entail searching the list of monitors detected. If the * DisplayIdentifier does not refer to a valid monitor, an * error is returned. * * Returns: (transfer full): new #DdcgDisplayRef */ DdcgDisplayRef * ddcg_context_create_display_ref( DdcgDisplayIdentifier * ddcg_did, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DDCA_Display_Identifier ddct_did = NULL; // extract from DdcgDisplayIdentifier ddct_did = _ddcg_display_identifier_get_ddct_object(ddcg_did); DdcgDisplayRef * ddcg_dref = NULL; DDCA_Display_Ref ddct_dref = NULL; // is pointer DDCA_Status ddct_status = ddca_create_display_ref(ddct_did, &ddct_dref); if (ddct_status == 0) { DdcgDisplayRef * ddcg_dref = ddcg_display_ref_new(); _ddcg_display_ref_set_ddct_object(ddcg_dref, ddct_dref); // also save context? } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "invalid display identifier. ddct_get_display_ref() returned ddct_status=%d", ddct_status); } return ddcg_dref; } ddcutil-0.8.6/src/gobject_api/ddcg_display_handle.c0000644000175000001440000001640313230445447017246 00000000000000/* ddc_display_handle.c * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include "public/ddcutil_c_api.h" #include "base/core.h" #include "base/ddc_errno.h" #include "gobject_api/ddcg_gobjects.h" typedef struct { // whatever DDCA_Display_Handle ddct_dh; } DdcgDisplayHandlePrivate; struct _DdcgDisplayHandle { GObject parent_instance; // class instance variables go here DdcgDisplayHandlePrivate* priv; }; G_DEFINE_TYPE_WITH_PRIVATE(DdcgDisplayHandle, ddcg_display_handle, G_TYPE_OBJECT); #ifdef FORWARD_REF_NOT_NEEDED static void ddcg_display_handle_class_init(DdcgDisplayHandleClass * cls); static void ddcg_display_handle_init(DdcgDisplayHandle * display_handle); #endif #ifdef UNUSED static void ddcg_display_handle_finalize(GObject * obj); #endif static void ddcg_display_handle_class_init(DdcgDisplayHandleClass * cls) { DBGMSG("Starting"); } static void ddcg_display_handle_init(DdcgDisplayHandle * ddcg_dh) { DBGMSG("Starting"); // initialize the instance ddcg_dh->priv = ddcg_display_handle_get_instance_private(ddcg_dh); } #ifdef UNUSED static void ddcg_display_handle_finalize(GObject * obj) { } #endif DdcgDisplayHandle * ddcg_display_handle_new(void) { return g_object_new(DDCG_TYPE_DISPLAY_HANDLE, NULL); } /** * ddcg_display_handle_open0: * @ddcg_dref: a #DdcgDisplayRef indicating the device to open * @pddcg_dh: (out): location where to return pointer #DdcgDisplayHandle * representing the opened device * * Opens a display for reading and writing. * * Returns: status code */ DdcgStatusCode ddcg_display_handle_open0(DdcgDisplayRef * ddcg_dref, DdcgDisplayHandle ** pddcg_dh) { g_return_val_if_fail( DDCG_IS_DISPLAY_REF(ddcg_dref), -EINVAL); DdcgStatusCode result = 0; DDCA_Display_Ref ddct_dref = _ddcg_display_ref_get_ddct_object(ddcg_dref); DDCA_Display_Handle ddct_dh = NULL; DDCA_Status ddct_status = ddca_open_display(ddct_dref, &ddct_dh); if (ddct_status == 0) { DdcgDisplayHandle * ddcg_dh = ddcg_display_handle_new(); ddcg_dh->priv->ddct_dh = ddct_dh; *pddcg_dh = ddcg_dh; } else { *pddcg_dh = NULL; result = ddct_status; // temp } return result; } /** * ddcg_display_handle_open: * @ddcg_dref: a #DdcgDisplayRef indicating the device to open * @error: (out): location where to return pointer #GEerror if error * * Opens a display for reading and writing. * * Returns: (transfer full): */ DdcgDisplayHandle * ddcg_display_handle_open(DdcgDisplayRef * ddcg_dref, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayHandle * ddcg_dh = NULL; DDCA_Display_Handle ddct_dh = NULL; DDCA_Display_Ref ddct_dref = _ddcg_display_ref_get_ddct_object(ddcg_dref); DDCA_Status ddct_status = ddca_open_display(ddct_dref, &ddct_dh); if (ddct_status == 0) { ddcg_dh = ddcg_display_handle_new(); ddcg_dh->priv->ddct_dh = ddct_dh; } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_open_display() returned ddct_status=%d", ddct_status); } return ddcg_dh; } /** * ddcg_display_handle_close: * @ddcg_dh: a #DdcgDisplayHandle indicating the device to close * * Closes a device * * Returns: status code */ DdcgStatusCode ddcg_display_handle_close(DdcgDisplayHandle * ddcg_dh) { DDCA_Status ddct_status = ddca_close_display(ddcg_dh->priv->ddct_dh); DdcgStatusCode ddcg_status = ddct_status; // TODO: replace with function return ddcg_status; } /** * ddcg_display_handle_get_nontable_vcp_value: * @ddcg_dh: a #DdcgDisplayHandle indicating the current instance * @feature_code: VCP feature code * @error: (out): location where to return pointer #GEerror if error * * Retrieve a raw non-table VCP feature value * * Returns: (transfer full): point to #DdcgContRespose */ DdcgContResponse * ddcg_display_handle_get_nontable_vcp_value( DdcgDisplayHandle * ddcg_dh, DdcgFeatureCode feature_code, GError ** error) { DdcgContResponse * ddcg_response = NULL; DDCA_Non_Table_Value ddct_response; DDCA_Status ddct_status = ddca_get_nontable_vcp_value( ddcg_dh->priv->ddct_dh, feature_code, &ddct_response); // DBGMSG("ddct_status = %d", ddct_status); if (ddct_status == 0) { // allocate a new DdcgContResponse instance ddcg_response = g_object_new(DDCG_TYPE_CONT_RESPONSE, NULL); // or set properties? #ifdef OLD ddcg_response->mh = ddct_response.mh; ddcg_response->ml = ddct_response.ml; ddcg_response->sh = ddct_response.sh; ddcg_response->sl = ddct_response.sl; ddcg_response->cur_value = ddct_response.cur_value; ddcg_response->max_value = ddct_response.max_value; #endif ddcg_response->mh = ddct_response.mh; ddcg_response->ml = ddct_response.ml; ddcg_response->sh = ddct_response.sh; ddcg_response->sl = ddct_response.sl; ddcg_response->cur_value = ddct_response.sh << 8 | ddct_response.sl; ddcg_response->max_value = ddct_response.mh << 8 | ddct_response.ml; // ddcg_cont_response_report(ddcg_response, 1); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_get_nontable_vcp_value() returned ddct_status=%d", ddct_status); } // DBGMSG("Returning ddcg_response=%p", ddcg_response); return ddcg_response; } /** * ddcg_display_handle_repr: * @ddcg_dh: a #DdcgDisplayHandle indicating the current instance * @error: (out callee-allocates): location where to return error information * * Returns a brief description of the current instance * * Returns: (transfer none): status code */ gchar * ddcg_display_handle_repr( DdcgDisplayHandle * ddcg_dh, GError ** error) { g_return_val_if_fail( DDCG_IS_DISPLAY_HANDLE(ddcg_dh), NULL); gchar * repr = ddca_dh_repr(ddcg_dh->priv->ddct_dh); // DBGMSG("repr=%p", repr); // DBGMSG("repr = %s", repr); if ( repr) { } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, DDCL_ARG, "ddct_repr_display_handle() returned ddct_status=%d", DDCL_ARG); } return g_strdup(repr); } #ifdef REF TO IMPLEMENT: DDCA_Status ddct_get_mccs_version(DDCA_Display_Handle ddct_dh, DDCT_MCCS_Version_Spec* pspec); #endif ddcutil-0.8.6/src/gobject_api/ddcg_display_identifier.c0000644000175000001440000002573713216676670020157 00000000000000/* ddcg_display_identifier.c * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include "util/report_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "gobject_api/ddcg_gobjects.h" typedef struct { DDCA_Display_Identifier ddct_did; } DdcgDisplayIdentifierPrivate; struct _DdcgDisplayIdentifier { GObject parent_instance; DdcgContext * pcontext; // needed? DdcgDisplayIdentifierPrivate * priv; }; G_DEFINE_TYPE_WITH_PRIVATE (DdcgDisplayIdentifier, ddcg_display_identifier, G_TYPE_OBJECT); static void ddcg_display_identifier_class_init(DdcgDisplayIdentifierClass * cls); static void ddcg_display_identifier_init(DdcgDisplayIdentifier * did); #ifdef UNUSED static void ddcg_display_identifier_finalize(GObject * obj); #endif static void ddcg_display_identifier_class_init(DdcgDisplayIdentifierClass * cls) { GObjectClass * object_class = G_OBJECT_CLASS(cls); DBGMSG("Starting. object_class=%p", object_class); } static void ddcg_display_identifier_init(DdcgDisplayIdentifier * ddcg_did) { DBGMSG("Starting"); // initialize the instance ddcg_did->priv = ddcg_display_identifier_get_instance_private(ddcg_did); // DBGMSG("Set ddcg_did->priv=%p", ddcg_did->priv); } // End of boilerplate DDCA_Display_Identifier _ddcg_display_identifier_get_ddct_object(DdcgDisplayIdentifier * ddcg_did) { g_return_val_if_fail( DDCG_IS_DISPLAY_IDENTIFIER(ddcg_did), NULL); return ddcg_did->priv->ddct_did; } /** * ddcg_display_identifier_report: * @ddcg_did: pointer to the #DdcgDisplayIdentifier instance to be reported * @depth: logical indentation depth * * Writes a report of the specified #DdcgDisplayIdentifier instance to the current * report destination. * * Returns: nothing */ void ddcg_display_identifier_report(DdcgDisplayIdentifier * ddcg_did, int depth) { g_return_if_fail( DDCG_IS_DISPLAY_IDENTIFIER(ddcg_did) ); int d1 = depth+1; int d2 = depth+2; rpt_vstring(depth, "DdcgDisplayIdentifier at %p", ddcg_did); rpt_vstring(d1, "parent_instance: %p", ddcg_did->parent_instance); rpt_vstring(d1, "pcontext: %p", ddcg_did->pcontext); rpt_vstring(d1, "priv: %p", ddcg_did->priv); if (ddcg_did->priv) { rpt_vstring(d2, "ddct_did: %p", ddcg_did->priv->ddct_did); rpt_vstring(d2, "did: %s", ddca_did_repr(ddcg_did->priv->ddct_did)); } } /** * ddcg_display_identifier_create_busno_identifier: (constructor): * @busno: display number * @error: (out): location where to return #GError if failure * * Creates a #DdcgDisplayIdentifier specifying an I2C bus number * * Returns: (transfer full): newly created #DdcgDisplayIdentifier */ DdcgDisplayIdentifier* ddcg_display_identifier_create_busno_identifier( gint32 busno, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayIdentifier * ddcg_did = NULL; DDCA_Display_Identifier ddct_did = NULL; DDCA_Status ddct_status = ddca_create_busno_display_identifier(busno, &ddct_did); if (ddct_status == 0) { ddcg_did = g_object_new(DDCG_TYPE_DISPLAY_IDENTIFIER, NULL); ddcg_did->priv->ddct_did = ddct_did; // ddcg_display_identifier_report(ddcg_did, 0); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_create_busno_display_identifier() returned %d=ddct_status", ddct_status); } return ddcg_did; } /** * ddcg_display_identifier_create_adlno_identifier: (constructor): * @adapter_index: ADL adapter index * @display_index: ADL display index * @error: (out): location where to return #GError if failure * * Creates a #DdcgDisplayIdentifier specifying an I2C bus number * * Returns: (transfer full): newly created #DdcgDisplayIdentifier */ DdcgDisplayIdentifier* ddcg_display_identifier_create_adlno_identifier( gint32 adapter_index, gint32 display_index, gint32 busno, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayIdentifier * ddcg_did = NULL; DDCA_Display_Identifier ddct_did = NULL; DDCA_Status ddct_status = ddca_create_adlno_display_identifier(adapter_index, display_index, &ddct_did); if (ddct_status == 0) { ddcg_did = g_object_new(DDCG_TYPE_DISPLAY_IDENTIFIER, NULL); ddcg_did->priv->ddct_did = ddct_did; // ddcg_display_identifier_report(ddcg_did, 0); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_create_adlno_display_identifier() returned %d=ddct_status", ddct_status); } return ddcg_did; } /** * ddcg_display_identifier_create_usb_identifier: (constructor): * @bus: bus number * @device: device number * @error: (out): location where to return #GError if failure * * Creates a #DdcgDisplayIdentifier using USB bus and device numbers * * Returns: (transfer full): newly created #DdcgDisplayIdentifier */ DdcgDisplayIdentifier* ddcg_display_identifier_create_usb_identifier( gint32 bus, gint32 device, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayIdentifier * ddcg_did = NULL; DDCA_Display_Identifier ddct_did = NULL; DDCA_Status ddct_status = ddca_create_usb_display_identifier(bus, device, &ddct_did); if (ddct_status == 0) { ddcg_did = g_object_new(DDCG_TYPE_DISPLAY_IDENTIFIER, NULL); ddcg_did->priv->ddct_did = ddct_did; // ddcg_display_identifier_report(ddcg_did, 0); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_create_usb_display_identifier() returned %d=ddct_status", ddct_status); } return ddcg_did; } /** * ddcg_display_identifier_create_mfg_model_sn_identifier: (constructor): * @mfg_id: 3 character manufacturer id * @model: model name * @sn: serial number string * @error: (out): location where to return #GError if failure * * Creates a #DdcgDisplayIdentifier using USB bus and device numbers * * Returns: (transfer full): newly created #DdcgDisplayIdentifier */ DdcgDisplayIdentifier* ddcg_display_identifier_create_mfg_model_sn_identifier( const gchar * mfg_id, const gchar * model, const gchar * sn, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayIdentifier * ddcg_did = NULL; DDCA_Display_Identifier ddca_did = NULL; DDCA_Status ddca_status = ddca_create_mfg_model_sn_display_identifier(mfg_id, model, sn, &ddca_did); if (ddca_status == 0) { ddcg_did = g_object_new(DDCG_TYPE_DISPLAY_IDENTIFIER, NULL); ddcg_did->priv->ddct_did = ddca_did; // ddcg_display_identifier_report(ddcg_did, 0); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddca_status, "ddca_create_model_sn_identifier() returned %d=ddct_status", ddca_status); } return ddcg_did; } /** * ddcg_display_identifier_create_dispno_identifier: (constructor): * @dispno: display number * @error: (out) : location where to return #GError if failure * * Creates a #DdcgDisplayIdentifier specifying a display number * * Returns: (transfer full): newly created #DdcgDisplayIdentifier */ DdcgDisplayIdentifier* ddcg_display_identifier_create_dispno_identifier( gint32 dispno, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayIdentifier * ddcg_did = NULL; DDCA_Display_Identifier ddct_did = NULL; DDCA_Status ddct_status = ddca_create_dispno_display_identifier(dispno, &ddct_did); if (ddct_status == 0) { ddcg_did = g_object_new(DDCG_TYPE_DISPLAY_IDENTIFIER, NULL); ddcg_did->priv->ddct_did = ddct_did; // ddcg_display_identifier_report(ddcg_did, 0); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_create_busno_display_identifier() returned %d=ddct_status", ddct_status); } return ddcg_did; } /** * ddcg_display_identifier_repr: * @ddcg_did: points to the current #DdcgDisplayIdentifier instance * @error: (out): location where to return #GError if failure * * Creates a printable representation of the current instance. * * Returns: (transfer none): printable representation */ gchar * ddcg_display_identifier_repr( DdcgDisplayIdentifier * ddcg_did, GError** error) { // DBGMSG("Starting. ddcg_did=%p", ddcg_did); g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail( DDCG_IS_DISPLAY_IDENTIFIER(ddcg_did), NULL); char * repr = ddca_did_repr(ddcg_did->priv->ddct_did); if (!repr) { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, DDCL_ARG, "ddct_repr_identifier() returned %d=ddct_status", DDCL_ARG); } // DBGMSG("Returning %p -> |%s|", repr, repr); // solves the problem of free failure in python runtime, // but why was python trying to free result if transfer mode = none? char * s = g_strdup(repr); // DBGMSG("Returning %p -> |%s|", s, s); return s; } #ifdef UNUSED static void ddcg_display_identifier_finalize(GObject * obj) { } #endif #ifdef NO_SUBCLASS G_DEFINE_TYPE (DdcgBusnoDisplayIdentifier, ddcg_busno_display_identifier, G_TYPE_OBJECT); static void ddcg_busno_display_identifier_class_init(DdcgBusnoDisplayIdentifierClass * cls); static void ddcg_busno_display_identifier_init(DdcgBusnoDisplayIdentifier * did); #ifdef UNUSED static void ddcg_busno_display_identifier_finalize(GObject * obj); #endif static void ddcg_busno_display_identifier_class_init(DdcgBusnoDisplayIdentifierClass * cls) { } static void ddcg_busno_display_identifier_init(DdcgBusnoDisplayIdentifier * did) { } #ifdef UNUSED static void ddcg_busno_display_identifier_finalize(GObject * obj) { } #endif GObject * busno_display_identifier_new(void) { return g_object_new(DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER, 0); } #endif ddcutil-0.8.6/src/gobject_api/ddcg_display_ref.c0000644000175000001440000001177613221435336016573 00000000000000/* ddcg_display_ref.c * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include "public/ddcutil_c_api.h" #include "util/report_util.h" #include "base/core.h" #include "base/ddc_errno.h" #include "gobject_api/ddcg_gobjects.h" typedef struct { DDCA_Display_Ref ddct_dref; } DdcgDisplayRefPrivate; struct _DdcgDisplayRef { GObject parent_instance; DdcgContext * pcontext; // needed? DdcgDisplayRefPrivate * priv; }; G_DEFINE_TYPE_WITH_PRIVATE(DdcgDisplayRef, ddcg_display_ref, G_TYPE_OBJECT); #ifdef UNNEEDED_FORWARD_REFS static void ddcg_display_ref_class_init(DdcgDisplayRefClass * cls); static void ddcg_display_ref_init(DdcgDisplayRef * display_ref); #endif static void ddcg_display_ref_class_init(DdcgDisplayRefClass * cls) { DBGMSG("Starting"); #ifdef WONT_COMPILE GObjectClass * object_class = G_OBJECT_CLASS(cls); object_class->constructed = ddcg_display_ref_constructed; #endif } static void ddcg_display_ref_init(DdcgDisplayRef * ddcg_dref) { DBGMSG("Starting"); // initialize the instance ddcg_dref->priv = ddcg_display_ref_get_instance_private(ddcg_dref); } DdcgDisplayRef * ddcg_display_ref_new(void) { return g_object_new(DDCG_TYPE_DISPLAY_REF, NULL); } // end of boilerplate void _ddcg_display_ref_set_ddct_object( DdcgDisplayRef * ddcg_dref, DDCA_Display_Ref ddct_dref) { g_return_if_fail( DDCG_IS_DISPLAY_REF(ddcg_dref) ); ddcg_dref->priv->ddct_dref = ddct_dref; } DDCA_Display_Ref _ddcg_display_ref_get_ddct_object(DdcgDisplayRef * ddcg_dref) { g_return_val_if_fail( DDCG_IS_DISPLAY_REF(ddcg_dref), NULL); return ddcg_dref->priv->ddct_dref; } /** * ddcg_display_ref_get: * @ddcg_did: a #DdcgDisplayRef pointing to the current instance * @error: (out) : location where to return pointer to created GError if failure * * Creates a #DcggDisplayRef. * * Returns: (transfer full) : pointer to newly created #DdcgDisplayRef, NULL if failure */ DdcgDisplayRef * ddcg_display_ref_get(DdcgDisplayIdentifier * ddcg_did, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); DdcgDisplayRef * ddcg_dref = NULL; DDCA_Display_Ref ddct_dref = NULL; DDCA_Display_Identifier ddct_did = _ddcg_display_identifier_get_ddct_object(ddcg_did); assert(ddcg_did); DDCA_Status ddct_status = ddca_create_display_ref( ddct_did, &ddct_dref); if (ddct_status == 0) { ddcg_dref = g_object_new(DDCG_TYPE_DISPLAY_REF, NULL); // DBGMSG("ddcg_dref=%p", ddcg_dref); // DBGMSG("ddcg_dref->priv=%p", ddcg_dref->priv); ddcg_dref->priv->ddct_dref = ddct_dref; // ddcg_display_ref_report(ddcg_dref, 0); } else { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, ddct_status, "ddct_get_display_ref() returned %d=ddcg_status", ddct_status); } return ddcg_dref; } /** * ddcg_display_ref_repr: * @ddcg_dref: a #DdcgDisplayRef * @error: (out) : location where to return pointer to created GError if failure * * Creates a printable representation of the current instance. * * Returns: (transfer none): printable representation of the current instance */ gchar * ddcg_display_ref_repr( DdcgDisplayRef * ddcg_dref, GError ** error) { g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail( DDCG_IS_DISPLAY_REF(ddcg_dref), NULL); gchar * repr = ddca_dref_repr( ddcg_dref->priv->ddct_dref); if (!repr) { GQuark domain = g_quark_from_string("DDCTOOL_DDCG"); g_set_error(error, domain, DDCL_ARG, "ddcg_display_ref_repr() returned %d=ddcg_status",DDCL_ARG); } return g_strdup(repr); // w/o g_strdup get free(): invalid pointer in Python } /** * ddcg_display_ref_report: * @ddcg_dref: a #DdcgDisplayRef * @depth: logical indentation depth * * Report on the specified instance. * * Returns: nothing */ void ddcg_display_ref_report( DdcgDisplayRef * ddcg_dref, int depth) { g_return_if_fail( DDCG_IS_DISPLAY_REF(ddcg_dref) ); rpt_vstring(depth, "DdcgDisplayRef at %p:", ddcg_dref); ddca_report_display_ref(ddcg_dref->priv->ddct_dref, depth+1); } ddcutil-0.8.6/src/gobject_api/gomain.c0000644000175000001440000000643713107075377014571 00000000000000/* gomain.c * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include "gobject_api/ddcg_gobjects.h" #define FUNCTION_ERRMSG(function_name,status_code) \ printf("(%s) %s() returned %d (%s): %s\n", \ __func__, function_name, status_code, \ ddct_status_code_name(status_code), \ ddct_status_code_desc(status_code)) void check_gerror(char * funcname, GError * err) { if (err) { printf("%s returned GError, domain=%s, code=%d\n", funcname, g_quark_to_string(err->domain), err->code ); printf("%s\n", err->message); exit(1); } } int main(int argc, char** argv) { printf("(%s) Starting.\n", __func__); gint x = ddcg_context_get_type(); printf("ddcg_context_get_type() returned %d\n", x); DdcgContext * context = g_object_new(DDCG_TYPE_CONTEXT, NULL); printf("context=%p\n", context); int max_max_tries = ddcg_context_get_max_max_tries(context); printf("(%s) max_max_tries = %d\n", __func__, max_max_tries); int busno = 5; GError * err = NULL; DdcgDisplayIdentifier* ddcg_did = ddcg_display_identifier_create_busno_identifier(busno, &err); check_gerror("ddcg_display_identifier_create_busno_identifier", err); ddcg_display_identifier_report(ddcg_did, 0); printf("After ddcg_display_identifier_report()\n"); char * repr = ddcg_display_identifier_repr(ddcg_did, &err); check_gerror("ddcg_display_identifier_create_busno_identifier", err); printf("repr: %s\n", repr); DdcgDisplayRef * ddcg_dref = ddcg_display_ref_get(ddcg_did, &err); check_gerror("ddcg_display_ref_get", err); repr = ddcg_display_ref_repr(ddcg_dref, &err); check_gerror("ddcg_display_ref_repr", err); printf("repr: %s\n", repr); DdcgDisplayHandle * ddcg_dh = ddcg_display_handle_open(ddcg_dref, &err); printf("wolf 5\n"); check_gerror("ddcg_display_handle_open", err); repr = ddcg_display_handle_repr(ddcg_dh, &err); check_gerror("ddcg_display_handle_repr", err); printf("repr: %s\n", repr); DdcgContResponse * ddcg_cont_resp = ddcg_display_handle_get_nontable_vcp_value(ddcg_dh, 0x10, &err); check_gerror("ddcg_display_handle_get_nontable_vcp_value", err); // repr = ddcg_display_handle_cont_resp_repr(ddcg_cont_resp, &err); // check_gerror("ddcg_display_cont_resp_repr", err); // DBGMSG("repr: %s", repr); ddcg_cont_response_report(ddcg_cont_resp, 0); return 0; } ddcutil-0.8.6/src/gobject_api/ddcg_cont_response.h0000644000175000001440000000357113230445447017156 00000000000000/* ddcg_cont_response.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCG_CONT_RESPONSE_H_ #define DDCG_CONT_RESPONSE_H_ #include #include "public/ddcutil_c_api.h" G_BEGIN_DECLS #define DDCG_TYPE_CONT_RESPONSE (ddcg_cont_response_get_type()) G_DECLARE_FINAL_TYPE(DdcgContResponse, ddcg_cont_response, DDCG, CONT_RESPONSE, GObject) #define DDCG_CONT_RESPONSE_ERROR ( ddcg_cont_response_quark() ) #define DDCG_CONT_RESPONSE_TYPE_ERROR ( ddcg_cont_response_get_type() ) struct _DdcgContResponse { GObject parent_instance; // class instance variables: DDCA_Non_Table_Value * presp; guint8 mh; guint8 ml; guint8 sh; guint8 sl; gint32 max_value; // or guint16? gint32 cur_value; }; void ddcg_cont_response_report(DdcgContResponse * presp, int depth); DdcgContResponse * ddcg_cont_response_new(void); DdcgContResponse * ddcg_cont_response_create( guint8 mh, guint8 ml, guint8 sh, guint8 sl); G_END_DECLS #endif /* _DDCG_CONT_RESPONSE_H_ */ ddcutil-0.8.6/src/gobject_api/ddcg_display_ref.h0000644000175000001440000000410413230445447016567 00000000000000/* ddcg_display_ref.h * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCG_DISPLAY_REF_H_ #define DDCG_DISPLAY_REF_H_ #include #include #include #include #include "gobject_api/ddcg_types.h" #include "gobject_api/ddcg_display_identifier.h" G_BEGIN_DECLS #define DDCG_TYPE_DISPLAY_REF (ddcg_display_ref_get_type()) G_DECLARE_FINAL_TYPE(DdcgDisplayRef, ddcg_display_ref, DDCG, DISPLAY_REF, GObject) #define DDCG_DISPLAY_REF_ERROR ( ddcg_display_ref_quark() ) #define DDCG_DISPLAY_REF_TYPE_ERROR ( ddcg_display_ref_get_type() ) DdcgDisplayRef * ddcg_display_ref_new(void); DdcgDisplayRef * ddcg_display_ref_get( DdcgDisplayIdentifier * ddcg_did, GError ** error); gchar * ddcg_display_ref_repr( DdcgDisplayRef * ddcg_dref, GError ** error); void ddcg_display_ref_report( DdcgDisplayRef * ddcg_dref, int depth); DDCA_Display_Ref _ddcg_display_ref_get_ddct_object( DdcgDisplayRef * ddcg_dref); void _ddcg_display_ref_set_ddct_object( DdcgDisplayRef * ddcg_dref, DDCA_Display_Ref ddct_dref); G_END_DECLS #endif /* DDCG_DISPLAY_REF_H_ */ ddcutil-0.8.6/src/gobject_api/ddcg_display_identifier.h0000644000175000001440000001243213230445447020140 00000000000000/* ddcg_display_identifier.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCG_DISPLAY_IDENTIFIER_H_ #define DDCG_DISPLAY_IDENTIFIER_H_ // #include #include #include // #include // #include "gobject_api/ddcg_gobjects.h" #include "public/ddcutil_c_api.h" // for ddcg_display_identifier_get_ddct_object() G_BEGIN_DECLS #define DDCG_TYPE_DISPLAY_IDENTIFIER (ddcg_display_identifier_get_type()) G_DECLARE_FINAL_TYPE(DdcgDisplayIdentifier, ddcg_display_identifier, DDCG, DISPLAY_IDENTIFIER, GObject) #ifdef OLD typedef struct _DdcgDisplayIdentifier DdcgDisplayIdentifier; typedef struct _DdcgDisplayIdentifierClass DdcgDisplayIdentifierClass; #endif DdcgDisplayIdentifier * ddcg_display_identifier_new(void); DdcgDisplayIdentifier * ddcg_display_identifier_create_busno_identifier( gint32 busno, GError ** error); DdcgDisplayIdentifier* ddcg_display_identifier_create_adlno_identifier( gint32 adapter_index, gint32 display_index, gint32 busno, GError ** error); DdcgDisplayIdentifier* ddcg_display_identifier_create_mfg_model_sn_identifier( const gchar * mfg_id, const gchar * model, const gchar * sn, GError ** error); DdcgDisplayIdentifier* ddcg_display_identifier_create_usb_identifier( gint32 bus, gint32 device, GError ** error); DdcgDisplayIdentifier * ddcg_display_identifier_create_dispno_identifier( gint32 dispno, GError ** error); gchar * ddcg_display_identifier_repr( DdcgDisplayIdentifier * ddcg_did, GError** error); void ddcg_display_identifier_report( DdcgDisplayIdentifier * ddcg_did, int depth); DDCA_Display_Identifier _ddcg_display_identifier_get_ddct_object( DdcgDisplayIdentifier * ddcg_did); G_END_DECLS #ifdef NO_SUBCLASS typedef struct _DdcgBusnoDisplayIdentifier DdcgBusnoDisplayIdentifier; typedef struct _DdcgBusnoDisplayIdentifierClass DdcgBusnoDisplayIdentifierClass; struct _DdcgDisplayIdentifierClass { GObjectClass parent_class; /* private */ gpointer padding[10]; }; #ifdef DEFINED_BY_G_DECLARE_DERIVABLE_TYPE struct _DdcgDisplayIdentifier { GObject parent_instance; }; #endif struct _DdcgBusnoDisplayIdentifierClass { DdcgDisplayIdentifierClass parent_class; }; struct _DdcgBusnoDisplayIdentifier { DdcgDisplayIdentifier parent_instance; gchar busno; }; #endif #ifdef OLD #define DDCG_TYPE_DISPLAY_IDENTIFIER (ddcg_display_identifier_get_type()) #define DDCG_DISPLAY_IDENTIFIER(o) \ (G_TYPE_CHECK_INSTANCE_CAST ((o), DDCG_TYPE_DISPLAY_IDENTIFIER, DdcgDisplayIdentifier)) #define DDCG_DISPLAY_IDENTIFIER_CLASS(k) \ (G_TYPE_CHECK_CLASS_CAST((k), DDCG_TYPE_DISPLAY_IDENTIFIER, DdcgDisplayIdentifierClass)) #define DDCG_IS_DISPLAY_IDENTIFIER(o) \ (G_TYPE_CHECK_INSTANCE_TYPE ((o), DDCG_TYPE_DISPLAY_IDENTIFIER)) #define DDCG_IS_DISPLAY_IDENTIFIER_CLASS(k) \ (G_TYPE_CHECK_CLASS_TYPE ((k), DDCG_TYPE_DISPLAY_IDENTIFIER)) #define DDCG_DISPLAY_IDENTIFIER_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS ((o), DDCG_TYPE_DISPLAY_IDENTIFIER, DdcgDisplayIdentifierClass)) #define DDCG_DISPLAY_IDENTIFIER_ERROR (ddcg_display_identifier_quark ()) #define DDCG_DISPLAY_IDENTIFIER_TYPE_ERROR (ddcg_display_identifier_get_type ()) #endif #ifdef NO_SUBCLASS #define DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER (ddcg_busno_display_identifier_get_type()) #define DDCG_BUSNO_DISPLAY_IDENTIFIER(o) \ (G_TYPE_CHECK_INSTANCE_CAST ((o), DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER, DdcgDisplayIdentifier)) #define DDCG_BUSNO_DISPLAY_IDENTIFIER_CLASS(k) \ (G_TYPE_CHECK_CLASS_CAST((k), DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER, DdcgDisplayIdentifierClass)) #define DDCG_IS_BUSNO_DISPLAY_IDENTIFIER(o) \ (G_TYPE_CHECK_INSTANCE_TYPE ((o), DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER)) #define DDCG_IS_BUSNO_DISPLAY_IDENTIFIER_CLASS(k) \ (G_TYPE_CHECK_CLASS_TYPE ((k), DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER)) #define DDCG_BUSNO_DISPLAY_IDENTIFIER_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS ((o), DDCG_TYPE_BUSNO_DISPLAY_IDENTIFIER, DdcgDisplayIdentifierClass)) #define DDCG_BUSNO_DISPLAY_IDENTIFIER_ERROR (ddcg_busno_display_identifier_quark ()) #define DDCG_BUSNO_DISPLAY_IDENTIFIER_TYPE_ERROR (ddcg_busno_display_identifier_get_type ()) #endif #endif /* DDCG_DISPLAY_IDENTIFIER_H_ */ ddcutil-0.8.6/src/gobject_api/pyobj_hello.py0000644000175000001440000000027213230445447016016 00000000000000import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk window = Gtk.Window(title="Hello World") window.show() window.connect("delete-event", Gtk.main_quit) Gtk.main() ddcutil-0.8.6/src/gobject_api/ddcg_context.h0000644000175000001440000001053113230445447015753 00000000000000/* ddcgt_gocontext.h * * * Copyright (C) 2014-2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCGT_CONTEXT_H_ #define DDCGT_CONTEXT_H_ #include #include // #include #include "public/ddcutil_types.h" #include "public/ddcutil_c_api.h" #include "ddcg_display_identifier.h" #include "ddcg_display_ref.h" #include "ddcg_structs.h" #include "ddcg_types.h" // Build Information DdcgDdcutilVersionSpec * ddcg_get_ddcutil_version_spec(void); gint * ddcg_get_ddcutil_version_spec4(void); const gchar * ddcg_get_ddcutil_version_string(void); /** * DDCG_BUILD_OPTIONS_ADL3: * Built with ADL support. */ #define DDCG_BUILD_OPTIONS_ADL3 1 // cannot use DDCA_BUILT_WITH_USB as a value for the define. must be actual number /** * DDCG_BUILT_WITH_USB3: (value 2) * Built with USB support. */ #define DDCG_BUILT_WITH_USB3 2 const guint8 ddcg_get_build_options(void); typedef enum { DDCG_BUILD_OPTIONS_ADL2 = DDCA_BUILT_WITH_ADL, DDCG_BUILD_OPTIONS_USB2 = DDCA_BUILT_WITH_USB, DDCG_BUILT_OPTIONS_FAILSIM2 = DDCA_BUILT_WITH_FAILSIM, } DdcgBuildOptions; #ifdef TO_SOURCE GEnumClass * build_flags_class; GEnumValue * build_flags_value; build_flags_class = g_type_class_ref(DDCA_Build_Option_Flags); build_flags_value = g_enum_get_value(build_flags_class, DDCA_BUILD_FLAGS_USB); #endif // Status Codes const gchar * ddcg_rc_name(DdcgStatusCode status_code); const gchar * ddcg_rc_desc(DdcgStatusCode status_code); G_BEGIN_DECLS #ifdef REPLACED_BY_G_DECLARE_FINAL_TYPE typedef struct _DdcgContext DdcgContext; typedef struct _DdcgContextClass DdcgContextClass; struct _DdcgContextClass { GObjectClass parent_class; bool class_initialized; }; #endif #ifdef NO struct _DdcgContext { GObject parent_instance; }; #endif #define DDCG_TYPE_CONTEXT (ddcg_context_get_type()) G_DECLARE_FINAL_TYPE(DdcgContext, ddcg_context, DDCG, CONTEXT, GObject) // Not needed. Generated by G_DECLARE_FINAL_TYPE /* #define DDCG_CONTEXT(o) \ (G_TYPE_CHECK_INSTANCE_CAST ((o), DDCG_TYPE_CONTEXT, DdcgContext)) #define DDCG_CONTEXT_CLASS(k) \ (G_TYPE_CHECK_CLASS_CAST((k), DDCG_TYPE_CONTEXT, DdcgContextClass)) #define DDCG_IS_CONTEXT(o) \ (G_TYPE_CHECK_INSTANCE_TYPE ((o), DDCG_TYPE_CONTEXT)) #define DDCG_IS_CONTEXT_CLASS(k) \ (G_TYPE_CHECK_CLASS_TYPE ((k), DDCG_TYPE_CONTEXT)) #define DDCG_CONTEXT_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS ((o), DDCG_TYPE_CONTEXT, DdcgContextClass)) */ #define DDCG_CONTEXT_ERROR (ddcg_context_quark ()) #define DDCG_CONTEXT_TYPE_ERROR (ddcg_context_get_type ()) DdcgContext * ddcg_context_new(void); gint32 ddcg_context_get_max_max_tries( DdcgContext * ddcg_context); // GError ** error); gint32 ddcg_context_get_max_tries( DdcgContext * ddcg_context, DdcgRetryType retry_type); void ddcg_context_set_max_tries( DdcgContext * ddcg_context, DdcgRetryType retry_type, gint32 max_tries, GError ** error); DdcgDisplayRef * ddcg_context_create_display_ref( DdcgDisplayIdentifier * ddcg_did, GError ** error); #ifdef REF /** * Returns the ddcutil version as a struct of 3 8 bit integers. * * @return version numbers */ DDCA_Ddcutil_Version_Spec ddca_ddcutil_version(void); // ddcutil version /** * Returns the ddcutil version as a string in the form "major.minor.micro". * * @return version string. */ const char * ddca_ddcutil_version_string(); #endif G_END_DECLS #endif /* DDCGT_CONTEXT_H_ */ ddcutil-0.8.6/src/gobject_api/ddcg_display_handle.h0000644000175000001440000000412013230445447017244 00000000000000/* ddg_display_handle.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef _DDCG_DISPLAY_HANDLE_H_ #define _DDCG_DISPLAY_HANDLE_H_ #include // #include // make eclipse happy #include "gobject_api/ddcg_types.h" G_BEGIN_DECLS #define DDCG_TYPE_DISPLAY_HANDLE (ddcg_display_handle_get_type()) G_DECLARE_FINAL_TYPE(DdcgDisplayHandle, ddcg_display_handle, DDCG, DISPLAY_HANDLE, GObject) #define DDCG_DISPLAY_HANDLE_ERROR ( ddcg_display_handle_quark() ) #define DDCG_DISPLAY_HANDLE_TYPE_ERROR ( ddcg_display_handle_get_type() ) DdcgDisplayHandle * ddcg_display_handle_new(void); DdcgStatusCode ddcg_display_handle_open0( DdcgDisplayRef * ddcg_dref, DdcgDisplayHandle ** pddcg_dh); DdcgDisplayHandle * ddcg_display_handle_open( DdcgDisplayRef * ddcg_dref, GError ** error); DdcgStatusCode ddcg_display_handle_close(DdcgDisplayHandle * ddcg_dh); DdcgContResponse * ddcg_display_handle_get_nontable_vcp_value( DdcgDisplayHandle * ddcg_dh, DdcgFeatureCode feature_code, GError ** error); gchar * ddcg_display_handle_repr( DdcgDisplayHandle * ddcg_dh, GError ** error); G_END_DECLS #endif /* _DDCG_DISPLAY_HANDLE_H_ */ ddcutil-0.8.6/src/gobject_api/ddcg_gobjects.h0000644000175000001440000000261013230445447016066 00000000000000/* ddcg_gobjects.h * * * Copyright (C) 2016 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCG_GOBJECTS_H_ #define DDCG_GOBJECTS_H_ // #include // Hack for eclipse not picked up pkg-config location from autotools // explicit location for Ubuntu #include #include "gobject_api/ddcg_types.h" #include "gobject_api/ddcg_context.h" #include "gobject_api/ddcg_cont_response.h" #include "gobject_api/ddcg_display_identifier.h" #include "gobject_api/ddcg_display_ref.h" #include "gobject_api/ddcg_display_handle.h" #endif /* DDCG_GOBJECTS_H_ */ ddcutil-0.8.6/src/gobject_api/ddcg_structs.h0000644000175000001440000000404313230445447015777 00000000000000/* ddcg_structs.h * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCG_STRUCTS_H_ #define DDCG_STRUCTS_H_ #include #include #include "ddcg_types.h" // // Build Information // // /** ddcutil version */ typedef struct _DdcgDdcutilVersionSpec { GObject parent_instance; uint8_t major; uint8_t minor; uint8_t micro; } DdcgDdcutilVersionSpec; // DDCA_Ddcutil_Version_Spec; typedef struct { uint8_t v[3]; } DdcgDdcutilVersionSpec2; // /** // * DDCA_Ddcutil_Version_Spec: (rename-to DdcgDdcutilVersionSpec); // * // */ // typedef DDCA_Ddcutil_Version_Spec DdcgDdcutilVersionSpec; G_BEGIN_DECLS #define DDCG_TYPE_DDCUTIL_VERSION_SPEC (ddcg_ddcutil_version_spec_get_type()) G_DECLARE_FINAL_TYPE(DdcgDdcutilVersionSpec, ddcg_ddcutil_version_spec, DDCG, DDCUTIL_VERSION_SPEC, GObject) // struct _DdcgDdcutilVersionSpecClass { // GObjectClass parent_class; // }; #define DDCG_DDCUTIL_VERSION_SPEC_ERROR (ddcg_ddcutil_version_spec_quark ()) #define DDCG_DDCUTIL_VERSION_SPEC_TYPE_ERROR (ddcg_ddcutil_version_spec_get_type ()) DdcgDdcutilVersionSpec * ddcg_ddcutil_version_spec_new(void); G_END_DECLS #endif /* DDCG_STRUCTS_H_ */ ddcutil-0.8.6/src/gobject_api/ddcg_types.h0000644000175000001440000000350313230445447015434 00000000000000/* ddcg_types.h * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDCG_TYPES_H_ #define DDCG_TYPES_H_ #include // glib-2.0 to avoid bogus eclipse error #include "public/ddcutil_types.h" typedef gint32 DdcgStatusCode; typedef guint8 DdcgFeatureCode; #ifdef REF /** I2C timeout types */ typedef enum{ DDCA_TIMEOUT_STANDARD, /**< Normal retry interval */ DDCA_TIMEOUT_TABLE_RETRY /**< Special timeout for Table reads and writes */ } DDCA_Timeout_Type; /** I2C retry limit types */ typedef enum{ DDCA_WRITE_ONLY_TRIES, /**< Maximum write-only operation tries */ DDCA_WRITE_READ_TRIES, /**< Maximum read-write operation tries */ DDCA_MULTI_PART_TRIES /**< Maximum multi-part operation tries */ } DDCA_Retry_Type; #endif typedef enum { DDCG_WRITE_ONLY_TRIES = DDCA_WRITE_ONLY_TRIES, DDCG_WRITE_READ_TRIES = DDCA_WRITE_READ_TRIES, DDCG_MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES } DdcgRetryType; #endif /* DDCG_TYPES_H_ */ ddcutil-0.8.6/src/swig/0000755000175000001440000000000013230445447011720 500000000000000ddcutil-0.8.6/src/swig/Makefile.am0000644000175000001440000001744013042715053013674 00000000000000# Adapted from code by tschoonj generated_source_files = \ ddc_swig_wrap.c \ ddc_swig_py # ddc_swig.pyc \ # ddc_swig.pyo CLEANFILES = ${generated_source_files} EXTRA_DIST = ddc_swig.i # deleting files from distribution fails if done here # needs to be done from src/Makefile.am - why? dist-hook: @echo "(src/swig/Makefile) dist-hook. distdir=$(distdir) top_distdir=$(top_distdir)" # For some reason, if ddc_swig.py is in CLEANFILES, it is not deleted. # Just do the work in clean-local clean-local: @echo "(src/swig/clean-local)" @echo " CLEANFILES = |$(CLEANFILES)|" rm -f ddc_swig_wrap.c ddc_swig.py *.pyc *.pyo ddc_swig3_wrap.c ddc_swig3.py if ENABLE_PYTHON_SWIG # Python extension modules, installed in $(py2execdir) or $(py3execdir) py2exec_LTLIBRARIES = _ddc_swig.la py3exec_LTLIBRARIES = _ddc_swig3.la # Corresponding extension module Python files # Files in PYTHON primary are byte-compiled into .pyc and .pyo at install time. # Uses pyexec_ prefix so it will be installed in same site-packages exec directory as the extension module nodist_py2exec_PYTHON = ddc_swig.py nodist_py3exec_PYTHON = ddc_swig3.py # Flags when compiling files in _ddc_swig_la_SOURCES _ddc_swig_la_CFLAGS = $(PYTHON_CFLAGS) # _ddc_swig_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PYTHON_CPPFLAGS) _ddc_swig_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PY2_CFLAGS) _ddc_swig_la_SOURCES = ddc_swig.c # Link in the core library # Any reason to just refer to libddcutil.so instead? # By statically linking we can control the symbols visible. # But the only usefully visible symbols are those used by SWIG _ddc_swig_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la # The source code for the extension module, nodist because this file will be generated by swig nodist__ddc_swig_la_SOURCES = ddc_swig_wrap.c nodist__ddc_swig_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PY2_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info # _ddc_swig_la_LDFLAGS = _ddc_swig_la_LDFLAGS += -module -shared -export-dynamic -static # should we use --avoid-version instead? all examples seem to _ddc_swig_la_LDFLAGS += -version-info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' _ddc_swig_la_LIBADD += $(PY2_EXTRA_LIBS) # # Python 3 version # # Flags when compiling files in _ddc_swig3_la_SOURCES # _ddc_swig3_la_CFLAGS = $(PYTHON3_CFLAGS) # _ddc_swig3_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PYTHON3_CPPFLAGS) _ddc_swig3_la_CFLAGS = -DPYTHON3 _ddc_swig3_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PY3_CFLAGS) _ddc_swig3_la_SOURCES = ddc_swig.c # Link in the core library # Any reason to just refer to libddcutil.so instead? # By statically linking we can control the symbols visible. # But the only usefully visible symbols are those used by SWIG _ddc_swig3_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la # The source code for the extension module, nodist because this file will be generated by swig nodist__ddc_swig3_la_SOURCES = ddc_swig3_wrap.c # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info # _ddc_swig3_la_LDFLAGS = _ddc_swig3_la_LDFLAGS += -module -shared -export-dynamic -static # should we use --avoid-version instead? all examples seem to _ddc_swig_la_LDFLAGS += -version-info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' all-local: @echo "==> (src/swig/Makefile) Executing target all-local...." chmod a+x pylocal if [ -e _ddc_swig.so ]; then \ echo "Link to _ddc_swig.so already exists";\ else \ ln -s .libs/_ddc_swig.so _ddc_swig.so ; \ fi; if [ -e _ddc_swig3.so ]; then \ echo "Link to _ddc_swig3.so already exists";\ else \ ln -s .libs/_ddc_swig3.so _ddc_swig3.so ; \ fi; if HAVE_PYTHON3 install-exec-python3: @echo " install-exec-python3 - HAVE_PYTHON3 version" else install-exec-python3: @echo " install-exec-python3 - no PYTHON3 version" endif install-exec-local: @echo "===> (src/swig/Makefile) Executing.target install-exec-local....." install-exec-hook: install-exec-python3 @echo "==> (src/swig/Makefile) Executing.target install-exec-hook....." @echo " py2execdir = ${py2execdir}" @echo " py3execdir = ${py3execdir}" # # Run swig # For debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" # old vars: # @echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars # hack, how to look up compile include directory? BUT NO LONGER NEEDED # swig_incs=-I/usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/include # add show_vars to dependencies for debugging ddc_swig_wrap.c: ddc_swig.i ddc_swig.c ddc_swig.h @echo "===> (src/swig/Makefile) Executing target ddc_swig_wrap.c" $(SWIG) -I${top_srcdir}/src -I$(top_srcdir)/src/public -includeall -o ddc_swig_wrap.c -python ddc_swig.i ddc_swig.py: ddc_swig_wrap.c @echo "===> (src/swig/Makefile) Executing target ddc_swig.py" ddc_swig3_wrap.c: ddc_swig.i ddc_swig.c ddc_swig.h @echo "===> (src/swig/Makefile) Executing target ddc_swig3_wrap.c" $(SWIG) -I${top_srcdir}/src -DPYTHON3 -I$(top_srcdir)/src/public -includeall -o ddc_swig3_wrap.c -python ddc_swig.i ddc_swig3.py: ddc_swig3_wrap.c @echo "==> (src/swig/Makefile) Executing target ddc_swig3.py" endif ddcutil-0.8.6/src/swig/Makefile.in0000644000175000001440000013250413230171237013703 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Adapted from code by tschoonj 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@ subdir = src/swig ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = pylocal set_pylocal_exec CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(py2execdir)" "$(DESTDIR)$(py3execdir)" \ "$(DESTDIR)$(py2execdir)" "$(DESTDIR)$(py3execdir)" LTLIBRARIES = $(py2exec_LTLIBRARIES) $(py3exec_LTLIBRARIES) am__DEPENDENCIES_1 = @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig_la_DEPENDENCIES = ../libcommon.la \ @ENABLE_PYTHON_SWIG_TRUE@ ../libddcutil.la \ @ENABLE_PYTHON_SWIG_TRUE@ $(am__DEPENDENCIES_1) am___ddc_swig_la_SOURCES_DIST = ddc_swig.c @ENABLE_PYTHON_SWIG_TRUE@am__ddc_swig_la_OBJECTS = \ @ENABLE_PYTHON_SWIG_TRUE@ _ddc_swig_la-ddc_swig.lo @ENABLE_PYTHON_SWIG_TRUE@nodist__ddc_swig_la_OBJECTS = \ @ENABLE_PYTHON_SWIG_TRUE@ _ddc_swig_la-ddc_swig_wrap.lo _ddc_swig_la_OBJECTS = $(am__ddc_swig_la_OBJECTS) \ $(nodist__ddc_swig_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 = _ddc_swig_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_ddc_swig_la_CFLAGS) \ $(CFLAGS) $(_ddc_swig_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_PYTHON_SWIG_TRUE@am__ddc_swig_la_rpath = -rpath $(py2execdir) @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig3_la_DEPENDENCIES = ../libcommon.la \ @ENABLE_PYTHON_SWIG_TRUE@ ../libddcutil.la am___ddc_swig3_la_SOURCES_DIST = ddc_swig.c @ENABLE_PYTHON_SWIG_TRUE@am__ddc_swig3_la_OBJECTS = \ @ENABLE_PYTHON_SWIG_TRUE@ _ddc_swig3_la-ddc_swig.lo @ENABLE_PYTHON_SWIG_TRUE@nodist__ddc_swig3_la_OBJECTS = \ @ENABLE_PYTHON_SWIG_TRUE@ _ddc_swig3_la-ddc_swig3_wrap.lo _ddc_swig3_la_OBJECTS = $(am__ddc_swig3_la_OBJECTS) \ $(nodist__ddc_swig3_la_OBJECTS) _ddc_swig3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_ddc_swig3_la_CFLAGS) \ $(CFLAGS) $(_ddc_swig3_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_PYTHON_SWIG_TRUE@am__ddc_swig3_la_rpath = -rpath $(py3execdir) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(_ddc_swig_la_SOURCES) $(nodist__ddc_swig_la_SOURCES) \ $(_ddc_swig3_la_SOURCES) $(nodist__ddc_swig3_la_SOURCES) DIST_SOURCES = $(am___ddc_swig_la_SOURCES_DIST) \ $(am___ddc_swig3_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) am__pep3147_tweak = \ sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' py_compile = $(top_srcdir)/config/py-compile am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/pylocal.in \ $(srcdir)/set_pylocal_exec.in $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/py-compile DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ generated_source_files = \ ddc_swig_wrap.c \ ddc_swig_py # ddc_swig.pyc \ # ddc_swig.pyo CLEANFILES = ${generated_source_files} EXTRA_DIST = ddc_swig.i # Python extension modules, installed in $(py2execdir) or $(py3execdir) @ENABLE_PYTHON_SWIG_TRUE@py2exec_LTLIBRARIES = _ddc_swig.la @ENABLE_PYTHON_SWIG_TRUE@py3exec_LTLIBRARIES = _ddc_swig3.la # Corresponding extension module Python files # Files in PYTHON primary are byte-compiled into .pyc and .pyo at install time. # Uses pyexec_ prefix so it will be installed in same site-packages exec directory as the extension module @ENABLE_PYTHON_SWIG_TRUE@nodist_py2exec_PYTHON = ddc_swig.py @ENABLE_PYTHON_SWIG_TRUE@nodist_py3exec_PYTHON = ddc_swig3.py # Flags when compiling files in _ddc_swig_la_SOURCES @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig_la_CFLAGS = $(PYTHON_CFLAGS) # _ddc_swig_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PYTHON_CPPFLAGS) @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PY2_CFLAGS) @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig_la_SOURCES = ddc_swig.c # Link in the core library # Any reason to just refer to libddcutil.so instead? # By statically linking we can control the symbols visible. # But the only usefully visible symbols are those used by SWIG @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig_la_LIBADD = ../libcommon.la \ @ENABLE_PYTHON_SWIG_TRUE@ ../libddcutil.la $(PY2_EXTRA_LIBS) # The source code for the extension module, nodist because this file will be generated by swig @ENABLE_PYTHON_SWIG_TRUE@nodist__ddc_swig_la_SOURCES = ddc_swig_wrap.c @ENABLE_PYTHON_SWIG_TRUE@nodist__ddc_swig_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PY2_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info # # should we use --avoid-version instead? all examples seem to # should we use --avoid-version instead? all examples seem to @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig_la_LDFLAGS = -module -shared \ @ENABLE_PYTHON_SWIG_TRUE@ -export-dynamic -static -version-info \ @ENABLE_PYTHON_SWIG_TRUE@ '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' \ @ENABLE_PYTHON_SWIG_TRUE@ -version-info \ @ENABLE_PYTHON_SWIG_TRUE@ '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # # Python 3 version # # Flags when compiling files in _ddc_swig3_la_SOURCES # _ddc_swig3_la_CFLAGS = $(PYTHON3_CFLAGS) # _ddc_swig3_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PYTHON3_CPPFLAGS) @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig3_la_CFLAGS = -DPYTHON3 @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig3_la_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/public $(PY3_CFLAGS) @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig3_la_SOURCES = ddc_swig.c # Link in the core library # Any reason to just refer to libddcutil.so instead? # By statically linking we can control the symbols visible. # But the only usefully visible symbols are those used by SWIG @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig3_la_LIBADD = \ @ENABLE_PYTHON_SWIG_TRUE@ ../libcommon.la \ @ENABLE_PYTHON_SWIG_TRUE@ ../libddcutil.la # The source code for the extension module, nodist because this file will be generated by swig @ENABLE_PYTHON_SWIG_TRUE@nodist__ddc_swig3_la_SOURCES = ddc_swig3_wrap.c # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info # @ENABLE_PYTHON_SWIG_TRUE@_ddc_swig3_la_LDFLAGS = -module -shared \ @ENABLE_PYTHON_SWIG_TRUE@ -export-dynamic -static all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/swig/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/swig/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): pylocal: $(top_builddir)/config.status $(srcdir)/pylocal.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ set_pylocal_exec: $(top_builddir)/config.status $(srcdir)/set_pylocal_exec.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-py2execLTLIBRARIES: $(py2exec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(py2exec_LTLIBRARIES)'; test -n "$(py2execdir)" || 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)$(py2execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py2execdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(py2execdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(py2execdir)"; \ } uninstall-py2execLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(py2exec_LTLIBRARIES)'; test -n "$(py2execdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(py2execdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(py2execdir)/$$f"; \ done clean-py2execLTLIBRARIES: -test -z "$(py2exec_LTLIBRARIES)" || rm -f $(py2exec_LTLIBRARIES) @list='$(py2exec_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-py3execLTLIBRARIES: $(py3exec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || 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)$(py3execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py3execdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(py3execdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(py3execdir)"; \ } uninstall-py3execLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(py3execdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(py3execdir)/$$f"; \ done clean-py3execLTLIBRARIES: -test -z "$(py3exec_LTLIBRARIES)" || rm -f $(py3exec_LTLIBRARIES) @list='$(py3exec_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}; \ } _ddc_swig.la: $(_ddc_swig_la_OBJECTS) $(_ddc_swig_la_DEPENDENCIES) $(EXTRA__ddc_swig_la_DEPENDENCIES) $(AM_V_CCLD)$(_ddc_swig_la_LINK) $(am__ddc_swig_la_rpath) $(_ddc_swig_la_OBJECTS) $(_ddc_swig_la_LIBADD) $(LIBS) _ddc_swig3.la: $(_ddc_swig3_la_OBJECTS) $(_ddc_swig3_la_DEPENDENCIES) $(EXTRA__ddc_swig3_la_DEPENDENCIES) $(AM_V_CCLD)$(_ddc_swig3_la_LINK) $(am__ddc_swig3_la_rpath) $(_ddc_swig3_la_OBJECTS) $(_ddc_swig3_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_ddc_swig3_la-ddc_swig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_ddc_swig3_la-ddc_swig3_wrap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_ddc_swig_la-ddc_swig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_ddc_swig_la-ddc_swig_wrap.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< _ddc_swig_la-ddc_swig.lo: ddc_swig.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_ddc_swig_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig_la_CFLAGS) $(CFLAGS) -MT _ddc_swig_la-ddc_swig.lo -MD -MP -MF $(DEPDIR)/_ddc_swig_la-ddc_swig.Tpo -c -o _ddc_swig_la-ddc_swig.lo `test -f 'ddc_swig.c' || echo '$(srcdir)/'`ddc_swig.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_ddc_swig_la-ddc_swig.Tpo $(DEPDIR)/_ddc_swig_la-ddc_swig.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ddc_swig.c' object='_ddc_swig_la-ddc_swig.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) $(_ddc_swig_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig_la_CFLAGS) $(CFLAGS) -c -o _ddc_swig_la-ddc_swig.lo `test -f 'ddc_swig.c' || echo '$(srcdir)/'`ddc_swig.c _ddc_swig_la-ddc_swig_wrap.lo: ddc_swig_wrap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_ddc_swig_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig_la_CFLAGS) $(CFLAGS) -MT _ddc_swig_la-ddc_swig_wrap.lo -MD -MP -MF $(DEPDIR)/_ddc_swig_la-ddc_swig_wrap.Tpo -c -o _ddc_swig_la-ddc_swig_wrap.lo `test -f 'ddc_swig_wrap.c' || echo '$(srcdir)/'`ddc_swig_wrap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_ddc_swig_la-ddc_swig_wrap.Tpo $(DEPDIR)/_ddc_swig_la-ddc_swig_wrap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ddc_swig_wrap.c' object='_ddc_swig_la-ddc_swig_wrap.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) $(_ddc_swig_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig_la_CFLAGS) $(CFLAGS) -c -o _ddc_swig_la-ddc_swig_wrap.lo `test -f 'ddc_swig_wrap.c' || echo '$(srcdir)/'`ddc_swig_wrap.c _ddc_swig3_la-ddc_swig.lo: ddc_swig.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_ddc_swig3_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig3_la_CFLAGS) $(CFLAGS) -MT _ddc_swig3_la-ddc_swig.lo -MD -MP -MF $(DEPDIR)/_ddc_swig3_la-ddc_swig.Tpo -c -o _ddc_swig3_la-ddc_swig.lo `test -f 'ddc_swig.c' || echo '$(srcdir)/'`ddc_swig.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_ddc_swig3_la-ddc_swig.Tpo $(DEPDIR)/_ddc_swig3_la-ddc_swig.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ddc_swig.c' object='_ddc_swig3_la-ddc_swig.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) $(_ddc_swig3_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig3_la_CFLAGS) $(CFLAGS) -c -o _ddc_swig3_la-ddc_swig.lo `test -f 'ddc_swig.c' || echo '$(srcdir)/'`ddc_swig.c _ddc_swig3_la-ddc_swig3_wrap.lo: ddc_swig3_wrap.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_ddc_swig3_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig3_la_CFLAGS) $(CFLAGS) -MT _ddc_swig3_la-ddc_swig3_wrap.lo -MD -MP -MF $(DEPDIR)/_ddc_swig3_la-ddc_swig3_wrap.Tpo -c -o _ddc_swig3_la-ddc_swig3_wrap.lo `test -f 'ddc_swig3_wrap.c' || echo '$(srcdir)/'`ddc_swig3_wrap.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_ddc_swig3_la-ddc_swig3_wrap.Tpo $(DEPDIR)/_ddc_swig3_la-ddc_swig3_wrap.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ddc_swig3_wrap.c' object='_ddc_swig3_la-ddc_swig3_wrap.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) $(_ddc_swig3_la_CPPFLAGS) $(CPPFLAGS) $(_ddc_swig3_la_CFLAGS) $(CFLAGS) -c -o _ddc_swig3_la-ddc_swig3_wrap.lo `test -f 'ddc_swig3_wrap.c' || echo '$(srcdir)/'`ddc_swig3_wrap.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nodist_py2execPYTHON: $(nodist_py2exec_PYTHON) @$(NORMAL_INSTALL) @list='$(nodist_py2exec_PYTHON)'; dlist=; list2=; test -n "$(py2execdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(py2execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py2execdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ if test -f $$b$$p; then \ $(am__strip_dir) \ dlist="$$dlist $$f"; \ list2="$$list2 $$b$$p"; \ else :; fi; \ done; \ for file in $$list2; do echo $$file; done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(py2execdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(py2execdir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ $(am__py_compile) --destdir "$(DESTDIR)" \ --basedir "$(py2execdir)" $$dlist; \ else :; fi uninstall-nodist_py2execPYTHON: @$(NORMAL_UNINSTALL) @list='$(nodist_py2exec_PYTHON)'; test -n "$(py2execdir)" || list=; \ py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(py2execdir)'; \ pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ echo "$$py_files_pep3147";\ pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ st=0; \ for files in \ "$$py_files" \ "$$pyc_files" \ "$$pyo_files" \ "$$pyc_files_pep3147" \ "$$pyo_files_pep3147" \ ; do \ $(am__uninstall_files_from_dir) || st=$$?; \ done; \ exit $$st install-nodist_py3execPYTHON: $(nodist_py3exec_PYTHON) @$(NORMAL_INSTALL) @list='$(nodist_py3exec_PYTHON)'; dlist=; list2=; test -n "$(py3execdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(py3execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py3execdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ if test -f $$b$$p; then \ $(am__strip_dir) \ dlist="$$dlist $$f"; \ list2="$$list2 $$b$$p"; \ else :; fi; \ done; \ for file in $$list2; do echo $$file; done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(py3execdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(py3execdir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ $(am__py_compile) --destdir "$(DESTDIR)" \ --basedir "$(py3execdir)" $$dlist; \ else :; fi uninstall-nodist_py3execPYTHON: @$(NORMAL_UNINSTALL) @list='$(nodist_py3exec_PYTHON)'; test -n "$(py3execdir)" || list=; \ py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$py_files" || exit 0; \ dir='$(DESTDIR)$(py3execdir)'; \ pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \ pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \ py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \ echo "$$py_files_pep3147";\ pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \ pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \ st=0; \ for files in \ "$$py_files" \ "$$pyc_files" \ "$$pyo_files" \ "$$pyc_files_pep3147" \ "$$pyo_files_pep3147" \ ; do \ $(am__uninstall_files_from_dir) || st=$$?; \ done; \ exit $$st ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am check: check-am @ENABLE_PYTHON_SWIG_FALSE@all-local: all-am: Makefile $(LTLIBRARIES) all-local installdirs: for dir in "$(DESTDIR)$(py2execdir)" "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(py2execdir)" "$(DESTDIR)$(py3execdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @ENABLE_PYTHON_SWIG_FALSE@install-exec-local: @ENABLE_PYTHON_SWIG_FALSE@install-exec-hook: clean: clean-am clean-am: clean-generic clean-libtool clean-local \ clean-py2execLTLIBRARIES clean-py3execLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-exec-local install-nodist_py2execPYTHON \ install-nodist_py3execPYTHON install-py2execLTLIBRARIES \ install-py3execLTLIBRARIES @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nodist_py2execPYTHON \ uninstall-nodist_py3execPYTHON uninstall-py2execLTLIBRARIES \ uninstall-py3execLTLIBRARIES .MAKE: install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \ clean-generic clean-libtool clean-local \ clean-py2execLTLIBRARIES clean-py3execLTLIBRARIES \ cscopelist-am ctags ctags-am dist-hook distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-exec-hook \ install-exec-local install-html install-html-am install-info \ install-info-am install-man install-nodist_py2execPYTHON \ install-nodist_py3execPYTHON install-pdf install-pdf-am \ install-ps install-ps-am install-py2execLTLIBRARIES \ install-py3execLTLIBRARIES install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-nodist_py2execPYTHON uninstall-nodist_py3execPYTHON \ uninstall-py2execLTLIBRARIES uninstall-py3execLTLIBRARIES .PRECIOUS: Makefile # deleting files from distribution fails if done here # needs to be done from src/Makefile.am - why? dist-hook: @echo "(src/swig/Makefile) dist-hook. distdir=$(distdir) top_distdir=$(top_distdir)" # For some reason, if ddc_swig.py is in CLEANFILES, it is not deleted. # Just do the work in clean-local clean-local: @echo "(src/swig/clean-local)" @echo " CLEANFILES = |$(CLEANFILES)|" rm -f ddc_swig_wrap.c ddc_swig.py *.pyc *.pyo ddc_swig3_wrap.c ddc_swig3.py @ENABLE_PYTHON_SWIG_TRUE@all-local: @ENABLE_PYTHON_SWIG_TRUE@ @echo "==> (src/swig/Makefile) Executing target all-local...." @ENABLE_PYTHON_SWIG_TRUE@ chmod a+x pylocal @ENABLE_PYTHON_SWIG_TRUE@ if [ -e _ddc_swig.so ]; then \ @ENABLE_PYTHON_SWIG_TRUE@ echo "Link to _ddc_swig.so already exists";\ @ENABLE_PYTHON_SWIG_TRUE@ else \ @ENABLE_PYTHON_SWIG_TRUE@ ln -s .libs/_ddc_swig.so _ddc_swig.so ; \ @ENABLE_PYTHON_SWIG_TRUE@ fi; @ENABLE_PYTHON_SWIG_TRUE@ if [ -e _ddc_swig3.so ]; then \ @ENABLE_PYTHON_SWIG_TRUE@ echo "Link to _ddc_swig3.so already exists";\ @ENABLE_PYTHON_SWIG_TRUE@ else \ @ENABLE_PYTHON_SWIG_TRUE@ ln -s .libs/_ddc_swig3.so _ddc_swig3.so ; \ @ENABLE_PYTHON_SWIG_TRUE@ fi; @ENABLE_PYTHON_SWIG_TRUE@@HAVE_PYTHON3_TRUE@install-exec-python3: @ENABLE_PYTHON_SWIG_TRUE@@HAVE_PYTHON3_TRUE@ @echo " install-exec-python3 - HAVE_PYTHON3 version" @ENABLE_PYTHON_SWIG_TRUE@@HAVE_PYTHON3_FALSE@install-exec-python3: @ENABLE_PYTHON_SWIG_TRUE@@HAVE_PYTHON3_FALSE@ @echo " install-exec-python3 - no PYTHON3 version" @ENABLE_PYTHON_SWIG_TRUE@install-exec-local: @ENABLE_PYTHON_SWIG_TRUE@ @echo "===> (src/swig/Makefile) Executing.target install-exec-local....." @ENABLE_PYTHON_SWIG_TRUE@install-exec-hook: install-exec-python3 @ENABLE_PYTHON_SWIG_TRUE@ @echo "==> (src/swig/Makefile) Executing.target install-exec-hook....." @ENABLE_PYTHON_SWIG_TRUE@ @echo " py2execdir = ${py2execdir}" @ENABLE_PYTHON_SWIG_TRUE@ @echo " py3execdir = ${py3execdir}" # # Run swig # For debugging @ENABLE_PYTHON_SWIG_TRUE@show_vars: @ENABLE_PYTHON_SWIG_TRUE@ @echo " AM_CFLAGS = $(AM_CFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY2_LIBS = $(PY2_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY3_LIBS = $(PY3_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " SWIG = $(SWIG) " @ENABLE_PYTHON_SWIG_TRUE@ @echo " SWIG_LIB = $(SWIG_LIB)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " includedir = $(includedir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " prefix = $(prefix)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " pyexecdir = $(pyexecdir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " pythondir = $(pythondir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " py2execdir = $(py2execdir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " py3execdir = $(py3execdir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " python3dir = $(python3dir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " srcdir = $(srcdir)" @ENABLE_PYTHON_SWIG_TRUE@ @echo " top_srcdir = $(top_srcdir)" # old vars: # @echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" @ENABLE_PYTHON_SWIG_TRUE@.PHONY: show_vars # hack, how to look up compile include directory? BUT NO LONGER NEEDED # swig_incs=-I/usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/include # add show_vars to dependencies for debugging @ENABLE_PYTHON_SWIG_TRUE@ddc_swig_wrap.c: ddc_swig.i ddc_swig.c ddc_swig.h @ENABLE_PYTHON_SWIG_TRUE@ @echo "===> (src/swig/Makefile) Executing target ddc_swig_wrap.c" @ENABLE_PYTHON_SWIG_TRUE@ $(SWIG) -I${top_srcdir}/src -I$(top_srcdir)/src/public -includeall -o ddc_swig_wrap.c -python ddc_swig.i @ENABLE_PYTHON_SWIG_TRUE@ddc_swig.py: ddc_swig_wrap.c @ENABLE_PYTHON_SWIG_TRUE@ @echo "===> (src/swig/Makefile) Executing target ddc_swig.py" @ENABLE_PYTHON_SWIG_TRUE@ddc_swig3_wrap.c: ddc_swig.i ddc_swig.c ddc_swig.h @ENABLE_PYTHON_SWIG_TRUE@ @echo "===> (src/swig/Makefile) Executing target ddc_swig3_wrap.c" @ENABLE_PYTHON_SWIG_TRUE@ $(SWIG) -I${top_srcdir}/src -DPYTHON3 -I$(top_srcdir)/src/public -includeall -o ddc_swig3_wrap.c -python ddc_swig.i @ENABLE_PYTHON_SWIG_TRUE@ddc_swig3.py: ddc_swig3_wrap.c @ENABLE_PYTHON_SWIG_TRUE@ @echo "==> (src/swig/Makefile) Executing target ddc_swig3.py" # 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: ddcutil-0.8.6/src/swig/pylocal.in0000755000175000001440000000012213032550072013620 00000000000000#!/bin/sh exec_prefix="/usr/local" PYTHONPATH=@PYEXECDIR@:$PYTHONPATH python "$@" ddcutil-0.8.6/src/swig/set_pylocal_exec.in0000755000175000001440000000011613032550072015502 00000000000000#!/bin/sh exec_prefix="/usr/local" export PYTHONPATH=@PYEXECDIR@:$PYTHONPATH ddcutil-0.8.6/src/swig/ddc_swig.c0000664000175000001440000002433713224707675013611 00000000000000/* ddc_swig.c * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include // must be before stdio.h // #include #include #include #include "base/core.h" #include "base/ddc_errno.h" #include "swig/ddc_swig.h" // // Macros // #define ERROR_CHECK(impl) \ do { \ clear_exception(); \ DDCA_Status rc = impl; \ if (rc != 0) \ throw_exception_from_status_code(rc); \ } while(0); // // Convert ddcutil status codes to exceptions // static DDCA_Status ddcutil_error_status = 0; static char error_msg[256]; static PyObject * PyExc_DDCUtilError = NULL; void clear_exception() { ddcutil_error_status = 0; } static void throw_exception_from_status_code(DDCA_Status rc) { ddcutil_error_status = rc; snprintf(error_msg, sizeof(error_msg), "%s (%d): %s", ddca_rc_name(rc), rc, ddca_rc_desc(rc) ); } // Called from %exception handler in ddc_swig.i char * check_exception() { char * result = NULL; if (ddcutil_error_status) result = error_msg; return result; } bool check_exception2() { bool debug = true; bool result = false; if (ddcutil_error_status) { PyErr_SetString( PyExc_RuntimeError, error_msg); // PyErr_SetString( PyExc_DDCUtilError, emsg); // future DBGMSF(debug, "throwing exception\n"); result = true; } return result; } // // General // void ddcs_init(void) { // ddca_init(); PyExc_DDCUtilError = PyErr_NewException( "ddc_swig.PyExc_DDCUtilError", NULL, // PyObject* base NULL); // PyObject* dict assert(PyExc_DDCUtilError); } // // Build Options // const char * ddcs_ddcutil_version_string(void) { return ddca_ddcutil_version_string(); } #ifdef OLD bool ddcs_built_with_adl(void) { return ddca_built_with_adl(); } bool ddcs_built_with_usb(void) { return ddca_built_with_usb(); } #endif FlagsByte ddcs_get_build_options(void) { unsigned long feature_bits = ddca_build_options(); return feature_bits; } // // IO Redirection // #ifdef NO void ddcs_set_fout(void * fpy) { printf("(%s) fpy = %p\n", __func__, fpy); int is_pyfile = PyFile_Check(fpy); printf("(%s) is_pyfile=%d\n", __func__, is_pyfile); FILE * extracted = PyFile_AsFile((PyObject *)fpy); ddca_set_fout(extracted); } #endif #ifndef PYTHON3 void ddcs_set_fout(FILE * f) { // DBGMSG("f = %p", f); ddca_set_fout(f); } static PyFileObject * current_python_fout; void save_current_python_fout(PyFileObject * pfy) { DBGMSG("pfy = %p", pfy); current_python_fout = pfy; } PyFileObject * get_current_python_fout() { return current_python_fout; } #endif // // Reports // int ddcs_report_active_displays(int depth) { clear_exception(); return ddca_report_active_displays(depth); } // // VCP Feature Information // #ifdef TO_REIMPLEMENT Version_Feature_Flags ddcs_get_feature_info_by_vcp_version( DDCS_VCP_Feature_Code feature_code, DDCA_MCCS_Version_Id version_id) // DDCS_MCCS_Version_Spec vspec) { Version_Feature_Flags result = 0; ERROR_CHECK( ddca_get_feature_flags_by_vcp_version(feature_code, version_id, &result) ); return result; } #endif char * ddcs_get_feature_name(DDCS_VCP_Feature_Code feature_code) { return ddca_get_feature_name(feature_code); } // // Display Identifiers // DDCS_Display_Identifier ddcs_create_dispno_display_identifier(int dispno){ DDCA_Display_Identifier pdid = NULL; DDCA_Status rc = ddca_create_dispno_display_identifier(dispno, &pdid); clear_exception(); if (rc != 0) throw_exception_from_status_code(rc); return pdid; } DDCS_Display_Identifier ddcs_create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex) { DDCA_Display_Identifier pdid = NULL; ERROR_CHECK( ddca_create_adlno_display_identifier(iAdapterIndex, iDisplayIndex, &pdid) ); return pdid; } DDCS_Display_Identifier ddcs_create_busno_display_identifier(int busno) { DDCA_Display_Identifier pdid = NULL; ERROR_CHECK( ddca_create_busno_display_identifier(busno, &pdid) ); return pdid; } DDCS_Display_Identifier ddcs_create_mfg_model_sn_display_identifier(const char * mfg_id, const char * model, const char * sn) { DDCA_Display_Identifier pdid = NULL; DBGMSG("mfg_id=%s, model=%s, sn=%s", model, sn); ERROR_CHECK( ddca_create_mfg_model_sn_display_identifier(mfg_id, model, sn, &pdid) ); return pdid; } DDCS_Display_Identifier ddcs_create_edid_display_identifier(const Byte * edid, int bytect) { DDCA_Display_Identifier pdid = NULL; DBGMSG("edid addr = %p, bytect = %d", edid, bytect); ERROR_CHECK( ddca_create_edid_display_identifier(edid, &pdid) ); return pdid; } DDCS_Display_Identifier ddcs_create_usb_display_identifier(int bus,int device) { DDCA_Display_Identifier pdid = NULL; ERROR_CHECK( ddca_create_usb_display_identifier(bus, device, &pdid) ); return pdid; } void ddcs_free_display_identifier(DDCS_Display_Identifier ddcs_did){ clear_exception(); DDCA_Status rc = ddca_free_display_identifier(ddcs_did); if (rc != 0) throw_exception_from_status_code(rc); } char * ddcs_repr_display_identifier(DDCS_Display_Identifier ddcs_did){ clear_exception(); char * result = ddca_did_repr(ddcs_did); if (!result) throw_exception_from_status_code(DDCL_ARG); // TODO: Python ValueError return result; } // // Display References // DDCS_Display_Ref ddcs_get_display_ref(DDCS_Display_Identifier did){ DDCS_Display_Ref result = NULL; DDCA_Status rc = ddca_create_display_ref(did, &result); clear_exception(); if (rc != 0) throw_exception_from_status_code(rc); return result; } void ddcs_free_display_ref(DDCS_Display_Ref dref) { clear_exception(); DDCA_Status rc = ddca_free_display_ref(dref); if (rc != 0) throw_exception_from_status_code(rc); } char * ddcs_repr_display_ref(DDCS_Display_Ref dref) { clear_exception(); char * result = ddca_dref_repr(dref); if (!result) throw_exception_from_status_code(DDCL_ARG); // TODO: Python ValueError return result; } void ddcs_report_display_ref(DDCS_Display_Ref dref, int depth) { clear_exception(); ddca_report_display_ref(dref, depth); } // // Display Handles // DDCS_Display_Handle ddcs_open_display(DDCS_Display_Ref dref) { DDCS_Display_Handle result = NULL; DDCA_Status rc = ddca_open_display(dref, &result); clear_exception(); if (rc != 0) throw_exception_from_status_code(rc); return result; } void ddcs_close_display(DDCS_Display_Handle dh) { clear_exception(); DDCA_Status rc = ddca_close_display(dh); if (rc != 0) throw_exception_from_status_code(rc); } char * ddcs_repr_display_handle(DDCS_Display_Handle dh) { clear_exception(); char * result = ddca_dh_repr(dh); if (!result) throw_exception_from_status_code(DDCL_OTHER); // should just be Python ValueError return result; } // // Miscellaneous Monitor Specific Functions // DDCS_MCCS_Version_Spec ddcs_get_mccs_version(DDCS_Display_Handle dh) { DDCS_MCCS_Version_Spec result = {0}; ERROR_CHECK( ddca_get_mccs_version(dh, &result) ); return result; } #ifdef OLD // DEPRECATED unsigned long ddcs_get_feature_info_by_display( DDCS_Display_Handle dh, DDCS_VCP_Feature_Code feature_code) { DDCA_Version_Feature_Flags result = 0; ERROR_CHECK( ddca_get_feature_info_by_display(dh, feature_code, &result) ); return result; } #endif // // Monitor Capabilities // char * ddcs_get_capabilities_string(DDCS_Display_Handle dh){ clear_exception(); char * result = NULL; DDCA_Status rc = ddca_get_capabilities_string(dh, &result); if (rc != 0) throw_exception_from_status_code(rc); return result; } // // Get and Set VCP Feature Values // // n. returning entire value, not pointer to value DDCS_Non_Table_Value_Response ddcs_get_nontable_vcp_value( DDCS_Display_Handle dh, DDCS_VCP_Feature_Code feature_code) { clear_exception(); DDCA_Non_Table_Value resp = {0}; DDCA_Status rc = ddca_get_nontable_vcp_value(dh, feature_code, &resp); if (rc != 0) throw_exception_from_status_code(rc); DDCS_Non_Table_Value_Response result; // memcpy(&result, &resp, sizeof(resp)); // How best to handle union in swig? result.mh = resp.mh; result.ml = resp.ml; result.sh = resp.sh; result.sl = resp.sl; result.cur_value = resp.sh << 8 | resp.sl; result.max_value = resp.mh << 8 | resp.ml; return result; } void ddcs_set_nontable_vcp_value( DDCS_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, int new_value) { clear_exception(); DDCA_Status rc = ddca_set_continuous_vcp_value(dh, feature_code, new_value); if (rc != 0) throw_exception_from_status_code(rc); } char * ddcs_get_profile_related_values(DDCS_Display_Handle dh){ clear_exception(); char * result = NULL; DDCA_Status rc = ddca_get_profile_related_values(dh, &result); if (rc != 0) throw_exception_from_status_code(rc); return result; } void ddcs_set_profile_related_values(char * profile_values_string) { clear_exception(); DDCA_Status rc = ddca_set_profile_related_values(profile_values_string); if (rc != 0) throw_exception_from_status_code(rc); } ddcutil-0.8.6/src/swig/ddc_swig.i0000664000175000001440000002105213225424423013572 00000000000000/* ddc_swig.i * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef PYTHON3 %module ddc_swig #else %module ddc_swig3 #endif %header %{ // Start of copy block #include "swig/ddc_swig.h" // void ddca_init(void); // bool ddcs_built_with_adl(void); const char * ddcutil_version(void); // enum Retries{DDCT_WRITE_ONLY_TRIES3, DDCT_WRITE_READ_TRIES3, DDCT_MULTI_PART_TRIES3}; // end of copy block %} %wrapper %{ %} %init %{ ddcs_init(); %} //%rename("%(regex:/(.*)_swigconstant$/\\1/)s") ""; %module(docstring="ddcutil Python interface") ddc_swig; %exception { clear_exception(); // redundant $action // char * emsg = check_exception(); // if (emsg) { // PyErr_SetString( PyExc_RuntimeError, emsg); // return NULL; // } bool exception_thrown = check_exception2(); if (exception_thrown) { puts("(ddc_swig.i:exception handler) throwing exception"); return NULL; } } // Convert byte of bit flags to a Python set %typemap(out) FlagsByte { printf("(typemap:FlagsByte) Starting. Value=0x%02x\n", $1); PyObject * pyset = PySet_New(NULL); for (int ndx = 0; ndx < 8; ndx++) { printf("(typemap:FlagsByte) testing bit %d, hexval 0x%02x\n", ndx, (1< * Copyright (C) 2016-2018 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_SWIG_H_ #define DDC_SWIG_H_ // hack attempting to avoid _float128 undefined error in coverity // does not solve problem and causes warnigs re __HAVE_FLOAT128 redefined // #include // #define __HAVE_FLOAT128 0 #include #include "public/ddcutil_types.h" #include "public/ddcutil_c_api.h" // Initialization void ddcs_init(void); // Convert ddcutil status codes to Python exceptions void clear_exception(); char * check_exception(); bool check_exception2(); // // Build Information // const char * ddcs_ddcutil_version_string(); typedef uint8_t FlagsByte; #ifdef OLD bool ddcs_built_with_adl(void); bool ddcs_built_with_usb(void); #endif // #define DDCS_BUILT_WITH_ADL DDCA_BUILT_WITH_ADL // #define DDCS_BUILT_WITH_USB DDCA_BUILT_WITH_USB // #define DDCS_BUILT_WITH_FAILSIM DDCA_BUILT_WITH_FAILSIM typedef enum {DDCA_HAS_ADL = DDCA_BUILT_WITH_ADL, DDCA_HAS_USB = DDCA_BUILT_WITH_USB, DDCA_HAS_FAILSIM = DDCA_BUILT_WITH_FAILSIM} DDCS_Build_Flags; FlagsByte ddcs_get_build_options(void); #ifdef NO // use this to get something that SWIG understands? correct order? ugly typedef struct { unsigned int pad: 5; unsigned int build_with_failsim: 1; unsigned int built_with_usb: 1; unsigned int built_with_adl: 1; } DDCS_Build_Flags_Struct; #endif // // Global Settings // #ifndef PYTHON3 // PyFileObject not defined in Python 3, how to handle? // void ddc_set_fout(PyFileObject *fpy); void ddcs_set_fout(FILE * fout); // void ddcs_set_fout(void * fpy); void save_current_python_fout(PyFileObject * pfy); PyFileObject * get_current_python_fout(); #endif // Reports int ddcs_report_active_displays(int depth); // // VCP Feature Information // typedef int DDCS_VCP_Feature_Code; #ifdef OLD typedef struct { int major; int minor; } DDCS_MCCS_Version_Spec; #endif typedef DDCA_MCCS_Version_Spec DDCS_MCCS_Version_Spec; #ifdef TO_REIMPLEMENT Version_Feature_Flags ddcs_get_feature_info_by_vcp_version( DDCS_VCP_Feature_Code feature_code, DDCA_MCCS_Version_Id version_id); #endif char * ddcs_get_feature_name(DDCS_VCP_Feature_Code feature_code); // // Display Identifiers // typedef void * DDCS_Display_Identifier; // opaque DDCS_Display_Identifier ddcs_create_dispno_display_identifier( int dispno); DDCS_Display_Identifier ddcs_create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex); DDCS_Display_Identifier ddcs_create_busno_display_identifier( int busno); DDCS_Display_Identifier ddcs_create_mfg_model_sn_display_identifier( const char * mfg_id, const char * model, const char * sn); DDCS_Display_Identifier ddcs_create_edid_display_identifier( const uint8_t * byte_buffer, int bytect); DDCS_Display_Identifier ddcs_create_usb_display_identifier( int bus, int device); void ddcs_free_display_identifier(DDCS_Display_Identifier ddcs_did); char * ddcs_repr_display_identifier(DDCS_Display_Identifier ddcs_did); // // Display References // typedef void * DDCS_Display_Ref; // opaque DDCS_Display_Ref ddcs_get_display_ref( DDCS_Display_Identifier did); void ddcs_free_display_ref( DDCS_Display_Ref dref); char * ddcs_repr_display_ref( DDCS_Display_Ref dref); void ddcs_report_display_ref(DDCS_Display_Ref dref, int depth); // // Display Handles // typedef void * DDCS_Display_Handle; // opaque DDCS_Display_Handle ddcs_open_display(DDCS_Display_Ref dref); void ddcs_close_display(DDCS_Display_Handle dh); char * ddcs_repr_display_handle(DDCS_Display_Handle dh); // // Miscellaneous Display Specific Functions // DDCS_MCCS_Version_Spec ddcs_get_mccs_version(DDCS_Display_Handle dh); #ifdef OLD // DEPRECATED unsigned long ddcs_get_feature_info_by_display( DDCS_Display_Handle dh, DDCS_VCP_Feature_Code feature_code); #endif // // Capabilities // char * ddcs_get_capabilities_string(DDCS_Display_Handle dh); // // Get and Set VCP Feature Values // typedef struct { uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; int max_value; int cur_value; } DDCS_Non_Table_Value_Response; DDCS_Non_Table_Value_Response ddcs_get_nontable_vcp_value( DDCS_Display_Handle dh, DDCS_VCP_Feature_Code feature_code); void ddcs_set_nontable_vcp_value( DDCS_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, int new_value); char * ddcs_get_profile_related_values(DDCS_Display_Handle dh); void ddcs_set_profile_related_values(char * profile_values_string); #endif /* DDC_SWIG_H_ */ ddcutil-0.8.6/src/swig/ddc_swig.h~0000644000175000001440000001276613230445447014006 00000000000000/* ddc_swig.h * * * Copyright (C) 2016-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #ifndef DDC_SWIG_H_ #define DDC_SWIG_H_ #include #include "public/ddcutil_types.h" #include "public/ddcutil_c_api.h" // Initialization void ddcs_init(void); // Convert ddcutil status codes to Python exceptions void clear_exception(); char * check_exception(); bool check_exception2(); // // Build Information // const char * ddcs_ddcutil_version_string(); typedef uint8_t FlagsByte; #ifdef OLD bool ddcs_built_with_adl(void); bool ddcs_built_with_usb(void); #endif // #define DDCS_BUILT_WITH_ADL DDCA_BUILT_WITH_ADL // #define DDCS_BUILT_WITH_USB DDCA_BUILT_WITH_USB // #define DDCS_BUILT_WITH_FAILSIM DDCA_BUILT_WITH_FAILSIM typedef enum {DDCA_HAS_ADL = DDCA_BUILT_WITH_ADL, DDCA_HAS_USB = DDCA_BUILT_WITH_USB, DDCA_HAS_FAILSIM = DDCA_BUILT_WITH_FAILSIM} DDCS_Build_Flags; FlagsByte ddcs_get_build_options(void); #ifdef NO // use this to get something that SWIG understands? correct order? ugly typedef struct { unsigned int pad: 5; unsigned int build_with_failsim: 1; unsigned int built_with_usb: 1; unsigned int built_with_adl: 1; } DDCS_Build_Flags_Struct; #endif // // Global Settings // #ifndef PYTHON3 // PyFileObject not defined in Python 3, how to handle? // void ddc_set_fout(PyFileObject *fpy); void ddcs_set_fout(FILE * fout); // void ddcs_set_fout(void * fpy); void save_current_python_fout(PyFileObject * pfy); PyFileObject * get_current_python_fout(); #endif // Reports int ddcs_report_active_displays(int depth); // // VCP Feature Information // typedef int DDCS_VCP_Feature_Code; #ifdef OLD typedef struct { int major; int minor; } DDCS_MCCS_Version_Spec; #endif typedef DDCA_MCCS_Version_Spec DDCS_MCCS_Version_Spec; #ifdef TO_REIMPLEMENT Version_Feature_Flags ddcs_get_feature_info_by_vcp_version( DDCS_VCP_Feature_Code feature_code, DDCA_MCCS_Version_Id version_id); #endif char * ddcs_get_feature_name(DDCS_VCP_Feature_Code feature_code); // // Display Identifiers // typedef void * DDCS_Display_Identifier; // opaque DDCS_Display_Identifier ddcs_create_dispno_display_identifier( int dispno); DDCS_Display_Identifier ddcs_create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex); DDCS_Display_Identifier ddcs_create_busno_display_identifier( int busno); DDCS_Display_Identifier ddcs_create_mfg_model_sn_display_identifier( const char * mfg_id, const char * model, const char * sn); DDCS_Display_Identifier ddcs_create_edid_display_identifier( const uint8_t * byte_buffer, int bytect); DDCS_Display_Identifier ddcs_create_usb_display_identifier( int bus, int device); void ddcs_free_display_identifier(DDCS_Display_Identifier ddcs_did); char * ddcs_repr_display_identifier(DDCS_Display_Identifier ddcs_did); // // Display References // typedef void * DDCS_Display_Ref; // opaque DDCS_Display_Ref ddcs_get_display_ref( DDCS_Display_Identifier did); void ddcs_free_display_ref( DDCS_Display_Ref dref); char * ddcs_repr_display_ref( DDCS_Display_Ref dref); void ddcs_report_display_ref(DDCS_Display_Ref dref, int depth); // // Display Handles // typedef void * DDCS_Display_Handle; // opaque DDCS_Display_Handle ddcs_open_display(DDCS_Display_Ref dref); void ddcs_close_display(DDCS_Display_Handle dh); char * ddcs_repr_display_handle(DDCS_Display_Handle dh); // // Miscellaneous Display Specific Functions // DDCS_MCCS_Version_Spec ddcs_get_mccs_version(DDCS_Display_Handle dh); #ifdef OLD // DEPRECATED unsigned long ddcs_get_feature_info_by_display( DDCS_Display_Handle dh, DDCS_VCP_Feature_Code feature_code); #endif // // Capabilities // char * ddcs_get_capabilities_string(DDCS_Display_Handle dh); // // Get and Set VCP Feature Values // typedef struct { uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; int max_value; int cur_value; } DDCS_Non_Table_Value_Response; DDCS_Non_Table_Value_Response ddcs_get_nontable_vcp_value( DDCS_Display_Handle dh, DDCS_VCP_Feature_Code feature_code); void ddcs_set_nontable_vcp_value( DDCS_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, int new_value); char * ddcs_get_profile_related_values(DDCS_Display_Handle dh); void ddcs_set_profile_related_values(char * profile_values_string); #endif /* DDC_SWIG_H_ */ ddcutil-0.8.6/src/cython/0000755000175000001440000000000013230445447012253 500000000000000ddcutil-0.8.6/src/cython/Makefile.am0000644000175000001440000001221013230445447014223 00000000000000generated_source_files = \ cyddc2.c \ cyddc3.c CLEANFILES = ${generated_source_files} *.so cyddc2.html cyddc3.html if ENABLE_CYTHON # Python extension modules, installed in $(py2execdir) or $(py3execdir) pyexec_LTLIBRARIES = cyddc2.la py3exec_LTLIBRARIES = cyddc3.la # nodist_py3exec_PYTHON = # # Python 2 version # # Module source code, nodist because cyddc2.c is generated nodist_cyddc2_la_SOURCES = cyddc2.c # Flags when compiling files in cyddc2_SOURCES cyddc2_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY2_CFLAGS} cyddc2_la_CFLAGS = $(PYTHON_CFLAGS) # Global and order-independent shared library and program linker config flags and options cyddc2_la_LDFLAGS = cyddc2_la_LDFLAGS += -module -shared -export_dynamic -static cyddc2_la_LDFLAGS += version_info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library cyddc2_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la cyddc2.c: cyddc.pyx show_vars @echo "=====> (src/cython/Makefile) Executing target cyddc2.c" cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -2 -o cyddc2.c -a cyddc.pyx # # Python 3 version # # nodist because cyddc3.c is generated nodist_cyddc3_la_SOURCES = cyddc3.c # Flags when compiling files in cyddc3_SOURCES cyddc3_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY3_CFLAGS} cyddc3_la_CFLAGS = $(PYTHON3_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info cyddc3_la_LDFLAGS = cyddc3_la_LDFLAGS += -module -shared -export_dynamic -static cyddc3_la_LDFLAGS += version_info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library cyddc3_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la cyddc3.c: cyddc.pyx show_vars @echo "=====> (src/cython/Makefile) Executing target cyddc.c" cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -3 -o cyddc3.c -a cyddc.pyx endif # Add show_vars to dependencies for debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" @echo " LIBS = $(LIBS)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_DEPENDENCIES = $(cyddc2_la_DEPENDENCIES)" @echo " EXTRA_cyddc2_la_DEPENDENCIES = $(EXTRA_cyddc2_la_DEPENDENCIES)" @echo " cyddc2_la_LINK = $(cyddc2_la_LINK)" @echo " am_cyddc2_la_rpath = $(am_cyddc2_la_rpath)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_LIBADD = $(cyddc2_la_LIBADD)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_DEPENDENCIES = $(cyddc3_la_DEPENDENCIES)" @echo " EXTRA_cyddc3_la_DEPENDENCIES = $(EXTRA_cyddc3_la_DEPENDENCIES)" @echo " cyddc3_la_LINK = $(cyddc3_la_LINK)" @echo " am_cyddc3_la_rpath = $(am_cyddc3_la_rpath)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_LIBADD = $(cyddc3_la_LIBADD)" # ld vars: #@echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars ddcutil-0.8.6/src/cython/Makefile.in0000644000175000001440000010165313230445447014246 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/cython ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(pyexecdir)" LTLIBRARIES = $(py3exec_LTLIBRARIES) $(pyexec_LTLIBRARIES) @ENABLE_CYTHON_TRUE@cyddc2_la_DEPENDENCIES = ../libcommon.la \ @ENABLE_CYTHON_TRUE@ ../libddcutil.la @ENABLE_CYTHON_TRUE@nodist_cyddc2_la_OBJECTS = cyddc2_la-cyddc2.lo cyddc2_la_OBJECTS = $(nodist_cyddc2_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 = cyddc2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cyddc2_la_CFLAGS) \ $(CFLAGS) $(cyddc2_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_CYTHON_TRUE@am_cyddc2_la_rpath = -rpath $(pyexecdir) @ENABLE_CYTHON_TRUE@cyddc3_la_DEPENDENCIES = ../libcommon.la \ @ENABLE_CYTHON_TRUE@ ../libddcutil.la @ENABLE_CYTHON_TRUE@nodist_cyddc3_la_OBJECTS = cyddc3_la-cyddc3.lo cyddc3_la_OBJECTS = $(nodist_cyddc3_la_OBJECTS) cyddc3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cyddc3_la_CFLAGS) \ $(CFLAGS) $(cyddc3_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_CYTHON_TRUE@am_cyddc3_la_rpath = -rpath $(py3execdir) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(nodist_cyddc2_la_SOURCES) $(nodist_cyddc3_la_SOURCES) DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ generated_source_files = \ cyddc2.c \ cyddc3.c CLEANFILES = ${generated_source_files} *.so cyddc2.html cyddc3.html # Python extension modules, installed in $(py2execdir) or $(py3execdir) @ENABLE_CYTHON_TRUE@pyexec_LTLIBRARIES = cyddc2.la @ENABLE_CYTHON_TRUE@py3exec_LTLIBRARIES = cyddc3.la # nodist_py3exec_PYTHON = # # Python 2 version # # Module source code, nodist because cyddc2.c is generated @ENABLE_CYTHON_TRUE@nodist_cyddc2_la_SOURCES = cyddc2.c # Flags when compiling files in cyddc2_SOURCES @ENABLE_CYTHON_TRUE@cyddc2_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY2_CFLAGS} @ENABLE_CYTHON_TRUE@cyddc2_la_CFLAGS = $(PYTHON_CFLAGS) # Global and order-independent shared library and program linker config flags and options @ENABLE_CYTHON_TRUE@cyddc2_la_LDFLAGS = -module -shared \ @ENABLE_CYTHON_TRUE@ -export_dynamic -static version_info \ @ENABLE_CYTHON_TRUE@ '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library @ENABLE_CYTHON_TRUE@cyddc2_la_LIBADD = \ @ENABLE_CYTHON_TRUE@ ../libcommon.la \ @ENABLE_CYTHON_TRUE@ ../libddcutil.la # # Python 3 version # # nodist because cyddc3.c is generated @ENABLE_CYTHON_TRUE@nodist_cyddc3_la_SOURCES = cyddc3.c # Flags when compiling files in cyddc3_SOURCES @ENABLE_CYTHON_TRUE@cyddc3_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY3_CFLAGS} @ENABLE_CYTHON_TRUE@cyddc3_la_CFLAGS = $(PYTHON3_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info @ENABLE_CYTHON_TRUE@cyddc3_la_LDFLAGS = -module -shared \ @ENABLE_CYTHON_TRUE@ -export_dynamic -static version_info \ @ENABLE_CYTHON_TRUE@ '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library @ENABLE_CYTHON_TRUE@cyddc3_la_LIBADD = \ @ENABLE_CYTHON_TRUE@ ../libcommon.la \ @ENABLE_CYTHON_TRUE@ ../libddcutil.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/cython/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/cython/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-py3execLTLIBRARIES: $(py3exec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || 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)$(py3execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py3execdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(py3execdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(py3execdir)"; \ } uninstall-py3execLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(py3execdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(py3execdir)/$$f"; \ done clean-py3execLTLIBRARIES: -test -z "$(py3exec_LTLIBRARIES)" || rm -f $(py3exec_LTLIBRARIES) @list='$(py3exec_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}; \ } cyddc2.la: $(cyddc2_la_OBJECTS) $(cyddc2_la_DEPENDENCIES) $(EXTRA_cyddc2_la_DEPENDENCIES) $(AM_V_CCLD)$(cyddc2_la_LINK) $(am_cyddc2_la_rpath) $(cyddc2_la_OBJECTS) $(cyddc2_la_LIBADD) $(LIBS) cyddc3.la: $(cyddc3_la_OBJECTS) $(cyddc3_la_DEPENDENCIES) $(EXTRA_cyddc3_la_DEPENDENCIES) $(AM_V_CCLD)$(cyddc3_la_LINK) $(am_cyddc3_la_rpath) $(cyddc3_la_OBJECTS) $(cyddc3_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyddc2_la-cyddc2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyddc3_la-cyddc3.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< cyddc2_la-cyddc2.lo: cyddc2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cyddc2_la_CPPFLAGS) $(CPPFLAGS) $(cyddc2_la_CFLAGS) $(CFLAGS) -MT cyddc2_la-cyddc2.lo -MD -MP -MF $(DEPDIR)/cyddc2_la-cyddc2.Tpo -c -o cyddc2_la-cyddc2.lo `test -f 'cyddc2.c' || echo '$(srcdir)/'`cyddc2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cyddc2_la-cyddc2.Tpo $(DEPDIR)/cyddc2_la-cyddc2.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cyddc2.c' object='cyddc2_la-cyddc2.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) $(cyddc2_la_CPPFLAGS) $(CPPFLAGS) $(cyddc2_la_CFLAGS) $(CFLAGS) -c -o cyddc2_la-cyddc2.lo `test -f 'cyddc2.c' || echo '$(srcdir)/'`cyddc2.c cyddc3_la-cyddc3.lo: cyddc3.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cyddc3_la_CPPFLAGS) $(CPPFLAGS) $(cyddc3_la_CFLAGS) $(CFLAGS) -MT cyddc3_la-cyddc3.lo -MD -MP -MF $(DEPDIR)/cyddc3_la-cyddc3.Tpo -c -o cyddc3_la-cyddc3.lo `test -f 'cyddc3.c' || echo '$(srcdir)/'`cyddc3.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cyddc3_la-cyddc3.Tpo $(DEPDIR)/cyddc3_la-cyddc3.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cyddc3.c' object='cyddc3_la-cyddc3.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) $(cyddc3_la_CPPFLAGS) $(CPPFLAGS) $(cyddc3_la_CFLAGS) $(CFLAGS) -c -o cyddc3_la-cyddc3.lo `test -f 'cyddc3.c' || echo '$(srcdir)/'`cyddc3.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(pyexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-py3execLTLIBRARIES \ clean-pyexecLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-py3execLTLIBRARIES install-pyexecLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-py3execLTLIBRARIES uninstall-pyexecLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-py3execLTLIBRARIES clean-pyexecLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am \ install-py3execLTLIBRARIES install-pyexecLTLIBRARIES \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-py3execLTLIBRARIES uninstall-pyexecLTLIBRARIES .PRECIOUS: Makefile @ENABLE_CYTHON_TRUE@cyddc2.c: cyddc.pyx show_vars @ENABLE_CYTHON_TRUE@ @echo "=====> (src/cython/Makefile) Executing target cyddc2.c" @ENABLE_CYTHON_TRUE@ cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -2 -o cyddc2.c -a cyddc.pyx @ENABLE_CYTHON_TRUE@cyddc3.c: cyddc.pyx show_vars @ENABLE_CYTHON_TRUE@ @echo "=====> (src/cython/Makefile) Executing target cyddc.c" @ENABLE_CYTHON_TRUE@ cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -3 -o cyddc3.c -a cyddc.pyx # Add show_vars to dependencies for debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" @echo " LIBS = $(LIBS)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_DEPENDENCIES = $(cyddc2_la_DEPENDENCIES)" @echo " EXTRA_cyddc2_la_DEPENDENCIES = $(EXTRA_cyddc2_la_DEPENDENCIES)" @echo " cyddc2_la_LINK = $(cyddc2_la_LINK)" @echo " am_cyddc2_la_rpath = $(am_cyddc2_la_rpath)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_LIBADD = $(cyddc2_la_LIBADD)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_DEPENDENCIES = $(cyddc3_la_DEPENDENCIES)" @echo " EXTRA_cyddc3_la_DEPENDENCIES = $(EXTRA_cyddc3_la_DEPENDENCIES)" @echo " cyddc3_la_LINK = $(cyddc3_la_LINK)" @echo " am_cyddc3_la_rpath = $(am_cyddc3_la_rpath)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_LIBADD = $(cyddc3_la_LIBADD)" # ld vars: #@echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars # 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: ddcutil-0.8.6/src/cython/setup.py~0000644000175000001440000000044313230445447014104 00000000000000 import sys from distutils.core import setup from Cython.Build import cythonize # if (len(sys.argv) < 2): # print("Syntax: setup.py # sys.exit(1) # target = sys.argv[1] target='nonsuch.pyx' print("Compiling: %d" % target) setup(ext_modules=cythonize(target)) ddcutil-0.8.6/src/cython/setup.py0000644000175000001440000000044313230445447013706 00000000000000 import sys from distutils.core import setup from Cython.Build import cythonize # if (len(sys.argv) < 2): # print("Syntax: setup.py # sys.exit(1) # target = sys.argv[1] target='nonsuch.pyx' print("Compiling: %s" % target) setup(ext_modules=cythonize(target)) ddcutil-0.8.6/src/cython/callcython~0000755000175000001440000000024113230445447014454 00000000000000#!/bin/sh incdirs=/shared/playproj/i2c/src/public src_fn=cyddc.fbx echo ${incdirs} echo ${src_fn} cmd="cython -I ${incdirs} -I . -3 ${src_fn}" echo $cmd $cmd ddcutil-0.8.6/src/cython/callcython0000755000175000001440000000024113230445447014256 00000000000000#!/bin/sh incdirs=/shared/playproj/i2c/src/public src_fn=cyddc.pyx echo ${incdirs} echo ${src_fn} cmd="cython -I ${incdirs} -I . -3 ${src_fn}" echo $cmd $cmd ddcutil-0.8.6/src/cython/runc~0000755000175000001440000000132313230445447013265 00000000000000#!/bin/sh target=cyddc.c linkfile=cyddc.o ddcincl="-I /shared/playproj/i2c/src/public -I/shared/playproj/i2c" CFLAGS=$(python3-config --cflags) LDFLAGS=`python3-config --ldflags` echo $CFLAGS echo $LDFLAGS echo $target echo $ddcincl cmd="gcc -c $target ${CFLAGS} -fPIC ${ddcincl}" echo $cmd $cmd # cmd="gcc -shared -Wno-undef ${LDFLAGS} -o libcyddc.so -L/shared/playproj/i2c/src/.libs -L$(pwd) -lddcutil ${linkfile}" cmd="gcc -shared -Wno-undef ${LDFLAGS} -o libcyddc.so -L/shared/playproj/i2c/src/.libs -L$(pwd) -lddcutil ${linkfile}" # cmd="gcc -shared --no-undefined -export-dynamic -static ${LDFLAGS} -o libcyddc.so -L /shared/playproj/i2c/src/.libs ../.libs/libhack.a ${linkfile}" echo $cmd $cmd ddcutil-0.8.6/src/cython/runc0000755000175000001440000000155013230445447013071 00000000000000#!/bin/sh target=cyddc.c linkfile=cyddc.o ddcincl="-I /shared/playproj/i2c/src/public -I/shared/playproj/i2c" CFLAGS=$(python3-config --cflags) LDFLAGS=`python3-config --ldflags` echo "\$CFLAGS:" echo $CFLAGS echo "\$LDFLAGS:" echo $LDFLAGS echo "\$target: $target" echo "\$ddcincl: $ddcincl" cmd="gcc -c $target ${CFLAGS} -fPIC ${ddcincl}" echo "\$cmd:" echo $cmd echo "Executing \$cmd:" $cmd # cmd="gcc -shared -Wno-undef ${LDFLAGS} -o libcyddc.so -L/shared/playproj/i2c/src/.libs -L$(pwd) -lddcutil ${linkfile}" cmd="gcc -shared -Wno-undef ${LDFLAGS} -o libcyddc.so -L/shared/playproj/i2c/src/.libs -L$(pwd) -lddcutil ${linkfile}" # cmd="gcc -shared --no-undefined -export-dynamic -static ${LDFLAGS} -o libcyddc.so -L /shared/playproj/i2c/src/.libs ../.libs/libhack.a ${linkfile}" echo "\$cmd:" echo $cmd echo "Executing \$cmd:" echo $cmd $cmd ddcutil-0.8.6/src/cython/cyddc.pyx~0000644000175000001440000000114513230445447014222 00000000000000cdef extern from "ddcutil_c_api.h": ctypedef int integral ctypedef struct DDCA_Ddcutil_Version_Spec: int major int minor int micro int ddca_get_max_max_tries() char * ddca_ddcutil_version_string() DDCA_Ddcutil_Version_Spec ddca_ddcutil_version() def ddcy_get_max_max_tries(): return ddca_get_max_max_tries() def ddcy_ddcutil_version_string(): return ddca_ddcutil_version_string().decode("UTF-8") def ddcy_ddcutil_version(): return ddca_ddcutil_version() def ddcutil_version2(): v = ddca_ddcutil_version() return (v.major, v.minor, v.micro) ddcutil-0.8.6/src/cython/cyddc.pyx0000644000175000001440000003325113230445447014027 00000000000000import traceback import sys cdef extern from "Python.h": ctypedef object PyList ctypedef object PyObject PyList PyList_New(Py_ssize_t len) PyList_SET_ITEM(PyObject list, Py_ssize_t index, PyObject o) cdef extern from "stdbool.h": pass cdef extern from "stdio.h": pass cdef extern from "ddcutil_c_api.h": ctypedef int integral ctypedef int bint # # Library build information # cdef extern from "ddcutil_c_api.h": ctypedef struct DDCA_Ddcutil_Version_Spec: int major int minor int micro const char * ddca_ddcutil_version_string() DDCA_Ddcutil_Version_Spec ddca_ddcutil_version() ctypedef enum DDCA_Build_Option_Flags: DDCA_BUILT_WITH_ADL DDCA_BUILT_WITH_USB DDCA_BUILT_WITH_FAILSIM int ddca_build_options() def ddcy_ddcutil_version_string(): return ddca_ddcutil_version_string().decode("UTF-8") def ddcy_ddcutil_version(): return ddca_ddcutil_version() def ddcutil_version2(): v = ddca_ddcutil_version() return (v.major, v.minor, v.micro) BUILT_WITH_ADL = DDCA_BUILT_WITH_ADL BUILT_WITH_USB = DDCA_BUILT_WITH_USB BUILT_WITH_FAILSIM = DDCA_BUILT_WITH_FAILSIM def get_build_options(): bits = ddca_build_options() print(bits) l = [] if bits & DDCA_BUILT_WITH_ADL: l.append(BUILT_WITH_ADL) if bits & DDCA_BUILT_WITH_USB: l.append(BUILT_WITH_USB) if bits & DDCA_BUILT_WITH_FAILSIM: l.append(BUILT_WITH_FAILSIM) print(l) s0 = set() if bits & DDCA_BUILT_WITH_USB: s0.add(BUILT_WITH_USB) print(s0) s2 = frozenset(s0) s = frozenset(l) return s2 # # Status Codes # cdef extern from "ddcutil_c_api.h": char * ddca_rc_name(int status_code) char * ddca_rc_desc(int status_code) def rc_name(code): return ddca_rc_name(code).decode("UTF-8") def rc_desc(code): return ddca_rc_desc(code).decode("UTF-8") # # Global Settings # cdef extern from "ddcutil_c_api.h": ctypedef enum DDCA_Retry_Type: DDCA_WRITE_ONLY_TRIES DDCA_WRITE_READ_TRIES DDCA_MULTI_PART_TRIES int ddca_max_max_tries() void ddca_set_max_tries(int retry_type, int ct) int ddca_get_max_tries(int retry_type) void ddca_enable_verify(int onoff) int ddca_is_verify_enabled() WRITE_ONLY_TRIES = DDCA_WRITE_ONLY_TRIES WRITE_READ_TRIES = DDCA_WRITE_READ_TRIES MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES def ddcy_get_max_max_tries(): return ddca_max_max_tries() def get_max_tries(retry_type): return ddca_get_max_tries(retry_type) def set_max_tries(retry_type, ct): ddca_set_max_tries(retry_type, ct) def enable_verify(onoff): ddca_enable_verify(onoff) def is_verify_enabled(): return bool(ddca_is_verify_enabled()) # # Message Control # cdef extern from "ddcutil_c_api.h": # void ddca_set_fout(FILE * fout) # void ddca_set_fout_to_default() # void ddca_set_ferr(FILE * file) # void ddca_set_ferr_to_default() ctypedef enum DDCA_Output_Level: DDCA_OL_TERSE DDCA_OL_NORMAL DDCA_OL_VERBOSE int ddca_get_output_level() void ddca_set_output_level(int) void ddca_enable_report_ddc_errors(int truefalse) int ddca_is_report_ddc_errors_enabled() OL_TERSE = DDCA_OL_TERSE OL_NORMAL = DDCA_OL_NORMAL OL_VERBOSE = DDCA_OL_VERBOSE def get_output_level(): return ddca_get_output_level() def set_output_level(ol): ddca_set_output_level(ol) def enable_report_ddc_errors(truefalse): ddca_set_output_level(truefalse) def is_report_ddc_errors_enabled(): return bool(ddca_is_report_ddc_errors_enabled()) # # Statistics # cdef extern from "ddcutil_c_api.h": ctypedef enum DDCA_Stats_Type: DDCA_STATS_NONE DDCA_STATS_TRIES DDCA_STATS_ERRORS DDCA_STATS_CALLS DDCA_STATS_ELAPSED DDCA_STATS_ALL void ddca_reset_stats() void ddca_show_stats(int stats_types, int depth) STATS_NONE = DDCA_STATS_NONE STATS_TRIES = DDCA_STATS_TRIES STATS_ERRORS = DDCA_STATS_ERRORS STATS_CALLS = DDCA_STATS_CALLS STATS_ELAPSED = DDCA_STATS_ELAPSED STATS_ALL = DDCA_STATS_ALL def reset_stats(): ddca_reset_stats() def show_stats(stats_type, depth): # TODO: verify that depth is integer, raise exception if not ddca_show_stats(stats_type, depth) # # Error handling # class CYDDC_Exception(Exception): def __init__(self, rc, msg=None): if msg is None: msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) super(CYDDC_Exception, self).__init__(msg) self.status = rc def create_ddc_exception(int rc): # To do: test for rc values that map to standard Python exceptions excp = CYDDC_Exception(rc) # ??? # To do: adjust the stack (etype, evalue, tb) = sys.exc_info() print("traceback.print_tb(): ") traceback.print_tb(tb) print("traceback.print_exception():") traceback.print_exception(etype, evalue, tb) print("traceback.print_exc():") traceback.print_exc() x = traceback.extract_tb(tb) print(type(x)) print(x) y = traceback.extract_stack(tb) print(type(y)) print(y) print(excp) return excp def check_ddca_status(int rc): if (rc != 0): excp = CYDDC_Exception(rc) # (etype, evalue, tb) = sys.exc_info() print(excp) raise excp # # Display Access # cdef extern from "ddcutil_c_api.h": ctypedef void * DDCA_Display_Identifier ctypedef struct DDCA_Display_Ref: pass ctypedef struct DDCA_Display_Handle: pass ctypedef struct DDCA_Adlno: int iAdapterIndex int iDisplayIndex ctypedef enum DDCA_IO_Mode: DDCA_IO_DEVI2C DDCA_IO_ADL DDCA_IO_USB ctypedef union PathUnion: int i2c_busno DDCA_Adlno adlno int hiddev_devno ctypedef struct DDCA_IO_Path: DDCA_IO_Mode io_mode PathUnion pu ctypedef struct DDCA_Display_Info: char marker[4] int dispno DDCA_IO_Path path int usb_bus int usb_device const char * mfg_id const char * model_name const char * sn # const int uint8_t * edid_bytes # pointer to 128 bytes of edid DDCA_Display_Ref dref ctypedef struct DDCA_Display_Info_List: int ct DDCA_Display_Info ** info # array whose size is determined by ct # ctypedef DDCA_Status int DDCA_Display_Info_List * ddca_get_display_info_list() void ddca_free_display_info_list(DDCA_Display_Info_List * dlist) void ddca_report_display_info(DDCA_Display_Info * dinfo, int depth) void ddca_report_display_info_list(DDCA_Display_Info_List * dlist, int depth) int ddca_create_dispno_display_identifier( int dispno, void * pc_did) int ddca_free_display_identifier(void * c_did) char * ddca_did_repr(void * c_did) # cdef get_display_info_list_aux(): # cdef DDCA_Display_Info_List * dlist # cdef DDCA_Display_Info * dinfo # cdef int ct, ndx # dlist = ddca_get_display_info_list() # ct = dlist.ct # pylist = PyList_New(ct) # for ndx in range(ct): # dinfo = dlist.info[ndx] # # how to convert a C DDCA_Display_Info struct to a Python object? # pyinfo = dinfo # will cython do the right thing? # PyList_SET_ITEM(pylist, ndx, pyinfo) # return pylist # def create_dispno_display_identifier(int dispno): # cdef DDCA_Display_Identifier did # rc = ddca_create_dispno_display_identifier(dispno, &did) # if rc != 0: # excp = create_ddc_exception(rc) # raise excp # return did # def free_display_identifier(DDCA_Display_Identifier did): # rc = ddca_free_display_identifier(did) # if rc != 0: # excp = create_ddc_exception(rc) # raise excp # def did_repr(DDCA_Display_Identifier did): # return ddca_did_repr(did) # # Display References # cdef extern from "ddcutil_c_api.h": int ddca_create_display_ref(void * did, void ** ddca_dref) int ddca_free_display_ref(void * dref) char * ddca_dref_repr(void * dref) void ddca_report_display_ref(void * dref, int depth) # def get_display_ref(DDCA_Display_Identifier did): # cdef void * c_dref # rc = ddca_create_display_ref(did, &c_dref) # if rc != 0: # excp = create_ddc_exception(rc) # raise excp # return dref # def dref_repr(DDCA_Display_Ref dref): # return ddca_dref_repr(dref) # def free_display_ref(dref): # rc = ddca_free_display_ref(dref) # if rc != 0: # excp = create_ddc_exception(rc) # raise excp # def report_display_ref(dref, depth): # ddca_report_display_ref(dref, depth) cdef class Display_Identifier(object): cdef void * c_did # def __init__(self, void * c_did): # self.c_did = c_did @classmethod def create_by_dispno(cls, int dispno): cdef void * c_did rc = ddca_create_dispno_display_identifier(dispno, &c_did) if rc != 0: excp = create_ddc_exception(rc) raise excp result = Display_Identifier() result.c_did = c_did return result def free(self): rc = ddca_free_display_identifier(self.c_did) if rc != 0: excp = create_ddc_exception(rc) raise excp # or ? def __dealloc__(self): rc = ddca_free_display_identifier(self.c_did) if rc != 0: excp = create_ddc_exception(rc) raise excp def __repr__(self): return ddca_did_repr(self.c_did).decode("UTF-8") cdef class Display_Ref(object): cdef void * c_dref # cdef __init__(self, c_dref): # self.c_dref = c_dref @classmethod def create_from_did(cls, Display_Identifier did): cdef void * c_dref rc = ddca_create_display_ref(did.c_did, &c_dref) if rc != 0: excp = create_ddc_exception(rc) raise excp dref = Display_Ref() dref.c_dref = c_dref return dref def free(self): ddca_free_display_ref(self.c_dref) def __repr__(self): return ddca_dref_repr(self.c_dref).decode("UTF-8") def dbgrpt(self, int depth): ddca_report_display_ref(self.c_dref, depth) # cdef extern from "": # ctypedef uint8_t integral cdef extern from "ddcutil_c_api.h": int ddca_open_display(void * dref, void ** pdh) int ddca_close_display(void * dh) char * ddca_dh_repr(void * dh) int ddca_get_capabilities_string(void * dh, char ** p_caps) # ctypedef DDCA_Vcp_Feature_Code uint8_t ctypedef struct DDCA_Non_Table_Value: unsigned char mh unsigned char ml unsigned char sh unsigned char sl int ddca_get_nontable_vcp_value(void * dh, unsigned char feature_code, DDCA_Non_Table_Value * p_resp) ctypedef enum DDCA_Vcp_Value_Type: DDCA_NON_TABLE_VCP_VALUE DDCA_TABLE_VCP_VALUE NON_TABLE_VCP_VALUE = DDCA_NON_TABLE_VCP_VALUE TABLE_VCP_VALUE = DDCA_TABLE_VCP_VALUE cdef class Vcp_Value(object): cdef public unsigned char feature_code cdef public unsigned char feature_type # needed? def __init__(self, feature_code, int feature_type): self.feature_code = feature_code self.feature_type = feature_type cdef class Non_Table_Vcp_Value(Vcp_Value): def __init__(self, feature_code, mh, ml, sh, sl): super(Non_Table_Vcp_Value, self).__init__(feature_code, DDCA_NON_TABLE_VCP_VALUE) self.mh = mh self.ml = ml self.sh = sh self.sl = sl # TODO: use getattr, setattr def cur_val(self): return self.sh << 16 | self.sl cdef class Table_Vcp_Value(Vcp_Value): def __init__(self, feature_code, bytestring ): super(Table_Vcp_Value, self).__init__(feature_code, DDCA_TABLE_VCP_VALUE) self.bytes = bytestring cdef class Display_Handle(object): cdef void * c_dh @classmethod def open(cls, Display_Ref dref): cdef int rc cdef void * c_dh rc = ddca_open_display(dref.c_dref, &c_dh) if rc != 0: excp = create_ddc_exception(rc) raise excp dh = Display_Handle() dh.c_dh = c_dh return dh def close(self): cdef int rc rc = ddca_close_display(self.c_dh) if rc != 0: excp = create_ddc_exception(rc) raise excp def __repr__(self): return ddca_dh_repr(self.c_dh).decode("UTF-8") def get_capabilities_string(self): cdef char * s cdef int rc rc = ddca_get_capabilities_string(self.c_dh, &s) if rc != 0: excp = create_ddc_exception(rc) raise excp return s.decode("UTF-8") def get_nontable_vcp_value(self, feature_code): cdef DDCA_Non_Table_Value resp # n. fills in existing DDCA_Non_Table_Value, does not allocate rc = ddca_get_nontable_vcp_value(self.c_dh, feature_code, &resp) if rc != 0: excp = create_ddc_exception(rc) raise excp # Todo: create a Non_Table_Vcp_Value instance, return it # return resp fcode = resp.feature_code mh = resp.mh ml = resp.ml sh = resp.sh sl = resp.sl print("fcode: x%02x" % fcode) print("sl: x%02x" % sl) resp = Non_Table_Vcp_Value(fcode, mh, ml, sh, sl) # raise("unimplemented") return resp cdef extern from "ddcutil_c_api.h": ctypedef struct DDCA_Capabilities: char marker[4] char * unparsed_string # DDCA_MCCS_Version_Spec version_spec int vcp_code_ct # cdef class Capabilities(object): # @classmethod # def parse()ddcutil-0.8.6/src/cython/runcy~0000755000175000001440000000017213230445447013457 00000000000000#!/bin/sh cydir=/shared/playproj/i2c/src/cython cp -p ${cydir}/initcy.py .libs cd ${cydir}/.libs python3 -i initcy.py ddcutil-0.8.6/src/cython/runcy0000755000175000001440000000017413230445447013263 00000000000000#!/bin/sh cydir=/shared/playproj/i2c/src/cython cp -p ${cydir}/init_cy.py .libs cd ${cydir}/.libs python3 -i init_cy.py ddcutil-0.8.6/src/cython/init_cy.py~0000644000175000001440000000031413230445447014377 00000000000000import cyddc from cyddc import * did = Display_Identifier.create_by_dispno(2) print("did: %s" % did.__repr__()) print("did: %s" % did) dref = Display_Ref.create_from_did(did) print("dref: %s" % dref) ddcutil-0.8.6/src/cython/init_cy.py0000644000175000001440000000047613230445447014212 00000000000000import cyddc from cyddc import * did = Display_Identifier.create_by_dispno(2) print("did: %s" % did.__repr__()) print("did: %s" % did) dref = Display_Ref.create_from_did(did) print("dref: %s" % dref) dh = Display_Handle.open(dref) print("dh: %s" % dh) caps = dh.get_capabilities_string() print("caps: %s" % caps) ddcutil-0.8.6/src/cython/.gitignore~0000644000175000001440000000007113230445447014357 00000000000000.gitigore callcython *html cyddc*.c setup.py runcy runc ddcutil-0.8.6/src/cython/.gitignore0000644000175000001440000000010413230445447014156 00000000000000.gitigore callcython *html cyddc*.c setup.py runcy runc init_cy.py ddcutil-0.8.6/src/cython/fixpath~0000755000175000001440000000006013230445447013756 00000000000000#!/bin/sh export PYTHONPATH=./libs:$PYTHONPATH ddcutil-0.8.6/src/cython/Makefile.am~0000644000175000001440000001216013230445447014425 00000000000000generated_source_files = \ cyddc2.c \ cyddc3.c CLEANFILES = ${generated_source_files} *.so if ENABLE_CYTHON # Python extension modules, installed in $(py2execdir) or $(py3execdir) pyexec_LTLIBRARIES = cyddc2.la py3exec_LTLIBRARIES = cyddc3.la # nodist_py3exec_PYTHON = # # Python 2 version # # Module source code, nodist because cyddc2.c is generated nodist_cyddc2_la_SOURCES = cyddc2.c # Flags when compiling files in cyddc2_SOURCES cyddc2_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY2_CFLAGS} cyddc2_la_CFLAGS = $(PYTHON_CFLAGS) # Global and order-independent shared library and program linker config flags and options cyddc2_la_LDFLAGS = cyddc2_la_LDFLAGS += -module -shared -export_dynamic -static cyddc2_la_LDFLAGS += version_info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library cyddc2_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la cyddc2.c: cyddc.pyx show_vars @echo "=====> (src/cython/Makefile) Executing target cyddc2.c" cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -2 -o cyddc2.c -a cyddc.pyx # # Python 3 version # # nodist because cyddc3.c is generated nodist_cyddc3_la_SOURCES = cyddc3.c # Flags when compiling files in cyddc3_SOURCES cyddc3_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY3_CFLAGS} cyddc3_la_CFLAGS = $(PYTHON3_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info cyddc3_la_LDFLAGS = cyddc3_la_LDFLAGS += -module -shared -export_dynamic -static cyddc3_la_LDFLAGS += version_info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library cyddc3_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la cyddc3.c: cyddc.pyx show_vars @echo "=====> (src/cython/Makefile) Executing target cyddc.c" cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -3 -o cyddc3.c -a cyddc.pyx endif # Add show_vars to dependencies for debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" @echo " LIBS = $(LIBS)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_DEPENDENCIES = $(cyddc2_la_DEPENDENCIES)" @echo " EXTRA_cyddc2_la_DEPENDENCIES = $(EXTRA_cyddc2_la_DEPENDENCIES)" @echo " cyddc2_la_LINK = $(cyddc2_la_LINK)" @echo " am_cyddc2_la_rpath = $(am_cyddc2_la_rpath)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_LIBADD = $(cyddc2_la_LIBADD)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_DEPENDENCIES = $(cyddc3_la_DEPENDENCIES)" @echo " EXTRA_cyddc3_la_DEPENDENCIES = $(EXTRA_cyddc3_la_DEPENDENCIES)" @echo " cyddc3_la_LINK = $(cyddc3_la_LINK)" @echo " am_cyddc3_la_rpath = $(am_cyddc3_la_rpath)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_LIBADD = $(cyddc3_la_LIBADD)" # ld vars: #@echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars ddcutil-0.8.6/src/cython/cyddc.c0000644000175000001440000151050013230445447013427 00000000000000/* Generated by Cython 0.25.2 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_25_2" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #define HAVE_LONG_LONG #endif #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #undef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if PY_VERSION_HEX < 0x030300F0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 #define PyUnicode_2BYTE_KIND 2 #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } # else # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #elif defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__cyddc #define __PYX_HAVE_API__cyddc #include "stdbool.h" #include "stdio.h" #include "ddcutil_c_api.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "cyddc.pyx", }; /*--- Type declarations ---*/ struct __pyx_obj_5cyddc_Display_Identifier; struct __pyx_obj_5cyddc_Display_Ref; struct __pyx_obj_5cyddc_Vcp_Value; struct __pyx_obj_5cyddc_Non_Table_Vcp_Value; struct __pyx_obj_5cyddc_Table_Vcp_Value; struct __pyx_obj_5cyddc_Display_Handle; /* "cyddc.pyx":399 * * * cdef class Display_Identifier(object): # <<<<<<<<<<<<<< * cdef void * c_did * */ struct __pyx_obj_5cyddc_Display_Identifier { PyObject_HEAD void *c_did; }; /* "cyddc.pyx":436 * * * cdef class Display_Ref(object): # <<<<<<<<<<<<<< * cdef void * c_dref * */ struct __pyx_obj_5cyddc_Display_Ref { PyObject_HEAD void *c_dref; }; /* "cyddc.pyx":512 * * * cdef class Vcp_Value(object): # <<<<<<<<<<<<<< * cdef public unsigned char feature_code * cdef public unsigned char feature_type # needed? */ struct __pyx_obj_5cyddc_Vcp_Value { PyObject_HEAD unsigned char feature_code; unsigned char feature_type; }; /* "cyddc.pyx":520 * self.feature_type = feature_type * * cdef class Non_Table_Vcp_Value(Vcp_Value): # <<<<<<<<<<<<<< * * def __init__(self, feature_code, mh, ml, sh, sl): */ struct __pyx_obj_5cyddc_Non_Table_Vcp_Value { struct __pyx_obj_5cyddc_Vcp_Value __pyx_base; }; /* "cyddc.pyx":535 * * * cdef class Table_Vcp_Value(Vcp_Value): # <<<<<<<<<<<<<< * * */ struct __pyx_obj_5cyddc_Table_Vcp_Value { struct __pyx_obj_5cyddc_Vcp_Value __pyx_base; }; /* "cyddc.pyx":544 * * * cdef class Display_Handle(object): # <<<<<<<<<<<<<< * cdef void * c_dh * */ struct __pyx_obj_5cyddc_Display_Handle { PyObject_HEAD void *c_dh; }; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* IncludeStringH.proto */ #include /* decode_c_string.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /* pyfrozenset_new.proto */ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { if (it) { PyObject* result; #if CYTHON_COMPILING_IN_PYPY PyObject* args; args = PyTuple_Pack(1, it); if (unlikely(!args)) return NULL; result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); Py_DECREF(args); return result; #else if (PyFrozenSet_CheckExact(it)) { Py_INCREF(it); return it; } result = PyFrozenSet_New(it); if (unlikely(!result)) return NULL; if (likely(PySet_GET_SIZE(result))) return result; Py_DECREF(result); #endif } #if CYTHON_USE_TYPE_SLOTS return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL); #else return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL); #endif } /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #endif /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_setattro)) return tp->tp_setattro(obj, attr_name, value); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_setattr)) return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); #endif return PyObject_SetAttr(obj, attr_name, value); } #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #else #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); /* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil); /* ArgTypeTest.proto */ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_LshiftObjC(PyObject *op1, PyObject *op2, long intval, int inplace); #else #define __Pyx_PyInt_LshiftObjC(op1, op2, intval, inplace)\ (inplace ? PyNumber_InPlaceLshift(op1, op2) : PyNumber_Lshift(op1, op2)) #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* CythonFunction.proto */ #define __Pyx_CyFunction_USED 1 #include #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { PyCFunctionObject func; #if PY_VERSION_HEX < 0x030500A0 PyObject *func_weakreflist; #endif PyObject *func_dict; PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; PyObject *func_classobj; void *defaults; int defaults_pyobjects; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *self, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /* GetNameInClass.proto */ static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); /* ClassMethod.proto */ #include "descrobject.h" static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Build_Option_Flags(DDCA_Build_Option_Flags value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Retry_Type(DDCA_Retry_Type value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Output_Level(DDCA_Output_Level value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_Stats_Type value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Vcp_Value_Type(DDCA_Vcp_Value_Type value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); static PyObject* __pyx_convert__to_py_DDCA_Ddcutil_Version_Spec(DDCA_Ddcutil_Version_Spec s); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cyddc' */ static PyTypeObject *__pyx_ptype_5cyddc_Display_Identifier = 0; static PyTypeObject *__pyx_ptype_5cyddc_Display_Ref = 0; static PyTypeObject *__pyx_ptype_5cyddc_Vcp_Value = 0; static PyTypeObject *__pyx_ptype_5cyddc_Non_Table_Vcp_Value = 0; static PyTypeObject *__pyx_ptype_5cyddc_Table_Vcp_Value = 0; static PyTypeObject *__pyx_ptype_5cyddc_Display_Handle = 0; #define __Pyx_MODULE_NAME "cyddc" int __pyx_module_is_main_cyddc = 0; /* Implementation of 'cyddc' */ static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_super; static const char __pyx_k_l[] = "l"; static const char __pyx_k_s[] = "s"; static const char __pyx_k_v[] = "v"; static const char __pyx_k_x[] = "x"; static const char __pyx_k_y[] = "y"; static const char __pyx_k_ct[] = "ct"; static const char __pyx_k_mh[] = "mh"; static const char __pyx_k_ml[] = "ml"; static const char __pyx_k_ol[] = "ol"; static const char __pyx_k_rc[] = "rc"; static const char __pyx_k_s0[] = "s0"; static const char __pyx_k_s2[] = "s2"; static const char __pyx_k_sh[] = "sh"; static const char __pyx_k_sl[] = "sl"; static const char __pyx_k_tb[] = "tb"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_msg[] = "msg"; static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_bits[] = "bits"; static const char __pyx_k_code[] = "code"; static const char __pyx_k_excp[] = "excp"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_open[] = "open"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_bytes[] = "bytes"; static const char __pyx_k_cyddc[] = "cyddc"; static const char __pyx_k_depth[] = "depth"; static const char __pyx_k_etype[] = "etype"; static const char __pyx_k_major[] = "major"; static const char __pyx_k_micro[] = "micro"; static const char __pyx_k_minor[] = "minor"; static const char __pyx_k_onoff[] = "onoff"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_super[] = "super"; static const char __pyx_k_evalue[] = "evalue"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_status[] = "status"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_rc_desc[] = "rc_desc"; static const char __pyx_k_rc_name[] = "rc_name"; static const char __pyx_k_OL_TERSE[] = "OL_TERSE"; static const char __pyx_k_exc_info[] = "exc_info"; static const char __pyx_k_print_tb[] = "print_tb"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_sl_x_02x[] = "sl: x%02x"; static const char __pyx_k_OL_NORMAL[] = "OL_NORMAL"; static const char __pyx_k_STATS_ALL[] = "STATS_ALL"; static const char __pyx_k_cyddc_pyx[] = "cyddc.pyx"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_print_exc[] = "print_exc"; static const char __pyx_k_traceback[] = "traceback"; static const char __pyx_k_truefalse[] = "truefalse"; static const char __pyx_k_OL_VERBOSE[] = "OL_VERBOSE"; static const char __pyx_k_STATS_NONE[] = "STATS_NONE"; static const char __pyx_k_bytestring[] = "bytestring"; static const char __pyx_k_extract_tb[] = "extract_tb"; static const char __pyx_k_retry_type[] = "retry_type"; static const char __pyx_k_show_stats[] = "show_stats"; static const char __pyx_k_stats_type[] = "stats_type"; static const char __pyx_k_STATS_CALLS[] = "STATS_CALLS"; static const char __pyx_k_STATS_TRIES[] = "STATS_TRIES"; static const char __pyx_k_fcode_x_02x[] = "fcode: x%02x"; static const char __pyx_k_reset_stats[] = "reset_stats"; static const char __pyx_k_STATS_ERRORS[] = "STATS_ERRORS"; static const char __pyx_k_feature_code[] = "feature_code"; static const char __pyx_k_feature_type[] = "feature_type"; static const char __pyx_k_STATS_ELAPSED[] = "STATS_ELAPSED"; static const char __pyx_k_enable_verify[] = "enable_verify"; static const char __pyx_k_extract_stack[] = "extract_stack"; static const char __pyx_k_get_max_tries[] = "get_max_tries"; static const char __pyx_k_set_max_tries[] = "set_max_tries"; static const char __pyx_k_unimplemented[] = "unimplemented"; static const char __pyx_k_BUILT_WITH_ADL[] = "BUILT_WITH_ADL"; static const char __pyx_k_BUILT_WITH_USB[] = "BUILT_WITH_USB"; static const char __pyx_k_DDC_status_s_s[] = "DDC status: %s - %s"; static const char __pyx_k_CYDDC_Exception[] = "CYDDC_Exception"; static const char __pyx_k_TABLE_VCP_VALUE[] = "TABLE_VCP_VALUE"; static const char __pyx_k_create_from_did[] = "create_from_did"; static const char __pyx_k_print_exception[] = "print_exception"; static const char __pyx_k_MULTI_PART_TRIES[] = "MULTI_PART_TRIES"; static const char __pyx_k_WRITE_ONLY_TRIES[] = "WRITE_ONLY_TRIES"; static const char __pyx_k_WRITE_READ_TRIES[] = "WRITE_READ_TRIES"; static const char __pyx_k_create_by_dispno[] = "create_by_dispno"; static const char __pyx_k_ddcutil_version2[] = "ddcutil_version2"; static const char __pyx_k_get_output_level[] = "get_output_level"; static const char __pyx_k_set_output_level[] = "set_output_level"; static const char __pyx_k_check_ddca_status[] = "check_ddca_status"; static const char __pyx_k_get_build_options[] = "get_build_options"; static const char __pyx_k_is_verify_enabled[] = "is_verify_enabled"; static const char __pyx_k_BUILT_WITH_FAILSIM[] = "BUILT_WITH_FAILSIM"; static const char __pyx_k_traceback_print_tb[] = "traceback.print_tb(): "; static const char __pyx_k_NON_TABLE_VCP_VALUE[] = "NON_TABLE_VCP_VALUE"; static const char __pyx_k_traceback_print_exc[] = "traceback.print_exc():"; static const char __pyx_k_create_ddc_exception[] = "create_ddc_exception"; static const char __pyx_k_ddcy_ddcutil_version[] = "ddcy_ddcutil_version"; static const char __pyx_k_CYDDC_Exception___init[] = "CYDDC_Exception.__init__"; static const char __pyx_k_ddcy_get_max_max_tries[] = "ddcy_get_max_max_tries"; static const char __pyx_k_enable_report_ddc_errors[] = "enable_report_ddc_errors"; static const char __pyx_k_traceback_print_exception[] = "traceback.print_exception():"; static const char __pyx_k_ddcy_ddcutil_version_string[] = "ddcy_ddcutil_version_string"; static const char __pyx_k_is_report_ddc_errors_enabled[] = "is_report_ddc_errors_enabled"; static PyObject *__pyx_n_s_BUILT_WITH_ADL; static PyObject *__pyx_n_s_BUILT_WITH_FAILSIM; static PyObject *__pyx_n_s_BUILT_WITH_USB; static PyObject *__pyx_n_s_CYDDC_Exception; static PyObject *__pyx_n_s_CYDDC_Exception___init; static PyObject *__pyx_kp_u_DDC_status_s_s; static PyObject *__pyx_n_s_MULTI_PART_TRIES; static PyObject *__pyx_n_s_NON_TABLE_VCP_VALUE; static PyObject *__pyx_n_s_OL_NORMAL; static PyObject *__pyx_n_s_OL_TERSE; static PyObject *__pyx_n_s_OL_VERBOSE; static PyObject *__pyx_n_s_STATS_ALL; static PyObject *__pyx_n_s_STATS_CALLS; static PyObject *__pyx_n_s_STATS_ELAPSED; static PyObject *__pyx_n_s_STATS_ERRORS; static PyObject *__pyx_n_s_STATS_NONE; static PyObject *__pyx_n_s_STATS_TRIES; static PyObject *__pyx_n_s_TABLE_VCP_VALUE; static PyObject *__pyx_n_s_WRITE_ONLY_TRIES; static PyObject *__pyx_n_s_WRITE_READ_TRIES; static PyObject *__pyx_n_s_bits; static PyObject *__pyx_n_s_bytes; static PyObject *__pyx_n_s_bytestring; static PyObject *__pyx_n_s_check_ddca_status; static PyObject *__pyx_n_s_code; static PyObject *__pyx_n_s_create_by_dispno; static PyObject *__pyx_n_s_create_ddc_exception; static PyObject *__pyx_n_s_create_from_did; static PyObject *__pyx_n_s_ct; static PyObject *__pyx_n_s_cyddc; static PyObject *__pyx_kp_s_cyddc_pyx; static PyObject *__pyx_n_s_ddcutil_version2; static PyObject *__pyx_n_s_ddcy_ddcutil_version; static PyObject *__pyx_n_s_ddcy_ddcutil_version_string; static PyObject *__pyx_n_s_ddcy_get_max_max_tries; static PyObject *__pyx_n_s_depth; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_enable_report_ddc_errors; static PyObject *__pyx_n_s_enable_verify; static PyObject *__pyx_n_s_etype; static PyObject *__pyx_n_s_evalue; static PyObject *__pyx_n_s_exc_info; static PyObject *__pyx_n_s_excp; static PyObject *__pyx_n_s_extract_stack; static PyObject *__pyx_n_s_extract_tb; static PyObject *__pyx_kp_u_fcode_x_02x; static PyObject *__pyx_n_s_feature_code; static PyObject *__pyx_n_s_feature_type; static PyObject *__pyx_n_s_get_build_options; static PyObject *__pyx_n_s_get_max_tries; static PyObject *__pyx_n_s_get_output_level; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_is_report_ddc_errors_enabled; static PyObject *__pyx_n_s_is_verify_enabled; static PyObject *__pyx_n_s_l; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_major; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_mh; static PyObject *__pyx_n_s_micro; static PyObject *__pyx_n_s_minor; static PyObject *__pyx_n_s_ml; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_msg; static PyObject *__pyx_n_s_ol; static PyObject *__pyx_n_s_onoff; static PyObject *__pyx_n_s_open; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_print; static PyObject *__pyx_n_s_print_exc; static PyObject *__pyx_n_s_print_exception; static PyObject *__pyx_n_s_print_tb; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_rc; static PyObject *__pyx_n_s_rc_desc; static PyObject *__pyx_n_s_rc_name; static PyObject *__pyx_n_s_reset_stats; static PyObject *__pyx_n_s_retry_type; static PyObject *__pyx_n_s_s; static PyObject *__pyx_n_s_s0; static PyObject *__pyx_n_s_s2; static PyObject *__pyx_n_s_self; static PyObject *__pyx_n_s_set_max_tries; static PyObject *__pyx_n_s_set_output_level; static PyObject *__pyx_n_s_sh; static PyObject *__pyx_n_s_show_stats; static PyObject *__pyx_n_s_sl; static PyObject *__pyx_kp_u_sl_x_02x; static PyObject *__pyx_n_s_stats_type; static PyObject *__pyx_n_s_status; static PyObject *__pyx_n_s_super; static PyObject *__pyx_n_s_sys; static PyObject *__pyx_n_s_tb; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_traceback; static PyObject *__pyx_kp_u_traceback_print_exc; static PyObject *__pyx_kp_u_traceback_print_exception; static PyObject *__pyx_kp_u_traceback_print_tb; static PyObject *__pyx_n_s_truefalse; static PyObject *__pyx_n_u_unimplemented; static PyObject *__pyx_n_s_v; static PyObject *__pyx_n_s_x; static PyObject *__pyx_n_s_y; static PyObject *__pyx_pf_5cyddc_ddcy_ddcutil_version_string(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_2ddcy_ddcutil_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_4ddcutil_version2(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_6get_build_options(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_8rc_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_code); /* proto */ static PyObject *__pyx_pf_5cyddc_10rc_desc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_code); /* proto */ static PyObject *__pyx_pf_5cyddc_12ddcy_get_max_max_tries(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_14get_max_tries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_retry_type); /* proto */ static PyObject *__pyx_pf_5cyddc_16set_max_tries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_retry_type, PyObject *__pyx_v_ct); /* proto */ static PyObject *__pyx_pf_5cyddc_18enable_verify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_onoff); /* proto */ static PyObject *__pyx_pf_5cyddc_20is_verify_enabled(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_22get_output_level(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_24set_output_level(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ol); /* proto */ static PyObject *__pyx_pf_5cyddc_26enable_report_ddc_errors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_truefalse); /* proto */ static PyObject *__pyx_pf_5cyddc_28is_report_ddc_errors_enabled(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_30reset_stats(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_5cyddc_32show_stats(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stats_type, PyObject *__pyx_v_depth); /* proto */ static PyObject *__pyx_pf_5cyddc_15CYDDC_Exception___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rc, PyObject *__pyx_v_msg); /* proto */ static PyObject *__pyx_pf_5cyddc_34create_ddc_exception(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rc); /* proto */ static PyObject *__pyx_pf_5cyddc_36check_ddca_status(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rc); /* proto */ static PyObject *__pyx_pf_5cyddc_18Display_Identifier_create_by_dispno(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, int __pyx_v_dispno); /* proto */ static PyObject *__pyx_pf_5cyddc_18Display_Identifier_2free(struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_self); /* proto */ static void __pyx_pf_5cyddc_18Display_Identifier_4__dealloc__(struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_18Display_Identifier_6__repr__(struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_11Display_Ref_create_from_did(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_did); /* proto */ static PyObject *__pyx_pf_5cyddc_11Display_Ref_2free(struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_11Display_Ref_4__repr__(struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_11Display_Ref_6dbgrpt(struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_self, int __pyx_v_depth); /* proto */ static int __pyx_pf_5cyddc_9Vcp_Value___init__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_feature_code, int __pyx_v_feature_type); /* proto */ static PyObject *__pyx_pf_5cyddc_9Vcp_Value_12feature_code___get__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self); /* proto */ static int __pyx_pf_5cyddc_9Vcp_Value_12feature_code_2__set__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static PyObject *__pyx_pf_5cyddc_9Vcp_Value_12feature_type___get__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self); /* proto */ static int __pyx_pf_5cyddc_9Vcp_Value_12feature_type_2__set__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_5cyddc_19Non_Table_Vcp_Value___init__(struct __pyx_obj_5cyddc_Non_Table_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_feature_code, PyObject *__pyx_v_mh, PyObject *__pyx_v_ml, PyObject *__pyx_v_sh, PyObject *__pyx_v_sl); /* proto */ static PyObject *__pyx_pf_5cyddc_19Non_Table_Vcp_Value_2cur_val(struct __pyx_obj_5cyddc_Non_Table_Vcp_Value *__pyx_v_self); /* proto */ static int __pyx_pf_5cyddc_15Table_Vcp_Value___init__(struct __pyx_obj_5cyddc_Table_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_feature_code, PyObject *__pyx_v_bytestring); /* proto */ static PyObject *__pyx_pf_5cyddc_14Display_Handle_open(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_dref); /* proto */ static PyObject *__pyx_pf_5cyddc_14Display_Handle_2close(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_14Display_Handle_4__repr__(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_14Display_Handle_6get_capabilities_string(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_5cyddc_14Display_Handle_8get_nontable_vcp_value(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self, PyObject *__pyx_v_feature_code); /* proto */ static PyObject *__pyx_tp_new_5cyddc_Display_Identifier(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5cyddc_Display_Ref(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5cyddc_Vcp_Value(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5cyddc_Non_Table_Vcp_Value(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5cyddc_Table_Vcp_Value(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_5cyddc_Display_Handle(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_16; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__15; static PyObject *__pyx_tuple__17; static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__31; static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__36; static PyObject *__pyx_codeobj__4; static PyObject *__pyx_codeobj__5; static PyObject *__pyx_codeobj__7; static PyObject *__pyx_codeobj__9; static PyObject *__pyx_codeobj__11; static PyObject *__pyx_codeobj__13; static PyObject *__pyx_codeobj__14; static PyObject *__pyx_codeobj__16; static PyObject *__pyx_codeobj__18; static PyObject *__pyx_codeobj__20; static PyObject *__pyx_codeobj__21; static PyObject *__pyx_codeobj__22; static PyObject *__pyx_codeobj__24; static PyObject *__pyx_codeobj__26; static PyObject *__pyx_codeobj__27; static PyObject *__pyx_codeobj__28; static PyObject *__pyx_codeobj__30; static PyObject *__pyx_codeobj__32; static PyObject *__pyx_codeobj__35; static PyObject *__pyx_codeobj__37; /* "cyddc.pyx":47 * int ddca_build_options() * * def ddcy_ddcutil_version_string(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version_string().decode("UTF-8") * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_1ddcy_ddcutil_version_string(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_1ddcy_ddcutil_version_string = {"ddcy_ddcutil_version_string", (PyCFunction)__pyx_pw_5cyddc_1ddcy_ddcutil_version_string, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_1ddcy_ddcutil_version_string(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ddcy_ddcutil_version_string (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_ddcy_ddcutil_version_string(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_ddcy_ddcutil_version_string(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char const *__pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("ddcy_ddcutil_version_string", 0); /* "cyddc.pyx":48 * * def ddcy_ddcutil_version_string(): * return ddca_ddcutil_version_string().decode("UTF-8") # <<<<<<<<<<<<<< * * def ddcy_ddcutil_version(): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ddca_ddcutil_version_string(); __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_r = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "cyddc.pyx":47 * int ddca_build_options() * * def ddcy_ddcutil_version_string(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version_string().decode("UTF-8") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cyddc.ddcy_ddcutil_version_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":50 * return ddca_ddcutil_version_string().decode("UTF-8") * * def ddcy_ddcutil_version(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version() * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_3ddcy_ddcutil_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_3ddcy_ddcutil_version = {"ddcy_ddcutil_version", (PyCFunction)__pyx_pw_5cyddc_3ddcy_ddcutil_version, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_3ddcy_ddcutil_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ddcy_ddcutil_version (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_2ddcy_ddcutil_version(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_2ddcy_ddcutil_version(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("ddcy_ddcutil_version", 0); /* "cyddc.pyx":51 * * def ddcy_ddcutil_version(): * return ddca_ddcutil_version() # <<<<<<<<<<<<<< * * def ddcutil_version2(): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_convert__to_py_DDCA_Ddcutil_Version_Spec(ddca_ddcutil_version()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "cyddc.pyx":50 * return ddca_ddcutil_version_string().decode("UTF-8") * * def ddcy_ddcutil_version(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.ddcy_ddcutil_version", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":53 * return ddca_ddcutil_version() * * def ddcutil_version2(): # <<<<<<<<<<<<<< * v = ddca_ddcutil_version() * return (v.major, v.minor, v.micro) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_5ddcutil_version2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_5ddcutil_version2 = {"ddcutil_version2", (PyCFunction)__pyx_pw_5cyddc_5ddcutil_version2, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_5ddcutil_version2(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ddcutil_version2 (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_4ddcutil_version2(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_4ddcutil_version2(CYTHON_UNUSED PyObject *__pyx_self) { DDCA_Ddcutil_Version_Spec __pyx_v_v; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("ddcutil_version2", 0); /* "cyddc.pyx":54 * * def ddcutil_version2(): * v = ddca_ddcutil_version() # <<<<<<<<<<<<<< * return (v.major, v.minor, v.micro) * */ __pyx_v_v = ddca_ddcutil_version(); /* "cyddc.pyx":55 * def ddcutil_version2(): * v = ddca_ddcutil_version() * return (v.major, v.minor, v.micro) # <<<<<<<<<<<<<< * * BUILT_WITH_ADL = DDCA_BUILT_WITH_ADL */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_v.major); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_v.minor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_v.micro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; /* "cyddc.pyx":53 * return ddca_ddcutil_version() * * def ddcutil_version2(): # <<<<<<<<<<<<<< * v = ddca_ddcutil_version() * return (v.major, v.minor, v.micro) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("cyddc.ddcutil_version2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":62 * * * def get_build_options(): # <<<<<<<<<<<<<< * bits = ddca_build_options() * print(bits) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_7get_build_options(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_7get_build_options = {"get_build_options", (PyCFunction)__pyx_pw_5cyddc_7get_build_options, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_7get_build_options(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_build_options (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_6get_build_options(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_6get_build_options(CYTHON_UNUSED PyObject *__pyx_self) { int __pyx_v_bits; PyObject *__pyx_v_l = NULL; PyObject *__pyx_v_s0 = NULL; PyObject *__pyx_v_s2 = NULL; CYTHON_UNUSED PyObject *__pyx_v_s = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; __Pyx_RefNannySetupContext("get_build_options", 0); /* "cyddc.pyx":63 * * def get_build_options(): * bits = ddca_build_options() # <<<<<<<<<<<<<< * print(bits) * l = [] */ __pyx_v_bits = ddca_build_options(); /* "cyddc.pyx":64 * def get_build_options(): * bits = ddca_build_options() * print(bits) # <<<<<<<<<<<<<< * l = [] * if bits & DDCA_BUILT_WITH_ADL: */ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_bits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":65 * bits = ddca_build_options() * print(bits) * l = [] # <<<<<<<<<<<<<< * if bits & DDCA_BUILT_WITH_ADL: * l.append(BUILT_WITH_ADL) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_l = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":66 * print(bits) * l = [] * if bits & DDCA_BUILT_WITH_ADL: # <<<<<<<<<<<<<< * l.append(BUILT_WITH_ADL) * if bits & DDCA_BUILT_WITH_USB: */ __pyx_t_3 = ((__pyx_v_bits & DDCA_BUILT_WITH_ADL) != 0); if (__pyx_t_3) { /* "cyddc.pyx":67 * l = [] * if bits & DDCA_BUILT_WITH_ADL: * l.append(BUILT_WITH_ADL) # <<<<<<<<<<<<<< * if bits & DDCA_BUILT_WITH_USB: * l.append(BUILT_WITH_USB) */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BUILT_WITH_ADL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_l, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":66 * print(bits) * l = [] * if bits & DDCA_BUILT_WITH_ADL: # <<<<<<<<<<<<<< * l.append(BUILT_WITH_ADL) * if bits & DDCA_BUILT_WITH_USB: */ } /* "cyddc.pyx":68 * if bits & DDCA_BUILT_WITH_ADL: * l.append(BUILT_WITH_ADL) * if bits & DDCA_BUILT_WITH_USB: # <<<<<<<<<<<<<< * l.append(BUILT_WITH_USB) * if bits & DDCA_BUILT_WITH_FAILSIM: */ __pyx_t_3 = ((__pyx_v_bits & DDCA_BUILT_WITH_USB) != 0); if (__pyx_t_3) { /* "cyddc.pyx":69 * l.append(BUILT_WITH_ADL) * if bits & DDCA_BUILT_WITH_USB: * l.append(BUILT_WITH_USB) # <<<<<<<<<<<<<< * if bits & DDCA_BUILT_WITH_FAILSIM: * l.append(BUILT_WITH_FAILSIM) */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BUILT_WITH_USB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_l, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":68 * if bits & DDCA_BUILT_WITH_ADL: * l.append(BUILT_WITH_ADL) * if bits & DDCA_BUILT_WITH_USB: # <<<<<<<<<<<<<< * l.append(BUILT_WITH_USB) * if bits & DDCA_BUILT_WITH_FAILSIM: */ } /* "cyddc.pyx":70 * if bits & DDCA_BUILT_WITH_USB: * l.append(BUILT_WITH_USB) * if bits & DDCA_BUILT_WITH_FAILSIM: # <<<<<<<<<<<<<< * l.append(BUILT_WITH_FAILSIM) * print(l) */ __pyx_t_3 = ((__pyx_v_bits & DDCA_BUILT_WITH_FAILSIM) != 0); if (__pyx_t_3) { /* "cyddc.pyx":71 * l.append(BUILT_WITH_USB) * if bits & DDCA_BUILT_WITH_FAILSIM: * l.append(BUILT_WITH_FAILSIM) # <<<<<<<<<<<<<< * print(l) * s0 = set() */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BUILT_WITH_FAILSIM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_l, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":70 * if bits & DDCA_BUILT_WITH_USB: * l.append(BUILT_WITH_USB) * if bits & DDCA_BUILT_WITH_FAILSIM: # <<<<<<<<<<<<<< * l.append(BUILT_WITH_FAILSIM) * print(l) */ } /* "cyddc.pyx":72 * if bits & DDCA_BUILT_WITH_FAILSIM: * l.append(BUILT_WITH_FAILSIM) * print(l) # <<<<<<<<<<<<<< * s0 = set() * if bits & DDCA_BUILT_WITH_USB: */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_l); __Pyx_GIVEREF(__pyx_v_l); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_l); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":73 * l.append(BUILT_WITH_FAILSIM) * print(l) * s0 = set() # <<<<<<<<<<<<<< * if bits & DDCA_BUILT_WITH_USB: * s0.add(BUILT_WITH_USB) */ __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_s0 = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":74 * print(l) * s0 = set() * if bits & DDCA_BUILT_WITH_USB: # <<<<<<<<<<<<<< * s0.add(BUILT_WITH_USB) * print(s0) */ __pyx_t_3 = ((__pyx_v_bits & DDCA_BUILT_WITH_USB) != 0); if (__pyx_t_3) { /* "cyddc.pyx":75 * s0 = set() * if bits & DDCA_BUILT_WITH_USB: * s0.add(BUILT_WITH_USB) # <<<<<<<<<<<<<< * print(s0) * s2 = frozenset(s0) */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_BUILT_WITH_USB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PySet_Add(__pyx_v_s0, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":74 * print(l) * s0 = set() * if bits & DDCA_BUILT_WITH_USB: # <<<<<<<<<<<<<< * s0.add(BUILT_WITH_USB) * print(s0) */ } /* "cyddc.pyx":76 * if bits & DDCA_BUILT_WITH_USB: * s0.add(BUILT_WITH_USB) * print(s0) # <<<<<<<<<<<<<< * s2 = frozenset(s0) * s = frozenset(l) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_s0); __Pyx_GIVEREF(__pyx_v_s0); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s0); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":77 * s0.add(BUILT_WITH_USB) * print(s0) * s2 = frozenset(s0) # <<<<<<<<<<<<<< * s = frozenset(l) * return s2 */ __pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_v_s0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_s2 = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":78 * print(s0) * s2 = frozenset(s0) * s = frozenset(l) # <<<<<<<<<<<<<< * return s2 * */ __pyx_t_1 = __Pyx_PyFrozenSet_New(__pyx_v_l); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_s = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":79 * s2 = frozenset(s0) * s = frozenset(l) * return s2 # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_s2); __pyx_r = __pyx_v_s2; goto __pyx_L0; /* "cyddc.pyx":62 * * * def get_build_options(): # <<<<<<<<<<<<<< * bits = ddca_build_options() * print(bits) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cyddc.get_build_options", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_l); __Pyx_XDECREF(__pyx_v_s0); __Pyx_XDECREF(__pyx_v_s2); __Pyx_XDECREF(__pyx_v_s); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":90 * char * ddca_rc_desc(int status_code) * * def rc_name(code): # <<<<<<<<<<<<<< * return ddca_rc_name(code).decode("UTF-8") * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_9rc_name(PyObject *__pyx_self, PyObject *__pyx_v_code); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_9rc_name = {"rc_name", (PyCFunction)__pyx_pw_5cyddc_9rc_name, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_9rc_name(PyObject *__pyx_self, PyObject *__pyx_v_code) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rc_name (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_8rc_name(__pyx_self, ((PyObject *)__pyx_v_code)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_8rc_name(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_code) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; char *__pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("rc_name", 0); /* "cyddc.pyx":91 * * def rc_name(code): * return ddca_rc_name(code).decode("UTF-8") # <<<<<<<<<<<<<< * * def rc_desc(code): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_code); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error) __pyx_t_2 = ddca_rc_name(__pyx_t_1); __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_2, 0, strlen(__pyx_t_2), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_3); __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "cyddc.pyx":90 * char * ddca_rc_desc(int status_code) * * def rc_name(code): # <<<<<<<<<<<<<< * return ddca_rc_name(code).decode("UTF-8") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("cyddc.rc_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":93 * return ddca_rc_name(code).decode("UTF-8") * * def rc_desc(code): # <<<<<<<<<<<<<< * return ddca_rc_desc(code).decode("UTF-8") * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_11rc_desc(PyObject *__pyx_self, PyObject *__pyx_v_code); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_11rc_desc = {"rc_desc", (PyCFunction)__pyx_pw_5cyddc_11rc_desc, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_11rc_desc(PyObject *__pyx_self, PyObject *__pyx_v_code) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rc_desc (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_10rc_desc(__pyx_self, ((PyObject *)__pyx_v_code)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_10rc_desc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_code) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; char *__pyx_t_2; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("rc_desc", 0); /* "cyddc.pyx":94 * * def rc_desc(code): * return ddca_rc_desc(code).decode("UTF-8") # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_code); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error) __pyx_t_2 = ddca_rc_desc(__pyx_t_1); __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_2, 0, strlen(__pyx_t_2), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_3); __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "cyddc.pyx":93 * return ddca_rc_name(code).decode("UTF-8") * * def rc_desc(code): # <<<<<<<<<<<<<< * return ddca_rc_desc(code).decode("UTF-8") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("cyddc.rc_desc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":122 * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES * * def ddcy_get_max_max_tries(): # <<<<<<<<<<<<<< * return ddca_max_max_tries() * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_13ddcy_get_max_max_tries(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_13ddcy_get_max_max_tries = {"ddcy_get_max_max_tries", (PyCFunction)__pyx_pw_5cyddc_13ddcy_get_max_max_tries, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_13ddcy_get_max_max_tries(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ddcy_get_max_max_tries (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_12ddcy_get_max_max_tries(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_12ddcy_get_max_max_tries(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("ddcy_get_max_max_tries", 0); /* "cyddc.pyx":123 * * def ddcy_get_max_max_tries(): * return ddca_max_max_tries() # <<<<<<<<<<<<<< * * def get_max_tries(retry_type): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(ddca_max_max_tries()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "cyddc.pyx":122 * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES * * def ddcy_get_max_max_tries(): # <<<<<<<<<<<<<< * return ddca_max_max_tries() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.ddcy_get_max_max_tries", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":125 * return ddca_max_max_tries() * * def get_max_tries(retry_type): # <<<<<<<<<<<<<< * return ddca_get_max_tries(retry_type) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_15get_max_tries(PyObject *__pyx_self, PyObject *__pyx_v_retry_type); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_15get_max_tries = {"get_max_tries", (PyCFunction)__pyx_pw_5cyddc_15get_max_tries, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_15get_max_tries(PyObject *__pyx_self, PyObject *__pyx_v_retry_type) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_max_tries (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_14get_max_tries(__pyx_self, ((PyObject *)__pyx_v_retry_type)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_14get_max_tries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_retry_type) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("get_max_tries", 0); /* "cyddc.pyx":126 * * def get_max_tries(retry_type): * return ddca_get_max_tries(retry_type) # <<<<<<<<<<<<<< * * def set_max_tries(retry_type, ct): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_retry_type); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_From_int(ddca_get_max_tries(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "cyddc.pyx":125 * return ddca_max_max_tries() * * def get_max_tries(retry_type): # <<<<<<<<<<<<<< * return ddca_get_max_tries(retry_type) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cyddc.get_max_tries", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":128 * return ddca_get_max_tries(retry_type) * * def set_max_tries(retry_type, ct): # <<<<<<<<<<<<<< * ddca_set_max_tries(retry_type, ct) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_17set_max_tries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_17set_max_tries = {"set_max_tries", (PyCFunction)__pyx_pw_5cyddc_17set_max_tries, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_5cyddc_17set_max_tries(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_retry_type = 0; PyObject *__pyx_v_ct = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_max_tries (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_retry_type,&__pyx_n_s_ct,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_retry_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ct)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_max_tries", 1, 2, 2, 1); __PYX_ERR(0, 128, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_max_tries") < 0)) __PYX_ERR(0, 128, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_retry_type = values[0]; __pyx_v_ct = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("set_max_tries", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 128, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cyddc.set_max_tries", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_16set_max_tries(__pyx_self, __pyx_v_retry_type, __pyx_v_ct); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_16set_max_tries(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_retry_type, PyObject *__pyx_v_ct) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("set_max_tries", 0); /* "cyddc.pyx":129 * * def set_max_tries(retry_type, ct): * ddca_set_max_tries(retry_type, ct) # <<<<<<<<<<<<<< * * def enable_verify(onoff): */ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_retry_type); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_ct); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L1_error) ddca_set_max_tries(__pyx_t_1, __pyx_t_2); /* "cyddc.pyx":128 * return ddca_get_max_tries(retry_type) * * def set_max_tries(retry_type, ct): # <<<<<<<<<<<<<< * ddca_set_max_tries(retry_type, ct) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.set_max_tries", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":131 * ddca_set_max_tries(retry_type, ct) * * def enable_verify(onoff): # <<<<<<<<<<<<<< * ddca_enable_verify(onoff) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_19enable_verify(PyObject *__pyx_self, PyObject *__pyx_v_onoff); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_19enable_verify = {"enable_verify", (PyCFunction)__pyx_pw_5cyddc_19enable_verify, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_19enable_verify(PyObject *__pyx_self, PyObject *__pyx_v_onoff) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("enable_verify (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_18enable_verify(__pyx_self, ((PyObject *)__pyx_v_onoff)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_18enable_verify(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_onoff) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("enable_verify", 0); /* "cyddc.pyx":132 * * def enable_verify(onoff): * ddca_enable_verify(onoff) # <<<<<<<<<<<<<< * * def is_verify_enabled(): */ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_onoff); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) ddca_enable_verify(__pyx_t_1); /* "cyddc.pyx":131 * ddca_set_max_tries(retry_type, ct) * * def enable_verify(onoff): # <<<<<<<<<<<<<< * ddca_enable_verify(onoff) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.enable_verify", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":134 * ddca_enable_verify(onoff) * * def is_verify_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_verify_enabled()) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_21is_verify_enabled(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_21is_verify_enabled = {"is_verify_enabled", (PyCFunction)__pyx_pw_5cyddc_21is_verify_enabled, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_21is_verify_enabled(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_verify_enabled (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_20is_verify_enabled(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_20is_verify_enabled(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; __Pyx_RefNannySetupContext("is_verify_enabled", 0); /* "cyddc.pyx":135 * * def is_verify_enabled(): * return bool(ddca_is_verify_enabled()) # <<<<<<<<<<<<<< * * # */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(ddca_is_verify_enabled()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "cyddc.pyx":134 * ddca_enable_verify(onoff) * * def is_verify_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_verify_enabled()) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.is_verify_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":162 * OL_VERBOSE = DDCA_OL_VERBOSE * * def get_output_level(): # <<<<<<<<<<<<<< * return ddca_get_output_level() * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_23get_output_level(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_23get_output_level = {"get_output_level", (PyCFunction)__pyx_pw_5cyddc_23get_output_level, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_23get_output_level(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_output_level (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_22get_output_level(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_22get_output_level(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_output_level", 0); /* "cyddc.pyx":163 * * def get_output_level(): * return ddca_get_output_level() # <<<<<<<<<<<<<< * * def set_output_level(ol): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(ddca_get_output_level()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "cyddc.pyx":162 * OL_VERBOSE = DDCA_OL_VERBOSE * * def get_output_level(): # <<<<<<<<<<<<<< * return ddca_get_output_level() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.get_output_level", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":165 * return ddca_get_output_level() * * def set_output_level(ol): # <<<<<<<<<<<<<< * ddca_set_output_level(ol) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_25set_output_level(PyObject *__pyx_self, PyObject *__pyx_v_ol); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_25set_output_level = {"set_output_level", (PyCFunction)__pyx_pw_5cyddc_25set_output_level, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_25set_output_level(PyObject *__pyx_self, PyObject *__pyx_v_ol) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_output_level (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_24set_output_level(__pyx_self, ((PyObject *)__pyx_v_ol)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_24set_output_level(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ol) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_output_level", 0); /* "cyddc.pyx":166 * * def set_output_level(ol): * ddca_set_output_level(ol) # <<<<<<<<<<<<<< * * def enable_report_ddc_errors(truefalse): */ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_ol); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error) ddca_set_output_level(__pyx_t_1); /* "cyddc.pyx":165 * return ddca_get_output_level() * * def set_output_level(ol): # <<<<<<<<<<<<<< * ddca_set_output_level(ol) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.set_output_level", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":168 * ddca_set_output_level(ol) * * def enable_report_ddc_errors(truefalse): # <<<<<<<<<<<<<< * ddca_set_output_level(truefalse) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_27enable_report_ddc_errors(PyObject *__pyx_self, PyObject *__pyx_v_truefalse); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_27enable_report_ddc_errors = {"enable_report_ddc_errors", (PyCFunction)__pyx_pw_5cyddc_27enable_report_ddc_errors, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_27enable_report_ddc_errors(PyObject *__pyx_self, PyObject *__pyx_v_truefalse) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("enable_report_ddc_errors (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_26enable_report_ddc_errors(__pyx_self, ((PyObject *)__pyx_v_truefalse)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_26enable_report_ddc_errors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_truefalse) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("enable_report_ddc_errors", 0); /* "cyddc.pyx":169 * * def enable_report_ddc_errors(truefalse): * ddca_set_output_level(truefalse) # <<<<<<<<<<<<<< * * def is_report_ddc_errors_enabled(): */ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_truefalse); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L1_error) ddca_set_output_level(__pyx_t_1); /* "cyddc.pyx":168 * ddca_set_output_level(ol) * * def enable_report_ddc_errors(truefalse): # <<<<<<<<<<<<<< * ddca_set_output_level(truefalse) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.enable_report_ddc_errors", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":171 * ddca_set_output_level(truefalse) * * def is_report_ddc_errors_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_report_ddc_errors_enabled()) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_29is_report_ddc_errors_enabled(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_29is_report_ddc_errors_enabled = {"is_report_ddc_errors_enabled", (PyCFunction)__pyx_pw_5cyddc_29is_report_ddc_errors_enabled, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_29is_report_ddc_errors_enabled(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_report_ddc_errors_enabled (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_28is_report_ddc_errors_enabled(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_28is_report_ddc_errors_enabled(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; __Pyx_RefNannySetupContext("is_report_ddc_errors_enabled", 0); /* "cyddc.pyx":172 * * def is_report_ddc_errors_enabled(): * return bool(ddca_is_report_ddc_errors_enabled()) # <<<<<<<<<<<<<< * * # */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(ddca_is_report_ddc_errors_enabled()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "cyddc.pyx":171 * ddca_set_output_level(truefalse) * * def is_report_ddc_errors_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_report_ddc_errors_enabled()) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.is_report_ddc_errors_enabled", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":199 * STATS_ALL = DDCA_STATS_ALL * * def reset_stats(): # <<<<<<<<<<<<<< * ddca_reset_stats() * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_31reset_stats(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_31reset_stats = {"reset_stats", (PyCFunction)__pyx_pw_5cyddc_31reset_stats, METH_NOARGS, 0}; static PyObject *__pyx_pw_5cyddc_31reset_stats(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset_stats (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_30reset_stats(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_30reset_stats(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reset_stats", 0); /* "cyddc.pyx":200 * * def reset_stats(): * ddca_reset_stats() # <<<<<<<<<<<<<< * * def show_stats(stats_type, depth): */ ddca_reset_stats(); /* "cyddc.pyx":199 * STATS_ALL = DDCA_STATS_ALL * * def reset_stats(): # <<<<<<<<<<<<<< * ddca_reset_stats() * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":202 * ddca_reset_stats() * * def show_stats(stats_type, depth): # <<<<<<<<<<<<<< * # TODO: verify that depth is integer, raise exception if not * ddca_show_stats(stats_type, depth) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_33show_stats(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_33show_stats = {"show_stats", (PyCFunction)__pyx_pw_5cyddc_33show_stats, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_5cyddc_33show_stats(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_stats_type = 0; PyObject *__pyx_v_depth = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("show_stats (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stats_type,&__pyx_n_s_depth,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stats_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("show_stats", 1, 2, 2, 1); __PYX_ERR(0, 202, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "show_stats") < 0)) __PYX_ERR(0, 202, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_stats_type = values[0]; __pyx_v_depth = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("show_stats", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 202, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cyddc.show_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_32show_stats(__pyx_self, __pyx_v_stats_type, __pyx_v_depth); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_32show_stats(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_stats_type, PyObject *__pyx_v_depth) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("show_stats", 0); /* "cyddc.pyx":204 * def show_stats(stats_type, depth): * # TODO: verify that depth is integer, raise exception if not * ddca_show_stats(stats_type, depth) # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_stats_type); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_depth); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error) ddca_show_stats(__pyx_t_1, __pyx_t_2); /* "cyddc.pyx":202 * ddca_reset_stats() * * def show_stats(stats_type, depth): # <<<<<<<<<<<<<< * # TODO: verify that depth is integer, raise exception if not * ddca_show_stats(stats_type, depth) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.show_stats", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":215 * class CYDDC_Exception(Exception): * * def __init__(self, rc, msg=None): # <<<<<<<<<<<<<< * if msg is None: * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_15CYDDC_Exception_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_15CYDDC_Exception_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5cyddc_15CYDDC_Exception_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_5cyddc_15CYDDC_Exception_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_rc = 0; PyObject *__pyx_v_msg = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_rc,&__pyx_n_s_msg,0}; PyObject* values[3] = {0,0,0}; values[2] = ((PyObject *)((PyObject *)Py_None)); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rc)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); __PYX_ERR(0, 215, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_msg); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 215, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_self = values[0]; __pyx_v_rc = values[1]; __pyx_v_msg = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 215, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cyddc.CYDDC_Exception.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_15CYDDC_Exception___init__(__pyx_self, __pyx_v_self, __pyx_v_rc, __pyx_v_msg); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_15CYDDC_Exception___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_rc, PyObject *__pyx_v_msg) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("__init__", 0); __Pyx_INCREF(__pyx_v_msg); /* "cyddc.pyx":216 * * def __init__(self, rc, msg=None): * if msg is None: # <<<<<<<<<<<<<< * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) * super(CYDDC_Exception, self).__init__(msg) */ __pyx_t_1 = (__pyx_v_msg == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "cyddc.pyx":217 * def __init__(self, rc, msg=None): * if msg is None: * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) # <<<<<<<<<<<<<< * super(CYDDC_Exception, self).__init__(msg) * self.status = rc */ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_rc_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_5) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_rc}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_rc}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_rc); __Pyx_GIVEREF(__pyx_v_rc); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_rc); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_rc_desc); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } if (!__pyx_t_5) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_rc}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_rc}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif { __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_rc); __Pyx_GIVEREF(__pyx_v_rc); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_rc); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyUnicode_Format(__pyx_kp_u_DDC_status_s_s, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_4); __pyx_t_4 = 0; /* "cyddc.pyx":216 * * def __init__(self, rc, msg=None): * if msg is None: # <<<<<<<<<<<<<< * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) * super(CYDDC_Exception, self).__init__(msg) */ } /* "cyddc.pyx":218 * if msg is None: * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) * super(CYDDC_Exception, self).__init__(msg) # <<<<<<<<<<<<<< * self.status = rc * */ __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_CYDDC_Exception); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_6) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_msg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_msg}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_msg}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif { __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_v_msg); __Pyx_GIVEREF(__pyx_v_msg); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_msg); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "cyddc.pyx":219 * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) * super(CYDDC_Exception, self).__init__(msg) * self.status = rc # <<<<<<<<<<<<<< * * */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status, __pyx_v_rc) < 0) __PYX_ERR(0, 219, __pyx_L1_error) /* "cyddc.pyx":215 * class CYDDC_Exception(Exception): * * def __init__(self, rc, msg=None): # <<<<<<<<<<<<<< * if msg is None: * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cyddc.CYDDC_Exception.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_msg); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":222 * * * def create_ddc_exception(int rc): # <<<<<<<<<<<<<< * # To do: test for rc values that map to standard Python exceptions * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_35create_ddc_exception(PyObject *__pyx_self, PyObject *__pyx_arg_rc); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_35create_ddc_exception = {"create_ddc_exception", (PyCFunction)__pyx_pw_5cyddc_35create_ddc_exception, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_35create_ddc_exception(PyObject *__pyx_self, PyObject *__pyx_arg_rc) { int __pyx_v_rc; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("create_ddc_exception (wrapper)", 0); assert(__pyx_arg_rc); { __pyx_v_rc = __Pyx_PyInt_As_int(__pyx_arg_rc); if (unlikely((__pyx_v_rc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 222, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("cyddc.create_ddc_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_34create_ddc_exception(__pyx_self, ((int)__pyx_v_rc)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_34create_ddc_exception(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rc) { PyObject *__pyx_v_excp = NULL; PyObject *__pyx_v_etype = NULL; PyObject *__pyx_v_evalue = NULL; PyObject *__pyx_v_tb = NULL; PyObject *__pyx_v_x = NULL; PyObject *__pyx_v_y = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; __Pyx_RefNannySetupContext("create_ddc_exception", 0); /* "cyddc.pyx":225 * # To do: test for rc values that map to standard Python exceptions * * excp = CYDDC_Exception(rc) # ??? # <<<<<<<<<<<<<< * # To do: adjust the stack * (etype, evalue, tb) = sys.exc_info() */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CYDDC_Exception); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_4) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_excp = __pyx_t_1; __pyx_t_1 = 0; /* "cyddc.pyx":227 * excp = CYDDC_Exception(rc) # ??? * # To do: adjust the stack * (etype, evalue, tb) = sys.exc_info() # <<<<<<<<<<<<<< * print("traceback.print_tb(): ") * traceback.print_tb(tb) */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if !CYTHON_COMPILING_IN_PYPY Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 227, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); __pyx_t_3 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 2; __pyx_t_3 = __pyx_t_6(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_4), 3) < 0) __PYX_ERR(0, 227, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 227, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_etype = __pyx_t_5; __pyx_t_5 = 0; __pyx_v_evalue = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_tb = __pyx_t_3; __pyx_t_3 = 0; /* "cyddc.pyx":228 * # To do: adjust the stack * (etype, evalue, tb) = sys.exc_info() * print("traceback.print_tb(): ") # <<<<<<<<<<<<<< * traceback.print_tb(tb) * print("traceback.print_exception():") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":229 * (etype, evalue, tb) = sys.exc_info() * print("traceback.print_tb(): ") * traceback.print_tb(tb) # <<<<<<<<<<<<<< * print("traceback.print_exception():") * traceback.print_exception(etype, evalue, tb) */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_print_tb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_tb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_tb); __Pyx_GIVEREF(__pyx_v_tb); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_tb); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":230 * print("traceback.print_tb(): ") * traceback.print_tb(tb) * print("traceback.print_exception():") # <<<<<<<<<<<<<< * traceback.print_exception(etype, evalue, tb) * print("traceback.print_exc():") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":231 * traceback.print_tb(tb) * print("traceback.print_exception():") * traceback.print_exception(etype, evalue, tb) # <<<<<<<<<<<<<< * print("traceback.print_exc():") * traceback.print_exc() */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_print_exception); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_etype, __pyx_v_evalue, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_etype, __pyx_v_evalue, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_3 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_INCREF(__pyx_v_etype); __Pyx_GIVEREF(__pyx_v_etype); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_v_etype); __Pyx_INCREF(__pyx_v_evalue); __Pyx_GIVEREF(__pyx_v_evalue); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_v_evalue); __Pyx_INCREF(__pyx_v_tb); __Pyx_GIVEREF(__pyx_v_tb); PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_7, __pyx_v_tb); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":232 * print("traceback.print_exception():") * traceback.print_exception(etype, evalue, tb) * print("traceback.print_exc():") # <<<<<<<<<<<<<< * traceback.print_exc() * */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":233 * traceback.print_exception(etype, evalue, tb) * print("traceback.print_exc():") * traceback.print_exc() # <<<<<<<<<<<<<< * * x = traceback.extract_tb(tb) */ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_5) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":235 * traceback.print_exc() * * x = traceback.extract_tb(tb) # <<<<<<<<<<<<<< * print(type(x)) * print(x) */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_extract_tb); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_tb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_tb); __Pyx_GIVEREF(__pyx_v_tb); PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_tb); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_x = __pyx_t_1; __pyx_t_1 = 0; /* "cyddc.pyx":236 * * x = traceback.extract_tb(tb) * print(type(x)) # <<<<<<<<<<<<<< * print(x) * y = traceback.extract_stack(tb) */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_x))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_x))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(__pyx_v_x))); __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "cyddc.pyx":237 * x = traceback.extract_tb(tb) * print(type(x)) * print(x) # <<<<<<<<<<<<<< * y = traceback.extract_stack(tb) * print(type(y)) */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":238 * print(type(x)) * print(x) * y = traceback.extract_stack(tb) # <<<<<<<<<<<<<< * print(type(y)) * print(y) */ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_extract_stack); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_5) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_tb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_tb}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_tb); __Pyx_GIVEREF(__pyx_v_tb); PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_tb); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_y = __pyx_t_1; __pyx_t_1 = 0; /* "cyddc.pyx":239 * print(x) * y = traceback.extract_stack(tb) * print(type(y)) # <<<<<<<<<<<<<< * print(y) * */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_y))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_v_y))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(__pyx_v_y))); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":240 * y = traceback.extract_stack(tb) * print(type(y)) * print(y) # <<<<<<<<<<<<<< * * print(excp) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_y); __Pyx_GIVEREF(__pyx_v_y); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":242 * print(y) * * print(excp) # <<<<<<<<<<<<<< * return excp * */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_excp); __Pyx_GIVEREF(__pyx_v_excp); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_excp); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":243 * * print(excp) * return excp # <<<<<<<<<<<<<< * * def check_ddca_status(int rc): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_excp); __pyx_r = __pyx_v_excp; goto __pyx_L0; /* "cyddc.pyx":222 * * * def create_ddc_exception(int rc): # <<<<<<<<<<<<<< * # To do: test for rc values that map to standard Python exceptions * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("cyddc.create_ddc_exception", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XDECREF(__pyx_v_etype); __Pyx_XDECREF(__pyx_v_evalue); __Pyx_XDECREF(__pyx_v_tb); __Pyx_XDECREF(__pyx_v_x); __Pyx_XDECREF(__pyx_v_y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":245 * return excp * * def check_ddca_status(int rc): # <<<<<<<<<<<<<< * if (rc != 0): * excp = CYDDC_Exception(rc) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_37check_ddca_status(PyObject *__pyx_self, PyObject *__pyx_arg_rc); /*proto*/ static PyMethodDef __pyx_mdef_5cyddc_37check_ddca_status = {"check_ddca_status", (PyCFunction)__pyx_pw_5cyddc_37check_ddca_status, METH_O, 0}; static PyObject *__pyx_pw_5cyddc_37check_ddca_status(PyObject *__pyx_self, PyObject *__pyx_arg_rc) { int __pyx_v_rc; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("check_ddca_status (wrapper)", 0); assert(__pyx_arg_rc); { __pyx_v_rc = __Pyx_PyInt_As_int(__pyx_arg_rc); if (unlikely((__pyx_v_rc == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("cyddc.check_ddca_status", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_36check_ddca_status(__pyx_self, ((int)__pyx_v_rc)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_36check_ddca_status(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rc) { PyObject *__pyx_v_excp = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("check_ddca_status", 0); /* "cyddc.pyx":246 * * def check_ddca_status(int rc): * if (rc != 0): # <<<<<<<<<<<<<< * excp = CYDDC_Exception(rc) * # (etype, evalue, tb) = sys.exc_info() */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":247 * def check_ddca_status(int rc): * if (rc != 0): * excp = CYDDC_Exception(rc) # <<<<<<<<<<<<<< * # (etype, evalue, tb) = sys.exc_info() * */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_CYDDC_Exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":251 * * * print(excp) # <<<<<<<<<<<<<< * raise excp * */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_excp); __Pyx_GIVEREF(__pyx_v_excp); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_excp); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "cyddc.pyx":252 * * print(excp) * raise excp # <<<<<<<<<<<<<< * * # */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 252, __pyx_L1_error) /* "cyddc.pyx":246 * * def check_ddca_status(int rc): * if (rc != 0): # <<<<<<<<<<<<<< * excp = CYDDC_Exception(rc) * # (etype, evalue, tb) = sys.exc_info() */ } /* "cyddc.pyx":245 * return excp * * def check_ddca_status(int rc): # <<<<<<<<<<<<<< * if (rc != 0): * excp = CYDDC_Exception(rc) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.check_ddca_status", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":406 * * @classmethod * def create_by_dispno(cls, int dispno): # <<<<<<<<<<<<<< * cdef void * c_did * rc = ddca_create_dispno_display_identifier(dispno, &c_did) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_18Display_Identifier_1create_by_dispno(PyObject *__pyx_v_cls, PyObject *__pyx_arg_dispno); /*proto*/ static PyObject *__pyx_pw_5cyddc_18Display_Identifier_1create_by_dispno(PyObject *__pyx_v_cls, PyObject *__pyx_arg_dispno) { int __pyx_v_dispno; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("create_by_dispno (wrapper)", 0); assert(__pyx_arg_dispno); { __pyx_v_dispno = __Pyx_PyInt_As_int(__pyx_arg_dispno); if (unlikely((__pyx_v_dispno == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("cyddc.Display_Identifier.create_by_dispno", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_18Display_Identifier_create_by_dispno(((PyTypeObject*)__pyx_v_cls), ((int)__pyx_v_dispno)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_18Display_Identifier_create_by_dispno(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, int __pyx_v_dispno) { void *__pyx_v_c_did; int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("create_by_dispno", 0); /* "cyddc.pyx":408 * def create_by_dispno(cls, int dispno): * cdef void * c_did * rc = ddca_create_dispno_display_identifier(dispno, &c_did) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_create_dispno_display_identifier(__pyx_v_dispno, (&__pyx_v_c_did)); /* "cyddc.pyx":409 * cdef void * c_did * rc = ddca_create_dispno_display_identifier(dispno, &c_did) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":410 * rc = ddca_create_dispno_display_identifier(dispno, &c_did) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * result = Display_Identifier() */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":411 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * result = Display_Identifier() * result.c_did = c_did */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 411, __pyx_L1_error) /* "cyddc.pyx":409 * cdef void * c_did * rc = ddca_create_dispno_display_identifier(dispno, &c_did) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":412 * excp = create_ddc_exception(rc) * raise excp * result = Display_Identifier() # <<<<<<<<<<<<<< * result.c_did = c_did * return result */ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5cyddc_Display_Identifier), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_result = ((struct __pyx_obj_5cyddc_Display_Identifier *)__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":413 * raise excp * result = Display_Identifier() * result.c_did = c_did # <<<<<<<<<<<<<< * return result * */ __pyx_v_result->c_did = __pyx_v_c_did; /* "cyddc.pyx":414 * result = Display_Identifier() * result.c_did = c_did * return result # <<<<<<<<<<<<<< * * def free(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; /* "cyddc.pyx":406 * * @classmethod * def create_by_dispno(cls, int dispno): # <<<<<<<<<<<<<< * cdef void * c_did * rc = ddca_create_dispno_display_identifier(dispno, &c_did) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Display_Identifier.create_by_dispno", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":416 * return result * * def free(self): # <<<<<<<<<<<<<< * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_18Display_Identifier_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_5cyddc_18Display_Identifier_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("free (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_18Display_Identifier_2free(((struct __pyx_obj_5cyddc_Display_Identifier *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_18Display_Identifier_2free(struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_self) { int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("free", 0); /* "cyddc.pyx":417 * * def free(self): * rc = ddca_free_display_identifier(self.c_did) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_free_display_identifier(__pyx_v_self->c_did); /* "cyddc.pyx":418 * def free(self): * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":419 * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":420 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * * # or ? */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 420, __pyx_L1_error) /* "cyddc.pyx":418 * def free(self): * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":416 * return result * * def free(self): # <<<<<<<<<<<<<< * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Display_Identifier.free", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":423 * * # or ? * def __dealloc__(self): # <<<<<<<<<<<<<< * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: */ /* Python wrapper */ static void __pyx_pw_5cyddc_18Display_Identifier_5__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_5cyddc_18Display_Identifier_5__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_5cyddc_18Display_Identifier_4__dealloc__(((struct __pyx_obj_5cyddc_Display_Identifier *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_5cyddc_18Display_Identifier_4__dealloc__(struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_self) { int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "cyddc.pyx":424 * # or ? * def __dealloc__(self): * rc = ddca_free_display_identifier(self.c_did) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_free_display_identifier(__pyx_v_self->c_did); /* "cyddc.pyx":425 * def __dealloc__(self): * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":426 * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":427 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * * */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 427, __pyx_L1_error) /* "cyddc.pyx":425 * def __dealloc__(self): * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":423 * * # or ? * def __dealloc__(self): # <<<<<<<<<<<<<< * rc = ddca_free_display_identifier(self.c_did) * if rc != 0: */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_WriteUnraisable("cyddc.Display_Identifier.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_RefNannyFinishContext(); } /* "cyddc.pyx":430 * * * def __repr__(self): # <<<<<<<<<<<<<< * return ddca_did_repr(self.c_did).decode("UTF-8") * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_18Display_Identifier_7__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5cyddc_18Display_Identifier_7__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_18Display_Identifier_6__repr__(((struct __pyx_obj_5cyddc_Display_Identifier *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_18Display_Identifier_6__repr__(struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); /* "cyddc.pyx":431 * * def __repr__(self): * return ddca_did_repr(self.c_did).decode("UTF-8") # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ddca_did_repr(__pyx_v_self->c_did); __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 431, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_r = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "cyddc.pyx":430 * * * def __repr__(self): # <<<<<<<<<<<<<< * return ddca_did_repr(self.c_did).decode("UTF-8") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cyddc.Display_Identifier.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":443 * * @classmethod * def create_from_did(cls, Display_Identifier did): # <<<<<<<<<<<<<< * cdef void * c_dref * rc = ddca_create_display_ref(did.c_did, &c_dref) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_11Display_Ref_1create_from_did(PyObject *__pyx_v_cls, PyObject *__pyx_v_did); /*proto*/ static PyObject *__pyx_pw_5cyddc_11Display_Ref_1create_from_did(PyObject *__pyx_v_cls, PyObject *__pyx_v_did) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("create_from_did (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_did), __pyx_ptype_5cyddc_Display_Identifier, 1, "did", 0))) __PYX_ERR(0, 443, __pyx_L1_error) __pyx_r = __pyx_pf_5cyddc_11Display_Ref_create_from_did(((PyTypeObject*)__pyx_v_cls), ((struct __pyx_obj_5cyddc_Display_Identifier *)__pyx_v_did)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_11Display_Ref_create_from_did(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct __pyx_obj_5cyddc_Display_Identifier *__pyx_v_did) { void *__pyx_v_c_dref; int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_dref = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("create_from_did", 0); /* "cyddc.pyx":445 * def create_from_did(cls, Display_Identifier did): * cdef void * c_dref * rc = ddca_create_display_ref(did.c_did, &c_dref) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_create_display_ref(__pyx_v_did->c_did, (&__pyx_v_c_dref)); /* "cyddc.pyx":446 * cdef void * c_dref * rc = ddca_create_display_ref(did.c_did, &c_dref) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":447 * rc = ddca_create_display_ref(did.c_did, &c_dref) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * dref = Display_Ref() */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":448 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * dref = Display_Ref() * dref.c_dref = c_dref */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 448, __pyx_L1_error) /* "cyddc.pyx":446 * cdef void * c_dref * rc = ddca_create_display_ref(did.c_did, &c_dref) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":449 * excp = create_ddc_exception(rc) * raise excp * dref = Display_Ref() # <<<<<<<<<<<<<< * dref.c_dref = c_dref * return dref */ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5cyddc_Display_Ref), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_dref = ((struct __pyx_obj_5cyddc_Display_Ref *)__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":450 * raise excp * dref = Display_Ref() * dref.c_dref = c_dref # <<<<<<<<<<<<<< * return dref * */ __pyx_v_dref->c_dref = __pyx_v_c_dref; /* "cyddc.pyx":451 * dref = Display_Ref() * dref.c_dref = c_dref * return dref # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_dref)); __pyx_r = ((PyObject *)__pyx_v_dref); goto __pyx_L0; /* "cyddc.pyx":443 * * @classmethod * def create_from_did(cls, Display_Identifier did): # <<<<<<<<<<<<<< * cdef void * c_dref * rc = ddca_create_display_ref(did.c_did, &c_dref) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Display_Ref.create_from_did", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XDECREF((PyObject *)__pyx_v_dref); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":454 * * * def free(self): # <<<<<<<<<<<<<< * ddca_free_display_ref(self.c_dref) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_11Display_Ref_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_5cyddc_11Display_Ref_3free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("free (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_11Display_Ref_2free(((struct __pyx_obj_5cyddc_Display_Ref *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_11Display_Ref_2free(struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("free", 0); /* "cyddc.pyx":455 * * def free(self): * ddca_free_display_ref(self.c_dref) # <<<<<<<<<<<<<< * * def __repr__(self): */ ddca_free_display_ref(__pyx_v_self->c_dref); /* "cyddc.pyx":454 * * * def free(self): # <<<<<<<<<<<<<< * ddca_free_display_ref(self.c_dref) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":457 * ddca_free_display_ref(self.c_dref) * * def __repr__(self): # <<<<<<<<<<<<<< * return ddca_dref_repr(self.c_dref).decode("UTF-8") * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_11Display_Ref_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5cyddc_11Display_Ref_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_11Display_Ref_4__repr__(((struct __pyx_obj_5cyddc_Display_Ref *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_11Display_Ref_4__repr__(struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); /* "cyddc.pyx":458 * * def __repr__(self): * return ddca_dref_repr(self.c_dref).decode("UTF-8") # <<<<<<<<<<<<<< * * def dbgrpt(self, int depth): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ddca_dref_repr(__pyx_v_self->c_dref); __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_r = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "cyddc.pyx":457 * ddca_free_display_ref(self.c_dref) * * def __repr__(self): # <<<<<<<<<<<<<< * return ddca_dref_repr(self.c_dref).decode("UTF-8") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cyddc.Display_Ref.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":460 * return ddca_dref_repr(self.c_dref).decode("UTF-8") * * def dbgrpt(self, int depth): # <<<<<<<<<<<<<< * ddca_report_display_ref(self.c_dref, depth) * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_11Display_Ref_7dbgrpt(PyObject *__pyx_v_self, PyObject *__pyx_arg_depth); /*proto*/ static PyObject *__pyx_pw_5cyddc_11Display_Ref_7dbgrpt(PyObject *__pyx_v_self, PyObject *__pyx_arg_depth) { int __pyx_v_depth; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dbgrpt (wrapper)", 0); assert(__pyx_arg_depth); { __pyx_v_depth = __Pyx_PyInt_As_int(__pyx_arg_depth); if (unlikely((__pyx_v_depth == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("cyddc.Display_Ref.dbgrpt", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_11Display_Ref_6dbgrpt(((struct __pyx_obj_5cyddc_Display_Ref *)__pyx_v_self), ((int)__pyx_v_depth)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_11Display_Ref_6dbgrpt(struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_self, int __pyx_v_depth) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dbgrpt", 0); /* "cyddc.pyx":461 * * def dbgrpt(self, int depth): * ddca_report_display_ref(self.c_dref, depth) # <<<<<<<<<<<<<< * * # cdef extern from "": */ ddca_report_display_ref(__pyx_v_self->c_dref, __pyx_v_depth); /* "cyddc.pyx":460 * return ddca_dref_repr(self.c_dref).decode("UTF-8") * * def dbgrpt(self, int depth): # <<<<<<<<<<<<<< * ddca_report_display_ref(self.c_dref, depth) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":516 * cdef public unsigned char feature_type # needed? * * def __init__(self, feature_code, int feature_type): # <<<<<<<<<<<<<< * self.feature_code = feature_code * self.feature_type = feature_type */ /* Python wrapper */ static int __pyx_pw_5cyddc_9Vcp_Value_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_5cyddc_9Vcp_Value_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_feature_code = 0; int __pyx_v_feature_type; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feature_code,&__pyx_n_s_feature_type,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_feature_code)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_feature_type)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 516, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 516, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_feature_code = values[0]; __pyx_v_feature_type = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_feature_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 516, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 516, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cyddc.Vcp_Value.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_9Vcp_Value___init__(((struct __pyx_obj_5cyddc_Vcp_Value *)__pyx_v_self), __pyx_v_feature_code, __pyx_v_feature_type); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5cyddc_9Vcp_Value___init__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_feature_code, int __pyx_v_feature_type) { int __pyx_r; __Pyx_RefNannyDeclarations unsigned char __pyx_t_1; __Pyx_RefNannySetupContext("__init__", 0); /* "cyddc.pyx":517 * * def __init__(self, feature_code, int feature_type): * self.feature_code = feature_code # <<<<<<<<<<<<<< * self.feature_type = feature_type * */ __pyx_t_1 = __Pyx_PyInt_As_unsigned_char(__pyx_v_feature_code); if (unlikely((__pyx_t_1 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L1_error) __pyx_v_self->feature_code = __pyx_t_1; /* "cyddc.pyx":518 * def __init__(self, feature_code, int feature_type): * self.feature_code = feature_code * self.feature_type = feature_type # <<<<<<<<<<<<<< * * cdef class Non_Table_Vcp_Value(Vcp_Value): */ __pyx_v_self->feature_type = __pyx_v_feature_type; /* "cyddc.pyx":516 * cdef public unsigned char feature_type # needed? * * def __init__(self, feature_code, int feature_type): # <<<<<<<<<<<<<< * self.feature_code = feature_code * self.feature_type = feature_type */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.Vcp_Value.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":513 * * cdef class Vcp_Value(object): * cdef public unsigned char feature_code # <<<<<<<<<<<<<< * cdef public unsigned char feature_type # needed? * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_9Vcp_Value_12feature_code_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5cyddc_9Vcp_Value_12feature_code_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_9Vcp_Value_12feature_code___get__(((struct __pyx_obj_5cyddc_Vcp_Value *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_9Vcp_Value_12feature_code___get__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_char(__pyx_v_self->feature_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.Vcp_Value.feature_code.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_5cyddc_9Vcp_Value_12feature_code_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5cyddc_9Vcp_Value_12feature_code_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_9Vcp_Value_12feature_code_2__set__(((struct __pyx_obj_5cyddc_Vcp_Value *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5cyddc_9Vcp_Value_12feature_code_2__set__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations unsigned char __pyx_t_1; __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = __Pyx_PyInt_As_unsigned_char(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 513, __pyx_L1_error) __pyx_v_self->feature_code = __pyx_t_1; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.Vcp_Value.feature_code.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":514 * cdef class Vcp_Value(object): * cdef public unsigned char feature_code * cdef public unsigned char feature_type # needed? # <<<<<<<<<<<<<< * * def __init__(self, feature_code, int feature_type): */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_9Vcp_Value_12feature_type_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5cyddc_9Vcp_Value_12feature_type_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_9Vcp_Value_12feature_type___get__(((struct __pyx_obj_5cyddc_Vcp_Value *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_9Vcp_Value_12feature_type___get__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_char(__pyx_v_self->feature_type); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cyddc.Vcp_Value.feature_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_5cyddc_9Vcp_Value_12feature_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_5cyddc_9Vcp_Value_12feature_type_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_9Vcp_Value_12feature_type_2__set__(((struct __pyx_obj_5cyddc_Vcp_Value *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5cyddc_9Vcp_Value_12feature_type_2__set__(struct __pyx_obj_5cyddc_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations unsigned char __pyx_t_1; __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = __Pyx_PyInt_As_unsigned_char(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 514, __pyx_L1_error) __pyx_v_self->feature_type = __pyx_t_1; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cyddc.Vcp_Value.feature_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":522 * cdef class Non_Table_Vcp_Value(Vcp_Value): * * def __init__(self, feature_code, mh, ml, sh, sl): # <<<<<<<<<<<<<< * super(Non_Table_Vcp_Value, self).__init__(feature_code, DDCA_NON_TABLE_VCP_VALUE) * */ /* Python wrapper */ static int __pyx_pw_5cyddc_19Non_Table_Vcp_Value_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_5cyddc_19Non_Table_Vcp_Value_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_feature_code = 0; PyObject *__pyx_v_mh = 0; PyObject *__pyx_v_ml = 0; PyObject *__pyx_v_sh = 0; PyObject *__pyx_v_sl = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feature_code,&__pyx_n_s_mh,&__pyx_n_s_ml,&__pyx_n_s_sh,&__pyx_n_s_sl,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_feature_code)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mh)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); __PYX_ERR(0, 522, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ml)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); __PYX_ERR(0, 522, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sh)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); __PYX_ERR(0, 522, __pyx_L3_error) } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sl)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); __PYX_ERR(0, 522, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 522, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_feature_code = values[0]; __pyx_v_mh = values[1]; __pyx_v_ml = values[2]; __pyx_v_sh = values[3]; __pyx_v_sl = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 522, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cyddc.Non_Table_Vcp_Value.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_19Non_Table_Vcp_Value___init__(((struct __pyx_obj_5cyddc_Non_Table_Vcp_Value *)__pyx_v_self), __pyx_v_feature_code, __pyx_v_mh, __pyx_v_ml, __pyx_v_sh, __pyx_v_sl); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5cyddc_19Non_Table_Vcp_Value___init__(struct __pyx_obj_5cyddc_Non_Table_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_feature_code, PyObject *__pyx_v_mh, PyObject *__pyx_v_ml, PyObject *__pyx_v_sh, PyObject *__pyx_v_sl) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__init__", 0); /* "cyddc.pyx":523 * * def __init__(self, feature_code, mh, ml, sh, sl): * super(Non_Table_Vcp_Value, self).__init__(feature_code, DDCA_NON_TABLE_VCP_VALUE) # <<<<<<<<<<<<<< * * self.mh = mh */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_5cyddc_Non_Table_Vcp_Value)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5cyddc_Non_Table_Vcp_Value)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_5cyddc_Non_Table_Vcp_Value)); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_DDCA_Vcp_Value_Type(DDCA_NON_TABLE_VCP_VALUE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_feature_code, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_feature_code, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_feature_code); __Pyx_GIVEREF(__pyx_v_feature_code); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_feature_code); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":525 * super(Non_Table_Vcp_Value, self).__init__(feature_code, DDCA_NON_TABLE_VCP_VALUE) * * self.mh = mh # <<<<<<<<<<<<<< * self.ml = ml * self.sh = sh */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_mh, __pyx_v_mh) < 0) __PYX_ERR(0, 525, __pyx_L1_error) /* "cyddc.pyx":526 * * self.mh = mh * self.ml = ml # <<<<<<<<<<<<<< * self.sh = sh * self.sl = sl */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ml, __pyx_v_ml) < 0) __PYX_ERR(0, 526, __pyx_L1_error) /* "cyddc.pyx":527 * self.mh = mh * self.ml = ml * self.sh = sh # <<<<<<<<<<<<<< * self.sl = sl * */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sh, __pyx_v_sh) < 0) __PYX_ERR(0, 527, __pyx_L1_error) /* "cyddc.pyx":528 * self.ml = ml * self.sh = sh * self.sl = sl # <<<<<<<<<<<<<< * * # TODO: use getattr, setattr */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sl, __pyx_v_sl) < 0) __PYX_ERR(0, 528, __pyx_L1_error) /* "cyddc.pyx":522 * cdef class Non_Table_Vcp_Value(Vcp_Value): * * def __init__(self, feature_code, mh, ml, sh, sl): # <<<<<<<<<<<<<< * super(Non_Table_Vcp_Value, self).__init__(feature_code, DDCA_NON_TABLE_VCP_VALUE) * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Non_Table_Vcp_Value.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":531 * * # TODO: use getattr, setattr * def cur_val(self): # <<<<<<<<<<<<<< * return self.sh << 16 | self.sl * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_19Non_Table_Vcp_Value_3cur_val(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_5cyddc_19Non_Table_Vcp_Value_3cur_val(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cur_val (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_19Non_Table_Vcp_Value_2cur_val(((struct __pyx_obj_5cyddc_Non_Table_Vcp_Value *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_19Non_Table_Vcp_Value_2cur_val(struct __pyx_obj_5cyddc_Non_Table_Vcp_Value *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("cur_val", 0); /* "cyddc.pyx":532 * # TODO: use getattr, setattr * def cur_val(self): * return self.sh << 16 | self.sl # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_LshiftObjC(__pyx_t_1, __pyx_int_16, 16, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyNumber_Or(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "cyddc.pyx":531 * * # TODO: use getattr, setattr * def cur_val(self): # <<<<<<<<<<<<<< * return self.sh << 16 | self.sl * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("cyddc.Non_Table_Vcp_Value.cur_val", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":538 * * * def __init__(self, feature_code, bytestring ): # <<<<<<<<<<<<<< * super(Table_Vcp_Value, self).__init__(feature_code, DDCA_TABLE_VCP_VALUE) * self.bytes = bytestring */ /* Python wrapper */ static int __pyx_pw_5cyddc_15Table_Vcp_Value_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_5cyddc_15Table_Vcp_Value_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_feature_code = 0; PyObject *__pyx_v_bytestring = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_feature_code,&__pyx_n_s_bytestring,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_feature_code)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bytestring)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 538, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 538, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_feature_code = values[0]; __pyx_v_bytestring = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 538, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cyddc.Table_Vcp_Value.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_5cyddc_15Table_Vcp_Value___init__(((struct __pyx_obj_5cyddc_Table_Vcp_Value *)__pyx_v_self), __pyx_v_feature_code, __pyx_v_bytestring); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_5cyddc_15Table_Vcp_Value___init__(struct __pyx_obj_5cyddc_Table_Vcp_Value *__pyx_v_self, PyObject *__pyx_v_feature_code, PyObject *__pyx_v_bytestring) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__init__", 0); /* "cyddc.pyx":539 * * def __init__(self, feature_code, bytestring ): * super(Table_Vcp_Value, self).__init__(feature_code, DDCA_TABLE_VCP_VALUE) # <<<<<<<<<<<<<< * self.bytes = bytestring * */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_5cyddc_Table_Vcp_Value)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_5cyddc_Table_Vcp_Value)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_5cyddc_Table_Vcp_Value)); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self)); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_DDCA_Vcp_Value_Type(DDCA_TABLE_VCP_VALUE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_feature_code, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_feature_code, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_feature_code); __Pyx_GIVEREF(__pyx_v_feature_code); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_feature_code); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":540 * def __init__(self, feature_code, bytestring ): * super(Table_Vcp_Value, self).__init__(feature_code, DDCA_TABLE_VCP_VALUE) * self.bytes = bytestring # <<<<<<<<<<<<<< * * */ if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_bytes, __pyx_v_bytestring) < 0) __PYX_ERR(0, 540, __pyx_L1_error) /* "cyddc.pyx":538 * * * def __init__(self, feature_code, bytestring ): # <<<<<<<<<<<<<< * super(Table_Vcp_Value, self).__init__(feature_code, DDCA_TABLE_VCP_VALUE) * self.bytes = bytestring */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Table_Vcp_Value.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":548 * * @classmethod * def open(cls, Display_Ref dref): # <<<<<<<<<<<<<< * cdef int rc * cdef void * c_dh */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_14Display_Handle_1open(PyObject *__pyx_v_cls, PyObject *__pyx_v_dref); /*proto*/ static PyObject *__pyx_pw_5cyddc_14Display_Handle_1open(PyObject *__pyx_v_cls, PyObject *__pyx_v_dref) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("open (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dref), __pyx_ptype_5cyddc_Display_Ref, 1, "dref", 0))) __PYX_ERR(0, 548, __pyx_L1_error) __pyx_r = __pyx_pf_5cyddc_14Display_Handle_open(((PyTypeObject*)__pyx_v_cls), ((struct __pyx_obj_5cyddc_Display_Ref *)__pyx_v_dref)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_14Display_Handle_open(CYTHON_UNUSED PyTypeObject *__pyx_v_cls, struct __pyx_obj_5cyddc_Display_Ref *__pyx_v_dref) { int __pyx_v_rc; void *__pyx_v_c_dh; PyObject *__pyx_v_excp = NULL; struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_dh = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("open", 0); /* "cyddc.pyx":551 * cdef int rc * cdef void * c_dh * rc = ddca_open_display(dref.c_dref, &c_dh) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_open_display(__pyx_v_dref->c_dref, (&__pyx_v_c_dh)); /* "cyddc.pyx":552 * cdef void * c_dh * rc = ddca_open_display(dref.c_dref, &c_dh) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":553 * rc = ddca_open_display(dref.c_dref, &c_dh) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * dh = Display_Handle() */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":554 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * dh = Display_Handle() * dh.c_dh = c_dh */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 554, __pyx_L1_error) /* "cyddc.pyx":552 * cdef void * c_dh * rc = ddca_open_display(dref.c_dref, &c_dh) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":555 * excp = create_ddc_exception(rc) * raise excp * dh = Display_Handle() # <<<<<<<<<<<<<< * dh.c_dh = c_dh * return dh */ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5cyddc_Display_Handle), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_dh = ((struct __pyx_obj_5cyddc_Display_Handle *)__pyx_t_2); __pyx_t_2 = 0; /* "cyddc.pyx":556 * raise excp * dh = Display_Handle() * dh.c_dh = c_dh # <<<<<<<<<<<<<< * return dh * */ __pyx_v_dh->c_dh = __pyx_v_c_dh; /* "cyddc.pyx":557 * dh = Display_Handle() * dh.c_dh = c_dh * return dh # <<<<<<<<<<<<<< * * def close(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_dh)); __pyx_r = ((PyObject *)__pyx_v_dh); goto __pyx_L0; /* "cyddc.pyx":548 * * @classmethod * def open(cls, Display_Ref dref): # <<<<<<<<<<<<<< * cdef int rc * cdef void * c_dh */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Display_Handle.open", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XDECREF((PyObject *)__pyx_v_dh); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":559 * return dh * * def close(self): # <<<<<<<<<<<<<< * cdef int rc * rc = ddca_close_display(self.c_dh) */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_14Display_Handle_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_5cyddc_14Display_Handle_3close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_14Display_Handle_2close(((struct __pyx_obj_5cyddc_Display_Handle *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_14Display_Handle_2close(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self) { int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("close", 0); /* "cyddc.pyx":561 * def close(self): * cdef int rc * rc = ddca_close_display(self.c_dh) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_close_display(__pyx_v_self->c_dh); /* "cyddc.pyx":562 * cdef int rc * rc = ddca_close_display(self.c_dh) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":563 * rc = ddca_close_display(self.c_dh) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":564 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * * def __repr__(self): */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 564, __pyx_L1_error) /* "cyddc.pyx":562 * cdef int rc * rc = ddca_close_display(self.c_dh) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":559 * return dh * * def close(self): # <<<<<<<<<<<<<< * cdef int rc * rc = ddca_close_display(self.c_dh) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Display_Handle.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":566 * raise excp * * def __repr__(self): # <<<<<<<<<<<<<< * return ddca_dh_repr(self.c_dh).decode("UTF-8") * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_14Display_Handle_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_5cyddc_14Display_Handle_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_14Display_Handle_4__repr__(((struct __pyx_obj_5cyddc_Display_Handle *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_14Display_Handle_4__repr__(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); /* "cyddc.pyx":567 * * def __repr__(self): * return ddca_dh_repr(self.c_dh).decode("UTF-8") # <<<<<<<<<<<<<< * * def get_capabilities_string(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ddca_dh_repr(__pyx_v_self->c_dh); __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_r = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "cyddc.pyx":566 * raise excp * * def __repr__(self): # <<<<<<<<<<<<<< * return ddca_dh_repr(self.c_dh).decode("UTF-8") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cyddc.Display_Handle.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":569 * return ddca_dh_repr(self.c_dh).decode("UTF-8") * * def get_capabilities_string(self): # <<<<<<<<<<<<<< * cdef char * s * cdef int rc */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_14Display_Handle_7get_capabilities_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_5cyddc_14Display_Handle_7get_capabilities_string(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_capabilities_string (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_14Display_Handle_6get_capabilities_string(((struct __pyx_obj_5cyddc_Display_Handle *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_14Display_Handle_6get_capabilities_string(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self) { char *__pyx_v_s; int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("get_capabilities_string", 0); /* "cyddc.pyx":572 * cdef char * s * cdef int rc * rc = ddca_get_capabilities_string(self.c_dh, &s) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_v_rc = ddca_get_capabilities_string(__pyx_v_self->c_dh, (&__pyx_v_s)); /* "cyddc.pyx":573 * cdef int rc * rc = ddca_get_capabilities_string(self.c_dh, &s) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_1 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_1) { /* "cyddc.pyx":574 * rc = ddca_get_capabilities_string(self.c_dh, &s) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * return s.decode("UTF-8") */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_excp = __pyx_t_2; __pyx_t_2 = 0; /* "cyddc.pyx":575 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * return s.decode("UTF-8") * */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 575, __pyx_L1_error) /* "cyddc.pyx":573 * cdef int rc * rc = ddca_get_capabilities_string(self.c_dh, &s) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":576 * excp = create_ddc_exception(rc) * raise excp * return s.decode("UTF-8") # <<<<<<<<<<<<<< * * def get_nontable_vcp_value(self, feature_code): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "cyddc.pyx":569 * return ddca_dh_repr(self.c_dh).decode("UTF-8") * * def get_capabilities_string(self): # <<<<<<<<<<<<<< * cdef char * s * cdef int rc */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cyddc.Display_Handle.get_capabilities_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cyddc.pyx":578 * return s.decode("UTF-8") * * def get_nontable_vcp_value(self, feature_code): # <<<<<<<<<<<<<< * cdef DDCA_Non_Table_Value_Response resp * */ /* Python wrapper */ static PyObject *__pyx_pw_5cyddc_14Display_Handle_9get_nontable_vcp_value(PyObject *__pyx_v_self, PyObject *__pyx_v_feature_code); /*proto*/ static PyObject *__pyx_pw_5cyddc_14Display_Handle_9get_nontable_vcp_value(PyObject *__pyx_v_self, PyObject *__pyx_v_feature_code) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_nontable_vcp_value (wrapper)", 0); __pyx_r = __pyx_pf_5cyddc_14Display_Handle_8get_nontable_vcp_value(((struct __pyx_obj_5cyddc_Display_Handle *)__pyx_v_self), ((PyObject *)__pyx_v_feature_code)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_5cyddc_14Display_Handle_8get_nontable_vcp_value(struct __pyx_obj_5cyddc_Display_Handle *__pyx_v_self, PyObject *__pyx_v_feature_code) { DDCA_Non_Table_Value_Response __pyx_v_resp; int __pyx_v_rc; PyObject *__pyx_v_excp = NULL; PyObject *__pyx_v_fcode = NULL; CYTHON_UNUSED unsigned char __pyx_v_mh; CYTHON_UNUSED unsigned char __pyx_v_ml; CYTHON_UNUSED unsigned char __pyx_v_sh; PyObject *__pyx_v_sl = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations unsigned char __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("get_nontable_vcp_value", 0); /* "cyddc.pyx":582 * * # n. fills in existing DDCA_Non_Table_Value_Response, does not allocate * rc = ddca_get_nontable_vcp_value(self.c_dh, feature_code, &resp) # <<<<<<<<<<<<<< * if rc != 0: * excp = create_ddc_exception(rc) */ __pyx_t_1 = __Pyx_PyInt_As_unsigned_char(__pyx_v_feature_code); if (unlikely((__pyx_t_1 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 582, __pyx_L1_error) __pyx_v_rc = ddca_get_nontable_vcp_value(__pyx_v_self->c_dh, __pyx_t_1, (&__pyx_v_resp)); /* "cyddc.pyx":583 * # n. fills in existing DDCA_Non_Table_Value_Response, does not allocate * rc = ddca_get_nontable_vcp_value(self.c_dh, feature_code, &resp) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ __pyx_t_2 = ((__pyx_v_rc != 0) != 0); if (__pyx_t_2) { /* "cyddc.pyx":584 * rc = ddca_get_nontable_vcp_value(self.c_dh, feature_code, &resp) * if rc != 0: * excp = create_ddc_exception(rc) # <<<<<<<<<<<<<< * raise excp * */ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_create_ddc_exception); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_6) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_excp = __pyx_t_3; __pyx_t_3 = 0; /* "cyddc.pyx":585 * if rc != 0: * excp = create_ddc_exception(rc) * raise excp # <<<<<<<<<<<<<< * * # Todo: create a Non_Table_Vcp_Value instance, return it */ __Pyx_Raise(__pyx_v_excp, 0, 0, 0); __PYX_ERR(0, 585, __pyx_L1_error) /* "cyddc.pyx":583 * # n. fills in existing DDCA_Non_Table_Value_Response, does not allocate * rc = ddca_get_nontable_vcp_value(self.c_dh, feature_code, &resp) * if rc != 0: # <<<<<<<<<<<<<< * excp = create_ddc_exception(rc) * raise excp */ } /* "cyddc.pyx":589 * # Todo: create a Non_Table_Vcp_Value instance, return it * # return resp * fcode = resp.feature_code # <<<<<<<<<<<<<< * mh = resp.nc.mh * ml = resp.nc.ml */ __pyx_t_3 = __Pyx_PyInt_From_unsigned_char(__pyx_v_resp.feature_code); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_fcode = __pyx_t_3; __pyx_t_3 = 0; /* "cyddc.pyx":590 * # return resp * fcode = resp.feature_code * mh = resp.nc.mh # <<<<<<<<<<<<<< * ml = resp.nc.ml * sh = resp.nc.sh */ __pyx_t_1 = __pyx_v_resp.nc.mh; __pyx_v_mh = __pyx_t_1; /* "cyddc.pyx":591 * fcode = resp.feature_code * mh = resp.nc.mh * ml = resp.nc.ml # <<<<<<<<<<<<<< * sh = resp.nc.sh * sl = resp.nc.sl */ __pyx_t_1 = __pyx_v_resp.nc.ml; __pyx_v_ml = __pyx_t_1; /* "cyddc.pyx":592 * mh = resp.nc.mh * ml = resp.nc.ml * sh = resp.nc.sh # <<<<<<<<<<<<<< * sl = resp.nc.sl * print("fcode: x%02x" % fcode) */ __pyx_t_1 = __pyx_v_resp.nc.sh; __pyx_v_sh = __pyx_t_1; /* "cyddc.pyx":593 * ml = resp.nc.ml * sh = resp.nc.sh * sl = resp.nc.sl # <<<<<<<<<<<<<< * print("fcode: x%02x" % fcode) * print("sl: x%02x" % sl) */ __pyx_t_3 = __Pyx_PyInt_From_unsigned_char(__pyx_v_resp.nc.sl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_sl = __pyx_t_3; __pyx_t_3 = 0; /* "cyddc.pyx":594 * sh = resp.nc.sh * sl = resp.nc.sl * print("fcode: x%02x" % fcode) # <<<<<<<<<<<<<< * print("sl: x%02x" % sl) * */ __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_fcode_x_02x, __pyx_v_fcode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "cyddc.pyx":595 * sl = resp.nc.sl * print("fcode: x%02x" % fcode) * print("sl: x%02x" % sl) # <<<<<<<<<<<<<< * * # resp = Non_Table_Vcp_Value(fcode, mh, ml, sh, sl) */ __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_sl_x_02x, __pyx_v_sl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "cyddc.pyx":599 * # resp = Non_Table_Vcp_Value(fcode, mh, ml, sh, sl) * * raise("unimplemented") # <<<<<<<<<<<<<< * * */ __Pyx_Raise(__pyx_n_u_unimplemented, 0, 0, 0); __PYX_ERR(0, 599, __pyx_L1_error) /* "cyddc.pyx":578 * return s.decode("UTF-8") * * def get_nontable_vcp_value(self, feature_code): # <<<<<<<<<<<<<< * cdef DDCA_Non_Table_Value_Response resp * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cyddc.Display_Handle.get_nontable_vcp_value", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XDECREF(__pyx_v_excp); __Pyx_XDECREF(__pyx_v_fcode); __Pyx_XDECREF(__pyx_v_sl); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_5cyddc_Display_Identifier(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; return o; } static void __pyx_tp_dealloc_5cyddc_Display_Identifier(PyObject *o) { #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_5cyddc_18Display_Identifier_5__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_5cyddc_Display_Identifier[] = { {"create_by_dispno", (PyCFunction)__pyx_pw_5cyddc_18Display_Identifier_1create_by_dispno, METH_O, 0}, {"free", (PyCFunction)__pyx_pw_5cyddc_18Display_Identifier_3free, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_5cyddc_Display_Identifier = { PyVarObject_HEAD_INIT(0, 0) "cyddc.Display_Identifier", /*tp_name*/ sizeof(struct __pyx_obj_5cyddc_Display_Identifier), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5cyddc_Display_Identifier, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif __pyx_pw_5cyddc_18Display_Identifier_7__repr__, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5cyddc_Display_Identifier, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5cyddc_Display_Identifier, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyObject *__pyx_tp_new_5cyddc_Display_Ref(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; return o; } static void __pyx_tp_dealloc_5cyddc_Display_Ref(PyObject *o) { #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_5cyddc_Display_Ref[] = { {"create_from_did", (PyCFunction)__pyx_pw_5cyddc_11Display_Ref_1create_from_did, METH_O, 0}, {"free", (PyCFunction)__pyx_pw_5cyddc_11Display_Ref_3free, METH_NOARGS, 0}, {"dbgrpt", (PyCFunction)__pyx_pw_5cyddc_11Display_Ref_7dbgrpt, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_5cyddc_Display_Ref = { PyVarObject_HEAD_INIT(0, 0) "cyddc.Display_Ref", /*tp_name*/ sizeof(struct __pyx_obj_5cyddc_Display_Ref), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5cyddc_Display_Ref, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif __pyx_pw_5cyddc_11Display_Ref_5__repr__, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5cyddc_Display_Ref, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5cyddc_Display_Ref, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyObject *__pyx_tp_new_5cyddc_Vcp_Value(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; return o; } static void __pyx_tp_dealloc_5cyddc_Vcp_Value(PyObject *o) { #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif (*Py_TYPE(o)->tp_free)(o); } static PyObject *__pyx_getprop_5cyddc_9Vcp_Value_feature_code(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_5cyddc_9Vcp_Value_12feature_code_1__get__(o); } static int __pyx_setprop_5cyddc_9Vcp_Value_feature_code(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_5cyddc_9Vcp_Value_12feature_code_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyObject *__pyx_getprop_5cyddc_9Vcp_Value_feature_type(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_5cyddc_9Vcp_Value_12feature_type_1__get__(o); } static int __pyx_setprop_5cyddc_9Vcp_Value_feature_type(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_5cyddc_9Vcp_Value_12feature_type_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyMethodDef __pyx_methods_5cyddc_Vcp_Value[] = { {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_5cyddc_Vcp_Value[] = { {(char *)"feature_code", __pyx_getprop_5cyddc_9Vcp_Value_feature_code, __pyx_setprop_5cyddc_9Vcp_Value_feature_code, (char *)0, 0}, {(char *)"feature_type", __pyx_getprop_5cyddc_9Vcp_Value_feature_type, __pyx_setprop_5cyddc_9Vcp_Value_feature_type, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_5cyddc_Vcp_Value = { PyVarObject_HEAD_INIT(0, 0) "cyddc.Vcp_Value", /*tp_name*/ sizeof(struct __pyx_obj_5cyddc_Vcp_Value), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5cyddc_Vcp_Value, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5cyddc_Vcp_Value, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_5cyddc_Vcp_Value, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_5cyddc_9Vcp_Value_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5cyddc_Vcp_Value, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyObject *__pyx_tp_new_5cyddc_Non_Table_Vcp_Value(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_tp_new_5cyddc_Vcp_Value(t, a, k); if (unlikely(!o)) return 0; return o; } static PyMethodDef __pyx_methods_5cyddc_Non_Table_Vcp_Value[] = { {"cur_val", (PyCFunction)__pyx_pw_5cyddc_19Non_Table_Vcp_Value_3cur_val, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_5cyddc_Non_Table_Vcp_Value = { PyVarObject_HEAD_INIT(0, 0) "cyddc.Non_Table_Vcp_Value", /*tp_name*/ sizeof(struct __pyx_obj_5cyddc_Non_Table_Vcp_Value), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5cyddc_Vcp_Value, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5cyddc_Non_Table_Vcp_Value, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_5cyddc_19Non_Table_Vcp_Value_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5cyddc_Non_Table_Vcp_Value, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyObject *__pyx_tp_new_5cyddc_Table_Vcp_Value(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o = __pyx_tp_new_5cyddc_Vcp_Value(t, a, k); if (unlikely(!o)) return 0; return o; } static PyMethodDef __pyx_methods_5cyddc_Table_Vcp_Value[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_5cyddc_Table_Vcp_Value = { PyVarObject_HEAD_INIT(0, 0) "cyddc.Table_Vcp_Value", /*tp_name*/ sizeof(struct __pyx_obj_5cyddc_Table_Vcp_Value), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5cyddc_Vcp_Value, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5cyddc_Table_Vcp_Value, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_5cyddc_15Table_Vcp_Value_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5cyddc_Table_Vcp_Value, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyObject *__pyx_tp_new_5cyddc_Display_Handle(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; return o; } static void __pyx_tp_dealloc_5cyddc_Display_Handle(PyObject *o) { #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_5cyddc_Display_Handle[] = { {"open", (PyCFunction)__pyx_pw_5cyddc_14Display_Handle_1open, METH_O, 0}, {"close", (PyCFunction)__pyx_pw_5cyddc_14Display_Handle_3close, METH_NOARGS, 0}, {"get_capabilities_string", (PyCFunction)__pyx_pw_5cyddc_14Display_Handle_7get_capabilities_string, METH_NOARGS, 0}, {"get_nontable_vcp_value", (PyCFunction)__pyx_pw_5cyddc_14Display_Handle_9get_nontable_vcp_value, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_5cyddc_Display_Handle = { PyVarObject_HEAD_INIT(0, 0) "cyddc.Display_Handle", /*tp_name*/ sizeof(struct __pyx_obj_5cyddc_Display_Handle), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5cyddc_Display_Handle, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif __pyx_pw_5cyddc_14Display_Handle_5__repr__, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_5cyddc_Display_Handle, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_5cyddc_Display_Handle, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "cyddc", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_BUILT_WITH_ADL, __pyx_k_BUILT_WITH_ADL, sizeof(__pyx_k_BUILT_WITH_ADL), 0, 0, 1, 1}, {&__pyx_n_s_BUILT_WITH_FAILSIM, __pyx_k_BUILT_WITH_FAILSIM, sizeof(__pyx_k_BUILT_WITH_FAILSIM), 0, 0, 1, 1}, {&__pyx_n_s_BUILT_WITH_USB, __pyx_k_BUILT_WITH_USB, sizeof(__pyx_k_BUILT_WITH_USB), 0, 0, 1, 1}, {&__pyx_n_s_CYDDC_Exception, __pyx_k_CYDDC_Exception, sizeof(__pyx_k_CYDDC_Exception), 0, 0, 1, 1}, {&__pyx_n_s_CYDDC_Exception___init, __pyx_k_CYDDC_Exception___init, sizeof(__pyx_k_CYDDC_Exception___init), 0, 0, 1, 1}, {&__pyx_kp_u_DDC_status_s_s, __pyx_k_DDC_status_s_s, sizeof(__pyx_k_DDC_status_s_s), 0, 1, 0, 0}, {&__pyx_n_s_MULTI_PART_TRIES, __pyx_k_MULTI_PART_TRIES, sizeof(__pyx_k_MULTI_PART_TRIES), 0, 0, 1, 1}, {&__pyx_n_s_NON_TABLE_VCP_VALUE, __pyx_k_NON_TABLE_VCP_VALUE, sizeof(__pyx_k_NON_TABLE_VCP_VALUE), 0, 0, 1, 1}, {&__pyx_n_s_OL_NORMAL, __pyx_k_OL_NORMAL, sizeof(__pyx_k_OL_NORMAL), 0, 0, 1, 1}, {&__pyx_n_s_OL_TERSE, __pyx_k_OL_TERSE, sizeof(__pyx_k_OL_TERSE), 0, 0, 1, 1}, {&__pyx_n_s_OL_VERBOSE, __pyx_k_OL_VERBOSE, sizeof(__pyx_k_OL_VERBOSE), 0, 0, 1, 1}, {&__pyx_n_s_STATS_ALL, __pyx_k_STATS_ALL, sizeof(__pyx_k_STATS_ALL), 0, 0, 1, 1}, {&__pyx_n_s_STATS_CALLS, __pyx_k_STATS_CALLS, sizeof(__pyx_k_STATS_CALLS), 0, 0, 1, 1}, {&__pyx_n_s_STATS_ELAPSED, __pyx_k_STATS_ELAPSED, sizeof(__pyx_k_STATS_ELAPSED), 0, 0, 1, 1}, {&__pyx_n_s_STATS_ERRORS, __pyx_k_STATS_ERRORS, sizeof(__pyx_k_STATS_ERRORS), 0, 0, 1, 1}, {&__pyx_n_s_STATS_NONE, __pyx_k_STATS_NONE, sizeof(__pyx_k_STATS_NONE), 0, 0, 1, 1}, {&__pyx_n_s_STATS_TRIES, __pyx_k_STATS_TRIES, sizeof(__pyx_k_STATS_TRIES), 0, 0, 1, 1}, {&__pyx_n_s_TABLE_VCP_VALUE, __pyx_k_TABLE_VCP_VALUE, sizeof(__pyx_k_TABLE_VCP_VALUE), 0, 0, 1, 1}, {&__pyx_n_s_WRITE_ONLY_TRIES, __pyx_k_WRITE_ONLY_TRIES, sizeof(__pyx_k_WRITE_ONLY_TRIES), 0, 0, 1, 1}, {&__pyx_n_s_WRITE_READ_TRIES, __pyx_k_WRITE_READ_TRIES, sizeof(__pyx_k_WRITE_READ_TRIES), 0, 0, 1, 1}, {&__pyx_n_s_bits, __pyx_k_bits, sizeof(__pyx_k_bits), 0, 0, 1, 1}, {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, {&__pyx_n_s_bytestring, __pyx_k_bytestring, sizeof(__pyx_k_bytestring), 0, 0, 1, 1}, {&__pyx_n_s_check_ddca_status, __pyx_k_check_ddca_status, sizeof(__pyx_k_check_ddca_status), 0, 0, 1, 1}, {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1}, {&__pyx_n_s_create_by_dispno, __pyx_k_create_by_dispno, sizeof(__pyx_k_create_by_dispno), 0, 0, 1, 1}, {&__pyx_n_s_create_ddc_exception, __pyx_k_create_ddc_exception, sizeof(__pyx_k_create_ddc_exception), 0, 0, 1, 1}, {&__pyx_n_s_create_from_did, __pyx_k_create_from_did, sizeof(__pyx_k_create_from_did), 0, 0, 1, 1}, {&__pyx_n_s_ct, __pyx_k_ct, sizeof(__pyx_k_ct), 0, 0, 1, 1}, {&__pyx_n_s_cyddc, __pyx_k_cyddc, sizeof(__pyx_k_cyddc), 0, 0, 1, 1}, {&__pyx_kp_s_cyddc_pyx, __pyx_k_cyddc_pyx, sizeof(__pyx_k_cyddc_pyx), 0, 0, 1, 0}, {&__pyx_n_s_ddcutil_version2, __pyx_k_ddcutil_version2, sizeof(__pyx_k_ddcutil_version2), 0, 0, 1, 1}, {&__pyx_n_s_ddcy_ddcutil_version, __pyx_k_ddcy_ddcutil_version, sizeof(__pyx_k_ddcy_ddcutil_version), 0, 0, 1, 1}, {&__pyx_n_s_ddcy_ddcutil_version_string, __pyx_k_ddcy_ddcutil_version_string, sizeof(__pyx_k_ddcy_ddcutil_version_string), 0, 0, 1, 1}, {&__pyx_n_s_ddcy_get_max_max_tries, __pyx_k_ddcy_get_max_max_tries, sizeof(__pyx_k_ddcy_get_max_max_tries), 0, 0, 1, 1}, {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_enable_report_ddc_errors, __pyx_k_enable_report_ddc_errors, sizeof(__pyx_k_enable_report_ddc_errors), 0, 0, 1, 1}, {&__pyx_n_s_enable_verify, __pyx_k_enable_verify, sizeof(__pyx_k_enable_verify), 0, 0, 1, 1}, {&__pyx_n_s_etype, __pyx_k_etype, sizeof(__pyx_k_etype), 0, 0, 1, 1}, {&__pyx_n_s_evalue, __pyx_k_evalue, sizeof(__pyx_k_evalue), 0, 0, 1, 1}, {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1}, {&__pyx_n_s_excp, __pyx_k_excp, sizeof(__pyx_k_excp), 0, 0, 1, 1}, {&__pyx_n_s_extract_stack, __pyx_k_extract_stack, sizeof(__pyx_k_extract_stack), 0, 0, 1, 1}, {&__pyx_n_s_extract_tb, __pyx_k_extract_tb, sizeof(__pyx_k_extract_tb), 0, 0, 1, 1}, {&__pyx_kp_u_fcode_x_02x, __pyx_k_fcode_x_02x, sizeof(__pyx_k_fcode_x_02x), 0, 1, 0, 0}, {&__pyx_n_s_feature_code, __pyx_k_feature_code, sizeof(__pyx_k_feature_code), 0, 0, 1, 1}, {&__pyx_n_s_feature_type, __pyx_k_feature_type, sizeof(__pyx_k_feature_type), 0, 0, 1, 1}, {&__pyx_n_s_get_build_options, __pyx_k_get_build_options, sizeof(__pyx_k_get_build_options), 0, 0, 1, 1}, {&__pyx_n_s_get_max_tries, __pyx_k_get_max_tries, sizeof(__pyx_k_get_max_tries), 0, 0, 1, 1}, {&__pyx_n_s_get_output_level, __pyx_k_get_output_level, sizeof(__pyx_k_get_output_level), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_is_report_ddc_errors_enabled, __pyx_k_is_report_ddc_errors_enabled, sizeof(__pyx_k_is_report_ddc_errors_enabled), 0, 0, 1, 1}, {&__pyx_n_s_is_verify_enabled, __pyx_k_is_verify_enabled, sizeof(__pyx_k_is_verify_enabled), 0, 0, 1, 1}, {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1}, {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, {&__pyx_n_s_mh, __pyx_k_mh, sizeof(__pyx_k_mh), 0, 0, 1, 1}, {&__pyx_n_s_micro, __pyx_k_micro, sizeof(__pyx_k_micro), 0, 0, 1, 1}, {&__pyx_n_s_minor, __pyx_k_minor, sizeof(__pyx_k_minor), 0, 0, 1, 1}, {&__pyx_n_s_ml, __pyx_k_ml, sizeof(__pyx_k_ml), 0, 0, 1, 1}, {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1}, {&__pyx_n_s_ol, __pyx_k_ol, sizeof(__pyx_k_ol), 0, 0, 1, 1}, {&__pyx_n_s_onoff, __pyx_k_onoff, sizeof(__pyx_k_onoff), 0, 0, 1, 1}, {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, {&__pyx_n_s_print_exc, __pyx_k_print_exc, sizeof(__pyx_k_print_exc), 0, 0, 1, 1}, {&__pyx_n_s_print_exception, __pyx_k_print_exception, sizeof(__pyx_k_print_exception), 0, 0, 1, 1}, {&__pyx_n_s_print_tb, __pyx_k_print_tb, sizeof(__pyx_k_print_tb), 0, 0, 1, 1}, {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, {&__pyx_n_s_rc, __pyx_k_rc, sizeof(__pyx_k_rc), 0, 0, 1, 1}, {&__pyx_n_s_rc_desc, __pyx_k_rc_desc, sizeof(__pyx_k_rc_desc), 0, 0, 1, 1}, {&__pyx_n_s_rc_name, __pyx_k_rc_name, sizeof(__pyx_k_rc_name), 0, 0, 1, 1}, {&__pyx_n_s_reset_stats, __pyx_k_reset_stats, sizeof(__pyx_k_reset_stats), 0, 0, 1, 1}, {&__pyx_n_s_retry_type, __pyx_k_retry_type, sizeof(__pyx_k_retry_type), 0, 0, 1, 1}, {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, {&__pyx_n_s_s0, __pyx_k_s0, sizeof(__pyx_k_s0), 0, 0, 1, 1}, {&__pyx_n_s_s2, __pyx_k_s2, sizeof(__pyx_k_s2), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {&__pyx_n_s_set_max_tries, __pyx_k_set_max_tries, sizeof(__pyx_k_set_max_tries), 0, 0, 1, 1}, {&__pyx_n_s_set_output_level, __pyx_k_set_output_level, sizeof(__pyx_k_set_output_level), 0, 0, 1, 1}, {&__pyx_n_s_sh, __pyx_k_sh, sizeof(__pyx_k_sh), 0, 0, 1, 1}, {&__pyx_n_s_show_stats, __pyx_k_show_stats, sizeof(__pyx_k_show_stats), 0, 0, 1, 1}, {&__pyx_n_s_sl, __pyx_k_sl, sizeof(__pyx_k_sl), 0, 0, 1, 1}, {&__pyx_kp_u_sl_x_02x, __pyx_k_sl_x_02x, sizeof(__pyx_k_sl_x_02x), 0, 1, 0, 0}, {&__pyx_n_s_stats_type, __pyx_k_stats_type, sizeof(__pyx_k_stats_type), 0, 0, 1, 1}, {&__pyx_n_s_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 1, 1}, {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, {&__pyx_kp_u_traceback_print_exc, __pyx_k_traceback_print_exc, sizeof(__pyx_k_traceback_print_exc), 0, 1, 0, 0}, {&__pyx_kp_u_traceback_print_exception, __pyx_k_traceback_print_exception, sizeof(__pyx_k_traceback_print_exception), 0, 1, 0, 0}, {&__pyx_kp_u_traceback_print_tb, __pyx_k_traceback_print_tb, sizeof(__pyx_k_traceback_print_tb), 0, 1, 0, 0}, {&__pyx_n_s_truefalse, __pyx_k_truefalse, sizeof(__pyx_k_truefalse), 0, 0, 1, 1}, {&__pyx_n_u_unimplemented, __pyx_k_unimplemented, sizeof(__pyx_k_unimplemented), 0, 1, 0, 1}, {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 64, __pyx_L1_error) __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 218, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "cyddc.pyx":228 * # To do: adjust the stack * (etype, evalue, tb) = sys.exc_info() * print("traceback.print_tb(): ") # <<<<<<<<<<<<<< * traceback.print_tb(tb) * print("traceback.print_exception():") */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_traceback_print_tb); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); /* "cyddc.pyx":230 * print("traceback.print_tb(): ") * traceback.print_tb(tb) * print("traceback.print_exception():") # <<<<<<<<<<<<<< * traceback.print_exception(etype, evalue, tb) * print("traceback.print_exc():") */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_traceback_print_exception); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "cyddc.pyx":232 * print("traceback.print_exception():") * traceback.print_exception(etype, evalue, tb) * print("traceback.print_exc():") # <<<<<<<<<<<<<< * traceback.print_exc() * */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_traceback_print_exc); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* "cyddc.pyx":47 * int ddca_build_options() * * def ddcy_ddcutil_version_string(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version_string().decode("UTF-8") * */ __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_ddcy_ddcutil_version_string, 47, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 47, __pyx_L1_error) /* "cyddc.pyx":50 * return ddca_ddcutil_version_string().decode("UTF-8") * * def ddcy_ddcutil_version(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version() * */ __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_ddcy_ddcutil_version, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 50, __pyx_L1_error) /* "cyddc.pyx":53 * return ddca_ddcutil_version() * * def ddcutil_version2(): # <<<<<<<<<<<<<< * v = ddca_ddcutil_version() * return (v.major, v.minor, v.micro) */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_v); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_ddcutil_version2, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 53, __pyx_L1_error) /* "cyddc.pyx":62 * * * def get_build_options(): # <<<<<<<<<<<<<< * bits = ddca_build_options() * print(bits) */ __pyx_tuple__8 = PyTuple_Pack(5, __pyx_n_s_bits, __pyx_n_s_l, __pyx_n_s_s0, __pyx_n_s_s2, __pyx_n_s_s); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_get_build_options, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 62, __pyx_L1_error) /* "cyddc.pyx":90 * char * ddca_rc_desc(int status_code) * * def rc_name(code): # <<<<<<<<<<<<<< * return ddca_rc_name(code).decode("UTF-8") * */ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_code); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_rc_name, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 90, __pyx_L1_error) /* "cyddc.pyx":93 * return ddca_rc_name(code).decode("UTF-8") * * def rc_desc(code): # <<<<<<<<<<<<<< * return ddca_rc_desc(code).decode("UTF-8") * */ __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_code); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_rc_desc, 93, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 93, __pyx_L1_error) /* "cyddc.pyx":122 * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES * * def ddcy_get_max_max_tries(): # <<<<<<<<<<<<<< * return ddca_max_max_tries() * */ __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_ddcy_get_max_max_tries, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 122, __pyx_L1_error) /* "cyddc.pyx":125 * return ddca_max_max_tries() * * def get_max_tries(retry_type): # <<<<<<<<<<<<<< * return ddca_get_max_tries(retry_type) * */ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_retry_type); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_get_max_tries, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 125, __pyx_L1_error) /* "cyddc.pyx":128 * return ddca_get_max_tries(retry_type) * * def set_max_tries(retry_type, ct): # <<<<<<<<<<<<<< * ddca_set_max_tries(retry_type, ct) * */ __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_retry_type, __pyx_n_s_ct); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_set_max_tries, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 128, __pyx_L1_error) /* "cyddc.pyx":131 * ddca_set_max_tries(retry_type, ct) * * def enable_verify(onoff): # <<<<<<<<<<<<<< * ddca_enable_verify(onoff) * */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_onoff); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_enable_verify, 131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 131, __pyx_L1_error) /* "cyddc.pyx":134 * ddca_enable_verify(onoff) * * def is_verify_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_verify_enabled()) * */ __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_is_verify_enabled, 134, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 134, __pyx_L1_error) /* "cyddc.pyx":162 * OL_VERBOSE = DDCA_OL_VERBOSE * * def get_output_level(): # <<<<<<<<<<<<<< * return ddca_get_output_level() * */ __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_get_output_level, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 162, __pyx_L1_error) /* "cyddc.pyx":165 * return ddca_get_output_level() * * def set_output_level(ol): # <<<<<<<<<<<<<< * ddca_set_output_level(ol) * */ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_ol); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_set_output_level, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 165, __pyx_L1_error) /* "cyddc.pyx":168 * ddca_set_output_level(ol) * * def enable_report_ddc_errors(truefalse): # <<<<<<<<<<<<<< * ddca_set_output_level(truefalse) * */ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_truefalse); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_enable_report_ddc_errors, 168, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 168, __pyx_L1_error) /* "cyddc.pyx":171 * ddca_set_output_level(truefalse) * * def is_report_ddc_errors_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_report_ddc_errors_enabled()) * */ __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_is_report_ddc_errors_enabled, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 171, __pyx_L1_error) /* "cyddc.pyx":199 * STATS_ALL = DDCA_STATS_ALL * * def reset_stats(): # <<<<<<<<<<<<<< * ddca_reset_stats() * */ __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_reset_stats, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 199, __pyx_L1_error) /* "cyddc.pyx":202 * ddca_reset_stats() * * def show_stats(stats_type, depth): # <<<<<<<<<<<<<< * # TODO: verify that depth is integer, raise exception if not * ddca_show_stats(stats_type, depth) */ __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_stats_type, __pyx_n_s_depth); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_show_stats, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 202, __pyx_L1_error) /* "cyddc.pyx":215 * class CYDDC_Exception(Exception): * * def __init__(self, rc, msg=None): # <<<<<<<<<<<<<< * if msg is None: * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) */ __pyx_tuple__31 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_rc, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_init, 215, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 215, __pyx_L1_error) __pyx_tuple__33 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); /* "cyddc.pyx":222 * * * def create_ddc_exception(int rc): # <<<<<<<<<<<<<< * # To do: test for rc values that map to standard Python exceptions * */ __pyx_tuple__34 = PyTuple_Pack(8, __pyx_n_s_rc, __pyx_n_s_rc, __pyx_n_s_excp, __pyx_n_s_etype, __pyx_n_s_evalue, __pyx_n_s_tb, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_create_ddc_exception, 222, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 222, __pyx_L1_error) /* "cyddc.pyx":245 * return excp * * def check_ddca_status(int rc): # <<<<<<<<<<<<<< * if (rc != 0): * excp = CYDDC_Exception(rc) */ __pyx_tuple__36 = PyTuple_Pack(3, __pyx_n_s_rc, __pyx_n_s_rc, __pyx_n_s_excp); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cyddc_pyx, __pyx_n_s_check_ddca_status, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initcyddc(void); /*proto*/ PyMODINIT_FUNC initcyddc(void) #else PyMODINIT_FUNC PyInit_cyddc(void); /*proto*/ PyMODINIT_FUNC PyInit_cyddc(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_cyddc(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("cyddc", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_cyddc) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "cyddc")) { if (unlikely(PyDict_SetItemString(modules, "cyddc", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_5cyddc_Display_Identifier) < 0) __PYX_ERR(0, 399, __pyx_L1_error) __pyx_type_5cyddc_Display_Identifier.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Display_Identifier", (PyObject *)&__pyx_type_5cyddc_Display_Identifier) < 0) __PYX_ERR(0, 399, __pyx_L1_error) __pyx_ptype_5cyddc_Display_Identifier = &__pyx_type_5cyddc_Display_Identifier; if (PyType_Ready(&__pyx_type_5cyddc_Display_Ref) < 0) __PYX_ERR(0, 436, __pyx_L1_error) __pyx_type_5cyddc_Display_Ref.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Display_Ref", (PyObject *)&__pyx_type_5cyddc_Display_Ref) < 0) __PYX_ERR(0, 436, __pyx_L1_error) __pyx_ptype_5cyddc_Display_Ref = &__pyx_type_5cyddc_Display_Ref; if (PyType_Ready(&__pyx_type_5cyddc_Vcp_Value) < 0) __PYX_ERR(0, 512, __pyx_L1_error) __pyx_type_5cyddc_Vcp_Value.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Vcp_Value", (PyObject *)&__pyx_type_5cyddc_Vcp_Value) < 0) __PYX_ERR(0, 512, __pyx_L1_error) __pyx_ptype_5cyddc_Vcp_Value = &__pyx_type_5cyddc_Vcp_Value; __pyx_type_5cyddc_Non_Table_Vcp_Value.tp_base = __pyx_ptype_5cyddc_Vcp_Value; if (PyType_Ready(&__pyx_type_5cyddc_Non_Table_Vcp_Value) < 0) __PYX_ERR(0, 520, __pyx_L1_error) __pyx_type_5cyddc_Non_Table_Vcp_Value.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Non_Table_Vcp_Value", (PyObject *)&__pyx_type_5cyddc_Non_Table_Vcp_Value) < 0) __PYX_ERR(0, 520, __pyx_L1_error) __pyx_ptype_5cyddc_Non_Table_Vcp_Value = &__pyx_type_5cyddc_Non_Table_Vcp_Value; __pyx_type_5cyddc_Table_Vcp_Value.tp_base = __pyx_ptype_5cyddc_Vcp_Value; if (PyType_Ready(&__pyx_type_5cyddc_Table_Vcp_Value) < 0) __PYX_ERR(0, 535, __pyx_L1_error) __pyx_type_5cyddc_Table_Vcp_Value.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Table_Vcp_Value", (PyObject *)&__pyx_type_5cyddc_Table_Vcp_Value) < 0) __PYX_ERR(0, 535, __pyx_L1_error) __pyx_ptype_5cyddc_Table_Vcp_Value = &__pyx_type_5cyddc_Table_Vcp_Value; if (PyType_Ready(&__pyx_type_5cyddc_Display_Handle) < 0) __PYX_ERR(0, 544, __pyx_L1_error) __pyx_type_5cyddc_Display_Handle.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Display_Handle", (PyObject *)&__pyx_type_5cyddc_Display_Handle) < 0) __PYX_ERR(0, 544, __pyx_L1_error) __pyx_ptype_5cyddc_Display_Handle = &__pyx_type_5cyddc_Display_Handle; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "cyddc.pyx":1 * import traceback # <<<<<<<<<<<<<< * import sys * */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_traceback, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_traceback, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":2 * import traceback * import sys # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":47 * int ddca_build_options() * * def ddcy_ddcutil_version_string(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version_string().decode("UTF-8") * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_1ddcy_ddcutil_version_string, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ddcy_ddcutil_version_string, __pyx_t_1) < 0) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":50 * return ddca_ddcutil_version_string().decode("UTF-8") * * def ddcy_ddcutil_version(): # <<<<<<<<<<<<<< * return ddca_ddcutil_version() * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_3ddcy_ddcutil_version, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ddcy_ddcutil_version, __pyx_t_1) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":53 * return ddca_ddcutil_version() * * def ddcutil_version2(): # <<<<<<<<<<<<<< * v = ddca_ddcutil_version() * return (v.major, v.minor, v.micro) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_5ddcutil_version2, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ddcutil_version2, __pyx_t_1) < 0) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":57 * return (v.major, v.minor, v.micro) * * BUILT_WITH_ADL = DDCA_BUILT_WITH_ADL # <<<<<<<<<<<<<< * BUILT_WITH_USB = DDCA_BUILT_WITH_USB * BUILT_WITH_FAILSIM = DDCA_BUILT_WITH_FAILSIM */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Build_Option_Flags(DDCA_BUILT_WITH_ADL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_BUILT_WITH_ADL, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":58 * * BUILT_WITH_ADL = DDCA_BUILT_WITH_ADL * BUILT_WITH_USB = DDCA_BUILT_WITH_USB # <<<<<<<<<<<<<< * BUILT_WITH_FAILSIM = DDCA_BUILT_WITH_FAILSIM * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Build_Option_Flags(DDCA_BUILT_WITH_USB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_BUILT_WITH_USB, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":59 * BUILT_WITH_ADL = DDCA_BUILT_WITH_ADL * BUILT_WITH_USB = DDCA_BUILT_WITH_USB * BUILT_WITH_FAILSIM = DDCA_BUILT_WITH_FAILSIM # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Build_Option_Flags(DDCA_BUILT_WITH_FAILSIM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_BUILT_WITH_FAILSIM, __pyx_t_1) < 0) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":62 * * * def get_build_options(): # <<<<<<<<<<<<<< * bits = ddca_build_options() * print(bits) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_7get_build_options, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_build_options, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":90 * char * ddca_rc_desc(int status_code) * * def rc_name(code): # <<<<<<<<<<<<<< * return ddca_rc_name(code).decode("UTF-8") * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_9rc_name, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_rc_name, __pyx_t_1) < 0) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":93 * return ddca_rc_name(code).decode("UTF-8") * * def rc_desc(code): # <<<<<<<<<<<<<< * return ddca_rc_desc(code).decode("UTF-8") * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_11rc_desc, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_rc_desc, __pyx_t_1) < 0) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":118 * int ddca_is_verify_enabled() * * WRITE_ONLY_TRIES = DDCA_WRITE_ONLY_TRIES # <<<<<<<<<<<<<< * WRITE_READ_TRIES = DDCA_WRITE_READ_TRIES * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Retry_Type(DDCA_WRITE_ONLY_TRIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_WRITE_ONLY_TRIES, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":119 * * WRITE_ONLY_TRIES = DDCA_WRITE_ONLY_TRIES * WRITE_READ_TRIES = DDCA_WRITE_READ_TRIES # <<<<<<<<<<<<<< * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Retry_Type(DDCA_WRITE_READ_TRIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_WRITE_READ_TRIES, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":120 * WRITE_ONLY_TRIES = DDCA_WRITE_ONLY_TRIES * WRITE_READ_TRIES = DDCA_WRITE_READ_TRIES * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES # <<<<<<<<<<<<<< * * def ddcy_get_max_max_tries(): */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Retry_Type(DDCA_MULTI_PART_TRIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_MULTI_PART_TRIES, __pyx_t_1) < 0) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":122 * MULTI_PART_TRIES = DDCA_MULTI_PART_TRIES * * def ddcy_get_max_max_tries(): # <<<<<<<<<<<<<< * return ddca_max_max_tries() * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_13ddcy_get_max_max_tries, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ddcy_get_max_max_tries, __pyx_t_1) < 0) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":125 * return ddca_max_max_tries() * * def get_max_tries(retry_type): # <<<<<<<<<<<<<< * return ddca_get_max_tries(retry_type) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_15get_max_tries, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_max_tries, __pyx_t_1) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":128 * return ddca_get_max_tries(retry_type) * * def set_max_tries(retry_type, ct): # <<<<<<<<<<<<<< * ddca_set_max_tries(retry_type, ct) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_17set_max_tries, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_max_tries, __pyx_t_1) < 0) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":131 * ddca_set_max_tries(retry_type, ct) * * def enable_verify(onoff): # <<<<<<<<<<<<<< * ddca_enable_verify(onoff) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_19enable_verify, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_enable_verify, __pyx_t_1) < 0) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":134 * ddca_enable_verify(onoff) * * def is_verify_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_verify_enabled()) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_21is_verify_enabled, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_verify_enabled, __pyx_t_1) < 0) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":158 * int ddca_is_report_ddc_errors_enabled() * * OL_TERSE = DDCA_OL_TERSE # <<<<<<<<<<<<<< * OL_NORMAL = DDCA_OL_NORMAL * OL_VERBOSE = DDCA_OL_VERBOSE */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Output_Level(DDCA_OL_TERSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_OL_TERSE, __pyx_t_1) < 0) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":159 * * OL_TERSE = DDCA_OL_TERSE * OL_NORMAL = DDCA_OL_NORMAL # <<<<<<<<<<<<<< * OL_VERBOSE = DDCA_OL_VERBOSE * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Output_Level(DDCA_OL_NORMAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_OL_NORMAL, __pyx_t_1) < 0) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":160 * OL_TERSE = DDCA_OL_TERSE * OL_NORMAL = DDCA_OL_NORMAL * OL_VERBOSE = DDCA_OL_VERBOSE # <<<<<<<<<<<<<< * * def get_output_level(): */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Output_Level(DDCA_OL_VERBOSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_OL_VERBOSE, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":162 * OL_VERBOSE = DDCA_OL_VERBOSE * * def get_output_level(): # <<<<<<<<<<<<<< * return ddca_get_output_level() * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_23get_output_level, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_output_level, __pyx_t_1) < 0) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":165 * return ddca_get_output_level() * * def set_output_level(ol): # <<<<<<<<<<<<<< * ddca_set_output_level(ol) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_25set_output_level, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_output_level, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":168 * ddca_set_output_level(ol) * * def enable_report_ddc_errors(truefalse): # <<<<<<<<<<<<<< * ddca_set_output_level(truefalse) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_27enable_report_ddc_errors, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_enable_report_ddc_errors, __pyx_t_1) < 0) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":171 * ddca_set_output_level(truefalse) * * def is_report_ddc_errors_enabled(): # <<<<<<<<<<<<<< * return bool(ddca_is_report_ddc_errors_enabled()) * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_29is_report_ddc_errors_enabled, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_is_report_ddc_errors_enabled, __pyx_t_1) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":192 * void ddca_show_stats(int stats_types, int depth) * * STATS_NONE = DDCA_STATS_NONE # <<<<<<<<<<<<<< * STATS_TRIES = DDCA_STATS_TRIES * STATS_ERRORS = DDCA_STATS_ERRORS */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_STATS_NONE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATS_NONE, __pyx_t_1) < 0) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":193 * * STATS_NONE = DDCA_STATS_NONE * STATS_TRIES = DDCA_STATS_TRIES # <<<<<<<<<<<<<< * STATS_ERRORS = DDCA_STATS_ERRORS * STATS_CALLS = DDCA_STATS_CALLS */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_STATS_TRIES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATS_TRIES, __pyx_t_1) < 0) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":194 * STATS_NONE = DDCA_STATS_NONE * STATS_TRIES = DDCA_STATS_TRIES * STATS_ERRORS = DDCA_STATS_ERRORS # <<<<<<<<<<<<<< * STATS_CALLS = DDCA_STATS_CALLS * STATS_ELAPSED = DDCA_STATS_ELAPSED */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_STATS_ERRORS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATS_ERRORS, __pyx_t_1) < 0) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":195 * STATS_TRIES = DDCA_STATS_TRIES * STATS_ERRORS = DDCA_STATS_ERRORS * STATS_CALLS = DDCA_STATS_CALLS # <<<<<<<<<<<<<< * STATS_ELAPSED = DDCA_STATS_ELAPSED * STATS_ALL = DDCA_STATS_ALL */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_STATS_CALLS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATS_CALLS, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":196 * STATS_ERRORS = DDCA_STATS_ERRORS * STATS_CALLS = DDCA_STATS_CALLS * STATS_ELAPSED = DDCA_STATS_ELAPSED # <<<<<<<<<<<<<< * STATS_ALL = DDCA_STATS_ALL * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_STATS_ELAPSED); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATS_ELAPSED, __pyx_t_1) < 0) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":197 * STATS_CALLS = DDCA_STATS_CALLS * STATS_ELAPSED = DDCA_STATS_ELAPSED * STATS_ALL = DDCA_STATS_ALL # <<<<<<<<<<<<<< * * def reset_stats(): */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_STATS_ALL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_STATS_ALL, __pyx_t_1) < 0) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":199 * STATS_ALL = DDCA_STATS_ALL * * def reset_stats(): # <<<<<<<<<<<<<< * ddca_reset_stats() * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_31reset_stats, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_reset_stats, __pyx_t_1) < 0) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":202 * ddca_reset_stats() * * def show_stats(stats_type, depth): # <<<<<<<<<<<<<< * # TODO: verify that depth is integer, raise exception if not * ddca_show_stats(stats_type, depth) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_33show_stats, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_show_stats, __pyx_t_1) < 0) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":213 * * * class CYDDC_Exception(Exception): # <<<<<<<<<<<<<< * * def __init__(self, rc, msg=None): */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_CYDDC_Exception, __pyx_n_s_CYDDC_Exception, (PyObject *) NULL, __pyx_n_s_cyddc, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "cyddc.pyx":215 * class CYDDC_Exception(Exception): * * def __init__(self, rc, msg=None): # <<<<<<<<<<<<<< * if msg is None: * msg = "DDC status: %s - %s" % (rc_name(rc), rc_desc(rc)) */ __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5cyddc_15CYDDC_Exception_1__init__, 0, __pyx_n_s_CYDDC_Exception___init, NULL, __pyx_n_s_cyddc, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__33); if (PyObject_SetItem(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "cyddc.pyx":213 * * * class CYDDC_Exception(Exception): # <<<<<<<<<<<<<< * * def __init__(self, rc, msg=None): */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_CYDDC_Exception, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_CYDDC_Exception, __pyx_t_4) < 0) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":222 * * * def create_ddc_exception(int rc): # <<<<<<<<<<<<<< * # To do: test for rc values that map to standard Python exceptions * */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_35create_ddc_exception, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_ddc_exception, __pyx_t_1) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":245 * return excp * * def check_ddca_status(int rc): # <<<<<<<<<<<<<< * if (rc != 0): * excp = CYDDC_Exception(rc) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5cyddc_37check_ddca_status, NULL, __pyx_n_s_cyddc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_ddca_status, __pyx_t_1) < 0) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":406 * * @classmethod * def create_by_dispno(cls, int dispno): # <<<<<<<<<<<<<< * cdef void * c_did * rc = ddca_create_dispno_display_identifier(dispno, &c_did) */ __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5cyddc_Display_Identifier, __pyx_n_s_create_by_dispno); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "cyddc.pyx":405 * # self.c_did = c_did * * @classmethod # <<<<<<<<<<<<<< * def create_by_dispno(cls, int dispno): * cdef void * c_did */ __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_5cyddc_Display_Identifier->tp_dict, __pyx_n_s_create_by_dispno, __pyx_t_2) < 0) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5cyddc_Display_Identifier); /* "cyddc.pyx":443 * * @classmethod * def create_from_did(cls, Display_Identifier did): # <<<<<<<<<<<<<< * cdef void * c_dref * rc = ddca_create_display_ref(did.c_did, &c_dref) */ __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5cyddc_Display_Ref, __pyx_n_s_create_from_did); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "cyddc.pyx":442 * # self.c_dref = c_dref * * @classmethod # <<<<<<<<<<<<<< * def create_from_did(cls, Display_Identifier did): * cdef void * c_dref */ __pyx_t_1 = __Pyx_Method_ClassMethod(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_5cyddc_Display_Ref->tp_dict, __pyx_n_s_create_from_did, __pyx_t_1) < 0) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_5cyddc_Display_Ref); /* "cyddc.pyx":508 * DDCA_TABLE_VCP_VALUE * * NON_TABLE_VCP_VALUE = DDCA_NON_TABLE_VCP_VALUE # <<<<<<<<<<<<<< * TABLE_VCP_VALUE = DDCA_TABLE_VCP_VALUE * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Vcp_Value_Type(DDCA_NON_TABLE_VCP_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_NON_TABLE_VCP_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":509 * * NON_TABLE_VCP_VALUE = DDCA_NON_TABLE_VCP_VALUE * TABLE_VCP_VALUE = DDCA_TABLE_VCP_VALUE # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyInt_From_DDCA_Vcp_Value_Type(DDCA_TABLE_VCP_VALUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_TABLE_VCP_VALUE, __pyx_t_1) < 0) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "cyddc.pyx":548 * * @classmethod * def open(cls, Display_Ref dref): # <<<<<<<<<<<<<< * cdef int rc * cdef void * c_dh */ __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5cyddc_Display_Handle, __pyx_n_s_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "cyddc.pyx":547 * cdef void * c_dh * * @classmethod # <<<<<<<<<<<<<< * def open(cls, Display_Ref dref): * cdef int rc */ __pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_5cyddc_Display_Handle->tp_dict, __pyx_n_s_open, __pyx_t_2) < 0) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_5cyddc_Display_Handle); /* "cyddc.pyx":1 * import traceback # <<<<<<<<<<<<<< * import sys * */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init cyddc", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init cyddc"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* decode_c_string */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { Py_ssize_t length; if (unlikely((start < 0) | (stop < 0))) { size_t slen = strlen(cstring); if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "c-string too long to convert to Python"); return NULL; } length = (Py_ssize_t) slen; if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } length = stop - start; if (unlikely(length <= 0)) return PyUnicode_FromUnicode(NULL, 0); cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* GetModuleGlobalName */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); assert(PyCFunction_Check(func)); assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); } #endif // CYTHON_FAST_PYCCALL /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL #include "frameobject.h" static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; PyThreadState *tstate = PyThreadState_GET(); PyObject **fastlocals; Py_ssize_t i; PyObject *result; assert(globals != NULL); /* XXX Perhaps we should create a specialized PyFrame_New() that doesn't take locals, but does take builtins without sanity checking them. */ assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); if (f == NULL) { return NULL; } fastlocals = f->f_localsplus; for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; } result = PyEval_EvalFrameEx(f,0); ++tstate->recursion_depth; Py_DECREF(f); --tstate->recursion_depth; return result; } #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func); PyObject *closure; #if PY_MAJOR_VERSION >= 3 PyObject *kwdefs; #endif PyObject *kwtuple, **k; PyObject **d; Py_ssize_t nd; Py_ssize_t nk; PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { return NULL; } if ( #if PY_MAJOR_VERSION >= 3 co->co_kwonlyargcount == 0 && #endif likely(kwargs == NULL || nk == 0) && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { if (argdefs == NULL && co->co_argcount == nargs) { result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); goto done; } else if (nargs == 0 && argdefs != NULL && co->co_argcount == Py_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ args = &PyTuple_GET_ITEM(argdefs, 0); result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); goto done; } } if (kwargs != NULL) { Py_ssize_t pos, i; kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { result = NULL; goto done; } k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { Py_INCREF(k[i]); Py_INCREF(k[i+1]); i += 2; } nk = i / 2; } else { kwtuple = NULL; k = NULL; } closure = PyFunction_GET_CLOSURE(func); #if PY_MAJOR_VERSION >= 3 kwdefs = PyFunction_GET_KW_DEFAULTS(func); #endif if (argdefs != NULL) { d = &PyTuple_GET_ITEM(argdefs, 0); nd = Py_SIZE(argdefs); } else { d = NULL; nd = 0; } #if PY_MAJOR_VERSION >= 3 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, closure); #endif Py_XDECREF(kwtuple); done: Py_LeaveRecursiveCall(); return result; } #endif // CPython < 3.6 #endif // CYTHON_FAST_PYCALL /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = PyCFunction_GET_FUNCTION(func); self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); if (unlikely(!args)) return NULL; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, &arg, 1); } #endif #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } } return __Pyx__PyObject_CallOneArg(func, arg); } #else static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_Pack(1, arg); if (unlikely(!args)) return NULL; result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } #endif /* PyObjectCallNoArg */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, NULL, 0); } #endif #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { return __Pyx_PyObject_CallMethO(func, NULL); } } return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); } #endif /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_FAST_THREAD_STATE PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } /* UnpackItemEndCheck */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* WriteUnraisableException */ static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, int full_traceback, CYTHON_UNUSED int nogil) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_PyThreadState_declare #ifdef WITH_THREAD PyGILState_STATE state; if (nogil) state = PyGILState_Ensure(); #ifdef _MSC_VER else state = (PyGILState_STATE)-1; #endif #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); if (full_traceback) { Py_XINCREF(old_exc); Py_XINCREF(old_val); Py_XINCREF(old_tb); __Pyx_ErrRestore(old_exc, old_val, old_tb); PyErr_PrintEx(1); } #if PY_MAJOR_VERSION < 3 ctx = PyString_FromString(name); #else ctx = PyUnicode_FromString(name); #endif __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } #ifdef WITH_THREAD if (nogil) PyGILState_Release(state); #endif } /* ArgTypeTest */ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); } static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(PyObject_TypeCheck(obj, type))) return 1; } __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_LshiftObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long a = PyInt_AS_LONG(op1); if (likely(b < sizeof(long)*8 && a == (a << b) >> b) || !a) { return PyInt_FromLong(a << b); } } #endif #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { const long b = intval; long a, x; #ifdef HAVE_LONG_LONG const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif const digit* digits = ((PyLongObject*)op1)->ob_digit; const Py_ssize_t size = Py_SIZE(op1); if (likely(__Pyx_sst_abs(size) <= 1)) { a = likely(size) ? digits[0] : 0; if (size == -1) a = -a; } else { switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } default: return PyLong_Type.tp_as_number->nb_lshift(op1, op2); } } x = a << b; #ifdef HAVE_LONG_LONG if (unlikely(!(b < sizeof(long)*8 && a == x >> b)) && a) { lla = a; goto long_long; } #else if (likely(b < sizeof(long)*8 && a == x >> b) || !a) #endif return PyLong_FromLong(x); #ifdef HAVE_LONG_LONG long_long: llx = lla << llb; if (likely(lla == llx >> llb)) return PyLong_FromLongLong(llx); #endif } #endif return (inplace ? PyNumber_InPlaceLshift : PyNumber_Lshift)(op1, op2); } #endif /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* CalculateMetaclass */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; PyObject *tmp = PyTuple_GET_ITEM(bases, i); tmptype = Py_TYPE(tmp); #if PY_MAJOR_VERSION < 3 if (tmptype == &PyClass_Type) continue; #endif if (!metaclass) { metaclass = tmptype; continue; } if (PyType_IsSubtype(metaclass, tmptype)) continue; if (PyType_IsSubtype(tmptype, metaclass)) { metaclass = tmptype; continue; } PyErr_SetString(PyExc_TypeError, "metaclass conflict: " "the metaclass of a derived class " "must be a (non-strict) subclass " "of the metaclasses of all its bases"); return NULL; } if (!metaclass) { #if PY_MAJOR_VERSION < 3 metaclass = &PyClass_Type; #else metaclass = &PyType_Type; #endif } Py_INCREF((PyObject*) metaclass); return (PyObject*) metaclass; } /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); if (!fake_module) return NULL; Py_INCREF(fake_module); cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); if (cached_type) { if (!PyType_Check((PyObject*)cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", type->tp_name); goto bad; } if (cached_type->tp_basicsize != type->tp_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", type->tp_name); goto bad; } } else { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; PyErr_Clear(); if (PyType_Ready(type) < 0) goto bad; if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) goto bad; Py_INCREF(type); cached_type = type; } done: Py_DECREF(fake_module); return cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CythonFunction */ static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { if (unlikely(op->func_doc == NULL)) { if (op->func.m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); #else op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } } Py_INCREF(op->func_doc); return op->func_doc; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp = op->func_doc; if (value == NULL) { value = Py_None; } Py_INCREF(value); op->func_doc = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); #else op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } tmp = op->func_name; Py_INCREF(value); op->func_name = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_qualname); return op->func_qualname; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } tmp = op->func_qualname; Py_INCREF(value); op->func_qualname = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) { PyObject *self; self = m->func_closure; if (self == NULL) self = Py_None; Py_INCREF(self); return self; } static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) { if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } static int __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); return -1; } if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "setting function's dictionary to a non-dict"); return -1; } tmp = op->func_dict; Py_INCREF(value); op->func_dict = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) { Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) { PyObject* result = (op->func_code) ? op->func_code : Py_None; Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; } else if (value != Py_None && !PyTuple_Check(value)) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } Py_INCREF(value); tmp = op->defaults_tuple; op->defaults_tuple = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; } else if (value != Py_None && !PyDict_Check(value)) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } Py_INCREF(value); tmp = op->defaults_kwdict; op->defaults_kwdict = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value || value == Py_None) { value = NULL; } else if (!PyDict_Check(value)) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); tmp = op->func_annotations; op->func_annotations = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(m->func.m_ml->ml_name); #else return PyString_FromString(m->func.m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if PY_VERSION_HEX < 0x030500A0 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) #endif static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); if (op == NULL) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; op->func.m_ml = ml; op->func.m_self = (PyObject *) op; Py_XINCREF(closure); op->func_closure = closure; Py_XINCREF(module); op->func.m_module = module; op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; op->func_classobj = NULL; op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults_pyobjects = 0; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; PyObject_GC_Track(op); return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); Py_CLEAR(m->func.m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); Py_CLEAR(m->func_classobj); Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_XDECREF(pydefaults[i]); PyObject_Free(m->defaults); m->defaults = NULL; } return 0; } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); Py_VISIT(m->func.m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); Py_VISIT(m->func_classobj); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_VISIT(pydefaults[i]); } return 0; } static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { Py_INCREF(func); return func; } if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { if (type == NULL) type = (PyObject *)(Py_TYPE(obj)); return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); } if (obj == Py_None) obj = NULL; return __Pyx_PyMethod_New(func, obj, type); } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("", op->func_qualname, (void *)op); #else return PyString_FromFormat("", PyString_AsString(op->func_qualname), (void *)op); #endif } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; Py_ssize_t size; switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 0)) return (*meth)(self, NULL); PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 1)) { PyObject *result, *arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; result = (*meth)(self, arg0); Py_DECREF(arg0); return result; } PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags in " "__Pyx_CyFunction_Call. METH_OLDARGS is no " "longer supported!"); return NULL; } PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; argc = PyTuple_GET_SIZE(args); new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); Py_DECREF(new_args); } else { result = __Pyx_CyFunction_Call(func, args, kw); } return result; } static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, 0, 0, 0, #if PY_MAJOR_VERSION < 3 0, #else 0, #endif (reprfunc) __Pyx_CyFunction_repr, 0, 0, 0, 0, __Pyx_CyFunction_CallAsMethod, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, 0, #if PY_VERSION_HEX < 0x030500A0 offsetof(__pyx_CyFunctionObject, func_weakreflist), #else offsetof(PyCFunctionObject, m_weakreflist), #endif 0, 0, __pyx_CyFunction_methods, __pyx_CyFunction_members, __pyx_CyFunction_getsets, 0, 0, __Pyx_CyFunction_descr_get, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #endif }; static int __pyx_CyFunction_init(void) { __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); if (__pyx_CyFunctionType == NULL) { return -1; } return 0; } static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_Malloc(size); if (!m->defaults) return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); if (prep) { PyObject *pargs = PyTuple_Pack(2, name, bases); if (unlikely(!pargs)) { Py_DECREF(prep); return NULL; } ns = PyObject_Call(prep, pargs, mkw); Py_DECREF(prep); Py_DECREF(pargs); } else { if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) return NULL; PyErr_Clear(); ns = PyDict_New(); } } else { ns = PyDict_New(); } if (unlikely(!ns)) return NULL; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; return ns; bad: Py_DECREF(ns); return NULL; } static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass) { PyObject *result, *margs; PyObject *owned_metaclass = NULL; if (allow_py2_metaclass) { owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); if (owned_metaclass) { metaclass = owned_metaclass; } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { PyErr_Clear(); } else { return NULL; } } if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); Py_XDECREF(owned_metaclass); if (unlikely(!metaclass)) return NULL; owned_metaclass = metaclass; } margs = PyTuple_Pack(3, name, bases, dict); if (unlikely(!margs)) { result = NULL; } else { result = PyObject_Call(metaclass, margs, mkw); Py_DECREF(margs); } Py_XDECREF(owned_metaclass); return result; } /* GetNameInClass */ static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { PyObject *result; result = __Pyx_PyObject_GetAttrStr(nmspace, name); if (!result) result = __Pyx_GetModuleGlobalName(name); return result; } /* ClassMethod */ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) { #if CYTHON_COMPILING_IN_PYPY if (PyObject_TypeCheck(method, &PyWrapperDescr_Type)) { return PyClassMethod_New(method); } #else #if CYTHON_COMPILING_IN_PYSTON if (PyMethodDescr_Check(method)) { #else static PyTypeObject *methoddescr_type = NULL; if (methoddescr_type == NULL) { PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append"); if (!meth) return NULL; methoddescr_type = Py_TYPE(meth); Py_DECREF(meth); } if (PyObject_TypeCheck(method, methoddescr_type)) { #endif PyMethodDescrObject *descr = (PyMethodDescrObject *)method; #if PY_VERSION_HEX < 0x03020000 PyTypeObject *d_type = descr->d_type; #else PyTypeObject *d_type = descr->d_common.d_type; #endif return PyDescr_NewClassMethod(d_type, descr->d_method); } #endif else if (PyMethod_Check(method)) { return PyClassMethod_New(PyMethod_GET_FUNCTION(method)); } else if (PyCFunction_Check(method)) { return PyClassMethod_New(method); } #ifdef __Pyx_CyFunction_USED else if (PyObject_TypeCheck(method, __pyx_CyFunctionType)) { return PyClassMethod_New(method); } #endif PyErr_SetString(PyExc_TypeError, "Class-level classmethod() can only be called on " "a method_descriptor or instance method."); return NULL; } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Build_Option_Flags(DDCA_Build_Option_Flags value) { const DDCA_Build_Option_Flags neg_one = (DDCA_Build_Option_Flags) -1, const_zero = (DDCA_Build_Option_Flags) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(DDCA_Build_Option_Flags) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(DDCA_Build_Option_Flags) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Build_Option_Flags) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(DDCA_Build_Option_Flags) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Build_Option_Flags) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(DDCA_Build_Option_Flags), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Retry_Type(DDCA_Retry_Type value) { const DDCA_Retry_Type neg_one = (DDCA_Retry_Type) -1, const_zero = (DDCA_Retry_Type) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(DDCA_Retry_Type) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(DDCA_Retry_Type) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Retry_Type) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(DDCA_Retry_Type) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Retry_Type) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(DDCA_Retry_Type), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Output_Level(DDCA_Output_Level value) { const DDCA_Output_Level neg_one = (DDCA_Output_Level) -1, const_zero = (DDCA_Output_Level) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(DDCA_Output_Level) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(DDCA_Output_Level) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Output_Level) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(DDCA_Output_Level) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Output_Level) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(DDCA_Output_Level), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Stats_Type(DDCA_Stats_Type value) { const DDCA_Stats_Type neg_one = (DDCA_Stats_Type) -1, const_zero = (DDCA_Stats_Type) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(DDCA_Stats_Type) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(DDCA_Stats_Type) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Stats_Type) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(DDCA_Stats_Type) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Stats_Type) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(DDCA_Stats_Type), little, !is_unsigned); } } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_DDCA_Vcp_Value_Type(DDCA_Vcp_Value_Type value) { const DDCA_Vcp_Value_Type neg_one = (DDCA_Vcp_Value_Type) -1, const_zero = (DDCA_Vcp_Value_Type) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(DDCA_Vcp_Value_Type) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(DDCA_Vcp_Value_Type) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Vcp_Value_Type) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(DDCA_Vcp_Value_Type) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(DDCA_Vcp_Value_Type) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(DDCA_Vcp_Value_Type), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); } } static PyObject* __pyx_convert__to_py_DDCA_Ddcutil_Version_Spec(DDCA_Ddcutil_Version_Spec s) { PyObject* res; PyObject* member; res = PyDict_New(); if (unlikely(!res)) return NULL; member = __Pyx_PyInt_From_int(s.major); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_major, member) < 0)) goto bad; Py_DECREF(member); member = __Pyx_PyInt_From_int(s.minor); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_minor, member) < 0)) goto bad; Py_DECREF(member); member = __Pyx_PyInt_From_int(s.micro); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_micro, member) < 0)) goto bad; Py_DECREF(member); return res; bad: Py_XDECREF(member); Py_DECREF(res); return NULL; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(unsigned char) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(unsigned char) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(unsigned char), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntFromPy */ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(unsigned char) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(unsigned char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (unsigned char) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned char) 0; case 1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, digits[0]) case 2: if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT) { return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); } } break; case 3: if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT) { return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); } } break; case 4: if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT) { return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (unsigned char) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(unsigned char) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned char) 0; case -1: __PYX_VERIFY_RETURN_INT(unsigned char, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, +digits[0]) case -2: if (8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) { return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case 2: if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) { return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case -3: if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) { return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case 3: if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) { return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case -4: if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) { return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case 4: if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) { return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; } #endif if (sizeof(unsigned char) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else unsigned char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (unsigned char) -1; } } else { unsigned char val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (unsigned char) -1; val = __Pyx_PyInt_As_unsigned_char(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); return (unsigned char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned char"); return (unsigned char) -1; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif #else res = PyNumber_Int(x); #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ ddcutil-0.8.6/src/cython/Makefile0000644000175000001440000007707713230445447013655 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # src/cython/Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. 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)/ddcutil pkgincludedir = $(includedir)/ddcutil pkglibdir = $(libdir)/ddcutil pkglibexecdir = $(libexecdir)/ddcutil 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 = x86_64-pc-linux-gnu host_triplet = x86_64-pc-linux-gnu subdir = src/cython ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(pyexecdir)" LTLIBRARIES = $(py3exec_LTLIBRARIES) $(pyexec_LTLIBRARIES) cyddc2_la_DEPENDENCIES = ../libcommon.la \ ../libddcutil.la nodist_cyddc2_la_OBJECTS = cyddc2_la-cyddc2.lo cyddc2_la_OBJECTS = $(nodist_cyddc2_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent am__v_lt_1 = cyddc2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cyddc2_la_CFLAGS) \ $(CFLAGS) $(cyddc2_la_LDFLAGS) $(LDFLAGS) -o $@ am_cyddc2_la_rpath = -rpath $(pyexecdir) cyddc3_la_DEPENDENCIES = ../libcommon.la \ ../libddcutil.la nodist_cyddc3_la_OBJECTS = cyddc3_la-cyddc3.lo cyddc3_la_OBJECTS = $(nodist_cyddc3_la_OBJECTS) cyddc3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cyddc3_la_CFLAGS) \ $(CFLAGS) $(cyddc3_la_LDFLAGS) $(LDFLAGS) -o $@ am_cyddc3_la_rpath = -rpath $(py3execdir) AM_V_P = $(am__v_P_$(V)) am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I. -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) 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_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(nodist_cyddc2_la_SOURCES) $(nodist_cyddc3_la_SOURCES) DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = ${SHELL} /shared/playproj/i2c/config/missing aclocal-1.15 ADL_HEADER_DIR = /shared/playproj/i2c/adl_sdk_headers AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 0 AR = ar AUTOCONF = ${SHELL} /shared/playproj/i2c/config/missing autoconf AUTOHEADER = ${SHELL} /shared/playproj/i2c/config/missing autoheader AUTOMAKE = ${SHELL} /shared/playproj/i2c/config/missing automake-1.15 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 CFLAGS = -g -O2 CPP = gcc -E CPPFLAGS = CYGPATH_W = echo DBG = DEBIAN_DISTRIBUTION = xenial DEBIAN_RELEASE = 1 DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DLLTOOL = false DOCBASE_INSTALL_DOCS = install-docs DOXYGEN = DOXYGEN_PAPER_SIZE = DSYMUTIL = DUMPBIN = DX_CONFIG = DX_DOCDIR = DX_DOT = DX_DOXYGEN = DX_DVIPS = DX_EGREP = DX_ENV = DX_FLAG_chi = DX_FLAG_chm = DX_FLAG_doc = DX_FLAG_dot = DX_FLAG_html = DX_FLAG_man = DX_FLAG_pdf = DX_FLAG_ps = DX_FLAG_rtf = DX_FLAG_xml = DX_HHC = DX_LATEX = DX_MAKEINDEX = DX_PDFLATEX = DX_PERL = DX_PROJECT = ECHO_C = ECHO_N = -n ECHO_T = EGREP = /bin/grep -E ENABLE_SHARED_LIB_FLAG = 1 ENABLE_USB_FLAG = 1 EXEEXT = FGREP = /bin/grep -F GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include GLIB_LIBS = -lglib-2.0 GOBJECT_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include GOBJECT_LIBS = -lgobject-2.0 -lglib-2.0 GREP = /bin/grep INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = $(install_sh) -c -s INTROSPECTION_CFLAGS = -pthread -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include INTROSPECTION_COMPILER = /usr/bin/g-ir-compiler INTROSPECTION_GENERATE = /usr/bin/g-ir-generate INTROSPECTION_GIRDIR = /usr/share/gir-1.0 INTROSPECTION_LIBS = -lgirepository-1.0 -lgobject-2.0 -lglib-2.0 INTROSPECTION_MAKEFILE = /usr/share/gobject-introspection-1.0/Makefile.introspection INTROSPECTION_SCANNER = /usr/bin/g-ir-scanner INTROSPECTION_TYPELIBDIR = /usr/lib/x86_64-linux-gnu/girepository-1.0 LD = /usr/bin/ld -m elf_x86_64 LDFLAGS = LIBDRM_CFLAGS = -I/usr/include/libdrm LIBDRM_LIBS = -ldrm LIBOBJS = LIBS = -ldl LIBTOOL = $(SHELL) $(top_builddir)/libtool LIBTOOL_DEPS = config/ltmain.sh LIBUSB_CFLAGS = -I/usr/include/libusb-1.0 LIBUSB_LIBS = -lusb-1.0 LIBX11_CFLAGS = LIBX11_LIBS = -lX11 LIPO = LN_S = ln -s LTLIBOBJS = LT_AGE = 0 LT_CURRENT = 0 LT_REVISION = 0 LT_SYS_LIBRARY_PATH = MAKEINFO = ${SHELL} /shared/playproj/i2c/config/missing makeinfo MANIFEST_TOOL = : MKDIR_P = /bin/mkdir -p NM = /usr/bin/nm -B NMEDIT = OBJDUMP = objdump OBJEXT = o OTOOL = OTOOL64 = PACKAGE = ddcutil PACKAGE_BUGREPORT = rockowitz@minsoft.com PACKAGE_NAME = ddcutil PACKAGE_STRING = ddcutil 0.8.6 PACKAGE_TARNAME = ddcutil PACKAGE_URL = PACKAGE_VERSION = 0.8.6 PATH_SEPARATOR = : PKG_CONFIG = /usr/bin/pkg-config PKG_CONFIG_LIBDIR = PKG_CONFIG_PATH = PY2_CFLAGS = -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 PY2_EXECDIR = /usr/lib/python2.7/dist-packages PY2_EXTRA_LDFLAGS = -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions PY2_EXTRA_LIBS = -lpthread -ldl -lutil -lm PY2_LIBS = -lpython2.7 PY3_CFLAGS = -I/usr/include/python3.6m -I/usr/include/x86_64-linux-gnu/python3.6m PY3_EXECDIR = /usr/lib/python3/dist-packages PY3_EXTRA_LDFLAGS = -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions PY3_EXTRA_LIBS = -lpthread -ldl -lutil -lm PY3_LIBS = -lpython3.6m PYEXECDIR = ${exec_prefix}/lib/python2.7/dist-packages PYTHON = /usr/bin/python PYTHON3 = /usr/bin/python3 PYTHON3_EXEC_PREFIX = ${exec_prefix} PYTHON3_PLATFORM = linux PYTHON3_PREFIX = ${prefix} PYTHON3_VERSION = 3.6 PYTHON_EXEC_PREFIX = ${exec_prefix} PYTHON_PLATFORM = linux2 PYTHON_PREFIX = ${prefix} PYTHON_VERSION = 2.7 RANLIB = ranlib REQUIRED_PACKAGES = glib-2.0 >= 2.32 xrandr x11 SED = /bin/sed SET_MAKE = SHELL = /bin/bash STRIP = strip SWIG = /usr/bin/swig SWIG_LIB = /usr/share/swig3.0 UDEV_CFLAGS = UDEV_LIBS = -ludev VERSION = 0.8.6 XRANDR_CFLAGS = XRANDR_LIBS = -lXrandr ZLIB_CFLAGS = ZLIB_LIBS = -lz abs_builddir = /shared/playproj/i2c/src/cython abs_srcdir = /shared/playproj/i2c/src/cython abs_top_builddir = /shared/playproj/i2c abs_top_srcdir = /shared/playproj/i2c ac_ct_AR = ar ac_ct_CC = gcc ac_ct_DUMPBIN = am__include = include am__leading_dot = . am__quote = am__tar = $${TAR-tar} chof - "$$tardir" am__untar = $${TAR-tar} xf - bindir = ${exec_prefix}/bin build = x86_64-pc-linux-gnu build_alias = build_cpu = x86_64 build_os = linux-gnu build_vendor = pc builddir = . datadir = ${datarootdir} datarootdir = ${prefix}/share docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} dvidir = ${docdir} exec_prefix = ${prefix} host = x86_64-pc-linux-gnu host_alias = host_cpu = x86_64 host_os = linux-gnu host_vendor = pc htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info install_sh = ${SHELL} /shared/playproj/i2c/config/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale localstatedir = ${prefix}/var mandir = ${datarootdir}/man mkdir_p = $(MKDIR_P) oldincludedir = /usr/include pdfdir = ${docdir} pkgpy3execdir = ${py3execdir}/ddcutil pkgpyexecdir = ${pyexecdir}/ddcutil pkgpython3dir = ${python3dir}/ddcutil pkgpythondir = ${pythondir}/ddcutil prefix = /usr/local program_transform_name = s,x,x, psdir = ${docdir} py2execdir = /usr/lib/python2.7/dist-packages py3execdir = /usr/lib/python3/dist-packages pyexecdir = ${exec_prefix}/lib/python2.7/dist-packages python3dir = ${prefix}/lib/python3/dist-packages pythondir = ${prefix}/lib/python2.7/dist-packages runstatedir = ${localstatedir}/run sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com srcdir = . sysconfdir = ${prefix}/etc target_alias = top_build_prefix = ../../ top_builddir = ../.. top_srcdir = ../.. generated_source_files = \ cyddc2.c \ cyddc3.c CLEANFILES = ${generated_source_files} *.so cyddc2.html cyddc3.html # Python extension modules, installed in $(py2execdir) or $(py3execdir) pyexec_LTLIBRARIES = cyddc2.la py3exec_LTLIBRARIES = cyddc3.la # nodist_py3exec_PYTHON = # # Python 2 version # # Module source code, nodist because cyddc2.c is generated nodist_cyddc2_la_SOURCES = cyddc2.c # Flags when compiling files in cyddc2_SOURCES cyddc2_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY2_CFLAGS} cyddc2_la_CFLAGS = $(PYTHON_CFLAGS) # Global and order-independent shared library and program linker config flags and options cyddc2_la_LDFLAGS = -module -shared \ -export_dynamic -static version_info \ '0:0:0' # Link in the core library cyddc2_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la # # Python 3 version # # nodist because cyddc3.c is generated nodist_cyddc3_la_SOURCES = cyddc3.c # Flags when compiling files in cyddc3_SOURCES cyddc3_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY3_CFLAGS} cyddc3_la_CFLAGS = $(PYTHON3_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info cyddc3_la_LDFLAGS = -module -shared \ -export_dynamic -static version_info \ '0:0:0' # Link in the core library cyddc3_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/cython/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/cython/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-py3execLTLIBRARIES: $(py3exec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || 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)$(py3execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py3execdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(py3execdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(py3execdir)"; \ } uninstall-py3execLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(py3execdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(py3execdir)/$$f"; \ done clean-py3execLTLIBRARIES: -test -z "$(py3exec_LTLIBRARIES)" || rm -f $(py3exec_LTLIBRARIES) @list='$(py3exec_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}; \ } cyddc2.la: $(cyddc2_la_OBJECTS) $(cyddc2_la_DEPENDENCIES) $(EXTRA_cyddc2_la_DEPENDENCIES) $(AM_V_CCLD)$(cyddc2_la_LINK) $(am_cyddc2_la_rpath) $(cyddc2_la_OBJECTS) $(cyddc2_la_LIBADD) $(LIBS) cyddc3.la: $(cyddc3_la_OBJECTS) $(cyddc3_la_DEPENDENCIES) $(EXTRA_cyddc3_la_DEPENDENCIES) $(AM_V_CCLD)$(cyddc3_la_LINK) $(am_cyddc3_la_rpath) $(cyddc3_la_OBJECTS) $(cyddc3_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c include ./$(DEPDIR)/cyddc2_la-cyddc2.Plo include ./$(DEPDIR)/cyddc3_la-cyddc3.Plo .c.o: $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ $(am__mv) $$depbase.Tpo $$depbase.Po # $(AM_V_CC)source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(COMPILE) -c -o $@ $< .c.obj: $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ $(am__mv) $$depbase.Tpo $$depbase.Po # $(AM_V_CC)source='$<' object='$@' libtool=no \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ $(am__mv) $$depbase.Tpo $$depbase.Plo # $(AM_V_CC)source='$<' object='$@' libtool=yes \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $< cyddc2_la-cyddc2.lo: cyddc2.c $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cyddc2_la_CPPFLAGS) $(CPPFLAGS) $(cyddc2_la_CFLAGS) $(CFLAGS) -MT cyddc2_la-cyddc2.lo -MD -MP -MF $(DEPDIR)/cyddc2_la-cyddc2.Tpo -c -o cyddc2_la-cyddc2.lo `test -f 'cyddc2.c' || echo '$(srcdir)/'`cyddc2.c $(AM_V_at)$(am__mv) $(DEPDIR)/cyddc2_la-cyddc2.Tpo $(DEPDIR)/cyddc2_la-cyddc2.Plo # $(AM_V_CC)source='cyddc2.c' object='cyddc2_la-cyddc2.lo' libtool=yes \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cyddc2_la_CPPFLAGS) $(CPPFLAGS) $(cyddc2_la_CFLAGS) $(CFLAGS) -c -o cyddc2_la-cyddc2.lo `test -f 'cyddc2.c' || echo '$(srcdir)/'`cyddc2.c cyddc3_la-cyddc3.lo: cyddc3.c $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cyddc3_la_CPPFLAGS) $(CPPFLAGS) $(cyddc3_la_CFLAGS) $(CFLAGS) -MT cyddc3_la-cyddc3.lo -MD -MP -MF $(DEPDIR)/cyddc3_la-cyddc3.Tpo -c -o cyddc3_la-cyddc3.lo `test -f 'cyddc3.c' || echo '$(srcdir)/'`cyddc3.c $(AM_V_at)$(am__mv) $(DEPDIR)/cyddc3_la-cyddc3.Tpo $(DEPDIR)/cyddc3_la-cyddc3.Plo # $(AM_V_CC)source='cyddc3.c' object='cyddc3_la-cyddc3.lo' libtool=yes \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ # $(AM_V_CC_no)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(cyddc3_la_CPPFLAGS) $(CPPFLAGS) $(cyddc3_la_CFLAGS) $(CFLAGS) -c -o cyddc3_la-cyddc3.lo `test -f 'cyddc3.c' || echo '$(srcdir)/'`cyddc3.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(pyexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-py3execLTLIBRARIES \ clean-pyexecLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-py3execLTLIBRARIES install-pyexecLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-py3execLTLIBRARIES uninstall-pyexecLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-py3execLTLIBRARIES clean-pyexecLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am \ install-py3execLTLIBRARIES install-pyexecLTLIBRARIES \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-py3execLTLIBRARIES uninstall-pyexecLTLIBRARIES .PRECIOUS: Makefile cyddc2.c: cyddc.pyx show_vars @echo "=====> (src/cython/Makefile) Executing target cyddc2.c" cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -2 -o cyddc2.c -a cyddc.pyx cyddc3.c: cyddc.pyx show_vars @echo "=====> (src/cython/Makefile) Executing target cyddc.c" cython -I${top_srcdir}/src -I{top_srcdir}/src/public -I . -3 -o cyddc3.c -a cyddc.pyx # Add show_vars to dependencies for debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" @echo " LIBS = $(LIBS)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_DEPENDENCIES = $(cyddc2_la_DEPENDENCIES)" @echo " EXTRA_cyddc2_la_DEPENDENCIES = $(EXTRA_cyddc2_la_DEPENDENCIES)" @echo " cyddc2_la_LINK = $(cyddc2_la_LINK)" @echo " am_cyddc2_la_rpath = $(am_cyddc2_la_rpath)" @echo " cyddc2_la_OBJECTS = $(cyddc2_la_OBJECTS)" @echo " cyddc2_la_LIBADD = $(cyddc2_la_LIBADD)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_DEPENDENCIES = $(cyddc3_la_DEPENDENCIES)" @echo " EXTRA_cyddc3_la_DEPENDENCIES = $(EXTRA_cyddc3_la_DEPENDENCIES)" @echo " cyddc3_la_LINK = $(cyddc3_la_LINK)" @echo " am_cyddc3_la_rpath = $(am_cyddc3_la_rpath)" @echo " cyddc3_la_OBJECTS = $(cyddc3_la_OBJECTS)" @echo " cyddc3_la_LIBADD = $(cyddc3_la_LIBADD)" # ld vars: #@echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars # 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: ddcutil-0.8.6/src/cffi/0000755000175000001440000000000013230445447011656 500000000000000ddcutil-0.8.6/src/cffi/Makefile.am0000644000175000001440000001341613230170535013630 00000000000000generated_source_files = \ ddccffi.c ddccffi2.c ddccffi3.c CLEANFILES = ${generated_source_files} libddccffi2.la libddccffi3.la _ddccffi2.c _ddccffi3.c __pycache__/* if ENABLE_CFFI # Python extension modules, installed in $(py2execdir) or $(py3execdir) # nodist_py3exec_PYTHON = if ENABLE_PY2 pyexec_LTLIBRARIES = _ddccffi2.la # # Python 2 version # # Generated C file is version agnostic, but unfortunately the # initialization entry point name must match the .so file name, # and the only way to force this is use different c file names # in build_cffi.py _ddccffi2.c: _ddccffi_cdef_c_api.h _ddccffi_cdef_types.h show_vars @echo "=====> (src/cython/Makefile) Executing target _ddccffi2.c" python2 build_cffi.py --nocompile # Module source code, nodist because ddc_cffi.c is generated nodist__ddccffi2_la_SOURCES = _ddccffi2.c # Flags when compiling files in ddc_cffi2_SOURCES _ddccffi2_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY2_CFLAGS} _ddccffi2_la_CFLAGS = $(PYTHON_CFLAGS) # Global and order-independent shared library and program linker config flags and options _ddccffi2_la_LDFLAGS = _ddccffi2_la_LDFLAGS += -module -shared -export_dynamic -static _ddccffi2_la_LDFLAGS += version_info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library _ddccffi2_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la endif if ENABLE_PY3 py3exec_LTLIBRARIES = _ddccffi3.la # # Python 3 version # # Generated C file is version agnostic, but unfortunately the # initialization entry point name must match the .so file name, # and the only way to force this is use different c file names # in build_cffi.py _ddccffi3.c: _ddccffi_cdef_c_api.h _ddccffi_cdef_types.h show_vars @echo "=====> (src/cython/Makefile) Executing target _ddccffi3.c" python3 build_cffi.py --nocompile # nodist because ddc_cffi.c is generated nodist__ddccffi3_la_SOURCES = _ddccffi3.c # Flags when compiling files in ddc_cffi3_SOURCES _ddccffi3_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY3_CFLAGS} _ddccffi3_la_CFLAGS = $(PYTHON3_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info _ddccffi3_la_LDFLAGS = _ddccffi3_la_LDFLAGS += -module -shared -export_dynamic -static _ddccffi3_la_LDFLAGS += version_info '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library _ddccffi3_la_LIBADD = \ ../libcommon.la \ ../libddcutil.la endif endif # Add show_vars to dependencies for debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" @echo " LIBS = $(LIBS)" @echo " _ddccffi2_la_OBJECTS = $(ddc_cffi2_la_OBJECTS)" @echo " _ddccffi2_la_DEPENDENCIES = $(ddc_cffi2_la_DEPENDENCIES)" @echo " EXTRA_ddc_cffi2_la_DEPENDENCIES = $(EXTRA_ddc_cffi2_la_DEPENDENCIES)" @echo " _ddccffi2_la_LINK = $(ddc_cffi2_la_LINK)" @echo " am_ddc_cffi2_la_rpath = $(am_ddc_cffi2_la_rpath)" @echo " _ddccffi2_la_OBJECTS = $(ddc_cffi2_la_OBJECTS)" @echo " _ddccffi2_la_LIBADD = $(ddc_cffi2_la_LIBADD)" @echo " _ddccffi3_la_OBJECTS = $(ddc_cffi3_la_OBJECTS)" @echo " _ddccffi3_la_DEPENDENCIES = $(ddc_cffi3_la_DEPENDENCIES)" @echo " EXTRA_ddc_cffi3_la_DEPENDENCIES = $(EXTRA_ddc_cffi3_la_DEPENDENCIES)" @echo " _ddccffi3_la_LINK = $(ddc_cffi3_la_LINK)" @echo " am_ddc_cffi3_la_rpath = $(am_ddc_cffi3_la_rpath)" @echo " _ddccffi3_la_OBJECTS = $(ddc_cffi3_la_OBJECTS)" @echo " _ddccffi3_la_LIBADD = $(ddc_cffi3_la_LIBADD)" # ld vars: #@echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars ddcutil-0.8.6/src/cffi/Makefile.in0000644000175000001440000010510013230171237013631 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/cffi ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(pyexecdir)" LTLIBRARIES = $(py3exec_LTLIBRARIES) $(pyexec_LTLIBRARIES) @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@_ddccffi2_la_DEPENDENCIES = \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ ../libcommon.la \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ ../libddcutil.la @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@nodist__ddccffi2_la_OBJECTS = \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ _ddccffi2_la-_ddccffi2.lo _ddccffi2_la_OBJECTS = $(nodist__ddccffi2_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 = _ddccffi2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_ddccffi2_la_CFLAGS) \ $(CFLAGS) $(_ddccffi2_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@am__ddccffi2_la_rpath = -rpath \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ $(pyexecdir) @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@_ddccffi3_la_DEPENDENCIES = \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ ../libcommon.la \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ ../libddcutil.la @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@nodist__ddccffi3_la_OBJECTS = \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ _ddccffi3_la-_ddccffi3.lo _ddccffi3_la_OBJECTS = $(nodist__ddccffi3_la_OBJECTS) _ddccffi3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_ddccffi3_la_CFLAGS) \ $(CFLAGS) $(_ddccffi3_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@am__ddccffi3_la_rpath = -rpath \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ $(py3execdir) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(nodist__ddccffi2_la_SOURCES) \ $(nodist__ddccffi3_la_SOURCES) DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ generated_source_files = \ ddccffi.c ddccffi2.c ddccffi3.c CLEANFILES = ${generated_source_files} libddccffi2.la libddccffi3.la _ddccffi2.c _ddccffi3.c __pycache__/* # Python extension modules, installed in $(py2execdir) or $(py3execdir) # nodist_py3exec_PYTHON = @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@pyexec_LTLIBRARIES = _ddccffi2.la # Module source code, nodist because ddc_cffi.c is generated @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@nodist__ddccffi2_la_SOURCES = _ddccffi2.c # Flags when compiling files in ddc_cffi2_SOURCES @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@_ddccffi2_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY2_CFLAGS} @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@_ddccffi2_la_CFLAGS = $(PYTHON_CFLAGS) # Global and order-independent shared library and program linker config flags and options @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@_ddccffi2_la_LDFLAGS = -module \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ -shared -export_dynamic \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ -static version_info \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@_ddccffi2_la_LIBADD = \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ ../libcommon.la \ @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ ../libddcutil.la @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@py3exec_LTLIBRARIES = _ddccffi3.la # nodist because ddc_cffi.c is generated @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@nodist__ddccffi3_la_SOURCES = _ddccffi3.c # Flags when compiling files in ddc_cffi3_SOURCES @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@_ddccffi3_la_CPPFLAGS = -I${top_srcdir}/src -I${top_srcdir}/src/public ${PY3_CFLAGS} @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@_ddccffi3_la_CFLAGS = $(PYTHON3_CFLAGS) # Global and order-independent shared library and program linker config flags and options # -module forces libtool to generate a dynamically loadable module # -static do not link against shared libraries, all external references must be resolved from static libraries # -shared create a shared library # -export-dynamic add all symbols to dynamic symbol table, needed for dlopen # -avoid-version avoid versioning if possible (any effect on Linux?) # -version-info @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@_ddccffi3_la_LDFLAGS = -module \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ -shared -export_dynamic \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ -static version_info \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ '@LT_CURRENT@:@LT_REVISION@:@LT_AGE@' # Link in the core library @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@_ddccffi3_la_LIBADD = \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ ../libcommon.la \ @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ ../libddcutil.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/cffi/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/cffi/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-py3execLTLIBRARIES: $(py3exec_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || 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)$(py3execdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(py3execdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(py3execdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(py3execdir)"; \ } uninstall-py3execLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(py3exec_LTLIBRARIES)'; test -n "$(py3execdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(py3execdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(py3execdir)/$$f"; \ done clean-py3execLTLIBRARIES: -test -z "$(py3exec_LTLIBRARIES)" || rm -f $(py3exec_LTLIBRARIES) @list='$(py3exec_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}; \ } _ddccffi2.la: $(_ddccffi2_la_OBJECTS) $(_ddccffi2_la_DEPENDENCIES) $(EXTRA__ddccffi2_la_DEPENDENCIES) $(AM_V_CCLD)$(_ddccffi2_la_LINK) $(am__ddccffi2_la_rpath) $(_ddccffi2_la_OBJECTS) $(_ddccffi2_la_LIBADD) $(LIBS) _ddccffi3.la: $(_ddccffi3_la_OBJECTS) $(_ddccffi3_la_DEPENDENCIES) $(EXTRA__ddccffi3_la_DEPENDENCIES) $(AM_V_CCLD)$(_ddccffi3_la_LINK) $(am__ddccffi3_la_rpath) $(_ddccffi3_la_OBJECTS) $(_ddccffi3_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_ddccffi2_la-_ddccffi2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_ddccffi3_la-_ddccffi3.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< _ddccffi2_la-_ddccffi2.lo: _ddccffi2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_ddccffi2_la_CPPFLAGS) $(CPPFLAGS) $(_ddccffi2_la_CFLAGS) $(CFLAGS) -MT _ddccffi2_la-_ddccffi2.lo -MD -MP -MF $(DEPDIR)/_ddccffi2_la-_ddccffi2.Tpo -c -o _ddccffi2_la-_ddccffi2.lo `test -f '_ddccffi2.c' || echo '$(srcdir)/'`_ddccffi2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_ddccffi2_la-_ddccffi2.Tpo $(DEPDIR)/_ddccffi2_la-_ddccffi2.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='_ddccffi2.c' object='_ddccffi2_la-_ddccffi2.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) $(_ddccffi2_la_CPPFLAGS) $(CPPFLAGS) $(_ddccffi2_la_CFLAGS) $(CFLAGS) -c -o _ddccffi2_la-_ddccffi2.lo `test -f '_ddccffi2.c' || echo '$(srcdir)/'`_ddccffi2.c _ddccffi3_la-_ddccffi3.lo: _ddccffi3.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(_ddccffi3_la_CPPFLAGS) $(CPPFLAGS) $(_ddccffi3_la_CFLAGS) $(CFLAGS) -MT _ddccffi3_la-_ddccffi3.lo -MD -MP -MF $(DEPDIR)/_ddccffi3_la-_ddccffi3.Tpo -c -o _ddccffi3_la-_ddccffi3.lo `test -f '_ddccffi3.c' || echo '$(srcdir)/'`_ddccffi3.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/_ddccffi3_la-_ddccffi3.Tpo $(DEPDIR)/_ddccffi3_la-_ddccffi3.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='_ddccffi3.c' object='_ddccffi3_la-_ddccffi3.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) $(_ddccffi3_la_CPPFLAGS) $(CPPFLAGS) $(_ddccffi3_la_CFLAGS) $(CFLAGS) -c -o _ddccffi3_la-_ddccffi3.lo `test -f '_ddccffi3.c' || echo '$(srcdir)/'`_ddccffi3.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(py3execdir)" "$(DESTDIR)$(pyexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-py3execLTLIBRARIES \ clean-pyexecLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-py3execLTLIBRARIES install-pyexecLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-py3execLTLIBRARIES uninstall-pyexecLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-py3execLTLIBRARIES clean-pyexecLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am \ install-py3execLTLIBRARIES install-pyexecLTLIBRARIES \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-py3execLTLIBRARIES uninstall-pyexecLTLIBRARIES .PRECIOUS: Makefile # # Python 2 version # # Generated C file is version agnostic, but unfortunately the # initialization entry point name must match the .so file name, # and the only way to force this is use different c file names # in build_cffi.py @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@_ddccffi2.c: _ddccffi_cdef_c_api.h _ddccffi_cdef_types.h show_vars @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ @echo "=====> (src/cython/Makefile) Executing target _ddccffi2.c" @ENABLE_CFFI_TRUE@@ENABLE_PY2_TRUE@ python2 build_cffi.py --nocompile # # Python 3 version # # Generated C file is version agnostic, but unfortunately the # initialization entry point name must match the .so file name, # and the only way to force this is use different c file names # in build_cffi.py @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@_ddccffi3.c: _ddccffi_cdef_c_api.h _ddccffi_cdef_types.h show_vars @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ @echo "=====> (src/cython/Makefile) Executing target _ddccffi3.c" @ENABLE_CFFI_TRUE@@ENABLE_PY3_TRUE@ python3 build_cffi.py --nocompile # Add show_vars to dependencies for debugging show_vars: @echo " AM_CFLAGS = $(AM_CFLAGS)" @echo " AM_CPPFLAGS = $(AM_CPPFLAGS)" @echo " AX_SWIG_PYTHON_CPPFLAGS = $(AX_SWIG_PYTHON_CPPFLAGS)" @echo " AX_SWIG_PYTHON_LIBS = $(AX_SWIG_PYTHON_LIBS)" @echo " AX_SWIG_PYTHON_OPT = $(AX_SWIG_PYTHON_OPT)" @echo " PYTHON_CFLAGS = $(PYTHON_CFLAGS)" @echo " PYTHON_CPPFLAGS = $(PYTHON_CPPFLAGS)" @echo " PYTHON_EXEC_PREFIX = $(PYTHON_EXEC_PREFIX)" @echo " PYTHON_EXTRA_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)" @echo " PYTHON_EXTRA_LIBS = $(PYTHON_EXTRA_LIBS)" @echo " PY2_CFLAGS = $(PY2_CFLAGS)" @echo " PY2_LIBS = $(PY2_LIBS)" @echo " PY2_EXTRA_LDFLAGS = $(PY2_EXTRA_LDFLAGS)" @echo " PY2_EXTRA_LIBS = $(PY2_EXTRA_LIBS)" @echo " PY3_CFLAGS = $(PY3_CFLAGS)" @echo " PY3_LIBS = $(PY3_LIBS)" @echo " PY3_EXTRA_LDFLAGS = $(PY3_EXTRA_LDFLAGS)" @echo " PY3_EXTRA_LIBS = $(PY3_EXTRA_LIBS)" @echo " PYTHON_LDFLAGS = $(PYTHON_LDFLAGS)" @echo " PYTHON_LIBS = $(PYTHON_LIBS)" @echo " PYTHON_SITE_PKG = $(PYTHON_SITE_PKG)" @echo " PYTHON_SITE_PKG_EXEC = $(PYTHON_SITE_PKG_EXEC)" @echo " SWIG = $(SWIG) " @echo " SWIG_LIB = $(SWIG_LIB)" @echo " includedir = $(includedir)" @echo " prefix = $(prefix)" @echo " pyexecdir = $(pyexecdir)" @echo " pythondir = $(pythondir)" @echo " py2execdir = $(py2execdir)" @echo " py3execdir = $(py3execdir)" @echo " python3dir = $(python3dir)" @echo " srcdir = $(srcdir)" @echo " top_srcdir = $(top_srcdir)" @echo " LIBS = $(LIBS)" @echo " _ddccffi2_la_OBJECTS = $(ddc_cffi2_la_OBJECTS)" @echo " _ddccffi2_la_DEPENDENCIES = $(ddc_cffi2_la_DEPENDENCIES)" @echo " EXTRA_ddc_cffi2_la_DEPENDENCIES = $(EXTRA_ddc_cffi2_la_DEPENDENCIES)" @echo " _ddccffi2_la_LINK = $(ddc_cffi2_la_LINK)" @echo " am_ddc_cffi2_la_rpath = $(am_ddc_cffi2_la_rpath)" @echo " _ddccffi2_la_OBJECTS = $(ddc_cffi2_la_OBJECTS)" @echo " _ddccffi2_la_LIBADD = $(ddc_cffi2_la_LIBADD)" @echo " _ddccffi3_la_OBJECTS = $(ddc_cffi3_la_OBJECTS)" @echo " _ddccffi3_la_DEPENDENCIES = $(ddc_cffi3_la_DEPENDENCIES)" @echo " EXTRA_ddc_cffi3_la_DEPENDENCIES = $(EXTRA_ddc_cffi3_la_DEPENDENCIES)" @echo " _ddccffi3_la_LINK = $(ddc_cffi3_la_LINK)" @echo " am_ddc_cffi3_la_rpath = $(am_ddc_cffi3_la_rpath)" @echo " _ddccffi3_la_OBJECTS = $(ddc_cffi3_la_OBJECTS)" @echo " _ddccffi3_la_LIBADD = $(ddc_cffi3_la_LIBADD)" # ld vars: #@echo " PY2_EXECDIR = $(PY2_EXECDIR)" # @echo " PY3_EXECDIR = $(PY3_EXECDIR)" .PHONY: show_vars # 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: ddcutil-0.8.6/src/cffi/cffi_c_lib_demo/0000755000175000001440000000000013230445447014721 500000000000000ddcutil-0.8.6/src/cffi/cffi_c_lib_demo/testcffi.h0000644000175000001440000000073413230445447016625 00000000000000#define HELLO 123 typedef struct { double x; double y; double z; char *label; } point_t; // Creation, printing and deletion point_t* createPoint(double x, double y, double z, char *label); void printPoint(point_t *point); void deletePoint(point_t *point); // Mathematical transformations void extendPoint(point_t *point, double scalar, char mode); void rotatePoint(point_t *point, char axis, double deg); void translatePoint(point_t *point, char axis, double dist); ddcutil-0.8.6/src/cffi/_ddccffi_cdef_types.h0000644000175000001440000002626013230445447015703 00000000000000 // Extracted from ddcutil_types.h. // These files must be kept manually in sync. (UGH) // Basic Types typedef int DDCA_Status; typedef uint8_t DDCA_Vcp_Feature_Code; typedef void * DDCA_Display_Identifier; typedef void * DDCA_Display_Ref; typedef void * DDCA_Display_Handle; typedef struct { int iAdapterIndex; /**< adapter number */ int iDisplayIndex; /**< display number */ } DDCA_Adlno; // Build Information typedef struct { uint8_t major; uint8_t minor; uint8_t micro; } DDCA_Ddcutil_Version_Spec; typedef enum { /** @brief ddcutil was built with support for AMD Display Library connected monitors */ DDCA_BUILT_WITH_ADL = 0x01, /** @brief ddcutil was built with support for USB connected monitors */ DDCA_BUILT_WITH_USB = 0x02, /** @brief ddcutil was built with support for failure simulation */ DDCA_BUILT_WITH_FAILSIM = 0x04 } DDCA_Build_Option_Flags; // I2C Protocol Control typedef enum{ DDCA_TIMEOUT_STANDARD, /**< Normal retry interval */ DDCA_TIMEOUT_TABLE_RETRY /**< Special timeout for Table reads and writes */ } DDCA_Timeout_Type; typedef enum{ DDCA_WRITE_ONLY_TRIES, /**< Maximum write-only operation tries */ DDCA_WRITE_READ_TRIES, /**< Maximum read-write operation tries */ DDCA_MULTI_PART_TRIES /**< Maximum multi-part operation tries */ } DDCA_Retry_Type; // Message Control typedef enum { DDCA_OL_TERSE =0x04, /**< Brief output */ DDCA_OL_NORMAL =0x08, /**< Normal output */ DDCA_OL_VERBOSE=0x10 /**< Verbose output */ } DDCA_Output_Level; // Performance Statistics typedef enum { DDCA_STATS_NONE = 0x00, ///< no statistics DDCA_STATS_TRIES = 0x01, ///< retry statistics DDCA_STATS_ERRORS = 0x02, ///< error statistics DDCA_STATS_CALLS = 0x04, ///< system calls DDCA_STATS_ELAPSED = 0x08, ///< total elapsed time DDCA_STATS_ALL = 0xFF ///< indicates all statistics types } DDCA_Stats_Type; // MCCS Version typedef struct { uint8_t major; /**< major version number */ uint8_t minor; /*** minor version number */ } DDCA_MCCS_Version_Spec; typedef enum { DDCA_VNONE = 0, /**< As query, match any MCCS version, as response, version unknown */ DDCA_V10 = 1, /**< MCCS v1.0 */ DDCA_V20 = 2, /**< MCCS v2.0 */ DDCA_V21 = 4, /**< MCCS v2.1 */ DDCA_V30 = 8, /**< MCCS v3.0 */ DDCA_V22 = 16 /**< MCCS v2.2 */ } DDCA_MCCS_Version_Id; // #define DDCA_VANY DDCA_VNONE /**< For use on queries, indicates match any version */ // #define DDCA_VUNK DDCA_VNONE /**< For use on responses, indicates version unknown */ typedef enum { DDCA_IO_DEVI2C, /**< Use DDC to communicate with a /dev/i2c-n device */ DDCA_IO_ADL, /**< Use ADL API */ DDCA_IO_USB /**< Use USB reports for a USB connected monitor */ } DDCA_IO_Mode; typedef struct { DDCA_IO_Mode io_mode; ///< physical access mode union { int i2c_busno; ///< I2C bus number DDCA_Adlno adlno; ///< ADL iAdapterIndex/iDisplayIndex pair int hiddev_devno; ///* USB hiddev device number } path; } DDCA_IO_Path; // INVALID: #define DDCA_DISPLAY_INFO_MARKER "DDIN" // const char DDCA_DISPLAY_INFO_MARKER[4] = ['D','D','I','N']; /** Describes one monitor detected by ddcutil. */ typedef struct { char marker[4]; ///< always "DDIN" int dispno; ///< ddcutil assigned display number DDCA_IO_Path path; ///< physical access path to display int usb_bus; ///< USB bus number, if USB connection int usb_device; ///< USB device number, if USB connection // or should these be actual character/byte arrays instead of pointers? const char * mfg_id; ///< 3 character manufacturer id, from EDID const char * model_name; ///< model name, from EDID const char * sn; ///< ASCII serial number string from EDID const uint8_t * edid_bytes; ///< raw bytes (128) of first EDID block DDCA_Display_Ref dref; ///< opaque display reference } DDCA_Display_Info; /** Collection of #DDCA_Display_Info */ typedef struct { int ct; ///< number of records DDCA_Display_Info info[]; ///< array whose size is determined by ct } DDCA_Display_Info_List; // VCP Feature Information /** Flags specifying VCP feature attributes, which can be VCP version dependent. */ typedef uint16_t DDCA_Version_Feature_Flags; // Bits in DDCA_Version_Feature_Flags: // Exactly 1 of DDCA_RO, DDCA_WO, DDCA_RW is set #define DDCA_RO 0x0400 /**< Read only feature */ #define DDCA_WO 0x0200 /**< Write only feature */ #define DDCA_RW 0x0100 /**< Feature is both readable and writable */ // cffi parser can't handle: // #define DDCA_READABLE (DDCA_RO | DDCA_RW) /**< Feature is either RW or RO */ // #define DDCA_WRITABLE (DDCA_WO | DDCA_RW) /**< Feature is either RW or WO */ static const int DDCA_READABLE = (DDCA_RO | DDCA_RW); static const int DDCA_WRITABLE = (DDCA_WO | DDCA_RW); // Further refine the C/NC/TABLE categorization of the MCCS spec // Exactly 1 of the following 7 bits is set #define DDCA_STD_CONT 0x0080 /**< Normal continuous feature */ #define DDCA_COMPLEX_CONT 0x0040 /**< Continuous feature with special interpretation */ #define DDCA_SIMPLE_NC 0x0020 /**< Non-continuous feature, having a defined list of values in byte SL */ #define DDCA_COMPLEX_NC 0x0010 /**< Non-continuous feature, having a complex interpretation using one or more of SL, SH, ML, MH */ // For WO NC features. There's no interpretation function or lookup table // Used to mark that the feature is defined for a version #define DDCA_WO_NC 0x0008 /**< Used internally for write-only non-continuous features */ #define DDCA_NORMAL_TABLE 0x0004 /**< Normal RW table type feature */ #define DDCA_WO_TABLE 0x0002 /**< Write only table feature */ // #define DDCA_CONT (DDCA_STD_CONT|DDCA_COMPLEX_CONT) /**< Continuous feature, of any subtype */ // #define DDCA_NC (DDCA_SIMPLE_NC|DDCA_COMPLEX_NC|DDCA_WO_NC) /**< Non-continuous feature of any subtype */ // #define DDCA_NON_TABLE (DDCA_CONT | DDCA_NC) /**< Non-table feature of any type */ // #define DDCA_TABLE (DDCA_NORMAL_TABLE | DDCA_WO_TABLE) /**< Table type feature, of any subtype */ static const uint16_t DDCA_CONT = (DDCA_STD_CONT|DDCA_COMPLEX_CONT); /**< Continuous feature, of any subtype */ static const uint16_t DDCA_NC = (DDCA_SIMPLE_NC|DDCA_COMPLEX_NC|DDCA_WO_NC); /**< Non-continuous feature of any subtype */ static const uint16_t DDCA_NON_TABLE = (DDCA_CONT | DDCA_NC); /**< Non-table feature of any type */ // Additional bits: #define DDCA_DEPRECATED 0x0001 /**< Feature is deprecated in the specified VCP version */ typedef uint16_t DDCA_Global_Feature_Flags; // Bits in DDCA_Global_Feature_Flags: #define DDCA_SYNTHETIC 0x8000 typedef uint16_t DDCA_Feature_Flags; // union (DDCA_Version_Feature_Flags, DDCA_Global_Feature_Flags) /** One entry in array listing defined simple NC values. * * An entry of {0x00,NULL} terminates the list. */ typedef struct { uint8_t value_code; char * value_name; } DDCA_Feature_Value_Entry; // Makes reference to feature value table less implementation specific typedef DDCA_Feature_Value_Entry * DDCA_Feature_Value_Table; // #define VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER "VSFI" /** Describes a VCP feature code, tailored for a specific VCP version */ typedef struct { char marker[4]; /**< equals VCP_VERSION_SPECIFIC_FEATURE_INFO_MARKER */ DDCA_Vcp_Feature_Code feature_code; /**< VCP feature code */ DDCA_MCCS_Version_Spec vspec; // ??? DDCA_MCCS_Version_Id version_id; // which ? char * desc; /**< feature description */ // Format_Normal_Feature_Detail_Function nontable_formatter; // Format_Table_Feature_Detail_Function table_formatter; DDCA_Feature_Value_Table sl_values; /**< valid when DDCA_SIMPLE_NC set */ // VCP_Feature_Subset vcp_subsets; // Need it? char * feature_name; /**< feature name */ DDCA_Feature_Flags feature_flags; } DDCA_Version_Feature_Info; // Represent the Capabilities string returned by a monitor // #define DDCA_CAP_VCP_MARKER "DCVP" /** Represents one feature code in the vcp() section of the capabilities string. */ typedef struct { char marker[4]; /**< Always DDCA_CAP_VCP_MARKER */ DDCA_Vcp_Feature_Code feature_code; /**< VCP feature code */ int value_ct; /**< number of values declared */ uint8_t * values; /**< array of declared values */ } DDCA_Cap_Vcp; // #define DDCA_CAPABILITIES_MARKER "DCAP" /** Represents a monitor capabilities string */ typedef struct { char marker[4]; /**< always DDCA_CAPABILITIES_MARKER */ char * unparsed_string; /**< unparsed capabilities string */ DDCA_MCCS_Version_Spec version_spec; /**< parsed mccs_ver() field */ int vcp_code_ct; /**< number of features in vcp() field */ DDCA_Cap_Vcp * vcp_codes; /**< array of pointers to structs describing each vcp code */ } DDCA_Capabilities; // Get and set VCP Feature Values /** Indicates the physical type of a VCP value */ typedef enum { DDCA_NON_TABLE_VCP_VALUE = 1, /**< Continuous (C) or Non-Continuous (NC) value */ DDCA_TABLE_VCP_VALUE = 2, /**< Table (T) value */ } DDCA_Vcp_Value_Type; /** #DDCA_Vcp_Value_Type_Parm extends #DDCA_Vcp_Value_Type to allow for its use as function call parameter where the type is unknown */ typedef enum { DDCA_UNSET_VCP_VALUE_TYPE_PARM = 0, /**< type unknown */ DDCA_NON_TABLE_VCP_VALUE_PARM = 1, /**< Continuous (C) or Non-Continuous (NC) value */ DDCA_TABLE_VCP_VALUE_PARM = 2, /**< Table (T) value */ } DDCA_Vcp_Value_Type_Parm; // VCP Values typedef struct { DDCA_Vcp_Feature_Code opcode; /**< VCP feature code */ DDCA_Vcp_Value_Type value_type; // probably a different type would be better union { struct { uint8_t * bytes; /**< pointer to bytes of table value */ uint16_t bytect; /**< number of bytes in table value */ } t; /**< table value */ struct { uint8_t mh; uint8_t ml; uint8_t sh; uint8_t sl; } c_nc; /**< continuous non-continuous, i.e. non-table, value */ } val; } DDCA_Any_Vcp_Value; /** Callback function to report VCP value change */ typedef void (*DDCA_Notification_Func)(DDCA_Status psc, DDCA_Any_Vcp_Value* valrec); ddcutil-0.8.6/src/cffi/_ddccffi_cdef_c_api.h0000644000175000001440000002013313230445447015603 00000000000000 // From ddcutil_c_api.h // Must be manually kept in sync! // Library Build Information DDCA_Ddcutil_Version_Spec ddca_ddcutil_version(void); const char * ddca_ddcutil_version_string(void); uint8_t ddca_build_options(void); int ddca_max_max_tries(); // Status Codes char * ddca_rc_name(DDCA_Status status_code); char * ddca_rc_desc(DDCA_Status status_code); // Global Settings int ddca_get_max_tries(DDCA_Retry_Type retry_type); DDCA_Status ddca_set_max_tries( DDCA_Retry_Type retry_type, int max_tries); void ddca_enable_verify(bool onoff); bool ddca_is_verify_enabled(void); // Message Control void ddca_set_fout( FILE * fout); /**< where to write normal messages, if NULL, suppress */ void ddca_set_fout_to_default(void); void ddca_set_ferr( FILE * ferr); /**< where to write error messages, If NULL, suppress */ void ddca_set_ferr_to_default(void); DDCA_Output_Level /**< current output level */ ddca_get_output_level(void); void ddca_set_output_level( DDCA_Output_Level newval); /**< new output level */ char * ddca_output_level_name( DDCA_Output_Level val); /**< output level id */ void ddca_enable_report_ddc_errors( bool onoff); bool ddca_is_report_ddc_errors_enabled(void); // Statistics void ddca_reset_stats(void); void ddca_show_stats(DDCA_Stats_Type stats, int depth); // Display Descriptions DDCA_Display_Info_List * ddca_get_display_info_list(void); void ddca_free_display_info_list(DDCA_Display_Info_List * dlist); void ddca_report_display_info( DDCA_Display_Info * dinfo, int depth); void ddca_report_display_info_list( DDCA_Display_Info_List * dlist, int depth); int ddca_report_active_displays( int depth); // Display Identifier DDCA_Status ddca_create_dispno_display_identifier( int dispno, DDCA_Display_Identifier* pdid); DDCA_Status ddca_create_busno_display_identifier( int busno, DDCA_Display_Identifier* pdid); DDCA_Status ddca_create_adlno_display_identifier( int iAdapterIndex, int iDisplayIndex, DDCA_Display_Identifier* pdid); DDCA_Status ddca_create_mfg_model_sn_display_identifier( const char * mfg_id, const char * model, const char * sn, DDCA_Display_Identifier* pdid); DDCA_Status ddca_create_edid_display_identifier( const uint8_t* edid, DDCA_Display_Identifier * pdid); // 128 byte edid DDCA_Status ddca_create_usb_display_identifier( int bus, int device, DDCA_Display_Identifier* pdid); DDCA_Status ddca_create_usb_hiddev_display_identifier( int hiddev_devno, DDCA_Display_Identifier* pdid); DDCA_Status ddca_free_display_identifier( DDCA_Display_Identifier did); char * ddca_did_repr( DDCA_Display_Identifier did); // Display Reference DDCA_Status ddca_create_display_ref( DDCA_Display_Identifier did, DDCA_Display_Ref* pdref); DDCA_Status ddca_free_display_ref( DDCA_Display_Ref dref); char * ddca_dref_repr( DDCA_Display_Ref dref); void ddca_report_display_ref( DDCA_Display_Ref dref, int depth); // Display Handle DDCA_Status ddca_open_display( DDCA_Display_Ref ddca_dref, DDCA_Display_Handle * p_ddca_dh); DDCA_Status ddca_close_display( DDCA_Display_Handle ddca_dh); char * ddca_dh_repr( DDCA_Display_Handle ddca_dh); // MCCS Version DDCA_Status ddca_get_mccs_version( DDCA_Display_Handle ddca_dh, DDCA_MCCS_Version_Spec* pspec); DDCA_Status ddca_get_mccs_version_id( DDCA_Display_Handle ddca_dh, DDCA_MCCS_Version_Id* p_id); char * ddca_mccs_version_id_name( DDCA_MCCS_Version_Id version_id); char * ddca_mccs_version_id_desc( DDCA_MCCS_Version_Id version_id); // Monitor Capabilities DDCA_Status ddca_get_capabilities_string( DDCA_Display_Handle ddca_dh, char** p_capabiltities_string); DDCA_Status ddca_parse_capabilities_string( char * capabilities_string, DDCA_Capabilities ** p_parsed_capabilities); void ddca_free_parsed_capabilities( DDCA_Capabilities * parsed_capabilities); void ddca_report_parsed_capabilities( DDCA_Capabilities * parsed_capabilities, int depth); // VCP Feature Information, Monitor Independent // DDCA_Status ddca_get_feature_info_by_vcp_version( DDCA_Vcp_Feature_Code feature_code, // DDCT_MCCS_Version_Spec vspec, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Version_Feature_Info** p_info); char * ddca_get_feature_name(DDCA_Vcp_Feature_Code feature_code); DDCA_Status ddca_get_simple_sl_value_table( DDCA_Vcp_Feature_Code feature_code, DDCA_MCCS_Version_Id mccs_version_id, DDCA_Feature_Value_Table * p_value_table); // DDCA_Feature_Value_Entry ** DDCA_Status ddca_get_simple_nc_feature_value_name( DDCA_Display_Handle ddca_dh, // needed because value lookup mccs version dependent DDCA_Vcp_Feature_Code feature_code, uint8_t feature_value, char** p_feature_name); // Feature Information, Monitor Dependent DDCA_Status ddca_get_feature_info_by_display( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Version_Feature_Info ** p_info); DDCA_Status ddca_free_feature_info( DDCA_Version_Feature_Info * info); // Miscellaneous Monitor Specific Functions DDCA_Status ddca_get_edid_by_display_ref( DDCA_Display_Ref ddca_dref, uint8_t ** pbytes); // pointer into ddcutil data structures, do not free // Get/Set VCP Feature Values // void // ddca_free_table_value_response( // DDCA_Table_Value * table_value_response); // TODO: Choose between ddca_get_nontable_vcp_value()/ddca_get_table_vcp_value() vs ddca_get_vcp_value() //DDCA_Status //ddca_get_nontable_vcp_value( // DDCA_Display_Handle ddca_dh, // DDCA_Vcp_Feature_Code feature_code, // DDCA_Non_Table_Value_Response * response); // // //DDCA_Status //ddca_get_table_vcp_value( // DDCA_Display_Handle ddca_dh, // DDCA_Vcp_Feature_Code feature_code, // int * value_len, // uint8_t** value_bytes); DDCA_Status ddca_get_any_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, DDCA_Vcp_Value_Type_Parm call_type, DDCA_Any_Vcp_Value ** pvalrec); DDCA_Status ddca_get_formatted_vcp_value( DDCA_Display_Handle * ddca_dh, DDCA_Vcp_Feature_Code feature_code, char** p_formatted_value); DDCA_Status ddca_set_continuous_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, int new_value); DDCA_Status ddca_set_simple_nc_vcp_value( DDCA_Display_Handle ddca_dh, DDCA_Vcp_Feature_Code feature_code, uint8_t new_value); DDCA_Status ddca_set_raw_vcp_value( DDCA_Display_Handle ddca_dh, /**< Display handle */ DDCA_Vcp_Feature_Code feature_code, /**< VCP feature code */ uint8_t hi_byte, /**< High byte of value */ uint8_t lo_byte /**< Low byte of value */ ); // Unimplemented //DDCA_Status //ddct_set_table_vcp_value( // DDCA_Display_Handle ddct_dh, // DDCA_Vcp_Feature_Code feature_code, // int value_len, // uint8_t* value_bytes); DDCA_Status ddca_get_profile_related_values( DDCA_Display_Handle ddca_dh, char** pprofile_values_string); DDCA_Status ddca_set_profile_related_values(char * profile_values_string); ddcutil-0.8.6/src/cffi/fixpath0000755000175000001440000000005113230445447013163 00000000000000#!/bin/sh PYTHONPATH=./libs:$PYTHONPATH ddcutil-0.8.6/src/cffi/_ddccffi_callback.h0000644000175000001440000000045413230445447015307 00000000000000 // typedef struct { // a int; // b int; // } Footype_t; extern "Python" int sample_callback(int status_code); DDCA_Status ddca_pass_callback( //Simple_Callback_Func func, int (*func)(int), int parm ); ddcutil-0.8.6/src/sample_clients/0000755000175000001440000000000013230445447013751 500000000000000ddcutil-0.8.6/src/sample_clients/Makefile.am0000644000175000001440000000220713101546540015717 00000000000000# File src/sample_clients/Makefile.am # Makefile for sample and test programs for libddcutil AM_CPPFLAGS= \ -I$(srcdir) \ -I$(top_srcdir)/src/public \ -I$(top_srcdir)/src AM_CFLAGS = -Wall -fPIC AM_CFLAGS += -Werror check_PROGRAMS = if ENABLE_SHARED_LIB_COND # Sample C client program for shared library: check_PROGRAMS += \ laclient \ demo_global_settings \ demo_vcpinfo \ demo_get_set_vcp \ demo_display_selection endif laclient_SOURCES = clmain.c demo_global_settings_SOURCES = demo_global_settings.c demo_vcpinfo_SOURCES = demo_vcpinfo.c demo_display_selection_SOURCES = demo_display_selection.c demo_get_set_vcp_SOURCES = demo_get_set_vcp.c LDADD = ../libddcutil.la AM_LDFLAGS = -pie clean-local: @echo "(src/sample_clients/Makefile) clean-local" mostlyclean-local: @echo "(src/sample_clients/Makefile) mostlyclean-local" distclean-local: @echo "(src/sample_clients/Makefile) distclean-local" # Make this a dependency of something to enable it: show_vars: @echo "src/sample_clients/Makefile" @echo "srcdir: ${srcdir}" @echo "top_srcdir: ${top_srcdir}" .PHONY: show_vars ddcutil-0.8.6/src/sample_clients/Makefile.in0000644000175000001440000006036113230171237015735 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # File src/sample_clients/Makefile.am # Makefile for sample and test programs for libddcutil 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@ check_PROGRAMS = $(am__EXEEXT_1) # Sample C client program for shared library: @ENABLE_SHARED_LIB_COND_TRUE@am__append_1 = \ @ENABLE_SHARED_LIB_COND_TRUE@ laclient \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_global_settings \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_vcpinfo \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_get_set_vcp \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_display_selection subdir = src/sample_clients ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ENABLE_SHARED_LIB_COND_TRUE@am__EXEEXT_1 = laclient$(EXEEXT) \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_global_settings$(EXEEXT) \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_vcpinfo$(EXEEXT) \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_get_set_vcp$(EXEEXT) \ @ENABLE_SHARED_LIB_COND_TRUE@ demo_display_selection$(EXEEXT) am_demo_display_selection_OBJECTS = demo_display_selection.$(OBJEXT) demo_display_selection_OBJECTS = $(am_demo_display_selection_OBJECTS) demo_display_selection_LDADD = $(LDADD) demo_display_selection_DEPENDENCIES = ../libddcutil.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_demo_get_set_vcp_OBJECTS = demo_get_set_vcp.$(OBJEXT) demo_get_set_vcp_OBJECTS = $(am_demo_get_set_vcp_OBJECTS) demo_get_set_vcp_LDADD = $(LDADD) demo_get_set_vcp_DEPENDENCIES = ../libddcutil.la am_demo_global_settings_OBJECTS = demo_global_settings.$(OBJEXT) demo_global_settings_OBJECTS = $(am_demo_global_settings_OBJECTS) demo_global_settings_LDADD = $(LDADD) demo_global_settings_DEPENDENCIES = ../libddcutil.la am_demo_vcpinfo_OBJECTS = demo_vcpinfo.$(OBJEXT) demo_vcpinfo_OBJECTS = $(am_demo_vcpinfo_OBJECTS) demo_vcpinfo_LDADD = $(LDADD) demo_vcpinfo_DEPENDENCIES = ../libddcutil.la am_laclient_OBJECTS = clmain.$(OBJEXT) laclient_OBJECTS = $(am_laclient_OBJECTS) laclient_LDADD = $(LDADD) laclient_DEPENDENCIES = ../libddcutil.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(demo_display_selection_SOURCES) \ $(demo_get_set_vcp_SOURCES) $(demo_global_settings_SOURCES) \ $(demo_vcpinfo_SOURCES) $(laclient_SOURCES) DIST_SOURCES = $(demo_display_selection_SOURCES) \ $(demo_get_set_vcp_SOURCES) $(demo_global_settings_SOURCES) \ $(demo_vcpinfo_SOURCES) $(laclient_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ AM_CPPFLAGS = \ -I$(srcdir) \ -I$(top_srcdir)/src/public \ -I$(top_srcdir)/src AM_CFLAGS = -Wall -fPIC -Werror laclient_SOURCES = clmain.c demo_global_settings_SOURCES = demo_global_settings.c demo_vcpinfo_SOURCES = demo_vcpinfo.c demo_display_selection_SOURCES = demo_display_selection.c demo_get_set_vcp_SOURCES = demo_get_set_vcp.c LDADD = ../libddcutil.la AM_LDFLAGS = -pie all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/sample_clients/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/sample_clients/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_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 demo_display_selection$(EXEEXT): $(demo_display_selection_OBJECTS) $(demo_display_selection_DEPENDENCIES) $(EXTRA_demo_display_selection_DEPENDENCIES) @rm -f demo_display_selection$(EXEEXT) $(AM_V_CCLD)$(LINK) $(demo_display_selection_OBJECTS) $(demo_display_selection_LDADD) $(LIBS) demo_get_set_vcp$(EXEEXT): $(demo_get_set_vcp_OBJECTS) $(demo_get_set_vcp_DEPENDENCIES) $(EXTRA_demo_get_set_vcp_DEPENDENCIES) @rm -f demo_get_set_vcp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(demo_get_set_vcp_OBJECTS) $(demo_get_set_vcp_LDADD) $(LIBS) demo_global_settings$(EXEEXT): $(demo_global_settings_OBJECTS) $(demo_global_settings_DEPENDENCIES) $(EXTRA_demo_global_settings_DEPENDENCIES) @rm -f demo_global_settings$(EXEEXT) $(AM_V_CCLD)$(LINK) $(demo_global_settings_OBJECTS) $(demo_global_settings_LDADD) $(LIBS) demo_vcpinfo$(EXEEXT): $(demo_vcpinfo_OBJECTS) $(demo_vcpinfo_DEPENDENCIES) $(EXTRA_demo_vcpinfo_DEPENDENCIES) @rm -f demo_vcpinfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(demo_vcpinfo_OBJECTS) $(demo_vcpinfo_LDADD) $(LIBS) laclient$(EXEEXT): $(laclient_OBJECTS) $(laclient_DEPENDENCIES) $(EXTRA_laclient_DEPENDENCIES) @rm -f laclient$(EXEEXT) $(AM_V_CCLD)$(LINK) $(laclient_OBJECTS) $(laclient_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clmain.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_display_selection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_get_set_vcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_global_settings.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demo_vcpinfo.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-local pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool clean-local \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-local \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ mostlyclean-local pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile clean-local: @echo "(src/sample_clients/Makefile) clean-local" mostlyclean-local: @echo "(src/sample_clients/Makefile) mostlyclean-local" distclean-local: @echo "(src/sample_clients/Makefile) distclean-local" # Make this a dependency of something to enable it: show_vars: @echo "src/sample_clients/Makefile" @echo "srcdir: ${srcdir}" @echo "top_srcdir: ${top_srcdir}" .PHONY: show_vars # 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: ddcutil-0.8.6/src/sample_clients/demo_display_selection.c0000644000175000001440000001446613221435336020562 00000000000000/* demo_display_selection.c * * This file contains detailed examples of display selection. * * * Copyright (C) 2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ /* Overview goes here. */ #include #include #include #include #include #include "public/ddcutil_c_api.h" #define FUNCTION_ERRMSG(function_name,status_code) \ printf("(%s) %s() returned %d (%s): %s\n", \ __func__, function_name, status_code, \ ddca_rc_name(status_code), \ ddca_rc_desc(status_code)) DDCA_Display_Ref display_selection_using_ddca_get_displays() { printf("\nCheck for monitors using ddca_get_displays()...\n"); // Inquire about detected monitors. DDCA_Display_Info_List * dlist = ddca_get_display_info_list(); printf(" ddca_get_displays() returned %p\n", dlist); // A convenience function to report the result of ddca_get_displays() printf(" Report the result using ddca_report_display_info_list()...\n"); ddca_report_display_info_list(dlist, 2); // A similar function that hooks directly into the "ddcutil detect" command. printf("\n Calling ddca_report_active_displays()...\n"); int displayct = ddca_report_active_displays(2); printf("ddca_report_active_displays() found %d displays\n", displayct); // This example selects the monitor by its ddcutil assigned display number, // since any working ddcutil installation will have at least 1 display. // In practice, selection could be performed using any of the monitor // description fields in DDCA_Display_Info. DDCA_Display_Ref dref = NULL; int desired_display_number = 1; for (int ndx = 0; ndx < dlist->ct; ndx++) { if (dlist->info[ndx].dispno == desired_display_number) { dref = dlist->info[ndx].dref; break; } } if (dref) { printf("Found display: %s\n", ddca_dref_repr(dref) ); // printf("Detailed debug report:\n"); // ddca_report_display_ref( // dref, // 1); // logical indentation depth } else printf("Display number %d not found.\n", desired_display_number); // dref is an (opaque) pointer to an internal ddcutil data structure. // It does not need to be freed. ddca_free_display_info_list(dlist); return dref; } DDCA_Display_Ref display_selection_using_display_identifier() { DDCA_Display_Identifier did; DDCA_Display_Ref dref; DDCA_Status rc; printf("\nExamples of display identifier creation:\n"); printf("\nCreate a Display Identifier using I2C bus number\n"); ddca_create_busno_display_identifier(7, &did); // always succeeds printf("Created display identifier: %s\n", ddca_did_repr(did) ); ddca_free_display_identifier(did); printf("\nCreate a Display Identifier using mfg code and model\n"); rc = ddca_create_mfg_model_sn_display_identifier("ACI", "VE247", NULL, &did); assert(rc == 0); printf("Created display identifier: %s\n", ddca_did_repr(did) ); ddca_free_display_identifier(did); printf("\nCalling ddca_create_mfg_model_sn_display_identifier() with an invalid argument fails\n"); rc = ddca_create_mfg_model_sn_display_identifier(NULL, "Model name longer than 13 chars", NULL, &did); if (rc != 0) { printf(" ddca_create_mfg_model_sn_display_identifier() returned %d (%s): %s\n", rc, ddca_rc_name(rc), ddca_rc_desc(rc)); } assert(rc!=0 && !did); printf("\nCreate a Display Identifier for display 1...\n"); ddca_create_dispno_display_identifier(1, &did); // always succeeds printf("Created display identifier: %s\n", ddca_did_repr(did) ); printf("\nFind a display reference for the display identifier...\n"); rc = ddca_create_display_ref(did, &dref); if (rc != 0) { printf(" ddca_get_display_ref() returned %d (%s): %s\n", rc, ddca_rc_name(rc), ddca_rc_desc(rc)); } else { printf("Found display reference: %s\n", ddca_dref_repr(dref) ); } ddca_free_display_identifier(did); return dref; } DDCA_Display_Ref demo_get_display_ref() { DDCA_Display_Ref dref1 = display_selection_using_ddca_get_displays(); DDCA_Display_Ref dref2 = display_selection_using_display_identifier(); assert(dref1 == dref2); // printf("Debug report on display reference:\n"); // ddca_report_display_ref(dref1, 2); return dref1; } void demo_use_display_ref(DDCA_Display_Ref dref) { DDCA_Status rc; DDCA_Display_Handle dh; printf("\nOpen the display reference, creating a display handle...\n"); rc = ddca_open_display(dref, &dh); if (rc != 0) { FUNCTION_ERRMSG("ddca_open_display", rc); } else { printf(" display handle: %s\n", ddca_dh_repr(dh)); DDCA_MCCS_Version_Spec vspec; rc = ddca_get_mccs_version(dh, &vspec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_mccs_version_spec", rc); } else { printf("VCP version: %d.%d\n", vspec.major, vspec.minor); } DDCA_MCCS_Version_Id version_id; rc = ddca_get_mccs_version_id(dh, &version_id); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_mccs_version_id", rc); } else { printf("VCP version id: %s\n", ddca_mccs_version_id_desc(version_id)); } rc = ddca_close_display(dh); if (rc != 0) FUNCTION_ERRMSG("ddca_close_display", rc); } } int main(int argc, char** argv) { printf("\nStarting display selection example....\n"); DDCA_Display_Ref dref = demo_get_display_ref(); if (dref) { demo_use_display_ref(dref); } } ddcutil-0.8.6/src/sample_clients/demo_get_set_vcp.c0000644000175000001440000004247213223745534017356 00000000000000/* demo_get_set_vcp.c * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include "public/ddcutil_c_api.h" #define FUNCTION_ERRMSG(function_name,status_code) \ printf("(%s) %s() returned %d (%s): %s\n", \ __func__, function_name, status_code, \ ddca_rc_name(status_code), \ ddca_rc_desc(status_code)) static bool saved_report_ddc_errors = false; static bool saved_verify_setvcp = false; void set_standard_settings() { printf("Seting standard settings in function %s()\n", __func__); saved_report_ddc_errors = ddca_is_report_ddc_errors_enabled(); printf(" Calling ddca_enable_report_ddc_errors(true)...\n"); ddca_enable_report_ddc_errors(true); saved_verify_setvcp = ddca_is_verify_enabled(); printf(" Calling ddca_set_verify_setvcp(true)...\n"); ddca_enable_verify(true); } void restore_standard_settings() { ddca_enable_verify(saved_verify_setvcp); ddca_enable_report_ddc_errors(saved_report_ddc_errors); } bool verify_cont_value( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, int expected_value) { DDCA_Status rc; bool ok = false; #ifdef OLD DDCA_Single_Vcp_Value * valrec; rc = ddca_get_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE, &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_vcp_value", rc); } else { if ( valrec->val.c.cur_val != expected_value) { printf(" Current value %d does not match expected value %d\n", valrec->val.c.cur_val, expected_value); } #endif DDCA_Any_Vcp_Value * valrec; rc = ddca_get_any_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE_PARM, &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_any_vcp_value", rc); } else { if ( VALREC_CUR_VAL(valrec) != expected_value) { printf(" Current value %d does not match expected value %d\n", VALREC_CUR_VAL(valrec), expected_value); } else { printf(" Current value matches expected value\n"); ok = true; } } return ok; } bool test_cont_value( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code) { char * feature_name = ddca_get_feature_name(feature_code); printf("\nTesting query and setting continuous value. dh=%s, feature_code=0x%02x - %s\n", ddca_dh_repr(dh), feature_code, feature_name); DDCA_Status rc; bool ok = true; printf("Resetting statistics...\n"); ddca_reset_stats(); set_standard_settings(); printf("Disabling automatic verification by calling ddca_enable_verify(false)\n"); ddca_enable_verify(false); // we'll do the check ourselves DDCA_Version_Feature_Info * info = NULL; rc = ddca_get_feature_info_by_display( dh, // needed because in rare cases feature info is MCCS version dependent feature_code, &info); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_feature_info", rc); ok = false; goto bye; } #ifdef OLD DDCA_Single_Vcp_Value * valrec; rc = ddca_get_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE, // why is this needed? look it up from dh and feature_code &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_vcp_value", rc); ok = false; goto bye; } printf("Feature 0x%02x (%s) current value = %d, max value = %d\n", feature_code, feature_name, valrec->val.c.cur_val, valrec->val.c.max_val); int old_value = valrec->val.c.cur_val; #endif DDCA_Any_Vcp_Value * valrec; rc = ddca_get_any_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE_PARM, &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_any_vcp_value", rc); ok = false; goto bye; } printf("Feature 0x%02x (%s) current value = %d, max value = %d\n", feature_code, feature_name, VALREC_CUR_VAL(valrec), VALREC_MAX_VAL(valrec) ); int old_value = VALREC_CUR_VAL(valrec) ; int new_value = old_value/2; printf("Setting new value %d,,,\n", new_value); rc = ddca_set_continuous_vcp_value(dh, feature_code, new_value); if (rc != 0) { FUNCTION_ERRMSG("ddca_set_continuous_vcp_value", rc); ok = false; goto bye; } printf("Setting new value succeeded. Verifying the new current value...\n"); ok = verify_cont_value(dh, feature_code, new_value); printf("Resetting original value %d...\n", old_value); rc = ddca_set_continuous_vcp_value(dh, feature_code, old_value); if (rc != 0) { FUNCTION_ERRMSG("ddca_set_continuous_vcp_value", rc); ok = false; goto bye; } printf("Resetting original value succeeded. Verifying the new current value...\n"); ok = verify_cont_value(dh, feature_code, old_value) && ok; bye: if (info) ddca_free_feature_info(info); restore_standard_settings(); // Uncomment to see statistics: // printf("\nStatistics for one execution of %s()", __func__); // ddca_show_stats(DDCA_STATS_ALL, 0); // printf("(%s) Done. Returning: %d\n", __func__, ok); return ok; } bool verify_simple_nc_value( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, uint8_t expected_value) { DDCA_Status rc; bool ok = false; #ifdef OLD DDCA_Single_Vcp_Value * valrec; rc = ddca_get_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE, &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_vcp_value", rc); } else { if ( valrec->val.nc.sl != expected_value) { printf(" Current value 0x%02x does not match expected value 0x%02x\n", valrec->val.nc.sl, expected_value); } #endif DDCA_Any_Vcp_Value * valrec; rc = ddca_get_any_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE_PARM, &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_any_vcp_value", rc); } else { if ( valrec->val.c_nc.sl != expected_value) { printf(" Current value 0x%02x does not match expected value 0x%02x\n", valrec->val.c_nc.sl, expected_value); } else { printf(" Current value matches expected value\n"); ok = true; } } return ok; } bool show_simple_nc_feature_value( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, uint8_t feature_value) { char * feature_value_name = NULL; bool ok = false; DDCA_Status rc = ddca_get_simple_nc_feature_value_name( dh, // needed because value lookup mccs version dependent feature_code, feature_value, &feature_value_name); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_nc_feature_value_name", rc); printf("Unable to get interpretation of value 0x%02x\n", feature_value); ok = false; } else { printf("Current value: 0x%02x - %s\n", feature_value, feature_value_name); ok = true; } return ok; } bool test_simple_nc_value( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code, uint8_t new_value) { printf("\nTesting query and set of simple NC value: dh=%s, feature_code=0x%02x - %s\n", ddca_dh_repr(dh), feature_code, ddca_get_feature_name(feature_code)); printf("Resetting statistics...\n"); ddca_reset_stats(); DDCA_Status rc; bool ok = true; set_standard_settings(); printf("Disabling automatic verification by calling ddca_enable_verify(false)\n"); ddca_enable_verify(false); // we'll do the check ourselves DDCA_Version_Feature_Info * info; rc = ddca_get_feature_info_by_display( dh, // needed because in rare cases feature info is MCCS version dependent feature_code, &info); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_feature_info", rc); ok = false; goto bye; } assert(info->feature_flags & DDCA_SIMPLE_NC); #ifdef OLD DDCA_Single_Vcp_Value * valrec; rc = ddca_get_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE, // why is this needed? look it up from dh and feature_code &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_vcp_value", rc); ok = false; goto bye; } printf("Feature 0x%02x current value = 0x%02x\n", feature_code, valrec->val.nc.sl); uint8_t old_value = valrec->val.nc.sl; #endif DDCA_Any_Vcp_Value * valrec; rc = ddca_get_any_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE_PARM, &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_any_vcp_value", rc); ok = false; goto bye; } printf("Feature 0x%02x current value = 0x%02x\n", feature_code, valrec->val.c_nc.sl); uint8_t old_value = valrec->val.c_nc.sl; ok = show_simple_nc_feature_value(dh, feature_code, old_value); printf("Setting new value 0x%02x...\n", new_value); rc = ddca_set_simple_nc_vcp_value(dh, feature_code, new_value); if (rc != 0) { FUNCTION_ERRMSG("ddca_set_simple_nc_vcp_value", rc); ok = false; goto bye; } else { // Checking for demonstration purposes. // if ddca_enable_verify(true) is in effect (the default) // ddca_...() functions that set feature values also read them for verification printf("Setting new value succeeded. Verifying...\n"); bool verified = verify_simple_nc_value(dh, feature_code, new_value); if (!verified) ok = false; else { ok = show_simple_nc_feature_value(dh, feature_code, new_value) && ok; } printf("Resetting original value 0x%02x...\n", old_value); rc = ddca_set_simple_nc_vcp_value(dh, feature_code, old_value); if (rc != 0) { FUNCTION_ERRMSG("ddca_set_simple_nc_vcp_value", rc); ok = false; } else { printf("Resetting original value succeeded. Verifying...\n"); ok = verify_simple_nc_value(dh, feature_code, old_value) && ok; } } bye: if (info) ddca_free_feature_info(info); restore_standard_settings(); // uncomment to show statistics: // printf("\nStatistics for one execution of %s()", __func__); // ddca_show_stats(DDCA_STATS_ALL, 0); printf("(%s) Done. Returning: %d\n", __func__, ok); return ok; } // there's no commonly implemented complex NC feature that's writable. Just read. bool test_complex_nc_value( DDCA_Display_Handle dh, DDCA_Vcp_Feature_Code feature_code) { printf("\nTesting query of complex NC value: dh=%s, feature_code=0x%02x - %s\n", ddca_dh_repr(dh), feature_code, ddca_get_feature_name(feature_code)); printf("Resetting statistics...\n"); ddca_reset_stats(); DDCA_Status rc; bool ok = true; set_standard_settings(); DDCA_Version_Feature_Info * info; rc = ddca_get_feature_info_by_display( dh, // needed because in rare cases feature info is MCCS version dependent feature_code, &info); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_feature_info", rc); ok = false; goto bye; } assert(info->feature_flags & DDCA_COMPLEX_NC); #ifdef OLD DDCA_Single_Vcp_Value * valrec; rc = ddca_get_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE, // why is this needed? look it up from dh and feature_code &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_vcp_value", rc); ok = false; goto bye; } printf("Feature 0x%02x current value: mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x\n", feature_code, valrec->val.nc.mh, valrec->val.nc.ml, valrec->val.nc.sh, valrec->val.nc.sl); #endif DDCA_Any_Vcp_Value * valrec; rc = ddca_get_any_vcp_value( dh, feature_code, DDCA_NON_TABLE_VCP_VALUE_PARM, // why is this needed? look it up from dh and feature_code &valrec); if (rc != 0) { FUNCTION_ERRMSG("ddca_get_any_vcp_value", rc); ok = false; goto bye; } printf("Feature 0x%02x current value: mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x\n", feature_code, valrec->val.c_nc.mh, valrec->val.c_nc.ml, valrec->val.c_nc.sh, valrec->val.c_nc.sl); bye: if (info) ddca_free_feature_info(info); restore_standard_settings(); // uncomment to show statistics: // printf("\nStatistics for one execution of %s()", __func__); // ddca_show_stats(DDCA_STATS_ALL, 0); printf("(%s) Done. Returning: %d\n", __func__, ok); return ok; } DDCA_Status test_get_set_profile_related_values(DDCA_Display_Handle dh) { printf("\nTesting retrieval and setting of profile related values. dh = %s\n", ddca_dh_repr(dh)); printf("Resetting statistics...\n"); ddca_reset_stats(); set_standard_settings(); printf("Calling ddca_get_profile_related_values()...\n"); DDCA_Status psc = 0; char* profile_values_string; psc = ddca_get_profile_related_values(dh, &profile_values_string); if (psc != 0) { FUNCTION_ERRMSG("ddca_get_profile_related_values", psc); goto bye; } printf("profile values string = %s\n", profile_values_string); printf("Calling ddca_set_profile_related_values()...\n"); psc = ddca_set_profile_related_values(profile_values_string); if (psc != 0) { FUNCTION_ERRMSG("ddca_set_profile_related_values", psc); } bye: restore_standard_settings(); printf("\nStatistics for one execution of %s()", __func__); ddca_show_stats(DDCA_STATS_ALL, 0); return psc; } #ifdef OBSOLETE // Register an abort function. // If libddcutil encounters an unexpected, unrecoverable error, it will // normally exit, causing the calling program to fail. If the caller registers an // abort function, that function will be called instead. void handle_library_abort() { // For aborting out of shared library static jmp_buf abort_buf; int jmprc = setjmp(abort_buf); if (jmprc) { DDCA_Global_Failure_Information * finfo = ddca_get_global_failure_information(); if (finfo) fprintf(stderr, "(%s) Error %d (%s) in function %s at line %d in file %s\n", __func__, finfo->status, ddca_rc_name(finfo->status), finfo->funcname, finfo->lineno, finfo->fn); fprintf(stderr, "(%s) Aborting. Internal status code = %d\n", __func__, jmprc); exit(EXIT_FAILURE); } ddca_register_jmp_buf(&abort_buf); } #endif int main(int argc, char** argv) { printf("\n(%s) Starting.\n", __func__); #ifdef OBSOLETE handle_library_abort(); #endif // ddca_reset_stats(); DDCA_Status rc; DDCA_Display_Ref dref; DDCA_Display_Handle dh = NULL; // initialize to avoid clang analyzer warning int MAX_DISPLAYS = 4; // limit the number of displays DDCA_Display_Info_List * dlist = ddca_get_display_info_list(); for (int ndx = 0; ndx < dlist->ct && ndx < MAX_DISPLAYS; ndx++) { DDCA_Display_Info * dinfo = &dlist->info[ndx]; printf("\n(%s) ===> Test loop for display %d\n", __func__, dinfo->dispno); // For all the gory details: // ddca_report_display_info(dinfo, /* depth=*/ 1); dref = dinfo->dref; printf("Open display reference %s, creating a display handle...\n", ddca_dref_repr(dref)); rc = ddca_open_display(dref, &dh); if (rc != 0) { FUNCTION_ERRMSG("ddca_open_display", rc); continue; } printf("Opened display handle: %s\n", ddca_dh_repr(dh)); // Comment out the tests you'd like to skip: // test_cont_value(dh, 0x10); // test_get_set_profile_related_values(dh); // feature 0xcc = OSD language, value 0x03 = French // test_simple_nc_value(dh, 0xcc, 0x03); test_complex_nc_value(dh, 0xDF); // VCP version rc = ddca_close_display(dh); if (rc != 0) FUNCTION_ERRMSG("ddca_close_display", rc); dh = NULL; } ddca_free_display_info_list(dlist); // bye: // uncomment if you want to see stats: // dca_show_stats(DDCA_STATS_ALL, 0); return 0; } ddcutil-0.8.6/src/sample_clients/demo_global_settings.c0000644000175000001440000001344113221435061020213 00000000000000/* demo_global_settings.c * * Sample program illustrating the use of libddcutil's functions for * build information and global settings management. * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include #include "public/ddcutil_c_api.h" #define FUNCTION_ERRMSG(function_name,status_code) \ printf("(%s) %s() returned %d (%s): %s\n", \ __func__, function_name, status_code, \ ddca_rc_name(status_code), \ ddca_rc_desc(status_code)) void demo_build_information() { printf("\nProbe static build information...\n"); // Get the ddcutil version as a string in the form "major.minor.micro". printf(" ddcutil version by ddca_ddcutil_version_string(): %s\n", ddca_ddcutil_version_string() ); // Get the ddcutil version as a struct of integers DDCA_Ddcutil_Version_Spec vspec = ddca_ddcutil_version(); printf(" ddcutil version by ddca_ddcutil_version(): %d.%d.%d\n", vspec.major, vspec.minor, vspec.micro); // Get build options uint8_t build_options = ddca_build_options(); printf(" Built with ADL support: %s\n", (build_options & DDCA_BUILT_WITH_ADL) ? "yes" : "no"); printf(" Built with USB support: %s\n", (build_options & DDCA_BUILT_WITH_USB) ? "yes" : "no"); printf(" Built with failure simulation: %s\n", (build_options & DDCA_BUILT_WITH_FAILSIM) ? "yes" : "no"); } void demo_retry_management() { printf("\nExercise retry management functions...\n"); int rc = 0; // The maximum retry number that can be specified on ddca_set_max_tries(). // Any larger number will case the call to fail. int max_max_tries = ddca_max_max_tries(); printf(" Maximum try count that can be set: %d\n", max_max_tries); // There are separate maximum tries for 3 different types of I2C operations. // - DDCA_WRITE_READ_TRIES // The is the most common operation, the host performs a write on the // I2C bus requesting information from the display, which prepares a response. // The subsequent write reads the response from the I2C bus. // - DDCA_WRITE_ONLY_TRIES // Used to set a VCP feature value. // - DDCA_MULTI_PART_TRIES // Some operations (capabilities, table read/write) transfer more data // than can be transmitted in a single I2C request. The operation is // broken up into multiple write/read or write-only operations. This // count controls the number of times the aggregate operation can be // retried. // rc = ddca_set_max_tries(DDCA_WRITE_READ_TRIES, 15); // printf("(%s) ddca_set_max_tries(DDCA_WRITE_READ_TRIES,15) returned: %d (%s)\n", // __func__, rc, ddca_status_code_name(rc) ) printf(" Get the current max try settings:\n"); printf(" max write only tries: %d\n", ddca_get_max_tries(DDCA_WRITE_ONLY_TRIES)); printf(" max write read tries: %d\n", ddca_get_max_tries(DDCA_WRITE_READ_TRIES)); printf(" max multi part tries: %d\n", ddca_get_max_tries(DDCA_MULTI_PART_TRIES)); // The following calls exercise the DDCA_WRITE_READ_TRIES setting. // Invocations for DDCA_WRITE_ONLY and DDCA_MULTI_PART_TRIES are similar. printf(" Calling ddca_set_max_tries() with a retry count that's too large...\n"); int badct = max_max_tries + 1; rc = ddca_set_max_tries(DDCA_WRITE_READ_TRIES, badct); assert(rc == -EINVAL); printf(" ddca_set_max_tries(DDCA_WRITE_READ_TRIES, %d) returned: %d (%s)\n", badct, rc, ddca_rc_name(rc) ); printf(" Setting the count to exactly ddca_get_max_max_tries() works...\n"); rc = ddca_set_max_tries(DDCA_WRITE_READ_TRIES, max_max_tries); printf(" ddca_set_max_tries(DDCA_WRITE_READ_TRIES, %d) returned: %d (%s)\n", max_max_tries, rc, ddca_rc_name(rc) ); } #ifdef OBSOLETE // Register an abort function. // If libddcutil encounters an unexpected, unrecoverable error, it will // normally exit, causing the calling program to fail. If the caller registers an // abort function, that function will be called instead. void handle_library_abort() { // For aborting out of shared library static jmp_buf abort_buf; int jmprc = setjmp(abort_buf); if (jmprc) { DDCA_Global_Failure_Information * finfo = ddca_get_global_failure_information(); if (finfo) fprintf(stderr, "(%s) Error %d (%s) in function %s at line %d in file %s\n", __func__, finfo->status, ddca_rc_name(finfo->status), finfo->funcname, finfo->lineno, finfo->fn); fprintf(stderr, "(%s) Aborting. Internal status code = %d\n", __func__, jmprc); exit(EXIT_FAILURE); } ddca_register_jmp_buf(&abort_buf); } #endif int main(int argc, char** argv) { // printf("\n(%s) Starting.\n", __func__); // Query library build settings. demo_build_information(); #ifdef OBSOLETE // Catches libddcutil failures that would otherwise cause program abort handle_library_abort(); #endif // Retry management demo_retry_management(); } ddcutil-0.8.6/src/sample_clients/demo_vcpinfo.c0000644000175000001440000002072513215717027016512 00000000000000/* demo_vcpinfo.c * * Query VCP feature information * * * Copyright (C) 2014-2015 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #define _GNU_SOURCE // for asprintf() #include #include #include #include #include #include "public/ddcutil_c_api.h" #define FUNCTION_ERRMSG(function_name,status_code) \ printf("(%s) %s() returned %d (%s): %s\n", \ __func__, function_name, status_code, \ ddca_rc_name(status_code), \ ddca_rc_desc(status_code)) /* A simple function that opens the first detected display. * For a more detailed example of display detection and management, * see demo_display_selection.c * * Arguments: none * Returns: display handle of first detected display, * NULL if not found or can't be opened */ DDCA_Display_Handle * open_first_display() { printf("Check for monitors using ddca_get_displays()...\n"); DDCA_Display_Handle dh = NULL; // Inquire about detected monitors. DDCA_Display_Info_List * dlist = ddca_get_display_info_list(); printf("ddca_get_displays() returned %p\n", dlist); assert(dlist); // this is sample code if (dlist->ct == 0) { printf(" No DDC capable displays found\n"); } else { DDCA_Display_Info * dinf = &dlist->info[0]; DDCA_Display_Ref * dref = dinf->dref; printf("Opening display %s\n", dinf->model_name); DDCA_Status rc = ddca_open_display(dref, &dh); if (rc != 0) { FUNCTION_ERRMSG("ddca_open_display", rc); } } ddca_free_display_info_list(dlist); return dh; } /* Creates a string representation of DDCA_Feature_Flags bitfield. * * Arguments: * data flags * * Returns: string representation, caller must free */ char * interpret_feature_flags(DDCA_Version_Feature_Flags flags) { char * buffer = NULL; int rc = asprintf(&buffer, "%s%s%s%s%s%s%s%s%s%s%s%s", flags & DDCA_RO ? "Read-Only, " : "", flags & DDCA_WO ? "Write-Only, " : "", flags & DDCA_RW ? "Read-Write, " : "", flags & DDCA_STD_CONT ? "Continuous (standard), " : "", flags & DDCA_COMPLEX_CONT ? "Continuous (complex), " : "", flags & DDCA_SIMPLE_NC ? "Non-Continuous (simple), " : "", flags & DDCA_COMPLEX_NC ? "Non-Continuous (complex), " : "", flags & DDCA_WO_NC ? "Non-Continuous (write-only), " : "", flags & DDCA_NORMAL_TABLE ? "Table (readable), " : "", flags & DDCA_WO_TABLE ? "Table (write-only), " : "", flags & DDCA_DEPRECATED ? "Deprecated, " : "", flags & DDCA_SYNTHETIC ? "Synthesized, " : "" ); assert(rc >= 0); // real life code would check for malloc() failure in asprintf() // remove final comma and blank if (strlen(buffer) > 0) buffer[strlen(buffer)-2] = '\0'; return buffer; } /* Displays the contents of DDCA_Version_Feature_Info instance. * * Arguments: * info pointer to DDCA_Version_Feature_Info */ void show_version_feature_info(DDCA_Version_Feature_Info * info) { printf("\nVersion Sensitive Feature Information for VCP Feature: 0x%02x - %s\n", info->feature_code, info->feature_name); printf(" VCP version: %d.%d\n", info->vspec.major, info->vspec.minor); printf(" VCP version id: %d (%s) - %s \n", info->version_id, ddca_mccs_version_id_name(info->version_id), ddca_mccs_version_id_desc(info->version_id) ); printf(" Description: %s\n", info->desc); char * s = interpret_feature_flags(info->feature_flags); printf(" Feature flags: %s\n", s); free(s); if (info->sl_values) { printf(" SL values: \n"); DDCA_Feature_Value_Entry * cur_entry = info->sl_values; while (cur_entry->value_name) { printf(" 0x%02x - %s\n", cur_entry->value_code, cur_entry->value_name); cur_entry++; } } } /** Retrieves and displays feature information for a specified MCCS version * and feature code. * * Arguments: * version_id * feature_code */ void test_get_single_feature_info( DDCA_MCCS_Version_Id version_id, DDCA_Vcp_Feature_Code feature_code) { printf("\n(%s) Getting metadata for feature 0x%02x, mccs version = %s\n", __func__, feature_code, ddca_mccs_version_id_desc(version_id)); printf("Feature name: %s\n", ddca_get_feature_name(feature_code)); // DDCA_Version_Feature_Flags feature_flags; DDCA_Version_Feature_Info * info = NULL; DDCA_Status rc = ddca_get_feature_info_by_vcp_version(feature_code, version_id, &info); if (rc != 0) FUNCTION_ERRMSG("ddca_get_feature_info_by_vcp_version", rc); else { // TODO: Version_Specific_Feature_Info needs a report function // report_ddca_version_feature_flags(feature_code, info->feature_flags); // report_version_feature_info(info, 1); show_version_feature_info(info); ddca_free_feature_info(info); } printf("%s) Done.\n", __func__); } /** Retrieves and displays feature information for a specified MCCS version * and a representative sample of feature codes. * * Arguments: * version_id * feature_code */ void test_get_feature_info(DDCA_MCCS_Version_Id version_id) { printf("\n(%s) ===> Starting. version_id = %s\n", __func__, ddca_mccs_version_id_name(version_id)); DDCA_Vcp_Feature_Code feature_codes[] = {0x00, 0x02, 0x03, 0x10, 0x43, 0x60, 0xe0}; int feature_code_ct = sizeof(feature_codes)/sizeof(DDCA_Vcp_Feature_Code); for (int ndx = 0; ndx < feature_code_ct; ndx++) test_get_single_feature_info(version_id, feature_codes[ndx]); printf("%s) Done.\n", __func__); } void demo_feature_info() { test_get_feature_info(DDCA_V10); test_get_feature_info(DDCA_V20); test_get_feature_info(DDCA_V21); test_get_feature_info(DDCA_V30); test_get_feature_info(DDCA_V22); } /* Retrieves and reports the capabilities string for the first detected monitor. */ void demo_get_capabilities() { DDCA_Display_Handle dh = open_first_display(); if (!dh) goto bye; printf("\n(%s) ===> Starting. dh = %s\n", __func__, ddca_dh_repr(dh)); char * capabilities = NULL; DDCA_Status rc = ddca_get_capabilities_string(dh, &capabilities); if (rc != 0) FUNCTION_ERRMSG("ddca_get_capabilities_string", rc); else printf("(%s) Capabilities: %s\n", __func__, capabilities); printf("(%s) Second call should be fast\n", __func__); rc = ddca_get_capabilities_string(dh, &capabilities); if (rc != 0) FUNCTION_ERRMSG("ddca_get_capabilities_string", rc); else { printf("(%s) Capabilities: %s\n", __func__, capabilities); printf("(%s) Try parsing the string...\n", __func__); DDCA_Capabilities * pcaps = NULL; rc = ddca_parse_capabilities_string( capabilities, &pcaps); if (rc != 0) FUNCTION_ERRMSG("ddca_parse_capabilities_string", rc); else { printf("(%s) Parsing succeeded. Report the result...\n", __func__); // DDCA_Output_Level saved_ol = ddca_get_output_level(); // ddca_set_output_level(DDCA_OL_VERBOSE); // show both unparsed and parsed capabilities ddca_report_parsed_capabilities(pcaps, 1); // ddca_set_output_level(saved_ol); ddca_free_parsed_capabilities(pcaps); } } bye: printf("(%s) Done.\n", __func__); } int main(int argc, char** argv) { printf("\ndemo_vcpinfo Starting.\n"); demo_feature_info(); demo_get_capabilities(); return 0; } ddcutil-0.8.6/src/sample_clients/clmain.c0000644000175000001440000000552213213674667015315 00000000000000/* clmain.c * * Framework for test code * * * Copyright (C) 2014-2017 Sanford Rockowitz * * Licensed under the GNU General Public License Version 2 * * 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. * */ #include #include #include #include #include #include "public/ddcutil_c_api.h" #define FUNCTION_ERRMSG(function_name,status_code) \ printf("(%s) %s() returned %d (%s): %s\n", \ __func__, function_name, status_code, \ ddca_rc_name(status_code), \ ddca_rc_desc(status_code)) int main(int argc, char** argv) { printf("\n(%s) Starting.\n", __func__); ddca_reset_stats(); DDCA_Status rc; DDCA_Display_Ref dref; DDCA_Display_Handle dh = NULL; // initialize to avoid clang analyzer warning DDCA_Display_Info_List * dlist = ddca_get_display_info_list(); printf("ddca_get_displays() returned %p\n", dlist); for (int ndx = 0; ndx < dlist->ct; ndx++) { DDCA_Display_Info * dinfo = &dlist->info[ndx]; ddca_report_display_info(dinfo, /* depth=*/ 1); printf("\n(%s) ===> Test loop for display %d\n", __func__, dinfo->dispno); #ifdef ALT DDCA_Display_Identifier did = NULL; printf("Create a Display Identifier for display %d...\n", dispno); rc = ddca_create_dispno_display_identifier(dispno, &did); printf("Create a display reference from the display identifier...\n"); rc = ddca_get_display_ref(did, &dref); assert(rc == 0); rc = ddca_free_display_identifier(did); printf("ddca_free_display_identifier() returned %d\n", rc); #endif dref = dinfo->dref; printf("Open the display reference, creating a display handle...\n"); rc = ddca_open_display(dref, &dh); if (rc != 0) { FUNCTION_ERRMSG("ddca_open_display", rc); continue; } printf("(%s) Opened display handle: %s\n", __func__, ddca_dh_repr(dh)); // // Insert test code here // rc = ddca_close_display(dh); if (rc != 0) FUNCTION_ERRMSG("ddca_close_display", rc); } ddca_show_stats(DDCA_STATS_ALL, 0); return 0; } ddcutil-0.8.6/src/libhack.la0000644000175000001440000000237613230445447012612 00000000000000# libhack.la - a libtool library file # Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2 # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='' # Names of this library. library_names='' # The name of the static archive. old_library='libhack.a' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='' # Libraries that this one depends upon. dependency_libs=' /shared/playproj/i2c/src/libddcutil.la -lz -lX11 -lXrandr -lglib-2.0 -ludev -lusb-1.0 -ldrm -ldl' # Names of additional weak libraries provided by this library weak_library_names='' # Version information for libhack. current=0 age=0 revision=0 # Is this an already installed library? installed=no # Should we warn about portability when linking against -modules? shouldnotlink=no # Files to dlopen/dlpreopen dlopen='' dlpreopen='' # Directory that this library needs to be installed in: libdir='' relink_command="(cd /shared/playproj/i2c/src; /bin/bash \"/shared/playproj/i2c/libtool\" --silent --tag CC --mode=relink gcc -Wall -g -O2 -export-symbols-regex \"^ddc[ags]_[^_]\" -version-info 0:0:0 -pie --disable-static -o libhack.la libmain/ddcutil_c_api.lo -lz libcommon.la libddcutil.la -ldl @inst_prefix_dir@)" ddcutil-0.8.6/man/0000755000175000001440000000000013230445447010733 500000000000000ddcutil-0.8.6/man/Makefile.am0000644000175000001440000000012612773657513012720 00000000000000man_MANS = ddcutil.1 EXTRA_DIST = $(man_MANS) # dist_man1_MANS = \ # ddcutil.1 ddcutil-0.8.6/man/Makefile.in0000644000175000001440000004353013230171236012715 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ man_MANS = ddcutil.1 EXTRA_DIST = $(man_MANS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ 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=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags-am uninstall uninstall-am uninstall-man \ uninstall-man1 .PRECIOUS: Makefile # dist_man1_MANS = \ # ddcutil.1 # 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: ddcutil-0.8.6/man/ddcutil.10000644000175000001440000002724113101546540012364 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH ddcutil 1 "15 December 2015" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME ddcutil \- Query and change monitor settings .SH SYNOPSIS .B ddcutil .RB [ "--display|--dis|-d" .IR dispno ] .RB [ "--bus|-b" .IR busno ] .RB [ "--adl" | "-a " .IR "adapter-index.display-index" ] .RB [ "--hiddev" .IR hiddev device number ] .RB [ "--usb" | "-u" .IR "busnum.devicenum" ] .RB [ "--edid" .IR "256 hex character EDID" ] .RB [ "--mfg" | "-g" .IR "manufacturer code" ] .RB [ "--model" | "-l" .IR "model name" ] .RB [ "--sn" | "-n" .IR "serial number" ] .RB [ "--noverify" ] .RB [ "-v|--verbose" ] .RB [ -t | --terse | --brief ] .RB [ "-U" | "--show-unsupported" ] .RB [ --ddc ] .RB [ "-s" | "--stats" ] .RB [ --trace .IR trace-class ] .RB [ --timestamp | --ts] .RB [ --maxtries .IR comma separated list ] .RB [ "--force-slave-address" ] .RB [ "-f" | "--force" ] .RB [ "--async" ] .RB [ "--nodetect" ] .RB [ "-V" | "--version" ] .RB [ "h" | "--help" ] .BR detect " | " listvcp " | " capabilities " | " getvcp " | " probe .RI [ "feature-code" | "feature-group" ] .RB | setvcp .I feature-code new-value ] | .BR vcpinfo " " .RI [ "feature-code" | "feature-group" "] | " .B dumpvcp .RI [ filename ] | .BI "loadvcp " filename ] | .BR environment " | " usbenvironment ' | " interrogate .\" ALT USING .SY .OP .\" .SY .\" .OP \-abcde .\" .OP \-b busno .\" .OP \-d|--display dispno .\" command command-arguments .\" .YS .SH DESCRIPTION \fBddcutil\fP is used to query and change monitor settings. \fBddcutil\fP communicates with monitors implementing MCCS (Monitor Control Command Set) using the DDC/CI protocol on the I2C bus. Normally, the video driver for the monitor exposes the I2C bus as devices named /dev/i2c-n. Alternatively, \fBddcutil\fP can communicate with USB connected monitors implementing the USB Monitor Control Class Specification. The Monitor Control Command Set describes a collection of Virtual Control Panel (VCP) features that a monitor can implement. Each feature is identified using a single byte. For example, feature x10 is the brightness control. In general, the monitor settings that can be controlled by \fBddcutil\fP are a superset of what can be changed using the buttons on a monitor and its on screen display. The specific capabilities vary from monitor to monitor. A particular use case for \fBddcutil\fP is as part of color profile management. Monitor calibration is relative to the monitor color settings currently in effect, e.g. red gain. \fBddcutil\fP allows color related settings to be saved at the time a monitor is calibrated, and then restored when the calibration is applied. Another common use case is to switch the monitor input source. For extended documentation, see http://www.ddcutil.com. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. .\" .B ddcutil .\" .I command .\" .R [ .\" .I command-arguments .\" .R ] [ .\" .I options .\" .R ] .SH COMMANDS .TP .BR "detect " "Report attached monitors" .TP \fBvcpinfo\fP [ \fIfeature-code\fP | \fIfeature-group\fP ] Describe VCP feature codes that \fBddcutil\fP knows how to interpret .TP .B "capabilities " Query the monitor's capabilities string .TP \fBgetvcp\fP [ \fIfeature-code\fP | \fIfeature-group\fP ] Report a single VCP feature value, or a group of feature values .TP .BI "setvcp " "feature-code new-value" Set a single VCP feature value .TP .BI "dumpvcp " filename Save color related VCP feature values in a file. If no file name is specified, one is generated and the file is saved .TP .BI "loadvcp " filename Set VCP feature values from a file. The monitor to which the values will be applied is determined by the monitor identification stored in the file. If the monitor is not attached, nothing happens. .TP .B "environment " Probe the \fBddcutil\fP installation environment. .TP .B "usbenv " Probe USB aspects of the \fBddcutil\fP installation environment. .TP .B "probe " Explore the capabilities and features of a sing monitor. .TP .B "interrogate " Collect maximum information for problem diagnosis. .TP .B "chkusbmon " Tests if hiddev device is a USB connected monitor, for use in udev rules. .PP .SH COMMAND ARGUMENTS .I feature-code .sp A feature-code is specified by its 2 character hex feature number, with or without a leading "0x", e.g. 0x10, 10 .sp 2 .I feature-group .sp 2 The following are the most useful feature groups recognized. For a complete list, use the \fB--help\fP option. .TP .BR ALL All feature codes understood by \fBddcutil\fP .TQ .B KNOWN Scan all understood feature codes, but show only codes supported by the monitor .TQ .B COLOR Scan color related feature codes .TQ .B PROFILE Subset of color related feature codes that are saved and restored by \fBdumpvcp\fP and \fBloadvcp\fP .TQ .B SCAN Scan all possible feature codes 0x00..0xff, except those known the be write-only .PP Feature group names can be abbreviated to the first 3 characters. Case is ignored. e.g. COL, pro .I new-value .sp A number in the range 0..255 .\" .TP inserts a line before its output, .TQ does not .SH OPTIONS Options for monitor selection. If none are of these options are specified, the default is the first detected monitor. Options \fB--mfg\fP, \fB--model\fP and \fB--sn\fP can be specified together. .TQ .BR -d , "--display " .I display-number logical display number (starting from 1) .TQ .BR "-b,--bus " .I bus-number I2C bus number .TQ .BI "-a,--adl " "adapterIndex.displayIndex" ADL adapter and display indexes .TQ .BR "--hiddev " .I device number hiddev device number .TQ .BI "-u,--usb " "busnum.devicenum" USB bus and device numbers .TQ .B -g,--mfg 3 letter manufacturer code .TQ .B -l,--model model name .TQ .B -n,--sn serial number. (This is the "serial ascii" field from the EDID, not the binary serial number.) .TQ \fB-e,--edid\fP 256 hex character representation of the 128 byte EDID. Needless to say, this is intended for program use. .PP Options to control the amount and form of output. .TQ .B "-U, --show-unsupported" Normally, \fBgetvcp\fP does not report unsupported features when querying a feature-group. This option forces output. .TQ .B "-t, --terse, --brief" Show brief detail. For command \fBgetvcp\fP, the output is in machine readable form. .TQ .B -v, --verbose Show extended detail .PP Options for diagnostic output. .TQ .BR --stats " [" all | errors | tries | calls | elapsed | time ] Report execution statistics. If no argument is specified, or ALL is specified, then all statistics are output. \fBelapsed\fP is a synonym for \fBtime\fP. \fBcalls\fP implies \fBtime\fP. .br Specify this option multiple times to report multiple statistics groups. .br I2C bus communication is an inherently unreliable. It is the responsibility of the program using the bus to manage retries in case of failure. This option reports retry counts and various performance statistics. .TQ .B --ddc Reports DDC protocol errors. These may reflect I2C bus errors, or deviations by monitors from the MCCS specification. .TQ .BI "--trace " "trace-class" Enable debug tracing for a trace class. Valid values are: \fIbase\fP, \fBi2c\fP, \fBadl\fP, \fBddc\fP, \fBmain\fP, and the special value \fIall\fP. Some trace classes are more useful than others. .br Specify this option multiple times to enable multiple trace classes. .TQ .B --timestamp, --ts Prepend trace messages with elapsed time .PP Options for program information. .TQ .BR -h , --help Show program help. .TQ .B "-V, --version" Show program version. .PP Options to tune execution: .TQ .BI "--maxtries " "(max-read-tries, max-write-read-tries, max-multi-part-read-tries)" Adjust the number of retries .TQ .B "--force-slave-address" Take control of slave addresses on the I2C bus even they are in use. .TQ .B "-f, --force" Do not check certain parameters. .TQ .B "--verify" Verify values set by \fBsetvcp\fP or \fBloadvcp\fP. (default) .TQ .B "--noverify" Do not verify values set by \fBsetvcp\fP or \fBloadvcp\fP. .TQ .B "--async" If there are multiple monitors, initial checks are performed in multiple threads, improving performance. .TQ .B "--nodetect" If the monitor is specified by its I2C bus number (option \fB--busno\fP) skip the monitor detection phase, improving performance. .SH EXECUTION ENVIRONMENT requires package i2c-dev i2c permissions .SH NVIDIA PROPRIETARY DRIVER Some newer Nvidia cards (e.g. GTX660Ti) require special settings to properly enable I2C support. If you are using this driver and \fBddcctool\fP does not work with your Nvidia card (TODO: Describe symptoms), you can try the following: Copy file /usr/local/share/ddcutil/data/90-nvidia-i2c.conf to directory /etc/X11/xorg.conf.d .B sudo cp /usr/local/share/ddcutil/data/90-nvidia-i2c.conf /etc/X11/xorg.conf.d This file will work "out of the box" if you do not have an /etc/X11/xorg.conf file. If you do, adjust the \fBIdentifier\fP value in the file to correspond to the value in the master xorg.conf file. (Note that the above instructions assume that datadir was set to /usr/local/share when ddcutil was installed. YMMV) .SH AMD PRORIETARY DRIVER AMD's proprietary video driver \fBfglrx\fP does not expose the I2C bus. Instead, it provides access to the bus through the AMD Display Library, aka \fBADL\fP. Owing to copyright restrictions, the ADL header files are not distributed with the \fBddcutil\fP source. Additional steps are required to build \fBddcutil\fP with \fBfglrx\fP support. To see if your copy of \fBddcutil\fP was built with \fBfglrx\fP support, issue the command: .br .B ddcutil --version ADL identifies monitors using an adapter-number/display-number pair. To select a monitor using these numbers, specify the \fB--adl\fP option with a period separating the adapter-number and display-number, e.g. .br .B --adl 0.1 .SH VIRTUAL MACHINES Virtualized video drivers in VMWare and VirtualBox do not provide I2C emulation. Use of normal video drivers with PCI passthrough in a virtual machine has not been tested. .SH EXAMPLES .\" What do .EX and .EE do? .B ddcutil detect .sp 0 Identify all attached monitors. .sp 4 .B ddcutil getvcp supported .sp 1 .br Show all settings that the default monitor supports and that \fBddcutil\fP understands. .PP .sp 0 .B ddctpp getvcp 10 --display 2 .br Query the luminosity value of the second monitor. .B ddcutil setvcp 10 30 --bus 4 .sp 0 Set the luminosity value for the monitor on bus /dev/i2c-4. .B ddcutil vcpinfo --verbose .sp 0 Show detailed information about VCP features that \fBddcutil\fP understands. .B ddcutil interrogate > ~/ddcutil.out .sp 0 Collect maximum information about monitor capabilities and the execution environment, and direct the output to a file. .SH DIAGNOSTICS Returns 0 on success, 1 on failure. Requesting help is regarded as success. .\" .SH FILES .SH SEE ALSO .\" README file /usr/local/share/doc/ddcutil/README.md .\" The program is documented fully in .\" .br .\" /usr/local/share/doc/ddcutil/html/index.html .\" .PP The project homepage: http://www.ddcutil.com .\" .SH NOTES .\" .SH BUGS .SH AUTHOR Sanford Rockowitz (rockowitz at minsoft dot com) .br Copyright 2015\-2016 Sanford Rockowitz ddcutil-0.8.6/data/0000755000175000001440000000000013230445450011063 500000000000000ddcutil-0.8.6/data/etc/0000755000175000001440000000000013230445450011636 500000000000000ddcutil-0.8.6/data/etc/udev/0000755000175000001440000000000013230445450012601 500000000000000ddcutil-0.8.6/data/etc/udev/rules.d/0000755000175000001440000000000013230445450014155 500000000000000ddcutil-0.8.6/data/etc/udev/rules.d/45-ddcutil-i2c.rules0000644000175000001440000000051012773657513017516 00000000000000# On some distributions, package i2c-tools provides a udev rule. # For example, on Ubuntu, see 40-i2c-tools.rules. # Assigns the i2c devices to group i2c, and gives that group RW access: KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660" # Gives everyone RW access to the /dev/i2c devices: # KERNEL=="i2c-[0-9]*", MODE="0666" ddcutil-0.8.6/data/etc/udev/rules.d/45-ddcutil-usb.rules0000644000175000001440000000205113032550072017611 00000000000000# Rules for USB attached monitors, which are categorized as User Interface Devices. # The following example rules assign USB connected monitors to group video, and give RW permission # to users in that group. Alternatively, you can give everyone RW permission for monitor devices by # changing 'MODE="0660", GROUP="video"' to 'MODE="0666"'. # Use ddcutil to check if a USB Human Interface Device appears to be a monitor. # Note this rule will have to be adjusted to reflect the actual path where ddcutil is installed. # The -v option produces informational messages. These are lost when the rule is normally executed # udev, but can be helpful when rules are tested using the "udevadm test" command. SUBSYSTEM=="usbmisc", KERNEL=="hiddev*", PROGRAM="/usr/local/bin/ddcutil chkusbmon $env{DEVNAME} -v", MODE="0660", GROUP="video" # Identifies a particular monitor device by its vid/pid. # The values in this example are for an Apple Cinema Display, model A1082. # SUBSYSTEM=="usbmisc", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="9223", MODE="0666" ddcutil-0.8.6/data/etc/X11/0000755000175000001440000000000013230445450012207 500000000000000ddcutil-0.8.6/data/etc/X11/xorg.conf.d/0000755000175000001440000000000013230445450014334 500000000000000ddcutil-0.8.6/data/etc/X11/xorg.conf.d/90-nvidia-i2c.conf0000644000175000001440000000051212443351444017300 00000000000000Section "Device" Driver "nvidia" Identifier "Dev0" Option "RegistryDwords" "RMUseSwI2c=0x01; RMI2cSpeed=100" # solves problem of i2c errors with nvidia driver # per https://devtalk.nvidia.com/default/topic/572292/-solved-does-gddccontrol-work-for-anyone-here-nvidia-i2c-monitor-display-ddc/#4309293 EndSection ddcutil-0.8.6/data/usr/0000755000175000001440000000000013230445450011674 500000000000000ddcutil-0.8.6/data/usr/share/0000755000175000001440000000000013230445450012776 500000000000000ddcutil-0.8.6/data/usr/share/cmake/0000755000175000001440000000000013230445450014056 500000000000000ddcutil-0.8.6/data/usr/share/cmake/Modules/0000755000175000001440000000000013230445450015466 500000000000000ddcutil-0.8.6/data/usr/share/cmake/Modules/FindDDCUtil.cmake0000644000175000001440000000477613101546540020456 00000000000000# - Try to find Libddcutil # Once done this will define # # DDCUTIL_FOUND - system has DDCUtil # DDCUTIL_INCLUDE_DIR - the libddcutil include directory # DDCUTIL_LIBS - The libddcutil libraries # Copyright (c) 2017, Dorian Vogel, # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. find_package(PkgConfig) pkg_check_modules(PC_LIBDDCUTIL QUIET ddcutil) set(LIBDDCUTIL_DEFINITIONS ${PC_LIBDDCUTIL_CFLAGS_OTHER}) find_path(LIBDDCUTIL_INCLUDE_DIR ddcutil_c_api.h HINTS ${PC_LIBDDCUTIL_INCLUDEDIR} ${PC_LIBDDCUTIL_INCLUDE_DIRS}) find_library(LIBDDCUTIL_LIBRARY NAMES libddcutil.so HINTS ${PC_LIBDDCUTIL_LIBDIR} ${PC_LIBDDCUTIL_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set LIBDDCUTIL_FOUND to TRUE # if all listed variables are TRUE find_package_handle_standard_args(ddcutil DEFAULT_MSG LIBDDCUTIL_LIBRARY LIBDDCUTIL_INCLUDE_DIR) mark_as_advanced(LIBDDCUTIL_INCLUDE_DIR LIBDDCUTIL_LIBRARY ) set(LIBDDCUTIL_LIBRARIES ${LIBDDCUTIL_LIBRARY} ) set(LIBDDCUTIL_INCLUDE_DIRS ${LIBDDCUTIL_INCLUDE_DIR} ) ddcutil-0.8.6/data/Makefile.am0000664000175000001440000000173013134651763013053 00000000000000 resfiles = \ etc/udev/rules.d/45-ddcutil-i2c.rules \ etc/udev/rules.d/45-ddcutil-usb.rules \ etc/X11/xorg.conf.d/90-nvidia-i2c.conf if ENABLE_SHARED_LIB_COND resfiles += usr/share/cmake/Modules/FindDDCUtil.cmake endif # resdir: not used # resdir = $(datadir)/ddcutil/data ddcutildir = $(datadir)/ddcutil/data # ddcutil_DATA requires ddcutildir # Causes files (w/o directory structure) to be installed in /usr/local/share/ddcutil/data: # or /usr/share/ddcutil/data ddcutil_DATA = $(resfiles) # Causes files (with directory structure) to be included in tarball: EXTRA_DIST = $(resfiles) EXTRA_DIST += usr/share/cmake/Modules/FindDDCUtil.cmake install-data-local: @echo "Executing rule: install-data-local" # @xxx@ names are not defined, names with $() are install-data-hook: @echo "Executing rule: install-data-hook" @echo "packagedatadir: $(packagedatadir)" @echo "datadir: $(datadir)" @echo "ddcutildir: $(ddcutildir)" @echo "srcdir: $(srcdir)" ddcutil-0.8.6/data/Makefile.in0000644000175000001440000004377013230171236013061 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_SHARED_LIB_COND_TRUE@am__append_1 = usr/share/cmake/Modules/FindDDCUtil.cmake subdir = data ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(ddcutildir)" DATA = $(ddcutil_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ resfiles = etc/udev/rules.d/45-ddcutil-i2c.rules \ etc/udev/rules.d/45-ddcutil-usb.rules \ etc/X11/xorg.conf.d/90-nvidia-i2c.conf $(am__append_1) # resdir: not used # resdir = $(datadir)/ddcutil/data ddcutildir = $(datadir)/ddcutil/data # ddcutil_DATA requires ddcutildir # Causes files (w/o directory structure) to be installed in /usr/local/share/ddcutil/data: # or /usr/share/ddcutil/data ddcutil_DATA = $(resfiles) # Causes files (with directory structure) to be included in tarball: EXTRA_DIST = $(resfiles) usr/share/cmake/Modules/FindDDCUtil.cmake all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign data/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-ddcutilDATA: $(ddcutil_DATA) @$(NORMAL_INSTALL) @list='$(ddcutil_DATA)'; test -n "$(ddcutildir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(ddcutildir)'"; \ $(MKDIR_P) "$(DESTDIR)$(ddcutildir)" || 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)$(ddcutildir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(ddcutildir)" || exit $$?; \ done uninstall-ddcutilDATA: @$(NORMAL_UNINSTALL) @list='$(ddcutil_DATA)'; test -n "$(ddcutildir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(ddcutildir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(ddcutildir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-data-local install-ddcutilDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-ddcutilDATA .MAKE: install-am install-data-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-data-local install-ddcutilDATA \ 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-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags-am uninstall uninstall-am uninstall-ddcutilDATA .PRECIOUS: Makefile install-data-local: @echo "Executing rule: install-data-local" # @xxx@ names are not defined, names with $() are install-data-hook: @echo "Executing rule: install-data-hook" @echo "packagedatadir: $(packagedatadir)" @echo "datadir: $(datadir)" @echo "ddcutildir: $(ddcutildir)" @echo "srcdir: $(srcdir)" # 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: ddcutil-0.8.6/docs/0000755000175000001440000000000013230445450011102 500000000000000ddcutil-0.8.6/docs/Makefile.am0000664000175000001440000000120513134651763013067 00000000000000 SUBDIRS = # SUBDIRS += ddcutil if USE_DOXYGEN SUBDIRS += doxygen endif if USE_DOXYGEN if HAVE_DOCBASE docbasedir = $(datadir)/doc-base docbase_DATA = ddcutil-c-api EXTRA_DIST = ddcutil-c-api install-data-local: @echo "(docs/Makefile) Executing rule install-data-local" install-data-hook: @echo "(docs/Makefile) Executing rule install-data-hook" @echo "docbasedir $(docbasedir)" @echo "datadir $(datadir)" install-docs --install-changed # uninstall-data-hook doesn't exist, use uninstall-hook: uninstall-hook: @echo "(docs/Makefile) Executing rule uninstall-data-hook" install-docs --install-changed endif endif ddcutil-0.8.6/docs/Makefile.in0000644000175000001440000006150113230171236013070 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ # SUBDIRS += ddcutil @USE_DOXYGEN_TRUE@am__append_1 = doxygen subdir = docs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = ddcutil-c-api CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(docbasedir)" DATA = $(docbase_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = doxygen am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ddcutil-c-api.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = $(am__append_1) @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@docbasedir = $(datadir)/doc-base @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@docbase_DATA = ddcutil-c-api @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@EXTRA_DIST = ddcutil-c-api all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign docs/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): ddcutil-c-api: $(top_builddir)/config.status $(srcdir)/ddcutil-c-api.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-docbaseDATA: $(docbase_DATA) @$(NORMAL_INSTALL) @list='$(docbase_DATA)'; test -n "$(docbasedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docbasedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docbasedir)" || 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)$(docbasedir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docbasedir)" || exit $$?; \ done uninstall-docbaseDATA: @$(NORMAL_UNINSTALL) @list='$(docbase_DATA)'; test -n "$(docbasedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docbasedir)'; $(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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(docbasedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @HAVE_DOCBASE_FALSE@install-data-local: @USE_DOXYGEN_FALSE@install-data-local: @HAVE_DOCBASE_FALSE@install-data-hook: @USE_DOXYGEN_FALSE@install-data-hook: @HAVE_DOCBASE_FALSE@uninstall-hook: @USE_DOXYGEN_FALSE@uninstall-hook: clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-docbaseDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-docbaseDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: $(am__recursive_targets) install-am install-data-am \ install-strip uninstall-am .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-data-local install-docbaseDATA \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-docbaseDATA uninstall-hook .PRECIOUS: Makefile @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@install-data-local: @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ @echo "(docs/Makefile) Executing rule install-data-local" @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@install-data-hook: @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ @echo "(docs/Makefile) Executing rule install-data-hook" @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ @echo "docbasedir $(docbasedir)" @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ @echo "datadir $(datadir)" @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ install-docs --install-changed # uninstall-data-hook doesn't exist, use uninstall-hook: @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@uninstall-hook: @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ @echo "(docs/Makefile) Executing rule uninstall-data-hook" @HAVE_DOCBASE_TRUE@@USE_DOXYGEN_TRUE@ install-docs --install-changed # 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: ddcutil-0.8.6/docs/ddcutil-c-api.in0000644000175000001440000000055713032550072013775 00000000000000Document: ddcutil-c-api Title: ddcutil C API Author: Sanford Rockowitz Abstract: This doxgygen generated manual documents the ddcutil C API. Your're probably better off just looking at the header files and sample code. Section: System/Hardware Format: HTML Index: @prefix@/share/doc/ddcutil/html/index.html Files: @prefix@/share/doc/ddcutil/html/* ddcutil-0.8.6/docs/doxygen/0000755000175000001440000000000013230445450012557 500000000000000ddcutil-0.8.6/docs/doxygen/Makefile.am0000644000175000001440000000065213032550072014533 00000000000000docpkg = $(PACKAGE_TARNAME)-doxy-$(PACKAGE_VERSION).tar.gz doc_DATA = $(docpkg) $(docpkg): doxygen.stamp tar chof - html | gzip -9 -c >$@ doxygen.stamp: doxyfile $(DOXYGEN) $(DOXYFLAGS) $< echo Timestamp > $@ install-data-hook: cd $(DESTDIR)$(docdir) && tar xf $(docpkg) uninstall-hook: cd $(DESTDIR)$(docdir) && rm -rf html CLEANFILES = doxywarn.txt doxygen.stamp $(docpkg) clean-local: rm -rf html ddcutil-0.8.6/docs/doxygen/Makefile.in0000644000175000001440000004324213230171236014547 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = docs/doxygen ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_path_python3.m4 \ $(top_srcdir)/m4/ax_pkg_swig.m4 \ $(top_srcdir)/m4/ax_prog_doxygen.m4 \ $(top_srcdir)/m4/ax_python_env.m4 \ $(top_srcdir)/m4/flm_prog_try_doxygen.m4 \ $(top_srcdir)/m4/introspection.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 $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = doxyfile CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(docdir)" DATA = $(doc_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/doxyfile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ADL_HEADER_DIR = @ADL_HEADER_DIR@ 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@ DBG = @DBG@ DEBIAN_DISTRIBUTION = @DEBIAN_DISTRIBUTION@ DEBIAN_RELEASE = @DEBIAN_RELEASE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOCBASE_INSTALL_DOCS = @DOCBASE_INSTALL_DOCS@ DOXYGEN = @DOXYGEN@ DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DX_CONFIG = @DX_CONFIG@ DX_DOCDIR = @DX_DOCDIR@ DX_DOT = @DX_DOT@ DX_DOXYGEN = @DX_DOXYGEN@ DX_DVIPS = @DX_DVIPS@ DX_EGREP = @DX_EGREP@ DX_ENV = @DX_ENV@ DX_FLAG_chi = @DX_FLAG_chi@ DX_FLAG_chm = @DX_FLAG_chm@ DX_FLAG_doc = @DX_FLAG_doc@ DX_FLAG_dot = @DX_FLAG_dot@ DX_FLAG_html = @DX_FLAG_html@ DX_FLAG_man = @DX_FLAG_man@ DX_FLAG_pdf = @DX_FLAG_pdf@ DX_FLAG_ps = @DX_FLAG_ps@ DX_FLAG_rtf = @DX_FLAG_rtf@ DX_FLAG_xml = @DX_FLAG_xml@ DX_HHC = @DX_HHC@ DX_LATEX = @DX_LATEX@ DX_MAKEINDEX = @DX_MAKEINDEX@ DX_PDFLATEX = @DX_PDFLATEX@ DX_PERL = @DX_PERL@ DX_PROJECT = @DX_PROJECT@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_SHARED_LIB_FLAG = @ENABLE_SHARED_LIB_FLAG@ ENABLE_USB_FLAG = @ENABLE_USB_FLAG@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_LIBS = @GLIB_LIBS@ GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIBS = @LIBDRM_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBX11_CFLAGS = @LIBX11_CFLAGS@ LIBX11_LIBS = @LIBX11_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_REVISION = @LT_REVISION@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PY2_CFLAGS = @PY2_CFLAGS@ PY2_EXECDIR = @PY2_EXECDIR@ PY2_EXTRA_LDFLAGS = @PY2_EXTRA_LDFLAGS@ PY2_EXTRA_LIBS = @PY2_EXTRA_LIBS@ PY2_LIBS = @PY2_LIBS@ PY3_CFLAGS = @PY3_CFLAGS@ PY3_EXECDIR = @PY3_EXECDIR@ PY3_EXTRA_LDFLAGS = @PY3_EXTRA_LDFLAGS@ PY3_EXTRA_LIBS = @PY3_EXTRA_LIBS@ PY3_LIBS = @PY3_LIBS@ PYEXECDIR = @PYEXECDIR@ PYTHON = @PYTHON@ PYTHON3 = @PYTHON3@ PYTHON3_EXEC_PREFIX = @PYTHON3_EXEC_PREFIX@ PYTHON3_PLATFORM = @PYTHON3_PLATFORM@ PYTHON3_PREFIX = @PYTHON3_PREFIX@ PYTHON3_VERSION = @PYTHON3_VERSION@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ REQUIRED_PACKAGES = @REQUIRED_PACKAGES@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ SWIG_LIB = @SWIG_LIB@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ XRANDR_CFLAGS = @XRANDR_CFLAGS@ XRANDR_LIBS = @XRANDR_LIBS@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LIBS = @ZLIB_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@ pkgpy3execdir = @pkgpy3execdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpython3dir = @pkgpython3dir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ py2execdir = @py2execdir@ py3execdir = @py3execdir@ pyexecdir = @pyexecdir@ python3dir = @python3dir@ pythondir = @pythondir@ 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@ docpkg = $(PACKAGE_TARNAME)-doxy-$(PACKAGE_VERSION).tar.gz doc_DATA = $(docpkg) CLEANFILES = doxywarn.txt doxygen.stamp $(docpkg) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/doxygen/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign docs/doxygen/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): doxyfile: $(top_builddir)/config.status $(srcdir)/doxyfile.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-docDATA: $(doc_DATA) @$(NORMAL_INSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-docDATA: @$(NORMAL_UNINSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-docDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-docDATA @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: install-am install-data-am install-strip uninstall-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ clean-local cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-data-hook install-docDATA install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-docDATA uninstall-hook .PRECIOUS: Makefile $(docpkg): doxygen.stamp tar chof - html | gzip -9 -c >$@ doxygen.stamp: doxyfile $(DOXYGEN) $(DOXYFLAGS) $< echo Timestamp > $@ install-data-hook: cd $(DESTDIR)$(docdir) && tar xf $(docpkg) uninstall-hook: cd $(DESTDIR)$(docdir) && rm -rf html clean-local: rm -rf html # 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: ddcutil-0.8.6/docs/doxygen/doxyfile.in0000644000175000001440000016714313032550072014663 00000000000000# Doxyfile 1.5.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = @PACKAGE_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @PACKAGE_VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = . # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, # and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = @top_srcdir@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. # DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 3 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. # OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES # EXTRACT_ALL = NO EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = YES # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. # SHOW_USED_FILES = NO SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. # *** OBSOLETE *** # SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. # WARN_NO_PARAMDOC = NO WARN_NO_PARAMDOC = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = doxywarn.txt #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/src/public/ddcutil_c_api.h @top_srcdir@/src/public/ddcutil_types.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.d \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.mm \ *.dox \ *.py # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. # *** OBSOLETE *** # HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hiererachy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = YES # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. # GENERATE_LATEX = NO GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. # PDF_HYPERLINKS = NO PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. # USE_PDFLATEX = NO USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. # *** OBSOLETE *** # XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. # *** OBSOLETE *** # XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 1000 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is enabled by default, which results in a transparent # background. Warning: Depending on the platform used, enabling this option # may lead to badly anti-aliased labels on the edges of a graph (i.e. they # become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO