libmtp-1.1.10/0000755000175000001440000000000012604234355010062 500000000000000libmtp-1.1.10/compile0000755000175000001440000001624512601454751011371 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libmtp-1.1.10/configure0000755000175000001440000206204212604225570011716 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for libmtp 1.1.10. # # 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: libmtp-discuss@lists.sourceforge.net about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libmtp' PACKAGE_TARNAME='libmtp' PACKAGE_VERSION='1.1.10' PACKAGE_STRING='libmtp 1.1.10' PACKAGE_BUGREPORT='libmtp-discuss@lists.sourceforge.net' PACKAGE_URL='' ac_unique_file="src/libmtp.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS effective_target LIBOBJS LIBOPENUSB_COMPILE_FALSE LIBOPENUSB_COMPILE_TRUE LIBUSB0_COMPILE_FALSE LIBUSB0_COMPILE_TRUE LIBUSB1_COMPILE_FALSE LIBUSB1_COMPILE_TRUE MTPZ_COMPILE_FALSE MTPZ_COMPILE_TRUE LIBUSB_REQUIRES LIBUSB_LIBS LIBUSB_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG MS_LIB_EXE_FALSE MS_LIB_EXE_TRUE ms_lib_exe COMPILE_MINGW32_FALSE COMPILE_MINGW32_TRUE USE_LINUX_FALSE USE_LINUX_TRUE OSFLAGS HAVE_DOXYGEN_FALSE HAVE_DOXYGEN_TRUE HAVE_DOXYGEN UDEV_MODE UDEV_GROUP UDEV_RULES UDEV LTLIBICONV LIBICONV CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL OBJDUMP DLLTOOL AS host_os host_vendor host_cpu host build_os build_vendor build_cpu build LN_S am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir 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_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_rpath with_libiconv_prefix with_udev with_udev_rules with_udev_group with_udev_mode enable_doxygen enable_mtpz enable_largefile ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR LIBUSB_CFLAGS LIBUSB_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures libmtp 1.1.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/libmtp] --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 libmtp 1.1.10:";; 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-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-rpath do not hardcode runtime library paths --enable-doxygen Build API documentation using Doxygen [default=auto] --disable-mtpz Disable functionality to connect to MTPZ devices (e.g. Zune) --disable-largefile omit support for large files 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-gnu-ld assume the C compiler uses GNU ld [default=no] --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-udev=DIR directory where udev is installed [default=/usr/lib/udev] --with-udev-rules=NAME file name for udev rules [default=69-libmtp.rules] --with-udev-group=GROUP file group for device nodes [default: none specified] --with-udev-mode=GROUP file mode for device nodes [default: none specified] Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor 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 LIBUSB_CFLAGS C compiler flags for LIBUSB, overriding pkg-config LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libmtp configure 1.1.10 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------------------------- ## ## Report this to libmtp-discuss@lists.sourceforge.net ## ## --------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=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 eval ac_res=\$$4 { $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_member 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 libmtp $as_me 1.1.10, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='libmtp' VERSION='1.1.10' 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 ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether 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 # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # 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 enable_dlopen=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 --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # 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="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; 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: if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. 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 ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${acl_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_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 `"$acl_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 ${acl_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 "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if ${acl_cv_rpath+:} false; then : $as_echo_n "(cached) " >&6 else CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 $as_echo "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; : else enable_rpath=yes fi acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 $as_echo_n "checking for 64-bit host... " >&6; } if ${gl_cv_solaris_64bit+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _LP64 sixtyfour bits #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "sixtyfour bits" >/dev/null 2>&1; then : gl_cv_solaris_64bit=yes else gl_cv_solaris_64bit=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 $as_echo "$gl_cv_solaris_64bit" >&6; } if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if ${am_cv_func_iconv+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 $as_echo "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 $as_echo_n "checking for working iconv... " >&6; } if ${am_cv_func_iconv_works+:} false; then : $as_echo_n "(cached) " >&6 else am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi if test "$cross_compiling" = yes; then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static const char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) return 1; } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) return 1; } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ if (/* Try standardized names. */ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) /* Try IRIX, OSF/1 names. */ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) /* Try AIX names. */ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : am_cv_func_iconv_works=yes else am_cv_func_iconv_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi LIBS="$am_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 $as_echo "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then $as_echo "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 $as_echo "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 $as_echo_n "checking for iconv declaration... " >&6; } if ${am_cv_proto_iconv+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_cv_proto_iconv_arg1="" else am_cv_proto_iconv_arg1="const" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_proto_iconv" >&5 $as_echo " $am_cv_proto_iconv" >&6; } cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 _ACEOF fi # Optionally set install location of udev UDEV=/usr/lib/udev # Check whether --with-udev was given. if test "${with_udev+set}" = set; then : withval=$with_udev; UDEV="${withval}" fi # Optionally set name of udev rules file, default # priority is 69, to appear before 70-acl.rules which handles # access control to the devices. We try to let all other userspace # libusb-based device handlers take precedence since libmtp may # attempt to autoprobe the devices. # # Later rules can then use the identifiers for its processing. UDEV_RULES=69-libmtp.rules # Check whether --with-udev-rules was given. if test "${with_udev_rules+set}" = set; then : withval=$with_udev_rules; UDEV_RULES="${withval}" fi # Optionally set group for device nodes UDEV_GROUP= # Check whether --with-udev-group was given. if test "${with_udev_group+set}" = set; then : withval=$with_udev_group; UDEV_GROUP="-g\"${withval}\"" fi # Optionally set mode for device nodes UDEV_MODE= # Check whether --with-udev-mode was given. if test "${with_udev_mode+set}" = set; then : withval=$with_udev_mode; UDEV_MODE="-m\"${withval}\"" fi # Optionally enable and check for doxygen # Check whether --enable-doxygen was given. if test "${enable_doxygen+set}" = set; then : enableval=$enable_doxygen; ac_enable_doxygen=$enableval else ac_enable_doxygen=auto fi if test "x$ac_enable_doxygen" != "xno"; then # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_HAVE_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAVE_DOXYGEN"; then ac_cv_prog_HAVE_DOXYGEN="$HAVE_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_HAVE_DOXYGEN="true" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_HAVE_DOXYGEN" && ac_cv_prog_HAVE_DOXYGEN="false" fi fi HAVE_DOXYGEN=$ac_cv_prog_HAVE_DOXYGEN if test -n "$HAVE_DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_DOXYGEN" >&5 $as_echo "$HAVE_DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doxygen" = "xyes"; then as_fn_error $? "*** API documentation explicitly requested but Doxygen not found" "$LINENO" 5 fi if test "x$HAVE_DOXYGEN" = "xtrue"; then { $as_echo "$as_me:${as_lineno-$LINENO}: API documentation will be generated using Doxygen" >&5 $as_echo "$as_me: API documentation will be generated using Doxygen" >&6;} fi else HAVE_DOXYGEN=false { $as_echo "$as_me:${as_lineno-$LINENO}: API documentation will not be generated" >&5 $as_echo "$as_me: API documentation will not be generated" >&6;} fi if $HAVE_DOXYGEN; then HAVE_DOXYGEN_TRUE= HAVE_DOXYGEN_FALSE='#' else HAVE_DOXYGEN_TRUE='#' HAVE_DOXYGEN_FALSE= fi # Check for Darwin { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the host operating system is Darwin" >&5 $as_echo_n "checking if the host operating system is Darwin... " >&6; } case "$host" in *-darwin*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS="$CFLAGS -DUSE_DARWIN" OSFLAGS="-framework IOKit" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the host operating system is Linux" >&5 $as_echo_n "checking if the host operating system is Linux... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __linux__ #error "FAIL" #endif int main () { int test; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } if true; then USE_LINUX_TRUE= USE_LINUX_FALSE='#' else USE_LINUX_TRUE='#' USE_LINUX_FALSE= fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if false; then USE_LINUX_TRUE= USE_LINUX_FALSE='#' else USE_LINUX_TRUE='#' USE_LINUX_FALSE= fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check for mingw compiler platform { $as_echo "$as_me:${as_lineno-$LINENO}: checking For MinGW32" >&5 $as_echo_n "checking For MinGW32... " >&6; } case "$host" in *-*-mingw*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } mingw_compiler=yes ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac if test "$mingw_compiler" = "yes"; then COMPILE_MINGW32_TRUE= COMPILE_MINGW32_FALSE='#' else COMPILE_MINGW32_TRUE='#' COMPILE_MINGW32_FALSE= fi # Check if Microsoft LIB.EXE is available if test "$mingw_compiler" = "yes"; then # Extract the first word of "lib.exe", so it can be a program name with args. set dummy lib.exe; ac_word=$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_ms_lib_exe+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ms_lib_exe"; then ac_cv_prog_ms_lib_exe="$ms_lib_exe" # 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_ms_lib_exe="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_ms_lib_exe" && ac_cv_prog_ms_lib_exe="no" fi fi ms_lib_exe=$ac_cv_prog_ms_lib_exe if test -n "$ms_lib_exe"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ms_lib_exe" >&5 $as_echo "$ms_lib_exe" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test x$ms_lib_exe = xyes; then MS_LIB_EXE_TRUE= MS_LIB_EXE_FALSE='#' else MS_LIB_EXE_TRUE='#' MS_LIB_EXE_FALSE= fi # Check for libusb-1.0 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 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.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.0") 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.0" 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.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb-1.0 >= 1.0.0") 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.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libusb-1.0 >= 1.0.0" 2>&1` else LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb-1.0 >= 1.0.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUSB_PKG_ERRORS" >&5 # Check for libopenusb second { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openusb_init in -lopenusb" >&5 $as_echo_n "checking for openusb_init in -lopenusb... " >&6; } if ${ac_cv_lib_openusb_openusb_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lopenusb $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 openusb_init (); int main () { return openusb_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_openusb_openusb_init=yes else ac_cv_lib_openusb_openusb_init=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_openusb_openusb_init" >&5 $as_echo "$ac_cv_lib_openusb_openusb_init" >&6; } if test "x$ac_cv_lib_openusb_openusb_init" = xyes; then : $as_echo "#define HAVE_OPENUSB /**/" >>confdefs.h LIBUSB_VER=1.0 else 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 >= 0.1.8\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb >= 0.1.8") 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 >= 0.1.8" 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 >= 0.1.8\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb >= 0.1.8") 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 >= 0.1.8" 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 >= 0.1.8" 2>&1` else LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb >= 0.1.8" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUSB_PKG_ERRORS" >&5 # Some systems don't use pkg-config for libusb, so double check. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb_open in -lusb" >&5 $as_echo_n "checking for usb_open in -lusb... " >&6; } if ${ac_cv_lib_usb_usb_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $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 usb_open (); int main () { return usb_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usb_usb_open=yes else ac_cv_lib_usb_usb_open=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_usb_usb_open" >&5 $as_echo "$ac_cv_lib_usb_usb_open" >&6; } if test "x$ac_cv_lib_usb_usb_open" = xyes; then : LIBUSB_VER=0.1 $as_echo "#define HAVE_LIBUSB0 /**/" >>confdefs.h found_libusb0_pkg=yes else as_fn_error $? "*** libusb not found! (missing -dev/-devel package?) ***\n*** prefer to install libusb-1 if you can! ***" "$LINENO" 5 fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Some systems don't use pkg-config for libusb, so double check. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb_open in -lusb" >&5 $as_echo_n "checking for usb_open in -lusb... " >&6; } if ${ac_cv_lib_usb_usb_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $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 usb_open (); int main () { return usb_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usb_usb_open=yes else ac_cv_lib_usb_usb_open=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_usb_usb_open" >&5 $as_echo "$ac_cv_lib_usb_usb_open" >&6; } if test "x$ac_cv_lib_usb_usb_open" = xyes; then : LIBUSB_VER=0.1 $as_echo "#define HAVE_LIBUSB0 /**/" >>confdefs.h found_libusb0_pkg=yes else as_fn_error $? "*** libusb not found! (missing -dev/-devel package?) ***\n*** prefer to install libusb-1 if you can! ***" "$LINENO" 5 fi 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_VER=`pkg-config --modversion libusb` LIBUSB_REQUIRES='libusb' $as_echo "#define HAVE_LIBUSB0 /**/" >>confdefs.h found_libusb0_pkg=yes fi fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Check for libopenusb second { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openusb_init in -lopenusb" >&5 $as_echo_n "checking for openusb_init in -lopenusb... " >&6; } if ${ac_cv_lib_openusb_openusb_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lopenusb $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 openusb_init (); int main () { return openusb_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_openusb_openusb_init=yes else ac_cv_lib_openusb_openusb_init=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_openusb_openusb_init" >&5 $as_echo "$ac_cv_lib_openusb_openusb_init" >&6; } if test "x$ac_cv_lib_openusb_openusb_init" = xyes; then : $as_echo "#define HAVE_OPENUSB /**/" >>confdefs.h LIBUSB_VER=1.0 else 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 >= 0.1.8\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb >= 0.1.8") 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 >= 0.1.8" 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 >= 0.1.8\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb >= 0.1.8") 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 >= 0.1.8" 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 >= 0.1.8" 2>&1` else LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libusb >= 0.1.8" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUSB_PKG_ERRORS" >&5 # Some systems don't use pkg-config for libusb, so double check. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb_open in -lusb" >&5 $as_echo_n "checking for usb_open in -lusb... " >&6; } if ${ac_cv_lib_usb_usb_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $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 usb_open (); int main () { return usb_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usb_usb_open=yes else ac_cv_lib_usb_usb_open=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_usb_usb_open" >&5 $as_echo "$ac_cv_lib_usb_usb_open" >&6; } if test "x$ac_cv_lib_usb_usb_open" = xyes; then : LIBUSB_VER=0.1 $as_echo "#define HAVE_LIBUSB0 /**/" >>confdefs.h found_libusb0_pkg=yes else as_fn_error $? "*** libusb not found! (missing -dev/-devel package?) ***\n*** prefer to install libusb-1 if you can! ***" "$LINENO" 5 fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } # Some systems don't use pkg-config for libusb, so double check. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb_open in -lusb" >&5 $as_echo_n "checking for usb_open in -lusb... " >&6; } if ${ac_cv_lib_usb_usb_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lusb $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 usb_open (); int main () { return usb_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_usb_usb_open=yes else ac_cv_lib_usb_usb_open=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_usb_usb_open" >&5 $as_echo "$ac_cv_lib_usb_usb_open" >&6; } if test "x$ac_cv_lib_usb_usb_open" = xyes; then : LIBUSB_VER=0.1 $as_echo "#define HAVE_LIBUSB0 /**/" >>confdefs.h found_libusb0_pkg=yes else as_fn_error $? "*** libusb not found! (missing -dev/-devel package?) ***\n*** prefer to install libusb-1 if you can! ***" "$LINENO" 5 fi 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_VER=`pkg-config --modversion libusb` LIBUSB_REQUIRES='libusb' $as_echo "#define HAVE_LIBUSB0 /**/" >>confdefs.h found_libusb0_pkg=yes fi fi 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_VER=`pkg-config --modversion libusb-1.0` LIBUSB_REQUIRES='libusb-1.0' $as_echo "#define HAVE_LIBUSB1 /**/" >>confdefs.h found_libusb1_pkg=yes fi # Optionally disable MTPZ functionality. # Check whether --enable-mtpz was given. if test "${enable_mtpz+set}" = set; then : enableval=$enable_mtpz; use_mtpz=$enableval else use_mtpz="yes" fi # Include MTPZ if not disabled. if test x"$use_mtpz" = "xyes" ; then # Check for libgcrypt. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgcrypt" >&5 $as_echo_n "checking for libgcrypt... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcry_check_version in -lgcrypt" >&5 $as_echo_n "checking for gcry_check_version in -lgcrypt... " >&6; } if ${ac_cv_lib_gcrypt_gcry_check_version+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgcrypt $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 gcry_check_version (); int main () { return gcry_check_version (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gcrypt_gcry_check_version=yes else ac_cv_lib_gcrypt_gcry_check_version=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_gcrypt_gcry_check_version" >&5 $as_echo "$ac_cv_lib_gcrypt_gcry_check_version" >&6; } if test "x$ac_cv_lib_gcrypt_gcry_check_version" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBGCRYPT 1 _ACEOF LIBS="-lgcrypt $LIBS" else { $as_echo "$as_me:${as_lineno-$LINENO}: *** libgcrypt not found - disabling MTPZ support ***" >&5 $as_echo "$as_me: *** libgcrypt not found - disabling MTPZ support ***" >&6;} ; use_mtpz="no" fi fi if test x"$use_mtpz" = "xyes" ; then $as_echo "#define USE_MTPZ /**/" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: MTPZ functionality enabled" >&5 $as_echo "$as_me: MTPZ functionality enabled" >&6;}; else { $as_echo "$as_me:${as_lineno-$LINENO}: MTPZ functionality disable" >&5 $as_echo "$as_me: MTPZ functionality disable" >&6;}; fi if test x"$use_mtpz" = "xyes"; then MTPZ_COMPILE_TRUE= MTPZ_COMPILE_FALSE='#' else MTPZ_COMPILE_TRUE='#' MTPZ_COMPILE_FALSE= fi if test x"$found_libusb1_pkg" = "xyes"; then LIBUSB1_COMPILE_TRUE= LIBUSB1_COMPILE_FALSE='#' else LIBUSB1_COMPILE_TRUE='#' LIBUSB1_COMPILE_FALSE= fi if test x"$found_libusb0_pkg" = "xyes"; then LIBUSB0_COMPILE_TRUE= LIBUSB0_COMPILE_FALSE='#' else LIBUSB0_COMPILE_TRUE='#' LIBUSB0_COMPILE_FALSE= fi if test x"$ac_cv_lib_openusb_openusb_init" = "xyes"; then LIBOPENUSB_COMPILE_TRUE= LIBOPENUSB_COMPILE_FALSE='#' else LIBOPENUSB_COMPILE_TRUE='#' LIBOPENUSB_COMPILE_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: *** using libusb $LIBUSB_VER ***" >&5 $as_echo "$as_me: *** using libusb $LIBUSB_VER ***" >&6;} # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=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_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi # zlib.h the day we need to decompress firmware for ac_header in ctype.h errno.h fcntl.h getopt.h libgen.h \ limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \ langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF 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_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 _ACEOF $as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h fi # Checks for library functions. for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if ${ac_cv_func_memcmp_working+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=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_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_func in basename memset select strdup strerror strndup strrchr strtoul usleep mkstemp 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 # Switches. # Enable LFS (Large File Support) # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi # Stick in "-Werror" if you want to be more aggressive. # (No need to use AC_SUBST on this default substituted environment variable.) # Only add these additional CFLAGS if we are using GCC. Other C compilers may # not support them. if test x"$GCC" == "xyes" ; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" fi # Output files # Create a stdint.h-like file containing size-specific integer definitions # that will always be available. The file is required by the # library, but we provide this anyway because the libptp2 stuff wants this # file. ac_dir=`$as_dirname -- "src/_stdint.h" || $as_expr X"src/_stdint.h" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"src/_stdint.h" : 'X\(//\)[^/]' \| \ X"src/_stdint.h" : 'X\(//\)$' \| \ X"src/_stdint.h" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"src/_stdint.h" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` if test "$ac_dir" != "src/_stdint.h" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && (as_dir="$ac_dir"; as_fn_mkdir_p) fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint8_t in stdint.h" >&5 $as_echo_n "checking for uint8_t in stdint.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then : ac_cv_type_uint8_t=yes else ac_cv_type_uint8_t=no fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uint8_t" >&5 $as_echo "$ac_cv_type_uint8_t" >&6; } if test $ac_cv_type_uint8_t = yes; then cat > "src/_stdint.h" < EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint8_t in inttypes.h" >&5 $as_echo_n "checking for uint8_t in inttypes.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then : ac_cv_type_uint8_t=yes else ac_cv_type_uint8_t=no fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uint8_t" >&5 $as_echo "$ac_cv_type_uint8_t" >&6; } if test $ac_cv_type_uint8_t = yes; then cat > "src/_stdint.h" < EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint8_t in sys/types.h" >&5 $as_echo_n "checking for uint8_t in sys/types.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "(^|[^a-zA-Z_0-9])uint8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then : ac_cv_type_uint8_t=yes else ac_cv_type_uint8_t=no fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uint8_t" >&5 $as_echo "$ac_cv_type_uint8_t" >&6; } if test $ac_cv_type_uint8_t = yes; then cat > "src/_stdint.h" < EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_int8_t in sys/types.h" >&5 $as_echo_n "checking for u_int8_t in sys/types.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "(^|[^a-zA-Z_0-9])u_int8_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then : ac_cv_type_u_int8_t=yes else ac_cv_type_u_int8_t=no fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_u_int8_t" >&5 $as_echo "$ac_cv_type_u_int8_t" >&6; } if test $ac_cv_type_u_int8_t = yes; then cat > "src/_stdint.h" < typedef u_int8_t uint8_t; typedef u_int16_t uint16_t; typedef u_int32_t uint32_t; EOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for u_int64_t in sys/types.h" >&5 $as_echo_n "checking for u_int64_t in sys/types.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "(^|[^a-zA-Z_0-9])u_int64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then : ac_cv_type_u_int64_t=yes else ac_cv_type_u_int64_t=no fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_u_int64_t" >&5 $as_echo "$ac_cv_type_u_int64_t" >&6; } if test $ac_cv_type_u_int64_t = yes; then cat >> "src/_stdint.h" <> "src/_stdint.h" <&5 $as_echo "$as_me: WARNING: I can't find size-specific integer definitions on this system" >&2;} if test -e "src/_stdint.h" ; then rm -f "src/_stdint.h" fi fi fi fi fi # Create a header file containing NetBSD-style byte swapping macros. # This m4 macros has caused severe pain, I am considering creating a # hard-coded byte swapper that will be eternally portable. ac_dir=`$as_dirname -- "src/gphoto2-endian.h" || $as_expr X"src/gphoto2-endian.h" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"src/gphoto2-endian.h" : 'X\(//\)[^/]' \| \ X"src/gphoto2-endian.h" : 'X\(//\)$' \| \ X"src/gphoto2-endian.h" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"src/gphoto2-endian.h" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` if test "$ac_dir" != "src/gphoto2-endian.h" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && (as_dir="$ac_dir"; as_fn_mkdir_p) fi # We're only interested in the target CPU, but it's not always set effective_target="$target" if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then effective_target="$host" fi cat > "src/gphoto2-endian.h" << EOF /* This file is generated automatically by configure */ /* It is valid only for the system type ${effective_target} */ #ifndef __BYTEORDER_H #define __BYTEORDER_H EOF { $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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for le32toh in machine/endian.h" >&5 $as_echo_n "checking for le32toh in machine/endian.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef le32toh symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } HAVE_LE32TOH=1 cat >> "src/gphoto2-endian.h" << EOF /* extended byte swapping macros are already available */ #include EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ntohl in arpa/inet.h" >&5 $as_echo_n "checking for ntohl in arpa/inet.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef ntohl symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* ntohl and relatives live here */ #include EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ntohl in netinet/in.h" >&5 $as_echo_n "checking for ntohl in netinet/in.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef ntohl symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* ntohl and relatives live here */ #include EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } true fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: checking for swap32 in machine/endian.h" >&5 $as_echo_n "checking for swap32 in machine/endian.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef swap32 symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* swap32 and swap16 are defined in machine/endian.h */ EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bswap_32 in byteswap.h" >&5 $as_echo_n "checking for bswap_32 in byteswap.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef bswap_32 symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) bswap_16(x) #define swap32(x) bswap_32(x) #define swap64(x) bswap_64(x) EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bswap32 in machine/endian.h" >&5 $as_echo_n "checking for bswap32 in machine/endian.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef bswap32 symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* Define generic byte swapping functions */ EOF if test "$HAVE_LE32TOH" != "1"; then echo '#include '>> "src/gphoto2-endian.h" fi cat >> "src/gphoto2-endian.h" << EOF #define swap16(x) bswap16(x) #define swap32(x) bswap32(x) #define swap64(x) bswap64(x) EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __byte_swap_long in sys/types.h" >&5 $as_echo_n "checking for __byte_swap_long in sys/types.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef __byte_swap_long symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\<__byte_swap_long\>" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) __byte_swap_word(x) #define swap32(x) __byte_swap_long(x) /* No optimized 64 bit byte swapping macro is available */ #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NXSwapLong in machine/byte_order.h" >&5 $as_echo_n "checking for NXSwapLong in machine/byte_order.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef NXSwapLong symbol is present #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "symbol is present|\" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >> "src/gphoto2-endian.h" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) NXSwapShort(x) #define swap32(x) NXSwapLong(x) #define swap64(x) NXSwapLongLong(x) EOF else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if test $ac_cv_c_bigendian = yes; then cat >> "src/gphoto2-endian.h" << EOF /* No other byte swapping functions are available on this big-endian system */ #define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8))) #define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\ ((uint32_t)(x) << 8) & 0x00ff0000UL | \\ ((x) >> 8) & 0x0000ff00UL | \\ ((x) >> 24) & 0x000000ffUL)) #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF else cat >> "src/gphoto2-endian.h" << EOF /* Use these as generic byteswapping macros on this little endian system */ #define swap16(x) ntohs(x) #define swap32(x) ntohl(x) /* No optimized 64 bit byte swapping macro is available */ #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF fi fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* if test "$HAVE_LE32TOH" != "1"; then cat >> "src/gphoto2-endian.h" << EOF /* The byte swapping macros have the form: */ /* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */ /* le (little-endian), NN is 16 or 32 (number of bits) and a, */ /* if present, indicates that the endian side is a pointer to an */ /* array of uint8_t bytes instead of an integer of the specified length. */ /* h refers to the host's ordering method. */ /* So, to convert a 32-bit integer stored in a buffer in little-endian */ /* format into a uint32_t usable on this machine, you could use: */ /* uint32_t value = le32atoh(&buf[3]); */ /* To put that value back into the buffer, you could use: */ /* htole32a(&buf[3], value); */ /* Define aliases for the standard byte swapping macros */ /* Arguments to these macros must be properly aligned on natural word */ /* boundaries in order to work properly on all architectures */ #ifndef htobe16 # define htobe16(x) htons(x) #endif #ifndef htobe32 # define htobe32(x) htonl(x) #endif #ifndef be16toh # define be16toh(x) ntohs(x) #endif #ifndef be32toh # define be32toh(x) ntohl(x) #endif #define HTOBE16(x) (x) = htobe16(x) #define HTOBE32(x) (x) = htobe32(x) #define BE32TOH(x) (x) = be32toh(x) #define BE16TOH(x) (x) = be16toh(x) EOF if test $ac_cv_c_bigendian = yes; then cat >> "src/gphoto2-endian.h" << EOF /* Define our own extended byte swapping macros for big-endian machines */ #ifndef htole16 # define htole16(x) swap16(x) #endif #ifndef htole32 # define htole32(x) swap32(x) #endif #ifndef le16toh # define le16toh(x) swap16(x) #endif #ifndef le32toh # define le32toh(x) swap32(x) #endif #ifndef le64toh # define le64toh(x) swap64(x) #endif #ifndef htobe64 # define htobe64(x) (x) #endif #ifndef be64toh # define be64toh(x) (x) #endif #define HTOLE16(x) (x) = htole16(x) #define HTOLE32(x) (x) = htole32(x) #define LE16TOH(x) (x) = le16toh(x) #define LE32TOH(x) (x) = le32toh(x) #define LE64TOH(x) (x) = le64toh(x) #define HTOBE64(x) (void) (x) #define BE64TOH(x) (void) (x) EOF else cat >> "src/gphoto2-endian.h" << EOF /* On little endian machines, these macros are null */ #ifndef htole16 # define htole16(x) (x) #endif #ifndef htole32 # define htole32(x) (x) #endif #ifndef htole64 # define htole64(x) (x) #endif #ifndef le16toh # define le16toh(x) (x) #endif #ifndef le32toh # define le32toh(x) (x) #endif #ifndef le64toh # define le64toh(x) (x) #endif #define HTOLE16(x) (void) (x) #define HTOLE32(x) (void) (x) #define HTOLE64(x) (void) (x) #define LE16TOH(x) (void) (x) #define LE32TOH(x) (void) (x) #define LE64TOH(x) (void) (x) /* These don't have standard aliases */ #ifndef htobe64 # define htobe64(x) swap64(x) #endif #ifndef be64toh # define be64toh(x) swap64(x) #endif #define HTOBE64(x) (x) = htobe64(x) #define BE64TOH(x) (x) = be64toh(x) EOF fi fi cat >> "src/gphoto2-endian.h" << EOF /* Define the C99 standard length-specific integer types */ #include <_stdint.h> EOF case "${effective_target}" in i[3456]86-*) cat >> "src/gphoto2-endian.h" << EOF /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* The i386 and compatibles can handle unaligned memory access, */ /* so use the optimized macros above to do this job */ #ifndef be16atoh # define be16atoh(x) be16toh(*(uint16_t*)(x)) #endif #ifndef be32atoh # define be32atoh(x) be32toh(*(uint32_t*)(x)) #endif #ifndef be64atoh # define be64atoh(x) be64toh(*(uint64_t*)(x)) #endif #ifndef le16atoh # define le16atoh(x) le16toh(*(uint16_t*)(x)) #endif #ifndef le32atoh # define le32atoh(x) le32toh(*(uint32_t*)(x)) #endif #ifndef le64atoh # define le64atoh(x) le64toh(*(uint64_t*)(x)) #endif #ifndef htob16a # define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x) #endif #ifndef htobe32a # define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x) #endif #ifndef htobe64a # define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x) #endif #ifndef htole16a # define htole16a(a,x) *(uint16_t*)(a) = htole16(x) #endif #ifndef htole32a # define htole32a(a,x) *(uint32_t*)(a) = htole32(x) #endif #ifndef htole64a # define htole64a(a,x) *(uint64_t*)(a) = htole64(x) #endif EOF ;; *) cat >> "src/gphoto2-endian.h" << EOF /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* Non-optimized but portable macros */ #define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1])) #define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) #define be64atoh_x(x,off,shift) (((uint64_t)((x)[off]))<>8), (a)[1]=(uint8_t)(x) #define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\ (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) #define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\ (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\ (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\ (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) #define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\ (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\ (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) EOF ;; esac cat >> "src/gphoto2-endian.h" << EOF #endif /*__BYTEORDER_H*/ EOF ac_config_files="$ac_config_files src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile examples/Makefile util/Makefile libmtp.sh hotplug.sh libmtp.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= 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 "${HAVE_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LINUX_TRUE}" && test -z "${USE_LINUX_FALSE}"; then as_fn_error $? "conditional \"USE_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LINUX_TRUE}" && test -z "${USE_LINUX_FALSE}"; then as_fn_error $? "conditional \"USE_LINUX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${COMPILE_MINGW32_TRUE}" && test -z "${COMPILE_MINGW32_FALSE}"; then as_fn_error $? "conditional \"COMPILE_MINGW32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MS_LIB_EXE_TRUE}" && test -z "${MS_LIB_EXE_FALSE}"; then as_fn_error $? "conditional \"MS_LIB_EXE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MTPZ_COMPILE_TRUE}" && test -z "${MTPZ_COMPILE_FALSE}"; then as_fn_error $? "conditional \"MTPZ_COMPILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBUSB1_COMPILE_TRUE}" && test -z "${LIBUSB1_COMPILE_FALSE}"; then as_fn_error $? "conditional \"LIBUSB1_COMPILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBUSB0_COMPILE_TRUE}" && test -z "${LIBUSB0_COMPILE_FALSE}"; then as_fn_error $? "conditional \"LIBUSB0_COMPILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${LIBOPENUSB_COMPILE_TRUE}" && test -z "${LIBOPENUSB_COMPILE_FALSE}"; then as_fn_error $? "conditional \"LIBOPENUSB_COMPILE\" 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 libmtp $as_me 1.1.10, 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="\\ libmtp config.status 1.1.10 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' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_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 AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "src/libmtp.h") CONFIG_FILES="$CONFIG_FILES src/libmtp.h" ;; "doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES doc/Doxyfile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; "libmtp.sh") CONFIG_FILES="$CONFIG_FILES libmtp.sh" ;; "hotplug.sh") CONFIG_FILES="$CONFIG_FILES hotplug.sh" ;; "libmtp.pc") CONFIG_FILES="$CONFIG_FILES libmtp.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "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 # 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 # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm 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 chmod +x hotplug.sh libmtp-1.1.10/libmtp.pc.in0000644000175000001440000000054112503541221012211 00000000000000# libmtp pkg-config source file prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libmtp Description: libmtp is a library for accessing Media Transfer Protocol devices Version: @VERSION@ Requires.private: @LIBUSB_REQUIRES@ Conflicts: Libs: -L${libdir} -lmtp Libs.private: @LIBS@ Cflags: -I${includedir} @OSFLAGS@ libmtp-1.1.10/README0000644000175000001440000012636412544440231010671 00000000000000Building and Installing ----------------------- See the "INSTALL" file. Initiator and Responder ----------------------- libmtp implements an MTP initiator, which means it initiate MTP sessions with devices. The devices responding are known as MTP responders. libmtp runs on something with a USB host controller interface, using libusb to access the host controller. If you're more interested in the MTP responders, gadgets like MP3 players, mobile phones etc, look into: - MeeGo:s Buteo Sync: https://github.com/nemomobile/buteo-mtp https://wiki.merproject.org/wiki/Buteo/MTP - Android has an MTP responder implementation: https://android.googlesource.com/platform/frameworks/base/+/master/media/jni/ - Ubuntu/Ricardo Salveti has mtp-server and libmtp-server going: https://code.launchpad.net/~phablet-team/mtp/trunk http://bazaar.launchpad.net/~phablet-team/mtp/trunk/files Heritage -------- libmtp is based on several ancestors: * libptp2 by Mariusz Woloszyn was the starting point used by Richard A. Low for the initial starter port. You can find it at http://libptp.sourceforge.net/ * libgphoto2 by Mariusz Woloszyn and Marcus Meissner was used at a later stage since it was (is) more actively maintained. libmtp tracks the PTP implementation in libgphoto2 and considers it an upstream project. We will try to submit anything generally useful back to libgphoto2 and not make double efforts. In practice this means we use ptp.c, ptp.h and ptp-pack.c verbatim from the libgphoto2 source code. If you need to change things in these files, make sure it is so general that libgphoto2 will want to merge it to their codebase too. You find libgphoto2 as part of gPhoto: http://gphoto.sourceforge.net/ * libnjb was a project that Richard and Linus were working on before libmtp. When Linus took Richards initial port and made an generic C API he re-used the philosophy and much code from libnjb. Many of the sample programs are for example taken quite literally from libnjb. You find it here: http://libnjb.sourceforge.net/ Contacting and Contributing --------------------------- See the project page at http://libmtp.sourceforge.net/ We always need your help. There is a mailinglist and a bug report system there. People who want to discuss MTP devices in fora seem to hang out on the forums at AnythingbutiPod: http://www.anythingbutipod.com/forum/ Compiling programs for libmtp ----------------------------- libmtp has support for the pkg-config script by adding a libmtp.pc entry in $(prefix)/lib/pkgconfig. To compile a libmtp program, "just" write: gcc -o foo `pkg-config --cflags --libs libmtp` foo.c This also simplifies compilation using autoconf and pkg-config: just write e.g. PKG_CHECK_MODULES(MTP, libmtp) AC_SUBST(MTP_CFLAGS) AC_SUBST(MTP_LIBS) To have libmtp LIBS and CFLAGS defined. Needless to say, this will only work if you have pkgconfig installed on your system, but most people have nowadays. If your library is installed in e.g. /usr/local you may have to tell this to pkgconfig by setting the PKG_CONFIG_PATH thus: export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig Documentation ------------- Read the API documentation that can be generated with doxygen. It will be output in doc/html if you have Doxygen properly installed. (It will not be created unless you have Doxygen!) For information about the Media Transfer Protocol, see: http://en.wikipedia.org/wiki/Media_Transfer_Protocol The official 1.0 specification for MTP was released by the USB Implementers Forum in may, 2008. Prior to this, only a proprietary Microsoft version was available, and quite a few devices out there still use some aspects of the Microsoft version, which deviates from the specified standard. You can find the official specification here: http://www.usb.org/developers/devclass_docs/MTP_1.0.zip The Examples ------------ In the subdirectory "examples" you find a number of command-line tools, illustrating the use of libmtp in very simple terms. Please do not complain about the usability or documentation of these examples, they look like they do for two reasons: 1. They are examples, not tools. If they were intended for day-to-day usage by commandline freaks, I would have called them "tools" not "examples". 2. The MTP usage paradigm is that a daemon should hook the device upon connection, and that it should be released by unplugging. GUI tools utilizing HAL (hald) and D-Bus do this much better than any commandline program ever can. (See below on bugs.) Specificationwise this is a bug, however it is present in many, many devices. That said, if you want to pick up and maintain the examples, please volunteer. FAQ: Common Problems -------------------- Some MTP devices have strange pecularities. We try to work around these whenever we can, sometimes we cannot work around it or we cannot test your solution. * Android locked screen: some devices just report zero files and no storages when the device screen is locked, it looks like so: mtp-detect Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP). Attempting to connect device(s) Error 1: Get Storage information failed. Device: SHV-E210K LIBMTP_Get_Storage(): No data available OK. This is probably so as not to allow the MTP access to be used as a "backdoor" into the device. Unlock the device before listing files, set the autolock to some large value or disabled if it disturbs you, you are causing this to yourself, or should we say that your vendor is prioritizing security and privacy over ease-of-use. (You may talk to your vendor about this.) * mtp-* tools doesn't work because someone else is already hogging the device This is a common problem, the most common case could be that gphoto2 (which can also talk PTP/MTP) is taking over the device as soon as it's plugged in. Some distributions are configured that way. Counter it like this: gvfs-mount -s gphoto2 Then re-attach the device. Sometimes some gvfs daemons are running on the system and hogging the device, try stopping them with something like these commands: killall gvfs-mtp-volume-monitor killall gvfs-gphoto2-volume-monitor Then plug in the device and issue "mtp-detect" to figure out if this may be the case. * Generic MTP/PTP disconnect misbehaviour: we have noticed that Windows Media Player apparently never close the session to an MTP device. There is a daemon in Windows that "hooks" the device by opening a PTP session to any MTP device, whenever it is plugged in. This daemon proxies any subsequent transactions to/from the device and will never close the session, thus Windows simply does not close sessions at all. For example this means that a device may work the first time you run some command-line example like "mtp-detect" while subsequent runs fail. Typical sign of this illness: broken pipes on closing sessions, on the main transfer pipes(s) or the interrupt pipe: Closing session usb_clear_halt() on INTERRUPT endpoint: Broken pipe OK. This means that device manufacturers doesn't notice any problems with devices that do not correctly handle closing PTP/MTP sessions, since Windows never do it. The proper way of closing a session in Windows is to unplug the device, simply put. Since libmtp actually tries to close sessions, some devices may fail since the close session functionality has never been properly tested, and "it works with Windows" is sort of the testing criteria at some companies. You can get Windows-like behaviour on Linux by running a udev-aware libmtp GUI client like Rhythmbox or Gnomad2, which will "hook" the device when you plug it in, and "release" it if you unplug it, and you start/end you transfer sessions by plugging/unplugging the USB cable. The "Unix way" of running small programs that open the device, do something, then close the device, isn't really working with such devices and you cannot expect to have command line tools like the mtp examples work with them. You could implement new example programs that just call to a mediating daemon like the Windows MTP stack does. (And change all programs using libmtp directly today.) If this bug in your device annoys you, contact your device manufacturer and ask them to test their product with some libmtp program. * Samsung Android 2.3.x devices: these have a special MTP stack with some specific bugs that we have maybe nailed down now. It suffers from an "immediate connect" syndrome, i.e. you have to connect to the device within 7 seconds of plugging in, or it will go numb. This also goes for command-line activity with the example programs, so this device is better used with a GUI tool like Rhythmbox, gnomad2... * Generic USB misbehaviour: some devices behave badly under MTP and USB mass storage alike, even down to the lowest layers of USB. You can always discuss such issues at the linux-usb mailing list if you're using Linux: http://www.linux-usb.org/mailing.html If you have a problem specific to USB mass storage mode, there is a list of strange behaving devices in the Linux kernel: http://lxr.linux.no/linux/drivers/usb/storage/unusual_devs.h You can discuss this too on the mentioned list, for understanding the quirks, see: http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt * Generic certificate misbehaviour. All devices are actually required to support a device certificate to be able to encrypt Windows Media (WMA/WMV) files. However there are obviously a lot of devices out there which doesn't support this at all but instead crash. Typical printout: Error 2: PTP Layer error 02ff: get_device_unicode_property(): failed to get unicode property. This should only affect "mtp-detect", there is no other application currently retrieveing the certificate (not that we know anyway). * Kernel bug on Linux. Linux 2.6.16 is generally speaking required to use any MTP device under USB 2.0. This is because the EHCI driver previously did not support zero-length writes to endpoints. It should work in most cases however, or if you connect it to an UHCI/OHCI port instead (yielding lower speed). But please just use a recent kernel. * Zen models AVI file seeking problem: the Zens cannot parse the files for the runlength metadata. Do not transfer file with e.g. mtp-sendfile, use mtp-sendtr and set the length of the track to the apropriate number of seconds and it will work. In graphical clients, use a "track transfer" function to send these AVI files, the Zens need the metadata associated with tracks to play back movies properly. Movies are considered "tracks" in the MTP world. * Some devices that disregard the metadata sent with the MTP commands will parse the files for e.g. ID3 metadata. Some still of these devices expect only ID3v2.3 metadata and will fail with a modern ID3v2,4 tag writer, like many of those found in Linux applications. Windows Media Player use ID3v2.3 only, so many manufacturers only test this version. * The Zen Vision:M (possibly more Creative Zens) has a firmware bug that makes it drop the last two characters off a playlist name. It is fixed in later firmware. * For Creative Technology devices, there are hard limits on how many files can be put onto the device. For a 30 GiB device (like the Zen Xtra) the limit is 6000, for a 60 GiB device the limit is 15000 files. For further Creative pecularities, see the FAQ sections at www.nomadness.net. * Sandisk sansa c150 and probably several other Sandisk devices (and possibly devices from other manufacturers) have a dual mode with MTP and USB mass storage. The device will initially claim to be mass storage so udev will capture is and make the use of MTP mode impossible. One way of avoiding it could be to be to blacklist the "usb-storage" module in /etc/modprobe.c/blacklist with a row like this: "blacklist usb-storage". Some have even removed the "usb-storage.ko" (kernel module file) to avoid loading. * Sandisk Sansa Fuze has three modes: auto, MTP or mass storage (MSC). Please set it to MTP to avoid problems with libmtp. * The iriver devices (possibly all of them) cannot handle the enhanced GetObjectPropList MTP command (0x9805) properly. So they have been banned from using it. * iriver devices have problems with older versions of libmtp and with new devices libmtp does not know of as of yet, since it has an oldstyle USB device controller that cannot handle zero writes. (Register your device with us!) All their devices are likely to need a special device flag in the src/libusb-glue.c database. * The Samsung Yepp T9 has several strange characteristics, some that we've managed to work around. (For example it will return multiple PTP packages in a single transaction.) * The early firmware for Philips HDD players is known to be problematic. Please upgrade to as new firmware as you can get. (Yes this requires some kind of Windows Installation I think.) * Philips HDD 1630/16 or 1630/17 etc may lock themselves up, turning inresponsive due to internal corruption. This typically gives an error in opening the PTP session. Apparently you can do a "repair" with the firmware utility (Windows only) which will often fix this problem and make the device responsive again. * Some devices that implement GetObjectPropList (0x9805) will not return the entire object list if you request a list for object 0xffffffffu. (But they should.) So they may need the special DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL. * Some (smaller) subset of devices cannot even get all the properties for a single object in one go, these need the DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST. Currently only the iriver devices seem to have this bug. * The Toshiba Gigabeat S (and probably its sibling the Microsoft Zune and other Toshiba devices) will only display album information tags for a song in case there is also an abstract album (created with the album interface) with the exact same name. * The Zen Vision:M has an older firmware which is very corrupt, it is incompatible with the Linux USB stack altogether. The kernel dmesg will look something like this, and you have to upgrade the firmware using Windows: usb 4-5: new high speed USB device using ehci_hcd and address 5 usb 4-5: configuration #1 chosen from 1 choice usb 4-5: can't set config #1, error -110 * The Sirus Stiletto does not seem to allow you to copy any files off the device. This may be someone's idea of copy protection. * The Samsung P2 assigns parent folder ID 0 to all unknown file types.(i.e. moves them to the root folder) * The Sandisk Sansa Clip+ needs a firmware upgrade in earlier versions in order to work properly. New Devices ----------- If you happen upon a device which libmtp claims it cannot autodetect, please submit the vendor ID and device ID (these can be obtained from the "lsusb" and "lsusb -n" commands run as root) as a bug, patch or feature request on the Sourceforge bug tracker at our homepage. If it gives a sensible output from "mtp-detect" then please attach the result as well as it teach us some stuff about your device. If you've done some additional hacking, join our mailinglist and post your experiences there. If you want to be able to hack some more and you're not afraid of C hacking, add an entry for your device's vendor/product ID and a descriptive string to the database in the file src/music-players.h. If you want to poke around to see if your device has some special pecularities, you can test some special device flags (defined in src/device-flags.h) by inserting them together with your device entry in src/music-players.h. Flags can be tested in isolation or catenated with "|" (binary OR). If relatives to your device use a certain flag, chances are high that a new device will need it too, typically from the same manufacturer. The most common flag that needs to be set is the DEVICE_FLAG_UNLOAD_DRIVER that detach any Linux kernel drivers that may have attached to the device making MTP access impossible. This is however not expected to really work: this is a problem being tracked as of now (2007-08-04). See the "last resort" solutions below if you really need to get your dual-mode device to work with MTP. Another flag which is easy to identify is the DEVICE_FLAG_NO_ZERO_READS, which remedies connection timeouts when getting files, and some timeouts on e.g. successive "mtp-connect" calls. If your device is very problematic we are curious of how it works under Windows, so we enjoy reading USB packet sniffs that reveal the low-level traffic carried out between Windows Media Player and your device. This can be done using e.g.: * USBsnoop: http://benoit.papillault.free.fr/usbsnoop/ * The trial version of HHD Softwares software-only USB monitor. You need to get a copy of version 2.37 since the newer trial versions won't let you carry out the needed packet sniffs. (As of 2007-03-10 a copy can be found at: http://www.cobbleware.com/files/usb-monitor-237.exe) There are other USB monitors as well, some more expensive alternatives use hardware and even measure electronic characteristics of the traffic (which is far too much detail for us). Device sniffs are an easy read since the PTP/MTP protocol is nicely structured. All commands will have a structure such as this in the log, we examplify with a object list request: PTP REQEUST: 000120: Bulk or Interrupt Transfer (UP), 03.09.2007 12:49:25.9843750 +0.0 Pipe Handle: 0x863ce234 (Endpoint Address: 0x2) Send 0x20 bytes to the device: 20 00 00 00 01 00 05 98 23 00 00 00 27 03 00 10 ......?#...'... Length TYPE CMD Trans# Param1 00 00 00 00 02 DC 00 00 00 00 00 00 00 00 00 00 .....Ü.......... Param2 Param3 Param4 Param5 [OPTIONAL] DATA PHASE: 000121: Bulk or Interrupt Transfer (UP), 03.09.2007 12:49:26.0 +0.0156250 Pipe Handle: 0x863ce214 (Endpoint Address: 0x81) Get 0x1a bytes from the device: 1A 00 00 00 02 00 05 98 23 00 00 00 01 00 00 00 .......?#....... Length TYPE CMD Trans# DATA 27 03 00 10 02 DC 04 00 00 30 '....Ü...0 RESPONSE: 000122: Bulk or Interrupt Transfer (UP), 03.09.2007 12:49:26.0 +0.0 Pipe Handle: 0x863ce214 (Endpoint Address: 0x81) Get 0xc bytes from the device: 0C 00 00 00 03 00 01 20 23 00 00 00 ....... #... Length TYPE CODE Trans# * One send (OUT to the device), two reads (IN from the device). * All three byte chunks commands are sent/recieved/recieeved by the function ptp_transaction() in the file ptp.c. * It boils down to ptp_usb_sendreq(), optionally ptp_usb_senddata() or ptp_usb_getdata() and finally ptp_usb_getresp() in the file libusb-glue.c. Notice ptp_usb_sendreq() and ptp_usb_getresp() are ALWAYS called. The TYPE field correspond to this, so the TYPES in this case are "COMMAND" (0x0001), "DATA" (0x0002), and "RESPONSE" (0x0003). * Notice that the byte order is little endian, so you need to read each field from right to left. * This COMMAND has: CMD 0x99805, we see in ptp.h that this is PTP_OC_MTP_GetObjPropList. Transaction# 0x00000023. REQUEST parameters 0x10000327, 0x00000000, 0x0000DC02, 0x00000000 0x00000000, in this case it means "get props for object 0x10000327", "any format", "property 0xDC02" (PTP_OPC_ObjectFormat), then two parameters that are always zero (no idea what they mean or their use). * The DATA has: CMD 0x99805, we see in ptp.h that this is PTP_OC_MTP_GetObjPropList. Transaction# 0x00000023. Then comes data 0x00000001, 0x10000327, 0xDC02, 0x0004, 0x3000 Which means in this case, (and this is the tricky part) "here you have 1 property", "for object 0x10000327", "it is property 0xDC02" (PTP_OPC_ObjectFormat), "which is of type 0x0004" (PTP_DTC_UINT16), "and set to 0x3000" (PTP_OFC_Undefined, it is perfectly valid to have undefined object formats, since it is a legal value defining this). * This RESPONSE has: CMD 0x99805, we see in ptp.h that this is PTP_OC_MTP_GetObjPropList. Return Code ("RC") = 0x2001, PTP_RC_OK, all went fine. Transaction# 0x00000023. If you want to compare the Windows behaviour with a similar operation using libmtp you can go into the src/libusb-glue.c file and uncomment the row that reads: //#define ENABLE_USB_BULK_DEBUG (I.e. remove the two //.) This will make libmtp print out a hex dump of every bulk USB transaction. The bulk transactions contain all the PTP/MTP layer data, which is usually where the problems appear. Notes to assist with debugging new devices: ------------------------------------------- In debugging new hardware, we highly recommend that you only use the example mtp-* applications that come with libmtp, as other applications may have their own bugs that may interfere with your new device working correctly. Using another application instead of those that come with libmtp just adds another point of failure. For debugging, there are 3 main options: 1. Use the env variable: LIBMTP_DEBUG to increase the verboseness of the debugging output for any application using libmtp. Relevant codes are: * 0x00 [0000 0000] : no debug (default) * 0x01 [0000 0001] : PTP debug * 0x02 [0000 0010] : Playlist debug * 0x04 [0000 0100] : USB debug * 0x08 [0000 1000] : USB data debug // Codes are hex and binary respectively. Simple add them togther // to get your desired level of output. (Assuming bash) eg: $ export LIBMTP_DEBUG=12 $ mtp-detect // To get USB debug and USB data debug information. $ export LIBMTP_DEBUG=2 $ mtp-detect // To get Playlist debug information. Also note, an application may also use the LIBMTP_debug() API function to achieve the same options as listed above. 2. Use "strace" on the various mtp-* commands to see where/what is falling over or getting stuck at. * On Solaris and FreeBSD, use "truss" or "dtrace" instead on "strace". * On Mac OS X, use "ktrace" or "dtrace" instead of "strace". * On OpenBSD and NetBSD, use "ktrace" instead of "strace". This will at least help pinpoint where the application is failing, or a device is reporting incorrect information. (This is extremely helpful with devices that have odd disconnection requirements). The use of these tools may also pinpoint issues with libusb as implemented by each OS vendor or issues with the MTP implementation on the new device as well, so please be prepared for either case. 3. Use "gdb" or similar debugger to step through the code as it is run. This is time consuming, and not needed just to pinpoint where the fault is. The use of gdb or another debugger may also miss or actually cause command and data timing issues with some devices, leading to false information. So please consider this a last resort option. Also please read the "It's Not Our Bug!" section below, as it does contain some useful information that may assist with your device. Dual-mode devices does not work - last resort: ---------------------------------------------- Some devices that are dual-mode are simply impossible to get to work under Linux because the usb-storage(.ko) kernel module hook them first, and refuse to release them, even when we specify the DEVICE_FLAG_UNLOAD_DRIVER flag. (Maybe it DOES release it but the device will immediately be probed at the USB mass storage interface AGAIN because it enumerates.) Here is what some people do: 1. Plug in the device. 2. USB-mass storage folder will open automatically. 3. Unmount the device. 4. Run mtp-detect. It will most likely fail the first time. 5. Run mtp-detect again, it might work this time, or fail. Keep running till it works. 99% it works by the third try. 6. Once mtp-detect gives you an "Ok", open either Rhythmbox or Gnomad2, everything should work. Linux: Try this, if you have a recent Linux kernel, add the file (as root): /etc/modprobe.d/no-usb-storage.conf With the contents: options usb-storage quirks=1234:4321:i This will tell usb-storage to ignore this device when it's inserted so it is not hogged by the mass storage interfaces. Remove and re-insert the device and see if it works. Usually this does the trick. For older systems, or as a bigger hammer, run (as root) something like: > rmmod usb_storage ; mtp-detect You can run most any command or a client like gnomad2 or Amarok immediately after the rmmod command. This works sometimes. Another even more brutal approach is this: * Edit /etc/modprobe.d/blacklist * Add the line "blacklist usb-storage" * Reboot. Now none of you USB disks, flash memory sticks etc will be working (you just disabled them all). However you *can* try your device, and it might have started working because there is no longer a USB mass storage driver that tries to hook onto the mass storage interface of your device. If not even blacklisting works (check with "lsmod | grep usb-storage"), there is some problem with something else and you may need to remove or rename the file /lib/modules//kernel/drivers/usb/storage/usb-storage.ko manually. If you find the PerfectSolution(TM) to this dilemma, so you can properly switch for individual devices whether to use it as USB mass storage or not, please tell us how you did it. We know we cannot use udev, because udev is called after-the-fact: the device is already configured for USB mass storage when udev is called. On Mac OS there is another ugly hack: 1. Open up a terminal window 2. Type: sudo mv /System/Library/Extensions/IOUSBMassStorageClass.kext /System/Library/Extensions/IOUSBMassStorageClass.kext.disabled and when prompted enter your password. 3. Restart. To reverse this change, just reverse the filenames: sudo mv /System/Library/Extensions/ IOUSBMassStorageClass.kext.disabled /System/Library/Extensions/ IOUSBMassStorageClass.kext and restart. Calendar and contact support: ----------------------------- The Creative Zen series can read VCALENDAR2 (.ics) files and VCard (.vcf) files from programs like for example Evolution with the following limitations/conditions: - The file must be in DOS (CR/LF) format, use the unix2dos program to convert if needed - Repeat events in calendar files do not seem to be supported, entries will only appear once. - Calendar (.ics) files should be stored in the folder "My Organizer" when sent to the device (this directory should be autodetected for use with calendar files, otherwise use the option -f "My Organizer" to sendfile for this) Apparently this file can also contain tasklists. - Contact (.vcf) files should be stored in the folder "My Contacts" when sent to the device. (-f "My Contacts") - Some devices are picky about the name of the calendar and contact files. For example the Zen Microphoto wants: Calendar: My Organizer/6651416.ics Contacts: My Organizer/6651416.vcf Syncing in with Evolution and Creative Devices ---------------------------------------------- Evolution can easily export .ics an .vcf files, but you currently need some command-line hacking to get you stuff copied over in one direction host -> device. The examples/ directory contains a script created for the Creative Zen Microphoto by Nicolas Tetreault. Lost symbols ------------ Shared libraries can be troublesome to users not experienced with them. The following is a condensed version of a generic question that has appeared on the libmtp mailing list from time to time. > PTP: Opening session > Queried Creative Zen Vision:M > gnomad2: relocation error: gnomad2: undefined symbol: > LIBMTP_Get_Storageinfo > (...) > Are these type of errors related to libmtp or something else? The problem is of a generic nature, and related to dynamic library loading. It is colloquially known as "dependency hell". (http://en.wikipedia.org/wiki/Dependency_hell) The gnomad2 application calls upon the dynamic linker in Linux to resolve the symbol "LIBMTP_Get_Storageinfo" or any other symbol (ELF symbol, or link point or whatever you want to call them, a symbol is a label on a memory address that the linker shall resolve from label to actual address.) For generic information on this subject see the INSTALL file and this Wikipedia page: http://en.wikipedia.org/wiki/Library_(computing) When Linux /lib/ld-linux.so.X is called to link the symbols compiled into gnomad2 (or any other executable using libmtp), it examines the ELF file for the libmtp.so.X file it finds first and cannot resolve the symbol "LIBMTP_Get_Storageinfo" (or whichever symbol you have a problem witj) from it, since it's probably not there. There are many possible causes of this symbol breakage: 1) You installed precompiled libmtp and gnomad2 packages (RPMs, debs whatever) that do not match up. Typical cause: your gnomad2 package was built against a newer version of libmtp than what's installed on your machine. Another typical cause: you installed a package you found on the web, somewhere, the dependency resolution system did not protest properly (as it should) or you forced it to install anyway, ignoring some warnings. 2) You compiled libmtp and/or gnomad2 from source, installing both or either in /usr/local/lib and /usr/local/bin. This means at compile-time gnomad2 finds the libmtp library in /usr/local/lib but at runtime, it depends on the Linux system wide library loader (/lib/ld-linux.so.X) in order to resolve the symbols. This loader will look into the file /etc/ld.so.conf and/or the folder /etc/ld.so.conf.d in order to find paths to libraries to be used for resolving the symbols. If you have some older version of libmtp in e.g. /usr/lib (typically installed by a package manager) it will take precedence over the new version you just installed in /usr/local/lib and the newly compiled library in /usr/local/lib will *not* be used, resulting in this error message. 3) You really did install the very latest versions (as of writing libmtp 0.1.5 and gnomad2 2.8.11) from source and there really is no pre-installed package of either on your machine. In that case I'm totally lost, I have no idea what's causing this. Typical remedies: 1) If you don't want to mess around with your system and risk these situations, only use pre-packaged software that came with the distribution or its official support channels. If it still breaks, blame your distribution, they're not packaging correctly. Relying on properly packaged software and not installing things yourself *is* the Linux solution to the "dependency hell" problem. 2) Read about dynamically linked library handling until the stuff I wrote about in the previous list sounds like music to your ears, inspect your /lib, /usr/lib, /usr/local/lib, /etc/ld.so.conf and the /etc/ld.so.conf.d, remove all pre-packed versions using RPM, APT, YaST or whatever your distribution uses, compile libmtp and gnomad2 (or whatever) from source only and you will be enlighted. I don't know if this helps you, it's the best answer we can give. API is obscure - I want plain files! ------------------------------------ PTP/MTP devices does not actually contain "files", they contain objects. These objects have file names, but that is actually just a name tag on the object. Folders/directories aren't really such entities: they are just objects too, albeit objects that can act as parent to other objects. They are called "associations" and are created in atomic fashion and even though there is an MTP command to get all the associations of a certain object, this command is optional so it is perfectly possible (and most common, actually) to create devices where the "folders" (which are actually associations) have no idea whatsoever of what files they are associated as parents to (i.e. which files they contain). This is very easy for device manufacturers to implement, all the association (i.e. finding out which files are in a certain folder) has to be done by the MTP Initiator / host computer. Moving a file to a new folder is for example very simple in a "real" file system. In PTP/MTP devices it is often not even possible, some devices *may* be able to do that, if they support command 0x1019 "Move Object", but actually the only reliable way of executing file movement is to upload the file to the host, download it with the new parent, then delete the old file. We have played with the idea of implementing this time consuming function as a fallback in case the device does not support command 0x1019, perhaps one day we will do that. (Some devices also support command 0x101a "Copy Object".) Then the issue that in PTP/MTP it is legal for two files to have exactly the same path as long as their object IDs differ. A folder/association can contain two files with the exact same name. (And on the Creative devices this even works, too, though most devices implicitly fail at this.) Perhaps one could add some custom hook for handling that, so they become /Foo.mp3 and /Foo.mp3(1) or something similar, but it's really a bit kludgy. Playlists and albums aren't really files, thinking about them as files like the hacks in libgphoto2 is really backwards. They are called associations and are more like a symbolic link that links in a star-shaped pattern to all the files that are part of the album/playlist. Some devices (Samsung) thought that was too complicated and have a different way of storing playlists in an UTF-16 encoded .spl-like file instead! This is why playlists/albums must have their own structs and functions. Plain file access also assumes to be able to write files of an undetermined size, which is simply not possible in a transactional file system like PTP/MTP. (See further below.) I Want Streaming! ----------------- Streaming reads is easy. Just connect the output file descriptor from LIBMTP_Get_File_To_File_Descriptor() (and a similar function for tracks) wherever you want. People have connected this to TCP sockets for streaming web servers etc, works like a charm. Some devices will even survive if the callback functions return non-zero and cancel the download. Some devices will lock up and even require a reset if you do that. Devices are poorly implemented so that's life. If you want to stream off a device, the best idea is always to stream the entire file and discard the stuff at the end you don't want. It will incur a delay if you e.g. want to skip between tracks, sadly. Then we get to the complicated things: streaming WRITES... There is a function: LIBMTP_Send_File_From_File_Descriptor() (and similar for tracks) which will write a file to a device from a file descriptor, which may be a socket or whatever. HOWEVER: this requires a piece of metadata with the .filesize properly set first. This is not because we think it is funny to require that, the protocol requires it. The reason is that PTP/MTP is a transactional file system and it wants to be able to deny file transfer if the file won't fit on the device, so the transaction never even starts, it's impossible to start a transaction without giving file length. People really want streaming so I tried a lot of hacks to see if they would work, such as setting file size to 0xffffffffU or something other unnaturally big and then aborting the file transfer when the stream ends. It doesn't work: either the device crashes or the file simply disappears since the device rolls back all failed transactions. So this is an inherent limitation of the PTP/MTP protocol. I want to remote control my device! ----------------------------------- I have both good and bad news for you. The good news is that the MTP protocol has well-defined commands to play back content on a device. Operation 0xD411 (PTP_DPC_MTP_PlaybackObject) will start playing back a file on the device (whatever that may mean if this is not a music or video file), and operation 0xD403 can set the playback volume to save your ears. Then there are operations to determine how far into the current file you currently are, so as to support say progress bars. Since these commands have been around since the dawn of the MTP protocol and since it was developed in cooperation with Creative Technology, this is probably a requested feature from the Creative people who already had support for playback on their devices using the PDE protocol back then. Anyway, here are the bad news: [logs]$ grep d411 * mtp-detect-trekstor-vibez.txt: 0xd411: Playback Object Aha there is only one known device in the world which actually supports playback on the device. So either you go buy the Trekstor Vibez, or you can forget about this. You could always try asking your hardware vendor of choice to go implement this. Since none of the core developers of libmtp has the Trekstor device, this is not yet implemented in libmtp. I make MTP devices! ------------------- If you are a device vendor there is a lot you can do for libmtp: * Please consider assigning one of your employees as a contact person for libmtp, have them sign up to the libmtp development list and answer questions and post new device ID:s as they are released to our mailing list. * If you want to help even more, assign someone to look deeper into error reports on your specific devices, understand why your firmware may require some special device flags and what can be done about it. * Do you have spare devices you can give us? Send them to Richard (Mac support) or Linus (Linux support). (So far nobody did that except for Microsoft who sent us a Zune by proxy!) Vendors do need help from libmtp too, especially we want to help vendors improve their MTP stacks, because they all suffer from the same problem: the lack of a proper conformance test has made many devices incompliant with the MTP specification as it is published today: most devices are just compliant with the Windows MTP stack, and don't work out-of-the-box with libmtp. We need someone on the inside to help in bug reporting vendors MTP stacks internally so these issues are raised. A good way to go toward better MTP compliance is to test with an alternative implementation of the stack. In e.g. IETF standardization it is compulsory for an RFC to have atleast two independent implementations for it to reach the status as standard. Being compliant with libmtp is also more and more important for vendors: libmtp is being deployed in some embedded systems like set-top-boxes etc. It will be very irritating for customers if a device will not dock properly with some home entertainment equipment just because it is based on Linux and libmtp and not the Windows MTP stack. Autodetect with gudev --------------------- Previously you would use HAL to detect devices being plugged in. Nowadays we use udev directly, or though the GNOME libgudev library. LIBMTPs default udev rules export the proper properties to detect any MTP device automatically, here is a verbose example derived from gnomad2: #define G_UDEV_API_IS_SUBJECT_TO_CHANGE #include const char * const gudev_subsystems[] = { "usb", NULL }; GUdevClient *gudev_client; guint uevent_id; guint uevent_bus_hooked = 0; guint uevent_device_hooked = 0; static void uevent_cb(GUdevClient *client, const char *action, GUdevDevice *device, void *data) { guint64 devicenum; guint vendor; guint model; guint busnum; guint devnum; guint mtpdevice; devicenum = (guint64) g_udev_device_get_device_number(device); g_print("%s event for %s (%"G_GINT64_MODIFIER"x)", action, g_udev_device_get_sysfs_path (device), devicenum); /* get device info */ vendor = get_property_as_int(device, "ID_VENDOR_ID", 16); model = get_property_as_int(device, "ID_MODEL_ID", 16); busnum = get_property_as_int(device, "BUSNUM", 10); devnum = get_property_as_int(device, "DEVNUM", 10); mtpdevice = get_property_as_int(device, "ID_MTP_DEVICE", 10); if (vendor == 0 || model == 0) { g_print("couldn't get vendor or model ID for device at (%x:%x)\n", busnum, devnum); return; } else { g_print("vendor = %x, model = %x, bus = %x, device = %x\n", vendor, model, busnum, devnum); } if (mtpdevice) { g_print("device is MTP compliant\n"); if (g_str_equal(action, "add") && uevent_bus_hooked == 0 && uevent_device_hooked == 0) { g_print(MTP device plugged in!\n"); uevent_bus_hooked = busnum; uevent_device_hooked = devnum; scan_jukebox(NULL); } else if (g_str_equal (action, "remove") && uevent_bus_hooked == busnum && uevent_device_hooked == devnum) { g_print("MTP device removed!\n"); uevent_bus_hooked = 0; uevent_device_hooked = 0; } } } (...) /* * Monitor udev device events - we're only really interested in events * for USB devices. */ gudev_client = g_udev_client_new(gudev_subsystems); uevent_id = g_signal_connect_object(gudev_client, "uevent", G_CALLBACK(uevent_cb), NULL, 0); SKETCH OF AN OVERVIEW --------------------- Draft agenda for a talk on MTP devices submitted for the Android builders summit, might come to recycle this: - Protocol overview - Transactional filesystem - no corruption due to unplugged cables! - The host and the device can access the files simultaneously, the device will always "own" the physical file system and proxy the host (MTP initiator). - libmtp interface - relation to libgphoto2 - User expectations fall short: - Not really a mountable filesystem. - Streaming does not work. (Size needs to be known beforehand due to transactional nature.) - GVFS MTP backend to the rescue. - Device sins - Using the same VID/PID for several modes, some of which are not MTP. HTC Zopo, HD2, Bird (0x0bb4/0x0c02). Thanks for that, now we cannot detect the protocol from just VID+PID but have to examine the interfaces. - Android bugs - Samsungs special Android MTP stack - SonyEricsson Aricent stack for Xperia Androids pre 4.0, broken headers! - Flat access model vs hierarchical, how Android uses MTP as an hierachical file system while it was previously a flat database. - Old paradigm: scan the entire non-hierarchical storage for all content, build a cache to speed up the (USB 1.1!) link. Usually all files were stored in the root folder or a single folder named "/Music" or similar. - Android introduced deeply nested folder hierarchies, not seen before on MTP devices. - Microsoft not using the complete metadata dump feature of the MTP protocol (once introduced by creative) instead they walk directories separately. - So caching a big device will take long time and/or timeout. - Go-MTPFS (FUSE) and GVFS MTP - doing the partial directory walk rather than caching all files. - Especially Android devices nowadays assume that you want to index a folder at the time, whereas older MTP devices (such as those from Creative) would assume that you wanted to index the entire device as it was plugged in, and device firmware is now ever more tailored toward per-folder filetree walking. This makes it harder for the library to provide the right abstractions: do we provide an API for indexing the whole device which is unacceptably slow on new devices, or do we provide an API for indexing a directory at the time which will somehow work on older devices too? Shall we deprecate the older API? - Detecting from vendor extension, can fix in newer extensions! - Autoprobing on Linux - Color devices do not like autoprobing - Devices need different PIDs for every alternative interface due to the Windows USB stack. - Multimode USB - one PID for each mode due to Windows limitations not applicable to Linux, SONY devices have ~5 different PIDs for a single device. - Mode switch devices? Maybe we do this wrong. - MTPZ, came and went. Apparently deprecated by Microsoft with Windows Phone 8. - Ideas?? libmtp-1.1.10/Makefile.in0000644000175000001440000007537512604225567012075 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/byteorder.m4 \ $(top_srcdir)/m4/iconv.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)/m4/stdint.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 = libmtp.sh hotplug.sh libmtp.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)$(hwdbdir)" "$(DESTDIR)$(pkgconfigdir)" \ "$(DESTDIR)$(udevrulesdir)" DATA = $(hwdb_DATA) $(noinst_DATA) $(pkgconfig_DATA) $(udevrules_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/hotplug.sh.in $(srcdir)/libmtp.pc.in \ $(srcdir)/libmtp.sh.in AUTHORS COPYING ChangeLog INSTALL \ README TODO compile config.guess config.rpath config.sub \ depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBUSB_REQUIRES = @LIBUSB_REQUIRES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ 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@ OSFLAGS = @OSFLAGS@ 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@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UDEV = @UDEV@ UDEV_GROUP = @UDEV_GROUP@ UDEV_MODE = @UDEV_MODE@ UDEV_RULES = @UDEV_RULES@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ effective_target = @effective_target@ 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@ ms_lib_exe = @ms_lib_exe@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src examples util doc ACLOCAL_AMFLAGS = -I m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libmtp.pc EXTRA_DIST = libmtp.pc libmtp.sh COPYING README.windows.txt # This stuff only makes sense on Linux so only # build and ship it on Linux. @USE_LINUX_TRUE@udevrulesdir = @UDEV@/rules.d @USE_LINUX_TRUE@hwdbdir = @UDEV@/hwdb.d @USE_LINUX_TRUE@udevrules_DATA = @UDEV_RULES@ @USE_LINUX_TRUE@hwdb_DATA = 69-libmtp.hwdb @USE_LINUX_TRUE@noinst_DATA = libmtp.usermap libmtp.fdi @USE_LINUX_TRUE@CLEANFILES = libmtp.usermap @UDEV_RULES@ libmtp.fdi libmtp.hwdb 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 libmtp.sh: $(top_builddir)/config.status $(srcdir)/libmtp.sh.in cd $(top_builddir) && $(SHELL) ./config.status $@ hotplug.sh: $(top_builddir)/config.status $(srcdir)/hotplug.sh.in cd $(top_builddir) && $(SHELL) ./config.status $@ libmtp.pc: $(top_builddir)/config.status $(srcdir)/libmtp.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-hwdbDATA: $(hwdb_DATA) @$(NORMAL_INSTALL) @list='$(hwdb_DATA)'; test -n "$(hwdbdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(hwdbdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(hwdbdir)" || 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)$(hwdbdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(hwdbdir)" || exit $$?; \ done uninstall-hwdbDATA: @$(NORMAL_UNINSTALL) @list='$(hwdb_DATA)'; test -n "$(hwdbdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(hwdbdir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) install-udevrulesDATA: $(udevrules_DATA) @$(NORMAL_INSTALL) @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(udevrulesdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(udevrulesdir)" || 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)$(udevrulesdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(udevrulesdir)" || exit $$?; \ done uninstall-udevrulesDATA: @$(NORMAL_UNINSTALL) @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(udevrulesdir)'; $(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)$(hwdbdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(udevrulesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 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-hwdbDATA install-pkgconfigDATA \ install-udevrulesDATA 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-hwdbDATA uninstall-pkgconfigDATA \ uninstall-udevrulesDATA .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-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-hwdbDATA install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkgconfigDATA install-ps install-ps-am install-strip \ install-udevrulesDATA 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-hwdbDATA uninstall-pkgconfigDATA \ uninstall-udevrulesDATA .PRECIOUS: Makefile @USE_LINUX_TRUE@libmtp.usermap: util/mtp-hotplug @USE_LINUX_TRUE@ util/mtp-hotplug > libmtp.usermap @USE_LINUX_TRUE@@UDEV_RULES@: util/mtp-hotplug @USE_LINUX_TRUE@ util/mtp-hotplug -u -p"@UDEV@" @UDEV_GROUP@ @UDEV_MODE@ > @UDEV_RULES@ @USE_LINUX_TRUE@libmtp.fdi: util/mtp-hotplug @USE_LINUX_TRUE@ util/mtp-hotplug -H > libmtp.fdi @USE_LINUX_TRUE@$(hwdb_DATA): util/mtp-hotplug @USE_LINUX_TRUE@ util/mtp-hotplug -w > $(hwdb_DATA) # 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: libmtp-1.1.10/config.h.in0000644000175000001440000001306712604225577012042 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `basename' function. */ #undef HAVE_BASENAME /* Define to 1 if you have the header file. */ #undef HAVE_BYTESWAP_H /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_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_GETOPT_H /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* 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 `gcrypt' library (-lgcrypt). */ #undef HAVE_LIBGCRYPT /* Define to 1 if you have the header file. */ #undef HAVE_LIBGEN_H /* Have libusb 0.x */ #undef HAVE_LIBUSB0 /* Have libusb 1.0 */ #undef HAVE_LIBUSB1 /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_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 `mkstemp' function. */ #undef HAVE_MKSTEMP /* Have libopenusb 1.0 */ #undef HAVE_OPENUSB /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* 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 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 `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ #undef HAVE_ST_BLKSIZE /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_UIO_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* 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 as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Enable MTPZ functionality */ #undef USE_MTPZ /* 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 /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `long int' if does not define. */ #undef off_t /* Define to `unsigned int' if does not define. */ #undef size_t libmtp-1.1.10/README.windows.txt0000644000175000001440000000547612121274441013177 00000000000000This file was created by James Ravenscroft as a direct revision of Farooq Zaman's work with LibMTP on Windows. CHANGELOG ---------------- 14th January 2009: Created the first revision of this file taking information from the work of Farooq Zaman. 1.0 Compilation of LibMTP on Windows 2000/XP/NT ----------------------------------------------------------- LibMTP currently compiles under Windows using MingW/MSys. The source relies upon the __WIN32__ macro which is defined by MinGW by default. Libraries: LibMTP currently depends on LibUSB and libiconv. There are currently projects that port both of these libraries to Windows. Binary files can be obtained from: LibUSB Win32 - http://libusb-win32.sourceforge.net/ LibIconv - http://gnuwin32.sourceforge.net/packages/libiconv.htm With both of these libraries extracted and placed in MinGW's search path, you can compile the library by opening the Msys prompt, navigating to the path where the extracted LibMTP source files can be found and typing: ./configure make all make install 2.0 LibUSB and Driver Issues for Windows ---------------------------------------------- Unfortunately, Windows does not have abstract USB support and depends upon specific drivers for each and every device you use. Fortunately, LibUSB-Win32 provide a solution to this problem. LibMTP takes advantage of the LibUSB-Win32 Device Driver package. 1. Download the latest device driver binary package (libusb-win32-device-bin-x.x.x.x.tar.gz) from http://sourceforge.net/project/showfiles.php?group_id=78138 2. Upon extraction, plug in your music device and run bin/inf-wizard.exe. Selecting your device and saving the inf file in the project root directory. 3. Copy the files "bin/libusb0.dll" and "libusb0.sys" or "libusb0_x64.dll" and "libusb0_x64.sys" for 32-bit or 64-bit operating systems respectively. 4. Goto Start -> Run, type "devmgmt.msc" and press "ok". 5. Select your music device from the list and click Action -> Update Driver, Choose "No, not this time" if prompted to connect to microsoft. 6. Choose "Install from a list or specific location". 7. Choose "Don't search, I will choose the driver to install 8. Click the "Have Disk..." button in the bottom right corner of the prompt 9. Browse to your .inf file and select it. Press Ok 10. The name of your music device should appear in the prompt, click it and click "Next>" (Ignore any prompts about Driver Signing, continuing installation of the selected driver). 11. Click finish to end the driver install process. To get your old driver back: 1. Goto Start -> Run, type "devmgmt.msc" and press "ok". 2. Select your music device, right click on it and click "Properties" 3. Go to the "Driver" pane and select "Roll Back Driver". 3.0 ---------------------------------------------- libmtp-1.1.10/Makefile.am0000644000175000001440000000141212503577736012047 00000000000000SUBDIRS=src examples util doc ACLOCAL_AMFLAGS=-I m4 pkgconfigdir=$(libdir)/pkgconfig pkgconfig_DATA=libmtp.pc EXTRA_DIST=libmtp.pc libmtp.sh COPYING README.windows.txt # This stuff only makes sense on Linux so only # build and ship it on Linux. if USE_LINUX udevrulesdir=@UDEV@/rules.d hwdbdir=@UDEV@/hwdb.d udevrules_DATA=@UDEV_RULES@ hwdb_DATA=69-libmtp.hwdb noinst_DATA=libmtp.usermap libmtp.fdi libmtp.usermap: util/mtp-hotplug util/mtp-hotplug > libmtp.usermap @UDEV_RULES@: util/mtp-hotplug util/mtp-hotplug -u -p"@UDEV@" @UDEV_GROUP@ @UDEV_MODE@ > @UDEV_RULES@ libmtp.fdi: util/mtp-hotplug util/mtp-hotplug -H > libmtp.fdi $(hwdb_DATA): util/mtp-hotplug util/mtp-hotplug -w > $(hwdb_DATA) CLEANFILES = libmtp.usermap @UDEV_RULES@ libmtp.fdi libmtp.hwdb endif libmtp-1.1.10/depcomp0000755000175000001440000005601612601454752011371 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libmtp-1.1.10/libmtp.pc0000644000175000001440000000052012604225576011617 00000000000000# libmtp pkg-config source file prefix=/usr exec_prefix=${prefix} libdir=/usr/lib64 includedir=${prefix}/include Name: libmtp Description: libmtp is a library for accessing Media Transfer Protocol devices Version: 1.1.10 Requires.private: libusb-1.0 Conflicts: Libs: -L${libdir} -lmtp Libs.private: -lgcrypt Cflags: -I${includedir} libmtp-1.1.10/hotplug.sh.in0000755000175000001440000001167712121274441012436 00000000000000#!/bin/bash INSTALL="@INSTALL@" HOTPLUGPATH=/etc/hotplug SCRIPTNAME=libmtp.sh USERMAP=libmtp.usermap UDEVPATH=/etc/udev/rules.d UDEVRULES=libmtp.rules HALBASEPATH=/usr/share/hal/fdi/information HALPATH=/usr/share/hal/fdi/information/20thirdparty HALRULES=libmtp.fdi # See if the parameter script ($2), device ($3) and productid ($4) # are already defined in the usermap ($1) function inmap { while read LINE; do if [ "x${LINE}" != "x" ]; then firstword=`echo ${LINE} | awk '{ print $1 }'` if [ ${firstword} != "#" ]; then # This is a device line entry script=${firstword} manid=`echo ${LINE} | awk '{ print $3 }'` productid=`echo ${LINE} | awk '{ print $4 }'` # Skip blank products... if [ "x${script}" = "x$2" ]; then if [ "x${manid}" = "x$3" ]; then if [ "x${productid}" = "x$4" ]; then echo "yes" return 0 fi fi fi fi fi done < $1 echo "no" return 0 } # Scan the usermap $2 for all devices in $1 to see if they are already # there, else patch the usermap. function patchusermap { # Nullify comment comment="" while read LINE; do if [ "x$LINE" != "x" ]; then firstword=`echo ${LINE} | awk '{ print $1 }'` if [ ${firstword} = "#" ]; then # This is a comment line, save it. comment=${LINE} else # This is a device line entry script=${firstword} manid=`echo ${LINE} | awk '{ print $3 }'` productid=`echo ${LINE} | awk '{ print $4 }'` # Skip blank products... if [ "x${manid}" != "x" ]; then # See if this product is already in the usermap echo "Checking for product ${productid} in $2..." if [ `inmap $2 ${script} ${manid} ${productid}` = "no" ]; then echo "Not present, adding to hotplug map." echo ${comment} >> $2 echo ${LINE} >> $2 comment="" else echo "Already installed." fi fi fi fi done < $1 } # Check for udev first if test -d ${UDEVPATH} ; then echo "You seem to have udev on your system. Installing udev rules..." ${INSTALL} ${UDEVRULES} ${UDEVPATH} echo "You may need additional setup to get correct permissions on your device." echo "See the INSTALL file for information." echo "Do you also want to install HAL support or the old hotplug support (y/n)?" read IN if [ "$IN" = "y" ] || [ "$IN" = "Y" ]; then echo "Continuing..." else exit 0 fi fi # Check for HAL next if test -d ${HALBASEPATH} ; then echo "You seem to have HAL on your system. Installing HAL rules..." mkdir -p ${HALPATH} ${INSTALL} ${HALRULES} ${HALPATH} echo "Do you also want to install the old hotplug support (y/n)?" read IN if [ "$IN" = "y" ] || [ "$IN" = "Y" ]; then echo "Continuing..." else exit 0 fi fi # Check prerequisites COMMAND=`which grep 2> /dev/null` if [ "x${COMMAND}" = "x" ]; then echo "Missing grep program. Fatal error." exit 1 fi COMMAND=`which awk 2> /dev/null` if [ "x${COMMAND}" = "x" ]; then echo "Missing awk program. Fatal error." exit 1 fi if [ "x${USER}" != "xroot" ]; then echo "WARNING: this program should be run as root!" fi # This script locates the hotplug distribution on a certain host # and sets up userland hotplugging scripts according to rules. # The in-parameters are the hotplug directory and the name of a # file of hotplug device entries and a script to be executed for # these deviced. if test -d ${HOTPLUGPATH} then echo "Hotplug in ${HOTPLUGPATH}" else echo "Hotplug missing on this system. Cannot install." exit 1 fi if test -d ${HOTPLUGPATH}/usb then echo "Has usb subdirectory." else mkdir ${HOTPLUGPATH}/usb fi echo "Installing script." ${INSTALL} libmtp.sh ${HOTPLUGPATH}/usb echo "Installing usermap." ${INSTALL} -m 644 ${USERMAP} ${HOTPLUGPATH}/usb # If we find a usb.usermap file, and we see that this distribution # of hotplug does not support private usermaps, then we need to # patch the usb.usermap file. # # Create a merged file, diff the files to each other, and if there # were mismatches, then patch the installed file. echo "Checking hotplugging CVS version..." echo "/etc/hotplug/usb/*.usermap support was added in august 2002" EDITMAP="yes" CVSTAG=`grep '\$Id:' /etc/hotplug/usb.agent` if [ "x${CVSTAG}" != "x" ]; then DATE=`echo ${CVSTAG} | awk '{ print $5 }'` echo "Hotplug version seems to be from ${DATE}" YEAR=`echo ${DATE} | awk 'BEGIN { FS="/"} {print $1; }'` MONTH=`echo ${DATE} | awk 'BEGIN { FS="/"} {print $2; }'` DAY=`echo ${DATE} | awk 'BEGIN { FS="/"} {print $3; }'` if [ "${YEAR}" -gt "2002" ]; then EDITMAP="no" else if [ "${YEAR}" -eq "2002" ]; then if [ "${MONTH}" -ge "08" ]; then EDITMAP="no" fi fi fi fi if [ "x${EDITMAP}" == "xyes" ]; then echo "We need to edit the ${HOTPLUGPATH}/usb.usermap if it exists..." if test -f ${HOTPLUGPATH}/usb.usermap then echo "We have a usb.usermap..." patchusermap ${USERMAP} /etc/hotplug/usb.usermap fi fi echo "Hotplugging successfully installed." exit 0 libmtp-1.1.10/m4/0000755000175000001440000000000012604234355010402 500000000000000libmtp-1.1.10/m4/byteorder.m40000644000175000001440000003007512121274441012562 00000000000000dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE ) dnl Copyright 2001-2002 by Dan Fandrich dnl This file may be copied and used freely without restrictions. No warranty dnl is expressed or implied. dnl dnl Create a header file that guarantees that byte swapping macros of the dnl ntohl variety as well as the extended types included in OpenBSD and dnl NetBSD such as le32toh are defined. If possible, the standard ntohl dnl are overloaded as they are optimized for the given platform, but when dnl this is not possible (e.g. on a big-endian machine) they are defined dnl in this file. dnl Look for a symbol in a header file dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) AC_DEFUN([AC_HAVE_SYMBOL], [ AC_MSG_CHECKING(for $1 in $2) AC_EGREP_CPP([symbol is present|\<$1\>],[ #include <$2> #ifdef $1 symbol is present #endif ], [AC_MSG_RESULT(yes) $3 ], [AC_MSG_RESULT(no) $4 ])]) dnl Create a header file that defines extended byte swapping macros AC_DEFUN([AC_NEED_BYTEORDER_H], [ ac_dir=`AS_DIRNAME(["$1"])` if test "$ac_dir" != "$1" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && (AS_MKDIR_P(["$ac_dir"])) fi # We're only interested in the target CPU, but it's not always set effective_target="$target" if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then effective_target="$host" fi AC_SUBST(effective_target) cat > "$1" << EOF /* This file is generated automatically by configure */ /* It is valid only for the system type ${effective_target} */ #ifndef __BYTEORDER_H #define __BYTEORDER_H EOF dnl First, do an endian check AC_C_BIGENDIAN dnl Look for NetBSD-style extended byte swapping macros AC_HAVE_SYMBOL(le32toh,machine/endian.h, [HAVE_LE32TOH=1 cat >> "$1" << EOF /* extended byte swapping macros are already available */ #include EOF], [ dnl Look for standard byte swapping macros AC_HAVE_SYMBOL(ntohl,arpa/inet.h, [cat >> "$1" << EOF /* ntohl and relatives live here */ #include EOF], [AC_HAVE_SYMBOL(ntohl,netinet/in.h, [cat >> "$1" << EOF /* ntohl and relatives live here */ #include EOF],true)]) ]) dnl Look for generic byte swapping macros dnl OpenBSD AC_HAVE_SYMBOL(swap32,machine/endian.h, [cat >> "$1" << EOF /* swap32 and swap16 are defined in machine/endian.h */ EOF], [ dnl Linux GLIBC AC_HAVE_SYMBOL(bswap_32,byteswap.h, [cat >> "$1" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) bswap_16(x) #define swap32(x) bswap_32(x) #define swap64(x) bswap_64(x) EOF], [ dnl NetBSD AC_HAVE_SYMBOL(bswap32,machine/endian.h, dnl We're already including machine/endian.h if this test succeeds [cat >> "$1" << EOF /* Define generic byte swapping functions */ EOF if test "$HAVE_LE32TOH" != "1"; then echo '#include '>> "$1" fi cat >> "$1" << EOF #define swap16(x) bswap16(x) #define swap32(x) bswap32(x) #define swap64(x) bswap64(x) EOF], [ dnl FreeBSD AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h, [cat >> "$1" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) __byte_swap_word(x) #define swap32(x) __byte_swap_long(x) /* No optimized 64 bit byte swapping macro is available */ #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF], [ dnl OS X AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h, [cat >> "$1" << EOF /* Define generic byte swapping functions */ #include #define swap16(x) NXSwapShort(x) #define swap32(x) NXSwapLong(x) #define swap64(x) NXSwapLongLong(x) EOF], [ if test $ac_cv_c_bigendian = yes; then cat >> "$1" << EOF /* No other byte swapping functions are available on this big-endian system */ #define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8))) #define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\ ((uint32_t)(x) << 8) & 0x00ff0000UL | \\ ((x) >> 8) & 0x0000ff00UL | \\ ((x) >> 24) & 0x000000ffUL)) #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF else cat >> "$1" << EOF /* Use these as generic byteswapping macros on this little endian system */ #define swap16(x) ntohs(x) #define swap32(x) ntohl(x) /* No optimized 64 bit byte swapping macro is available */ #define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ ((x) >> 8) & 0x00000000ff000000ULL | \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> 56) & 0x00000000000000ffULL)) EOF fi ]) ]) ]) ]) ]) [ if test "$HAVE_LE32TOH" != "1"; then cat >> "$1" << EOF /* The byte swapping macros have the form: */ /* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */ /* le (little-endian), NN is 16 or 32 (number of bits) and a, */ /* if present, indicates that the endian side is a pointer to an */ /* array of uint8_t bytes instead of an integer of the specified length. */ /* h refers to the host's ordering method. */ /* So, to convert a 32-bit integer stored in a buffer in little-endian */ /* format into a uint32_t usable on this machine, you could use: */ /* uint32_t value = le32atoh(&buf[3]); */ /* To put that value back into the buffer, you could use: */ /* htole32a(&buf[3], value); */ /* Define aliases for the standard byte swapping macros */ /* Arguments to these macros must be properly aligned on natural word */ /* boundaries in order to work properly on all architectures */ #ifndef htobe16 # define htobe16(x) htons(x) #endif #ifndef htobe32 # define htobe32(x) htonl(x) #endif #ifndef be16toh # define be16toh(x) ntohs(x) #endif #ifndef be32toh # define be32toh(x) ntohl(x) #endif #define HTOBE16(x) (x) = htobe16(x) #define HTOBE32(x) (x) = htobe32(x) #define BE32TOH(x) (x) = be32toh(x) #define BE16TOH(x) (x) = be16toh(x) EOF if test $ac_cv_c_bigendian = yes; then cat >> "$1" << EOF /* Define our own extended byte swapping macros for big-endian machines */ #ifndef htole16 # define htole16(x) swap16(x) #endif #ifndef htole32 # define htole32(x) swap32(x) #endif #ifndef le16toh # define le16toh(x) swap16(x) #endif #ifndef le32toh # define le32toh(x) swap32(x) #endif #ifndef le64toh # define le64toh(x) swap64(x) #endif #ifndef htobe64 # define htobe64(x) (x) #endif #ifndef be64toh # define be64toh(x) (x) #endif #define HTOLE16(x) (x) = htole16(x) #define HTOLE32(x) (x) = htole32(x) #define LE16TOH(x) (x) = le16toh(x) #define LE32TOH(x) (x) = le32toh(x) #define LE64TOH(x) (x) = le64toh(x) #define HTOBE64(x) (void) (x) #define BE64TOH(x) (void) (x) EOF else cat >> "$1" << EOF /* On little endian machines, these macros are null */ #ifndef htole16 # define htole16(x) (x) #endif #ifndef htole32 # define htole32(x) (x) #endif #ifndef htole64 # define htole64(x) (x) #endif #ifndef le16toh # define le16toh(x) (x) #endif #ifndef le32toh # define le32toh(x) (x) #endif #ifndef le64toh # define le64toh(x) (x) #endif #define HTOLE16(x) (void) (x) #define HTOLE32(x) (void) (x) #define HTOLE64(x) (void) (x) #define LE16TOH(x) (void) (x) #define LE32TOH(x) (void) (x) #define LE64TOH(x) (void) (x) /* These don't have standard aliases */ #ifndef htobe64 # define htobe64(x) swap64(x) #endif #ifndef be64toh # define be64toh(x) swap64(x) #endif #define HTOBE64(x) (x) = htobe64(x) #define BE64TOH(x) (x) = be64toh(x) EOF fi fi cat >> "$1" << EOF /* Define the C99 standard length-specific integer types */ #include <_stdint.h> EOF case "${effective_target}" in i[3456]86-*) cat >> "$1" << EOF /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* The i386 and compatibles can handle unaligned memory access, */ /* so use the optimized macros above to do this job */ #ifndef be16atoh # define be16atoh(x) be16toh(*(uint16_t*)(x)) #endif #ifndef be32atoh # define be32atoh(x) be32toh(*(uint32_t*)(x)) #endif #ifndef be64atoh # define be64atoh(x) be64toh(*(uint64_t*)(x)) #endif #ifndef le16atoh # define le16atoh(x) le16toh(*(uint16_t*)(x)) #endif #ifndef le32atoh # define le32atoh(x) le32toh(*(uint32_t*)(x)) #endif #ifndef le64atoh # define le64atoh(x) le64toh(*(uint64_t*)(x)) #endif #ifndef htob16a # define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x) #endif #ifndef htobe32a # define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x) #endif #ifndef htobe64a # define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x) #endif #ifndef htole16a # define htole16a(a,x) *(uint16_t*)(a) = htole16(x) #endif #ifndef htole32a # define htole32a(a,x) *(uint32_t*)(a) = htole32(x) #endif #ifndef htole64a # define htole64a(a,x) *(uint64_t*)(a) = htole64(x) #endif EOF ;; *) cat >> "$1" << EOF /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* Non-optimized but portable macros */ #define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1])) #define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) #define be64atoh_x(x,off,shift) (((uint64_t)((x)[off]))<>8), (a)[1]=(uint8_t)(x) #define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\ (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) #define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\ (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\ (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\ (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) #define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\ (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\ (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) EOF ;; esac ] cat >> "$1" << EOF #endif /*__BYTEORDER_H*/ EOF]) libmtp-1.1.10/m4/ltoptions.m40000644000175000001440000003426212601454745012632 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])]) libmtp-1.1.10/m4/ltversion.m40000644000175000001440000000127312601454745012620 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) ]) libmtp-1.1.10/m4/stdint.m40000644000175000001440000005700612121274441012073 00000000000000dnl AC_NEED_STDINT_H ( HEADER-TO-GENERATE ) dnl Copyright 2001-2002 by Dan Fandrich dnl This file may be copied and used freely without restrictions. No warranty dnl is expressed or implied. dnl dnl Look for a header file that defines size-specific integer types like the dnl ones recommended to be in stdint.h in the C99 standard (e.g. uint32_t). dnl This is a dumbed-down version of the macro of the same name in the file dnl ac_need_stdint_h.m4 which is part of the ac-archive, available at dnl (also, another macro dnl AC_CREATE_STDINT_H by the same author). This version is not as smart, dnl but works on older autoconf versions and has a different license. dnl AX_CHECK_DEFINED_TYPE ( TYPE, FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) dnl This is similar to _AC_CHECK_TYPE_NEW (a.k.a. new syntax version of dnl AC_CHECK_TYPE) in autoconf 2.50 but works on older versions AC_DEFUN([AX_CHECK_DEFINED_TYPE], [AC_MSG_CHECKING([for $1 in $2]) AC_EGREP_CPP(changequote(<<,>>)dnl <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl changequote([,]), [#include <$2>], ac_cv_type_$1=yes, ac_cv_type_$1=no)dnl AC_MSG_RESULT($ac_cv_type_$1) if test $ac_cv_type_$1 = yes; then $3 else $4 fi ]) dnl Look for a header file that defines size-specific integer types AC_DEFUN([AX_NEED_STDINT_H], [ ac_dir=`AS_DIRNAME(["$1"])` if test "$ac_dir" != "$1" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && (AS_MKDIR_P(["$ac_dir"])) fi AX_CHECK_DEFINED_TYPE(uint8_t, stdint.h, [ cat > "$1" < EOF], [AX_CHECK_DEFINED_TYPE(uint8_t, inttypes.h, [cat > "$1" < EOF], [AX_CHECK_DEFINED_TYPE(uint8_t, sys/types.h, [cat > "$1" < EOF], [AX_CHECK_DEFINED_TYPE(u_int8_t, sys/types.h, [cat > "$1" < typedef u_int8_t uint8_t; typedef u_int16_t uint16_t; typedef u_int32_t uint32_t; EOF AX_CHECK_DEFINED_TYPE(u_int64_t, sys/types.h, [cat >> "$1" <> "$1" <]) AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) m4_ifvaln([$1],[$1]) break done AC_MSG_CHECKING([for stdint uintptr_t]) ]) ]) AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[ AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[ ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h) AC_MSG_RESULT([(..)]) for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h stdint.h]) ; do unset ac_cv_type_uint32_t unset ac_cv_type_uint64_t AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>]) AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) m4_ifvaln([$1],[$1]) break break; done AC_MSG_CHECKING([for stdint uint32_t]) ]) ]) AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[ AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[ ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h) AC_MSG_RESULT([(..)]) for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do unset ac_cv_type_u_int32_t unset ac_cv_type_u_int64_t AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>]) AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>]) m4_ifvaln([$1],[$1]) break break; done AC_MSG_CHECKING([for stdint u_int32_t]) ]) ]) AC_DEFUN([AX_CREATE_STDINT_H], [# ------ AX CREATE STDINT H ------------------------------------- AC_MSG_CHECKING([for stdint types]) ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` # try to shortcircuit - if the default include path of the compiler # can find a "stdint.h" header then we assume that all compilers can. AC_CACHE_VAL([ac_cv_header_stdint_t],[ old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS="" old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="" old_CFLAGS="$CFLAGS" ; CFLAGS="" AC_TRY_COMPILE([#include ],[int_least32_t v = 0;], [ac_cv_stdint_result="(assuming C99 compatible system)" ac_cv_header_stdint_t="stdint.h"; ], [ac_cv_header_stdint_t=""]) CXXFLAGS="$old_CXXFLAGS" CPPFLAGS="$old_CPPFLAGS" CFLAGS="$old_CFLAGS" ]) v="... $ac_cv_header_stdint_h" if test "$ac_stdint_h" = "stdint.h" ; then AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)]) elif test "$ac_stdint_h" = "inttypes.h" ; then AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)]) elif test "_$ac_cv_header_stdint_t" = "_" ; then AC_MSG_RESULT([(putting them into $ac_stdint_h)$v]) else ac_cv_header_stdint="$ac_cv_header_stdint_t" AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)]) fi if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit.. dnl .....intro message done, now do a few system checks..... dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type, dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW dnl instead that is triggered with 3 or more arguments (see types.m4) inttype_headers=`echo $2 | sed -e 's/,/ /g'` ac_cv_stdint_result="(no helpful system typedefs seen)" AX_CHECK_HEADER_STDINT_X(dnl stdint.h inttypes.h sys/inttypes.h $inttype_headers, ac_cv_stdint_result="(seen uintptr_t$and64 in $i)") if test "_$ac_cv_header_stdint_x" = "_" ; then AX_CHECK_HEADER_STDINT_O(dnl, inttypes.h sys/inttypes.h stdint.h $inttype_headers, ac_cv_stdint_result="(seen uint32_t$and64 in $i)") fi if test "_$ac_cv_header_stdint_x" = "_" ; then if test "_$ac_cv_header_stdint_o" = "_" ; then AX_CHECK_HEADER_STDINT_U(dnl, sys/types.h inttypes.h sys/inttypes.h $inttype_headers, ac_cv_stdint_result="(seen u_int32_t$and64 in $i)") fi fi dnl if there was no good C99 header file, do some typedef checks... if test "_$ac_cv_header_stdint_x" = "_" ; then AC_MSG_CHECKING([for stdint datatype model]) AC_MSG_RESULT([(..)]) AX_CHECK_DATA_MODEL fi if test "_$ac_cv_header_stdint_x" != "_" ; then ac_cv_header_stdint="$ac_cv_header_stdint_x" elif test "_$ac_cv_header_stdint_o" != "_" ; then ac_cv_header_stdint="$ac_cv_header_stdint_o" elif test "_$ac_cv_header_stdint_u" != "_" ; then ac_cv_header_stdint="$ac_cv_header_stdint_u" else ac_cv_header_stdint="stddef.h" fi AC_MSG_CHECKING([for extra inttypes in chosen header]) AC_MSG_RESULT([($ac_cv_header_stdint)]) dnl see if int_least and int_fast types are present in _this_ header. unset ac_cv_type_int_least32_t unset ac_cv_type_int_fast32_t AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>]) fi # shortcircut to system "stdint.h" # ------------------ PREPARE VARIABLES ------------------------------ if test "$GCC" = "yes" ; then ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1` else ac_cv_stdint_message="using $CC" fi AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl $ac_cv_stdint_result]) dnl ----------------------------------------------------------------- # ----------------- DONE inttypes.h checks START header ------------- AC_CONFIG_COMMANDS([$ac_stdint_h],[ AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h) ac_stdint=$tmp/_stdint.h echo "#ifndef" $_ac_stdint_h >$ac_stdint echo "#define" $_ac_stdint_h "1" >>$ac_stdint echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint if test "_$ac_cv_header_stdint_t" != "_" ; then echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint echo "#include " >>$ac_stdint echo "#endif" >>$ac_stdint echo "#endif" >>$ac_stdint else cat >>$ac_stdint < #else #include /* .................... configured part ............................ */ STDINT_EOF echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint if test "_$ac_cv_header_stdint_x" != "_" ; then ac_header="$ac_cv_header_stdint_x" echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint else echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint fi echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint if test "_$ac_cv_header_stdint_o" != "_" ; then ac_header="$ac_cv_header_stdint_o" echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint else echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint fi echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint if test "_$ac_cv_header_stdint_u" != "_" ; then ac_header="$ac_cv_header_stdint_u" echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint else echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint fi echo "" >>$ac_stdint if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then echo "#include <$ac_header>" >>$ac_stdint echo "" >>$ac_stdint fi fi echo "/* which 64bit typedef has been found */" >>$ac_stdint if test "$ac_cv_type_uint64_t" = "yes" ; then echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint fi if test "$ac_cv_type_u_int64_t" = "yes" ; then echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint fi echo "" >>$ac_stdint echo "/* which type model has been detected */" >>$ac_stdint if test "_$ac_cv_char_data_model" != "_" ; then echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint else echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint fi echo "" >>$ac_stdint echo "/* whether int_least types were detected */" >>$ac_stdint if test "$ac_cv_type_int_least32_t" = "yes"; then echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint fi echo "/* whether int_fast types were detected */" >>$ac_stdint if test "$ac_cv_type_int_fast32_t" = "yes"; then echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint fi echo "/* whether intmax_t type was detected */" >>$ac_stdint if test "$ac_cv_type_intmax_t" = "yes"; then echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint else echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint fi echo "" >>$ac_stdint cat >>$ac_stdint <= 199901L #define _HAVE_UINT64_T #define _HAVE_LONGLONG_UINT64_T typedef long long int64_t; typedef unsigned long long uint64_t; #elif !defined __STRICT_ANSI__ #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ #define _HAVE_UINT64_T typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ /* note: all ELF-systems seem to have loff-support which needs 64-bit */ #if !defined _NO_LONGLONG #define _HAVE_UINT64_T #define _HAVE_LONGLONG_UINT64_T typedef long long int64_t; typedef unsigned long long uint64_t; #endif #elif defined __alpha || (defined __mips && defined _ABIN32) #if !defined _NO_LONGLONG typedef long int64_t; typedef unsigned long uint64_t; #endif /* compiler/cpu type to define int64_t */ #endif #endif #endif #if defined _STDINT_HAVE_U_INT_TYPES /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ typedef u_int8_t uint8_t; typedef u_int16_t uint16_t; typedef u_int32_t uint32_t; /* glibc compatibility */ #ifndef __int8_t_defined #define __int8_t_defined #endif #endif #ifdef _STDINT_NEED_INT_MODEL_T /* we must guess all the basic types. Apart from byte-adressable system, */ /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */ /* (btw, those nibble-addressable systems are way off, or so we assume) */ dnl /* have a look at "64bit and data size neutrality" at */ dnl /* http://unix.org/version2/whatsnew/login_64bit.html */ dnl /* (the shorthand "ILP" types always have a "P" part) */ #if defined _STDINT_BYTE_MODEL #if _STDINT_LONG_MODEL+0 == 242 /* 2:4:2 = IP16 = a normal 16-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned long uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef long int32_t; #endif #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444 /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */ /* 4:4:4 = ILP32 = a normal 32-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef int int32_t; #endif #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488 /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */ /* 4:8:8 = LP64 = a normal 64-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef int int32_t; #endif /* this system has a "long" of 64bit */ #ifndef _HAVE_UINT64_T #define _HAVE_UINT64_T typedef unsigned long uint64_t; typedef long int64_t; #endif #elif _STDINT_LONG_MODEL+0 == 448 /* LLP64 a 64-bit system derived from a 32-bit system */ typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #ifndef __int8_t_defined #define __int8_t_defined typedef char int8_t; typedef short int16_t; typedef int int32_t; #endif /* assuming the system has a "long long" */ #ifndef _HAVE_UINT64_T #define _HAVE_UINT64_T #define _HAVE_LONGLONG_UINT64_T typedef unsigned long long uint64_t; typedef long long int64_t; #endif #else #define _STDINT_NO_INT32_T #endif #else #define _STDINT_NO_INT8_T #define _STDINT_NO_INT32_T #endif #endif /* * quote from SunOS-5.8 sys/inttypes.h: * Use at your own risk. As of February 1996, the committee is squarely * behind the fixed sized types; the "least" and "fast" types are still being * discussed. The probability that the "fast" types may be removed before * the standard is finalized is high enough that they are not currently * implemented. */ #if defined _STDINT_NEED_INT_LEAST_T typedef int8_t int_least8_t; typedef int16_t int_least16_t; typedef int32_t int_least32_t; #ifdef _HAVE_UINT64_T typedef int64_t int_least64_t; #endif typedef uint8_t uint_least8_t; typedef uint16_t uint_least16_t; typedef uint32_t uint_least32_t; #ifdef _HAVE_UINT64_T typedef uint64_t uint_least64_t; #endif /* least types */ #endif #if defined _STDINT_NEED_INT_FAST_T typedef int8_t int_fast8_t; typedef int int_fast16_t; typedef int32_t int_fast32_t; #ifdef _HAVE_UINT64_T typedef int64_t int_fast64_t; #endif typedef uint8_t uint_fast8_t; typedef unsigned uint_fast16_t; typedef uint32_t uint_fast32_t; #ifdef _HAVE_UINT64_T typedef uint64_t uint_fast64_t; #endif /* fast types */ #endif #ifdef _STDINT_NEED_INTMAX_T #ifdef _HAVE_UINT64_T typedef int64_t intmax_t; typedef uint64_t uintmax_t; #else typedef long intmax_t; typedef unsigned long uintmax_t; #endif #endif #ifdef _STDINT_NEED_INTPTR_T #ifndef __intptr_t_defined #define __intptr_t_defined /* we encourage using "long" to store pointer values, never use "int" ! */ #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484 typedef unsinged int uintptr_t; typedef int intptr_t; #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444 typedef unsigned long uintptr_t; typedef long intptr_t; #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T typedef uint64_t uintptr_t; typedef int64_t intptr_t; #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */ typedef unsigned long uintptr_t; typedef long intptr_t; #endif #endif #endif /* The ISO C99 standard specifies that in C++ implementations these should only be defined if explicitly requested. */ #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS #ifndef UINT32_C /* Signed. */ # define INT8_C(c) c # define INT16_C(c) c # define INT32_C(c) c # ifdef _HAVE_LONGLONG_UINT64_T # define INT64_C(c) c ## L # else # define INT64_C(c) c ## LL # endif /* Unsigned. */ # define UINT8_C(c) c ## U # define UINT16_C(c) c ## U # define UINT32_C(c) c ## U # ifdef _HAVE_LONGLONG_UINT64_T # define UINT64_C(c) c ## UL # else # define UINT64_C(c) c ## ULL # endif /* Maximal type. */ # ifdef _HAVE_LONGLONG_UINT64_T # define INTMAX_C(c) c ## L # define UINTMAX_C(c) c ## UL # else # define INTMAX_C(c) c ## LL # define UINTMAX_C(c) c ## ULL # endif /* literalnumbers */ #endif #endif /* These limits are merily those of a two complement byte-oriented system */ /* Minimum of signed integral types. */ # define INT8_MIN (-128) # define INT16_MIN (-32767-1) # define INT32_MIN (-2147483647-1) # define INT64_MIN (-__INT64_C(9223372036854775807)-1) /* Maximum of signed integral types. */ # define INT8_MAX (127) # define INT16_MAX (32767) # define INT32_MAX (2147483647) # define INT64_MAX (__INT64_C(9223372036854775807)) /* Maximum of unsigned integral types. */ # define UINT8_MAX (255) # define UINT16_MAX (65535) # define UINT32_MAX (4294967295U) # define UINT64_MAX (__UINT64_C(18446744073709551615)) /* Minimum of signed integral types having a minimum size. */ # define INT_LEAST8_MIN INT8_MIN # define INT_LEAST16_MIN INT16_MIN # define INT_LEAST32_MIN INT32_MIN # define INT_LEAST64_MIN INT64_MIN /* Maximum of signed integral types having a minimum size. */ # define INT_LEAST8_MAX INT8_MAX # define INT_LEAST16_MAX INT16_MAX # define INT_LEAST32_MAX INT32_MAX # define INT_LEAST64_MAX INT64_MAX /* Maximum of unsigned integral types having a minimum size. */ # define UINT_LEAST8_MAX UINT8_MAX # define UINT_LEAST16_MAX UINT16_MAX # define UINT_LEAST32_MAX UINT32_MAX # define UINT_LEAST64_MAX UINT64_MAX /* shortcircuit*/ #endif /* once */ #endif #endif STDINT_EOF fi if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then AC_MSG_NOTICE([$ac_stdint_h is unchanged]) else ac_dir=`AS_DIRNAME(["$ac_stdint_h"])` AS_MKDIR_P(["$ac_dir"]) rm -f $ac_stdint_h mv $ac_stdint $ac_stdint_h fi ],[# variables for create stdint.h replacement PACKAGE="$PACKAGE" VERSION="$VERSION" ac_stdint_h="$ac_stdint_h" _ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h) ac_cv_stdint_message="$ac_cv_stdint_message" ac_cv_header_stdint_t="$ac_cv_header_stdint_t" ac_cv_header_stdint_x="$ac_cv_header_stdint_x" ac_cv_header_stdint_o="$ac_cv_header_stdint_o" ac_cv_header_stdint_u="$ac_cv_header_stdint_u" ac_cv_type_uint64_t="$ac_cv_type_uint64_t" ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" ac_cv_char_data_model="$ac_cv_char_data_model" ac_cv_long_data_model="$ac_cv_long_data_model" ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" ac_cv_type_intmax_t="$ac_cv_type_intmax_t" ]) ]) libmtp-1.1.10/m4/lt~obsolete.m40000644000175000001440000001377412601454745013156 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])]) libmtp-1.1.10/m4/iconv.m40000644000175000001440000001532112121274441011676 00000000000000# iconv.m4 serial 11 (gettext-0.18.1) dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) ]) AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], [am_cv_lib_iconv=yes] [am_cv_func_iconv=yes]) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi AC_TRY_RUN([ #include #include int main () { /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static const char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) return 1; } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) return 1; } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ if (/* Try standardized names. */ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) /* Try IRIX, OSF/1 names. */ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) /* Try AIX names. */ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) return 1; return 0; }], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], [case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac]) LIBS="$am_save_LIBS" ]) case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then AC_DEFINE([HAVE_ICONV], [1], [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST([LIBICONV]) AC_SUBST([LTLIBICONV]) ]) dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to dnl avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. m4_define([gl_iconv_AC_DEFUN], m4_version_prereq([2.64], [[AC_DEFUN_ONCE( [$1], [$2])]], [[AC_DEFUN( [$1], [$2])]])) gl_iconv_AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL([am_cv_proto_iconv], [ AC_TRY_COMPILE([ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([ $am_cv_proto_iconv]) AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) fi ]) libmtp-1.1.10/m4/libtool.m40000644000175000001440000112475312601454745012251 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 # 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 # 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="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; 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 libmtp-1.1.10/m4/ltsugar.m40000644000175000001440000001044012601454745012250 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 ]) libmtp-1.1.10/aclocal.m40000644000175000001440000027421012604225566011654 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'.])]) # lib-ld.m4 serial 6 dnl Copyright (C) 1996-2003, 2009-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid dnl collision with libtool.m4. dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], [# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 /dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL([acl_cv_path_LD], [if test -z "$LD"; then acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_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 `"$acl_cv_path_LD" -v 2>&1 = 1.10 to complain if config.rpath is missing. m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE([rpath], [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_FROMPACKAGE(name, package) dnl declares that libname comes from the given package. The configure file dnl will then not have a --with-libname-prefix option but a dnl --with-package-prefix option. Several libraries can come from the same dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar dnl macro call that searches for libname. AC_DEFUN([AC_LIB_FROMPACKAGE], [ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_frompackage_]NAME, [$2]) popdef([NAME]) pushdef([PACK],[$2]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_libsinpackage_]PACKUP, m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) popdef([PACKUP]) popdef([PACK]) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) dnl Autoconf >= 2.61 supports dots in --with options. pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_ARG_WITH(P_A_C_K[-prefix], [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= LIB[]NAME[]_PREFIX= dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been dnl computed. So it has to be reset here. HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" dnl The same code as in the loop below: dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$acl_hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi popdef([P_A_C_K]) popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) popdef([NAME]) ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) dnl For those cases where a variable contains several -L and -l options dnl referring to unknown libraries and directories, this macro determines the dnl necessary additional linker options for the runtime path. dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) dnl sets LDADDVAR to linker options needed together with LIBSVALUE. dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, dnl otherwise linking without libtool is assumed. AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], [ AC_REQUIRE([AC_LIB_RPATH]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= next= for opt in $2; do if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= else case $opt in -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= ;; *) next= ;; esac fi done if test "X$rpathdirs" != "X"; then if test -n ""$3""; then dnl libtool is used for linking. Use -R options. for dir in $rpathdirs; do $1="${$1}${$1:+ }-R$dir" done else dnl The linker is used for linking directly. if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="$flag" else dnl The -rpath options are cumulative. for dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="${$1}${$1:+ }$flag" done fi fi fi fi fi AC_SUBST([$1]) ]) # lib-prefix.m4 serial 7 (gettext-0.18) dnl Copyright (C) 2001-2005, 2008-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_LIB_ARG_WITH([lib-prefix], [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) dnl AC_LIB_PREPARE_MULTILIB creates dnl - a variable acl_libdirstem, containing the basename of the libdir, either dnl "lib" or "lib64" or "lib/64", dnl - a variable acl_libdirstem2, as a secondary possible value for dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or dnl "lib/amd64". AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib and lib64. dnl On glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine dnl the compiler's default mode by looking at the compiler's library search dnl path. If at least one of its elements ends in /lib64 or points to a dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. dnl Otherwise we use the default, namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment dnl . dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], [AC_EGREP_CPP([sixtyfour bits], [ #ifdef _LP64 sixtyfour bits #endif ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) ]) if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" ]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # 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 # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --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 # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # 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 ])# 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]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # 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 ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # 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. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/byteorder.m4]) m4_include([m4/iconv.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]) m4_include([m4/stdint.m4]) libmtp-1.1.10/config.sub0000755000175000001440000010622312601454751011772 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-12-03' # 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;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | 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 \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | 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-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | 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-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; 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 ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -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* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libmtp-1.1.10/libmtp.sh0000644000175000001440000000235112604225576011633 00000000000000#!/bin/sh # Lifts a plugged in MTP device to user space and # optionally runs a client program. # Written by Linus Walleij 2006, based on the "usbcam" # script by Nalin Dahyabhai. DEVICEOWNER=root DEVICEPERMS=666 # Special quirk for SuSE systems using "resmgr" # (see http://rechner.lst.de/~okir/resmgr/) if [ -f /sbin/resmgr ] then /sbin/resmgr "${ACTION}" "${DEVICE}" desktop usb exit 0 fi # This is for most other distributions if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then # New code, using lock files instead of copying /dev/console permissions # This also works with non-gdm logins (e.g. on a virtual terminal) # Idea and code from Nalin Dahyabhai if [ "x$DEVICEOWNER" = "xCONSOLE" ] then if [ -f /var/run/console/console.lock ] then DEVICEOWNER=`cat /var/run/console/console.lock` elif [ -f /var/run/console.lock ] then DEVICEOWNER=`cat /var/run/console.lock` elif [ -f /var/lock/console.lock ] then DEVICEOWNER=`cat /var/lock/console.lock` else DEVICEOWNER="nobody" DEVICEPERMS="666" fi fi if [ -n "$DEVICEOWNER" ] then chmod 0000 "${DEVICE}" chown "${DEVICEOWNER}" "${DEVICE}" chmod "${DEVICEPERMS}" "${DEVICE}" fi fi libmtp-1.1.10/doc/0000755000175000001440000000000012604234355010627 500000000000000libmtp-1.1.10/doc/Makefile.in0000644000175000001440000003221012604225567012617 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 = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/byteorder.m4 \ $(top_srcdir)/m4/iconv.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)/m4/stdint.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__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Doxyfile.in $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBUSB_REQUIRES = @LIBUSB_REQUIRES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ 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@ OSFLAGS = @OSFLAGS@ 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@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UDEV = @UDEV@ UDEV_GROUP = @UDEV_GROUP@ UDEV_MODE = @UDEV_MODE@ UDEV_RULES = @UDEV_RULES@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ effective_target = @effective_target@ 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@ ms_lib_exe = @ms_lib_exe@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = Doxyfile.in examples.h mainpage.h @HAVE_DOXYGEN_TRUE@pkgdocdir = $(datadir)/doc/$(PACKAGE)-$(VERSION) @HAVE_DOXYGEN_TRUE@htmldocdir = $(pkgdocdir)/html 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 doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/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 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 @HAVE_DOXYGEN_FALSE@all-local: all-am: Makefile all-local 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." @HAVE_DOXYGEN_FALSE@clean-local: @HAVE_DOXYGEN_FALSE@uninstall-local: @HAVE_DOXYGEN_FALSE@install-data-local: 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-data-local 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-local .MAKE: install-am install-strip .PHONY: all all-am all-local 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-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-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-local .PRECIOUS: Makefile @HAVE_DOXYGEN_TRUE@all-local: @HAVE_DOXYGEN_TRUE@ doxygen @HAVE_DOXYGEN_TRUE@install-data-local: @HAVE_DOXYGEN_TRUE@ $(INSTALL) -d $(DESTDIR)$(htmldocdir) @HAVE_DOXYGEN_TRUE@ $(INSTALL_DATA) html/* $(DESTDIR)$(htmldocdir) @HAVE_DOXYGEN_TRUE@uninstall-local: @HAVE_DOXYGEN_TRUE@ $(RM) -r $(DESTDIR)$(htmldocdir) @HAVE_DOXYGEN_TRUE@ $(RM) -r $(DESTDIR)$(pkgdocdir) @HAVE_DOXYGEN_TRUE@clean-local: @HAVE_DOXYGEN_TRUE@ $(RM) -r html latex man # 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: libmtp-1.1.10/doc/Makefile.am0000644000175000001440000000061512121274441012577 00000000000000EXTRA_DIST=Doxyfile.in examples.h mainpage.h if HAVE_DOXYGEN pkgdocdir=$(datadir)/doc/$(PACKAGE)-$(VERSION) htmldocdir=$(pkgdocdir)/html all-local: doxygen install-data-local: $(INSTALL) -d $(DESTDIR)$(htmldocdir) $(INSTALL_DATA) html/* $(DESTDIR)$(htmldocdir) uninstall-local: $(RM) -r $(DESTDIR)$(htmldocdir) $(RM) -r $(DESTDIR)$(pkgdocdir) clean-local: $(RM) -r html latex man endif libmtp-1.1.10/doc/Doxyfile.in0000644000175000001440000013317412121274441012665 00000000000000# Doxyfile 1.3.9.1 # 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 #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "libmtp" # 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. # Do this with autoconf eventually PROJECT_NUMBER = @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: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, # Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, # Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, # Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, # Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is used # as the annotated text. Otherwise, the brief description is used as-is. If left # blank, the following values are used ("$name" is automatically replaced with the # name of the entity): "The $name class" "The $name widget" "The $name file" # "is" "provides" "specifies" "contains" "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_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 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 # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the 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 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If 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 = NO # 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 = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. SHOW_DIRECTORIES = YES #--------------------------------------------------------------------------- # 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. # Set to YES by Linus Walleij on 2005-07-30. QUIET = YES # 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. # Set to NO by Linus Walleij on 2005-07-30. WARNINGS = NO # 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. # Set to NO by Linus Walleij on 2005-07-30. WARN_IF_UNDOCUMENTED = NO # 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. # Set to NO by Linus Walleij on 2005-07-30. WARN_IF_DOC_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/src \ @top_srcdir@/doc/mainpage.h \ @top_srcdir@/doc/examples.h # 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 FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = 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. EXCLUDE_PATTERNS = # 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 = @top_srcdir@/examples # 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 = *.c # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # 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 = YES #--------------------------------------------------------------------------- # 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 = NO # 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. # doc/libnjb_header.html HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # 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 # 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 = YES # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = 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_PREDEFINED 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 = NO #--------------------------------------------------------------------------- # 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 # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the 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 tags 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 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 # 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 on the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_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 a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # 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 libmtp-1.1.10/doc/examples.h0000644000175000001440000000062512121274441012533 00000000000000/* * List examples here... */ /** \example delfile.c */ /** \example detect.c */ /** \example files.c */ /** \example folders.c */ /** \example getfile.c */ /** \example hotplug.c */ /** \example newfolder.c */ /** \example sendfile.c */ /** \example sendtr.c */ /** \example tracks.c */ /** \example trexist.c */ /** \example playlists.c */ /** \example getplaylist.c */ /** \example refactortest.c */ libmtp-1.1.10/doc/mainpage.h0000644000175000001440000000102012121274441012464 00000000000000/** * \mainpage The official libmtp documentation * * \section Introduction * * libmtp is a library for the Media Transfer Protocol (MTP) * under various POSIX operating systems. * * \section License * * libmtp is available under the GNU Lesser General Public License, * version 2. You can use libmtp in Free or proprietary software alike as * long as you publish your modifications to this library in accordance * with the LGPL license. If you do not follow the LGPL you will be in * deep, deep trouble. * */ libmtp-1.1.10/TODO0000644000175000001440000001211412137315164010470 00000000000000TODO file: ---------- COMPATIBILITY fixes: 1. COMPATIBILITY: dual-mode devices, i.e. devices exposing both an MTP and a USB Mass Storage Device Class (flashdrive) interface are and have always been problematic. We must find a way to get this to work, eventually. The problem is that the in-kernel mass storage driver hogs the device before the MTP mode gets a chance of being used, whereas the Windows kernel driver apparently does it the other way around, trying the MTP mode first and then not fall back on mass storage if MTP is available. (For some more explanations se src/libusb-glue.h.) This may involve kernel modifications. Perhaps it is only necessary to tweak the udev config not to load USB mass storage support for these devices. Dunno. 2. COMPATIBILITY: several devices tend to "hang" after disconnect, needing to be unplugged and replugged before they can be used again. We don't know why, it may be related to low-level USB behaviour that is not exposed in the logs we read. On some devices it appear that avoiding to release the USB interface after closing the PTP/MTP session solves this, and might be a hint at how the Windows MTP stack works: perhaps the Windows MTP daemon grabs the interface once the device is plugged in, created a session and NEVER release it. Thus only unplug or shutdown ends the session. This behaviour can be emulated (sort of) by DEVICE_FLAG_NO_RELEASE_INTERFACE which will make the device not release the USB low-level interface, though it'll still close the session. But is it really desireable to have as default? Not unless we run an MTP daemon as well, probably, and the behaviour is questionable from an USB interoperability point of view. SPEEDUP fixes: None known. libmtp is fast :-) FEATURE fixes: 1. FEATURE: Support playback and volume setting on devices that have it. (I don't have one that does - Linus.) 2. FEATURE: Support relevant events. MTP devices seen in existance provide events for "object added" and "object deleted". These should result in atleast a call to the cache update function. 3. FEATURE: Mechanism to retrieve the device icon device property, else if not present, look for DevIcon.fil (Windows ICO format) and DevLogo.fil (PNG Format) images from the device (if available). 4. FEATURE: Shared device access so that multiple client applications can have an open connection to the device at the same time via a handle. For example, it should be somehow possible to run mtp-detect at the same time as amarok or mtpfs is connected to a device. This would require some form of resource sharing, discussions have centered on a D-Bus based connection arbiter daemon. 5. FEATURE: Implement an OpenSync backend for devices which have calendaring, contact etc support. http://opensync.org/ THOSE ARE ALREADY DONE: 1. FEATURE: Make an API that can return several devices and let the user choose which one to operate, not just connect to the first one... 2. SPEED: Cache the object info for all items on the device. Right now, ptp_getobjectinfo() is called repeatedly on the same objects during startup, track listing, file listing, playlist listing, album listing and whatever we implement tomorrow. A lot of useless communication can be saved by cacheing this info. Notice that this needs to be updated whenever flush_handles() is called too. (This came from libgphoto2 implementing it!) 3. SPEED: Cache track metadata, file metadata etc in params->proplist. 4. SPEED: Whenever we add an object (file, track, playlist...) we should only need to update the cache with relevant data. Atleast for speedup caches. 5. COMPATIBILITY: account for different step sizes and intervals on some numeric properties we set, make the functions round off when possible. 6. SPEED: Cache the supported object properties at first read/startup. then use the cache to check for supported props instead of calling out to PTP with ptp_mtp_getobjectpropssupported() every time. The cache would be an array of size params->deviceinfo.ImageFormats_len with a list for each format of the properties it will support. Notice that this needs to be updated whenever flush_handles() is called too. THIS HAS BEEN DISCARDED, TERO IMPLEMENTED IT BUT IT DOESN'T SEEM TO YIELD MUCH. 7. FEATURE: Make abstract playlists really become size -1 when created as the ones created on the device instead of the current 1 byte size. (Is this possible using enhanced commands? See TODO remarks in the create_abstract_entity() function) 8. FEATURE: Integrate libmtp with HAL / D-Bus so applications can dynamically know when a device has been plugged in or removed. Need a mechanism to connect a specific hal UDI. 9. SPEEDUP: The recursive function that builds the folder tree is O(n^2)! Atleast remove all non-folders (PTP associations) from the list before we start sorting and building that tree. We walk the entire list for each group of siblings right now! 10. FEATURE: program to autoprobe device interfaces on connection. 11. FEATURE: accomodate Googles uncached device needs. 12. FEATURE: rudimentary event interface. libmtp-1.1.10/COPYING0000644000175000001440000006347212121274441011043 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright © 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright © This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libmtp-1.1.10/install-sh0000755000175000001440000003452312601454751012016 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2013-12-25.23; # 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: "UTC" # time-stamp-end: "; # UTC" # End: libmtp-1.1.10/ltmain.sh0000755000175000001440000117077112601454744011646 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: libmtp-1.1.10/AUTHORS0000644000175000001440000000313012121274441011041 00000000000000libmtp was invented by: Richard Low Linus Walleij We both came to do libmtp after working on the libnjb project, which was all about Creative Technology devices implementing the OASiS and PDE protocols. libmtp is however largely based on libptp2, which was created by Mariusz Woloszyn as part of gPhoto2 then derived into its own project. We later started to use libgphoto2 which is also based on the same code as libptp2 but with large contributions from Marcus Meissner . Marcus is also a contributor on libmtp from time to time and we're great friends. Other contributors to libmtp include: Andy Kelk Chris A. Debenham Daniel Williams Dave Kelly Matthew Wilcox Robert Reardon Orson Teodoro Ted Bullock Sean Kellogg Tero Saarni Jeff Mitchell Johannes Huber Alistair Boyle Chris Bagwell Joseph Nahmias Florent Mertens Alvin James Ravenscroft Thomas Schweitzer Nyall Dawson Nicolas VIVIEN Andrea Grillini Yavor Goulishev Jonas Salling Sajid Anwar libmtp-1.1.10/src/0000755000175000001440000000000012604234355010651 500000000000000libmtp-1.1.10/src/ptp.h0000644000175000001440000036437512345765122011572 00000000000000/* ptp.h * * Copyright (C) 2001 Mariusz Woloszyn * Copyright (C) 2003-2012 Marcus Meissner * Copyright (C) 2006-2008 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #ifndef __PTP_H__ #define __PTP_H__ #include #include #ifdef HAVE_ICONV #include #endif #include "gphoto2-endian.h" #include "device-flags.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* PTP datalayer byteorder */ #define PTP_DL_BE 0xF0 #define PTP_DL_LE 0x0F /* USB interface class */ #ifndef USB_CLASS_PTP #define USB_CLASS_PTP 6 #endif /* PTP request/response/event general PTP container (transport independent) */ struct _PTPContainer { uint16_t Code; uint32_t SessionID; uint32_t Transaction_ID; /* params may be of any type of size less or equal to uint32_t */ uint32_t Param1; uint32_t Param2; uint32_t Param3; /* events can only have three parameters */ uint32_t Param4; uint32_t Param5; /* the number of meaningfull parameters */ uint8_t Nparam; }; typedef struct _PTPContainer PTPContainer; /* PTP USB Bulk-Pipe container */ /* USB bulk max packet length for high speed endpoints */ /* The max packet is set to 512 bytes. The spec says * "end of data transfers are signaled by short packets or NULL * packets". It never says anything about 512, but current * implementations seem to have chosen this value, which also * happens to be the size of an USB 2.0 HS endpoint, even though * this is not necessary. * * Previously we had this as 4096 for MTP devices. We have found * and fixed the bugs that made this necessary and it can be 512 again. * * USB 3.0 has now 1024 byte EPs. */ #define PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE 512 #define PTP_USB_BULK_HS_MAX_PACKET_LEN_READ 512 #define PTP_USB_BULK_SS_MAX_PACKET_LEN_WRITE 1024 #define PTP_USB_BULK_SS_MAX_PACKET_LEN_READ 1024 #define PTP_USB_BULK_HDR_LEN (2*sizeof(uint32_t)+2*sizeof(uint16_t)) #define PTP_USB_BULK_PAYLOAD_LEN_WRITE (PTP_USB_BULK_SS_MAX_PACKET_LEN_WRITE-PTP_USB_BULK_HDR_LEN) #define PTP_USB_BULK_PAYLOAD_LEN_READ (PTP_USB_BULK_SS_MAX_PACKET_LEN_READ-PTP_USB_BULK_HDR_LEN) #define PTP_USB_BULK_REQ_LEN (PTP_USB_BULK_HDR_LEN+5*sizeof(uint32_t)) struct _PTPUSBBulkContainer { uint32_t length; uint16_t type; uint16_t code; uint32_t trans_id; union { struct { uint32_t param1; uint32_t param2; uint32_t param3; uint32_t param4; uint32_t param5; } params; /* this must be set to the maximum of PTP_USB_BULK_PAYLOAD_LEN_WRITE * and PTP_USB_BULK_PAYLOAD_LEN_READ */ unsigned char data[PTP_USB_BULK_PAYLOAD_LEN_READ]; } payload; }; typedef struct _PTPUSBBulkContainer PTPUSBBulkContainer; /* PTP USB Asynchronous Event Interrupt Data Format */ struct _PTPUSBEventContainer { uint32_t length; uint16_t type; uint16_t code; uint32_t trans_id; uint32_t param1; uint32_t param2; uint32_t param3; }; typedef struct _PTPUSBEventContainer PTPUSBEventContainer; struct _PTPCanon_directtransfer_entry { uint32_t oid; char *str; }; typedef struct _PTPCanon_directtransfer_entry PTPCanon_directtransfer_entry; /* USB container types */ #define PTP_USB_CONTAINER_UNDEFINED 0x0000 #define PTP_USB_CONTAINER_COMMAND 0x0001 #define PTP_USB_CONTAINER_DATA 0x0002 #define PTP_USB_CONTAINER_RESPONSE 0x0003 #define PTP_USB_CONTAINER_EVENT 0x0004 /* PTP/IP definitions */ #define PTPIP_INIT_COMMAND_REQUEST 1 #define PTPIP_INIT_COMMAND_ACK 2 #define PTPIP_INIT_EVENT_REQUEST 3 #define PTPIP_INIT_EVENT_ACK 4 #define PTPIP_INIT_FAIL 5 #define PTPIP_CMD_REQUEST 6 #define PTPIP_CMD_RESPONSE 7 #define PTPIP_EVENT 8 #define PTPIP_START_DATA_PACKET 9 #define PTPIP_DATA_PACKET 10 #define PTPIP_CANCEL_TRANSACTION 11 #define PTPIP_END_DATA_PACKET 12 #define PTPIP_PING 13 #define PTPIP_PONG 14 struct _PTPIPHeader { uint32_t length; uint32_t type; }; typedef struct _PTPIPHeader PTPIPHeader; /* Vendor IDs */ #define PTP_VENDOR_EASTMAN_KODAK 0x00000001 #define PTP_VENDOR_SEIKO_EPSON 0x00000002 #define PTP_VENDOR_AGILENT 0x00000003 #define PTP_VENDOR_POLAROID 0x00000004 #define PTP_VENDOR_AGFA_GEVAERT 0x00000005 #define PTP_VENDOR_MICROSOFT 0x00000006 #define PTP_VENDOR_EQUINOX 0x00000007 #define PTP_VENDOR_VIEWQUEST 0x00000008 #define PTP_VENDOR_STMICROELECTRONICS 0x00000009 #define PTP_VENDOR_NIKON 0x0000000A #define PTP_VENDOR_CANON 0x0000000B #define PTP_VENDOR_FOTONATION 0x0000000C #define PTP_VENDOR_PENTAX 0x0000000D #define PTP_VENDOR_FUJI 0x0000000E /* not from standards papers, but from traces: */ #define PTP_VENDOR_SONY 0x00000011 /* observed in the A900 */ #define PTP_VENDOR_SAMSUNG 0x0000001a /* observed in the Samsung NX1000 */ /* Vendor extension ID used for MTP (occasionaly, usualy 6 is used) */ #define PTP_VENDOR_MTP 0xffffffff /* Operation Codes */ /* PTP v1.0 operation codes */ #define PTP_OC_Undefined 0x1000 #define PTP_OC_GetDeviceInfo 0x1001 #define PTP_OC_OpenSession 0x1002 #define PTP_OC_CloseSession 0x1003 #define PTP_OC_GetStorageIDs 0x1004 #define PTP_OC_GetStorageInfo 0x1005 #define PTP_OC_GetNumObjects 0x1006 #define PTP_OC_GetObjectHandles 0x1007 #define PTP_OC_GetObjectInfo 0x1008 #define PTP_OC_GetObject 0x1009 #define PTP_OC_GetThumb 0x100A #define PTP_OC_DeleteObject 0x100B #define PTP_OC_SendObjectInfo 0x100C #define PTP_OC_SendObject 0x100D #define PTP_OC_InitiateCapture 0x100E #define PTP_OC_FormatStore 0x100F #define PTP_OC_ResetDevice 0x1010 #define PTP_OC_SelfTest 0x1011 #define PTP_OC_SetObjectProtection 0x1012 #define PTP_OC_PowerDown 0x1013 #define PTP_OC_GetDevicePropDesc 0x1014 #define PTP_OC_GetDevicePropValue 0x1015 #define PTP_OC_SetDevicePropValue 0x1016 #define PTP_OC_ResetDevicePropValue 0x1017 #define PTP_OC_TerminateOpenCapture 0x1018 #define PTP_OC_MoveObject 0x1019 #define PTP_OC_CopyObject 0x101A #define PTP_OC_GetPartialObject 0x101B #define PTP_OC_InitiateOpenCapture 0x101C /* PTP v1.1 operation codes */ #define PTP_OC_StartEnumHandles 0x101D #define PTP_OC_EnumHandles 0x101E #define PTP_OC_StopEnumHandles 0x101F #define PTP_OC_GetVendorExtensionMaps 0x1020 #define PTP_OC_GetVendorDeviceInfo 0x1021 #define PTP_OC_GetResizedImageObject 0x1022 #define PTP_OC_GetFilesystemManifest 0x1023 #define PTP_OC_GetStreamInfo 0x1024 #define PTP_OC_GetStream 0x1025 /* Eastman Kodak extension Operation Codes */ #define PTP_OC_EK_GetSerial 0x9003 #define PTP_OC_EK_SetSerial 0x9004 #define PTP_OC_EK_SendFileObjectInfo 0x9005 #define PTP_OC_EK_SendFileObject 0x9006 #define PTP_OC_EK_SetText 0x9008 /* Canon extension Operation Codes */ #define PTP_OC_CANON_GetPartialObjectInfo 0x9001 /* 9002 - sends 2 uint32, nothing back */ #define PTP_OC_CANON_SetObjectArchive 0x9002 #define PTP_OC_CANON_KeepDeviceOn 0x9003 #define PTP_OC_CANON_LockDeviceUI 0x9004 #define PTP_OC_CANON_UnlockDeviceUI 0x9005 #define PTP_OC_CANON_GetObjectHandleByName 0x9006 /* no 9007 observed yet */ #define PTP_OC_CANON_InitiateReleaseControl 0x9008 #define PTP_OC_CANON_TerminateReleaseControl 0x9009 #define PTP_OC_CANON_TerminatePlaybackMode 0x900A #define PTP_OC_CANON_ViewfinderOn 0x900B #define PTP_OC_CANON_ViewfinderOff 0x900C #define PTP_OC_CANON_DoAeAfAwb 0x900D /* 900e - send nothing, gets 5 uint16t in 32bit entities back in 20byte datablob */ #define PTP_OC_CANON_GetCustomizeSpec 0x900E #define PTP_OC_CANON_GetCustomizeItemInfo 0x900F #define PTP_OC_CANON_GetCustomizeData 0x9010 #define PTP_OC_CANON_SetCustomizeData 0x9011 #define PTP_OC_CANON_GetCaptureStatus 0x9012 #define PTP_OC_CANON_CheckEvent 0x9013 #define PTP_OC_CANON_FocusLock 0x9014 #define PTP_OC_CANON_FocusUnlock 0x9015 #define PTP_OC_CANON_GetLocalReleaseParam 0x9016 #define PTP_OC_CANON_SetLocalReleaseParam 0x9017 #define PTP_OC_CANON_AskAboutPcEvf 0x9018 #define PTP_OC_CANON_SendPartialObject 0x9019 #define PTP_OC_CANON_InitiateCaptureInMemory 0x901A #define PTP_OC_CANON_GetPartialObjectEx 0x901B #define PTP_OC_CANON_SetObjectTime 0x901C #define PTP_OC_CANON_GetViewfinderImage 0x901D #define PTP_OC_CANON_GetObjectAttributes 0x901E #define PTP_OC_CANON_ChangeUSBProtocol 0x901F #define PTP_OC_CANON_GetChanges 0x9020 #define PTP_OC_CANON_GetObjectInfoEx 0x9021 #define PTP_OC_CANON_InitiateDirectTransfer 0x9022 #define PTP_OC_CANON_TerminateDirectTransfer 0x9023 #define PTP_OC_CANON_SendObjectInfoByPath 0x9024 #define PTP_OC_CANON_SendObjectByPath 0x9025 #define PTP_OC_CANON_InitiateDirectTansferEx 0x9026 #define PTP_OC_CANON_GetAncillaryObjectHandles 0x9027 #define PTP_OC_CANON_GetTreeInfo 0x9028 #define PTP_OC_CANON_GetTreeSize 0x9029 #define PTP_OC_CANON_NotifyProgress 0x902A #define PTP_OC_CANON_NotifyCancelAccepted 0x902B /* 902c: no parms, read 3 uint32 in data, no response parms */ #define PTP_OC_CANON_902C 0x902C #define PTP_OC_CANON_GetDirectory 0x902D #define PTP_OC_CANON_SetPairingInfo 0x9030 #define PTP_OC_CANON_GetPairingInfo 0x9031 #define PTP_OC_CANON_DeletePairingInfo 0x9032 #define PTP_OC_CANON_GetMACAddress 0x9033 /* 9034: 1 param, no parms returned */ #define PTP_OC_CANON_SetDisplayMonitor 0x9034 #define PTP_OC_CANON_PairingComplete 0x9035 #define PTP_OC_CANON_GetWirelessMAXChannel 0x9036 #define PTP_OC_CANON_GetWebServiceSpec 0x9068 #define PTP_OC_CANON_GetWebServiceData 0x9069 #define PTP_OC_CANON_SetWebServiceData 0x906B #define PTP_OC_CANON_GetRootCertificateSpec 0x906C #define PTP_OC_CANON_GetRootCertificateData 0x906D #define PTP_OC_CANON_SetRootCertificateData 0x906F /* 9101: no args, 8 byte data (01 00 00 00 00 00 00 00), no resp data. */ #define PTP_OC_CANON_EOS_GetStorageIDs 0x9101 /* 9102: 1 arg (0) * 0x28 bytes of data: 00000000: 34 00 00 00 02 00 02 91 0a 00 00 00 04 00 03 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000020: 00 00 ff ff ff ff 03 43 00 46 00 00 00 03 41 00 00000030: 3a 00 00 00 * no resp args */ #define PTP_OC_CANON_EOS_GetStorageInfo 0x9102 #define PTP_OC_CANON_EOS_GetObjectInfo 0x9103 #define PTP_OC_CANON_EOS_GetObject 0x9104 #define PTP_OC_CANON_EOS_DeleteObject 0x9105 #define PTP_OC_CANON_EOS_FormatStore 0x9106 #define PTP_OC_CANON_EOS_GetPartialObject 0x9107 #define PTP_OC_CANON_EOS_GetDeviceInfoEx 0x9108 /* sample1: * 3 cmdargs: 1,0xffffffff,00 00 10 00; * data: 00000000: 48 00 00 00 02 00 09 91 12 00 00 00 01 00 00 00 00000010: 38 00 00 00 00 00 00 30 01 00 00 00 01 30 00 00 00000020: 01 00 00 00 10 00 00 00 00 00 00 00 00 00 00 20 00000030: 00 00 00 30 44 43 49 4d 00 00 00 00 00 00 00 00 DCIM 00000040: 00 00 00 00 cc c3 01 46 * 2 respargs: 0x0, 0x3c * * sample2: * 00000000: 18 00 00 00 01 00 09 91 15 00 00 00 01 00 00 00 00000010: 00 00 00 30 00 00 10 00 00000000: 48 00 00 00 02 00 09 91 15 00 00 00 01 00 00 00 00000010: 38 00 00 00 00 00 9c 33 01 00 00 00 01 30 00 00 00000020: 01 00 00 00 10 00 00 00 00 00 00 00 00 00 00 30 00000030: 00 00 9c 33 32 33 31 43 41 4e 4f 4e 00 00 00 00 231CANON 00000040: 00 00 00 00 cc c3 01 46 */ #define PTP_OC_CANON_EOS_GetObjectInfoEx 0x9109 #define PTP_OC_CANON_EOS_GetThumbEx 0x910A #define PTP_OC_CANON_EOS_SendPartialObject 0x910B #define PTP_OC_CANON_EOS_SetObjectAttributes 0x910C #define PTP_OC_CANON_EOS_GetObjectTime 0x910D #define PTP_OC_CANON_EOS_SetObjectTime 0x910E /* 910f: no args, no data, 1 response arg (0). */ #define PTP_OC_CANON_EOS_RemoteRelease 0x910F /* Marcus: looks more like "Set DeviceProperty" in the trace. * * no cmd args * data phase (0xc, 0xd11c, 0x1) * no resp args */ #define PTP_OC_CANON_EOS_SetDevicePropValueEx 0x9110 #define PTP_OC_CANON_EOS_GetRemoteMode 0x9113 /* 9114: 1 arg (0x1), no data, no resp data. */ #define PTP_OC_CANON_EOS_SetRemoteMode 0x9114 /* 9115: 1 arg (0x1), no data, no resp data. */ #define PTP_OC_CANON_EOS_SetEventMode 0x9115 /* 9116: no args, data phase, no resp data. */ #define PTP_OC_CANON_EOS_GetEvent 0x9116 #define PTP_OC_CANON_EOS_TransferComplete 0x9117 #define PTP_OC_CANON_EOS_CancelTransfer 0x9118 #define PTP_OC_CANON_EOS_ResetTransfer 0x9119 /* 911a: 3 args (0xfffffff7, 0x00001000, 0x00000001), no data, no resp data. */ /* 911a: 3 args (0x001dfc60, 0x00001000, 0x00000001), no data, no resp data. */ #define PTP_OC_CANON_EOS_PCHDDCapacity 0x911A /* 911b: no cmd args, no data, no resp args */ #define PTP_OC_CANON_EOS_SetUILock 0x911B /* 911c: no cmd args, no data, no resp args */ #define PTP_OC_CANON_EOS_ResetUILock 0x911C #define PTP_OC_CANON_EOS_KeepDeviceOn 0x911D #define PTP_OC_CANON_EOS_SetNullPacketMode 0x911E #define PTP_OC_CANON_EOS_UpdateFirmware 0x911F #define PTP_OC_CANON_EOS_TransferCompleteDT 0x9120 #define PTP_OC_CANON_EOS_CancelTransferDT 0x9121 #define PTP_OC_CANON_EOS_SetWftProfile 0x9122 #define PTP_OC_CANON_EOS_GetWftProfile 0x9123 #define PTP_OC_CANON_EOS_SetProfileToWft 0x9124 #define PTP_OC_CANON_EOS_BulbStart 0x9125 #define PTP_OC_CANON_EOS_BulbEnd 0x9126 #define PTP_OC_CANON_EOS_RequestDevicePropValue 0x9127 /* 0x9128 args (0x1/0x2, 0x0), no data, no resp args */ #define PTP_OC_CANON_EOS_RemoteReleaseOn 0x9128 /* 0x9129 args (0x1/0x2), no data, no resp args */ #define PTP_OC_CANON_EOS_RemoteReleaseOff 0x9129 #define PTP_OC_CANON_EOS_RegistBackgroundImage 0x912A #define PTP_OC_CANON_EOS_ChangePhotoStudioMode 0x912B #define PTP_OC_CANON_EOS_GetPartialObjectEx 0x912C #define PTP_OC_CANON_EOS_ResetMirrorLockupState 0x9130 #define PTP_OC_CANON_EOS_PopupBuiltinFlash 0x9131 #define PTP_OC_CANON_EOS_EndGetPartialObjectEx 0x9132 #define PTP_OC_CANON_EOS_MovieSelectSWOn 0x9133 #define PTP_OC_CANON_EOS_MovieSelectSWOff 0x9134 #define PTP_OC_CANON_EOS_GetCTGInfo 0x9135 #define PTP_OC_CANON_EOS_GetLensAdjust 0x9136 #define PTP_OC_CANON_EOS_SetLensAdjust 0x9137 #define PTP_OC_CANON_EOS_GetMusicInfo 0x9138 #define PTP_OC_CANON_EOS_CreateHandle 0x9139 #define PTP_OC_CANON_EOS_SendPartialObjectEx 0x913A #define PTP_OC_CANON_EOS_EndSendPartialObjectEx 0x913B #define PTP_OC_CANON_EOS_SetCTGInfo 0x913C #define PTP_OC_CANON_EOS_SetRequestOLCInfoGroup 0x913D #define PTP_OC_CANON_EOS_SetRequestRollingPitchingLevel 0x913E #define PTP_OC_CANON_EOS_GetCameraSupport 0x913F #define PTP_OC_CANON_EOS_SetRating 0x9140 /* 2 args */ #define PTP_OC_CANON_EOS_RequestInnerDevelopStart 0x9141 /* 2 args: 1 type, 1 object? */ #define PTP_OC_CANON_EOS_RequestInnerDevelopParamChange 0x9142 #define PTP_OC_CANON_EOS_RequestInnerDevelopEnd 0x9143 #define PTP_OC_CANON_EOS_GpsLoggingDataMode 0x9144 /* 1 arg */ #define PTP_OC_CANON_EOS_GetGpsLogCurrentHandle 0x9145 #define PTP_OC_CANON_EOS_InitiateViewfinder 0x9151 #define PTP_OC_CANON_EOS_TerminateViewfinder 0x9152 #define PTP_OC_CANON_EOS_GetViewFinderData 0x9153 #define PTP_OC_CANON_EOS_DoAf 0x9154 #define PTP_OC_CANON_EOS_DriveLens 0x9155 #define PTP_OC_CANON_EOS_DepthOfFieldPreview 0x9156 /* 1 arg */ #define PTP_OC_CANON_EOS_ClickWB 0x9157 /* 2 args: x,y */ #define PTP_OC_CANON_EOS_Zoom 0x9158 /* 1 arg */ #define PTP_OC_CANON_EOS_ZoomPosition 0x9159 /* 2 args: x,y */ #define PTP_OC_CANON_EOS_SetLiveAfFrame 0x915A #define PTP_OC_CANON_EOS_TouchAfPosition 0x915B /* 3 args: type,x,y */ #define PTP_OC_CANON_EOS_SetLvPcFlavoreditMode 0x915C /* 1 arg */ #define PTP_OC_CANON_EOS_SetLvPcFlavoreditParam 0x915D /* 1 arg */ #define PTP_OC_CANON_EOS_AfCancel 0x9160 #define PTP_OC_CANON_EOS_SetDefaultCameraSetting 0x91BE #define PTP_OC_CANON_EOS_GetAEData 0x91BF #define PTP_OC_CANON_EOS_NotifyNetworkError 0x91E8 #define PTP_OC_CANON_EOS_AdapterTransferProgress 0x91E9 #define PTP_OC_CANON_EOS_TransferComplete2 0x91F0 #define PTP_OC_CANON_EOS_CancelTransfer2 0x91F1 #define PTP_OC_CANON_EOS_FAPIMessageTX 0x91FE #define PTP_OC_CANON_EOS_FAPIMessageRX 0x91FF /* Nikon extension Operation Codes */ #define PTP_OC_NIKON_GetProfileAllData 0x9006 #define PTP_OC_NIKON_SendProfileData 0x9007 #define PTP_OC_NIKON_DeleteProfile 0x9008 #define PTP_OC_NIKON_SetProfileData 0x9009 #define PTP_OC_NIKON_AdvancedTransfer 0x9010 #define PTP_OC_NIKON_GetFileInfoInBlock 0x9011 #define PTP_OC_NIKON_Capture 0x90C0 /* 1 param, no data */ #define PTP_OC_NIKON_AfDrive 0x90C1 /* no params, no data */ #define PTP_OC_NIKON_SetControlMode 0x90C2 /* 1 param, no data */ #define PTP_OC_NIKON_DelImageSDRAM 0x90C3 /* 1 param, no data */ #define PTP_OC_NIKON_GetLargeThumb 0x90C4 #define PTP_OC_NIKON_CurveDownload 0x90C5 /* 1 param, data in */ #define PTP_OC_NIKON_CurveUpload 0x90C6 /* 1 param, data out */ #define PTP_OC_NIKON_CheckEvent 0x90C7 /* no params, data in */ #define PTP_OC_NIKON_DeviceReady 0x90C8 /* no params, no data */ #define PTP_OC_NIKON_SetPreWBData 0x90C9 /* 3 params, data out */ #define PTP_OC_NIKON_GetVendorPropCodes 0x90CA /* 0 params, data in */ #define PTP_OC_NIKON_AfCaptureSDRAM 0x90CB /* no params, no data */ #define PTP_OC_NIKON_GetPictCtrlData 0x90CC /* 2 params, data in */ #define PTP_OC_NIKON_SetPictCtrlData 0x90CD /* 2 params, data out */ #define PTP_OC_NIKON_DelCstPicCtrl 0x90CE /* 1 param, no data */ #define PTP_OC_NIKON_GetPicCtrlCapability 0x90CF /* 1 param, data in */ /* Nikon Liveview stuff */ #define PTP_OC_NIKON_GetPreviewImg 0x9200 #define PTP_OC_NIKON_StartLiveView 0x9201 /* no params */ #define PTP_OC_NIKON_EndLiveView 0x9202 /* no params */ #define PTP_OC_NIKON_GetLiveViewImg 0x9203 /* no params, data in */ #define PTP_OC_NIKON_MfDrive 0x9204 /* 2 params */ #define PTP_OC_NIKON_ChangeAfArea 0x9205 /* 2 params */ #define PTP_OC_NIKON_AfDriveCancel 0x9206 /* no params */ /* 2 params: * 0xffffffff == No AF before, 0xfffffffe == AF before capture * sdram=1, card=0 */ #define PTP_OC_NIKON_InitiateCaptureRecInMedia 0x9207 /* 1 params */ #define PTP_OC_NIKON_GetVendorStorageIDs 0x9209 /* no params, data in */ #define PTP_OC_NIKON_StartMovieRecInCard 0x920a /* no params, no data */ #define PTP_OC_NIKON_EndMovieRec 0x920b /* no params, no data */ #define PTP_OC_NIKON_TerminateCapture 0x920c /* 2 params */ #define PTP_OC_NIKON_GetDevicePTPIPInfo 0x90E0 #define PTP_OC_NIKON_GetPartialObjectHiSpeed 0x9400 /* 3 params, data in */ /* From Nikon V1 Trace */ #define PTP_OC_NIKON_GetDevicePropEx 0x9504 /* gets device prop dataa */ /* Casio EX-F1 (from http://code.google.com/p/exf1ctrl/ ) */ #define PTP_OC_CASIO_STILL_START 0x9001 #define PTP_OC_CASIO_STILL_STOP 0x9002 #define PTP_OC_CASIO_FOCUS 0x9007 #define PTP_OC_CASIO_CF_PRESS 0x9009 #define PTP_OC_CASIO_CF_RELEASE 0x900A #define PTP_OC_CASIO_GET_OBJECT_INFO 0x900C #define PTP_OC_CASIO_SHUTTER 0x9024 #define PTP_OC_CASIO_GET_STILL_HANDLES 0x9027 #define PTP_OC_CASIO_STILL_RESET 0x9028 #define PTP_OC_CASIO_HALF_PRESS 0x9029 #define PTP_OC_CASIO_HALF_RELEASE 0x902A #define PTP_OC_CASIO_CS_PRESS 0x902B #define PTP_OC_CASIO_CS_RELEASE 0x902C #define PTP_OC_CASIO_ZOOM 0x902D #define PTP_OC_CASIO_CZ_PRESS 0x902E #define PTP_OC_CASIO_CZ_RELEASE 0x902F #define PTP_OC_CASIO_MOVIE_START 0x9041 #define PTP_OC_CASIO_MOVIE_STOP 0x9042 #define PTP_OC_CASIO_MOVIE_PRESS 0x9043 #define PTP_OC_CASIO_MOVIE_RELEASE 0x9044 #define PTP_OC_CASIO_GET_MOVIE_HANDLES 0x9045 #define PTP_OC_CASIO_MOVIE_RESET 0x9046 #define PTP_OC_CASIO_GET_OBJECT 0x9025 #define PTP_OC_CASIO_GET_THUMBNAIL 0x9026 /* Sony stuff */ /* 9201: * 3 params: 1,0,0 ; IN: data 8 bytes all 0 * or: * 3 params: 2,0,0 ; IN: data 8 bytes all 0 * or * 3 params: 3,0,0,: IN: data 8 butes all 0 */ #define PTP_OC_SONY_SDIOConnect 0x9201 /* 9202: 1 param, 0xc8; IN data: * 16 bit: 0xc8 * ptp array 32 bit: index, 16 bit values of propcodes */ #define PTP_OC_SONY_GetSDIOGetExtDeviceInfo 0x9202 #define PTP_OC_SONY_GetDevicePropdesc 0x9203 #define PTP_OC_SONY_GetDevicePropertyValue 0x9204 /* 1 param, 16bit propcode, SEND DATA: propvalue */ #define PTP_OC_SONY_SetControlDeviceA 0x9205 #define PTP_OC_SONY_GetControlDeviceDesc 0x9206 /* 1 param, 16bit propcode, SEND DATA: propvalue */ #define PTP_OC_SONY_SetControlDeviceB 0x9207 /* get all device property data at once */ #define PTP_OC_SONY_GetAllDevicePropData 0x9209 /* gets a 4126 byte blob of device props ?*/ /* Microsoft / MTP extension codes */ #define PTP_OC_MTP_GetObjectPropsSupported 0x9801 #define PTP_OC_MTP_GetObjectPropDesc 0x9802 #define PTP_OC_MTP_GetObjectPropValue 0x9803 #define PTP_OC_MTP_SetObjectPropValue 0x9804 #define PTP_OC_MTP_GetObjPropList 0x9805 #define PTP_OC_MTP_SetObjPropList 0x9806 #define PTP_OC_MTP_GetInterdependendPropdesc 0x9807 #define PTP_OC_MTP_SendObjectPropList 0x9808 #define PTP_OC_MTP_GetObjectReferences 0x9810 #define PTP_OC_MTP_SetObjectReferences 0x9811 #define PTP_OC_MTP_UpdateDeviceFirmware 0x9812 #define PTP_OC_MTP_Skip 0x9820 /* * Windows Media Digital Rights Management for Portable Devices * Extension Codes (microsoft.com/WMDRMPD: 10.1) */ #define PTP_OC_MTP_WMDRMPD_GetSecureTimeChallenge 0x9101 #define PTP_OC_MTP_WMDRMPD_GetSecureTimeResponse 0x9102 #define PTP_OC_MTP_WMDRMPD_SetLicenseResponse 0x9103 #define PTP_OC_MTP_WMDRMPD_GetSyncList 0x9104 #define PTP_OC_MTP_WMDRMPD_SendMeterChallengeQuery 0x9105 #define PTP_OC_MTP_WMDRMPD_GetMeterChallenge 0x9106 #define PTP_OC_MTP_WMDRMPD_SetMeterResponse 0x9107 #define PTP_OC_MTP_WMDRMPD_CleanDataStore 0x9108 #define PTP_OC_MTP_WMDRMPD_GetLicenseState 0x9109 #define PTP_OC_MTP_WMDRMPD_SendWMDRMPDCommand 0x910A #define PTP_OC_MTP_WMDRMPD_SendWMDRMPDRequest 0x910B /* * Windows Media Digital Rights Management for Portable Devices * Extension Codes (microsoft.com/WMDRMPD: 10.1) * Below are operations that have no public documented identifier * associated with them "Vendor-defined Command Code" */ #define PTP_OC_MTP_WMDRMPD_SendWMDRMPDAppRequest 0x9212 #define PTP_OC_MTP_WMDRMPD_GetWMDRMPDAppResponse 0x9213 #define PTP_OC_MTP_WMDRMPD_EnableTrustedFilesOperations 0x9214 #define PTP_OC_MTP_WMDRMPD_DisableTrustedFilesOperations 0x9215 #define PTP_OC_MTP_WMDRMPD_EndTrustedAppSession 0x9216 /* ^^^ guess ^^^ */ /* * Microsoft Advanced Audio/Video Transfer * Extensions (microsoft.com/AAVT: 1.0) */ #define PTP_OC_MTP_AAVT_OpenMediaSession 0x9170 #define PTP_OC_MTP_AAVT_CloseMediaSession 0x9171 #define PTP_OC_MTP_AAVT_GetNextDataBlock 0x9172 #define PTP_OC_MTP_AAVT_SetCurrentTimePosition 0x9173 /* * Windows Media Digital Rights Management for Network Devices * Extensions (microsoft.com/WMDRMND: 1.0) MTP/IP? */ #define PTP_OC_MTP_WMDRMND_SendRegistrationRequest 0x9180 #define PTP_OC_MTP_WMDRMND_GetRegistrationResponse 0x9181 #define PTP_OC_MTP_WMDRMND_GetProximityChallenge 0x9182 #define PTP_OC_MTP_WMDRMND_SendProximityResponse 0x9183 #define PTP_OC_MTP_WMDRMND_SendWMDRMNDLicenseRequest 0x9184 #define PTP_OC_MTP_WMDRMND_GetWMDRMNDLicenseResponse 0x9185 /* * Windows Media Player Portiable Devices * Extension Codes (microsoft.com/WMPPD: 11.1) */ #define PTP_OC_MTP_WMPPD_ReportAddedDeletedItems 0x9201 #define PTP_OC_MTP_WMPPD_ReportAcquiredItems 0x9202 #define PTP_OC_MTP_WMPPD_PlaylistObjectPref 0x9203 /* * Undocumented Zune Operation Codes * maybe related to WMPPD extension set? */ #define PTP_OC_MTP_ZUNE_GETUNDEFINED001 0x9204 /* WiFi Provisioning MTP Extension Codes (microsoft.com/WPDWCN: 1.0) */ #define PTP_OC_MTP_WPDWCN_ProcessWFCObject 0x9122 /* Olympus E series commands */ #define PTP_OC_OLYMPUS_Capture 0x9101 #define PTP_OC_OLYMPUS_SelfCleaning 0x9103 #define PTP_OC_OLYMPUS_SetRGBGain 0x9106 #define PTP_OC_OLYMPUS_SetPresetMode 0x9107 #define PTP_OC_OLYMPUS_SetWBBiasAll 0x9108 #define PTP_OC_OLYMPUS_GetCameraControlMode 0x910a #define PTP_OC_OLYMPUS_SetCameraControlMode 0x910b #define PTP_OC_OLYMPUS_SetWBRGBGain 0x910c #define PTP_OC_OLYMPUS_GetDeviceInfo 0x9301 #define PTP_OC_OLYMPUS_OpenSession 0x9302 #define PTP_OC_OLYMPUS_SetDateTime 0x9402 #define PTP_OC_OLYMPUS_GetDateTime 0x9482 #define PTP_OC_OLYMPUS_SetCameraID 0x9501 #define PTP_OC_OLYMPUS_GetCameraID 0x9581 /* Android Random I/O Extensions Codes */ #define PTP_OC_ANDROID_GetPartialObject64 0x95C1 #define PTP_OC_ANDROID_SendPartialObject 0x95C2 #define PTP_OC_ANDROID_TruncateObject 0x95C3 #define PTP_OC_ANDROID_BeginEditObject 0x95C4 #define PTP_OC_ANDROID_EndEditObject 0x95C5 /* Proprietary vendor extension operations mask */ #define PTP_OC_EXTENSION_MASK 0xF000 #define PTP_OC_EXTENSION 0x9000 /* Response Codes */ /* PTP v1.0 response codes */ #define PTP_RC_Undefined 0x2000 #define PTP_RC_OK 0x2001 #define PTP_RC_GeneralError 0x2002 #define PTP_RC_SessionNotOpen 0x2003 #define PTP_RC_InvalidTransactionID 0x2004 #define PTP_RC_OperationNotSupported 0x2005 #define PTP_RC_ParameterNotSupported 0x2006 #define PTP_RC_IncompleteTransfer 0x2007 #define PTP_RC_InvalidStorageId 0x2008 #define PTP_RC_InvalidObjectHandle 0x2009 #define PTP_RC_DevicePropNotSupported 0x200A #define PTP_RC_InvalidObjectFormatCode 0x200B #define PTP_RC_StoreFull 0x200C #define PTP_RC_ObjectWriteProtected 0x200D #define PTP_RC_StoreReadOnly 0x200E #define PTP_RC_AccessDenied 0x200F #define PTP_RC_NoThumbnailPresent 0x2010 #define PTP_RC_SelfTestFailed 0x2011 #define PTP_RC_PartialDeletion 0x2012 #define PTP_RC_StoreNotAvailable 0x2013 #define PTP_RC_SpecificationByFormatUnsupported 0x2014 #define PTP_RC_NoValidObjectInfo 0x2015 #define PTP_RC_InvalidCodeFormat 0x2016 #define PTP_RC_UnknownVendorCode 0x2017 #define PTP_RC_CaptureAlreadyTerminated 0x2018 #define PTP_RC_DeviceBusy 0x2019 #define PTP_RC_InvalidParentObject 0x201A #define PTP_RC_InvalidDevicePropFormat 0x201B #define PTP_RC_InvalidDevicePropValue 0x201C #define PTP_RC_InvalidParameter 0x201D #define PTP_RC_SessionAlreadyOpened 0x201E #define PTP_RC_TransactionCanceled 0x201F #define PTP_RC_SpecificationOfDestinationUnsupported 0x2020 /* PTP v1.1 response codes */ #define PTP_RC_InvalidEnumHandle 0x2021 #define PTP_RC_NoStreamEnabled 0x2022 #define PTP_RC_InvalidDataSet 0x2023 /* Eastman Kodak extension Response Codes */ #define PTP_RC_EK_FilenameRequired 0xA001 #define PTP_RC_EK_FilenameConflicts 0xA002 #define PTP_RC_EK_FilenameInvalid 0xA003 /* Nikon specific response codes */ #define PTP_RC_NIKON_HardwareError 0xA001 #define PTP_RC_NIKON_OutOfFocus 0xA002 #define PTP_RC_NIKON_ChangeCameraModeFailed 0xA003 #define PTP_RC_NIKON_InvalidStatus 0xA004 #define PTP_RC_NIKON_SetPropertyNotSupported 0xA005 #define PTP_RC_NIKON_WbResetError 0xA006 #define PTP_RC_NIKON_DustReferenceError 0xA007 #define PTP_RC_NIKON_ShutterSpeedBulb 0xA008 #define PTP_RC_NIKON_MirrorUpSequence 0xA009 #define PTP_RC_NIKON_CameraModeNotAdjustFNumber 0xA00A #define PTP_RC_NIKON_NotLiveView 0xA00B #define PTP_RC_NIKON_MfDriveStepEnd 0xA00C #define PTP_RC_NIKON_MfDriveStepInsufficiency 0xA00E #define PTP_RC_NIKON_AdvancedTransferCancel 0xA022 /* Canon specific response codes */ #define PTP_RC_CANON_UNKNOWN_COMMAND 0xA001 #define PTP_RC_CANON_OPERATION_REFUSED 0xA005 #define PTP_RC_CANON_LENS_COVER 0xA006 #define PTP_RC_CANON_BATTERY_LOW 0xA101 #define PTP_RC_CANON_NOT_READY 0xA102 #define PTP_RC_CANON_A009 0xA009 /* Microsoft/MTP specific codes */ #define PTP_RC_MTP_Undefined 0xA800 #define PTP_RC_MTP_Invalid_ObjectPropCode 0xA801 #define PTP_RC_MTP_Invalid_ObjectProp_Format 0xA802 #define PTP_RC_MTP_Invalid_ObjectProp_Value 0xA803 #define PTP_RC_MTP_Invalid_ObjectReference 0xA804 #define PTP_RC_MTP_Invalid_Dataset 0xA806 #define PTP_RC_MTP_Specification_By_Group_Unsupported 0xA807 #define PTP_RC_MTP_Specification_By_Depth_Unsupported 0xA808 #define PTP_RC_MTP_Object_Too_Large 0xA809 #define PTP_RC_MTP_ObjectProp_Not_Supported 0xA80A /* Microsoft Advanced Audio/Video Transfer response codes (microsoft.com/AAVT 1.0) */ #define PTP_RC_MTP_Invalid_Media_Session_ID 0xA170 #define PTP_RC_MTP_Media_Session_Limit_Reached 0xA171 #define PTP_RC_MTP_No_More_Data 0xA172 /* WiFi Provisioning MTP Extension Error Codes (microsoft.com/WPDWCN: 1.0) */ #define PTP_RC_MTP_Invalid_WFC_Syntax 0xA121 #define PTP_RC_MTP_WFC_Version_Not_Supported 0xA122 /* libptp2 extended ERROR codes */ #define PTP_ERROR_IO 0x02FF #define PTP_ERROR_DATA_EXPECTED 0x02FE #define PTP_ERROR_RESP_EXPECTED 0x02FD #define PTP_ERROR_BADPARAM 0x02FC #define PTP_ERROR_CANCEL 0x02FB #define PTP_ERROR_TIMEOUT 0x02FA /* PTP Event Codes */ #define PTP_EC_Undefined 0x4000 #define PTP_EC_CancelTransaction 0x4001 #define PTP_EC_ObjectAdded 0x4002 #define PTP_EC_ObjectRemoved 0x4003 #define PTP_EC_StoreAdded 0x4004 #define PTP_EC_StoreRemoved 0x4005 #define PTP_EC_DevicePropChanged 0x4006 #define PTP_EC_ObjectInfoChanged 0x4007 #define PTP_EC_DeviceInfoChanged 0x4008 #define PTP_EC_RequestObjectTransfer 0x4009 #define PTP_EC_StoreFull 0x400A #define PTP_EC_DeviceReset 0x400B #define PTP_EC_StorageInfoChanged 0x400C #define PTP_EC_CaptureComplete 0x400D #define PTP_EC_UnreportedStatus 0x400E /* Canon extension Event Codes */ #define PTP_EC_CANON_ExtendedErrorcode 0xC005 /* ? */ #define PTP_EC_CANON_ObjectInfoChanged 0xC008 #define PTP_EC_CANON_RequestObjectTransfer 0xC009 #define PTP_EC_CANON_ShutterButtonPressed0 0xC00B #define PTP_EC_CANON_CameraModeChanged 0xC00C #define PTP_EC_CANON_ShutterButtonPressed1 0xC00E #define PTP_EC_CANON_StartDirectTransfer 0xC011 #define PTP_EC_CANON_StopDirectTransfer 0xC013 /* Canon EOS events */ #define PTP_EC_CANON_EOS_RequestGetEvent 0xc101 #define PTP_EC_CANON_EOS_ObjectAddedEx 0xc181 #define PTP_EC_CANON_EOS_ObjectRemoved 0xc182 #define PTP_EC_CANON_EOS_RequestGetObjectInfoEx 0xc183 #define PTP_EC_CANON_EOS_StorageStatusChanged 0xc184 #define PTP_EC_CANON_EOS_StorageInfoChanged 0xc185 #define PTP_EC_CANON_EOS_RequestObjectTransfer 0xc186 #define PTP_EC_CANON_EOS_ObjectInfoChangedEx 0xc187 #define PTP_EC_CANON_EOS_ObjectContentChanged 0xc188 #define PTP_EC_CANON_EOS_PropValueChanged 0xc189 #define PTP_EC_CANON_EOS_AvailListChanged 0xc18a #define PTP_EC_CANON_EOS_CameraStatusChanged 0xc18b #define PTP_EC_CANON_EOS_WillSoonShutdown 0xc18d #define PTP_EC_CANON_EOS_ShutdownTimerUpdated 0xc18e #define PTP_EC_CANON_EOS_RequestCancelTransfer 0xc18f #define PTP_EC_CANON_EOS_RequestObjectTransferDT 0xc190 #define PTP_EC_CANON_EOS_RequestCancelTransferDT 0xc191 #define PTP_EC_CANON_EOS_StoreAdded 0xc192 #define PTP_EC_CANON_EOS_StoreRemoved 0xc193 #define PTP_EC_CANON_EOS_BulbExposureTime 0xc194 #define PTP_EC_CANON_EOS_RecordingTime 0xc195 #define PTP_EC_CANON_EOS_RequestObjectTransferTS 0xC1a2 #define PTP_EC_CANON_EOS_AfResult 0xc1a3 #define PTP_EC_CANON_EOS_CTGInfoCheckComplete 0xc1a4 #define PTP_EC_CANON_EOS_OLCInfoChanged 0xc1a5 #define PTP_EC_CANON_EOS_RequestObjectTransferFTP 0xc1f1 /* Nikon extension Event Codes */ /* Nikon extension Event Codes */ #define PTP_EC_Nikon_ObjectAddedInSDRAM 0xC101 #define PTP_EC_Nikon_CaptureCompleteRecInSdram 0xC102 /* Gets 1 parameter, objectid pointing to DPOF object */ #define PTP_EC_Nikon_AdvancedTransfer 0xC103 #define PTP_EC_Nikon_PreviewImageAdded 0xC104 /* Olympus E series */ #define PTP_EC_Olympus_PropertyChanged 0xC102 #define PTP_EC_Olympus_CaptureComplete 0xC103 /* Sony */ #define PTP_EC_Sony_ObjectAdded 0xC201 /* c202 ... unclear. also called with object id? */ #define PTP_EC_Sony_PropertyChanged 0xC203 /* MTP Event codes */ #define PTP_EC_MTP_ObjectPropChanged 0xC801 #define PTP_EC_MTP_ObjectPropDescChanged 0xC802 #define PTP_EC_MTP_ObjectReferencesChanged 0xC803 /* constants for GetObjectHandles */ #define PTP_GOH_ALL_STORAGE 0xffffffff #define PTP_GOH_ALL_FORMATS 0x00000000 #define PTP_GOH_ALL_ASSOCS 0x00000000 #define PTP_GOH_ROOT_PARENT 0xffffffff /* PTP device info structure (returned by GetDevInfo) */ struct _PTPDeviceInfo { uint16_t StandardVersion; uint32_t VendorExtensionID; uint16_t VendorExtensionVersion; char *VendorExtensionDesc; uint16_t FunctionalMode; uint32_t OperationsSupported_len; uint16_t *OperationsSupported; uint32_t EventsSupported_len; uint16_t *EventsSupported; uint32_t DevicePropertiesSupported_len; uint16_t *DevicePropertiesSupported; uint32_t CaptureFormats_len; uint16_t *CaptureFormats; uint32_t ImageFormats_len; uint16_t *ImageFormats; char *Manufacturer; char *Model; char *DeviceVersion; char *SerialNumber; }; typedef struct _PTPDeviceInfo PTPDeviceInfo; /* PTP storageIDs structute (returned by GetStorageIDs) */ struct _PTPStorageIDs { uint32_t n; uint32_t *Storage; }; typedef struct _PTPStorageIDs PTPStorageIDs; /* PTP StorageInfo structure (returned by GetStorageInfo) */ struct _PTPStorageInfo { uint16_t StorageType; uint16_t FilesystemType; uint16_t AccessCapability; uint64_t MaxCapability; uint64_t FreeSpaceInBytes; uint32_t FreeSpaceInImages; char *StorageDescription; char *VolumeLabel; }; typedef struct _PTPStorageInfo PTPStorageInfo; /* PTP objecthandles structure (returned by GetObjectHandles) */ struct _PTPObjectHandles { uint32_t n; uint32_t *Handler; }; typedef struct _PTPObjectHandles PTPObjectHandles; #define PTP_HANDLER_SPECIAL 0xffffffff #define PTP_HANDLER_ROOT 0x00000000 /* PTP objectinfo structure (returned by GetObjectInfo) */ struct _PTPObjectInfo { uint32_t StorageID; uint16_t ObjectFormat; uint16_t ProtectionStatus; /* In the regular objectinfo this is 32bit, * but we keep the general object size here * that also arrives via other methods and so * use 64bit */ uint64_t ObjectCompressedSize; uint16_t ThumbFormat; uint32_t ThumbCompressedSize; uint32_t ThumbPixWidth; uint32_t ThumbPixHeight; uint32_t ImagePixWidth; uint32_t ImagePixHeight; uint32_t ImageBitDepth; uint32_t ParentObject; uint16_t AssociationType; uint32_t AssociationDesc; uint32_t SequenceNumber; char *Filename; time_t CaptureDate; time_t ModificationDate; char *Keywords; }; typedef struct _PTPObjectInfo PTPObjectInfo; /* max ptp string length INCLUDING terminating null character */ #define PTP_MAXSTRLEN 255 /* PTP Object Format Codes */ /* ancillary formats */ #define PTP_OFC_Undefined 0x3000 #define PTP_OFC_Defined 0x3800 #define PTP_OFC_Association 0x3001 #define PTP_OFC_Script 0x3002 #define PTP_OFC_Executable 0x3003 #define PTP_OFC_Text 0x3004 #define PTP_OFC_HTML 0x3005 #define PTP_OFC_DPOF 0x3006 #define PTP_OFC_AIFF 0x3007 #define PTP_OFC_WAV 0x3008 #define PTP_OFC_MP3 0x3009 #define PTP_OFC_AVI 0x300A #define PTP_OFC_MPEG 0x300B #define PTP_OFC_ASF 0x300C #define PTP_OFC_QT 0x300D /* guessing */ /* image formats */ #define PTP_OFC_EXIF_JPEG 0x3801 #define PTP_OFC_TIFF_EP 0x3802 #define PTP_OFC_FlashPix 0x3803 #define PTP_OFC_BMP 0x3804 #define PTP_OFC_CIFF 0x3805 #define PTP_OFC_Undefined_0x3806 0x3806 #define PTP_OFC_GIF 0x3807 #define PTP_OFC_JFIF 0x3808 #define PTP_OFC_PCD 0x3809 #define PTP_OFC_PICT 0x380A #define PTP_OFC_PNG 0x380B #define PTP_OFC_Undefined_0x380C 0x380C #define PTP_OFC_TIFF 0x380D #define PTP_OFC_TIFF_IT 0x380E #define PTP_OFC_JP2 0x380F #define PTP_OFC_JPX 0x3810 /* ptp v1.1 has only DNG new */ #define PTP_OFC_DNG 0x3811 /* Eastman Kodak extension ancillary format */ #define PTP_OFC_EK_M3U 0xb002 /* Canon extension */ #define PTP_OFC_CANON_CRW 0xb101 #define PTP_OFC_CANON_CRW3 0xb103 #define PTP_OFC_CANON_MOV 0xb104 #define PTP_OFC_CANON_MOV2 0xb105 /* CHDK specific raw mode */ #define PTP_OFC_CANON_CHDK_CRW 0xb1ff /* Sony */ #define PTP_OFC_SONY_RAW 0xb101 /* MTP extensions */ #define PTP_OFC_MTP_MediaCard 0xb211 #define PTP_OFC_MTP_MediaCardGroup 0xb212 #define PTP_OFC_MTP_Encounter 0xb213 #define PTP_OFC_MTP_EncounterBox 0xb214 #define PTP_OFC_MTP_M4A 0xb215 #define PTP_OFC_MTP_ZUNEUNDEFINED 0xb217 /* Unknown file type */ #define PTP_OFC_MTP_Firmware 0xb802 #define PTP_OFC_MTP_WindowsImageFormat 0xb881 #define PTP_OFC_MTP_UndefinedAudio 0xb900 #define PTP_OFC_MTP_WMA 0xb901 #define PTP_OFC_MTP_OGG 0xb902 #define PTP_OFC_MTP_AAC 0xb903 #define PTP_OFC_MTP_AudibleCodec 0xb904 #define PTP_OFC_MTP_FLAC 0xb906 #define PTP_OFC_MTP_SamsungPlaylist 0xb909 #define PTP_OFC_MTP_UndefinedVideo 0xb980 #define PTP_OFC_MTP_WMV 0xb981 #define PTP_OFC_MTP_MP4 0xb982 #define PTP_OFC_MTP_MP2 0xb983 #define PTP_OFC_MTP_3GP 0xb984 #define PTP_OFC_MTP_UndefinedCollection 0xba00 #define PTP_OFC_MTP_AbstractMultimediaAlbum 0xba01 #define PTP_OFC_MTP_AbstractImageAlbum 0xba02 #define PTP_OFC_MTP_AbstractAudioAlbum 0xba03 #define PTP_OFC_MTP_AbstractVideoAlbum 0xba04 #define PTP_OFC_MTP_AbstractAudioVideoPlaylist 0xba05 #define PTP_OFC_MTP_AbstractContactGroup 0xba06 #define PTP_OFC_MTP_AbstractMessageFolder 0xba07 #define PTP_OFC_MTP_AbstractChapteredProduction 0xba08 #define PTP_OFC_MTP_AbstractAudioPlaylist 0xba09 #define PTP_OFC_MTP_AbstractVideoPlaylist 0xba0a #define PTP_OFC_MTP_AbstractMediacast 0xba0b #define PTP_OFC_MTP_WPLPlaylist 0xba10 #define PTP_OFC_MTP_M3UPlaylist 0xba11 #define PTP_OFC_MTP_MPLPlaylist 0xba12 #define PTP_OFC_MTP_ASXPlaylist 0xba13 #define PTP_OFC_MTP_PLSPlaylist 0xba14 #define PTP_OFC_MTP_UndefinedDocument 0xba80 #define PTP_OFC_MTP_AbstractDocument 0xba81 #define PTP_OFC_MTP_XMLDocument 0xba82 #define PTP_OFC_MTP_MSWordDocument 0xba83 #define PTP_OFC_MTP_MHTCompiledHTMLDocument 0xba84 #define PTP_OFC_MTP_MSExcelSpreadsheetXLS 0xba85 #define PTP_OFC_MTP_MSPowerpointPresentationPPT 0xba86 #define PTP_OFC_MTP_UndefinedMessage 0xbb00 #define PTP_OFC_MTP_AbstractMessage 0xbb01 #define PTP_OFC_MTP_UndefinedContact 0xbb80 #define PTP_OFC_MTP_AbstractContact 0xbb81 #define PTP_OFC_MTP_vCard2 0xbb82 #define PTP_OFC_MTP_vCard3 0xbb83 #define PTP_OFC_MTP_UndefinedCalendarItem 0xbe00 #define PTP_OFC_MTP_AbstractCalendarItem 0xbe01 #define PTP_OFC_MTP_vCalendar1 0xbe02 #define PTP_OFC_MTP_vCalendar2 0xbe03 #define PTP_OFC_MTP_UndefinedWindowsExecutable 0xbe80 #define PTP_OFC_MTP_MediaCast 0xbe81 #define PTP_OFC_MTP_Section 0xbe82 /* PTP Association Types */ #define PTP_AT_Undefined 0x0000 #define PTP_AT_GenericFolder 0x0001 #define PTP_AT_Album 0x0002 #define PTP_AT_TimeSequence 0x0003 #define PTP_AT_HorizontalPanoramic 0x0004 #define PTP_AT_VerticalPanoramic 0x0005 #define PTP_AT_2DPanoramic 0x0006 #define PTP_AT_AncillaryData 0x0007 /* PTP Protection Status */ #define PTP_PS_NoProtection 0x0000 #define PTP_PS_ReadOnly 0x0001 #define PTP_PS_MTP_ReadOnlyData 0x8002 #define PTP_PS_MTP_NonTransferableData 0x8003 /* PTP Storage Types */ #define PTP_ST_Undefined 0x0000 #define PTP_ST_FixedROM 0x0001 #define PTP_ST_RemovableROM 0x0002 #define PTP_ST_FixedRAM 0x0003 #define PTP_ST_RemovableRAM 0x0004 /* PTP FilesystemType Values */ #define PTP_FST_Undefined 0x0000 #define PTP_FST_GenericFlat 0x0001 #define PTP_FST_GenericHierarchical 0x0002 #define PTP_FST_DCF 0x0003 /* PTP StorageInfo AccessCapability Values */ #define PTP_AC_ReadWrite 0x0000 #define PTP_AC_ReadOnly 0x0001 #define PTP_AC_ReadOnly_with_Object_Deletion 0x0002 /* Property Describing Dataset, Range Form */ union _PTPPropertyValue { char *str; /* common string, malloced */ uint8_t u8; int8_t i8; uint16_t u16; int16_t i16; uint32_t u32; int32_t i32; uint64_t u64; int64_t i64; /* XXXX: 128 bit signed and unsigned missing */ struct array { uint32_t count; union _PTPPropertyValue *v; /* malloced, count elements */ } a; }; typedef union _PTPPropertyValue PTPPropertyValue; /* Metadata lists for MTP operations */ struct _MTPProperties { uint16_t property; uint16_t datatype; uint32_t ObjectHandle; PTPPropertyValue propval; }; typedef struct _MTPProperties MTPProperties; struct _PTPPropDescRangeForm { PTPPropertyValue MinimumValue; PTPPropertyValue MaximumValue; PTPPropertyValue StepSize; }; typedef struct _PTPPropDescRangeForm PTPPropDescRangeForm; /* Property Describing Dataset, Enum Form */ struct _PTPPropDescEnumForm { uint16_t NumberOfValues; PTPPropertyValue *SupportedValue; /* malloced */ }; typedef struct _PTPPropDescEnumForm PTPPropDescEnumForm; /* Device Property Describing Dataset (DevicePropDesc) */ struct _PTPDevicePropDesc { uint16_t DevicePropertyCode; uint16_t DataType; uint8_t GetSet; PTPPropertyValue FactoryDefaultValue; PTPPropertyValue CurrentValue; uint8_t FormFlag; union { PTPPropDescEnumForm Enum; PTPPropDescRangeForm Range; } FORM; }; typedef struct _PTPDevicePropDesc PTPDevicePropDesc; /* Object Property Describing Dataset (DevicePropDesc) */ struct _PTPObjectPropDesc { uint16_t ObjectPropertyCode; uint16_t DataType; uint8_t GetSet; PTPPropertyValue FactoryDefaultValue; uint32_t GroupCode; uint8_t FormFlag; union { PTPPropDescEnumForm Enum; PTPPropDescRangeForm Range; } FORM; }; typedef struct _PTPObjectPropDesc PTPObjectPropDesc; /* Canon filesystem's folder entry Dataset */ #define PTP_CANON_FilenameBufferLen 13 #define PTP_CANON_FolderEntryLen 28 struct _PTPCANONFolderEntry { uint32_t ObjectHandle; uint16_t ObjectFormatCode; uint8_t Flags; uint32_t ObjectSize; time_t Time; char Filename[PTP_CANON_FilenameBufferLen]; uint32_t StorageID; }; typedef struct _PTPCANONFolderEntry PTPCANONFolderEntry; /* Nikon Tone Curve Data */ #define PTP_NIKON_MaxCurvePoints 19 struct _PTPNIKONCoordinatePair { uint8_t X; uint8_t Y; }; typedef struct _PTPNIKONCoordinatePair PTPNIKONCoordinatePair; struct _PTPNTCCoordinatePair { uint8_t X; uint8_t Y; }; typedef struct _PTPNTCCoordinatePair PTPNTCCoordinatePair; struct _PTPNIKONCurveData { char static_preamble[6]; uint8_t XAxisStartPoint; uint8_t XAxisEndPoint; uint8_t YAxisStartPoint; uint8_t YAxisEndPoint; uint8_t MidPointIntegerPart; uint8_t MidPointDecimalPart; uint8_t NCoordinates; PTPNIKONCoordinatePair CurveCoordinates[PTP_NIKON_MaxCurvePoints]; }; typedef struct _PTPNIKONCurveData PTPNIKONCurveData; struct _PTPEKTextParams { char *title; char *line[5]; }; typedef struct _PTPEKTextParams PTPEKTextParams; /* Nikon Wifi profiles */ struct _PTPNIKONWifiProfile { /* Values valid both when reading and writing profiles */ char profile_name[17]; uint8_t device_type; uint8_t icon_type; char essid[33]; /* Values only valid when reading. Some of these are in the write packet, * but are set automatically, like id, display_order and creation_date. */ uint8_t id; uint8_t valid; uint8_t display_order; char creation_date[16]; char lastusage_date[16]; /* Values only valid when writing */ uint32_t ip_address; uint8_t subnet_mask; /* first zero bit position, e.g. 24 for 255.255.255.0 */ uint32_t gateway_address; uint8_t address_mode; /* 0 - Manual, 2-3 - DHCP ad-hoc/managed*/ uint8_t access_mode; /* 0 - Managed, 1 - Adhoc */ uint8_t wifi_channel; /* 1-11 */ uint8_t authentification; /* 0 - Open, 1 - Shared, 2 - WPA-PSK */ uint8_t encryption; /* 0 - None, 1 - WEP 64bit, 2 - WEP 128bit (not supported: 3 - TKIP) */ uint8_t key[64]; uint8_t key_nr; /* char guid[16]; */ }; typedef struct _PTPNIKONWifiProfile PTPNIKONWifiProfile; #define PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN 0 #define PTP_CANON_EOS_CHANGES_TYPE_OBJECTINFO 1 #define PTP_CANON_EOS_CHANGES_TYPE_OBJECTTRANSFER 2 #define PTP_CANON_EOS_CHANGES_TYPE_PROPERTY 3 #define PTP_CANON_EOS_CHANGES_TYPE_CAMERASTATUS 4 struct _PTPCanon_New_Object { uint32_t oid; PTPObjectInfo oi; }; struct _PTPCanon_changes_entry { int type; union { struct _PTPCanon_New_Object object; /* TYPE_OBJECTINFO */ char *info; uint16_t propid; int status; } u; }; typedef struct _PTPCanon_changes_entry PTPCanon_changes_entry; typedef struct _PTPCanon_Property { uint32_t size; uint32_t type; uint32_t proptype; unsigned char *data; /* fill out for queries */ PTPDevicePropDesc dpd; } PTPCanon_Property; typedef struct _PTPCanonEOSDeviceInfo { /* length */ uint32_t EventsSupported_len; uint32_t *EventsSupported; uint32_t DevicePropertiesSupported_len; uint32_t *DevicePropertiesSupported; uint32_t unk_len; uint32_t *unk; } PTPCanonEOSDeviceInfo; /* DataType Codes */ #define PTP_DTC_UNDEF 0x0000 #define PTP_DTC_INT8 0x0001 #define PTP_DTC_UINT8 0x0002 #define PTP_DTC_INT16 0x0003 #define PTP_DTC_UINT16 0x0004 #define PTP_DTC_INT32 0x0005 #define PTP_DTC_UINT32 0x0006 #define PTP_DTC_INT64 0x0007 #define PTP_DTC_UINT64 0x0008 #define PTP_DTC_INT128 0x0009 #define PTP_DTC_UINT128 0x000A #define PTP_DTC_ARRAY_MASK 0x4000 #define PTP_DTC_AINT8 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT8) #define PTP_DTC_AUINT8 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT8) #define PTP_DTC_AINT16 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT16) #define PTP_DTC_AUINT16 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT16) #define PTP_DTC_AINT32 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT32) #define PTP_DTC_AUINT32 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT32) #define PTP_DTC_AINT64 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT64) #define PTP_DTC_AUINT64 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT64) #define PTP_DTC_AINT128 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT128) #define PTP_DTC_AUINT128 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT128) #define PTP_DTC_STR 0xFFFF /* Device Properties Codes */ /* PTP v1.0 property codes */ #define PTP_DPC_Undefined 0x5000 #define PTP_DPC_BatteryLevel 0x5001 #define PTP_DPC_FunctionalMode 0x5002 #define PTP_DPC_ImageSize 0x5003 #define PTP_DPC_CompressionSetting 0x5004 #define PTP_DPC_WhiteBalance 0x5005 #define PTP_DPC_RGBGain 0x5006 #define PTP_DPC_FNumber 0x5007 #define PTP_DPC_FocalLength 0x5008 #define PTP_DPC_FocusDistance 0x5009 #define PTP_DPC_FocusMode 0x500A #define PTP_DPC_ExposureMeteringMode 0x500B #define PTP_DPC_FlashMode 0x500C #define PTP_DPC_ExposureTime 0x500D #define PTP_DPC_ExposureProgramMode 0x500E #define PTP_DPC_ExposureIndex 0x500F #define PTP_DPC_ExposureBiasCompensation 0x5010 #define PTP_DPC_DateTime 0x5011 #define PTP_DPC_CaptureDelay 0x5012 #define PTP_DPC_StillCaptureMode 0x5013 #define PTP_DPC_Contrast 0x5014 #define PTP_DPC_Sharpness 0x5015 #define PTP_DPC_DigitalZoom 0x5016 #define PTP_DPC_EffectMode 0x5017 #define PTP_DPC_BurstNumber 0x5018 #define PTP_DPC_BurstInterval 0x5019 #define PTP_DPC_TimelapseNumber 0x501A #define PTP_DPC_TimelapseInterval 0x501B #define PTP_DPC_FocusMeteringMode 0x501C #define PTP_DPC_UploadURL 0x501D #define PTP_DPC_Artist 0x501E #define PTP_DPC_CopyrightInfo 0x501F /* PTP v1.1 property codes */ #define PTP_DPC_SupportedStreams 0x5020 #define PTP_DPC_EnabledStreams 0x5021 #define PTP_DPC_VideoFormat 0x5022 #define PTP_DPC_VideoResolution 0x5023 #define PTP_DPC_VideoQuality 0x5024 #define PTP_DPC_VideoFrameRate 0x5025 #define PTP_DPC_VideoContrast 0x5026 #define PTP_DPC_VideoBrightness 0x5027 #define PTP_DPC_AudioFormat 0x5028 #define PTP_DPC_AudioBitrate 0x5029 #define PTP_DPC_AudioSamplingRate 0x502A #define PTP_DPC_AudioBitPerSample 0x502B #define PTP_DPC_AudioVolume 0x502C /* Proprietary vendor extension device property mask */ #define PTP_DPC_EXTENSION_MASK 0xF000 #define PTP_DPC_EXTENSION 0xD000 /* Zune extension device property codes */ #define PTP_DPC_MTP_ZUNE_UNKNOWN1 0xD181 #define PTP_DPC_MTP_ZUNE_UNKNOWN2 0xD132 #define PTP_DPC_MTP_ZUNE_UNKNOWN3 0xD215 #define PTP_DPC_MTP_ZUNE_UNKNOWN4 0xD216 /* Eastman Kodak extension device property codes */ #define PTP_DPC_EK_ColorTemperature 0xD001 #define PTP_DPC_EK_DateTimeStampFormat 0xD002 #define PTP_DPC_EK_BeepMode 0xD003 #define PTP_DPC_EK_VideoOut 0xD004 #define PTP_DPC_EK_PowerSaving 0xD005 #define PTP_DPC_EK_UI_Language 0xD006 /* Canon extension device property codes */ #define PTP_DPC_CANON_BeepMode 0xD001 #define PTP_DPC_CANON_BatteryKind 0xD002 #define PTP_DPC_CANON_BatteryStatus 0xD003 #define PTP_DPC_CANON_UILockType 0xD004 #define PTP_DPC_CANON_CameraMode 0xD005 #define PTP_DPC_CANON_ImageQuality 0xD006 #define PTP_DPC_CANON_FullViewFileFormat 0xD007 #define PTP_DPC_CANON_ImageSize 0xD008 #define PTP_DPC_CANON_SelfTime 0xD009 #define PTP_DPC_CANON_FlashMode 0xD00A #define PTP_DPC_CANON_Beep 0xD00B #define PTP_DPC_CANON_ShootingMode 0xD00C #define PTP_DPC_CANON_ImageMode 0xD00D #define PTP_DPC_CANON_DriveMode 0xD00E #define PTP_DPC_CANON_EZoom 0xD00F #define PTP_DPC_CANON_MeteringMode 0xD010 #define PTP_DPC_CANON_AFDistance 0xD011 #define PTP_DPC_CANON_FocusingPoint 0xD012 #define PTP_DPC_CANON_WhiteBalance 0xD013 #define PTP_DPC_CANON_SlowShutterSetting 0xD014 #define PTP_DPC_CANON_AFMode 0xD015 #define PTP_DPC_CANON_ImageStabilization 0xD016 #define PTP_DPC_CANON_Contrast 0xD017 #define PTP_DPC_CANON_ColorGain 0xD018 #define PTP_DPC_CANON_Sharpness 0xD019 #define PTP_DPC_CANON_Sensitivity 0xD01A #define PTP_DPC_CANON_ParameterSet 0xD01B #define PTP_DPC_CANON_ISOSpeed 0xD01C #define PTP_DPC_CANON_Aperture 0xD01D #define PTP_DPC_CANON_ShutterSpeed 0xD01E #define PTP_DPC_CANON_ExpCompensation 0xD01F #define PTP_DPC_CANON_FlashCompensation 0xD020 #define PTP_DPC_CANON_AEBExposureCompensation 0xD021 #define PTP_DPC_CANON_AvOpen 0xD023 #define PTP_DPC_CANON_AvMax 0xD024 #define PTP_DPC_CANON_FocalLength 0xD025 #define PTP_DPC_CANON_FocalLengthTele 0xD026 #define PTP_DPC_CANON_FocalLengthWide 0xD027 #define PTP_DPC_CANON_FocalLengthDenominator 0xD028 #define PTP_DPC_CANON_CaptureTransferMode 0xD029 #define CANON_TRANSFER_ENTIRE_IMAGE_TO_PC 0x0002 #define CANON_TRANSFER_SAVE_THUMBNAIL_TO_DEVICE 0x0004 #define CANON_TRANSFER_SAVE_IMAGE_TO_DEVICE 0x0008 /* we use those values: */ #define CANON_TRANSFER_MEMORY (2|1) #define CANON_TRANSFER_CARD (8|4|1) #define PTP_DPC_CANON_Zoom 0xD02A #define PTP_DPC_CANON_NamePrefix 0xD02B #define PTP_DPC_CANON_SizeQualityMode 0xD02C #define PTP_DPC_CANON_SupportedThumbSize 0xD02D #define PTP_DPC_CANON_SizeOfOutputDataFromCamera 0xD02E #define PTP_DPC_CANON_SizeOfInputDataToCamera 0xD02F #define PTP_DPC_CANON_RemoteAPIVersion 0xD030 #define PTP_DPC_CANON_FirmwareVersion 0xD031 #define PTP_DPC_CANON_CameraModel 0xD032 #define PTP_DPC_CANON_CameraOwner 0xD033 #define PTP_DPC_CANON_UnixTime 0xD034 #define PTP_DPC_CANON_CameraBodyID 0xD035 #define PTP_DPC_CANON_CameraOutput 0xD036 #define PTP_DPC_CANON_DispAv 0xD037 #define PTP_DPC_CANON_AvOpenApex 0xD038 #define PTP_DPC_CANON_DZoomMagnification 0xD039 #define PTP_DPC_CANON_MlSpotPos 0xD03A #define PTP_DPC_CANON_DispAvMax 0xD03B #define PTP_DPC_CANON_AvMaxApex 0xD03C #define PTP_DPC_CANON_EZoomStartPosition 0xD03D #define PTP_DPC_CANON_FocalLengthOfTele 0xD03E #define PTP_DPC_CANON_EZoomSizeOfTele 0xD03F #define PTP_DPC_CANON_PhotoEffect 0xD040 #define PTP_DPC_CANON_AssistLight 0xD041 #define PTP_DPC_CANON_FlashQuantityCount 0xD042 #define PTP_DPC_CANON_RotationAngle 0xD043 #define PTP_DPC_CANON_RotationScene 0xD044 #define PTP_DPC_CANON_EventEmulateMode 0xD045 #define PTP_DPC_CANON_DPOFVersion 0xD046 #define PTP_DPC_CANON_TypeOfSupportedSlideShow 0xD047 #define PTP_DPC_CANON_AverageFilesizes 0xD048 #define PTP_DPC_CANON_ModelID 0xD049 /* From EOS 400D trace. */ #define PTP_DPC_CANON_EOS_Aperture 0xD101 #define PTP_DPC_CANON_EOS_ShutterSpeed 0xD102 #define PTP_DPC_CANON_EOS_ISOSpeed 0xD103 #define PTP_DPC_CANON_EOS_ExpCompensation 0xD104 #define PTP_DPC_CANON_EOS_AutoExposureMode 0xD105 #define PTP_DPC_CANON_EOS_DriveMode 0xD106 #define PTP_DPC_CANON_EOS_MeteringMode 0xD107 #define PTP_DPC_CANON_EOS_FocusMode 0xD108 #define PTP_DPC_CANON_EOS_WhiteBalance 0xD109 #define PTP_DPC_CANON_EOS_ColorTemperature 0xD10A #define PTP_DPC_CANON_EOS_WhiteBalanceAdjustA 0xD10B #define PTP_DPC_CANON_EOS_WhiteBalanceAdjustB 0xD10C #define PTP_DPC_CANON_EOS_WhiteBalanceXA 0xD10D #define PTP_DPC_CANON_EOS_WhiteBalanceXB 0xD10E #define PTP_DPC_CANON_EOS_ColorSpace 0xD10F #define PTP_DPC_CANON_EOS_PictureStyle 0xD110 #define PTP_DPC_CANON_EOS_BatteryPower 0xD111 #define PTP_DPC_CANON_EOS_BatterySelect 0xD112 #define PTP_DPC_CANON_EOS_CameraTime 0xD113 #define PTP_DPC_CANON_EOS_AutoPowerOff 0xD114 #define PTP_DPC_CANON_EOS_Owner 0xD115 #define PTP_DPC_CANON_EOS_ModelID 0xD116 #define PTP_DPC_CANON_EOS_PTPExtensionVersion 0xD119 #define PTP_DPC_CANON_EOS_DPOFVersion 0xD11A #define PTP_DPC_CANON_EOS_AvailableShots 0xD11B #define PTP_CANON_EOS_CAPTUREDEST_HD 4 #define PTP_DPC_CANON_EOS_CaptureDestination 0xD11C #define PTP_DPC_CANON_EOS_BracketMode 0xD11D #define PTP_DPC_CANON_EOS_CurrentStorage 0xD11E #define PTP_DPC_CANON_EOS_CurrentFolder 0xD11F #define PTP_DPC_CANON_EOS_ImageFormat 0xD120 /* file setting */ #define PTP_DPC_CANON_EOS_ImageFormatCF 0xD121 /* file setting CF */ #define PTP_DPC_CANON_EOS_ImageFormatSD 0xD122 /* file setting SD */ #define PTP_DPC_CANON_EOS_ImageFormatExtHD 0xD123 /* file setting exthd */ #define PTP_DPC_CANON_EOS_CompressionS 0xD130 #define PTP_DPC_CANON_EOS_CompressionM1 0xD131 #define PTP_DPC_CANON_EOS_CompressionM2 0xD132 #define PTP_DPC_CANON_EOS_CompressionL 0xD133 #define PTP_DPC_CANON_EOS_AEModeDial 0xD138 #define PTP_DPC_CANON_EOS_AEModeCustom 0xD139 #define PTP_DPC_CANON_EOS_MirrorUpSetting 0xD13A #define PTP_DPC_CANON_EOS_HighlightTonePriority 0xD13B #define PTP_DPC_CANON_EOS_AFSelectFocusArea 0xD13C #define PTP_DPC_CANON_EOS_HDRSetting 0xD13D #define PTP_DPC_CANON_EOS_PCWhiteBalance1 0xD140 #define PTP_DPC_CANON_EOS_PCWhiteBalance2 0xD141 #define PTP_DPC_CANON_EOS_PCWhiteBalance3 0xD142 #define PTP_DPC_CANON_EOS_PCWhiteBalance4 0xD143 #define PTP_DPC_CANON_EOS_PCWhiteBalance5 0xD144 #define PTP_DPC_CANON_EOS_MWhiteBalance 0xD145 #define PTP_DPC_CANON_EOS_MWhiteBalanceEx 0xD146 #define PTP_DPC_CANON_EOS_UnknownPropD14D 0xD14D /*found in Canon EOS 5D M3*/ #define PTP_DPC_CANON_EOS_PictureStyleStandard 0xD150 #define PTP_DPC_CANON_EOS_PictureStylePortrait 0xD151 #define PTP_DPC_CANON_EOS_PictureStyleLandscape 0xD152 #define PTP_DPC_CANON_EOS_PictureStyleNeutral 0xD153 #define PTP_DPC_CANON_EOS_PictureStyleFaithful 0xD154 #define PTP_DPC_CANON_EOS_PictureStyleBlackWhite 0xD155 #define PTP_DPC_CANON_EOS_PictureStyleAuto 0xD156 #define PTP_DPC_CANON_EOS_PictureStyleUserSet1 0xD160 #define PTP_DPC_CANON_EOS_PictureStyleUserSet2 0xD161 #define PTP_DPC_CANON_EOS_PictureStyleUserSet3 0xD162 #define PTP_DPC_CANON_EOS_PictureStyleParam1 0xD170 #define PTP_DPC_CANON_EOS_PictureStyleParam2 0xD171 #define PTP_DPC_CANON_EOS_PictureStyleParam3 0xD172 #define PTP_DPC_CANON_EOS_HighISOSettingNoiseReduction 0xD178 #define PTP_DPC_CANON_EOS_MovieServoAF 0xD179 #define PTP_DPC_CANON_EOS_ContinuousAFValid 0xD17A #define PTP_DPC_CANON_EOS_Attenuator 0xD17B #define PTP_DPC_CANON_EOS_UTCTime 0xD17C #define PTP_DPC_CANON_EOS_Timezone 0xD17D #define PTP_DPC_CANON_EOS_Summertime 0xD17E #define PTP_DPC_CANON_EOS_FlavorLUTParams 0xD17F #define PTP_DPC_CANON_EOS_CustomFunc1 0xD180 #define PTP_DPC_CANON_EOS_CustomFunc2 0xD181 #define PTP_DPC_CANON_EOS_CustomFunc3 0xD182 #define PTP_DPC_CANON_EOS_CustomFunc4 0xD183 #define PTP_DPC_CANON_EOS_CustomFunc5 0xD184 #define PTP_DPC_CANON_EOS_CustomFunc6 0xD185 #define PTP_DPC_CANON_EOS_CustomFunc7 0xD186 #define PTP_DPC_CANON_EOS_CustomFunc8 0xD187 #define PTP_DPC_CANON_EOS_CustomFunc9 0xD188 #define PTP_DPC_CANON_EOS_CustomFunc10 0xD189 #define PTP_DPC_CANON_EOS_CustomFunc11 0xD18a #define PTP_DPC_CANON_EOS_CustomFunc12 0xD18b #define PTP_DPC_CANON_EOS_CustomFunc13 0xD18c #define PTP_DPC_CANON_EOS_CustomFunc14 0xD18d #define PTP_DPC_CANON_EOS_CustomFunc15 0xD18e #define PTP_DPC_CANON_EOS_CustomFunc16 0xD18f #define PTP_DPC_CANON_EOS_CustomFunc17 0xD190 #define PTP_DPC_CANON_EOS_CustomFunc18 0xD191 #define PTP_DPC_CANON_EOS_CustomFunc19 0xD192 #define PTP_DPC_CANON_EOS_CustomFunc19 0xD192 #define PTP_DPC_CANON_EOS_InnerDevelop 0xD193 #define PTP_DPC_CANON_EOS_MultiAspect 0xD194 #define PTP_DPC_CANON_EOS_MovieSoundRecord 0xD195 #define PTP_DPC_CANON_EOS_MovieRecordVolume 0xD196 #define PTP_DPC_CANON_EOS_WindCut 0xD197 #define PTP_DPC_CANON_EOS_ExtenderType 0xD198 #define PTP_DPC_CANON_EOS_OLCInfoVersion 0xD199 #define PTP_DPC_CANON_EOS_UnknownPropD19A 0xD19A /*found in Canon EOS 5D M3*/ #define PTP_DPC_CANON_EOS_UnknownPropD19C 0xD19C /*found in Canon EOS 5D M3*/ #define PTP_DPC_CANON_EOS_UnknownPropD19D 0xD19D /*found in Canon EOS 5D M3*/ #define PTP_DPC_CANON_EOS_CustomFuncEx 0xD1a0 #define PTP_DPC_CANON_EOS_MyMenu 0xD1a1 #define PTP_DPC_CANON_EOS_MyMenuList 0xD1a2 #define PTP_DPC_CANON_EOS_WftStatus 0xD1a3 #define PTP_DPC_CANON_EOS_WftInputTransmission 0xD1a4 #define PTP_DPC_CANON_EOS_HDDirectoryStructure 0xD1a5 #define PTP_DPC_CANON_EOS_BatteryInfo 0xD1a6 #define PTP_DPC_CANON_EOS_AdapterInfo 0xD1a7 #define PTP_DPC_CANON_EOS_LensStatus 0xD1a8 #define PTP_DPC_CANON_EOS_QuickReviewTime 0xD1a9 #define PTP_DPC_CANON_EOS_CardExtension 0xD1aa #define PTP_DPC_CANON_EOS_TempStatus 0xD1ab #define PTP_DPC_CANON_EOS_ShutterCounter 0xD1ac #define PTP_DPC_CANON_EOS_SpecialOption 0xD1ad #define PTP_DPC_CANON_EOS_PhotoStudioMode 0xD1ae #define PTP_DPC_CANON_EOS_SerialNumber 0xD1af #define PTP_DPC_CANON_EOS_EVFOutputDevice 0xD1b0 #define PTP_DPC_CANON_EOS_EVFMode 0xD1b1 #define PTP_DPC_CANON_EOS_DepthOfFieldPreview 0xD1b2 #define PTP_DPC_CANON_EOS_EVFSharpness 0xD1b3 #define PTP_DPC_CANON_EOS_EVFWBMode 0xD1b4 #define PTP_DPC_CANON_EOS_EVFClickWBCoeffs 0xD1b5 #define PTP_DPC_CANON_EOS_EVFColorTemp 0xD1b6 #define PTP_DPC_CANON_EOS_ExposureSimMode 0xD1b7 #define PTP_DPC_CANON_EOS_EVFRecordStatus 0xD1b8 #define PTP_DPC_CANON_EOS_LvAfSystem 0xD1ba #define PTP_DPC_CANON_EOS_MovSize 0xD1bb #define PTP_DPC_CANON_EOS_LvViewTypeSelect 0xD1bc #define PTP_DPC_CANON_EOS_MirrorDownStatus 0xD1bd #define PTP_DPC_CANON_EOS_MovieParam 0xD1be #define PTP_DPC_CANON_EOS_MirrorLockupState 0xD1bf #define PTP_DPC_CANON_EOS_FlashChargingState 0xD1C0 #define PTP_DPC_CANON_EOS_AloMode 0xD1C1 #define PTP_DPC_CANON_EOS_FixedMovie 0xD1C2 #define PTP_DPC_CANON_EOS_OneShotRawOn 0xD1C3 #define PTP_DPC_CANON_EOS_ErrorForDisplay 0xD1C4 #define PTP_DPC_CANON_EOS_AEModeMovie 0xD1C5 #define PTP_DPC_CANON_EOS_BuiltinStroboMode 0xD1C6 #define PTP_DPC_CANON_EOS_StroboDispState 0xD1C7 #define PTP_DPC_CANON_EOS_StroboETTL2Metering 0xD1C8 #define PTP_DPC_CANON_EOS_ContinousAFMode 0xD1C9 #define PTP_DPC_CANON_EOS_MovieParam2 0xD1CA #define PTP_DPC_CANON_EOS_StroboSettingExpComposition 0xD1CB #define PTP_DPC_CANON_EOS_MovieParam3 0xD1CC #define PTP_DPC_CANON_EOS_LVMedicalRotate 0xD1CF #define PTP_DPC_CANON_EOS_Artist 0xD1d0 #define PTP_DPC_CANON_EOS_Copyright 0xD1d1 #define PTP_DPC_CANON_EOS_BracketValue 0xD1d2 #define PTP_DPC_CANON_EOS_FocusInfoEx 0xD1d3 #define PTP_DPC_CANON_EOS_DepthOfField 0xD1d4 #define PTP_DPC_CANON_EOS_Brightness 0xD1d5 #define PTP_DPC_CANON_EOS_LensAdjustParams 0xD1d6 #define PTP_DPC_CANON_EOS_EFComp 0xD1d7 #define PTP_DPC_CANON_EOS_LensName 0xD1d8 #define PTP_DPC_CANON_EOS_AEB 0xD1d9 #define PTP_DPC_CANON_EOS_StroboSetting 0xD1da #define PTP_DPC_CANON_EOS_StroboWirelessSetting 0xD1db #define PTP_DPC_CANON_EOS_StroboFiring 0xD1dc #define PTP_DPC_CANON_EOS_LensID 0xD1dd #define PTP_DPC_CANON_EOS_LCDBrightness 0xD1de #define PTP_DPC_CANON_EOS_CADarkBright 0xD1df /* Nikon extension device property codes */ #define PTP_DPC_NIKON_ShootingBank 0xD010 #define PTP_DPC_NIKON_ShootingBankNameA 0xD011 #define PTP_DPC_NIKON_ShootingBankNameB 0xD012 #define PTP_DPC_NIKON_ShootingBankNameC 0xD013 #define PTP_DPC_NIKON_ShootingBankNameD 0xD014 #define PTP_DPC_NIKON_ResetBank0 0xD015 #define PTP_DPC_NIKON_RawCompression 0xD016 #define PTP_DPC_NIKON_WhiteBalanceAutoBias 0xD017 #define PTP_DPC_NIKON_WhiteBalanceTungstenBias 0xD018 #define PTP_DPC_NIKON_WhiteBalanceFluorescentBias 0xD019 #define PTP_DPC_NIKON_WhiteBalanceDaylightBias 0xD01A #define PTP_DPC_NIKON_WhiteBalanceFlashBias 0xD01B #define PTP_DPC_NIKON_WhiteBalanceCloudyBias 0xD01C #define PTP_DPC_NIKON_WhiteBalanceShadeBias 0xD01D #define PTP_DPC_NIKON_WhiteBalanceColorTemperature 0xD01E #define PTP_DPC_NIKON_WhiteBalancePresetNo 0xD01F #define PTP_DPC_NIKON_WhiteBalancePresetName0 0xD020 #define PTP_DPC_NIKON_WhiteBalancePresetName1 0xD021 #define PTP_DPC_NIKON_WhiteBalancePresetName2 0xD022 #define PTP_DPC_NIKON_WhiteBalancePresetName3 0xD023 #define PTP_DPC_NIKON_WhiteBalancePresetName4 0xD024 #define PTP_DPC_NIKON_WhiteBalancePresetVal0 0xD025 #define PTP_DPC_NIKON_WhiteBalancePresetVal1 0xD026 #define PTP_DPC_NIKON_WhiteBalancePresetVal2 0xD027 #define PTP_DPC_NIKON_WhiteBalancePresetVal3 0xD028 #define PTP_DPC_NIKON_WhiteBalancePresetVal4 0xD029 #define PTP_DPC_NIKON_ImageSharpening 0xD02A #define PTP_DPC_NIKON_ToneCompensation 0xD02B #define PTP_DPC_NIKON_ColorModel 0xD02C #define PTP_DPC_NIKON_HueAdjustment 0xD02D #define PTP_DPC_NIKON_NonCPULensDataFocalLength 0xD02E /* Set FMM Manual */ #define PTP_DPC_NIKON_NonCPULensDataMaximumAperture 0xD02F /* Set F0 Manual */ #define PTP_DPC_NIKON_ShootingMode 0xD030 #define PTP_DPC_NIKON_JPEG_Compression_Policy 0xD031 #define PTP_DPC_NIKON_ColorSpace 0xD032 #define PTP_DPC_NIKON_AutoDXCrop 0xD033 #define PTP_DPC_NIKON_FlickerReduction 0xD034 #define PTP_DPC_NIKON_RemoteMode 0xD035 #define PTP_DPC_NIKON_VideoMode 0xD036 #define PTP_DPC_NIKON_EffectMode 0xD037 #define PTP_DPC_NIKON_CSMMenuBankSelect 0xD040 #define PTP_DPC_NIKON_MenuBankNameA 0xD041 #define PTP_DPC_NIKON_MenuBankNameB 0xD042 #define PTP_DPC_NIKON_MenuBankNameC 0xD043 #define PTP_DPC_NIKON_MenuBankNameD 0xD044 #define PTP_DPC_NIKON_ResetBank 0xD045 #define PTP_DPC_NIKON_A1AFCModePriority 0xD048 #define PTP_DPC_NIKON_A2AFSModePriority 0xD049 #define PTP_DPC_NIKON_A3GroupDynamicAF 0xD04A #define PTP_DPC_NIKON_A4AFActivation 0xD04B #define PTP_DPC_NIKON_FocusAreaIllumManualFocus 0xD04C #define PTP_DPC_NIKON_FocusAreaIllumContinuous 0xD04D #define PTP_DPC_NIKON_FocusAreaIllumWhenSelected 0xD04E #define PTP_DPC_NIKON_FocusAreaWrap 0xD04F /* area sel */ #define PTP_DPC_NIKON_VerticalAFON 0xD050 #define PTP_DPC_NIKON_AFLockOn 0xD051 #define PTP_DPC_NIKON_FocusAreaZone 0xD052 #define PTP_DPC_NIKON_EnableCopyright 0xD053 #define PTP_DPC_NIKON_ISOAuto 0xD054 #define PTP_DPC_NIKON_EVISOStep 0xD055 #define PTP_DPC_NIKON_EVStep 0xD056 /* EV Step SS FN */ #define PTP_DPC_NIKON_EVStepExposureComp 0xD057 #define PTP_DPC_NIKON_ExposureCompensation 0xD058 #define PTP_DPC_NIKON_CenterWeightArea 0xD059 #define PTP_DPC_NIKON_ExposureBaseMatrix 0xD05A #define PTP_DPC_NIKON_ExposureBaseCenter 0xD05B #define PTP_DPC_NIKON_ExposureBaseSpot 0xD05C #define PTP_DPC_NIKON_LiveViewAFArea 0xD05D /* FIXME: AfAtLiveview? */ #define PTP_DPC_NIKON_AELockMode 0xD05E #define PTP_DPC_NIKON_AELAFLMode 0xD05F #define PTP_DPC_NIKON_LiveViewAFFocus 0xD061 #define PTP_DPC_NIKON_MeterOff 0xD062 #define PTP_DPC_NIKON_SelfTimer 0xD063 #define PTP_DPC_NIKON_MonitorOff 0xD064 #define PTP_DPC_NIKON_ImgConfTime 0xD065 #define PTP_DPC_NIKON_AutoOffTimers 0xD066 #define PTP_DPC_NIKON_AngleLevel 0xD067 #define PTP_DPC_NIKON_D1ShootingSpeed 0xD068 /* continous speed low */ #define PTP_DPC_NIKON_D2MaximumShots 0xD069 #define PTP_DPC_NIKON_ExposureDelayMode 0xD06A #define PTP_DPC_NIKON_LongExposureNoiseReduction 0xD06B #define PTP_DPC_NIKON_FileNumberSequence 0xD06C #define PTP_DPC_NIKON_ControlPanelFinderRearControl 0xD06D #define PTP_DPC_NIKON_ControlPanelFinderViewfinder 0xD06E #define PTP_DPC_NIKON_D7Illumination 0xD06F #define PTP_DPC_NIKON_NrHighISO 0xD070 #define PTP_DPC_NIKON_SHSET_CH_GUID_DISP 0xD071 #define PTP_DPC_NIKON_ArtistName 0xD072 #define PTP_DPC_NIKON_CopyrightInfo 0xD073 #define PTP_DPC_NIKON_FlashSyncSpeed 0xD074 #define PTP_DPC_NIKON_FlashShutterSpeed 0xD075 /* SB Low Limit */ #define PTP_DPC_NIKON_E3AAFlashMode 0xD076 #define PTP_DPC_NIKON_E4ModelingFlash 0xD077 #define PTP_DPC_NIKON_BracketSet 0xD078 /* Bracket Type? */ #define PTP_DPC_NIKON_E6ManualModeBracketing 0xD079 /* Bracket Factor? */ #define PTP_DPC_NIKON_BracketOrder 0xD07A #define PTP_DPC_NIKON_E8AutoBracketSelection 0xD07B /* Bracket Method? */ #define PTP_DPC_NIKON_BracketingSet 0xD07C #define PTP_DPC_NIKON_F1CenterButtonShootingMode 0xD080 #define PTP_DPC_NIKON_CenterButtonPlaybackMode 0xD081 #define PTP_DPC_NIKON_F2Multiselector 0xD082 #define PTP_DPC_NIKON_F3PhotoInfoPlayback 0xD083 /* MultiSelector Dir */ #define PTP_DPC_NIKON_F4AssignFuncButton 0xD084 /* CMD Dial Rotate */ #define PTP_DPC_NIKON_F5CustomizeCommDials 0xD085 /* CMD Dial Change */ #define PTP_DPC_NIKON_ReverseCommandDial 0xD086 /* CMD Dial FN Set */ #define PTP_DPC_NIKON_ApertureSetting 0xD087 /* CMD Dial Active */ #define PTP_DPC_NIKON_MenusAndPlayback 0xD088 /* CMD Dial Active */ #define PTP_DPC_NIKON_F6ButtonsAndDials 0xD089 /* Universal Mode? */ #define PTP_DPC_NIKON_NoCFCard 0xD08A /* Enable Shutter? */ #define PTP_DPC_NIKON_CenterButtonZoomRatio 0xD08B #define PTP_DPC_NIKON_FunctionButton2 0xD08C #define PTP_DPC_NIKON_AFAreaPoint 0xD08D #define PTP_DPC_NIKON_NormalAFOn 0xD08E #define PTP_DPC_NIKON_CleanImageSensor 0xD08F #define PTP_DPC_NIKON_ImageCommentString 0xD090 #define PTP_DPC_NIKON_ImageCommentEnable 0xD091 #define PTP_DPC_NIKON_ImageRotation 0xD092 #define PTP_DPC_NIKON_ManualSetLensNo 0xD093 #define PTP_DPC_NIKON_MovScreenSize 0xD0A0 #define PTP_DPC_NIKON_MovVoice 0xD0A1 #define PTP_DPC_NIKON_MovMicrophone 0xD0A2 #define PTP_DPC_NIKON_MovFileSlot 0xD0A3 #define PTP_DPC_NIKON_MovRecProhibitCondition 0xD0A4 #define PTP_DPC_NIKON_ManualMovieSetting 0xD0A6 #define PTP_DPC_NIKON_LiveViewScreenDisplaySetting 0xD0B2 #define PTP_DPC_NIKON_MonitorOffDelay 0xD0B3 #define PTP_DPC_NIKON_Bracketing 0xD0C0 #define PTP_DPC_NIKON_AutoExposureBracketStep 0xD0C1 #define PTP_DPC_NIKON_AutoExposureBracketProgram 0xD0C2 #define PTP_DPC_NIKON_AutoExposureBracketCount 0xD0C3 #define PTP_DPC_NIKON_WhiteBalanceBracketStep 0xD0C4 #define PTP_DPC_NIKON_WhiteBalanceBracketProgram 0xD0C5 #define PTP_DPC_NIKON_LensID 0xD0E0 #define PTP_DPC_NIKON_LensSort 0xD0E1 #define PTP_DPC_NIKON_LensType 0xD0E2 #define PTP_DPC_NIKON_FocalLengthMin 0xD0E3 #define PTP_DPC_NIKON_FocalLengthMax 0xD0E4 #define PTP_DPC_NIKON_MaxApAtMinFocalLength 0xD0E5 #define PTP_DPC_NIKON_MaxApAtMaxFocalLength 0xD0E6 #define PTP_DPC_NIKON_FinderISODisp 0xD0F0 #define PTP_DPC_NIKON_AutoOffPhoto 0xD0F2 #define PTP_DPC_NIKON_AutoOffMenu 0xD0F3 #define PTP_DPC_NIKON_AutoOffInfo 0xD0F4 #define PTP_DPC_NIKON_SelfTimerShootNum 0xD0F5 #define PTP_DPC_NIKON_VignetteCtrl 0xD0F7 #define PTP_DPC_NIKON_AutoDistortionControl 0xD0F8 #define PTP_DPC_NIKON_SceneMode 0xD0F9 #define PTP_DPC_NIKON_SceneMode2 0xD0FD #define PTP_DPC_NIKON_SelfTimerInterval 0xD0FE #define PTP_DPC_NIKON_ExposureTime 0xD100 /* Shutter Speed */ #define PTP_DPC_NIKON_ACPower 0xD101 #define PTP_DPC_NIKON_WarningStatus 0xD102 #define PTP_DPC_NIKON_MaximumShots 0xD103 /* remain shots (in RAM buffer?) */ #define PTP_DPC_NIKON_AFLockStatus 0xD104 #define PTP_DPC_NIKON_AELockStatus 0xD105 #define PTP_DPC_NIKON_FVLockStatus 0xD106 #define PTP_DPC_NIKON_AutofocusLCDTopMode2 0xD107 #define PTP_DPC_NIKON_AutofocusArea 0xD108 #define PTP_DPC_NIKON_FlexibleProgram 0xD109 #define PTP_DPC_NIKON_LightMeter 0xD10A /* Exposure Status */ #define PTP_DPC_NIKON_RecordingMedia 0xD10B /* Card or SDRAM */ #define PTP_DPC_NIKON_USBSpeed 0xD10C #define PTP_DPC_NIKON_CCDNumber 0xD10D #define PTP_DPC_NIKON_CameraOrientation 0xD10E #define PTP_DPC_NIKON_GroupPtnType 0xD10F #define PTP_DPC_NIKON_FNumberLock 0xD110 #define PTP_DPC_NIKON_ExposureApertureLock 0xD111 /* shutterspeed lock*/ #define PTP_DPC_NIKON_TVLockSetting 0xD112 #define PTP_DPC_NIKON_AVLockSetting 0xD113 #define PTP_DPC_NIKON_IllumSetting 0xD114 #define PTP_DPC_NIKON_FocusPointBright 0xD115 #define PTP_DPC_NIKON_ExternalFlashAttached 0xD120 #define PTP_DPC_NIKON_ExternalFlashStatus 0xD121 #define PTP_DPC_NIKON_ExternalFlashSort 0xD122 #define PTP_DPC_NIKON_ExternalFlashMode 0xD123 #define PTP_DPC_NIKON_ExternalFlashCompensation 0xD124 #define PTP_DPC_NIKON_NewExternalFlashMode 0xD125 #define PTP_DPC_NIKON_FlashExposureCompensation 0xD126 #define PTP_DPC_NIKON_HDRMode 0xD130 #define PTP_DPC_NIKON_HDRHighDynamic 0xD131 #define PTP_DPC_NIKON_HDRSmoothing 0xD132 #define PTP_DPC_NIKON_OptimizeImage 0xD140 #define PTP_DPC_NIKON_Saturation 0xD142 #define PTP_DPC_NIKON_BW_FillerEffect 0xD143 #define PTP_DPC_NIKON_BW_Sharpness 0xD144 #define PTP_DPC_NIKON_BW_Contrast 0xD145 #define PTP_DPC_NIKON_BW_Setting_Type 0xD146 #define PTP_DPC_NIKON_Slot2SaveMode 0xD148 #define PTP_DPC_NIKON_RawBitMode 0xD149 #define PTP_DPC_NIKON_ActiveDLighting 0xD14E /* was PTP_DPC_NIKON_ISOAutoTime */ #define PTP_DPC_NIKON_FlourescentType 0xD14F #define PTP_DPC_NIKON_TuneColourTemperature 0xD150 #define PTP_DPC_NIKON_TunePreset0 0xD151 #define PTP_DPC_NIKON_TunePreset1 0xD152 #define PTP_DPC_NIKON_TunePreset2 0xD153 #define PTP_DPC_NIKON_TunePreset3 0xD154 #define PTP_DPC_NIKON_TunePreset4 0xD155 #define PTP_DPC_NIKON_BeepOff 0xD160 #define PTP_DPC_NIKON_AutofocusMode 0xD161 #define PTP_DPC_NIKON_AFAssist 0xD163 #define PTP_DPC_NIKON_PADVPMode 0xD164 /* iso auto time */ #define PTP_DPC_NIKON_ImageReview 0xD165 #define PTP_DPC_NIKON_AFAreaIllumination 0xD166 #define PTP_DPC_NIKON_FlashMode 0xD167 #define PTP_DPC_NIKON_FlashCommanderMode 0xD168 #define PTP_DPC_NIKON_FlashSign 0xD169 #define PTP_DPC_NIKON_ISO_Auto 0xD16A #define PTP_DPC_NIKON_RemoteTimeout 0xD16B #define PTP_DPC_NIKON_GridDisplay 0xD16C #define PTP_DPC_NIKON_FlashModeManualPower 0xD16D #define PTP_DPC_NIKON_FlashModeCommanderPower 0xD16E #define PTP_DPC_NIKON_AutoFP 0xD16F #define PTP_DPC_NIKON_DateImprintSetting 0xD170 #define PTP_DPC_NIKON_DateCounterSelect 0xD171 #define PTP_DPC_NIKON_DateCountData 0xD172 #define PTP_DPC_NIKON_DateCountDisplaySetting 0xD173 #define PTP_DPC_NIKON_RangeFinderSetting 0xD174 #define PTP_DPC_NIKON_CSMMenu 0xD180 #define PTP_DPC_NIKON_WarningDisplay 0xD181 #define PTP_DPC_NIKON_BatteryCellKind 0xD182 #define PTP_DPC_NIKON_ISOAutoHiLimit 0xD183 #define PTP_DPC_NIKON_DynamicAFArea 0xD184 #define PTP_DPC_NIKON_ContinuousSpeedHigh 0xD186 #define PTP_DPC_NIKON_InfoDispSetting 0xD187 #define PTP_DPC_NIKON_PreviewButton 0xD189 #define PTP_DPC_NIKON_PreviewButton2 0xD18A #define PTP_DPC_NIKON_AEAFLockButton2 0xD18B #define PTP_DPC_NIKON_IndicatorDisp 0xD18D #define PTP_DPC_NIKON_CellKindPriority 0xD18E #define PTP_DPC_NIKON_BracketingFramesAndSteps 0xD190 #define PTP_DPC_NIKON_LiveViewMode 0xD1A0 #define PTP_DPC_NIKON_LiveViewDriveMode 0xD1A1 #define PTP_DPC_NIKON_LiveViewStatus 0xD1A2 #define PTP_DPC_NIKON_LiveViewImageZoomRatio 0xD1A3 #define PTP_DPC_NIKON_LiveViewProhibitCondition 0xD1A4 #define PTP_DPC_NIKON_ExposureDisplayStatus 0xD1B0 #define PTP_DPC_NIKON_ExposureIndicateStatus 0xD1B1 #define PTP_DPC_NIKON_InfoDispErrStatus 0xD1B2 #define PTP_DPC_NIKON_ExposureIndicateLightup 0xD1B3 #define PTP_DPC_NIKON_FlashOpen 0xD1C0 #define PTP_DPC_NIKON_FlashCharged 0xD1C1 #define PTP_DPC_NIKON_FlashMRepeatValue 0xD1D0 #define PTP_DPC_NIKON_FlashMRepeatCount 0xD1D1 #define PTP_DPC_NIKON_FlashMRepeatInterval 0xD1D2 #define PTP_DPC_NIKON_FlashCommandChannel 0xD1D3 #define PTP_DPC_NIKON_FlashCommandSelfMode 0xD1D4 #define PTP_DPC_NIKON_FlashCommandSelfCompensation 0xD1D5 #define PTP_DPC_NIKON_FlashCommandSelfValue 0xD1D6 #define PTP_DPC_NIKON_FlashCommandAMode 0xD1D7 #define PTP_DPC_NIKON_FlashCommandACompensation 0xD1D8 #define PTP_DPC_NIKON_FlashCommandAValue 0xD1D9 #define PTP_DPC_NIKON_FlashCommandBMode 0xD1DA #define PTP_DPC_NIKON_FlashCommandBCompensation 0xD1DB #define PTP_DPC_NIKON_FlashCommandBValue 0xD1DC #define PTP_DPC_NIKON_ApplicationMode 0xD1F0 #define PTP_DPC_NIKON_ActiveSlot 0xD1F2 #define PTP_DPC_NIKON_ActivePicCtrlItem 0xD200 #define PTP_DPC_NIKON_ChangePicCtrlItem 0xD201 /* Nikon V1 (or WU adapter?) Trace */ /* d241 - gets string "Nikon_WU2_0090B5123C61" */ #define PTP_DPC_NIKON_D241 0xD241 /* d244 - gets a single byte 0x00 */ #define PTP_DPC_NIKON_D244 0xD244 /* d247 - gets 3 bytes 0x01 0x00 0x00 */ #define PTP_DPC_NIKON_D247 0xD247 /* d250 - gets a string "0000123C61" */ #define PTP_DPC_NIKON_D250 0xD250 /* d251 - gets a 0x0100000d */ #define PTP_DPC_NIKON_D251 0xD251 /* Fuji specific */ #define PTP_DPC_FUJI_ColorTemperature 0xD017 #define PTP_DPC_FUJI_Quality 0xD018 #define PTP_DPC_FUJI_ReleaseMode 0xD201 #define PTP_DPC_FUJI_FocusAreas 0xD206 #define PTP_DPC_FUJI_AELock 0xD213 #define PTP_DPC_FUJI_Aperture 0xD218 #define PTP_DPC_FUJI_ShutterSpeed 0xD219 /* Microsoft/MTP specific */ #define PTP_DPC_MTP_SecureTime 0xD101 #define PTP_DPC_MTP_DeviceCertificate 0xD102 #define PTP_DPC_MTP_RevocationInfo 0xD103 #define PTP_DPC_MTP_SynchronizationPartner 0xD401 #define PTP_DPC_MTP_DeviceFriendlyName 0xD402 #define PTP_DPC_MTP_VolumeLevel 0xD403 #define PTP_DPC_MTP_DeviceIcon 0xD405 #define PTP_DPC_MTP_SessionInitiatorInfo 0xD406 #define PTP_DPC_MTP_PerceivedDeviceType 0xD407 #define PTP_DPC_MTP_PlaybackRate 0xD410 #define PTP_DPC_MTP_PlaybackObject 0xD411 #define PTP_DPC_MTP_PlaybackContainerIndex 0xD412 #define PTP_DPC_MTP_PlaybackPosition 0xD413 #define PTP_DPC_MTP_PlaysForSureID 0xD131 /* Zune specific property codes */ #define PTP_DPC_MTP_Zune_UnknownVersion 0xD181 /* Olympus */ #define PTP_DPC_OLYMPUS_ResolutionMode 0xD102 #define PTP_DPC_OLYMPUS_FocusPriority 0xD103 #define PTP_DPC_OLYMPUS_DriveMode 0xD104 #define PTP_DPC_OLYMPUS_DateTimeFormat 0xD105 #define PTP_DPC_OLYMPUS_ExposureBiasStep 0xD106 #define PTP_DPC_OLYMPUS_WBMode 0xD107 #define PTP_DPC_OLYMPUS_OneTouchWB 0xD108 #define PTP_DPC_OLYMPUS_ManualWB 0xD109 #define PTP_DPC_OLYMPUS_ManualWBRBBias 0xD10A #define PTP_DPC_OLYMPUS_CustomWB 0xD10B #define PTP_DPC_OLYMPUS_CustomWBValue 0xD10C #define PTP_DPC_OLYMPUS_ExposureTimeEx 0xD10D #define PTP_DPC_OLYMPUS_BulbMode 0xD10E #define PTP_DPC_OLYMPUS_AntiMirrorMode 0xD10F #define PTP_DPC_OLYMPUS_AEBracketingFrame 0xD110 #define PTP_DPC_OLYMPUS_AEBracketingStep 0xD111 #define PTP_DPC_OLYMPUS_WBBracketingFrame 0xD112 #define PTP_DPC_OLYMPUS_WBBracketingRBFrame 0xD112 /* dup ? */ #define PTP_DPC_OLYMPUS_WBBracketingRBRange 0xD113 #define PTP_DPC_OLYMPUS_WBBracketingGMFrame 0xD114 #define PTP_DPC_OLYMPUS_WBBracketingGMRange 0xD115 #define PTP_DPC_OLYMPUS_FLBracketingFrame 0xD118 #define PTP_DPC_OLYMPUS_FLBracketingStep 0xD119 #define PTP_DPC_OLYMPUS_FlashBiasCompensation 0xD11A #define PTP_DPC_OLYMPUS_ManualFocusMode 0xD11B #define PTP_DPC_OLYMPUS_RawSaveMode 0xD11D #define PTP_DPC_OLYMPUS_AUXLightMode 0xD11E #define PTP_DPC_OLYMPUS_LensSinkMode 0xD11F #define PTP_DPC_OLYMPUS_BeepStatus 0xD120 #define PTP_DPC_OLYMPUS_ColorSpace 0xD122 #define PTP_DPC_OLYMPUS_ColorMatching 0xD123 #define PTP_DPC_OLYMPUS_Saturation 0xD124 #define PTP_DPC_OLYMPUS_NoiseReductionPattern 0xD126 #define PTP_DPC_OLYMPUS_NoiseReductionRandom 0xD127 #define PTP_DPC_OLYMPUS_ShadingMode 0xD129 #define PTP_DPC_OLYMPUS_ISOBoostMode 0xD12A #define PTP_DPC_OLYMPUS_ExposureIndexBiasStep 0xD12B #define PTP_DPC_OLYMPUS_FilterEffect 0xD12C #define PTP_DPC_OLYMPUS_ColorTune 0xD12D #define PTP_DPC_OLYMPUS_Language 0xD12E #define PTP_DPC_OLYMPUS_LanguageCode 0xD12F #define PTP_DPC_OLYMPUS_RecviewMode 0xD130 #define PTP_DPC_OLYMPUS_SleepTime 0xD131 #define PTP_DPC_OLYMPUS_ManualWBGMBias 0xD132 #define PTP_DPC_OLYMPUS_AELAFLMode 0xD135 #define PTP_DPC_OLYMPUS_AELButtonStatus 0xD136 #define PTP_DPC_OLYMPUS_CompressionSettingEx 0xD137 #define PTP_DPC_OLYMPUS_ToneMode 0xD139 #define PTP_DPC_OLYMPUS_GradationMode 0xD13A #define PTP_DPC_OLYMPUS_DevelopMode 0xD13B #define PTP_DPC_OLYMPUS_ExtendInnerFlashMode 0xD13C #define PTP_DPC_OLYMPUS_OutputDeviceMode 0xD13D #define PTP_DPC_OLYMPUS_LiveViewMode 0xD13E #define PTP_DPC_OLYMPUS_LCDBacklight 0xD140 #define PTP_DPC_OLYMPUS_CustomDevelop 0xD141 #define PTP_DPC_OLYMPUS_GradationAutoBias 0xD142 #define PTP_DPC_OLYMPUS_FlashRCMode 0xD143 #define PTP_DPC_OLYMPUS_FlashRCGroupValue 0xD144 #define PTP_DPC_OLYMPUS_FlashRCChannelValue 0xD145 #define PTP_DPC_OLYMPUS_FlashRCFPMode 0xD146 #define PTP_DPC_OLYMPUS_FlashRCPhotoChromicMode 0xD147 #define PTP_DPC_OLYMPUS_FlashRCPhotoChromicBias 0xD148 #define PTP_DPC_OLYMPUS_FlashRCPhotoChromicManualBias 0xD149 #define PTP_DPC_OLYMPUS_FlashRCQuantityLightLevel 0xD14A #define PTP_DPC_OLYMPUS_FocusMeteringValue 0xD14B #define PTP_DPC_OLYMPUS_ISOBracketingFrame 0xD14C #define PTP_DPC_OLYMPUS_ISOBracketingStep 0xD14D #define PTP_DPC_OLYMPUS_BulbMFMode 0xD14E #define PTP_DPC_OLYMPUS_BurstFPSValue 0xD14F #define PTP_DPC_OLYMPUS_ISOAutoBaseValue 0xD150 #define PTP_DPC_OLYMPUS_ISOAutoMaxValue 0xD151 #define PTP_DPC_OLYMPUS_BulbLimiterValue 0xD152 #define PTP_DPC_OLYMPUS_DPIMode 0xD153 #define PTP_DPC_OLYMPUS_DPICustomValue 0xD154 #define PTP_DPC_OLYMPUS_ResolutionValueSetting 0xD155 #define PTP_DPC_OLYMPUS_AFTargetSize 0xD157 #define PTP_DPC_OLYMPUS_LightSensorMode 0xD158 #define PTP_DPC_OLYMPUS_AEBracket 0xD159 #define PTP_DPC_OLYMPUS_WBRBBracket 0xD15A #define PTP_DPC_OLYMPUS_WBGMBracket 0xD15B #define PTP_DPC_OLYMPUS_FlashBracket 0xD15C #define PTP_DPC_OLYMPUS_ISOBracket 0xD15D #define PTP_DPC_OLYMPUS_MyModeStatus 0xD15E /* Sony A900 */ #define PTP_DPC_SONY_DPCCompensation 0xD200 #define PTP_DPC_SONY_DRangeOptimize 0xD201 #define PTP_DPC_SONY_ImageSize 0xD203 #define PTP_DPC_SONY_ShutterSpeed 0xD20D #define PTP_DPC_SONY_ColorTemp 0xD20F #define PTP_DPC_SONY_CCFilter 0xD210 #define PTP_DPC_SONY_AspectRatio 0xD211 #define PTP_DPC_SONY_ExposeIndex 0xD216 #define PTP_DPC_SONY_PictureEffect 0xD21B #define PTP_DPC_SONY_ABFilter 0xD21C #define PTP_DPC_SONY_ISO 0xD21E /* ? */ /* also seen: D2C3 D2C4 */ /* semi control opcodes */ #define PTP_DPC_SONY_Movie 0xD2C8 /* ? */ #define PTP_DPC_SONY_StillImage 0xD2C7 /* ? */ /* Casio EX-F1 */ #define PTP_DPC_CASIO_MONITOR 0xD001 #define PTP_DPC_CASIO_STORAGE 0xD002 //Not reported by DeviceInfo? #define PTP_DPC_CASIO_UNKNOWN_1 0xD004 #define PTP_DPC_CASIO_UNKNOWN_2 0xD005 #define PTP_DPC_CASIO_UNKNOWN_3 0xD007 #define PTP_DPC_CASIO_RECORD_LIGHT 0xD008 #define PTP_DPC_CASIO_UNKNOWN_4 0xD009 #define PTP_DPC_CASIO_UNKNOWN_5 0xD00A #define PTP_DPC_CASIO_MOVIE_MODE 0xD00B #define PTP_DPC_CASIO_HD_SETTING 0xD00C #define PTP_DPC_CASIO_HS_SETTING 0xD00D #define PTP_DPC_CASIO_CS_HIGH_SPEED 0xD00F #define PTP_DPC_CASIO_CS_UPPER_LIMIT 0xD010 #define PTP_DPC_CASIO_CS_SHOT 0xD011 #define PTP_DPC_CASIO_UNKNOWN_6 0xD012 #define PTP_DPC_CASIO_UNKNOWN_7 0xD013 #define PTP_DPC_CASIO_UNKNOWN_8 0xD015 #define PTP_DPC_CASIO_UNKNOWN_9 0xD017 #define PTP_DPC_CASIO_UNKNOWN_10 0xD018 #define PTP_DPC_CASIO_UNKNOWN_11 0xD019 #define PTP_DPC_CASIO_UNKNOWN_12 0xD01A #define PTP_DPC_CASIO_UNKNOWN_13 0xD01B #define PTP_DPC_CASIO_UNKNOWN_14 0xD01C #define PTP_DPC_CASIO_UNKNOWN_15 0xD01D #define PTP_DPC_CASIO_UNKNOWN_16 0xD020 #define PTP_DPC_CASIO_UNKNOWN_17 0xD030 #define PTP_DPC_CASIO_UNKNOWN_18 0xD080 /* MTP specific Object Properties */ #define PTP_OPC_StorageID 0xDC01 #define PTP_OPC_ObjectFormat 0xDC02 #define PTP_OPC_ProtectionStatus 0xDC03 #define PTP_OPC_ObjectSize 0xDC04 #define PTP_OPC_AssociationType 0xDC05 #define PTP_OPC_AssociationDesc 0xDC06 #define PTP_OPC_ObjectFileName 0xDC07 #define PTP_OPC_DateCreated 0xDC08 #define PTP_OPC_DateModified 0xDC09 #define PTP_OPC_Keywords 0xDC0A #define PTP_OPC_ParentObject 0xDC0B #define PTP_OPC_AllowedFolderContents 0xDC0C #define PTP_OPC_Hidden 0xDC0D #define PTP_OPC_SystemObject 0xDC0E #define PTP_OPC_PersistantUniqueObjectIdentifier 0xDC41 #define PTP_OPC_SyncID 0xDC42 #define PTP_OPC_PropertyBag 0xDC43 #define PTP_OPC_Name 0xDC44 #define PTP_OPC_CreatedBy 0xDC45 #define PTP_OPC_Artist 0xDC46 #define PTP_OPC_DateAuthored 0xDC47 #define PTP_OPC_Description 0xDC48 #define PTP_OPC_URLReference 0xDC49 #define PTP_OPC_LanguageLocale 0xDC4A #define PTP_OPC_CopyrightInformation 0xDC4B #define PTP_OPC_Source 0xDC4C #define PTP_OPC_OriginLocation 0xDC4D #define PTP_OPC_DateAdded 0xDC4E #define PTP_OPC_NonConsumable 0xDC4F #define PTP_OPC_CorruptOrUnplayable 0xDC50 #define PTP_OPC_ProducerSerialNumber 0xDC51 #define PTP_OPC_RepresentativeSampleFormat 0xDC81 #define PTP_OPC_RepresentativeSampleSize 0xDC82 #define PTP_OPC_RepresentativeSampleHeight 0xDC83 #define PTP_OPC_RepresentativeSampleWidth 0xDC84 #define PTP_OPC_RepresentativeSampleDuration 0xDC85 #define PTP_OPC_RepresentativeSampleData 0xDC86 #define PTP_OPC_Width 0xDC87 #define PTP_OPC_Height 0xDC88 #define PTP_OPC_Duration 0xDC89 #define PTP_OPC_Rating 0xDC8A #define PTP_OPC_Track 0xDC8B #define PTP_OPC_Genre 0xDC8C #define PTP_OPC_Credits 0xDC8D #define PTP_OPC_Lyrics 0xDC8E #define PTP_OPC_SubscriptionContentID 0xDC8F #define PTP_OPC_ProducedBy 0xDC90 #define PTP_OPC_UseCount 0xDC91 #define PTP_OPC_SkipCount 0xDC92 #define PTP_OPC_LastAccessed 0xDC93 #define PTP_OPC_ParentalRating 0xDC94 #define PTP_OPC_MetaGenre 0xDC95 #define PTP_OPC_Composer 0xDC96 #define PTP_OPC_EffectiveRating 0xDC97 #define PTP_OPC_Subtitle 0xDC98 #define PTP_OPC_OriginalReleaseDate 0xDC99 #define PTP_OPC_AlbumName 0xDC9A #define PTP_OPC_AlbumArtist 0xDC9B #define PTP_OPC_Mood 0xDC9C #define PTP_OPC_DRMStatus 0xDC9D #define PTP_OPC_SubDescription 0xDC9E #define PTP_OPC_IsCropped 0xDCD1 #define PTP_OPC_IsColorCorrected 0xDCD2 #define PTP_OPC_ImageBitDepth 0xDCD3 #define PTP_OPC_Fnumber 0xDCD4 #define PTP_OPC_ExposureTime 0xDCD5 #define PTP_OPC_ExposureIndex 0xDCD6 #define PTP_OPC_DisplayName 0xDCE0 #define PTP_OPC_BodyText 0xDCE1 #define PTP_OPC_Subject 0xDCE2 #define PTP_OPC_Priority 0xDCE3 #define PTP_OPC_GivenName 0xDD00 #define PTP_OPC_MiddleNames 0xDD01 #define PTP_OPC_FamilyName 0xDD02 #define PTP_OPC_Prefix 0xDD03 #define PTP_OPC_Suffix 0xDD04 #define PTP_OPC_PhoneticGivenName 0xDD05 #define PTP_OPC_PhoneticFamilyName 0xDD06 #define PTP_OPC_EmailPrimary 0xDD07 #define PTP_OPC_EmailPersonal1 0xDD08 #define PTP_OPC_EmailPersonal2 0xDD09 #define PTP_OPC_EmailBusiness1 0xDD0A #define PTP_OPC_EmailBusiness2 0xDD0B #define PTP_OPC_EmailOthers 0xDD0C #define PTP_OPC_PhoneNumberPrimary 0xDD0D #define PTP_OPC_PhoneNumberPersonal 0xDD0E #define PTP_OPC_PhoneNumberPersonal2 0xDD0F #define PTP_OPC_PhoneNumberBusiness 0xDD10 #define PTP_OPC_PhoneNumberBusiness2 0xDD11 #define PTP_OPC_PhoneNumberMobile 0xDD12 #define PTP_OPC_PhoneNumberMobile2 0xDD13 #define PTP_OPC_FaxNumberPrimary 0xDD14 #define PTP_OPC_FaxNumberPersonal 0xDD15 #define PTP_OPC_FaxNumberBusiness 0xDD16 #define PTP_OPC_PagerNumber 0xDD17 #define PTP_OPC_PhoneNumberOthers 0xDD18 #define PTP_OPC_PrimaryWebAddress 0xDD19 #define PTP_OPC_PersonalWebAddress 0xDD1A #define PTP_OPC_BusinessWebAddress 0xDD1B #define PTP_OPC_InstantMessengerAddress 0xDD1C #define PTP_OPC_InstantMessengerAddress2 0xDD1D #define PTP_OPC_InstantMessengerAddress3 0xDD1E #define PTP_OPC_PostalAddressPersonalFull 0xDD1F #define PTP_OPC_PostalAddressPersonalFullLine1 0xDD20 #define PTP_OPC_PostalAddressPersonalFullLine2 0xDD21 #define PTP_OPC_PostalAddressPersonalFullCity 0xDD22 #define PTP_OPC_PostalAddressPersonalFullRegion 0xDD23 #define PTP_OPC_PostalAddressPersonalFullPostalCode 0xDD24 #define PTP_OPC_PostalAddressPersonalFullCountry 0xDD25 #define PTP_OPC_PostalAddressBusinessFull 0xDD26 #define PTP_OPC_PostalAddressBusinessLine1 0xDD27 #define PTP_OPC_PostalAddressBusinessLine2 0xDD28 #define PTP_OPC_PostalAddressBusinessCity 0xDD29 #define PTP_OPC_PostalAddressBusinessRegion 0xDD2A #define PTP_OPC_PostalAddressBusinessPostalCode 0xDD2B #define PTP_OPC_PostalAddressBusinessCountry 0xDD2C #define PTP_OPC_PostalAddressOtherFull 0xDD2D #define PTP_OPC_PostalAddressOtherLine1 0xDD2E #define PTP_OPC_PostalAddressOtherLine2 0xDD2F #define PTP_OPC_PostalAddressOtherCity 0xDD30 #define PTP_OPC_PostalAddressOtherRegion 0xDD31 #define PTP_OPC_PostalAddressOtherPostalCode 0xDD32 #define PTP_OPC_PostalAddressOtherCountry 0xDD33 #define PTP_OPC_OrganizationName 0xDD34 #define PTP_OPC_PhoneticOrganizationName 0xDD35 #define PTP_OPC_Role 0xDD36 #define PTP_OPC_Birthdate 0xDD37 #define PTP_OPC_MessageTo 0xDD40 #define PTP_OPC_MessageCC 0xDD41 #define PTP_OPC_MessageBCC 0xDD42 #define PTP_OPC_MessageRead 0xDD43 #define PTP_OPC_MessageReceivedTime 0xDD44 #define PTP_OPC_MessageSender 0xDD45 #define PTP_OPC_ActivityBeginTime 0xDD50 #define PTP_OPC_ActivityEndTime 0xDD51 #define PTP_OPC_ActivityLocation 0xDD52 #define PTP_OPC_ActivityRequiredAttendees 0xDD54 #define PTP_OPC_ActivityOptionalAttendees 0xDD55 #define PTP_OPC_ActivityResources 0xDD56 #define PTP_OPC_ActivityAccepted 0xDD57 #define PTP_OPC_Owner 0xDD5D #define PTP_OPC_Editor 0xDD5E #define PTP_OPC_Webmaster 0xDD5F #define PTP_OPC_URLSource 0xDD60 #define PTP_OPC_URLDestination 0xDD61 #define PTP_OPC_TimeBookmark 0xDD62 #define PTP_OPC_ObjectBookmark 0xDD63 #define PTP_OPC_ByteBookmark 0xDD64 #define PTP_OPC_LastBuildDate 0xDD70 #define PTP_OPC_TimetoLive 0xDD71 #define PTP_OPC_MediaGUID 0xDD72 #define PTP_OPC_TotalBitRate 0xDE91 #define PTP_OPC_BitRateType 0xDE92 #define PTP_OPC_SampleRate 0xDE93 #define PTP_OPC_NumberOfChannels 0xDE94 #define PTP_OPC_AudioBitDepth 0xDE95 #define PTP_OPC_ScanDepth 0xDE97 #define PTP_OPC_AudioWAVECodec 0xDE99 #define PTP_OPC_AudioBitRate 0xDE9A #define PTP_OPC_VideoFourCCCodec 0xDE9B #define PTP_OPC_VideoBitRate 0xDE9C #define PTP_OPC_FramesPerThousandSeconds 0xDE9D #define PTP_OPC_KeyFrameDistance 0xDE9E #define PTP_OPC_BufferSize 0xDE9F #define PTP_OPC_EncodingQuality 0xDEA0 #define PTP_OPC_EncodingProfile 0xDEA1 #define PTP_OPC_BuyFlag 0xD901 /* WiFi Provisioning MTP Extension property codes */ #define PTP_OPC_WirelessConfigurationFile 0xB104 /* Device Property Form Flag */ #define PTP_DPFF_None 0x00 #define PTP_DPFF_Range 0x01 #define PTP_DPFF_Enumeration 0x02 /* Object Property Codes used by MTP (first 3 are same as DPFF codes) */ #define PTP_OPFF_None 0x00 #define PTP_OPFF_Range 0x01 #define PTP_OPFF_Enumeration 0x02 #define PTP_OPFF_DateTime 0x03 #define PTP_OPFF_FixedLengthArray 0x04 #define PTP_OPFF_RegularExpression 0x05 #define PTP_OPFF_ByteArray 0x06 #define PTP_OPFF_LongString 0xFF /* Device Property GetSet type */ #define PTP_DPGS_Get 0x00 #define PTP_DPGS_GetSet 0x01 /* Glue stuff starts here */ typedef struct _PTPParams PTPParams; typedef uint16_t (* PTPDataGetFunc) (PTPParams* params, void*priv, unsigned long wantlen, unsigned char *data, unsigned long *gotlen); typedef uint16_t (* PTPDataPutFunc) (PTPParams* params, void*priv, unsigned long sendlen, unsigned char *data, unsigned long *putlen); typedef struct _PTPDataHandler { PTPDataGetFunc getfunc; PTPDataPutFunc putfunc; void *priv; } PTPDataHandler; /* * This functions take PTP oriented arguments and send them over an * appropriate data layer doing byteorder conversion accordingly. */ typedef uint16_t (* PTPIOSendReq) (PTPParams* params, PTPContainer* req); typedef uint16_t (* PTPIOSendData) (PTPParams* params, PTPContainer* ptp, uint64_t size, PTPDataHandler*getter); typedef uint16_t (* PTPIOGetResp) (PTPParams* params, PTPContainer* resp); typedef uint16_t (* PTPIOGetData) (PTPParams* params, PTPContainer* ptp, PTPDataHandler *putter); typedef uint16_t (* PTPIOCancelReq) (PTPParams* params, uint32_t transaction_id); /* debug functions */ typedef void (* PTPErrorFunc) (void *data, const char *format, va_list args) #if (__GNUC__ >= 3) __attribute__((__format__(printf,2,0))) #endif ; typedef void (* PTPDebugFunc) (void *data, const char *format, va_list args) #if (__GNUC__ >= 3) __attribute__((__format__(printf,2,0))) #endif ; struct _PTPObject { uint32_t oid; unsigned int flags; #define PTPOBJECT_OBJECTINFO_LOADED (1<<0) #define PTPOBJECT_CANONFLAGS_LOADED (1<<1) #define PTPOBJECT_MTPPROPLIST_LOADED (1<<2) #define PTPOBJECT_DIRECTORY_LOADED (1<<3) #define PTPOBJECT_PARENTOBJECT_LOADED (1<<4) #define PTPOBJECT_STORAGEID_LOADED (1<<5) PTPObjectInfo oi; uint32_t canon_flags; MTPProperties *mtpprops; unsigned int nrofmtpprops; }; typedef struct _PTPObject PTPObject; /* The Device Property Cache */ struct _PTPDeviceProperty { time_t timestamp; PTPDevicePropDesc desc; PTPPropertyValue value; }; typedef struct _PTPDeviceProperty PTPDeviceProperty; struct _PTPParams { /* device flags */ uint32_t device_flags; /* data layer byteorder */ uint8_t byteorder; uint16_t maxpacketsize; /* PTP IO: Custom IO functions */ PTPIOSendReq sendreq_func; PTPIOSendData senddata_func; PTPIOGetResp getresp_func; PTPIOGetData getdata_func; PTPIOGetResp event_check; PTPIOGetResp event_wait; PTPIOCancelReq cancelreq_func; /* Custom error and debug function */ PTPErrorFunc error_func; PTPDebugFunc debug_func; /* Data passed to above functions */ void *data; /* ptp transaction ID */ uint32_t transaction_id; /* ptp session ID */ uint32_t session_id; /* PTP IO: if we have MTP style split header/data transfers */ int split_header_data; int ocs64; /* 64bit objectsize */ /* PTP: internal structures used by ptp driver */ PTPObject *objects; unsigned int nrofobjects; PTPDeviceInfo deviceinfo; /* PTP: the current event queue */ PTPContainer *events; int nrofevents; /* live view enabled */ int inliveview; /* PTP: Device Property Caching */ PTPDeviceProperty *deviceproperties; unsigned int nrofdeviceproperties; /* PTP: Canon specific flags list */ PTPCanon_Property *canon_props; unsigned int nrofcanon_props; int canon_viewfinder_on; int canon_event_mode; /* PTP: Canon EOS event queue */ PTPCanon_changes_entry *backlogentries; unsigned int nrofbacklogentries; int eos_captureenabled; int eos_camerastatus; /* PTP: Nikon specifics */ int controlmode; /* PTP: Wifi profiles */ uint8_t wifi_profiles_version; uint8_t wifi_profiles_number; PTPNIKONWifiProfile *wifi_profiles; /* IO: PTP/IP related data */ int cmdfd, evtfd; uint8_t cameraguid[16]; uint32_t eventpipeid; char *cameraname; /* Olympus UMS wrapping related data */ PTPDeviceInfo outer_deviceinfo; char *olympus_cmd; char *olympus_reply; struct _PTPParams *outer_params; #ifdef HAVE_ICONV /* PTP: iconv converters */ iconv_t cd_locale_to_ucs2; iconv_t cd_ucs2_to_locale; #endif /* IO: Sometimes the response packet get send in the dataphase * too. This only happens for a Samsung player now. */ uint8_t *response_packet; uint16_t response_packet_size; }; /* last, but not least - ptp functions */ uint16_t ptp_usb_sendreq (PTPParams* params, PTPContainer* req); uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp, uint64_t size, PTPDataHandler *handler); uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp); uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler); uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event); uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event); uint16_t ptp_usb_control_get_extended_event_data (PTPParams *params, char *buffer, int *size); uint16_t ptp_usb_control_device_reset_request (PTPParams *params); uint16_t ptp_usb_control_get_device_status (PTPParams *params, char *buffer, int *size); uint16_t ptp_usb_control_cancel_request (PTPParams *params, uint32_t transid); int ptp_ptpip_connect (PTPParams* params, const char *port); uint16_t ptp_ptpip_sendreq (PTPParams* params, PTPContainer* req); uint16_t ptp_ptpip_senddata (PTPParams* params, PTPContainer* ptp, uint64_t size, PTPDataHandler *handler); uint16_t ptp_ptpip_getresp (PTPParams* params, PTPContainer* resp); uint16_t ptp_ptpip_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler); uint16_t ptp_ptpip_event_wait (PTPParams* params, PTPContainer* event); uint16_t ptp_ptpip_event_check (PTPParams* params, PTPContainer* event); uint16_t ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo); uint16_t ptp_generic_no_data (PTPParams* params, uint16_t opcode, unsigned int cnt, ...); uint16_t ptp_opensession (PTPParams *params, uint32_t session); uint16_t ptp_transaction_new (PTPParams* params, PTPContainer* ptp, uint16_t flags, uint64_t sendlen, PTPDataHandler *handler ); uint16_t ptp_transaction (PTPParams* params, PTPContainer* ptp, uint16_t flags, uint64_t sendlen, unsigned char **data, unsigned int *recvlen ); /** * ptp_closesession: * params: PTPParams* * * Closes session. * * Return values: Some PTP_RC_* code. **/ #define ptp_closesession(params) ptp_generic_no_data(params,PTP_OC_CloseSession,0) /** * ptp_resetdevice: * params: PTPParams* * * Uses the built-in function to reset the device * * Return values: Some PTP_RC_* code. * */ #define ptp_resetdevice(params) ptp_generic_no_data(params,PTP_OC_ResetDevice,0) uint16_t ptp_getstorageids (PTPParams* params, PTPStorageIDs* storageids); uint16_t ptp_getstorageinfo (PTPParams* params, uint32_t storageid, PTPStorageInfo* storageinfo); /** * ptp_formatstore: * params: PTPParams* * storageid - StorageID * * Formats the storage on the device. * * Return values: Some PTP_RC_* code. **/ #define ptp_formatstore(params,storageid) ptp_generic_no_data(params,PTP_OC_FormatStore,1,storageid) uint16_t ptp_getobjecthandles (PTPParams* params, uint32_t storage, uint32_t objectformatcode, uint32_t associationOH, PTPObjectHandles* objecthandles); uint16_t ptp_getnumobjects (PTPParams* params, uint32_t storage, uint32_t objectformatcode, uint32_t associationOH, uint32_t* numobs); uint16_t ptp_getobjectinfo (PTPParams *params, uint32_t handle, PTPObjectInfo* objectinfo); uint16_t ptp_getobject (PTPParams *params, uint32_t handle, unsigned char** object); uint16_t ptp_getobject_tofd (PTPParams* params, uint32_t handle, int fd); uint16_t ptp_getobject_to_handler (PTPParams* params, uint32_t handle, PTPDataHandler*); uint16_t ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset, uint32_t maxbytes, unsigned char** object, uint32_t *len); uint16_t ptp_getthumb (PTPParams *params, uint32_t handle, unsigned char** object, unsigned int *len); uint16_t ptp_deleteobject (PTPParams* params, uint32_t handle, uint32_t ofc); uint16_t ptp_sendobjectinfo (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle, PTPObjectInfo* objectinfo); /** * ptp_setobjectprotection: * params: PTPParams* * uint16_t newprot - object protection flag * * Set protection of object. * * Return values: Some PTP_RC_* code. * */ #define ptp_setobjectprotection(params,oid,newprot) ptp_generic_no_data(params,PTP_OC_SetObjectProtection,2,oid,newprot) uint16_t ptp_sendobject (PTPParams* params, unsigned char* object, uint64_t size); uint16_t ptp_sendobject_fromfd (PTPParams* params, int fd, uint64_t size); uint16_t ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler*, uint64_t size); /** * ptp_initiatecapture: * params: PTPParams* * storageid - destination StorageID on Responder * ofc - object format code * * Causes device to initiate the capture of one or more new data objects * according to its current device properties, storing the data into store * indicated by storageid. If storageid is 0x00000000, the object(s) will * be stored in a store that is determined by the capturing device. * The capturing of new data objects is an asynchronous operation. * * Return values: Some PTP_RC_* code. **/ #define ptp_initiatecapture(params,storageid,ofc) ptp_generic_no_data(params,PTP_OC_InitiateCapture,2,storageid,ofc) uint16_t ptp_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc *devicepropertydesc); uint16_t ptp_generic_getdevicepropdesc (PTPParams *params, uint16_t propcode, PTPDevicePropDesc *dpd); uint16_t ptp_getdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype); uint16_t ptp_setdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype); uint16_t ptp_generic_setdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype); uint16_t ptp_getfilesystemmanifest (PTPParams* params, uint32_t storage, uint32_t objectformatcode, uint32_t associationOH, unsigned char** data); uint16_t ptp_check_event (PTPParams *params); uint16_t ptp_add_event (PTPParams *params, PTPContainer *evt); int ptp_get_one_event (PTPParams *params, PTPContainer *evt); uint16_t ptp_check_eos_events (PTPParams *params); int ptp_get_one_eos_event (PTPParams *params, PTPCanon_changes_entry *entry); /* Microsoft MTP extensions */ uint16_t ptp_mtp_getobjectpropdesc (PTPParams* params, uint16_t opc, uint16_t ofc, PTPObjectPropDesc *objectpropertydesc); uint16_t ptp_mtp_getobjectpropvalue (PTPParams* params, uint32_t oid, uint16_t opc, PTPPropertyValue *value, uint16_t datatype); uint16_t ptp_mtp_setobjectpropvalue (PTPParams* params, uint32_t oid, uint16_t opc, PTPPropertyValue *value, uint16_t datatype); uint16_t ptp_mtp_getobjectreferences (PTPParams* params, uint32_t handle, uint32_t** ohArray, uint32_t* arraylen); uint16_t ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArray, uint32_t arraylen); uint16_t ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops); uint16_t ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops); uint16_t ptp_mtp_sendobjectproplist (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle, uint16_t objecttype, uint64_t objectsize, MTPProperties *props, int nrofprops); uint16_t ptp_mtp_setobjectproplist (PTPParams* params, MTPProperties *props, int nrofprops); /* Microsoft MTPZ (Zune) extensions */ uint16_t ptp_mtpz_sendwmdrmpdapprequest (PTPParams*, unsigned char *, uint32_t); #define ptp_mtpz_resethandshake(params) ptp_generic_no_data(params, PTP_OC_MTP_WMDRMPD_EndTrustedAppSession, 0) uint16_t ptp_mtpz_getwmdrmpdappresponse (PTPParams*, unsigned char **, uint32_t*); #define ptp_mtpz_wmdrmpd_enabletrustedfilesoperations(params,hash1,hash2,hash3,hash4) \ ptp_generic_no_data(params, PTP_OC_MTP_WMDRMPD_EnableTrustedFilesOperations, 4,\ hash1, hash2, hash3, hash4) /* Eastman Kodak extensions */ uint16_t ptp_ek_9007 (PTPParams* params, unsigned char **serial, unsigned int *size); uint16_t ptp_ek_9009 (PTPParams* params, uint32_t*, uint32_t*); uint16_t ptp_ek_900c (PTPParams* params, unsigned char **serial, unsigned int *size); uint16_t ptp_ek_getserial (PTPParams* params, unsigned char **serial, unsigned int *size); uint16_t ptp_ek_setserial (PTPParams* params, unsigned char *serial, unsigned int size); uint16_t ptp_ek_settext (PTPParams* params, PTPEKTextParams *text); uint16_t ptp_ek_sendfileobjectinfo (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle, PTPObjectInfo* objectinfo); uint16_t ptp_ek_sendfileobject (PTPParams* params, unsigned char* object, uint32_t size); uint16_t ptp_ek_sendfileobject_from_handler (PTPParams* params, PTPDataHandler*, uint32_t size); /* Canon PTP extensions */ #define ptp_canon_9012(params) ptp_generic_no_data(params,0x9012,0) uint16_t ptp_canon_gettreeinfo (PTPParams* params, uint32_t* out); uint16_t ptp_canon_gettreesize (PTPParams* params, PTPCanon_directtransfer_entry**, unsigned int*cnt); uint16_t ptp_canon_getpartialobjectinfo (PTPParams* params, uint32_t handle, uint32_t p2, uint32_t* size, uint32_t* rp2); uint16_t ptp_canon_get_mac_address (PTPParams* params, unsigned char **mac); /** * ptp_canon_startshootingmode: * params: PTPParams* * * Starts shooting session. It emits a StorageInfoChanged * event via the interrupt pipe and pushes the StorageInfoChanged * and CANON_CameraModeChange events onto the event stack * (see operation PTP_OC_CANON_CheckEvent). * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_startshootingmode(params) ptp_generic_no_data(params,PTP_OC_CANON_InitiateReleaseControl,0) /** * ptp_canon_endshootingmode: * params: PTPParams* * * This operation is observed after pressing the Disconnect * button on the Remote Capture app. It emits a StorageInfoChanged * event via the interrupt pipe and pushes the StorageInfoChanged * and CANON_CameraModeChange events onto the event stack * (see operation PTP_OC_CANON_CheckEvent). * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_endshootingmode(params) ptp_generic_no_data(params,PTP_OC_CANON_TerminateReleaseControl,0) /** * ptp_canon_viewfinderon: * params: PTPParams* * * Prior to start reading viewfinder images, one must call this operation. * Supposedly, this operation affects the value of the CANON_ViewfinderMode * property. * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_viewfinderon(params) ptp_generic_no_data(params,PTP_OC_CANON_ViewfinderOn,0) /** * ptp_canon_viewfinderoff: * params: PTPParams* * * Before changing the shooting mode, or when one doesn't need to read * viewfinder images any more, one must call this operation. * Supposedly, this operation affects the value of the CANON_ViewfinderMode * property. * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_viewfinderoff(params) ptp_generic_no_data(params,PTP_OC_CANON_ViewfinderOff,0) /** * ptp_canon_reset_aeafawb: * params: PTPParams* * uint32_t flags - what shall be reset. * 1 - autoexposure * 2 - autofocus * 4 - autowhitebalance * * Called "Reset AeAfAwb" (auto exposure, focus, white balance) * * Return values: Some PTP_RC_* code. **/ #define PTP_CANON_RESET_AE 0x1 #define PTP_CANON_RESET_AF 0x2 #define PTP_CANON_RESET_AWB 0x4 #define ptp_canon_reset_aeafawb(params,flags) ptp_generic_no_data(params,PTP_OC_CANON_DoAeAfAwb,1,flags) uint16_t ptp_canon_checkevent (PTPParams* params, PTPContainer* event, int* isevent); /** * ptp_canon_focuslock: * * This operation locks the focus. It is followed by the CANON_GetChanges(?) * operation in the log. * It affects the CANON_MacroMode property. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_focuslock(params) ptp_generic_no_data(params,PTP_OC_CANON_FocusLock,0) /** * ptp_canon_focusunlock: * * This operation unlocks the focus. It is followed by the CANON_GetChanges(?) * operation in the log. * It sets the CANON_MacroMode property value to 1 (where it occurs in the log). * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_focusunlock(params) ptp_generic_no_data(params,PTP_OC_CANON_FocusUnlock,0) /** * ptp_canon_keepdeviceon: * * This operation sends a "ping" style message to the camera. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_keepdeviceon(params) ptp_generic_no_data(params,PTP_OC_CANON_KeepDeviceOn,0) /** * ptp_canon_eos_keepdeviceon: * * This operation sends a "ping" style message to the camera. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_keepdeviceon(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_KeepDeviceOn,0) /** * ptp_canon_initiatecaptureinmemory: * * This operation starts the image capture according to the current camera * settings. When the capture has happened, the camera emits a CaptureComplete * event via the interrupt pipe and pushes the CANON_RequestObjectTransfer, * CANON_DeviceInfoChanged and CaptureComplete events onto the event stack * (see operation CANON_CheckEvent). From the CANON_RequestObjectTransfer * event's parameter one can learn the just captured image's ObjectHandle. * The image is stored in the camera's own RAM. * On the next capture the image will be overwritten! * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_initiatecaptureinmemory(params) ptp_generic_no_data(params,PTP_OC_CANON_InitiateCaptureInMemory,0) /** * ptp_canon_eos_requestdevicepropvalue: * * This operation sends a "ping" style message to the camera. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define CANON_EOS_OLC_BUTTON 0x0001 #define CANON_EOS_OLC_SHUTTERSPEED 0x0002 #define CANON_EOS_OLC_APERTURE 0x0004 #define CANON_EOS_OLC_ISO 0x0008 #define ptp_canon_eos_setrequestolcinfogroup(params,igmask) ptp_generic_no_data(params,PTP_OC_CANON_EOS_SetRequestOLCInfoGroup,1,igmask) #define ptp_canon_eos_requestdevicepropvalue(params,prop) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RequestDevicePropValue,1,prop) uint16_t ptp_canon_eos_capture (PTPParams* params, uint32_t *result); uint16_t ptp_canon_eos_getevent (PTPParams* params, PTPCanon_changes_entry **entries, int *nrofentries); uint16_t ptp_canon_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset, uint32_t size, uint32_t pos, unsigned char** block, uint32_t* readnum); uint16_t ptp_canon_getviewfinderimage (PTPParams* params, unsigned char** image, uint32_t* size); uint16_t ptp_canon_getchanges (PTPParams* params, uint16_t** props, uint32_t* propnum); uint16_t ptp_canon_getobjectinfo (PTPParams* params, uint32_t store, uint32_t p2, uint32_t parenthandle, uint32_t handle, PTPCANONFolderEntry** entries, uint32_t* entnum); uint16_t ptp_canon_eos_getdeviceinfo (PTPParams* params, PTPCanonEOSDeviceInfo*di); /** * ptp_canon_eos_setuilock: * * This command sets UI lock * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_setuilock(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_SetUILock,0) /** * ptp_canon_eos_resetuilock: * * This command sets UI lock * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_resetuilock(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_ResetUILock,0) /** * ptp_canon_eos_start_viewfinder: * * This command starts Viewfinder mode of newer Canon DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_start_viewfinder(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_InitiateViewfinder,0) /** * ptp_canon_eos_end_viewfinder: * * This command ends Viewfinder mode of newer Canon DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_end_viewfinder(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_TerminateViewfinder,0) uint16_t ptp_canon_eos_get_viewfinder_image (PTPParams* params, unsigned char **data, unsigned int *size); uint16_t ptp_canon_eos_get_viewfinder_image_handler (PTPParams* params, PTPDataHandler*); uint16_t ptp_canon_get_objecthandle_by_name (PTPParams* params, char* name, uint32_t* objectid); uint16_t ptp_canon_get_directory (PTPParams* params, PTPObjectHandles *handles, PTPObjectInfo **oinfos, uint32_t **flags); /** * ptp_canon_setobjectarchive: * * params: PTPParams* * uint32_t objectid * uint32_t flags * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_setobjectarchive(params,oid,flags) ptp_generic_no_data(params,PTP_OC_CANON_SetObjectArchive,2,oid,flags) uint16_t ptp_canon_get_customize_data (PTPParams* params, uint32_t themenr, unsigned char **data, unsigned int *size); uint16_t ptp_canon_getpairinginfo (PTPParams* params, uint32_t nr, unsigned char**, unsigned int*); uint16_t ptp_canon_eos_getstorageids (PTPParams* params, PTPStorageIDs* storageids); uint16_t ptp_canon_eos_getstorageinfo (PTPParams* params, uint32_t p1, unsigned char**, unsigned int*); uint16_t ptp_canon_eos_getpartialobject (PTPParams* params, uint32_t oid, uint32_t off, uint32_t xsize, unsigned char**data); uint16_t ptp_canon_eos_getobjectinfoex (PTPParams* params, uint32_t storageid, uint32_t objectid, uint32_t unk, PTPCANONFolderEntry **entries, unsigned int *nrofentries); uint16_t ptp_canon_eos_setdevicepropvalueex (PTPParams* params, unsigned char* data, unsigned int size); #define ptp_canon_eos_setremotemode(params,p1) ptp_generic_no_data(params,PTP_OC_CANON_EOS_SetRemoteMode,1,p1) #define ptp_canon_eos_seteventmode(params,p1) ptp_generic_no_data(params,PTP_OC_CANON_EOS_SetEventMode,1,p1) /** * ptp_canon_eos_transfercomplete: * * This ends a direct object transfer from an EOS camera. * * params: PTPParams* * oid Object ID * * Return values: Some PTP_RC_* code. * */ #define ptp_canon_eos_transfercomplete(params,oid) ptp_generic_no_data(params,PTP_OC_CANON_EOS_TransferComplete,1,oid) /* inHDD = %d, inLength =%d, inReset = %d */ #define ptp_canon_eos_pchddcapacity(params,p1,p2,p3) ptp_generic_no_data(params,PTP_OC_CANON_EOS_PCHDDCapacity,3,p1,p2,p3) uint16_t ptp_canon_eos_bulbstart (PTPParams* params); uint16_t ptp_canon_eos_bulbend (PTPParams* params); uint16_t ptp_canon_eos_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc *devicepropertydesc); uint16_t ptp_canon_eos_setdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype); uint16_t ptp_nikon_get_vendorpropcodes (PTPParams* params, uint16_t **props, unsigned int *size); uint16_t ptp_nikon_curve_download (PTPParams* params, unsigned char **data, unsigned int *size); uint16_t ptp_nikon_getptpipinfo (PTPParams* params, unsigned char **data, unsigned int *size); uint16_t ptp_nikon_getwifiprofilelist (PTPParams* params); uint16_t ptp_nikon_writewifiprofile (PTPParams* params, PTPNIKONWifiProfile* profile); uint16_t ptp_sony_sdioconnect (PTPParams* params, uint32_t p1, uint32_t p2, uint32_t p3); uint16_t ptp_sony_get_vendorpropcodes (PTPParams* params, uint16_t **props, unsigned int *size); uint16_t ptp_sony_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc *devicepropertydesc); uint16_t ptp_sony_getalldevicepropdesc (PTPParams* params); uint16_t ptp_sony_setdevicecontrolvaluea (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype); uint16_t ptp_sony_setdevicecontrolvalueb (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype); /** * ptp_nikon_deletewifiprofile: * * This command deletes a wifi profile. * * params: PTPParams* * unsigned int profilenr - profile number * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_deletewifiprofile(params,profilenr) ptp_generic_no_data(params,PTP_OC_NIKON_DeleteProfile,1,profilenr) /** * ptp_nikon_setcontrolmode: * * This command can switch the camera to full PC control mode. * * params: PTPParams* * uint32_t mode - mode * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_setcontrolmode(params,mode) ptp_generic_no_data(params,PTP_OC_NIKON_SetControlMode,1,mode) /** * ptp_nikon_terminatecapture: * * This command appears to terminate a longer capture * * params: PTPParams* * uint32_t a * uint32_t b * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_terminatecapture(params,p1,p2) ptp_generic_no_data(params,PTP_OC_NIKON_TerminateCapture,2,p1,p2) /** * ptp_nikon_afdrive: * * This command runs (drives) the lens autofocus. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_afdrive(params) ptp_generic_no_data(params,PTP_OC_NIKON_AfDrive,0) /** * ptp_nikon_changeafarea: * * This command starts movie capture (to card) * * params: PTPParams* * x: x coordinate * y: y coordinate * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_changeafarea(params,x,y) ptp_generic_no_data(params,PTP_OC_NIKON_ChangeAfArea,2,x,y) /** * ptp_nikon_startmovie: * * This command starts movie capture (to card) * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_startmovie(params) ptp_generic_no_data(params,PTP_OC_NIKON_StartMovieRecInCard,0) /** * ptp_nikon_stopmovie: * * This command stops movie capture (to card) * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_stopmovie(params) ptp_generic_no_data(params,PTP_OC_NIKON_EndMovieRec,0) /** * ptp_canon_eos_afdrive: * * This command runs (drives) the lens autofocus. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_afdrive(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_DoAf,0) /** * ptp_canon_eos_zoom: * * This command runs (drives) the lens autofocus. * * params: PTPParams* * params: arg1 unknown * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_zoom(params,x) ptp_generic_no_data(params,PTP_OC_CANON_EOS_Zoom,1,x) #define ptp_canon_eos_zoomposition(params,x,y) ptp_generic_no_data(params,PTP_OC_CANON_EOS_ZoomPosition,2,x,y) #define ptp_canon_eos_remotereleaseon(params,x,y) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RemoteReleaseOn,2,x,y) #define ptp_canon_eos_remotereleaseoff(params,x) ptp_generic_no_data(params,PTP_OC_CANON_EOS_RemoteReleaseOff,1,x) /** * ptp_nikon_mfdrive: * * This command runs (drives) the lens focus manually. * * params: PTPParams* * flag: 0x1 for (no limit - closest), 0x2 for (closest - no limit) * amount: amount of steps * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_mfdrive(params,flag,amount) ptp_generic_no_data(params,PTP_OC_NIKON_MfDrive,2,flag,amount) /** * ptp_canon_eos_drivelens: * * This command runs (drives) the lens focus manually. * * params: PTPParams* * amount: 0x1-0x3 for near range, 0x8001-0x8003 for far range. * * Return values: Some PTP_RC_* code. * **/ #define ptp_canon_eos_drivelens(params,amount) ptp_generic_no_data(params,PTP_OC_CANON_EOS_DriveLens,1,amount) /** * ptp_nikon_capture: * * This command captures a picture on the Nikon. * * params: PTPParams* * uint32_t x: unknown parameter. seen to be -1. * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_capture(params,x) ptp_generic_no_data(params,PTP_OC_NIKON_Capture,1,x) /** * ptp_nikon_capture2: * * This command captures a picture on the Nikon. * * params: PTPParams* * af: autofocus before capture (1 yes , 0 no) * target: sdram 1, card 0 * * Return values: Some PTP_RC_* code. * 2 params: * 0xffffffff == No AF before, 0xfffffffe == AF before capture * sdram=1, card=0 */ #define ptp_nikon_capture2(params,af,target) ptp_generic_no_data(params,PTP_OC_NIKON_InitiateCaptureRecInMedia,2,af?0xfffffffe:0xffffffff,target) /** * ptp_nikon_capture_sdram: * * This command captures a picture on the Nikon. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_capture_sdram(params) ptp_generic_no_data(params,PTP_OC_NIKON_AfCaptureSDRAM,0) /** * ptp_nikon_delete_sdram_image: * * This command deletes the current SDRAM image * * params: PTPParams* * uint32_t oid * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_delete_sdram_image(params,oid) ptp_generic_no_data(params,PTP_OC_NIKON_DelImageSDRAM,1,oid) /** * ptp_nikon_start_liveview: * * This command starts LiveView mode of newer Nikons DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_start_liveview(params) ptp_generic_no_data(params,PTP_OC_NIKON_StartLiveView,0) uint16_t ptp_nikon_get_liveview_image (PTPParams* params, unsigned char**,unsigned int*); uint16_t ptp_nikon_get_preview_image (PTPParams* params, unsigned char**, unsigned int*, uint32_t*); /** * ptp_nikon_end_liveview: * * This command ends LiveView mode of newer Nikons DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_end_liveview(params) ptp_generic_no_data(params,PTP_OC_NIKON_EndLiveView,0) uint16_t ptp_nikon_check_event (PTPParams* params, PTPContainer **evt, unsigned int *evtcnt); uint16_t ptp_nikon_getfileinfoinblock (PTPParams* params, uint32_t p1, uint32_t p2, uint32_t p3, unsigned char **data, unsigned int *size); /** * ptp_nikon_device_ready: * * This command checks if the device is ready. Used after * a capture. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ #define ptp_nikon_device_ready(params) ptp_generic_no_data (params, PTP_OC_NIKON_DeviceReady, 0) uint16_t ptp_mtp_getobjectpropssupported (PTPParams* params, uint16_t ofc, uint32_t *propnum, uint16_t **props); /* Android MTP Extensions */ uint16_t ptp_android_getpartialobject64 (PTPParams* params, uint32_t handle, uint64_t offset, uint32_t maxbytes, unsigned char** object, uint32_t *len); #define ptp_android_begineditobject(params,handle) ptp_generic_no_data (params, PTP_OC_ANDROID_BeginEditObject, 1, handle); #define ptp_android_truncate(params,handle,offset) ptp_generic_no_data (params, PTP_OC_ANDROID_TruncateObject, 3, handle, (offset & 0xFFFFFFFF), (offset >> 32)); uint16_t ptp_android_sendpartialobject (PTPParams *params, uint32_t handle, uint64_t offset, unsigned char *object, uint32_t len); #define ptp_android_endeditobject(params,handle) ptp_generic_no_data (params, PTP_OC_ANDROID_EndEditObject, 1, handle); uint16_t ptp_olympus_getdeviceinfo (PTPParams*, PTPDeviceInfo*); #define ptp_olympus_setcameracontrolmode(params,p1) ptp_generic_no_data (params, PTP_OC_OLYMPUS_SetCameraControlMode, 1, p1); uint16_t ptp_olympus_opensession (PTPParams*, unsigned char**, unsigned long *); #define ptp_olympus_capture(params,p1) ptp_generic_no_data (params, PTP_OC_OLYMPUS_Capture, 1, p1); uint16_t ptp_olympus_getcameraid (PTPParams*, unsigned char**, unsigned long *); /* Non PTP protocol functions */ static inline int ptp_operation_issupported(PTPParams* params, uint16_t operation) { unsigned int i=0; for (;ideviceinfo.OperationsSupported_len;i++) { if (params->deviceinfo.OperationsSupported[i]==operation) return 1; } return 0; } int ptp_event_issupported (PTPParams* params, uint16_t event); int ptp_property_issupported (PTPParams* params, uint16_t property); void ptp_free_params (PTPParams *params); void ptp_free_objectpropdesc (PTPObjectPropDesc*); void ptp_free_devicepropdesc (PTPDevicePropDesc*); void ptp_free_devicepropvalue (uint16_t, PTPPropertyValue*); void ptp_free_objectinfo (PTPObjectInfo *oi); void ptp_free_object (PTPObject *oi); const char *ptp_strerror(uint16_t error); void ptp_perror (PTPParams* params, uint16_t error); void ptp_debug (PTPParams *params, const char *format, ...); void ptp_error (PTPParams *params, const char *format, ...); const char* ptp_get_property_description(PTPParams* params, uint16_t dpc); int ptp_render_property_value(PTPParams* params, uint16_t dpc, PTPDevicePropDesc *dpd, unsigned int length, char *out); int ptp_render_ofc(PTPParams* params, uint16_t ofc, int spaceleft, char *txt); int ptp_render_opcode(PTPParams* params, uint16_t opcode, int spaceleft, char *txt); int ptp_render_mtp_propname(uint16_t propid, int spaceleft, char *txt); MTPProperties *ptp_get_new_object_prop_entry(MTPProperties **props, int *nrofprops); void ptp_destroy_object_prop(MTPProperties *prop); void ptp_destroy_object_prop_list(MTPProperties *props, int nrofprops); MTPProperties *ptp_find_object_prop_in_cache(PTPParams *params, uint32_t const handle, uint32_t const attribute_id); void ptp_remove_object_from_cache(PTPParams *params, uint32_t handle); uint16_t ptp_add_object_to_cache(PTPParams *params, uint32_t handle); uint16_t ptp_object_want (PTPParams *, uint32_t handle, unsigned int want, PTPObject**retob); void ptp_objects_sort (PTPParams *); uint16_t ptp_object_find (PTPParams *params, uint32_t handle, PTPObject **retob); uint16_t ptp_object_find_or_insert (PTPParams *params, uint32_t handle, PTPObject **retob); /* ptpip.c */ void ptp_nikon_getptpipguid (unsigned char* guid); /* CHDK specifics */ #define PTP_OC_CHDK 0x9999 typedef struct tagptp_chdk_videosettings { long live_image_buffer_width; long live_image_width; long live_image_height; long bitmap_buffer_width; long bitmap_width; long bitmap_height; unsigned palette[16]; } ptp_chdk_videosettings; /* Nafraf: Test this!!!*/ #define ptp_chdk_switch_mode(params,mode) ptp_generic_no_data(params,PTP_OC_CHDK,2,PTP_CHDK_SwitchMode,mode) /* include CHDK ptp protocol definitions from a CHDK source tree */ #include "chdk_ptp.h" #if (PTP_CHDK_VERSION_MAJOR < 2 || (PTP_CHDK_VERSION_MAJOR == 2 && PTP_CHDK_VERSION_MINOR < 5)) #error your chdk headers are too old, unset CHDK_SRC_DIR in config.mk #endif #include "chdk_live_view.h" /* the following happens to match what is used in CHDK, but is not part of the protocol */ typedef struct { unsigned size; unsigned script_id; /* id of script message is to/from */ unsigned type; unsigned subtype; char data[]; } ptp_chdk_script_msg; /* chunk for remote capture */ typedef struct { uint32_t size; /* length of data */ int last; /* is it the last chunk? */ uint32_t offset; /* offset within file, or -1 */ unsigned char *data; /* data, must be free'd by caller when done */ } ptp_chdk_rc_chunk; uint16_t ptp_chdk_get_memory(PTPParams* params, int start, int num, unsigned char **); uint16_t ptp_chdk_set_memory_long(PTPParams* params, int addr, int val); int ptp_chdk_upload(PTPParams* params, char *local_fn, char *remote_fn); int ptp_chdk_download(PTPParams* params, char *remote_fn, char *local_fn); /* remote capture */ uint16_t ptp_chdk_rcisready(PTPParams* params, int *isready,int *imgnum); uint16_t ptp_chdk_rcgetchunk(PTPParams* params,int fmt, ptp_chdk_rc_chunk *chunk); uint16_t ptp_chdk_exec_lua(PTPParams* params, char *script, int flags, int *script_id,int *status); uint16_t ptp_chdk_get_version(PTPParams* params, int *major, int *minor); uint16_t ptp_chdk_get_script_support(PTPParams* params, unsigned *status); uint16_t ptp_chdk_get_script_status(PTPParams* params, unsigned *status); uint16_t ptp_chdk_write_script_msg(PTPParams* params, char *data, unsigned size, int target_script_id, int *status); uint16_t ptp_chdk_read_script_msg(PTPParams* params, ptp_chdk_script_msg **msg); uint16_t ptp_chdk_get_live_data(PTPParams* params, unsigned flags, unsigned char **data, unsigned int *data_size); uint16_t ptp_chdk_call_function(PTPParams* params, int *args, int size, int *ret); /*uint16_t ptp_chdk_get_script_output(PTPParams* params, char **output ); */ /*uint16_t ptp_chdk_get_video_settings(PTPParams* params, ptp_chdk_videosettings* vsettings);*/ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __PTP_H__ */ libmtp-1.1.10/src/unicode.h0000644000175000001440000000301212121274441012356 00000000000000/** * \file unicode.h * * This file contains general Unicode string manipulation functions. * It mainly consist of functions for converting between UCS-2 (used on * the devices) and UTF-8 (used by several applications). * * For a deeper understanding of Unicode encoding formats see the * Wikipedia entries for * UTF-16/UCS-2 * and UTF-8. * * Copyright (C) 2005-2007 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #ifndef __MTP__UNICODE__H #define __MTP__UNICODE__H int ucs2_strlen(uint16_t const * const); char *utf16_to_utf8(LIBMTP_mtpdevice_t*,const uint16_t*); uint16_t *utf8_to_utf16(LIBMTP_mtpdevice_t*, const char*); void strip_7bit_from_utf8(char *str); #endif /* __MTP__UNICODE__H */ libmtp-1.1.10/src/libusb-glue.c0000644000175000001440000020024712540343671013155 00000000000000/* * \file libusb-glue.c * Low-level USB interface glue towards libusb. * * Copyright (C) 2005-2007 Richard A. Low * Copyright (C) 2005-2012 Linus Walleij * Copyright (C) 2006-2007 Marcus Meissner * Copyright (C) 2007 Ted Bullock * Copyright (C) 2008 Chris Bagwell * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Created by Richard Low on 24/12/2005. (as mtp-utils.c) * Modified by Linus Walleij 2006-03-06 * (Notice that Anglo-Saxons use little-endian dates and Swedes * use big-endian dates.) * */ #include "config.h" #include "libmtp.h" #include "libusb-glue.h" #include "device-flags.h" #include "util.h" #include "ptp.h" #include #include #include #include #include #include "ptp-pack.c" /* Aha, older libusb does not have USB_CLASS_PTP */ #ifndef USB_CLASS_PTP #define USB_CLASS_PTP 6 #endif /* * Default USB timeout length. This can be overridden as needed * but should start with a reasonable value so most common * requests can be completed. The original value of 4000 was * not long enough for large file transfer. Also, players can * spend a bit of time collecting data. Higher values also * make connecting/disconnecting more reliable. */ #define USB_TIMEOUT_DEFAULT 20000 #define USB_TIMEOUT_LONG 60000 static inline int get_timeout(PTP_USB* ptp_usb) { if (FLAG_LONG_TIMEOUT(ptp_usb)) { return USB_TIMEOUT_LONG; } return USB_TIMEOUT_DEFAULT; } /* USB control message data phase direction */ #ifndef USB_DP_HTD #define USB_DP_HTD (0x00 << 7) /* host to device */ #endif #ifndef USB_DP_DTH #define USB_DP_DTH (0x01 << 7) /* device to host */ #endif /* USB Feature selector HALT */ #ifndef USB_FEATURE_HALT #define USB_FEATURE_HALT 0x00 #endif /* Internal data types */ struct mtpdevice_list_struct { struct usb_device *libusb_device; PTPParams *params; PTP_USB *ptp_usb; uint32_t bus_location; struct mtpdevice_list_struct *next; }; typedef struct mtpdevice_list_struct mtpdevice_list_t; static const LIBMTP_device_entry_t mtp_device_table[] = { /* We include an .h file which is shared between us and libgphoto2 */ #include "music-players.h" }; static const int mtp_device_table_size = sizeof(mtp_device_table) / sizeof(LIBMTP_device_entry_t); // Local functions static struct usb_bus* init_usb(); static void close_usb(PTP_USB* ptp_usb); static int find_interface_and_endpoints(struct usb_device *dev, uint8_t *conf, uint8_t *interface, uint8_t *altsetting, int* inep, int* inep_maxpacket, int* outep, int* outep_maxpacket, int* intep); static void clear_stall(PTP_USB* ptp_usb); static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, struct usb_device* dev); static short ptp_write_func(unsigned long,PTPDataHandler*,void *data,unsigned long*); static short ptp_read_func(unsigned long,PTPDataHandler*,void *data,unsigned long*,int); static int usb_clear_stall_feature(PTP_USB* ptp_usb, int ep); static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status); /** * Get a list of the supported USB devices. * * The developers depend on users of this library to constantly * add in to the list of supported devices. What we need is the * device name, USB Vendor ID (VID) and USB Product ID (PID). * put this into a bug ticket at the project homepage, please. * The VID/PID is used to let e.g. udev lift the device to * console userspace access when it's plugged in. * * @param devices a pointer to a pointer that will hold a device * list after the call to this function, if it was * successful. * @param numdevs a pointer to an integer that will hold the number * of devices in the device list if the call was successful. * @return 0 if the list was successfull retrieved, any other * value means failure. */ int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const devices, int * const numdevs) { *devices = (LIBMTP_device_entry_t *) &mtp_device_table; *numdevs = mtp_device_table_size; return 0; } static struct usb_bus* init_usb() { struct usb_bus* busses; struct usb_bus* bus; /* * Some additional libusb debugging please. * We use the same level debug between MTP and USB. */ if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) usb_set_debug(9); usb_init(); usb_find_busses(); usb_find_devices(); /* Workaround a libusb 0.1 bug : bus location is not initialised */ busses = usb_get_busses(); for (bus = busses; bus != NULL; bus = bus->next) { if (!bus->location) bus->location = strtoul(bus->dirname, NULL, 10); } return (busses); } /** * Small recursive function to append a new usb_device to the linked list of * USB MTP devices * @param devlist dynamic linked list of pointers to usb devices with MTP * properties, to be extended with new device. * @param newdevice the new device to add. * @param bus_location bus for this device. * @return an extended array or NULL on failure. */ static mtpdevice_list_t *append_to_mtpdevice_list(mtpdevice_list_t *devlist, struct usb_device *newdevice, uint32_t bus_location) { mtpdevice_list_t *new_list_entry; new_list_entry = (mtpdevice_list_t *) malloc(sizeof(mtpdevice_list_t)); if (new_list_entry == NULL) { return NULL; } // Fill in USB device, if we *HAVE* to make a copy of the device do it here. new_list_entry->libusb_device = newdevice; new_list_entry->bus_location = bus_location; new_list_entry->next = NULL; if (devlist == NULL) { return new_list_entry; } else { mtpdevice_list_t *tmp = devlist; while (tmp->next != NULL) { tmp = tmp->next; } tmp->next = new_list_entry; } return devlist; } /** * Small recursive function to free dynamic memory allocated to the linked list * of USB MTP devices * @param devlist dynamic linked list of pointers to usb devices with MTP * properties. * @return nothing */ static void free_mtpdevice_list(mtpdevice_list_t *devlist) { mtpdevice_list_t *tmplist = devlist; if (devlist == NULL) return; while (tmplist != NULL) { mtpdevice_list_t *tmp = tmplist; tmplist = tmplist->next; // Do not free() the fields (ptp_usb, params)! These are used elsewhere. free(tmp); } return; } /** * This checks if a device has an MTP descriptor. The descriptor was * elaborated about in gPhoto bug 1482084, and some official documentation * with no strings attached was published by Microsoft at * http://www.microsoft.com/whdc/system/bus/USB/USBFAQ_intermed.mspx#E3HAC * * @param dev a device struct from libusb. * @param dumpfile set to non-NULL to make the descriptors dump out * to this file in human-readable hex so we can scruitinze them. * @return 1 if the device is MTP compliant, 0 if not. */ static int probe_device_descriptor(struct usb_device *dev, FILE *dumpfile) { usb_dev_handle *devh; unsigned char buf[1024], cmd; int i; int ret; /* This is to indicate if we find some vendor interface */ int found_vendor_spec_interface = 0; /* * Don't examine devices that are not likely to * contain any MTP interface, update this the day * you find some weird combination... */ if (!(dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE || dev->descriptor.bDeviceClass == USB_CLASS_COMM || dev->descriptor.bDeviceClass == USB_CLASS_PTP || dev->descriptor.bDeviceClass == 0xEF || /* Intf. Association Desc.*/ dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC)) { return 0; } /* Attempt to open Device on this port */ devh = usb_open(dev); if (devh == NULL) { /* Could not open this device */ return 0; } /* * This sometimes crashes on the j for loop below * I think it is because config is NULL yet * dev->descriptor.bNumConfigurations > 0 * this check should stop this */ if (dev->config) { /* * Loop over the device configurations and interfaces. Nokia MTP-capable * handsets (possibly others) typically have the string "MTP" in their * MTP interface descriptions, that's how they can be detected, before * we try the more esoteric "OS descriptors" (below). */ for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { uint8_t j; for (j = 0; j < dev->config[i].bNumInterfaces; j++) { int k; for (k = 0; k < dev->config[i].interface[j].num_altsetting; k++) { /* Current interface descriptor */ struct usb_interface_descriptor *intf = &dev->config[i].interface[j].altsetting[k]; /* * MTP interfaces have three endpoints, two bulk and one * interrupt. Don't probe anything else. */ if (intf->bNumEndpoints != 3) continue; /* * We only want to probe for the OS descriptor if the * device is USB_CLASS_VENDOR_SPEC or one of the interfaces * in it is, so flag if we find an interface like this. */ if (intf->bInterfaceClass == USB_CLASS_VENDOR_SPEC) { found_vendor_spec_interface = 1; } /* * Check for Still Image Capture class with PIMA 15740 protocol, * also known as PTP */ #if 0 if (intf->bInterfaceClass == USB_CLASS_PTP && intf->bInterfaceSubClass == 0x01 && intf->bInterfaceProtocol == 0x01) { if (dumpfile != NULL) { fprintf(dumpfile, " Found PTP device, check vendor " "extension...\n"); } // This is where we may insert code to open a PTP // session and query the vendor extension ID to see // if it is 0xffffffff, i.e. MTP according to the spec. if (was_mtp_extension) { usb_close(devh); return 1; } } #endif /* * Next we search for the MTP substring in the interface name. * For example : "RIM MS/MTP" should work. */ buf[0] = '\0'; ret = usb_get_string_simple(devh, dev->config[i].interface[j].altsetting[k].iInterface, (char *) buf, 1024); if (ret < 3) continue; if (strstr((char *) buf, "MTP") != NULL) { if (dumpfile != NULL) { fprintf(dumpfile, "Configuration %d, interface %d, altsetting %d:\n", i, j, k); fprintf(dumpfile, " Interface description contains the string \"MTP\"\n"); fprintf(dumpfile, " Device recognized as MTP, no further probing.\n"); } usb_close(devh); return 1; } #ifdef LIBUSB_HAS_GET_DRIVER_NP { /* * Specifically avoid probing anything else than USB mass storage devices * and non-associated drivers in Linux. */ char devname[0x10]; devname[0] = '\0'; ret = usb_get_driver_np(devh, dev->config[i].interface[j].altsetting[k].iInterface, devname, sizeof(devname)); if (devname[0] != '\0' && strcmp(devname, "usb-storage")) { LIBMTP_INFO("avoid probing device using kernel interface \"%s\"\n", devname); return 0; } } #endif } } } } else { if (dev->descriptor.bNumConfigurations) LIBMTP_INFO("dev->config is NULL in probe_device_descriptor yet dev->descriptor.bNumConfigurations > 0\n"); } /* * Only probe for OS descriptor if the device is vendor specific * or one of the interfaces found is. */ if (dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC || found_vendor_spec_interface) { /* Read the special descriptor */ ret = usb_get_descriptor(devh, 0x03, 0xee, buf, sizeof(buf)); /* * If something failed we're probably stalled to we need * to clear the stall off the endpoint and say this is not * MTP. */ if (ret < 0) { /* EP0 is the default control endpoint */ usb_clear_halt(devh, 0); usb_close(devh); return 0; } // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device descriptor 0xee:\n"); data_dump_ascii(dumpfile, buf, ret, 16); } /* Check if descriptor length is at least 10 bytes */ if (ret < 10) { usb_close(devh); return 0; } /* Check if this device has a Microsoft Descriptor */ if (!((buf[2] == 'M') && (buf[4] == 'S') && (buf[6] == 'F') && (buf[8] == 'T'))) { usb_close(devh); return 0; } /* Check if device responds to control message 1 or if there is an error */ cmd = buf[16]; ret = usb_control_msg (devh, USB_ENDPOINT_IN | USB_RECIP_DEVICE | USB_TYPE_VENDOR, cmd, 0, 4, (char *) buf, sizeof(buf), USB_TIMEOUT_DEFAULT); // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device response to control message 1, CMD 0x%02x:\n", cmd); data_dump_ascii(dumpfile, buf, ret, 16); } /* If this is true, the device either isn't MTP or there was an error */ if (ret <= 0x15) { /* TODO: If there was an error, flag it and let the user know somehow */ /* if(ret == -1) {} */ usb_close(devh); return 0; } /* Check if device is MTP or if it is something like a USB Mass Storage device with Janus DRM support */ if ((buf[0x12] != 'M') || (buf[0x13] != 'T') || (buf[0x14] != 'P')) { usb_close(devh); return 0; } /* After this point we are probably dealing with an MTP device */ /* * Check if device responds to control message 2, which is * the extended device parameters. Most devices will just * respond with a copy of the same message as for the first * message, some respond with zero-length (which is OK) * and some with pure garbage. We're not parsing the result * so this is not very important. */ ret = usb_control_msg (devh, USB_ENDPOINT_IN | USB_RECIP_DEVICE | USB_TYPE_VENDOR, cmd, 0, 5, (char *) buf, sizeof(buf), USB_TIMEOUT_DEFAULT); // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device response to control message 2, CMD 0x%02x:\n", cmd); data_dump_ascii(dumpfile, buf, ret, 16); } /* If this is true, the device errored against control message 2 */ if (ret == -1) { /* TODO: Implement callback function to let managing program know there was a problem, along with description of the problem */ LIBMTP_ERROR("Potential MTP Device with VendorID:%04x and " "ProductID:%04x encountered an error responding to " "control message 2.\n" "Problems may arrise but continuing\n", dev->descriptor.idVendor, dev->descriptor.idProduct); } else if (dumpfile != NULL && ret == 0) { fprintf(dumpfile, "Zero-length response to control message 2 (OK)\n"); } else if (dumpfile != NULL) { fprintf(dumpfile, "Device responds to control message 2 with some data.\n"); } /* Close the USB device handle */ usb_close(devh); return 1; } /* Close the USB device handle */ usb_close(devh); return 0; } /** * This function scans through the connected usb devices on a machine and * if they match known Vendor and Product identifiers appends them to the * dynamic array mtp_device_list. Be sure to call * free_mtpdevice_list(mtp_device_list) when you are done * with it, assuming it is not NULL. * @param mtp_device_list dynamic array of pointers to usb devices with MTP * properties (if this list is not empty, new entries will be appended * to the list). * @return LIBMTP_ERROR_NONE implies that devices have been found, scan the list * appropriately. LIBMTP_ERROR_NO_DEVICE_ATTACHED implies that no * devices have been found. */ static LIBMTP_error_number_t get_mtp_usb_device_list(mtpdevice_list_t ** mtp_device_list) { struct usb_bus *bus = init_usb(); for (; bus != NULL; bus = bus->next) { struct usb_device *dev = bus->devices; for (; dev != NULL; dev = dev->next) { if (dev->descriptor.bDeviceClass != USB_CLASS_HUB) { int i; int found = 0; // First check if we know about the device already. // Devices well known to us will not have their descriptors // probed, it caused problems with some devices. for(i = 0; i < mtp_device_table_size; i++) { if(dev->descriptor.idVendor == mtp_device_table[i].vendor_id && dev->descriptor.idProduct == mtp_device_table[i].product_id) { /* Append this usb device to the MTP device list */ *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, bus->location); found = 1; break; } } // If we didn't know it, try probing the "OS Descriptor". if (!found) { if (probe_device_descriptor(dev, NULL)) { /* Append this usb device to the MTP USB Device List */ *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, bus->location); } /* * By thomas_-_s: Also append devices that are no MTP but PTP devices * if this is commented out. */ /* else { // Check whether the device is no USB hub but a PTP. if ( dev->config != NULL &&dev->config->interface->altsetting->bInterfaceClass == USB_CLASS_PTP && dev->descriptor.bDeviceClass != USB_CLASS_HUB ) { *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, bus->location); } } */ } } } } /* If nothing was found we end up here. */ if(*mtp_device_list == NULL) { return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } return LIBMTP_ERROR_NONE; } /** * Checks if a specific device with a certain bus and device * number has an MTP type device descriptor. * * @param busno the bus number of the device to check * @param deviceno the device number of the device to check * @return 1 if the device is MTP else 0 */ int LIBMTP_Check_Specific_Device(int busno, int devno) { struct usb_bus *bus = init_usb(); for (; bus != NULL; bus = bus->next) { struct usb_device *dev = bus->devices; if (bus->location != busno) continue; for (; dev != NULL; dev = dev->next) { if (dev->devnum != devno) continue; if (probe_device_descriptor(dev, NULL)) return 1; } } return 0; } /** * Detect the raw MTP device descriptors and return a list of * of the devices found. * * @param devices a pointer to a variable that will hold * the list of raw devices found. This may be NULL * on return if the number of detected devices is zero. * The user shall simply free() this * variable when finished with the raw devices, * in order to release memory. * @param numdevs a pointer to an integer that will hold * the number of devices in the list. This may * be 0. * @return 0 if successful, any other value means failure. */ LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t ** devices, int * numdevs) { mtpdevice_list_t *devlist = NULL; mtpdevice_list_t *dev; LIBMTP_error_number_t ret; LIBMTP_raw_device_t *retdevs; int devs = 0; int i, j; ret = get_mtp_usb_device_list(&devlist); if (ret == LIBMTP_ERROR_NO_DEVICE_ATTACHED) { *devices = NULL; *numdevs = 0; return ret; } else if (ret != LIBMTP_ERROR_NONE) { LIBMTP_ERROR("LIBMTP PANIC: get_mtp_usb_device_list() " "error code: %d on line %d\n", ret, __LINE__); return ret; } // Get list size dev = devlist; while (dev != NULL) { devs++; dev = dev->next; } if (devs == 0) { *devices = NULL; *numdevs = 0; return LIBMTP_ERROR_NONE; } // Conjure a device list retdevs = (LIBMTP_raw_device_t *) malloc(sizeof(LIBMTP_raw_device_t) * devs); if (retdevs == NULL) { // Out of memory *devices = NULL; *numdevs = 0; return LIBMTP_ERROR_MEMORY_ALLOCATION; } dev = devlist; i = 0; while (dev != NULL) { int device_known = 0; // Assign default device info retdevs[i].device_entry.vendor = NULL; retdevs[i].device_entry.vendor_id = dev->libusb_device->descriptor.idVendor; retdevs[i].device_entry.product = NULL; retdevs[i].device_entry.product_id = dev->libusb_device->descriptor.idProduct; retdevs[i].device_entry.device_flags = 0x00000000U; // See if we can locate some additional vendor info and device flags for(j = 0; j < mtp_device_table_size; j++) { if(dev->libusb_device->descriptor.idVendor == mtp_device_table[j].vendor_id && dev->libusb_device->descriptor.idProduct == mtp_device_table[j].product_id) { device_known = 1; retdevs[i].device_entry.vendor = mtp_device_table[j].vendor; retdevs[i].device_entry.product = mtp_device_table[j].product; retdevs[i].device_entry.device_flags = mtp_device_table[j].device_flags; // This device is known to the developers LIBMTP_ERROR("Device %d (VID=%04x and PID=%04x) is a %s %s.\n", i, dev->libusb_device->descriptor.idVendor, dev->libusb_device->descriptor.idProduct, mtp_device_table[j].vendor, mtp_device_table[j].product); break; } } if (!device_known) { device_unknown(i, dev->libusb_device->descriptor.idVendor, dev->libusb_device->descriptor.idProduct); } // Save the location on the bus retdevs[i].bus_location = dev->bus_location; retdevs[i].devnum = dev->libusb_device->devnum; i++; dev = dev->next; } *devices = retdevs; *numdevs = i; free_mtpdevice_list(devlist); return LIBMTP_ERROR_NONE; } /** * This routine just dumps out low-level * USB information about the current device. * @param ptp_usb the USB device to get information from. */ void dump_usbinfo(PTP_USB *ptp_usb) { struct usb_device *dev; #ifdef LIBUSB_HAS_GET_DRIVER_NP char devname[0x10]; int res; devname[0] = '\0'; res = usb_get_driver_np(ptp_usb->handle, (int) ptp_usb->interface, devname, sizeof(devname)); if (devname[0] != '\0') { LIBMTP_INFO(" Using kernel interface \"%s\"\n", devname); } #endif dev = usb_device(ptp_usb->handle); LIBMTP_INFO(" bcdUSB: %d\n", dev->descriptor.bcdUSB); LIBMTP_INFO(" bDeviceClass: %d\n", dev->descriptor.bDeviceClass); LIBMTP_INFO(" bDeviceSubClass: %d\n", dev->descriptor.bDeviceSubClass); LIBMTP_INFO(" bDeviceProtocol: %d\n", dev->descriptor.bDeviceProtocol); LIBMTP_INFO(" idVendor: %04x\n", dev->descriptor.idVendor); LIBMTP_INFO(" idProduct: %04x\n", dev->descriptor.idProduct); LIBMTP_INFO(" IN endpoint maxpacket: %d bytes\n", ptp_usb->inep_maxpacket); LIBMTP_INFO(" OUT endpoint maxpacket: %d bytes\n", ptp_usb->outep_maxpacket); LIBMTP_INFO(" Raw device info:\n"); LIBMTP_INFO(" Bus location: %d\n", ptp_usb->rawdevice.bus_location); LIBMTP_INFO(" Device number: %d\n", ptp_usb->rawdevice.devnum); LIBMTP_INFO(" Device entry info:\n"); LIBMTP_INFO(" Vendor: %s\n", ptp_usb->rawdevice.device_entry.vendor); LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.vendor_id); LIBMTP_INFO(" Product: %s\n", ptp_usb->rawdevice.device_entry.product); LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.product_id); LIBMTP_INFO(" Device flags: 0x%08x\n", ptp_usb->rawdevice.device_entry.device_flags); (void) probe_device_descriptor(dev, stdout); } /** * Retrieve the apropriate playlist extension for this * device. Rather hacky at the moment. This is probably * desired by the managing software, but when creating * lists on the device itself you notice certain preferences. * @param ptp_usb the USB device to get suggestion for. * @return the suggested playlist extension. */ const char *get_playlist_extension(PTP_USB *ptp_usb) { struct usb_device *dev; static char creative_pl_extension[] = ".zpl"; static char default_pl_extension[] = ".pla"; dev = usb_device(ptp_usb->handle); if (dev->descriptor.idVendor == 0x041e) { return creative_pl_extension; } return default_pl_extension; } static void libusb_glue_debug (PTPParams *params, const char *format, ...) { va_list args; va_start (args, format); if (params->debug_func!=NULL) params->debug_func (params->data, format, args); else { vfprintf (stderr, format, args); fprintf (stderr,"\n"); fflush (stderr); } va_end (args); } static void libusb_glue_error (PTPParams *params, const char *format, ...) { va_list args; va_start (args, format); if (params->error_func!=NULL) params->error_func (params->data, format, args); else { vfprintf (stderr, format, args); fprintf (stderr,"\n"); fflush (stderr); } va_end (args); } /* * ptp_read_func() and ptp_write_func() are * based on same functions usb.c in libgphoto2. * Much reading packet logs and having fun with trials and errors * reveals that WMP / Windows is probably using an algorithm like this * for large transfers: * * 1. Send the command (0x0c bytes) if headers are split, else, send * command plus sizeof(endpoint) - 0x0c bytes. * 2. Send first packet, max size to be sizeof(endpoint) but only when using * split headers. Else goto 3. * 3. REPEAT send 0x10000 byte chunks UNTIL remaining bytes < 0x10000 * We call 0x10000 CONTEXT_BLOCK_SIZE. * 4. Send remaining bytes MOD sizeof(endpoint) * 5. Send remaining bytes. If this happens to be exactly sizeof(endpoint) * then also send a zero-length package. * * Further there is some special quirks to handle zero reads from the * device, since some devices can't do them at all due to shortcomings * of the USB slave controller in the device. */ #define CONTEXT_BLOCK_SIZE_1 0x3e00 #define CONTEXT_BLOCK_SIZE_2 0x200 #define CONTEXT_BLOCK_SIZE CONTEXT_BLOCK_SIZE_1+CONTEXT_BLOCK_SIZE_2 static short ptp_read_func ( unsigned long size, PTPDataHandler *handler,void *data, unsigned long *readbytes, int readzero ) { PTP_USB *ptp_usb = (PTP_USB *)data; unsigned long toread = 0; int result = 0; unsigned long curread = 0; unsigned long written; unsigned char *bytes; int expect_terminator_byte = 0; unsigned long usb_inep_maxpacket_size; unsigned long context_block_size_1; unsigned long context_block_size_2; uint16_t ptp_dev_vendor_id = ptp_usb->rawdevice.device_entry.vendor_id; //"iRiver" device special handling if (ptp_dev_vendor_id == 0x4102 || ptp_dev_vendor_id == 0x1006) { usb_inep_maxpacket_size = ptp_usb->inep_maxpacket; if (usb_inep_maxpacket_size == 0x400) { context_block_size_1 = CONTEXT_BLOCK_SIZE_1 - 0x200; context_block_size_2 = CONTEXT_BLOCK_SIZE_2 + 0x200; } else { context_block_size_1 = CONTEXT_BLOCK_SIZE_1; context_block_size_2 = CONTEXT_BLOCK_SIZE_2; } } // This is the largest block we'll need to read in. bytes = malloc(CONTEXT_BLOCK_SIZE); while (curread < size) { LIBMTP_USB_DEBUG("Remaining size to read: 0x%04lx bytes\n", size - curread); // check equal to condition here if (size - curread < CONTEXT_BLOCK_SIZE) { // this is the last packet toread = size - curread; // this is equivalent to zero read for these devices if (readzero && FLAG_NO_ZERO_READS(ptp_usb) && toread % 64 == 0) { toread += 1; expect_terminator_byte = 1; } } else if (ptp_dev_vendor_id == 0x4102 || ptp_dev_vendor_id == 0x1006) { //"iRiver" device special handling if (curread == 0) // we are first packet, but not last packet toread = context_block_size_1; else if (toread == context_block_size_1) toread = context_block_size_2; else if (toread == context_block_size_2) toread = context_block_size_1; else LIBMTP_INFO("unexpected toread size 0x%04x, 0x%04x remaining bytes\n", (unsigned int) toread, (unsigned int) (size-curread)); } else toread = CONTEXT_BLOCK_SIZE; LIBMTP_USB_DEBUG("Reading in 0x%04lx bytes\n", toread); result = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, (char*) bytes, toread, ptp_usb->timeout); LIBMTP_USB_DEBUG("Result of read: 0x%04x\n", result); if (result < 0) { return PTP_ERROR_IO; } LIBMTP_USB_DEBUG("<==USB IN\n"); if (result == 0) LIBMTP_USB_DEBUG("Zero Read\n"); else LIBMTP_USB_DATA(bytes, result, 16); // want to discard extra byte if (expect_terminator_byte && result == toread) { LIBMTP_USB_DEBUG("<==USB IN\nDiscarding extra byte\n"); result--; } int putfunc_ret = handler->putfunc(NULL, handler->priv, result, bytes, &written); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; ptp_usb->current_transfer_complete += result; curread += result; // Increase counters, call callback if (ptp_usb->callback_active) { if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { // send last update and disable callback. ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; ptp_usb->callback_active = 0; } if (ptp_usb->current_transfer_callback != NULL) { int ret; ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, ptp_usb->current_transfer_total, ptp_usb->current_transfer_callback_data); if (ret != 0) { return PTP_ERROR_CANCEL; } } } if (result < toread) /* short reads are common */ break; } if (readbytes) *readbytes = curread; free (bytes); // there might be a zero packet waiting for us... if (readzero && !FLAG_NO_ZERO_READS(ptp_usb) && curread % ptp_usb->outep_maxpacket == 0) { char temp; int zeroresult = 0; LIBMTP_USB_DEBUG("<==USB IN\n"); LIBMTP_USB_DEBUG("Zero Read\n"); zeroresult = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &temp, 0, ptp_usb->timeout); if (zeroresult != 0) LIBMTP_INFO("LIBMTP panic: unable to read in zero packet, response 0x%04x", zeroresult); } return PTP_RC_OK; } static short ptp_write_func ( unsigned long size, PTPDataHandler *handler, void *data, unsigned long *written ) { PTP_USB *ptp_usb = (PTP_USB *)data; unsigned long towrite = 0; int result = 0; unsigned long curwrite = 0; unsigned char *bytes; // This is the largest block we'll need to read in. bytes = malloc(CONTEXT_BLOCK_SIZE); if (!bytes) { return PTP_ERROR_IO; } while (curwrite < size) { unsigned long usbwritten = 0; towrite = size-curwrite; if (towrite > CONTEXT_BLOCK_SIZE) { towrite = CONTEXT_BLOCK_SIZE; } else { // This magic makes packets the same size that WMP send them. if (towrite > ptp_usb->outep_maxpacket && towrite % ptp_usb->outep_maxpacket != 0) { towrite -= towrite % ptp_usb->outep_maxpacket; } } int getfunc_ret = handler->getfunc(NULL, handler->priv,towrite,bytes,&towrite); if (getfunc_ret != PTP_RC_OK) return getfunc_ret; while (usbwritten < towrite) { result = USB_BULK_WRITE(ptp_usb->handle, ptp_usb->outep, ((char*) bytes+usbwritten), towrite-usbwritten, ptp_usb->timeout); LIBMTP_USB_DEBUG("USB OUT==>\n"); LIBMTP_USB_DATA(bytes+usbwritten, result, 16); if (result < 0) { return PTP_ERROR_IO; } // check for result == 0 perhaps too. // Increase counters ptp_usb->current_transfer_complete += result; curwrite += result; usbwritten += result; } // call callback if (ptp_usb->callback_active) { if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { // send last update and disable callback. ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; ptp_usb->callback_active = 0; } if (ptp_usb->current_transfer_callback != NULL) { int ret; ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, ptp_usb->current_transfer_total, ptp_usb->current_transfer_callback_data); if (ret != 0) { return PTP_ERROR_CANCEL; } } } if (result < towrite) /* short writes happen */ break; } free (bytes); if (written) { *written = curwrite; } // If this is the last transfer send a zero write if required if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { if ((towrite % ptp_usb->outep_maxpacket) == 0) { LIBMTP_USB_DEBUG("USB OUT==>\n"); LIBMTP_USB_DEBUG("Zero Write\n"); result=USB_BULK_WRITE(ptp_usb->handle, ptp_usb->outep, (char *) "x", 0, ptp_usb->timeout); } } if (result < 0) return PTP_ERROR_IO; return PTP_RC_OK; } /* memory data get/put handler */ typedef struct { unsigned char *data; unsigned long size, curoff; } PTPMemHandlerPrivate; static uint16_t memory_getfunc(PTPParams* params, void* private, unsigned long wantlen, unsigned char *data, unsigned long *gotlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)private; unsigned long tocopy = wantlen; if (priv->curoff + tocopy > priv->size) tocopy = priv->size - priv->curoff; memcpy (data, priv->data + priv->curoff, tocopy); priv->curoff += tocopy; *gotlen = tocopy; return PTP_RC_OK; } static uint16_t memory_putfunc(PTPParams* params, void* private, unsigned long sendlen, unsigned char *data, unsigned long *putlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)private; if (priv->curoff + sendlen > priv->size) { priv->data = realloc (priv->data, priv->curoff+sendlen); priv->size = priv->curoff + sendlen; } memcpy (priv->data + priv->curoff, data, sendlen); priv->curoff += sendlen; *putlen = sendlen; return PTP_RC_OK; } /* init private struct for receiving data. */ static uint16_t ptp_init_recv_memory_handler(PTPDataHandler *handler) { PTPMemHandlerPrivate* priv; priv = malloc (sizeof(PTPMemHandlerPrivate)); handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = NULL; priv->size = 0; priv->curoff = 0; return PTP_RC_OK; } /* init private struct and put data in for sending data. * data is still owned by caller. */ static uint16_t ptp_init_send_memory_handler(PTPDataHandler *handler, unsigned char *data, unsigned long len ) { PTPMemHandlerPrivate* priv; priv = malloc (sizeof(PTPMemHandlerPrivate)); if (!priv) return PTP_RC_GeneralError; handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = data; priv->size = len; priv->curoff = 0; return PTP_RC_OK; } /* free private struct + data */ static uint16_t ptp_exit_send_memory_handler (PTPDataHandler *handler) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)handler->priv; /* data is owned by caller */ free (priv); return PTP_RC_OK; } /* hand over our internal data to caller */ static uint16_t ptp_exit_recv_memory_handler (PTPDataHandler *handler, unsigned char **data, unsigned long *size ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)handler->priv; *data = priv->data; *size = priv->size; free (priv); return PTP_RC_OK; } /* send / receive functions */ uint16_t ptp_usb_sendreq (PTPParams* params, PTPContainer* req) { uint16_t ret; PTPUSBBulkContainer usbreq; PTPDataHandler memhandler; unsigned long written = 0; unsigned long towrite; char txt[256]; (void) ptp_render_opcode (params, req->Code, sizeof(txt), txt); LIBMTP_USB_DEBUG("REQUEST: 0x%04x, %s\n", req->Code, txt); /* build appropriate USB container */ usbreq.length=htod32(PTP_USB_BULK_REQ_LEN- (sizeof(uint32_t)*(5-req->Nparam))); usbreq.type=htod16(PTP_USB_CONTAINER_COMMAND); usbreq.code=htod16(req->Code); usbreq.trans_id=htod32(req->Transaction_ID); usbreq.payload.params.param1=htod32(req->Param1); usbreq.payload.params.param2=htod32(req->Param2); usbreq.payload.params.param3=htod32(req->Param3); usbreq.payload.params.param4=htod32(req->Param4); usbreq.payload.params.param5=htod32(req->Param5); /* send it to responder */ towrite = PTP_USB_BULK_REQ_LEN-(sizeof(uint32_t)*(5-req->Nparam)); ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, towrite); ret=ptp_write_func( towrite, &memhandler, params->data, &written ); ptp_exit_send_memory_handler (&memhandler); if (ret!=PTP_RC_OK && ret!=PTP_ERROR_CANCEL) { ret = PTP_ERROR_IO; } if (written != towrite && ret != PTP_ERROR_CANCEL && ret != PTP_ERROR_IO) { libusb_glue_error (params, "PTP: request code 0x%04x sending req wrote only %ld bytes instead of %d", req->Code, written, towrite ); ret = PTP_ERROR_IO; } return ret; } uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp, uint64_t size, PTPDataHandler *handler ) { uint16_t ret; int wlen, datawlen; unsigned long written; PTPUSBBulkContainer usbdata; uint64_t bytes_left_to_transfer; PTPDataHandler memhandler; LIBMTP_USB_DEBUG("SEND DATA PHASE\n"); /* build appropriate USB container */ usbdata.length = htod32(PTP_USB_BULK_HDR_LEN+size); usbdata.type = htod16(PTP_USB_CONTAINER_DATA); usbdata.code = htod16(ptp->Code); usbdata.trans_id= htod32(ptp->Transaction_ID); ((PTP_USB*)params->data)->current_transfer_complete = 0; ((PTP_USB*)params->data)->current_transfer_total = size+PTP_USB_BULK_HDR_LEN; if (params->split_header_data) { datawlen = 0; wlen = PTP_USB_BULK_HDR_LEN; } else { unsigned long gotlen; /* For all camera devices. */ datawlen = (sizegetfunc(params, handler->priv, datawlen, usbdata.payload.data, &gotlen); if (ret != PTP_RC_OK) return ret; if (gotlen != datawlen) return PTP_RC_GeneralError; } ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, wlen); /* send first part of data */ ret = ptp_write_func(wlen, &memhandler, params->data, &written); ptp_exit_send_memory_handler (&memhandler); if (ret!=PTP_RC_OK) { return ret; } if (size <= datawlen) return ret; /* if everything OK send the rest */ bytes_left_to_transfer = size-datawlen; ret = PTP_RC_OK; while(bytes_left_to_transfer > 0) { ret = ptp_write_func (bytes_left_to_transfer, handler, params->data, &written); if (ret != PTP_RC_OK) break; if (written == 0) { ret = PTP_ERROR_IO; break; } bytes_left_to_transfer -= written; } if (ret!=PTP_RC_OK && ret!=PTP_ERROR_CANCEL) ret = PTP_ERROR_IO; return ret; } static uint16_t ptp_usb_getpacket(PTPParams *params, PTPUSBBulkContainer *packet, unsigned long *rlen) { PTPDataHandler memhandler; uint16_t ret; unsigned char *x = NULL; unsigned long packet_size; PTP_USB *ptp_usb = (PTP_USB *) params->data; packet_size = ptp_usb->inep_maxpacket; /* read the header and potentially the first data */ if (params->response_packet_size > 0) { /* If there is a buffered packet, just use it. */ memcpy(packet, params->response_packet, params->response_packet_size); *rlen = params->response_packet_size; free(params->response_packet); params->response_packet = NULL; params->response_packet_size = 0; /* Here this signifies a "virtual read" */ return PTP_RC_OK; } ptp_init_recv_memory_handler (&memhandler); ret = ptp_read_func(packet_size, &memhandler, params->data, rlen, 0); ptp_exit_recv_memory_handler (&memhandler, &x, rlen); if (x) { memcpy (packet, x, *rlen); free (x); } return ret; } uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler) { uint16_t ret; PTPUSBBulkContainer usbdata; unsigned long written; PTP_USB *ptp_usb = (PTP_USB *) params->data; int putfunc_ret; LIBMTP_USB_DEBUG("GET DATA PHASE\n"); memset(&usbdata,0,sizeof(usbdata)); do { unsigned long len, rlen; ret = ptp_usb_getpacket(params, &usbdata, &rlen); if (ret!=PTP_RC_OK) { ret = PTP_ERROR_IO; break; } if (dtoh16(usbdata.type)!=PTP_USB_CONTAINER_DATA) { ret = PTP_ERROR_DATA_EXPECTED; break; } if (dtoh16(usbdata.code)!=ptp->Code) { if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { libusb_glue_debug (params, "ptp2/ptp_usb_getdata: detected a broken " "PTP header, code field insane, expect problems! (But continuing)"); // Repair the header, so it won't wreak more havoc, don't just ignore it. // Typically these two fields will be broken. usbdata.code = htod16(ptp->Code); usbdata.trans_id = htod32(ptp->Transaction_ID); ret = PTP_RC_OK; } else { ret = dtoh16(usbdata.code); // This filters entirely insane garbage return codes, but still // makes it possible to return error codes in the code field when // getting data. It appears Windows ignores the contents of this // field entirely. if (ret < PTP_RC_Undefined || ret > PTP_RC_SpecificationOfDestinationUnsupported) { libusb_glue_debug (params, "ptp2/ptp_usb_getdata: detected a broken " "PTP header, code field insane."); ret = PTP_ERROR_IO; } break; } } if (rlen == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ) { /* Copy first part of data to 'data' */ putfunc_ret = handler->putfunc( params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data, &written ); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; /* stuff data directly to passed data handler */ while (1) { unsigned long readdata; uint16_t xret; xret = ptp_read_func( 0x20000000, handler, params->data, &readdata, 0 ); if (xret != PTP_RC_OK) return xret; if (readdata < 0x20000000) break; } return PTP_RC_OK; } if (rlen > dtoh32(usbdata.length)) { /* * Buffer the surplus response packet if it is >= * PTP_USB_BULK_HDR_LEN * (i.e. it is probably an entire package) * else discard it as erroneous surplus data. * This will even work if more than 2 packets appear * in the same transaction, they will just be handled * iteratively. * * Marcus observed stray bytes on iRiver devices; * these are still discarded. */ unsigned int packlen = dtoh32(usbdata.length); unsigned int surplen = rlen - packlen; if (surplen >= PTP_USB_BULK_HDR_LEN) { params->response_packet = malloc(surplen); memcpy(params->response_packet, (uint8_t *) &usbdata + packlen, surplen); params->response_packet_size = surplen; /* Ignore reading one extra byte if device flags have been set */ } else if(!FLAG_NO_ZERO_READS(ptp_usb) && (rlen - dtoh32(usbdata.length) == 1)) { libusb_glue_debug (params, "ptp2/ptp_usb_getdata: read %d bytes " "too much, expect problems!", rlen - dtoh32(usbdata.length)); } rlen = packlen; } /* For most PTP devices rlen is 512 == sizeof(usbdata) * here. For MTP devices splitting header and data it might * be 12. */ /* Evaluate full data length. */ len=dtoh32(usbdata.length)-PTP_USB_BULK_HDR_LEN; /* autodetect split header/data MTP devices */ if (dtoh32(usbdata.length) > 12 && (rlen==12)) params->split_header_data = 1; /* Copy first part of data to 'data' */ putfunc_ret = handler->putfunc( params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data, &written ); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; if (FLAG_NO_ZERO_READS(ptp_usb) && len+PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ) { LIBMTP_USB_DEBUG("Reading in extra terminating byte\n"); // need to read in extra byte and discard it int result = 0; char byte = 0; result = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &byte, 1, ptp_usb->timeout); if (result != 1) LIBMTP_INFO("Could not read in extra byte for PTP_USB_BULK_HS_MAX_PACKET_LEN_READ long file, return value 0x%04x\n", result); } else if (len+PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ && params->split_header_data == 0) { int zeroresult = 0; char zerobyte = 0; LIBMTP_INFO("Reading in zero packet after header\n"); zeroresult = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &zerobyte, 0, ptp_usb->timeout); if (zeroresult != 0) LIBMTP_INFO("LIBMTP panic: unable to read in zero packet, response 0x%04x", zeroresult); } /* Is that all of data? */ if (len+PTP_USB_BULK_HDR_LEN<=rlen) { break; } ret = ptp_read_func(len - (rlen - PTP_USB_BULK_HDR_LEN), handler, params->data, &rlen, 1); if (ret!=PTP_RC_OK) { break; } } while (0); return ret; } uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp) { uint16_t ret; unsigned long rlen; PTPUSBBulkContainer usbresp; PTP_USB *ptp_usb = (PTP_USB *)(params->data); LIBMTP_USB_DEBUG("RESPONSE: "); memset(&usbresp,0,sizeof(usbresp)); /* read response, it should never be longer than sizeof(usbresp) */ ret = ptp_usb_getpacket(params, &usbresp, &rlen); // Fix for bevahiour reported by Scott Snyder on Samsung YP-U3. The player // sends a packet containing just zeroes of length 2 (up to 4 has been seen too) // after a NULL packet when it should send the response. This code ignores // such illegal packets. while (ret==PTP_RC_OK && rlenCode) { ret = dtoh16(usbresp.code); } LIBMTP_USB_DEBUG("%04x\n", ret); if (ret!=PTP_RC_OK) { /* libusb_glue_error (params, "PTP: request code 0x%04x getting resp error 0x%04x", resp->Code, ret);*/ return ret; } /* build an appropriate PTPContainer */ resp->Code=dtoh16(usbresp.code); resp->SessionID=params->session_id; resp->Transaction_ID=dtoh32(usbresp.trans_id); if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { if (resp->Transaction_ID != params->transaction_id-1) { libusb_glue_debug (params, "ptp_usb_getresp: detected a broken " "PTP header, transaction ID insane, expect " "problems! (But continuing)"); // Repair the header, so it won't wreak more havoc. resp->Transaction_ID = params->transaction_id-1; } } resp->Param1=dtoh32(usbresp.payload.params.param1); resp->Param2=dtoh32(usbresp.payload.params.param2); resp->Param3=dtoh32(usbresp.payload.params.param3); resp->Param4=dtoh32(usbresp.payload.params.param4); resp->Param5=dtoh32(usbresp.payload.params.param5); return ret; } /* Event handling functions */ /* PTP Events wait for or check mode */ #define PTP_EVENT_CHECK 0x0000 /* waits for */ #define PTP_EVENT_CHECK_FAST 0x0001 /* checks */ static inline uint16_t ptp_usb_event (PTPParams* params, PTPContainer* event, int wait) { uint16_t ret; int result; unsigned long rlen; PTPUSBEventContainer usbevent; PTP_USB *ptp_usb = (PTP_USB *)(params->data); memset(&usbevent,0,sizeof(usbevent)); if ((params==NULL) || (event==NULL)) return PTP_ERROR_BADPARAM; ret = PTP_RC_OK; switch(wait) { case PTP_EVENT_CHECK: result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (char *) &usbevent, sizeof(usbevent), 0); if (result==0) result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (char *) &usbevent, sizeof(usbevent), 0); if (result < 0) ret = PTP_ERROR_IO; break; case PTP_EVENT_CHECK_FAST: result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (char *) &usbevent, sizeof(usbevent), ptp_usb->timeout); if (result==0) result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (char *) &usbevent, sizeof(usbevent), ptp_usb->timeout); if (result < 0) ret = PTP_ERROR_IO; break; default: ret=PTP_ERROR_BADPARAM; break; } if (ret!=PTP_RC_OK) { libusb_glue_error (params, "PTP: reading event an error 0x%04x occurred", ret); return PTP_ERROR_IO; } rlen = result; if (rlen < 8) { libusb_glue_error (params, "PTP: reading event an short read of %ld bytes occurred", rlen); return PTP_ERROR_IO; } /* if we read anything over interrupt endpoint it must be an event */ /* build an appropriate PTPContainer */ event->Code=dtoh16(usbevent.code); event->SessionID=params->session_id; event->Transaction_ID=dtoh32(usbevent.trans_id); event->Param1=dtoh32(usbevent.param1); event->Param2=dtoh32(usbevent.param2); event->Param3=dtoh32(usbevent.param3); return ret; } uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event) { return ptp_usb_event (params, event, PTP_EVENT_CHECK_FAST); } uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event) { return ptp_usb_event (params, event, PTP_EVENT_CHECK); } uint16_t ptp_usb_control_cancel_request (PTPParams *params, uint32_t transactionid) { PTP_USB *ptp_usb = (PTP_USB *)(params->data); int ret; unsigned char buffer[6]; htod16a(&buffer[0],PTP_EC_CancelTransaction); htod32a(&buffer[2],transactionid); ret = usb_control_msg(ptp_usb->handle, USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0x64, 0x0000, 0x0000, (char *) buffer, sizeof(buffer), ptp_usb->timeout); if (ret < sizeof(buffer)) return PTP_ERROR_IO; return PTP_RC_OK; } static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, struct usb_device* dev) { usb_dev_handle *device_handle; char buf[255]; int usbresult; params->sendreq_func=ptp_usb_sendreq; params->senddata_func=ptp_usb_senddata; params->getresp_func=ptp_usb_getresp; params->getdata_func=ptp_usb_getdata; params->cancelreq_func=ptp_usb_control_cancel_request; params->data=ptp_usb; params->transaction_id=0; /* * This is hardcoded here since we have no devices whatsoever that are BE. * Change this the day we run into our first BE device (if ever). */ params->byteorder = PTP_DL_LE; ptp_usb->timeout = get_timeout(ptp_usb); device_handle = usb_open(dev); if (!device_handle) { perror("usb_open()"); return -1; } ptp_usb->handle = device_handle; #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP /* * If this device is known to be wrongfully claimed by other kernel * drivers (such as mass storage), then try to unload it to make it * accessible from user space. */ if (FLAG_UNLOAD_DRIVER(ptp_usb)) { if (usb_get_driver_np(device_handle, (int) ptp_usb->interface, buf, sizeof(buf)) == 0) { if (usb_detach_kernel_driver_np(device_handle, (int) ptp_usb->interface)) { perror("usb_detach_kernel_driver_np()"); return -1; } } } #endif /* * Check if the config is set to something else than what we want * to use. Only set the configuration if we absolutely have to. * Also do not bail out if we fail. */ if (dev->config->bConfigurationValue != ptp_usb->config) { if (usb_set_configuration(device_handle, dev->config->bConfigurationValue)) { perror("error in usb_set_configuration()- continuing anyway"); } } /* * It seems like on kernel 2.6.31 if we already have it open on another * pthread in our app, we'll get an error if we try to claim it again, * but that error is harmless because our process already claimed the interface */ usbresult = usb_claim_interface(device_handle, (int) ptp_usb->interface); if (usbresult != 0) fprintf(stderr, "ignoring usb_claim_interface = %d", usbresult); /* * If the altsetting is set to something different than we want, switch * it. * * FIXME: this seems to cause trouble on the Mac:s so disable it. Retry * this on the Mac now that it only sets this when the altsetting differs. */ #ifndef __APPLE__ #if 0 /* Disable this always, no idea on how to handle it */ if (dev->config->interface[].altsetting[] != ptp_usb->altsetting) { fprintf(stderr, "desired altsetting different from current, trying to set altsetting\n"); usbresult = usb_set_altinterface(device_handle, 0); if (usbresult) fprintf(stderr, "ignoring error from usb_claim_interface = %d\n", usbresult); } #endif #endif if (FLAG_SWITCH_MODE_BLACKBERRY(ptp_usb)) { int ret; // FIXME : Only for BlackBerry Storm // What does it mean? Maybe switch mode... // This first control message is absolutely necessary usleep(1000); ret = usb_control_msg(device_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 0xaa, 0x00, 0x04, buf, 0x40, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 1:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); // This control message is unnecessary ret = usb_control_msg(device_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 0xa5, 0x00, 0x01, buf, 0x02, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 2:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); // This control message is unnecessary ret = usb_control_msg(device_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 0xa8, 0x00, 0x01, buf, 0x05, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 3:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); // This control message is unnecessary ret = usb_control_msg(device_handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, 0xa8, 0x00, 0x01, buf, 0x11, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 4:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); } return 0; } static void clear_stall(PTP_USB* ptp_usb) { uint16_t status; int ret; /* check the inep status */ status = 0; ret = usb_get_endpoint_status(ptp_usb,ptp_usb->inep,&status); if (ret<0) { perror ("inep: usb_get_endpoint_status()"); } else if (status) { LIBMTP_INFO("Clearing stall on IN endpoint\n"); ret = usb_clear_stall_feature(ptp_usb,ptp_usb->inep); if (ret<0) { perror ("usb_clear_stall_feature()"); } } /* check the outep status */ status=0; ret = usb_get_endpoint_status(ptp_usb,ptp_usb->outep,&status); if (ret<0) { perror("outep: usb_get_endpoint_status()"); } else if (status) { LIBMTP_INFO("Clearing stall on OUT endpoint\n"); ret = usb_clear_stall_feature(ptp_usb,ptp_usb->outep); if (ret<0) { perror("usb_clear_stall_feature()"); } } /* TODO: do we need this for INTERRUPT (ptp_usb->intep) too? */ } static void clear_halt(PTP_USB* ptp_usb) { int ret; ret = usb_clear_halt(ptp_usb->handle,ptp_usb->inep); if (ret<0) { perror("usb_clear_halt() on IN endpoint"); } ret = usb_clear_halt(ptp_usb->handle,ptp_usb->outep); if (ret<0) { perror("usb_clear_halt() on OUT endpoint"); } ret = usb_clear_halt(ptp_usb->handle,ptp_usb->intep); if (ret<0) { perror("usb_clear_halt() on INTERRUPT endpoint"); } } static void close_usb(PTP_USB* ptp_usb) { if (!FLAG_NO_RELEASE_INTERFACE(ptp_usb)) { /* * Clear any stalled endpoints * On misbehaving devices designed for Windows/Mac, quote from: * http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt * Device does Bad Things(tm) when it gets a GET_STATUS after CLEAR_HALT * (...) Windows, when clearing a stall, only sends the CLEAR_HALT command, * and presumes that the stall has cleared. Some devices actually choke * if the CLEAR_HALT is followed by a GET_STATUS (used to determine if the * STALL is persistant or not). */ clear_stall(ptp_usb); #if 0 // causes troubles due to a kernel bug in 3.x kernels before/around 3.8 // Clear halts on any endpoints clear_halt(ptp_usb); // Added to clear some stuff on the OUT endpoint // TODO: is this good on the Mac too? // HINT: some devices may need that you comment these two out too. #endif usb_resetep(ptp_usb->handle, ptp_usb->outep); usb_release_interface(ptp_usb->handle, (int) ptp_usb->interface); } if (FLAG_FORCE_RESET_ON_CLOSE(ptp_usb)) { /* * Some devices really love to get reset after being * disconnected. Again, since Windows never disconnects * a device closing behaviour is seldom or never exercised * on devices when engineered and often error prone. * Reset may help some. */ usb_reset(ptp_usb->handle); } usb_close(ptp_usb->handle); } /** * Self-explanatory? */ static int find_interface_and_endpoints(struct usb_device *dev, uint8_t *conf, uint8_t *interface, uint8_t *altsetting, int* inep, int* inep_maxpacket, int* outep, int *outep_maxpacket, int* intep) { uint8_t i; // Loop over the device configurations for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { uint8_t j; *conf = dev->config->bConfigurationValue;; // Loop over each configurations interfaces for (j = 0; j < dev->config[i].bNumInterfaces; j++) { uint8_t k, l; uint8_t no_ep; int found_inep = 0; int found_outep = 0; int found_intep = 0; struct usb_endpoint_descriptor *ep; // Inspect the altsettings of this interface for (k = 0; k < dev->config[i].interface[j].num_altsetting; k++) { // MTP devices shall have 3 endpoints, ignore those interfaces // that haven't. no_ep = dev->config[i].interface[j].altsetting[k].bNumEndpoints; if (no_ep != 3) continue; *interface = dev->config[i].interface[j].altsetting[k].bInterfaceNumber; *altsetting = dev->config[i].interface[j].altsetting[k].bAlternateSetting; ep = dev->config[i].interface[j].altsetting[k].endpoint; // Loop over the three endpoints to locate two bulk and // one interrupt endpoint and FAIL if we cannot, and continue. for (l = 0; l < no_ep; l++) { if (ep[l].bmAttributes == USB_ENDPOINT_TYPE_BULK) { if ((ep[l].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_ENDPOINT_DIR_MASK) { *inep = ep[l].bEndpointAddress; *inep_maxpacket = ep[l].wMaxPacketSize; found_inep = 1; } if ((ep[l].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == 0) { *outep = ep[l].bEndpointAddress; *outep_maxpacket = ep[l].wMaxPacketSize; found_outep = 1; } } else if (ep[l].bmAttributes == USB_ENDPOINT_TYPE_INTERRUPT) { if ((ep[l].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_ENDPOINT_DIR_MASK) { *intep = ep[l].bEndpointAddress; found_intep = 1; } } } if (found_inep && found_outep && found_intep) // We assigned the endpoints so return here. return 0; // Else loop to next interface/config } /* Next altsetting */ } /* Next interface */ } /* Next config */ return -1; } /** * This function assigns params and usbinfo given a raw device * as input. * @param device the device to be assigned. * @param usbinfo a pointer to the new usbinfo. * @return an error code. */ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, PTPParams *params, void **usbinfo) { PTP_USB *ptp_usb; struct usb_device *libusb_device; uint16_t ret = 0; struct usb_bus *bus; int found = 0; int err; /* See if we can find this raw device again... */ bus = init_usb(); for (; bus != NULL; bus = bus->next) { if (bus->location == device->bus_location) { struct usb_device *dev = bus->devices; for (; dev != NULL; dev = dev->next) { if(dev->devnum == device->devnum && dev->descriptor.idVendor == device->device_entry.vendor_id && dev->descriptor.idProduct == device->device_entry.product_id ) { libusb_device = dev; found = 1; break; } } if (found) break; } } /* Device has gone since detecting raw devices! */ if (!found) { return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } /* Allocate structs */ ptp_usb = (PTP_USB *) malloc(sizeof(PTP_USB)); if (ptp_usb == NULL) { return LIBMTP_ERROR_MEMORY_ALLOCATION; } /* Start with a blank slate (includes setting device_flags to 0) */ memset(ptp_usb, 0, sizeof(PTP_USB)); /* Copy the raw device */ memcpy(&ptp_usb->rawdevice, device, sizeof(LIBMTP_raw_device_t)); /* * Some devices must have their "OS Descriptor" massaged in order * to work. */ if (FLAG_ALWAYS_PROBE_DESCRIPTOR(ptp_usb)) { // Massage the device descriptor (void) probe_device_descriptor(libusb_device, NULL); } /* Assign interface and endpoints to usbinfo... */ err = find_interface_and_endpoints(libusb_device, &ptp_usb->config, &ptp_usb->interface, &ptp_usb->altsetting, &ptp_usb->inep, &ptp_usb->inep_maxpacket, &ptp_usb->outep, &ptp_usb->outep_maxpacket, &ptp_usb->intep); if (err) { LIBMTP_ERROR("LIBMTP PANIC: Unable to find interface & endpoints of device\n"); return LIBMTP_ERROR_CONNECTING; } /* Copy USB version number */ ptp_usb->bcdusb = libusb_device->descriptor.bcdUSB; /* Attempt to initialize this device */ if (init_ptp_usb(params, ptp_usb, libusb_device) < 0) { LIBMTP_ERROR("LIBMTP PANIC: Unable to initialize device\n"); return LIBMTP_ERROR_CONNECTING; } /* * This works in situations where previous bad applications * have not used LIBMTP_Release_Device on exit */ if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("PTP_ERROR_IO: failed to open session, trying again after resetting USB interface\n"); LIBMTP_ERROR("LIBMTP libusb: Attempt to reset device\n"); usb_reset(ptp_usb->handle); close_usb(ptp_usb); if(init_ptp_usb(params, ptp_usb, libusb_device) <0) { LIBMTP_ERROR("LIBMTP PANIC: Could not init USB on second attempt\n"); return LIBMTP_ERROR_CONNECTING; } /* Device has been reset, try again */ if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("LIBMTP PANIC: failed to open session on second attempt\n"); return LIBMTP_ERROR_CONNECTING; } } /* Was the transaction id invalid? Try again */ if (ret == PTP_RC_InvalidTransactionID) { LIBMTP_ERROR("LIBMTP WARNING: Transaction ID was invalid, increment and try again\n"); params->transaction_id += 10; ret = ptp_opensession(params, 1); } if (ret != PTP_RC_SessionAlreadyOpened && ret != PTP_RC_OK) { LIBMTP_ERROR("LIBMTP PANIC: Could not open session! " "(Return code %d)\n Try to reset the device.\n", ret); usb_release_interface(ptp_usb->handle, (int) ptp_usb->interface); return LIBMTP_ERROR_CONNECTING; } /* OK configured properly */ *usbinfo = (void *) ptp_usb; return LIBMTP_ERROR_NONE; } void close_device (PTP_USB *ptp_usb, PTPParams *params) { if (ptp_closesession(params)!=PTP_RC_OK) LIBMTP_ERROR("ERROR: Could not close session!\n"); close_usb(ptp_usb); } void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout) { ptp_usb->timeout = timeout; } void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout) { *timeout = ptp_usb->timeout; } int guess_usb_speed(PTP_USB *ptp_usb) { int bytes_per_second; /* * We don't know the actual speeds so these are rough guesses * from the info you can find here: * http://en.wikipedia.org/wiki/USB#Transfer_rates * http://www.barefeats.com/usb2.html */ switch (ptp_usb->bcdusb & 0xFF00) { case 0x0100: /* 1.x USB versions let's say 1MiB/s */ bytes_per_second = 1*1024*1024; break; case 0x0200: case 0x0300: /* USB 2.0 nominal speed 18MiB/s */ /* USB 3.0 won't be worse? */ bytes_per_second = 18*1024*1024; break; default: /* Half-guess something? */ bytes_per_second = 1*1024*1024; break; } return bytes_per_second; } static int usb_clear_stall_feature(PTP_USB* ptp_usb, int ep) { return (usb_control_msg(ptp_usb->handle, USB_RECIP_ENDPOINT, USB_REQ_CLEAR_FEATURE, USB_FEATURE_HALT, ep, NULL, 0, ptp_usb->timeout)); } static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status) { return (usb_control_msg(ptp_usb->handle, USB_DP_DTH|USB_RECIP_ENDPOINT, USB_REQ_GET_STATUS, USB_FEATURE_HALT, ep, (char *) status, 2, ptp_usb->timeout)); } libmtp-1.1.10/src/README0000644000175000001440000000131412121274441011442 00000000000000RELATION TO LIBPTP2 ------------------- Parts of libptp2 are copied (and modified) from version 1.1.0: ptp-pack.c ptp-pack.h ptp.c ptp.h These are just copies of the same files from libptp2. In order to avoid clashes with the libptp2 endianness scripts we have named libptp-endian.h and libptp-stdint.h the same way as in libptp2, though they are created by libmtp autoconfigure scripts. We will try to track libptp2 and fold changes back into libmtp. TODO: check if the following still holds! (Linus) I have changed the config script slightly for the le64atoh function in libptp-endian.h. This is required for OS X on PowerPC (not sure why). I've just cast the bytes to uint64_t to avoid shifting wrongly. libmtp-1.1.10/src/chdk_live_view.h0000644000175000001440000000644712345765122013742 00000000000000#ifndef __LIVE_VIEW_H #define __LIVE_VIEW_H // Note: used in modules and platform independent code. // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values) /* Protocol notes: - Unless otherwise specified, all structure values are packed in camera native (little endian) byte order - Frame buffer and palette data are in native camera formats Some documentation may be found at http://chdk.wikia.com/wiki/Frame_buffers - The frame buffer descriptions returned may not be correct depending on the camera model and various camera settings (shooting mode, digital zoom, aspect ratio) This may result in partial images, garbage in the "valid" area or incorrect position - In some cases, the requested data may not be available. If this happens, the framebuffer or palette data offset will be zero. - The frame buffer descriptions are returned regardless of whether the data is available */ // Live View protocol version #define LIVE_VIEW_VERSION_MAJOR 2 // increase only with backwards incompatible changes (and reset minor) #define LIVE_VIEW_VERSION_MINOR 1 // increase with extensions of functionality /* protocol version history < 2.0 - development versions 2.0 - initial release, chdk 1.1 2.1 - added palette type 4 - 16 entry VUYA, 2 bit alpha */ // Control flags for determining which data block to transfer #define LV_TFR_VIEWPORT 0x01 #define LV_TFR_BITMAP 0x04 #define LV_TFR_PALETTE 0x08 enum lv_aspect_rato { LV_ASPECT_4_3, LV_ASPECT_16_9, }; /* Framebuffer types additional values will be added if new data formats appear */ enum lv_fb_type { LV_FB_YUV8, // 8 bit per element UYVYYY, used for live view LV_FB_PAL8, // 8 bit paletted, used for bitmap overlay. Note palette data and type sent separately }; /* framebuffer data description NOTE YUV pixels widths are based on the number of Y elements */ typedef struct { int fb_type; // framebuffer type - note future versions might use different structures depending on type int data_start; // offset of data from start of live view header /* buffer width in pixels data size is always buffer_width*visible_height*(buffer bpp based on type) */ int buffer_width; /* visible size in pixels describes data within the buffer which contains image data to be displayed any offsets within buffer data are added before sending, so the top left pixel is always the first first byte of data. width must always be <= buffer_width if buffer_width is > width, the additional data should be skipped visible_height also defines the number of data rows */ int visible_width; int visible_height; /* margins pixels offsets needed to replicate display position on cameras screen not used for any buffer offsets */ int margin_left; int margin_top; int margin_right; int margin_bot; } lv_framebuffer_desc; typedef struct { // live view sub-protocol version int version_major; int version_minor; int lcd_aspect_ratio; // physical aspect ratio of LCD int palette_type; int palette_data_start; // framebuffer descriptions are given as offsets, to allow expanding the structures in minor protocol changes int vp_desc_start; int bm_desc_start; } lv_data_header; #endif // __LIVE_VIEW_H libmtp-1.1.10/src/Makefile.in0000644000175000001440000010630712604225567012652 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@ @MTPZ_COMPILE_TRUE@am__append_1 = mtpz.c @LIBUSB1_COMPILE_TRUE@am__append_2 = libusb1-glue.c @LIBUSB0_COMPILE_TRUE@am__append_3 = libusb-glue.c @LIBOPENUSB_COMPILE_TRUE@am__append_4 = libopenusb1-glue.c subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/byteorder.m4 \ $(top_srcdir)/m4/iconv.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)/m4/stdint.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libmtp.h 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)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am__libmtp_la_SOURCES_DIST = libmtp.c unicode.c unicode.h util.c \ util.h playlist-spl.c gphoto2-endian.h _stdint.h ptp.c ptp.h \ libusb-glue.h music-players.h device-flags.h playlist-spl.h \ mtpz.h chdk_live_view.h chdk_ptp.h mtpz.c libusb1-glue.c \ libusb-glue.c libopenusb1-glue.c @MTPZ_COMPILE_TRUE@am__objects_1 = libmtp_la-mtpz.lo @LIBUSB1_COMPILE_TRUE@am__objects_2 = libmtp_la-libusb1-glue.lo @LIBUSB0_COMPILE_TRUE@am__objects_3 = libmtp_la-libusb-glue.lo @LIBOPENUSB_COMPILE_TRUE@am__objects_4 = \ @LIBOPENUSB_COMPILE_TRUE@ libmtp_la-libopenusb1-glue.lo am_libmtp_la_OBJECTS = libmtp_la-libmtp.lo libmtp_la-unicode.lo \ libmtp_la-util.lo libmtp_la-playlist-spl.lo libmtp_la-ptp.lo \ $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) libmtp_la_OBJECTS = $(am_libmtp_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 = libmtp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmtp_la_CFLAGS) \ $(CFLAGS) $(libmtp_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmtp_la_SOURCES) DIST_SOURCES = $(am__libmtp_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 DATA = $(noinst_DATA) HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libmtp.h.in \ $(top_srcdir)/depcomp README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBUSB_REQUIRES = @LIBUSB_REQUIRES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ 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@ OSFLAGS = @OSFLAGS@ 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@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UDEV = @UDEV@ UDEV_GROUP = @UDEV_GROUP@ UDEV_MODE = @UDEV_MODE@ UDEV_RULES = @UDEV_RULES@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ effective_target = @effective_target@ 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@ ms_lib_exe = @ms_lib_exe@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libmtp.la libmtp_la_CFLAGS = @LIBUSB_CFLAGS@ libmtp_la_SOURCES = libmtp.c unicode.c unicode.h util.c util.h \ playlist-spl.c gphoto2-endian.h _stdint.h ptp.c ptp.h \ libusb-glue.h music-players.h device-flags.h playlist-spl.h \ mtpz.h chdk_live_view.h chdk_ptp.h $(am__append_1) \ $(am__append_2) $(am__append_3) $(am__append_4) include_HEADERS = libmtp.h EXTRA_DIST = libmtp.h.in libmtp.sym ptp-pack.c # --------------------------------------------------------------------------- # Advanced information about versioning: # * "Writing shared libraries" by Mike Hearn # http://plan99.net/~mike/writing-shared-libraries.html # * libtool.info chapter "Versioning" # * libtool.info chapter "Updating library version information" # --------------------------------------------------------------------------- # Versioning: # - CURRENT (Major): Increment if the interface has changes. AGE is always # *changed* at the same time. # - AGE (Micro): Increment if any interfaces have been added; set to 0 # if any interfaces have been removed. Removal has # precedence over adding, so set to 0 if both happened. # It denotes upward compatibility. # - REVISION (Minor): Increment any time the source changes; set to # 0 if you incremented CURRENT. # # To summarize. Any interface *change* increment CURRENT. If that interface # change does not break upward compatibility (ie it is an addition), # increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed, # REVISION is set to 0, otherwise REVISION is incremented. # --------------------------------------------------------------------------- CURRENT = 12 AGE = 3 REVISION = 0 SOVERSION = $(CURRENT):$(REVISION):$(AGE) LT_CURRENT_MINUS_AGE = `expr $(CURRENT) - $(AGE)` @COMPILE_MINGW32_TRUE@W32_LIBS = -lws2_32 @COMPILE_MINGW32_TRUE@W32_LDFLAGS = -export-dynamic @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@noinst_DATA = libmtp.lib libmtp_la_LDFLAGS = @LDFLAGS@ -no-undefined -export-symbols $(srcdir)/libmtp.sym -version-info $(SOVERSION) $(W32_LDFLAGS) libmtp_la_LIBADD = $(W32_LIBS) $(LTLIBICONV) @LIBUSB_LIBS@ libmtp_la_DEPENDENCIES = $(srcdir)/libmtp.sym DISTCLEANFILES = _stdint.h gphoto2-endian.h 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/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): libmtp.h: $(top_builddir)/config.status $(srcdir)/libmtp.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 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}; \ } libmtp.la: $(libmtp_la_OBJECTS) $(libmtp_la_DEPENDENCIES) $(EXTRA_libmtp_la_DEPENDENCIES) $(AM_V_CCLD)$(libmtp_la_LINK) -rpath $(libdir) $(libmtp_la_OBJECTS) $(libmtp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-libmtp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-libopenusb1-glue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-libusb-glue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-libusb1-glue.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-mtpz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-playlist-spl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-ptp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-unicode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmtp_la-util.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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 $@ $< libmtp_la-libmtp.lo: libmtp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-libmtp.lo -MD -MP -MF $(DEPDIR)/libmtp_la-libmtp.Tpo -c -o libmtp_la-libmtp.lo `test -f 'libmtp.c' || echo '$(srcdir)/'`libmtp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-libmtp.Tpo $(DEPDIR)/libmtp_la-libmtp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libmtp.c' object='libmtp_la-libmtp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-libmtp.lo `test -f 'libmtp.c' || echo '$(srcdir)/'`libmtp.c libmtp_la-unicode.lo: unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-unicode.lo -MD -MP -MF $(DEPDIR)/libmtp_la-unicode.Tpo -c -o libmtp_la-unicode.lo `test -f 'unicode.c' || echo '$(srcdir)/'`unicode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-unicode.Tpo $(DEPDIR)/libmtp_la-unicode.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='unicode.c' object='libmtp_la-unicode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-unicode.lo `test -f 'unicode.c' || echo '$(srcdir)/'`unicode.c libmtp_la-util.lo: util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-util.lo -MD -MP -MF $(DEPDIR)/libmtp_la-util.Tpo -c -o libmtp_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-util.Tpo $(DEPDIR)/libmtp_la-util.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='libmtp_la-util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c libmtp_la-playlist-spl.lo: playlist-spl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-playlist-spl.lo -MD -MP -MF $(DEPDIR)/libmtp_la-playlist-spl.Tpo -c -o libmtp_la-playlist-spl.lo `test -f 'playlist-spl.c' || echo '$(srcdir)/'`playlist-spl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-playlist-spl.Tpo $(DEPDIR)/libmtp_la-playlist-spl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='playlist-spl.c' object='libmtp_la-playlist-spl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-playlist-spl.lo `test -f 'playlist-spl.c' || echo '$(srcdir)/'`playlist-spl.c libmtp_la-ptp.lo: ptp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-ptp.lo -MD -MP -MF $(DEPDIR)/libmtp_la-ptp.Tpo -c -o libmtp_la-ptp.lo `test -f 'ptp.c' || echo '$(srcdir)/'`ptp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-ptp.Tpo $(DEPDIR)/libmtp_la-ptp.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ptp.c' object='libmtp_la-ptp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-ptp.lo `test -f 'ptp.c' || echo '$(srcdir)/'`ptp.c libmtp_la-mtpz.lo: mtpz.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-mtpz.lo -MD -MP -MF $(DEPDIR)/libmtp_la-mtpz.Tpo -c -o libmtp_la-mtpz.lo `test -f 'mtpz.c' || echo '$(srcdir)/'`mtpz.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-mtpz.Tpo $(DEPDIR)/libmtp_la-mtpz.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mtpz.c' object='libmtp_la-mtpz.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-mtpz.lo `test -f 'mtpz.c' || echo '$(srcdir)/'`mtpz.c libmtp_la-libusb1-glue.lo: libusb1-glue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-libusb1-glue.lo -MD -MP -MF $(DEPDIR)/libmtp_la-libusb1-glue.Tpo -c -o libmtp_la-libusb1-glue.lo `test -f 'libusb1-glue.c' || echo '$(srcdir)/'`libusb1-glue.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-libusb1-glue.Tpo $(DEPDIR)/libmtp_la-libusb1-glue.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libusb1-glue.c' object='libmtp_la-libusb1-glue.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-libusb1-glue.lo `test -f 'libusb1-glue.c' || echo '$(srcdir)/'`libusb1-glue.c libmtp_la-libusb-glue.lo: libusb-glue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-libusb-glue.lo -MD -MP -MF $(DEPDIR)/libmtp_la-libusb-glue.Tpo -c -o libmtp_la-libusb-glue.lo `test -f 'libusb-glue.c' || echo '$(srcdir)/'`libusb-glue.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-libusb-glue.Tpo $(DEPDIR)/libmtp_la-libusb-glue.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libusb-glue.c' object='libmtp_la-libusb-glue.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-libusb-glue.lo `test -f 'libusb-glue.c' || echo '$(srcdir)/'`libusb-glue.c libmtp_la-libopenusb1-glue.lo: libopenusb1-glue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -MT libmtp_la-libopenusb1-glue.lo -MD -MP -MF $(DEPDIR)/libmtp_la-libopenusb1-glue.Tpo -c -o libmtp_la-libopenusb1-glue.lo `test -f 'libopenusb1-glue.c' || echo '$(srcdir)/'`libopenusb1-glue.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmtp_la-libopenusb1-glue.Tpo $(DEPDIR)/libmtp_la-libopenusb1-glue.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libopenusb1-glue.c' object='libmtp_la-libopenusb1-glue.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmtp_la_CFLAGS) $(CFLAGS) -c -o libmtp_la-libopenusb1-glue.lo `test -f 'libopenusb1-glue.c' || echo '$(srcdir)/'`libopenusb1-glue.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _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) 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) $(DATA) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @COMPILE_MINGW32_FALSE@install-data-local: @MS_LIB_EXE_FALSE@install-data-local: clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-data-local install-includeHEADERS 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-includeHEADERS uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-data-local install-dvi install-dvi-am \ install-exec install-exec-am 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 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-includeHEADERS \ uninstall-libLTLIBRARIES .PRECIOUS: Makefile @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@libmtp.def: $(srcdir)/libmtp.sym @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ echo "LIBRARY \"@PACKAGE@\"" > libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ echo "DESCRIPTION \"Media Transfer Protocol (MTP) library\"" >> libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ echo "VERSION @VERSION@" >> libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ echo >> libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ echo "EXPORTS" >> libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ cat $< >> libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@libmtp.lib: libmtp.la libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ lib -name:libmtp-$(LT_CURRENT_MINUS_AGE).dll -def:libmtp.def -out:$@ @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@install-data-local: libmtp.lib libmtp.def @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ $(INSTALL) libmtp.def $(DESTDIR)$(libdir) @COMPILE_MINGW32_TRUE@@MS_LIB_EXE_TRUE@ $(INSTALL) libmtp.lib $(DESTDIR)$(libdir) # 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: libmtp-1.1.10/src/mtpz.c0000644000175000001440000023712212507047521011735 00000000000000/** * \file mtpz.c * * Copyright (C) 2011-2012 Sajid Anwar * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * This file provides mtp zune cryptographic setup interfaces. * It is also used with Windows Phone 7, but Microsoft/Nokiad seem * to have discontinued MTPZ on Windows Phone 8. * * DISCLAIMER: * * The intention of this implementation is for users to be able * to interoperate with their devices, i.e. copy music to them in * operating systems other than Microsoft Windows, so it can be * played back on the device. We do not provide encryption keys * and constants in libmtp, we never will. You have to have these * on file in your home directory in $HOME/.mtpz-data, and we suggest * that you talk to Microsoft about providing the proper numbers if * you want to use this facility. */ #include "config.h" #include "libmtp.h" #include "unicode.h" #include "ptp.h" #include "libusb-glue.h" #include "device-flags.h" #include "playlist-spl.h" #include "util.h" #include "mtpz.h" #include #include #include #include #include #include #include #include /* Microsoft MTPZ extensions */ /* * The ~/.mtpz-data file contains all four necessary pieces of data: * * encryption key * public exponent * modulus * private key * certificate data * * These four pieces of data are each stored in hex representation, * separated by newline characters. * * If you know of a published, public reference for one of these * arrays of data, please inform us, so we can include it here and * drop it from the external file. Even better is if you convince * Microsoft to officially provide keys to this project. */ static unsigned char *MTPZ_ENCRYPTION_KEY; static unsigned char *MTPZ_PUBLIC_EXPONENT; static unsigned char *MTPZ_MODULUS; static unsigned char *MTPZ_PRIVATE_KEY; static char *MTPZ_CERTIFICATES; // Strip the trailing newline from fgets(). static char *fgets_strip(char * str, int num, FILE * stream) { char *result = str; if ((result = fgets(str, num, stream))) { size_t newlen = strlen(result); if (result[newlen - 1] == '\n') result[newlen - 1] = '\0'; } return result; } static char *hex_to_bytes(char *hex, size_t len) { if (len % 2) return NULL; char *bytes = malloc(len / 2); unsigned int u; int i = 0; while (i < len && sscanf(hex + i, "%2x", &u) == 1) { bytes[i / 2] = u; i += 2; } return bytes; } int mtpz_loaddata() { char *home = getenv("HOME"); int ret = -1; if (!home) { LIBMTP_ERROR("Unable to determine user's home directory, MTPZ disabled.\n"); return -1; } int plen = strlen(home) + strlen("/.mtpz-data") + 1; char path[plen]; sprintf(path, "%s/.mtpz-data", home); FILE *fdata = fopen(path, "r"); if (!fdata) return ret; // Should only be six characters in length, but fgets will encounter a newline and stop. MTPZ_PUBLIC_EXPONENT = (unsigned char *)fgets_strip((char *)malloc(8), 8, fdata); if (!MTPZ_PUBLIC_EXPONENT) { LIBMTP_ERROR("Unable to read MTPZ public exponent from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } // Should only be 33 characters in length, but fgets will encounter a newline and stop. char *hexenckey = fgets_strip((char *)malloc(35), 35, fdata); if (!hexenckey) { LIBMTP_ERROR("Unable to read MTPZ encryption key from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } MTPZ_ENCRYPTION_KEY = hex_to_bytes(hexenckey, strlen(hexenckey)); if (!MTPZ_ENCRYPTION_KEY) { LIBMTP_ERROR("Unable to read MTPZ encryption key from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } // Should only be 256 characters in length, but fgets will encounter a newline and stop. MTPZ_MODULUS = (unsigned char *)fgets_strip((char *)malloc(260), 260, fdata); if (!MTPZ_MODULUS) { LIBMTP_ERROR("Unable to read MTPZ modulus from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } // Should only be 256 characters in length, but fgets will encounter a newline and stop. MTPZ_PRIVATE_KEY = (unsigned char *)fgets_strip((char *)malloc(260), 260, fdata); if (!MTPZ_PRIVATE_KEY) { LIBMTP_ERROR("Unable to read MTPZ private key from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } // Should only be 1258 characters in length, but fgets will encounter the end of the file and stop. char *hexcerts = fgets_strip((char *)malloc(1260), 1260, fdata); if (!hexcerts) { LIBMTP_ERROR("Unable to read MTPZ certificates from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } MTPZ_CERTIFICATES = hex_to_bytes(hexcerts, strlen(hexcerts)); if (!MTPZ_CERTIFICATES) { LIBMTP_ERROR("Unable to parse MTPZ certificates from ~/.mtpz-data, MTPZ disabled.\n"); goto cleanup; } // If all done without errors, drop the fail ret = 0; cleanup: fclose(fdata); return ret; } /* MTPZ RSA */ typedef struct mtpz_rsa_struct { gcry_sexp_t privkey; gcry_sexp_t pubkey; } mtpz_rsa_t; mtpz_rsa_t *mtpz_rsa_init(const unsigned char *modulus, const unsigned char *priv_key, const unsigned char *pub_exp); void mtpz_rsa_free(mtpz_rsa_t *); int mtpz_rsa_decrypt(int flen, unsigned char *from, int tlen, unsigned char *to, mtpz_rsa_t *rsa); int mtpz_rsa_sign(int flen, unsigned char *from, int tlen, unsigned char *to, mtpz_rsa_t *rsa); /* MTPZ hashing */ #define MTPZ_HASHSTATE_84 5 #define MTPZ_HASHSTATE_88 6 static char *mtpz_hash_init_state(); static void mtpz_hash_reset_state(char *); static void mtpz_hash_transform_hash(char *, char *, int); static void mtpz_hash_finalize_hash(char *, char *); static char *mtpz_hash_custom6A5DC(char *, char *, int, int); static void mtpz_hash_compute_hash(char *, char *, int); static unsigned int mtpz_hash_f(int s, unsigned int x, unsigned int y, unsigned int z); static unsigned int mtpz_hash_rotate_left(unsigned int x, int n); /* MTPZ encryption */ unsigned char mtpz_aes_rcon[]; unsigned char mtpz_aes_sbox[]; unsigned char mtpz_aes_invsbox[]; unsigned int mtpz_aes_ft1[]; unsigned int mtpz_aes_ft2[]; unsigned int mtpz_aes_ft3[]; unsigned int mtpz_aes_ft4[]; unsigned int mtpz_aes_rt1[]; unsigned int mtpz_aes_rt2[]; unsigned int mtpz_aes_rt3[]; unsigned int mtpz_aes_rt4[]; unsigned int mtpz_aes_gb11[]; unsigned int mtpz_aes_gb14[]; unsigned int mtpz_aes_gb13[]; unsigned int mtpz_aes_gb9[]; #define MTPZ_ENCRYPTIONLOBYTE(val) (((val) >> 24) & 0xFF) #define MTPZ_ENCRYPTIONBYTE1(val) (((val) >> 16) & 0xFF) #define MTPZ_ENCRYPTIONBYTE2(val) (((val) >> 8) & 0xFF) #define MTPZ_ENCRYPTIONBYTE3(val) (((val) >> 0) & 0xFF) #define MTPZ_SWAP(x) mtpz_bswap32(x) void mtpz_encryption_cipher(unsigned char *data, unsigned int len, char encrypt); void mtpz_encryption_cipher_advanced(unsigned char *key, unsigned int key_len, unsigned char *data, unsigned int data_len, char encrypt); unsigned char *mtpz_encryption_expand_key(unsigned char *constant, int key_len, int count, int *out_len); void mtpz_encryption_expand_key_inner(unsigned char *constant, int key_len, unsigned char **out, int *out_len); void mtpz_encryption_inv_mix_columns(unsigned char *expanded, int offset, int rounds); void mtpz_encryption_decrypt_custom(unsigned char *data, unsigned char *seed, unsigned char *expanded); void mtpz_encryption_encrypt_custom(unsigned char *data, unsigned char *seed, unsigned char *expanded); void mtpz_encryption_encrypt_mac(unsigned char *hash, unsigned int hash_length, unsigned char *seed, unsigned int seed_len, unsigned char *out); static inline uint32_t mtpz_bswap32(uint32_t x) { #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) || defined(__clang__) return __builtin_bswap32(x); #else return (x >> 24) | ((x >> 8) & 0x0000ff00) | ((x << 8) & 0x00ff0000) | (x << 24); #endif } /* MTPZ RSA implementation */ mtpz_rsa_t *mtpz_rsa_init(const unsigned char *str_modulus, const unsigned char *str_privkey, const unsigned char *str_pubexp) { mtpz_rsa_t *rsa = calloc(1, sizeof(mtpz_rsa_t)); if (rsa == NULL) return NULL; gcry_mpi_t mpi_modulus, mpi_privkey, mpi_pubexp; gcry_mpi_scan(&mpi_modulus, GCRYMPI_FMT_HEX, str_modulus, 0, NULL); gcry_mpi_scan(&mpi_privkey, GCRYMPI_FMT_HEX, str_privkey, 0, NULL); gcry_mpi_scan(&mpi_pubexp, GCRYMPI_FMT_HEX, str_pubexp, 0, NULL); gcry_sexp_build(&rsa->privkey, NULL, "(private-key (rsa (n %m) (e %m) (d %m)))", mpi_modulus, mpi_pubexp, mpi_privkey); gcry_sexp_build(&rsa->pubkey, NULL, "(public-key (rsa (n %m) (e %m)))", mpi_modulus, mpi_pubexp); gcry_mpi_release(mpi_modulus); gcry_mpi_release(mpi_privkey); gcry_mpi_release(mpi_pubexp); return rsa; } void mtpz_rsa_free(mtpz_rsa_t *rsa) { gcry_sexp_release(rsa->privkey); gcry_sexp_release(rsa->pubkey); } int mtpz_rsa_decrypt(int flen, unsigned char *from, int tlen, unsigned char *to, mtpz_rsa_t *rsa) { gcry_mpi_t mpi_from; gcry_mpi_scan(&mpi_from, GCRYMPI_FMT_USG, from, flen, NULL); gcry_sexp_t sexp_data; gcry_sexp_build(&sexp_data, NULL, "(enc-val (flags raw) (rsa (a %m)))", mpi_from); gcry_sexp_t sexp_plain; gcry_pk_decrypt(&sexp_plain, sexp_data, rsa->privkey); gcry_mpi_t mpi_value = gcry_sexp_nth_mpi(sexp_plain, 1, GCRYMPI_FMT_USG); // Lame workaround. GCRYMPI_FMT_USG gets rid of any leading zeroes which we do need, // so we'll count how many bits are being used, and subtract that from how many bits actually // should be there, and then write into our output array shifted over however many bits/8. int bitshift = (tlen * 8) - gcry_mpi_get_nbits(mpi_value); size_t written; if (bitshift / 8) { memset(to, 0, bitshift / 8); to += bitshift / 8; tlen -= bitshift / 8; } gcry_mpi_print(GCRYMPI_FMT_USG, to, tlen, &written, mpi_value); gcry_mpi_release(mpi_from); gcry_mpi_release(mpi_value); gcry_sexp_release(sexp_data); gcry_sexp_release(sexp_plain); return (int)written; } int mtpz_rsa_sign(int flen, unsigned char *from, int tlen, unsigned char *to, mtpz_rsa_t *rsa) { return mtpz_rsa_decrypt(flen, from, tlen, to, rsa); } /* MTPZ hashing implementation */ static char *mtpz_hash_init_state() { char *s = (char *)malloc(92); if (s != NULL) memset(s, 0, 92); return s; } void mtpz_hash_reset_state(char *state) { int *state_box = (int *)(state + 64); /* * Constants from * http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf * Page 13, section 5.3.1 */ state_box[0] = 0x67452301; state_box[1] = 0xefcdab89; state_box[2] = 0x98badcfe; state_box[3] = 0x10325476; state_box[4] = 0xc3d2e1f0; state_box[MTPZ_HASHSTATE_84] = 0; state_box[MTPZ_HASHSTATE_88] = 0; } void mtpz_hash_transform_hash(char *state, char *msg, int len) { int *state_box = (int *)(state + 64); int x = state_box[MTPZ_HASHSTATE_88] & 0x3F; int v5 = len + state_box[MTPZ_HASHSTATE_88]; state_box[MTPZ_HASHSTATE_88] = v5; int i = len, j = 0; int a1 = 0; int c = 0; if (len > v5) state_box[MTPZ_HASHSTATE_84] += 1; if (x) { if (len + x > 0x3F) { for (a1 = 0; a1 < 64 - x; a1++) { state[x + a1] = msg[a1]; } i = len + x - 64; j = 64 - x; mtpz_hash_compute_hash(state, state, 64); } } while (i > 63) { mtpz_hash_compute_hash(state, msg + j, 64); j += 64; i -= 64; } if (i != 0) { for (c = 0; c < i; c++) { state[x + c] = msg[j + c]; } } } // out has at least 20 bytes of space void mtpz_hash_finalize_hash(char *state, char *out) { int *state_box = (int *)(state + 64); int v2 = 64 - (state_box[MTPZ_HASHSTATE_88] & 0x3F); int v6, v7; if (v2 <= 8) v2 += 64; char *v5 = (char *)malloc(72); memset(v5, 0, 72); v5[0] = '\x80'; v6 = 8 * state_box[MTPZ_HASHSTATE_84] | (state_box[MTPZ_HASHSTATE_88] >> 29); v7 = 8 * state_box[MTPZ_HASHSTATE_88]; v6 = MTPZ_SWAP(v6); v7 = MTPZ_SWAP(v7); *(int *)(v5 + v2 - 8) = v6; *(int *)(v5 + v2 - 4) = v7; mtpz_hash_transform_hash(state, v5, v2); int *out_int = (int *)out; out_int[0] = MTPZ_SWAP(state_box[0]); out_int[1] = MTPZ_SWAP(state_box[1]); out_int[2] = MTPZ_SWAP(state_box[2]); out_int[3] = MTPZ_SWAP(state_box[3]); out_int[4] = MTPZ_SWAP(state_box[4]); memset(state, 0, 64); mtpz_hash_reset_state(state); } char *mtpz_hash_custom6A5DC(char *state, char *msg, int len, int a4) { int v11 = (a4 / 20) + 1; char *v13 = (char *)malloc(v11 * 20); char *v5 = (char *)malloc(len + 4); int i; int k; memset(v13, 0, v11 * 20); memset(v5, 0, len + 4); memcpy(v5, msg, len); for (i = 0; i < v11; i++) { k = MTPZ_SWAP(i); *(int *)(v5 + len) = k; mtpz_hash_reset_state(state); mtpz_hash_transform_hash(state, v5, len + 4); mtpz_hash_finalize_hash(state, v13 + i * 20); } free(v5); v5 = NULL; return v13; } void mtpz_hash_compute_hash(char *state, char *msg, int len) { int *state_box = (int *)(state + 64); const unsigned int K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 }; if (len != 64) return; int *M = (int *)msg; // HASH COMPUTATION unsigned int W[80]; unsigned int a, b, c, d, e; int i, s; unsigned int T; // 1 - prepare message schedule 'W'. for (i = 0; i < 16; i++) W[i] = MTPZ_SWAP(M[i]); for (i = 16; i < 80; i++) W[i] = mtpz_hash_rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); // 2 - initialize five working variables a, b, c, d, e with previous hash value a = state_box[0]; b = state_box[1]; c = state_box[2]; d = state_box[3]; e = state_box[4]; // 3 - main loop for (i = 0; i < 80; i++) { s = i / 20; T = (mtpz_hash_rotate_left(a, 5) + mtpz_hash_f(s, b, c, d) + e + K[s] + W[i]) & 0xFFFFFFFF; e = d; d = c; c = mtpz_hash_rotate_left(b, 30); b = a; a = T; } state_box[0] = (state_box[0] + a) & 0xFFFFFFFF; state_box[1] = (state_box[1] + b) & 0xFFFFFFFF; state_box[2] = (state_box[2] + c) & 0xFFFFFFFF; state_box[3] = (state_box[3] + d) & 0xFFFFFFFF; state_box[4] = (state_box[4] + e) & 0xFFFFFFFF; } unsigned int mtpz_hash_f(int s, unsigned int x, unsigned int y, unsigned int z) { switch (s) { case 0: return (x & y) ^ (~x & z); // Ch() case 1: return x ^ y ^ z; // Parity() case 2: return (x & y) ^ (x & z) ^ (y & z); // Maj() case 3: return x ^ y ^ z; // Parity() } return 0; } unsigned int mtpz_hash_rotate_left(unsigned int x, int n) { return (x << n) | (x >> (32 - n)); } /* MTPZ encryption implementation */ void mtpz_encryption_cipher(unsigned char *data, unsigned int len, char encrypt) { unsigned char *expanded = NULL; int offset = 0, count = len; if ((count & 0x0F) == 0) { int exp_len = 0; expanded = mtpz_encryption_expand_key((unsigned char *)MTPZ_ENCRYPTION_KEY, 16, 10, &exp_len); if (count != 0) { do { if (encrypt) mtpz_encryption_encrypt_custom(data + offset, NULL, expanded); else mtpz_encryption_decrypt_custom(data + offset, NULL, expanded); count -= 16; offset += 16; } while (count != 0); } } } void mtpz_encryption_cipher_advanced(unsigned char *key, unsigned int key_len, unsigned char *data, unsigned int data_len, char encrypt) { int len = (key_len == 16) ? 10 : (key_len == 24) ? 12 : 32; int exp_len; unsigned char *expanded = mtpz_encryption_expand_key(key, key_len, len, &exp_len); int offset = 0, count = data_len; unsigned char *out = (unsigned char *)malloc(16); unsigned int *out_int = (unsigned int *)out; unsigned int *data_int = (unsigned int *)data; unsigned int *dtf = (unsigned int *)malloc(16); memset((unsigned char *)dtf, 0, 16); while (count != 0) { int chunk = 16; if (count < 16) { memset(out, 0, 16); chunk = count; } memcpy(out, data + offset, chunk); if (encrypt) { out_int[0] ^= MTPZ_SWAP(dtf[0]); out_int[1] ^= MTPZ_SWAP(dtf[1]); out_int[2] ^= MTPZ_SWAP(dtf[2]); out_int[3] ^= MTPZ_SWAP(dtf[3]); mtpz_encryption_encrypt_custom(data + offset, out, expanded); dtf[0] = MTPZ_SWAP(data_int[(offset / 4) + 0]); dtf[1] = MTPZ_SWAP(data_int[(offset / 4) + 1]); dtf[2] = MTPZ_SWAP(data_int[(offset / 4) + 2]); dtf[3] = MTPZ_SWAP(data_int[(offset / 4) + 3]); } else { mtpz_encryption_decrypt_custom(data + offset, out, expanded); data_int[(offset / 4) + 0] ^= MTPZ_SWAP(dtf[0]); data_int[(offset / 4) + 1] ^= MTPZ_SWAP(dtf[1]); data_int[(offset / 4) + 2] ^= MTPZ_SWAP(dtf[2]); data_int[(offset / 4) + 3] ^= MTPZ_SWAP(dtf[3]); dtf[0] = MTPZ_SWAP(out_int[0]); dtf[1] = MTPZ_SWAP(out_int[1]); dtf[2] = MTPZ_SWAP(out_int[2]); dtf[3] = MTPZ_SWAP(out_int[3]); } offset += chunk; count -= chunk; } free(out); free(dtf); free(expanded); } unsigned char *mtpz_encryption_expand_key(unsigned char *constant, int key_len, int count, int *out_len) { int i = 0; int seek = 0; unsigned char *back = (unsigned char *)malloc(484); memset(back, 0, 484); *out_len = 484; unsigned char *inner; int inner_len; mtpz_encryption_expand_key_inner(constant, key_len, &inner, &inner_len); back[i] = (unsigned char)(count % 0xFF); i += 4; memcpy(back + i, inner, inner_len); i += inner_len; memcpy(back + i, inner, inner_len); i += inner_len; switch (count) { case 10: seek = 0xB4; break; case 12: seek = 0xD4; break; case 14: default: seek = 0xF4; break; } mtpz_encryption_inv_mix_columns(back, seek, count); return back; } void mtpz_encryption_expand_key_inner(unsigned char *constant, int key_len, unsigned char **out, int *out_len) { int ks = -1; int rcon_i = 0; int i = 0, j = 0; switch (key_len) { case 16: ks = 16 * (10 + 1); break; case 24: ks = 16 * (12 + 1); break; case 32: ks = 16 * (14 + 1); break; default: *out = NULL; *out_len = 0; } unsigned char *key = (unsigned char *)malloc(ks); unsigned char *temp = (unsigned char *)malloc(4); memcpy(key, constant, key_len); unsigned char t0, t1, t2, t3; for (i = key_len; i < ks; i += 4) { temp[0] = t0 = key[i - 4]; temp[1] = t1 = key[i - 3]; temp[2] = t2 = key[i - 2]; temp[3] = t3 = key[i - 1]; if (i % key_len == 0) { temp[0] = (mtpz_aes_sbox[t1] ^ mtpz_aes_rcon[rcon_i]) & 0xFF; temp[1] = mtpz_aes_sbox[t2]; temp[2] = mtpz_aes_sbox[t3]; temp[3] = mtpz_aes_sbox[t0]; rcon_i++; } else if ((key_len > 24) && (i % key_len == 16)) { temp[0] = mtpz_aes_sbox[t0]; temp[1] = mtpz_aes_sbox[t1]; temp[2] = mtpz_aes_sbox[t2]; temp[3] = mtpz_aes_sbox[t3]; } for (j = 0; j < 4; j++) { key[i + j] = (unsigned char)((key[i + j - key_len] ^ temp[j]) & 0xFF); } } free(temp); *out = key; *out_len = ks; } void mtpz_encryption_inv_mix_columns(unsigned char *expanded, int offset, int rounds) { int v8 = 1, o = offset; unsigned int *exp_int = NULL; for (v8 = 1; v8 < rounds; v8++) { exp_int = (unsigned int *)(expanded + o + 16); exp_int[0] = MTPZ_SWAP(mtpz_aes_gb9[expanded[o + 19]] ^ mtpz_aes_gb13[expanded[o + 18]] ^ mtpz_aes_gb11[expanded[o + 17]] ^ mtpz_aes_gb14[expanded[o + 16]]); exp_int[1] = MTPZ_SWAP(mtpz_aes_gb9[expanded[o + 23]] ^ mtpz_aes_gb13[expanded[o + 22]] ^ mtpz_aes_gb11[expanded[o + 21]] ^ mtpz_aes_gb14[expanded[o + 20]]); exp_int[2] = MTPZ_SWAP(mtpz_aes_gb9[expanded[o + 27]] ^ mtpz_aes_gb13[expanded[o + 26]] ^ mtpz_aes_gb11[expanded[o + 25]] ^ mtpz_aes_gb14[expanded[o + 24]]); exp_int[3] = MTPZ_SWAP(mtpz_aes_gb9[expanded[o + 31]] ^ mtpz_aes_gb13[expanded[o + 30]] ^ mtpz_aes_gb11[expanded[o + 29]] ^ mtpz_aes_gb14[expanded[o + 28]]); o += 16; } } void mtpz_encryption_decrypt_custom(unsigned char *data, unsigned char *seed, unsigned char *expanded) { unsigned int *u_data = (unsigned int *)data; unsigned int *u_expanded = (unsigned int *)expanded; int keyOffset = 0xB4 + 0xA0; unsigned int *u_seed; if (seed == NULL) u_seed = u_data; else u_seed = (unsigned int *)seed; unsigned int v14 = MTPZ_SWAP(u_seed[0]) ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4]); unsigned int v15 = MTPZ_SWAP(u_seed[1]) ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4]); unsigned int v16 = MTPZ_SWAP(u_seed[2]) ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4]); unsigned int v17 = MTPZ_SWAP(u_seed[3]) ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4]); unsigned int v18 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v15)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v16)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v14)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v17)]; unsigned int v19 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v16)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v17)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v15)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v14)]; unsigned int v20 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v17)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v14)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v16)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v15)]; unsigned int v21 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v14)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v15)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v17)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v16)]; keyOffset -= 16; int rounds = 9; do { v14 = v18 ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4]); v15 = v19 ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4]); v16 = v20 ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4]); v17 = v21 ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4]); v18 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v15)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v16)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v14)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v17)]; v19 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v16)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v17)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v15)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v14)]; v20 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v17)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v14)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v16)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v15)]; v21 = mtpz_aes_rt1[MTPZ_ENCRYPTIONBYTE3(v14)] ^ mtpz_aes_rt2[MTPZ_ENCRYPTIONBYTE2(v15)] ^ mtpz_aes_rt3[MTPZ_ENCRYPTIONLOBYTE(v17)] ^ mtpz_aes_rt4[MTPZ_ENCRYPTIONBYTE1(v16)]; rounds--; keyOffset -= 16; } while (rounds != 1); v14 = v18 ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4]); v15 = v19 ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4]); v16 = v20 ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4]); v17 = v21 ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4]); keyOffset -= 16; v18 = ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONLOBYTE(v14)]) << 24) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE1 (v17)]) << 16) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE2 (v16)]) << 8) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE3 (v15)]) << 0); v19 = ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONLOBYTE(v15)]) << 24) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE1 (v14)]) << 16) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE2 (v17)]) << 8) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE3 (v16)]) << 0); v20 = ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONLOBYTE(v16)]) << 24) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE1 (v15)]) << 16) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE2 (v14)]) << 8) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE3 (v17)]) << 0); v21 = ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONLOBYTE(v17)]) << 24) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE1 (v16)]) << 16) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE2 (v15)]) << 8) | ((mtpz_aes_invsbox[MTPZ_ENCRYPTIONBYTE3 (v14)]) << 0); u_data[0] = MTPZ_SWAP(v18 ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4])); u_data[1] = MTPZ_SWAP(v19 ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4])); u_data[2] = MTPZ_SWAP(v20 ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4])); u_data[3] = MTPZ_SWAP(v21 ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4])); }; void mtpz_encryption_encrypt_custom(unsigned char *data, unsigned char *seed, unsigned char *expanded) { unsigned int *u_data = (unsigned int *)data; unsigned int *u_expanded = (unsigned int *)expanded; int keyOffset = 0x04; unsigned int *u_seed; if (seed == NULL) u_seed = u_data; else u_seed = (unsigned int *)seed; unsigned int v14 = MTPZ_SWAP(u_seed[0]) ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4]); unsigned int v15 = MTPZ_SWAP(u_seed[1]) ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4]); unsigned int v16 = MTPZ_SWAP(u_seed[2]) ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4]); unsigned int v17 = MTPZ_SWAP(u_seed[3]) ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4]); unsigned int v18 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v17)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v16)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v14)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v15)]; unsigned int v19 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v14)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v17)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v15)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v16)]; unsigned int v20 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v15)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v14)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v16)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v17)]; unsigned int v21 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v16)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v15)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v17)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v14)]; keyOffset += 16; int rounds = 1; do { v14 = v18 ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4]); v15 = v19 ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4]); v16 = v20 ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4]); v17 = v21 ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4]); v18 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v17)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v16)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v14)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v15)]; v19 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v14)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v17)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v15)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v16)]; v20 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v15)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v14)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v16)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v17)]; v21 = mtpz_aes_ft1[MTPZ_ENCRYPTIONBYTE3(v16)] ^ mtpz_aes_ft2[MTPZ_ENCRYPTIONBYTE2(v15)] ^ mtpz_aes_ft3[MTPZ_ENCRYPTIONLOBYTE(v17)] ^ mtpz_aes_ft4[MTPZ_ENCRYPTIONBYTE1(v14)]; rounds++; keyOffset += 16; } while (rounds != 9); v14 = v18 ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4]); v15 = v19 ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4]); v16 = v20 ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4]); v17 = v21 ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4]); keyOffset += 16; unsigned char *FT3_Bytes = (unsigned char *)mtpz_aes_ft3; v18 = ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONLOBYTE(v14)]) << 24) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE1 (v15)]) << 16) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE2 (v16)]) << 8) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE3 (v17)]) << 0); v19 = ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONLOBYTE(v15)]) << 24) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE1 (v16)]) << 16) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE2 (v17)]) << 8) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE3 (v14)]) << 0); v20 = ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONLOBYTE(v16)]) << 24) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE1 (v17)]) << 16) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE2 (v14)]) << 8) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE3 (v15)]) << 0); v21 = ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONLOBYTE(v17)]) << 24) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE1 (v14)]) << 16) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE2 (v15)]) << 8) | ((FT3_Bytes[1 + 4 * MTPZ_ENCRYPTIONBYTE3 (v16)]) << 0); u_data[0] = MTPZ_SWAP(v18 ^ MTPZ_SWAP(u_expanded[(keyOffset ) / 4])); u_data[1] = MTPZ_SWAP(v19 ^ MTPZ_SWAP(u_expanded[(keyOffset + 4) / 4])); u_data[2] = MTPZ_SWAP(v20 ^ MTPZ_SWAP(u_expanded[(keyOffset + 8) / 4])); u_data[3] = MTPZ_SWAP(v21 ^ MTPZ_SWAP(u_expanded[(keyOffset + 12) / 4])); } void mtpz_encryption_encrypt_mac(unsigned char *hash, unsigned int hash_length, unsigned char *seed, unsigned int seed_len, unsigned char *out) { if (hash == NULL || hash_length != 16) return; unsigned char *loop1 = (unsigned char *)malloc(17); memset(loop1, 0, 17); unsigned char *loop2 = (unsigned char *)malloc(17); memset(loop2, 0, 17); int i = 0; { unsigned char *enc_hash = (unsigned char *)malloc(17); memset(enc_hash, 0, 17); mtpz_encryption_cipher_advanced(hash, hash_length, enc_hash, 16, 1); for (i = 0; i < 16; i++) loop1[i] = (unsigned char)((2 * enc_hash[i]) | (enc_hash[i + 1] >> 7)); if (enc_hash[0] >= (unsigned char)128) loop1[15] ^= (unsigned char)0x87; for (i = 0; i < 16; i++) loop2[i] = (unsigned char)((2 * loop1[i]) | (loop1[i + 1] >> 7)); if (loop1[0] >= (unsigned char)128) loop2[15] ^= (unsigned char)0x87; free(enc_hash); } { int len = (hash_length == 16) ? 10 : (hash_length == 24) ? 12 : 32; int exp_len; unsigned char *expanded = mtpz_encryption_expand_key(hash, hash_length, len, &exp_len); unsigned char *actual_seed = (unsigned char *)malloc(16); memset(actual_seed, 0, 16); int i = 0; if (seed_len == 16) { for (i = 0; i < 16; i++) actual_seed[i] ^= seed[i]; for (i = 0; i < 16; i++) actual_seed[i] ^= loop1[i]; } else { for (i = 0; i < seed_len; i++) actual_seed[i] ^= seed[i]; actual_seed[seed_len] = (unsigned char)128; for (i = 0; i < 16; i++) actual_seed[i] ^= loop2[i]; } mtpz_encryption_encrypt_custom(out, actual_seed, expanded); free(expanded); free(actual_seed); } free(loop1); free(loop2); } /* ENCRYPTION CONSTANTS */ /* * These tables can also be found in Mozilla's Network Security Services: * http://www.mozilla.org/projects/security/pki/nss/ * * : * https://hg.mozilla.org/mozilla-central/raw-file/90828ac18dcf/security/nss/lib/freebl/rijndael32.tab * * Each of the following constant tables will also identify the corresponding * table in the link. */ /* Corresponds to Rcon[30] (seems to be truncated to include only the used constants) */ unsigned char mtpz_aes_rcon[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a }; /* Corresponds to _S[256] (in hex) */ unsigned char mtpz_aes_sbox[] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; /* Corresponds to _SInv[256] (in hex) */ unsigned char mtpz_aes_invsbox[] = { 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D }; /* Corresponds to _T3[256] */ unsigned int mtpz_aes_ft1[] = { 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C, }; /* Corresponds to _T2[256] */ unsigned int mtpz_aes_ft2[] = { 0x63A5C663, 0x7C84F87C, 0x7799EE77, 0x7B8DF67B, 0xF20DFFF2, 0x6BBDD66B, 0x6FB1DE6F, 0xC55491C5, 0x30506030, 0x01030201, 0x67A9CE67, 0x2B7D562B, 0xFE19E7FE, 0xD762B5D7, 0xABE64DAB, 0x769AEC76, 0xCA458FCA, 0x829D1F82, 0xC94089C9, 0x7D87FA7D, 0xFA15EFFA, 0x59EBB259, 0x47C98E47, 0xF00BFBF0, 0xADEC41AD, 0xD467B3D4, 0xA2FD5FA2, 0xAFEA45AF, 0x9CBF239C, 0xA4F753A4, 0x7296E472, 0xC05B9BC0, 0xB7C275B7, 0xFD1CE1FD, 0x93AE3D93, 0x266A4C26, 0x365A6C36, 0x3F417E3F, 0xF702F5F7, 0xCC4F83CC, 0x345C6834, 0xA5F451A5, 0xE534D1E5, 0xF108F9F1, 0x7193E271, 0xD873ABD8, 0x31536231, 0x153F2A15, 0x040C0804, 0xC75295C7, 0x23654623, 0xC35E9DC3, 0x18283018, 0x96A13796, 0x050F0A05, 0x9AB52F9A, 0x07090E07, 0x12362412, 0x809B1B80, 0xE23DDFE2, 0xEB26CDEB, 0x27694E27, 0xB2CD7FB2, 0x759FEA75, 0x091B1209, 0x839E1D83, 0x2C74582C, 0x1A2E341A, 0x1B2D361B, 0x6EB2DC6E, 0x5AEEB45A, 0xA0FB5BA0, 0x52F6A452, 0x3B4D763B, 0xD661B7D6, 0xB3CE7DB3, 0x297B5229, 0xE33EDDE3, 0x2F715E2F, 0x84971384, 0x53F5A653, 0xD168B9D1, 0x00000000, 0xED2CC1ED, 0x20604020, 0xFC1FE3FC, 0xB1C879B1, 0x5BEDB65B, 0x6ABED46A, 0xCB468DCB, 0xBED967BE, 0x394B7239, 0x4ADE944A, 0x4CD4984C, 0x58E8B058, 0xCF4A85CF, 0xD06BBBD0, 0xEF2AC5EF, 0xAAE54FAA, 0xFB16EDFB, 0x43C58643, 0x4DD79A4D, 0x33556633, 0x85941185, 0x45CF8A45, 0xF910E9F9, 0x02060402, 0x7F81FE7F, 0x50F0A050, 0x3C44783C, 0x9FBA259F, 0xA8E34BA8, 0x51F3A251, 0xA3FE5DA3, 0x40C08040, 0x8F8A058F, 0x92AD3F92, 0x9DBC219D, 0x38487038, 0xF504F1F5, 0xBCDF63BC, 0xB6C177B6, 0xDA75AFDA, 0x21634221, 0x10302010, 0xFF1AE5FF, 0xF30EFDF3, 0xD26DBFD2, 0xCD4C81CD, 0x0C14180C, 0x13352613, 0xEC2FC3EC, 0x5FE1BE5F, 0x97A23597, 0x44CC8844, 0x17392E17, 0xC45793C4, 0xA7F255A7, 0x7E82FC7E, 0x3D477A3D, 0x64ACC864, 0x5DE7BA5D, 0x192B3219, 0x7395E673, 0x60A0C060, 0x81981981, 0x4FD19E4F, 0xDC7FA3DC, 0x22664422, 0x2A7E542A, 0x90AB3B90, 0x88830B88, 0x46CA8C46, 0xEE29C7EE, 0xB8D36BB8, 0x143C2814, 0xDE79A7DE, 0x5EE2BC5E, 0x0B1D160B, 0xDB76ADDB, 0xE03BDBE0, 0x32566432, 0x3A4E743A, 0x0A1E140A, 0x49DB9249, 0x060A0C06, 0x246C4824, 0x5CE4B85C, 0xC25D9FC2, 0xD36EBDD3, 0xACEF43AC, 0x62A6C462, 0x91A83991, 0x95A43195, 0xE437D3E4, 0x798BF279, 0xE732D5E7, 0xC8438BC8, 0x37596E37, 0x6DB7DA6D, 0x8D8C018D, 0xD564B1D5, 0x4ED29C4E, 0xA9E049A9, 0x6CB4D86C, 0x56FAAC56, 0xF407F3F4, 0xEA25CFEA, 0x65AFCA65, 0x7A8EF47A, 0xAEE947AE, 0x08181008, 0xBAD56FBA, 0x7888F078, 0x256F4A25, 0x2E725C2E, 0x1C24381C, 0xA6F157A6, 0xB4C773B4, 0xC65197C6, 0xE823CBE8, 0xDD7CA1DD, 0x749CE874, 0x1F213E1F, 0x4BDD964B, 0xBDDC61BD, 0x8B860D8B, 0x8A850F8A, 0x7090E070, 0x3E427C3E, 0xB5C471B5, 0x66AACC66, 0x48D89048, 0x03050603, 0xF601F7F6, 0x0E121C0E, 0x61A3C261, 0x355F6A35, 0x57F9AE57, 0xB9D069B9, 0x86911786, 0xC15899C1, 0x1D273A1D, 0x9EB9279E, 0xE138D9E1, 0xF813EBF8, 0x98B32B98, 0x11332211, 0x69BBD269, 0xD970A9D9, 0x8E89078E, 0x94A73394, 0x9BB62D9B, 0x1E223C1E, 0x87921587, 0xE920C9E9, 0xCE4987CE, 0x55FFAA55, 0x28785028, 0xDF7AA5DF, 0x8C8F038C, 0xA1F859A1, 0x89800989, 0x0D171A0D, 0xBFDA65BF, 0xE631D7E6, 0x42C68442, 0x68B8D068, 0x41C38241, 0x99B02999, 0x2D775A2D, 0x0F111E0F, 0xB0CB7BB0, 0x54FCA854, 0xBBD66DBB, 0x163A2C16, }; /* Corresponds to _T0[256] */ unsigned int mtpz_aes_ft3[] = { 0xC66363A5, 0xF87C7C84, 0xEE777799, 0xF67B7B8D, 0xFFF2F20D, 0xD66B6BBD, 0xDE6F6FB1, 0x91C5C554, 0x60303050, 0x02010103, 0xCE6767A9, 0x562B2B7D, 0xE7FEFE19, 0xB5D7D762, 0x4DABABE6, 0xEC76769A, 0x8FCACA45, 0x1F82829D, 0x89C9C940, 0xFA7D7D87, 0xEFFAFA15, 0xB25959EB, 0x8E4747C9, 0xFBF0F00B, 0x41ADADEC, 0xB3D4D467, 0x5FA2A2FD, 0x45AFAFEA, 0x239C9CBF, 0x53A4A4F7, 0xE4727296, 0x9BC0C05B, 0x75B7B7C2, 0xE1FDFD1C, 0x3D9393AE, 0x4C26266A, 0x6C36365A, 0x7E3F3F41, 0xF5F7F702, 0x83CCCC4F, 0x6834345C, 0x51A5A5F4, 0xD1E5E534, 0xF9F1F108, 0xE2717193, 0xABD8D873, 0x62313153, 0x2A15153F, 0x0804040C, 0x95C7C752, 0x46232365, 0x9DC3C35E, 0x30181828, 0x379696A1, 0x0A05050F, 0x2F9A9AB5, 0x0E070709, 0x24121236, 0x1B80809B, 0xDFE2E23D, 0xCDEBEB26, 0x4E272769, 0x7FB2B2CD, 0xEA75759F, 0x1209091B, 0x1D83839E, 0x582C2C74, 0x341A1A2E, 0x361B1B2D, 0xDC6E6EB2, 0xB45A5AEE, 0x5BA0A0FB, 0xA45252F6, 0x763B3B4D, 0xB7D6D661, 0x7DB3B3CE, 0x5229297B, 0xDDE3E33E, 0x5E2F2F71, 0x13848497, 0xA65353F5, 0xB9D1D168, 0x00000000, 0xC1EDED2C, 0x40202060, 0xE3FCFC1F, 0x79B1B1C8, 0xB65B5BED, 0xD46A6ABE, 0x8DCBCB46, 0x67BEBED9, 0x7239394B, 0x944A4ADE, 0x984C4CD4, 0xB05858E8, 0x85CFCF4A, 0xBBD0D06B, 0xC5EFEF2A, 0x4FAAAAE5, 0xEDFBFB16, 0x864343C5, 0x9A4D4DD7, 0x66333355, 0x11858594, 0x8A4545CF, 0xE9F9F910, 0x04020206, 0xFE7F7F81, 0xA05050F0, 0x783C3C44, 0x259F9FBA, 0x4BA8A8E3, 0xA25151F3, 0x5DA3A3FE, 0x804040C0, 0x058F8F8A, 0x3F9292AD, 0x219D9DBC, 0x70383848, 0xF1F5F504, 0x63BCBCDF, 0x77B6B6C1, 0xAFDADA75, 0x42212163, 0x20101030, 0xE5FFFF1A, 0xFDF3F30E, 0xBFD2D26D, 0x81CDCD4C, 0x180C0C14, 0x26131335, 0xC3ECEC2F, 0xBE5F5FE1, 0x359797A2, 0x884444CC, 0x2E171739, 0x93C4C457, 0x55A7A7F2, 0xFC7E7E82, 0x7A3D3D47, 0xC86464AC, 0xBA5D5DE7, 0x3219192B, 0xE6737395, 0xC06060A0, 0x19818198, 0x9E4F4FD1, 0xA3DCDC7F, 0x44222266, 0x542A2A7E, 0x3B9090AB, 0x0B888883, 0x8C4646CA, 0xC7EEEE29, 0x6BB8B8D3, 0x2814143C, 0xA7DEDE79, 0xBC5E5EE2, 0x160B0B1D, 0xADDBDB76, 0xDBE0E03B, 0x64323256, 0x743A3A4E, 0x140A0A1E, 0x924949DB, 0x0C06060A, 0x4824246C, 0xB85C5CE4, 0x9FC2C25D, 0xBDD3D36E, 0x43ACACEF, 0xC46262A6, 0x399191A8, 0x319595A4, 0xD3E4E437, 0xF279798B, 0xD5E7E732, 0x8BC8C843, 0x6E373759, 0xDA6D6DB7, 0x018D8D8C, 0xB1D5D564, 0x9C4E4ED2, 0x49A9A9E0, 0xD86C6CB4, 0xAC5656FA, 0xF3F4F407, 0xCFEAEA25, 0xCA6565AF, 0xF47A7A8E, 0x47AEAEE9, 0x10080818, 0x6FBABAD5, 0xF0787888, 0x4A25256F, 0x5C2E2E72, 0x381C1C24, 0x57A6A6F1, 0x73B4B4C7, 0x97C6C651, 0xCBE8E823, 0xA1DDDD7C, 0xE874749C, 0x3E1F1F21, 0x964B4BDD, 0x61BDBDDC, 0x0D8B8B86, 0x0F8A8A85, 0xE0707090, 0x7C3E3E42, 0x71B5B5C4, 0xCC6666AA, 0x904848D8, 0x06030305, 0xF7F6F601, 0x1C0E0E12, 0xC26161A3, 0x6A35355F, 0xAE5757F9, 0x69B9B9D0, 0x17868691, 0x99C1C158, 0x3A1D1D27, 0x279E9EB9, 0xD9E1E138, 0xEBF8F813, 0x2B9898B3, 0x22111133, 0xD26969BB, 0xA9D9D970, 0x078E8E89, 0x339494A7, 0x2D9B9BB6, 0x3C1E1E22, 0x15878792, 0xC9E9E920, 0x87CECE49, 0xAA5555FF, 0x50282878, 0xA5DFDF7A, 0x038C8C8F, 0x59A1A1F8, 0x09898980, 0x1A0D0D17, 0x65BFBFDA, 0xD7E6E631, 0x844242C6, 0xD06868B8, 0x824141C3, 0x299999B0, 0x5A2D2D77, 0x1E0F0F11, 0x7BB0B0CB, 0xA85454FC, 0x6DBBBBD6, 0x2C16163A, }; /* Corresponds to _T1[256] */ unsigned int mtpz_aes_ft4[] = { 0xA5C66363, 0x84F87C7C, 0x99EE7777, 0x8DF67B7B, 0x0DFFF2F2, 0xBDD66B6B, 0xB1DE6F6F, 0x5491C5C5, 0x50603030, 0x03020101, 0xA9CE6767, 0x7D562B2B, 0x19E7FEFE, 0x62B5D7D7, 0xE64DABAB, 0x9AEC7676, 0x458FCACA, 0x9D1F8282, 0x4089C9C9, 0x87FA7D7D, 0x15EFFAFA, 0xEBB25959, 0xC98E4747, 0x0BFBF0F0, 0xEC41ADAD, 0x67B3D4D4, 0xFD5FA2A2, 0xEA45AFAF, 0xBF239C9C, 0xF753A4A4, 0x96E47272, 0x5B9BC0C0, 0xC275B7B7, 0x1CE1FDFD, 0xAE3D9393, 0x6A4C2626, 0x5A6C3636, 0x417E3F3F, 0x02F5F7F7, 0x4F83CCCC, 0x5C683434, 0xF451A5A5, 0x34D1E5E5, 0x08F9F1F1, 0x93E27171, 0x73ABD8D8, 0x53623131, 0x3F2A1515, 0x0C080404, 0x5295C7C7, 0x65462323, 0x5E9DC3C3, 0x28301818, 0xA1379696, 0x0F0A0505, 0xB52F9A9A, 0x090E0707, 0x36241212, 0x9B1B8080, 0x3DDFE2E2, 0x26CDEBEB, 0x694E2727, 0xCD7FB2B2, 0x9FEA7575, 0x1B120909, 0x9E1D8383, 0x74582C2C, 0x2E341A1A, 0x2D361B1B, 0xB2DC6E6E, 0xEEB45A5A, 0xFB5BA0A0, 0xF6A45252, 0x4D763B3B, 0x61B7D6D6, 0xCE7DB3B3, 0x7B522929, 0x3EDDE3E3, 0x715E2F2F, 0x97138484, 0xF5A65353, 0x68B9D1D1, 0x00000000, 0x2CC1EDED, 0x60402020, 0x1FE3FCFC, 0xC879B1B1, 0xEDB65B5B, 0xBED46A6A, 0x468DCBCB, 0xD967BEBE, 0x4B723939, 0xDE944A4A, 0xD4984C4C, 0xE8B05858, 0x4A85CFCF, 0x6BBBD0D0, 0x2AC5EFEF, 0xE54FAAAA, 0x16EDFBFB, 0xC5864343, 0xD79A4D4D, 0x55663333, 0x94118585, 0xCF8A4545, 0x10E9F9F9, 0x06040202, 0x81FE7F7F, 0xF0A05050, 0x44783C3C, 0xBA259F9F, 0xE34BA8A8, 0xF3A25151, 0xFE5DA3A3, 0xC0804040, 0x8A058F8F, 0xAD3F9292, 0xBC219D9D, 0x48703838, 0x04F1F5F5, 0xDF63BCBC, 0xC177B6B6, 0x75AFDADA, 0x63422121, 0x30201010, 0x1AE5FFFF, 0x0EFDF3F3, 0x6DBFD2D2, 0x4C81CDCD, 0x14180C0C, 0x35261313, 0x2FC3ECEC, 0xE1BE5F5F, 0xA2359797, 0xCC884444, 0x392E1717, 0x5793C4C4, 0xF255A7A7, 0x82FC7E7E, 0x477A3D3D, 0xACC86464, 0xE7BA5D5D, 0x2B321919, 0x95E67373, 0xA0C06060, 0x98198181, 0xD19E4F4F, 0x7FA3DCDC, 0x66442222, 0x7E542A2A, 0xAB3B9090, 0x830B8888, 0xCA8C4646, 0x29C7EEEE, 0xD36BB8B8, 0x3C281414, 0x79A7DEDE, 0xE2BC5E5E, 0x1D160B0B, 0x76ADDBDB, 0x3BDBE0E0, 0x56643232, 0x4E743A3A, 0x1E140A0A, 0xDB924949, 0x0A0C0606, 0x6C482424, 0xE4B85C5C, 0x5D9FC2C2, 0x6EBDD3D3, 0xEF43ACAC, 0xA6C46262, 0xA8399191, 0xA4319595, 0x37D3E4E4, 0x8BF27979, 0x32D5E7E7, 0x438BC8C8, 0x596E3737, 0xB7DA6D6D, 0x8C018D8D, 0x64B1D5D5, 0xD29C4E4E, 0xE049A9A9, 0xB4D86C6C, 0xFAAC5656, 0x07F3F4F4, 0x25CFEAEA, 0xAFCA6565, 0x8EF47A7A, 0xE947AEAE, 0x18100808, 0xD56FBABA, 0x88F07878, 0x6F4A2525, 0x725C2E2E, 0x24381C1C, 0xF157A6A6, 0xC773B4B4, 0x5197C6C6, 0x23CBE8E8, 0x7CA1DDDD, 0x9CE87474, 0x213E1F1F, 0xDD964B4B, 0xDC61BDBD, 0x860D8B8B, 0x850F8A8A, 0x90E07070, 0x427C3E3E, 0xC471B5B5, 0xAACC6666, 0xD8904848, 0x05060303, 0x01F7F6F6, 0x121C0E0E, 0xA3C26161, 0x5F6A3535, 0xF9AE5757, 0xD069B9B9, 0x91178686, 0x5899C1C1, 0x273A1D1D, 0xB9279E9E, 0x38D9E1E1, 0x13EBF8F8, 0xB32B9898, 0x33221111, 0xBBD26969, 0x70A9D9D9, 0x89078E8E, 0xA7339494, 0xB62D9B9B, 0x223C1E1E, 0x92158787, 0x20C9E9E9, 0x4987CECE, 0xFFAA5555, 0x78502828, 0x7AA5DFDF, 0x8F038C8C, 0xF859A1A1, 0x80098989, 0x171A0D0D, 0xDA65BFBF, 0x31D7E6E6, 0xC6844242, 0xB8D06868, 0xC3824141, 0xB0299999, 0x775A2D2D, 0x111E0F0F, 0xCB7BB0B0, 0xFCA85454, 0xD66DBBBB, 0x3A2C1616, }; /* Corresponds to _TInv3[256] */ unsigned int mtpz_aes_rt1[] = { 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 }; /* Corresponds to _TInv2[256] */ unsigned int mtpz_aes_rt2[] = { 0xA75051F4, 0x65537E41, 0xA4C31A17, 0x5E963A27, 0x6BCB3BAB, 0x45F11F9D, 0x58ABACFA, 0x03934BE3, 0xFA552030, 0x6DF6AD76, 0x769188CC, 0x4C25F502, 0xD7FC4FE5, 0xCBD7C52A, 0x44802635, 0xA38FB562, 0x5A49DEB1, 0x1B6725BA, 0x0E9845EA, 0xC0E15DFE, 0x7502C32F, 0xF012814C, 0x97A38D46, 0xF9C66BD3, 0x5FE7038F, 0x9C951592, 0x7AEBBF6D, 0x59DA9552, 0x832DD4BE, 0x21D35874, 0x692949E0, 0xC8448EC9, 0x896A75C2, 0x7978F48E, 0x3E6B9958, 0x71DD27B9, 0x4FB6BEE1, 0xAD17F088, 0xAC66C920, 0x3AB47DCE, 0x4A1863DF, 0x3182E51A, 0x33609751, 0x7F456253, 0x77E0B164, 0xAE84BB6B, 0xA01CFE81, 0x2B94F908, 0x68587048, 0xFD198F45, 0x6C8794DE, 0xF8B7527B, 0xD323AB73, 0x02E2724B, 0x8F57E31F, 0xAB2A6655, 0x2807B2EB, 0xC2032FB5, 0x7B9A86C5, 0x08A5D337, 0x87F23028, 0xA5B223BF, 0x6ABA0203, 0x825CED16, 0x1C2B8ACF, 0xB492A779, 0xF2F0F307, 0xE2A14E69, 0xF4CD65DA, 0xBED50605, 0x621FD134, 0xFE8AC4A6, 0x539D342E, 0x55A0A2F3, 0xE132058A, 0xEB75A4F6, 0xEC390B83, 0xEFAA4060, 0x9F065E71, 0x1051BD6E, 0x8AF93E21, 0x063D96DD, 0x05AEDD3E, 0xBD464DE6, 0x8DB59154, 0x5D0571C4, 0xD46F0406, 0x15FF6050, 0xFB241998, 0xE997D6BD, 0x43CC8940, 0x9E7767D9, 0x42BDB0E8, 0x8B880789, 0x5B38E719, 0xEEDB79C8, 0x0A47A17C, 0x0FE97C42, 0x1EC9F884, 0x00000000, 0x86830980, 0xED48322B, 0x70AC1E11, 0x724E6C5A, 0xFFFBFD0E, 0x38560F85, 0xD51E3DAE, 0x3927362D, 0xD9640A0F, 0xA621685C, 0x54D19B5B, 0x2E3A2436, 0x67B10C0A, 0xE70F9357, 0x96D2B4EE, 0x919E1B9B, 0xC54F80C0, 0x20A261DC, 0x4B695A77, 0x1A161C12, 0xBA0AE293, 0x2AE5C0A0, 0xE0433C22, 0x171D121B, 0x0D0B0E09, 0xC7ADF28B, 0xA8B92DB6, 0xA9C8141E, 0x198557F1, 0x074CAF75, 0xDDBBEE99, 0x60FDA37F, 0x269FF701, 0xF5BC5C72, 0x3BC54466, 0x7E345BFB, 0x29768B43, 0xC6DCCB23, 0xFC68B6ED, 0xF163B8E4, 0xDCCAD731, 0x85104263, 0x22401397, 0x112084C6, 0x247D854A, 0x3DF8D2BB, 0x3211AEF9, 0xA16DC729, 0x2F4B1D9E, 0x30F3DCB2, 0x52EC0D86, 0xE3D077C1, 0x166C2BB3, 0xB999A970, 0x48FA1194, 0x642247E9, 0x8CC4A8FC, 0x3F1AA0F0, 0x2CD8567D, 0x90EF2233, 0x4EC78749, 0xD1C1D938, 0xA2FE8CCA, 0x0B3698D4, 0x81CFA6F5, 0xDE28A57A, 0x8E26DAB7, 0xBFA43FAD, 0x9DE42C3A, 0x920D5078, 0xCC9B6A5F, 0x4662547E, 0x13C2F68D, 0xB8E890D8, 0xF75E2E39, 0xAFF582C3, 0x80BE9F5D, 0x937C69D0, 0x2DA96FD5, 0x12B3CF25, 0x993BC8AC, 0x7DA71018, 0x636EE89C, 0xBB7BDB3B, 0x7809CD26, 0x18F46E59, 0xB701EC9A, 0x9AA8834F, 0x6E65E695, 0xE67EAAFF, 0xCF0821BC, 0xE8E6EF15, 0x9BD9BAE7, 0x36CE4A6F, 0x09D4EA9F, 0x7CD629B0, 0xB2AF31A4, 0x23312A3F, 0x9430C6A5, 0x66C035A2, 0xBC37744E, 0xCAA6FC82, 0xD0B0E090, 0xD81533A7, 0x984AF104, 0xDAF741EC, 0x500E7FCD, 0xF62F1791, 0xD68D764D, 0xB04D43EF, 0x4D54CCAA, 0x04DFE496, 0xB5E39ED1, 0x881B4C6A, 0x1FB8C12C, 0x517F4665, 0xEA049D5E, 0x355D018C, 0x7473FA87, 0x412EFB0B, 0x1D5AB367, 0xD25292DB, 0x5633E910, 0x47136DD6, 0x618C9AD7, 0x0C7A37A1, 0x148E59F8, 0x3C89EB13, 0x27EECEA9, 0xC935B761, 0xE5EDE11C, 0xB13C7A47, 0xDF599CD2, 0x733F55F2, 0xCE791814, 0x37BF73C7, 0xCDEA53F7, 0xAA5B5FFD, 0x6F14DF3D, 0xDB867844, 0xF381CAAF, 0xC43EB968, 0x342C3824, 0x405FC2A3, 0xC372161D, 0x250CBCE2, 0x498B283C, 0x9541FF0D, 0x017139A8, 0xB3DE080C, 0xE49CD8B4, 0xC1906456, 0x84617BCB, 0xB670D532, 0x5C74486C, 0x5742D0B8 }; /* Corresponds to _TInv0[256] */ unsigned int mtpz_aes_rt3[] = { 0x51F4A750, 0x7E416553, 0x1A17A4C3, 0x3A275E96, 0x3BAB6BCB, 0x1F9D45F1, 0xACFA58AB, 0x4BE30393, 0x2030FA55, 0xAD766DF6, 0x88CC7691, 0xF5024C25, 0x4FE5D7FC, 0xC52ACBD7, 0x26354480, 0xB562A38F, 0xDEB15A49, 0x25BA1B67, 0x45EA0E98, 0x5DFEC0E1, 0xC32F7502, 0x814CF012, 0x8D4697A3, 0x6BD3F9C6, 0x038F5FE7, 0x15929C95, 0xBF6D7AEB, 0x955259DA, 0xD4BE832D, 0x587421D3, 0x49E06929, 0x8EC9C844, 0x75C2896A, 0xF48E7978, 0x99583E6B, 0x27B971DD, 0xBEE14FB6, 0xF088AD17, 0xC920AC66, 0x7DCE3AB4, 0x63DF4A18, 0xE51A3182, 0x97513360, 0x62537F45, 0xB16477E0, 0xBB6BAE84, 0xFE81A01C, 0xF9082B94, 0x70486858, 0x8F45FD19, 0x94DE6C87, 0x527BF8B7, 0xAB73D323, 0x724B02E2, 0xE31F8F57, 0x6655AB2A, 0xB2EB2807, 0x2FB5C203, 0x86C57B9A, 0xD33708A5, 0x302887F2, 0x23BFA5B2, 0x02036ABA, 0xED16825C, 0x8ACF1C2B, 0xA779B492, 0xF307F2F0, 0x4E69E2A1, 0x65DAF4CD, 0x0605BED5, 0xD134621F, 0xC4A6FE8A, 0x342E539D, 0xA2F355A0, 0x058AE132, 0xA4F6EB75, 0x0B83EC39, 0x4060EFAA, 0x5E719F06, 0xBD6E1051, 0x3E218AF9, 0x96DD063D, 0xDD3E05AE, 0x4DE6BD46, 0x91548DB5, 0x71C45D05, 0x0406D46F, 0x605015FF, 0x1998FB24, 0xD6BDE997, 0x894043CC, 0x67D99E77, 0xB0E842BD, 0x07898B88, 0xE7195B38, 0x79C8EEDB, 0xA17C0A47, 0x7C420FE9, 0xF8841EC9, 0x00000000, 0x09808683, 0x322BED48, 0x1E1170AC, 0x6C5A724E, 0xFD0EFFFB, 0x0F853856, 0x3DAED51E, 0x362D3927, 0x0A0FD964, 0x685CA621, 0x9B5B54D1, 0x24362E3A, 0x0C0A67B1, 0x9357E70F, 0xB4EE96D2, 0x1B9B919E, 0x80C0C54F, 0x61DC20A2, 0x5A774B69, 0x1C121A16, 0xE293BA0A, 0xC0A02AE5, 0x3C22E043, 0x121B171D, 0x0E090D0B, 0xF28BC7AD, 0x2DB6A8B9, 0x141EA9C8, 0x57F11985, 0xAF75074C, 0xEE99DDBB, 0xA37F60FD, 0xF701269F, 0x5C72F5BC, 0x44663BC5, 0x5BFB7E34, 0x8B432976, 0xCB23C6DC, 0xB6EDFC68, 0xB8E4F163, 0xD731DCCA, 0x42638510, 0x13972240, 0x84C61120, 0x854A247D, 0xD2BB3DF8, 0xAEF93211, 0xC729A16D, 0x1D9E2F4B, 0xDCB230F3, 0x0D8652EC, 0x77C1E3D0, 0x2BB3166C, 0xA970B999, 0x119448FA, 0x47E96422, 0xA8FC8CC4, 0xA0F03F1A, 0x567D2CD8, 0x223390EF, 0x87494EC7, 0xD938D1C1, 0x8CCAA2FE, 0x98D40B36, 0xA6F581CF, 0xA57ADE28, 0xDAB78E26, 0x3FADBFA4, 0x2C3A9DE4, 0x5078920D, 0x6A5FCC9B, 0x547E4662, 0xF68D13C2, 0x90D8B8E8, 0x2E39F75E, 0x82C3AFF5, 0x9F5D80BE, 0x69D0937C, 0x6FD52DA9, 0xCF2512B3, 0xC8AC993B, 0x10187DA7, 0xE89C636E, 0xDB3BBB7B, 0xCD267809, 0x6E5918F4, 0xEC9AB701, 0x834F9AA8, 0xE6956E65, 0xAAFFE67E, 0x21BCCF08, 0xEF15E8E6, 0xBAE79BD9, 0x4A6F36CE, 0xEA9F09D4, 0x29B07CD6, 0x31A4B2AF, 0x2A3F2331, 0xC6A59430, 0x35A266C0, 0x744EBC37, 0xFC82CAA6, 0xE090D0B0, 0x33A7D815, 0xF104984A, 0x41ECDAF7, 0x7FCD500E, 0x1791F62F, 0x764DD68D, 0x43EFB04D, 0xCCAA4D54, 0xE49604DF, 0x9ED1B5E3, 0x4C6A881B, 0xC12C1FB8, 0x4665517F, 0x9D5EEA04, 0x018C355D, 0xFA877473, 0xFB0B412E, 0xB3671D5A, 0x92DBD252, 0xE9105633, 0x6DD64713, 0x9AD7618C, 0x37A10C7A, 0x59F8148E, 0xEB133C89, 0xCEA927EE, 0xB761C935, 0xE11CE5ED, 0x7A47B13C, 0x9CD2DF59, 0x55F2733F, 0x1814CE79, 0x73C737BF, 0x53F7CDEA, 0x5FFDAA5B, 0xDF3D6F14, 0x7844DB86, 0xCAAFF381, 0xB968C43E, 0x3824342C, 0xC2A3405F, 0x161DC372, 0xBCE2250C, 0x283C498B, 0xFF0D9541, 0x39A80171, 0x080CB3DE, 0xD8B4E49C, 0x6456C190, 0x7BCB8461, 0xD532B670, 0x486C5C74, 0xD0B85742 }; /* Corresponds to _TInv1[256] */ unsigned int mtpz_aes_rt4[] = { 0x5051F4A7, 0x537E4165, 0xC31A17A4, 0x963A275E, 0xCB3BAB6B, 0xF11F9D45, 0xABACFA58, 0x934BE303, 0x552030FA, 0xF6AD766D, 0x9188CC76, 0x25F5024C, 0xFC4FE5D7, 0xD7C52ACB, 0x80263544, 0x8FB562A3, 0x49DEB15A, 0x6725BA1B, 0x9845EA0E, 0xE15DFEC0, 0x02C32F75, 0x12814CF0, 0xA38D4697, 0xC66BD3F9, 0xE7038F5F, 0x9515929C, 0xEBBF6D7A, 0xDA955259, 0x2DD4BE83, 0xD3587421, 0x2949E069, 0x448EC9C8, 0x6A75C289, 0x78F48E79, 0x6B99583E, 0xDD27B971, 0xB6BEE14F, 0x17F088AD, 0x66C920AC, 0xB47DCE3A, 0x1863DF4A, 0x82E51A31, 0x60975133, 0x4562537F, 0xE0B16477, 0x84BB6BAE, 0x1CFE81A0, 0x94F9082B, 0x58704868, 0x198F45FD, 0x8794DE6C, 0xB7527BF8, 0x23AB73D3, 0xE2724B02, 0x57E31F8F, 0x2A6655AB, 0x07B2EB28, 0x032FB5C2, 0x9A86C57B, 0xA5D33708, 0xF2302887, 0xB223BFA5, 0xBA02036A, 0x5CED1682, 0x2B8ACF1C, 0x92A779B4, 0xF0F307F2, 0xA14E69E2, 0xCD65DAF4, 0xD50605BE, 0x1FD13462, 0x8AC4A6FE, 0x9D342E53, 0xA0A2F355, 0x32058AE1, 0x75A4F6EB, 0x390B83EC, 0xAA4060EF, 0x065E719F, 0x51BD6E10, 0xF93E218A, 0x3D96DD06, 0xAEDD3E05, 0x464DE6BD, 0xB591548D, 0x0571C45D, 0x6F0406D4, 0xFF605015, 0x241998FB, 0x97D6BDE9, 0xCC894043, 0x7767D99E, 0xBDB0E842, 0x8807898B, 0x38E7195B, 0xDB79C8EE, 0x47A17C0A, 0xE97C420F, 0xC9F8841E, 0x00000000, 0x83098086, 0x48322BED, 0xAC1E1170, 0x4E6C5A72, 0xFBFD0EFF, 0x560F8538, 0x1E3DAED5, 0x27362D39, 0x640A0FD9, 0x21685CA6, 0xD19B5B54, 0x3A24362E, 0xB10C0A67, 0x0F9357E7, 0xD2B4EE96, 0x9E1B9B91, 0x4F80C0C5, 0xA261DC20, 0x695A774B, 0x161C121A, 0x0AE293BA, 0xE5C0A02A, 0x433C22E0, 0x1D121B17, 0x0B0E090D, 0xADF28BC7, 0xB92DB6A8, 0xC8141EA9, 0x8557F119, 0x4CAF7507, 0xBBEE99DD, 0xFDA37F60, 0x9FF70126, 0xBC5C72F5, 0xC544663B, 0x345BFB7E, 0x768B4329, 0xDCCB23C6, 0x68B6EDFC, 0x63B8E4F1, 0xCAD731DC, 0x10426385, 0x40139722, 0x2084C611, 0x7D854A24, 0xF8D2BB3D, 0x11AEF932, 0x6DC729A1, 0x4B1D9E2F, 0xF3DCB230, 0xEC0D8652, 0xD077C1E3, 0x6C2BB316, 0x99A970B9, 0xFA119448, 0x2247E964, 0xC4A8FC8C, 0x1AA0F03F, 0xD8567D2C, 0xEF223390, 0xC787494E, 0xC1D938D1, 0xFE8CCAA2, 0x3698D40B, 0xCFA6F581, 0x28A57ADE, 0x26DAB78E, 0xA43FADBF, 0xE42C3A9D, 0x0D507892, 0x9B6A5FCC, 0x62547E46, 0xC2F68D13, 0xE890D8B8, 0x5E2E39F7, 0xF582C3AF, 0xBE9F5D80, 0x7C69D093, 0xA96FD52D, 0xB3CF2512, 0x3BC8AC99, 0xA710187D, 0x6EE89C63, 0x7BDB3BBB, 0x09CD2678, 0xF46E5918, 0x01EC9AB7, 0xA8834F9A, 0x65E6956E, 0x7EAAFFE6, 0x0821BCCF, 0xE6EF15E8, 0xD9BAE79B, 0xCE4A6F36, 0xD4EA9F09, 0xD629B07C, 0xAF31A4B2, 0x312A3F23, 0x30C6A594, 0xC035A266, 0x37744EBC, 0xA6FC82CA, 0xB0E090D0, 0x1533A7D8, 0x4AF10498, 0xF741ECDA, 0x0E7FCD50, 0x2F1791F6, 0x8D764DD6, 0x4D43EFB0, 0x54CCAA4D, 0xDFE49604, 0xE39ED1B5, 0x1B4C6A88, 0xB8C12C1F, 0x7F466551, 0x049D5EEA, 0x5D018C35, 0x73FA8774, 0x2EFB0B41, 0x5AB3671D, 0x5292DBD2, 0x33E91056, 0x136DD647, 0x8C9AD761, 0x7A37A10C, 0x8E59F814, 0x89EB133C, 0xEECEA927, 0x35B761C9, 0xEDE11CE5, 0x3C7A47B1, 0x599CD2DF, 0x3F55F273, 0x791814CE, 0xBF73C737, 0xEA53F7CD, 0x5B5FFDAA, 0x14DF3D6F, 0x867844DB, 0x81CAAFF3, 0x3EB968C4, 0x2C382434, 0x5FC2A340, 0x72161DC3, 0x0CBCE225, 0x8B283C49, 0x41FF0D95, 0x7139A801, 0xDE080CB3, 0x9CD8B4E4, 0x906456C1, 0x617BCB84, 0x70D532B6, 0x74486C5C, 0x42D0B857 }; /* Corresponds to _IMXC1[256] */ unsigned int mtpz_aes_gb11[] = { 0x00000000, 0x0B0E090D, 0x161C121A, 0x1D121B17, 0x2C382434, 0x27362D39, 0x3A24362E, 0x312A3F23, 0x58704868, 0x537E4165, 0x4E6C5A72, 0x4562537F, 0x74486C5C, 0x7F466551, 0x62547E46, 0x695A774B, 0xB0E090D0, 0xBBEE99DD, 0xA6FC82CA, 0xADF28BC7, 0x9CD8B4E4, 0x97D6BDE9, 0x8AC4A6FE, 0x81CAAFF3, 0xE890D8B8, 0xE39ED1B5, 0xFE8CCAA2, 0xF582C3AF, 0xC4A8FC8C, 0xCFA6F581, 0xD2B4EE96, 0xD9BAE79B, 0x7BDB3BBB, 0x70D532B6, 0x6DC729A1, 0x66C920AC, 0x57E31F8F, 0x5CED1682, 0x41FF0D95, 0x4AF10498, 0x23AB73D3, 0x28A57ADE, 0x35B761C9, 0x3EB968C4, 0x0F9357E7, 0x049D5EEA, 0x198F45FD, 0x12814CF0, 0xCB3BAB6B, 0xC035A266, 0xDD27B971, 0xD629B07C, 0xE7038F5F, 0xEC0D8652, 0xF11F9D45, 0xFA119448, 0x934BE303, 0x9845EA0E, 0x8557F119, 0x8E59F814, 0xBF73C737, 0xB47DCE3A, 0xA96FD52D, 0xA261DC20, 0xF6AD766D, 0xFDA37F60, 0xE0B16477, 0xEBBF6D7A, 0xDA955259, 0xD19B5B54, 0xCC894043, 0xC787494E, 0xAEDD3E05, 0xA5D33708, 0xB8C12C1F, 0xB3CF2512, 0x82E51A31, 0x89EB133C, 0x94F9082B, 0x9FF70126, 0x464DE6BD, 0x4D43EFB0, 0x5051F4A7, 0x5B5FFDAA, 0x6A75C289, 0x617BCB84, 0x7C69D093, 0x7767D99E, 0x1E3DAED5, 0x1533A7D8, 0x0821BCCF, 0x032FB5C2, 0x32058AE1, 0x390B83EC, 0x241998FB, 0x2F1791F6, 0x8D764DD6, 0x867844DB, 0x9B6A5FCC, 0x906456C1, 0xA14E69E2, 0xAA4060EF, 0xB7527BF8, 0xBC5C72F5, 0xD50605BE, 0xDE080CB3, 0xC31A17A4, 0xC8141EA9, 0xF93E218A, 0xF2302887, 0xEF223390, 0xE42C3A9D, 0x3D96DD06, 0x3698D40B, 0x2B8ACF1C, 0x2084C611, 0x11AEF932, 0x1AA0F03F, 0x07B2EB28, 0x0CBCE225, 0x65E6956E, 0x6EE89C63, 0x73FA8774, 0x78F48E79, 0x49DEB15A, 0x42D0B857, 0x5FC2A340, 0x54CCAA4D, 0xF741ECDA, 0xFC4FE5D7, 0xE15DFEC0, 0xEA53F7CD, 0xDB79C8EE, 0xD077C1E3, 0xCD65DAF4, 0xC66BD3F9, 0xAF31A4B2, 0xA43FADBF, 0xB92DB6A8, 0xB223BFA5, 0x83098086, 0x8807898B, 0x9515929C, 0x9E1B9B91, 0x47A17C0A, 0x4CAF7507, 0x51BD6E10, 0x5AB3671D, 0x6B99583E, 0x60975133, 0x7D854A24, 0x768B4329, 0x1FD13462, 0x14DF3D6F, 0x09CD2678, 0x02C32F75, 0x33E91056, 0x38E7195B, 0x25F5024C, 0x2EFB0B41, 0x8C9AD761, 0x8794DE6C, 0x9A86C57B, 0x9188CC76, 0xA0A2F355, 0xABACFA58, 0xB6BEE14F, 0xBDB0E842, 0xD4EA9F09, 0xDFE49604, 0xC2F68D13, 0xC9F8841E, 0xF8D2BB3D, 0xF3DCB230, 0xEECEA927, 0xE5C0A02A, 0x3C7A47B1, 0x37744EBC, 0x2A6655AB, 0x21685CA6, 0x10426385, 0x1B4C6A88, 0x065E719F, 0x0D507892, 0x640A0FD9, 0x6F0406D4, 0x72161DC3, 0x791814CE, 0x48322BED, 0x433C22E0, 0x5E2E39F7, 0x552030FA, 0x01EC9AB7, 0x0AE293BA, 0x17F088AD, 0x1CFE81A0, 0x2DD4BE83, 0x26DAB78E, 0x3BC8AC99, 0x30C6A594, 0x599CD2DF, 0x5292DBD2, 0x4F80C0C5, 0x448EC9C8, 0x75A4F6EB, 0x7EAAFFE6, 0x63B8E4F1, 0x68B6EDFC, 0xB10C0A67, 0xBA02036A, 0xA710187D, 0xAC1E1170, 0x9D342E53, 0x963A275E, 0x8B283C49, 0x80263544, 0xE97C420F, 0xE2724B02, 0xFF605015, 0xF46E5918, 0xC544663B, 0xCE4A6F36, 0xD3587421, 0xD8567D2C, 0x7A37A10C, 0x7139A801, 0x6C2BB316, 0x6725BA1B, 0x560F8538, 0x5D018C35, 0x40139722, 0x4B1D9E2F, 0x2247E964, 0x2949E069, 0x345BFB7E, 0x3F55F273, 0x0E7FCD50, 0x0571C45D, 0x1863DF4A, 0x136DD647, 0xCAD731DC, 0xC1D938D1, 0xDCCB23C6, 0xD7C52ACB, 0xE6EF15E8, 0xEDE11CE5, 0xF0F307F2, 0xFBFD0EFF, 0x92A779B4, 0x99A970B9, 0x84BB6BAE, 0x8FB562A3, 0xBE9F5D80, 0xB591548D, 0xA8834F9A, 0xA38D4697, }; /* Corresponds to _IMXC0[256] */ unsigned int mtpz_aes_gb14[] = { 0x00000000, 0x0E090D0B, 0x1C121A16, 0x121B171D, 0x3824342C, 0x362D3927, 0x24362E3A, 0x2A3F2331, 0x70486858, 0x7E416553, 0x6C5A724E, 0x62537F45, 0x486C5C74, 0x4665517F, 0x547E4662, 0x5A774B69, 0xE090D0B0, 0xEE99DDBB, 0xFC82CAA6, 0xF28BC7AD, 0xD8B4E49C, 0xD6BDE997, 0xC4A6FE8A, 0xCAAFF381, 0x90D8B8E8, 0x9ED1B5E3, 0x8CCAA2FE, 0x82C3AFF5, 0xA8FC8CC4, 0xA6F581CF, 0xB4EE96D2, 0xBAE79BD9, 0xDB3BBB7B, 0xD532B670, 0xC729A16D, 0xC920AC66, 0xE31F8F57, 0xED16825C, 0xFF0D9541, 0xF104984A, 0xAB73D323, 0xA57ADE28, 0xB761C935, 0xB968C43E, 0x9357E70F, 0x9D5EEA04, 0x8F45FD19, 0x814CF012, 0x3BAB6BCB, 0x35A266C0, 0x27B971DD, 0x29B07CD6, 0x038F5FE7, 0x0D8652EC, 0x1F9D45F1, 0x119448FA, 0x4BE30393, 0x45EA0E98, 0x57F11985, 0x59F8148E, 0x73C737BF, 0x7DCE3AB4, 0x6FD52DA9, 0x61DC20A2, 0xAD766DF6, 0xA37F60FD, 0xB16477E0, 0xBF6D7AEB, 0x955259DA, 0x9B5B54D1, 0x894043CC, 0x87494EC7, 0xDD3E05AE, 0xD33708A5, 0xC12C1FB8, 0xCF2512B3, 0xE51A3182, 0xEB133C89, 0xF9082B94, 0xF701269F, 0x4DE6BD46, 0x43EFB04D, 0x51F4A750, 0x5FFDAA5B, 0x75C2896A, 0x7BCB8461, 0x69D0937C, 0x67D99E77, 0x3DAED51E, 0x33A7D815, 0x21BCCF08, 0x2FB5C203, 0x058AE132, 0x0B83EC39, 0x1998FB24, 0x1791F62F, 0x764DD68D, 0x7844DB86, 0x6A5FCC9B, 0x6456C190, 0x4E69E2A1, 0x4060EFAA, 0x527BF8B7, 0x5C72F5BC, 0x0605BED5, 0x080CB3DE, 0x1A17A4C3, 0x141EA9C8, 0x3E218AF9, 0x302887F2, 0x223390EF, 0x2C3A9DE4, 0x96DD063D, 0x98D40B36, 0x8ACF1C2B, 0x84C61120, 0xAEF93211, 0xA0F03F1A, 0xB2EB2807, 0xBCE2250C, 0xE6956E65, 0xE89C636E, 0xFA877473, 0xF48E7978, 0xDEB15A49, 0xD0B85742, 0xC2A3405F, 0xCCAA4D54, 0x41ECDAF7, 0x4FE5D7FC, 0x5DFEC0E1, 0x53F7CDEA, 0x79C8EEDB, 0x77C1E3D0, 0x65DAF4CD, 0x6BD3F9C6, 0x31A4B2AF, 0x3FADBFA4, 0x2DB6A8B9, 0x23BFA5B2, 0x09808683, 0x07898B88, 0x15929C95, 0x1B9B919E, 0xA17C0A47, 0xAF75074C, 0xBD6E1051, 0xB3671D5A, 0x99583E6B, 0x97513360, 0x854A247D, 0x8B432976, 0xD134621F, 0xDF3D6F14, 0xCD267809, 0xC32F7502, 0xE9105633, 0xE7195B38, 0xF5024C25, 0xFB0B412E, 0x9AD7618C, 0x94DE6C87, 0x86C57B9A, 0x88CC7691, 0xA2F355A0, 0xACFA58AB, 0xBEE14FB6, 0xB0E842BD, 0xEA9F09D4, 0xE49604DF, 0xF68D13C2, 0xF8841EC9, 0xD2BB3DF8, 0xDCB230F3, 0xCEA927EE, 0xC0A02AE5, 0x7A47B13C, 0x744EBC37, 0x6655AB2A, 0x685CA621, 0x42638510, 0x4C6A881B, 0x5E719F06, 0x5078920D, 0x0A0FD964, 0x0406D46F, 0x161DC372, 0x1814CE79, 0x322BED48, 0x3C22E043, 0x2E39F75E, 0x2030FA55, 0xEC9AB701, 0xE293BA0A, 0xF088AD17, 0xFE81A01C, 0xD4BE832D, 0xDAB78E26, 0xC8AC993B, 0xC6A59430, 0x9CD2DF59, 0x92DBD252, 0x80C0C54F, 0x8EC9C844, 0xA4F6EB75, 0xAAFFE67E, 0xB8E4F163, 0xB6EDFC68, 0x0C0A67B1, 0x02036ABA, 0x10187DA7, 0x1E1170AC, 0x342E539D, 0x3A275E96, 0x283C498B, 0x26354480, 0x7C420FE9, 0x724B02E2, 0x605015FF, 0x6E5918F4, 0x44663BC5, 0x4A6F36CE, 0x587421D3, 0x567D2CD8, 0x37A10C7A, 0x39A80171, 0x2BB3166C, 0x25BA1B67, 0x0F853856, 0x018C355D, 0x13972240, 0x1D9E2F4B, 0x47E96422, 0x49E06929, 0x5BFB7E34, 0x55F2733F, 0x7FCD500E, 0x71C45D05, 0x63DF4A18, 0x6DD64713, 0xD731DCCA, 0xD938D1C1, 0xCB23C6DC, 0xC52ACBD7, 0xEF15E8E6, 0xE11CE5ED, 0xF307F2F0, 0xFD0EFFFB, 0xA779B492, 0xA970B999, 0xBB6BAE84, 0xB562A38F, 0x9F5D80BE, 0x91548DB5, 0x834F9AA8, 0x8D4697A3, } ; /* Corresponds to _IMXC2[256] */ unsigned int mtpz_aes_gb13[] = { 0x00000000, 0x0D0B0E09, 0x1A161C12, 0x171D121B, 0x342C3824, 0x3927362D, 0x2E3A2436, 0x23312A3F, 0x68587048, 0x65537E41, 0x724E6C5A, 0x7F456253, 0x5C74486C, 0x517F4665, 0x4662547E, 0x4B695A77, 0xD0B0E090, 0xDDBBEE99, 0xCAA6FC82, 0xC7ADF28B, 0xE49CD8B4, 0xE997D6BD, 0xFE8AC4A6, 0xF381CAAF, 0xB8E890D8, 0xB5E39ED1, 0xA2FE8CCA, 0xAFF582C3, 0x8CC4A8FC, 0x81CFA6F5, 0x96D2B4EE, 0x9BD9BAE7, 0xBB7BDB3B, 0xB670D532, 0xA16DC729, 0xAC66C920, 0x8F57E31F, 0x825CED16, 0x9541FF0D, 0x984AF104, 0xD323AB73, 0xDE28A57A, 0xC935B761, 0xC43EB968, 0xE70F9357, 0xEA049D5E, 0xFD198F45, 0xF012814C, 0x6BCB3BAB, 0x66C035A2, 0x71DD27B9, 0x7CD629B0, 0x5FE7038F, 0x52EC0D86, 0x45F11F9D, 0x48FA1194, 0x03934BE3, 0x0E9845EA, 0x198557F1, 0x148E59F8, 0x37BF73C7, 0x3AB47DCE, 0x2DA96FD5, 0x20A261DC, 0x6DF6AD76, 0x60FDA37F, 0x77E0B164, 0x7AEBBF6D, 0x59DA9552, 0x54D19B5B, 0x43CC8940, 0x4EC78749, 0x05AEDD3E, 0x08A5D337, 0x1FB8C12C, 0x12B3CF25, 0x3182E51A, 0x3C89EB13, 0x2B94F908, 0x269FF701, 0xBD464DE6, 0xB04D43EF, 0xA75051F4, 0xAA5B5FFD, 0x896A75C2, 0x84617BCB, 0x937C69D0, 0x9E7767D9, 0xD51E3DAE, 0xD81533A7, 0xCF0821BC, 0xC2032FB5, 0xE132058A, 0xEC390B83, 0xFB241998, 0xF62F1791, 0xD68D764D, 0xDB867844, 0xCC9B6A5F, 0xC1906456, 0xE2A14E69, 0xEFAA4060, 0xF8B7527B, 0xF5BC5C72, 0xBED50605, 0xB3DE080C, 0xA4C31A17, 0xA9C8141E, 0x8AF93E21, 0x87F23028, 0x90EF2233, 0x9DE42C3A, 0x063D96DD, 0x0B3698D4, 0x1C2B8ACF, 0x112084C6, 0x3211AEF9, 0x3F1AA0F0, 0x2807B2EB, 0x250CBCE2, 0x6E65E695, 0x636EE89C, 0x7473FA87, 0x7978F48E, 0x5A49DEB1, 0x5742D0B8, 0x405FC2A3, 0x4D54CCAA, 0xDAF741EC, 0xD7FC4FE5, 0xC0E15DFE, 0xCDEA53F7, 0xEEDB79C8, 0xE3D077C1, 0xF4CD65DA, 0xF9C66BD3, 0xB2AF31A4, 0xBFA43FAD, 0xA8B92DB6, 0xA5B223BF, 0x86830980, 0x8B880789, 0x9C951592, 0x919E1B9B, 0x0A47A17C, 0x074CAF75, 0x1051BD6E, 0x1D5AB367, 0x3E6B9958, 0x33609751, 0x247D854A, 0x29768B43, 0x621FD134, 0x6F14DF3D, 0x7809CD26, 0x7502C32F, 0x5633E910, 0x5B38E719, 0x4C25F502, 0x412EFB0B, 0x618C9AD7, 0x6C8794DE, 0x7B9A86C5, 0x769188CC, 0x55A0A2F3, 0x58ABACFA, 0x4FB6BEE1, 0x42BDB0E8, 0x09D4EA9F, 0x04DFE496, 0x13C2F68D, 0x1EC9F884, 0x3DF8D2BB, 0x30F3DCB2, 0x27EECEA9, 0x2AE5C0A0, 0xB13C7A47, 0xBC37744E, 0xAB2A6655, 0xA621685C, 0x85104263, 0x881B4C6A, 0x9F065E71, 0x920D5078, 0xD9640A0F, 0xD46F0406, 0xC372161D, 0xCE791814, 0xED48322B, 0xE0433C22, 0xF75E2E39, 0xFA552030, 0xB701EC9A, 0xBA0AE293, 0xAD17F088, 0xA01CFE81, 0x832DD4BE, 0x8E26DAB7, 0x993BC8AC, 0x9430C6A5, 0xDF599CD2, 0xD25292DB, 0xC54F80C0, 0xC8448EC9, 0xEB75A4F6, 0xE67EAAFF, 0xF163B8E4, 0xFC68B6ED, 0x67B10C0A, 0x6ABA0203, 0x7DA71018, 0x70AC1E11, 0x539D342E, 0x5E963A27, 0x498B283C, 0x44802635, 0x0FE97C42, 0x02E2724B, 0x15FF6050, 0x18F46E59, 0x3BC54466, 0x36CE4A6F, 0x21D35874, 0x2CD8567D, 0x0C7A37A1, 0x017139A8, 0x166C2BB3, 0x1B6725BA, 0x38560F85, 0x355D018C, 0x22401397, 0x2F4B1D9E, 0x642247E9, 0x692949E0, 0x7E345BFB, 0x733F55F2, 0x500E7FCD, 0x5D0571C4, 0x4A1863DF, 0x47136DD6, 0xDCCAD731, 0xD1C1D938, 0xC6DCCB23, 0xCBD7C52A, 0xE8E6EF15, 0xE5EDE11C, 0xF2F0F307, 0xFFFBFD0E, 0xB492A779, 0xB999A970, 0xAE84BB6B, 0xA38FB562, 0x80BE9F5D, 0x8DB59154, 0x9AA8834F, 0x97A38D46, }; /* Corresponds to _IMXC3[256] */ unsigned int mtpz_aes_gb9[] = { 0x00000000, 0x090D0B0E, 0x121A161C, 0x1B171D12, 0x24342C38, 0x2D392736, 0x362E3A24, 0x3F23312A, 0x48685870, 0x4165537E, 0x5A724E6C, 0x537F4562, 0x6C5C7448, 0x65517F46, 0x7E466254, 0x774B695A, 0x90D0B0E0, 0x99DDBBEE, 0x82CAA6FC, 0x8BC7ADF2, 0xB4E49CD8, 0xBDE997D6, 0xA6FE8AC4, 0xAFF381CA, 0xD8B8E890, 0xD1B5E39E, 0xCAA2FE8C, 0xC3AFF582, 0xFC8CC4A8, 0xF581CFA6, 0xEE96D2B4, 0xE79BD9BA, 0x3BBB7BDB, 0x32B670D5, 0x29A16DC7, 0x20AC66C9, 0x1F8F57E3, 0x16825CED, 0x0D9541FF, 0x04984AF1, 0x73D323AB, 0x7ADE28A5, 0x61C935B7, 0x68C43EB9, 0x57E70F93, 0x5EEA049D, 0x45FD198F, 0x4CF01281, 0xAB6BCB3B, 0xA266C035, 0xB971DD27, 0xB07CD629, 0x8F5FE703, 0x8652EC0D, 0x9D45F11F, 0x9448FA11, 0xE303934B, 0xEA0E9845, 0xF1198557, 0xF8148E59, 0xC737BF73, 0xCE3AB47D, 0xD52DA96F, 0xDC20A261, 0x766DF6AD, 0x7F60FDA3, 0x6477E0B1, 0x6D7AEBBF, 0x5259DA95, 0x5B54D19B, 0x4043CC89, 0x494EC787, 0x3E05AEDD, 0x3708A5D3, 0x2C1FB8C1, 0x2512B3CF, 0x1A3182E5, 0x133C89EB, 0x082B94F9, 0x01269FF7, 0xE6BD464D, 0xEFB04D43, 0xF4A75051, 0xFDAA5B5F, 0xC2896A75, 0xCB84617B, 0xD0937C69, 0xD99E7767, 0xAED51E3D, 0xA7D81533, 0xBCCF0821, 0xB5C2032F, 0x8AE13205, 0x83EC390B, 0x98FB2419, 0x91F62F17, 0x4DD68D76, 0x44DB8678, 0x5FCC9B6A, 0x56C19064, 0x69E2A14E, 0x60EFAA40, 0x7BF8B752, 0x72F5BC5C, 0x05BED506, 0x0CB3DE08, 0x17A4C31A, 0x1EA9C814, 0x218AF93E, 0x2887F230, 0x3390EF22, 0x3A9DE42C, 0xDD063D96, 0xD40B3698, 0xCF1C2B8A, 0xC6112084, 0xF93211AE, 0xF03F1AA0, 0xEB2807B2, 0xE2250CBC, 0x956E65E6, 0x9C636EE8, 0x877473FA, 0x8E7978F4, 0xB15A49DE, 0xB85742D0, 0xA3405FC2, 0xAA4D54CC, 0xECDAF741, 0xE5D7FC4F, 0xFEC0E15D, 0xF7CDEA53, 0xC8EEDB79, 0xC1E3D077, 0xDAF4CD65, 0xD3F9C66B, 0xA4B2AF31, 0xADBFA43F, 0xB6A8B92D, 0xBFA5B223, 0x80868309, 0x898B8807, 0x929C9515, 0x9B919E1B, 0x7C0A47A1, 0x75074CAF, 0x6E1051BD, 0x671D5AB3, 0x583E6B99, 0x51336097, 0x4A247D85, 0x4329768B, 0x34621FD1, 0x3D6F14DF, 0x267809CD, 0x2F7502C3, 0x105633E9, 0x195B38E7, 0x024C25F5, 0x0B412EFB, 0xD7618C9A, 0xDE6C8794, 0xC57B9A86, 0xCC769188, 0xF355A0A2, 0xFA58ABAC, 0xE14FB6BE, 0xE842BDB0, 0x9F09D4EA, 0x9604DFE4, 0x8D13C2F6, 0x841EC9F8, 0xBB3DF8D2, 0xB230F3DC, 0xA927EECE, 0xA02AE5C0, 0x47B13C7A, 0x4EBC3774, 0x55AB2A66, 0x5CA62168, 0x63851042, 0x6A881B4C, 0x719F065E, 0x78920D50, 0x0FD9640A, 0x06D46F04, 0x1DC37216, 0x14CE7918, 0x2BED4832, 0x22E0433C, 0x39F75E2E, 0x30FA5520, 0x9AB701EC, 0x93BA0AE2, 0x88AD17F0, 0x81A01CFE, 0xBE832DD4, 0xB78E26DA, 0xAC993BC8, 0xA59430C6, 0xD2DF599C, 0xDBD25292, 0xC0C54F80, 0xC9C8448E, 0xF6EB75A4, 0xFFE67EAA, 0xE4F163B8, 0xEDFC68B6, 0x0A67B10C, 0x036ABA02, 0x187DA710, 0x1170AC1E, 0x2E539D34, 0x275E963A, 0x3C498B28, 0x35448026, 0x420FE97C, 0x4B02E272, 0x5015FF60, 0x5918F46E, 0x663BC544, 0x6F36CE4A, 0x7421D358, 0x7D2CD856, 0xA10C7A37, 0xA8017139, 0xB3166C2B, 0xBA1B6725, 0x8538560F, 0x8C355D01, 0x97224013, 0x9E2F4B1D, 0xE9642247, 0xE0692949, 0xFB7E345B, 0xF2733F55, 0xCD500E7F, 0xC45D0571, 0xDF4A1863, 0xD647136D, 0x31DCCAD7, 0x38D1C1D9, 0x23C6DCCB, 0x2ACBD7C5, 0x15E8E6EF, 0x1CE5EDE1, 0x07F2F0F3, 0x0EFFFBFD, 0x79B492A7, 0x70B999A9, 0x6BAE84BB, 0x62A38FB5, 0x5D80BE9F, 0x548DB591, 0x4F9AA883, 0x4697A38D, }; static uint16_t ptp_mtpz_validatehandshakeresponse (PTPParams* params, unsigned char *random, unsigned char **calculatedHash) { uint16_t ret; unsigned int len; unsigned char* response = NULL; ret = ptp_mtpz_getwmdrmpdappresponse (params, &response, &len); if (ret != PTP_RC_OK) { LIBMTP_INFO ("(MTPZ) Failure - did not receive device's response.\n"); return ret; } char *reader = (char *)response; int i; if (*(reader++) != '\x02') { return -1; } if (*(reader++) != '\x02') { return -1; } // Message is always 128 bytes. reader++; if (*(reader++) != '\x80') { return -1; } char *message = (char *)malloc(128); memcpy(message, reader, 128); reader += 128; // Decrypt the hash-key-message.. char *msg_dec = (char *)malloc(128); memset(msg_dec, 0, 128); mtpz_rsa_t *rsa = mtpz_rsa_init(MTPZ_MODULUS, MTPZ_PRIVATE_KEY, MTPZ_PUBLIC_EXPONENT); if (!rsa) { LIBMTP_INFO ("(MTPZ) Failure - could not instantiate RSA object.\n"); free(message); free(msg_dec); return -1; } if (mtpz_rsa_decrypt(128, (unsigned char *)message, 128, (unsigned char *)msg_dec, rsa) == 0) { LIBMTP_INFO ("(MTPZ) Failure - could not perform RSA decryption.\n"); free(message); free(msg_dec); mtpz_rsa_free(rsa); return -1; } mtpz_rsa_free(rsa); rsa = NULL; char *state = mtpz_hash_init_state(); char *hash_key = (char *)malloc(16); char *v10 = mtpz_hash_custom6A5DC(state, msg_dec + 21, 107, 20); for (i = 0; i < 20; i++) msg_dec[i + 1] ^= v10[i]; char *v11 = mtpz_hash_custom6A5DC(state, msg_dec + 1, 20, 107); for (i = 0; i < 107; i++) msg_dec[i + 21] ^= v11[i]; memcpy(hash_key, msg_dec + 112, 16); // Encrypted message is 0x340 bytes. reader += 2; if (*(reader++) != '\x03' || *(reader++) != '\x40') { return -1; } unsigned char *act_msg = (unsigned char *)malloc(832); unsigned char *act_reader = act_msg; memcpy(act_msg, reader, 832); reader = NULL; mtpz_encryption_cipher_advanced((unsigned char *)hash_key, 16, act_msg, 832, 0); act_reader++; unsigned int certs_length = MTPZ_SWAP(*(unsigned int *)(act_reader)); act_reader += 4; act_reader += certs_length; unsigned int rand_length = MTPZ_SWAP(*(unsigned short *)(act_reader) << 16); act_reader += 2; unsigned char *rand_data = (unsigned char *)malloc(rand_length); memcpy(rand_data, act_reader, rand_length); if (memcmp(rand_data, random, 16) != 0) { free(rand_data); return -1; } free(rand_data); act_reader += rand_length; unsigned int dev_rand_length = MTPZ_SWAP(*(unsigned short *)(act_reader) << 16); act_reader += 2; act_reader += dev_rand_length; act_reader++; unsigned int sig_length = MTPZ_SWAP(*(unsigned short *)(act_reader) << 16); act_reader += 2; act_reader += sig_length; act_reader++; unsigned int machash_length = MTPZ_SWAP(*(unsigned short *)(act_reader) << 16); act_reader += 2; unsigned char *machash_data = (unsigned char *)malloc(machash_length); memcpy(machash_data, act_reader, machash_length); act_reader += machash_length; *calculatedHash = machash_data; free(message); free(msg_dec); free(state); free(v10); free(v11); free(act_msg); return ret; } static uint16_t ptp_mtpz_opensecuresyncsession (PTPParams* params, unsigned char *hash) { unsigned char mch[16]; uint32_t *hashparams = (unsigned int *)mch; unsigned int macCount = *(unsigned int *)(hash + 16); uint16_t ret; mtpz_encryption_encrypt_mac(hash, 16, (unsigned char *)(&macCount), 4, mch); ret = ptp_mtpz_wmdrmpd_enabletrustedfilesoperations(params, MTPZ_SWAP(hashparams[0]), MTPZ_SWAP(hashparams[1]), MTPZ_SWAP(hashparams[2]), MTPZ_SWAP(hashparams[3])); return ret; }; static unsigned char * ptp_mtpz_makeapplicationcertificatemessage (unsigned int *out_len, unsigned char **out_random) { *out_len = 785; unsigned char *acm = (unsigned char *)malloc(785); unsigned char *target = acm; memset(acm, 0, 785); unsigned char *random = (unsigned char *)malloc(16); int i = 0; int certsLength = 0x275; // Write the marker bytes, length of certificates, and certificates themselves. *(target++) = '\x02'; *(target++) = '\x01'; *(target++) = '\x01'; *(target++) = '\x00'; *(target++) = '\x00'; *(target++) = '\x02'; *(target++) = '\x75'; memcpy(target, MTPZ_CERTIFICATES, certsLength); target += certsLength; // Write the random bytes. *(target++) = '\x00'; *(target++) = '\x10'; srand(time(NULL)); for (i = 0; i < 16; i++) *(random + i) = (unsigned char)(rand() % 256); *out_random = random; memcpy(target, random, 16); target += 16; char *state = mtpz_hash_init_state(); char *v16 = (char *)malloc(28); memset(v16, 0, 28); char *hash = (char *)malloc(20); memset(hash, 0, 20); char *odata = (char *)malloc(128); memset(odata, 0, 128); mtpz_hash_reset_state(state); mtpz_hash_transform_hash(state, (char *)acm + 2, (target - acm - 2)); mtpz_hash_finalize_hash(state, v16 + 8); mtpz_hash_reset_state(state); mtpz_hash_transform_hash(state, v16, 28); mtpz_hash_finalize_hash(state, hash); char *v17 = mtpz_hash_custom6A5DC(state, hash, 20, 107); for (i = 0; i < 20; i++) odata[107 + i] = hash[i]; odata[106] = '\x01'; if (v17 != NULL) { for (i = 0; i < 107; i++) odata[i] ^= v17[i]; odata[0] &= 127; odata[127] = 188; } // Free up some jazz. free(state); state = NULL; free(v16); v16 = NULL; free(v17); v17 = NULL; free(hash); hash = NULL; // Take care of some RSA jazz. mtpz_rsa_t *rsa = mtpz_rsa_init(MTPZ_MODULUS, MTPZ_PRIVATE_KEY, MTPZ_PUBLIC_EXPONENT); if (!rsa) { LIBMTP_INFO("(MTPZ) Failure - could not instantiate RSA object.\n"); *out_len = 0; return NULL; } char *signature = (char *)malloc(128); memset(signature, 0, 128); mtpz_rsa_sign(128, (unsigned char *)odata, 128, (unsigned char *)signature, rsa); // Free some more things. mtpz_rsa_free(rsa); rsa = NULL; free(odata); odata = NULL; // Write the signature + bytes. *(target++) = '\x01'; *(target++) = '\x00'; *(target++) = '\x80'; memcpy(target, signature, 128); // Kill target. target = NULL; return acm; }; static unsigned char * ptp_mtpz_makeconfirmationmessage (unsigned char *hash, unsigned int *out_len) { *out_len = 20; unsigned char *message = (unsigned char *)malloc(20); message[0] = (unsigned char)0x02; message[1] = (unsigned char)0x03; message[2] = (unsigned char)0x00; message[3] = (unsigned char)0x10; unsigned char *seed = (unsigned char *)malloc(16); memset(seed, 0, 16); seed[15] = (unsigned char)(0x01); mtpz_encryption_encrypt_mac(hash, 16u, seed, 16u, message + 4); free(seed); return message; } uint16_t ptp_mtpz_handshake (PTPParams* params) { uint16_t ret = PTP_RC_OK; uint32_t size; unsigned char *hash=NULL; unsigned char *random=NULL; PTPPropertyValue propval; unsigned char* applicationCertificateMessage; unsigned char* message; /* FIXME: do other places of libmtp set it? should we set it? */ LIBMTP_INFO ("(MTPZ) Setting session initiator info.\n"); propval.str = "libmtp/Sajid Anwar - MTPZClassDriver"; ret = ptp_setdevicepropvalue(params, PTP_DPC_MTP_SessionInitiatorInfo, &propval, PTP_DTC_STR); if (ret != PTP_RC_OK) return ret; LIBMTP_INFO ("(MTPZ) Resetting handshake.\n"); ret = ptp_mtpz_resethandshake(params); if (ret != PTP_RC_OK) return ret; LIBMTP_INFO ("(MTPZ) Sending application certificate message.\n"); applicationCertificateMessage = ptp_mtpz_makeapplicationcertificatemessage(&size, &random); ret = ptp_mtpz_sendwmdrmpdapprequest (params, applicationCertificateMessage, size); free (applicationCertificateMessage); if (ret != PTP_RC_OK) return ret; LIBMTP_INFO ("(MTPZ) Getting and validating handshake response.\n"); ret = ptp_mtpz_validatehandshakeresponse(params, random, &hash); if (ret != PTP_RC_OK) goto free_random; LIBMTP_INFO ("(MTPZ) Sending confirmation message.\n"); message = ptp_mtpz_makeconfirmationmessage(hash, &size); ret = ptp_mtpz_sendwmdrmpdapprequest (params, message, size); if (ret != PTP_RC_OK) goto free_hash; free (message); LIBMTP_INFO ("(MTPZ) Opening secure sync session.\n"); ret = ptp_mtpz_opensecuresyncsession(params, hash); free_hash: free(hash); free_random: free(random); return ret; } libmtp-1.1.10/src/Makefile.am0000644000175000001440000000550012507054014012617 00000000000000lib_LTLIBRARIES = libmtp.la libmtp_la_CFLAGS = @LIBUSB_CFLAGS@ libmtp_la_SOURCES = libmtp.c unicode.c unicode.h util.c util.h playlist-spl.c \ gphoto2-endian.h _stdint.h ptp.c ptp.h libusb-glue.h \ music-players.h device-flags.h playlist-spl.h mtpz.h \ chdk_live_view.h chdk_ptp.h if MTPZ_COMPILE libmtp_la_SOURCES += mtpz.c endif if LIBUSB1_COMPILE libmtp_la_SOURCES += libusb1-glue.c endif if LIBUSB0_COMPILE libmtp_la_SOURCES += libusb-glue.c endif if LIBOPENUSB_COMPILE libmtp_la_SOURCES += libopenusb1-glue.c endif include_HEADERS=libmtp.h EXTRA_DIST=libmtp.h.in libmtp.sym ptp-pack.c # --------------------------------------------------------------------------- # Advanced information about versioning: # * "Writing shared libraries" by Mike Hearn # http://plan99.net/~mike/writing-shared-libraries.html # * libtool.info chapter "Versioning" # * libtool.info chapter "Updating library version information" # --------------------------------------------------------------------------- # Versioning: # - CURRENT (Major): Increment if the interface has changes. AGE is always # *changed* at the same time. # - AGE (Micro): Increment if any interfaces have been added; set to 0 # if any interfaces have been removed. Removal has # precedence over adding, so set to 0 if both happened. # It denotes upward compatibility. # - REVISION (Minor): Increment any time the source changes; set to # 0 if you incremented CURRENT. # # To summarize. Any interface *change* increment CURRENT. If that interface # change does not break upward compatibility (ie it is an addition), # increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed, # REVISION is set to 0, otherwise REVISION is incremented. # --------------------------------------------------------------------------- CURRENT=12 AGE=3 REVISION=0 SOVERSION=$(CURRENT):$(REVISION):$(AGE) LT_CURRENT_MINUS_AGE=`expr $(CURRENT) - $(AGE)` if COMPILE_MINGW32 W32_LIBS=-lws2_32 W32_LDFLAGS=-export-dynamic if MS_LIB_EXE noinst_DATA=libmtp.lib libmtp.def: $(srcdir)/libmtp.sym echo "LIBRARY \"@PACKAGE@\"" > libmtp.def echo "DESCRIPTION \"Media Transfer Protocol (MTP) library\"" >> libmtp.def echo "VERSION @VERSION@" >> libmtp.def echo >> libmtp.def echo "EXPORTS" >> libmtp.def cat $< >> libmtp.def libmtp.lib: libmtp.la libmtp.def lib -name:libmtp-$(LT_CURRENT_MINUS_AGE).dll -def:libmtp.def -out:$@ install-data-local: libmtp.lib libmtp.def $(INSTALL) libmtp.def $(DESTDIR)$(libdir) $(INSTALL) libmtp.lib $(DESTDIR)$(libdir) endif endif libmtp_la_LDFLAGS=@LDFLAGS@ -no-undefined -export-symbols $(srcdir)/libmtp.sym -version-info $(SOVERSION) $(W32_LDFLAGS) libmtp_la_LIBADD=$(W32_LIBS) $(LTLIBICONV) @LIBUSB_LIBS@ libmtp_la_DEPENDENCIES=$(srcdir)/libmtp.sym DISTCLEANFILES = _stdint.h gphoto2-endian.h libmtp-1.1.10/src/playlist-spl.c0000644000175000001440000006163312502500601013366 00000000000000/** * \File playlist-spl.c * * Playlist_t to Samsung (.spl) and back conversion functions. * * Copyright (C) 2008 Alistair Boyle * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include #include // mkstmp() #include #include #include #include #ifdef HAVE_SYS_UIO_H #include #endif #include #include #include "libmtp.h" #include "libusb-glue.h" #include "ptp.h" #include "unicode.h" #include "util.h" #include "playlist-spl.h" /** * Debug macro */ #define LIBMTP_PLST_DEBUG(format, args...) \ do { \ if ((LIBMTP_debug & LIBMTP_DEBUG_PLST) != 0) \ fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \ } while (0) // Internal singly linked list of strings // used to hold .spl playlist in memory typedef struct text_struct { char* text; // String struct text_struct *next; // Link to next line, NULL if end of list } text_t; /** * Forward declarations of local (static) functions. */ static text_t* read_into_spl_text_t(LIBMTP_mtpdevice_t *device, const int fd); static void write_from_spl_text_t(LIBMTP_mtpdevice_t *device, const int fd, text_t* p); static void free_spl_text_t(text_t* p); static void print_spl_text_t(text_t* p); static uint32_t trackno_spl_text_t(text_t* p); static void tracks_from_spl_text_t(text_t* p, uint32_t* tracks, LIBMTP_folder_t* folders, LIBMTP_file_t* files); static void spl_text_t_from_tracks(text_t** p, uint32_t* tracks, const uint32_t trackno, const uint32_t ver_major, const uint32_t ver_minor, char* dnse, LIBMTP_folder_t* folders, LIBMTP_file_t* files); static uint32_t discover_id_from_filepath(const char* s, LIBMTP_folder_t* folders, LIBMTP_file_t* files); // TODO add file/dir cached args static void discover_filepath_from_id(char** p, uint32_t track, LIBMTP_folder_t* folders, LIBMTP_file_t* files); static void find_folder_name(LIBMTP_folder_t* folders, uint32_t* id, char** name); static uint32_t find_folder_id(LIBMTP_folder_t* folders, uint32_t parent, char* name); static void append_text_t(text_t** t, char* s); /** * Decides if the indicated object index is an .spl playlist. * * @param oi object we are deciding on * @return 1 if this is a Samsung .spl object, 0 otherwise */ int is_spl_playlist(PTPObjectInfo *oi) { return ((oi->ObjectFormat == PTP_OFC_Undefined) || (oi->ObjectFormat == PTP_OFC_MTP_SamsungPlaylist)) && (strlen(oi->Filename) > 4) && (strcmp((oi->Filename + strlen(oi->Filename) - 4), ".spl") == 0); } #ifndef HAVE_MKSTEMP # ifdef __WIN32__ # include # define mkstemp(_pattern) _open(_mktemp(_pattern), _O_CREAT | _O_SHORT_LIVED | _O_EXCL) # else # error Missing mkstemp() function. # endif #endif /** * Take an object ID, a .spl playlist on the MTP device, * and convert it to a playlist_t object. * * @param device mtp device pointer * @param oi object we are reading * @param id .spl playlist id on MTP device * @param pl the LIBMTP_playlist_t pointer to be filled with info from id */ void spl_to_playlist_t(LIBMTP_mtpdevice_t* device, PTPObjectInfo *oi, const uint32_t id, LIBMTP_playlist_t * const pl) { // Fill in playlist metadata // Use the Filename as the playlist name, dropping the ".spl" extension pl->name = malloc(sizeof(char)*(strlen(oi->Filename) -4 +1)); memcpy(pl->name, oi->Filename, strlen(oi->Filename) -4); // Set terminating character pl->name[strlen(oi->Filename) - 4] = 0; pl->playlist_id = id; pl->parent_id = oi->ParentObject; pl->storage_id = oi->StorageID; pl->tracks = NULL; pl->no_tracks = 0; LIBMTP_PLST_DEBUG("pl->name='%s'\n", pl->name); // open a temporary file char tmpname[] = "/tmp/mtp-spl2pl-XXXXXX"; int fd = mkstemp(tmpname); if(fd < 0) { LIBMTP_ERROR("failed to make temp file for %s.spl -> %s, errno=%s\n", pl->name, tmpname, strerror(errno)); return; } // make sure the file will be deleted afterwards if(unlink(tmpname) < 0) LIBMTP_ERROR("failed to delete temp file for %s.spl -> %s, errno=%s\n", pl->name, tmpname, strerror(errno)); int ret = LIBMTP_Get_File_To_File_Descriptor(device, pl->playlist_id, fd, NULL, NULL); if( ret < 0 ) { // FIXME add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist: Could not get .spl playlist file."); close(fd); LIBMTP_INFO("FIXME closed\n"); } text_t* p = read_into_spl_text_t(device, fd); close(fd); // FIXME cache these somewhere else so we don't keep calling this! LIBMTP_folder_t *folders; LIBMTP_file_t *files; folders = LIBMTP_Get_Folder_List(device); files = LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL); // convert the playlist listing to track ids pl->no_tracks = trackno_spl_text_t(p); LIBMTP_PLST_DEBUG("%u track%s found\n", pl->no_tracks, pl->no_tracks==1?"":"s"); pl->tracks = malloc(sizeof(uint32_t)*(pl->no_tracks)); tracks_from_spl_text_t(p, pl->tracks, folders, files); free_spl_text_t(p); // debug: add a break since this is the top level function call LIBMTP_PLST_DEBUG("------------\n\n"); } /** * Push a playlist_t onto the device after converting it to a .spl format * * @param device mtp device pointer * @param pl the LIBMTP_playlist_t to convert (pl->playlist_id will be updated * with the newly created object's id) * @return 0 on success, any other value means failure. */ int playlist_t_to_spl(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t * const pl) { text_t* t; LIBMTP_folder_t *folders; LIBMTP_file_t *files; folders = LIBMTP_Get_Folder_List(device); files = LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL); char tmpname[] = "/tmp/mtp-spl2pl-XXXXXX"; // must be a var since mkstemp modifies it LIBMTP_PLST_DEBUG("pl->name='%s'\n",pl->name); // open a file descriptor int fd = mkstemp(tmpname); if(fd < 0) { LIBMTP_ERROR("failed to make temp file for %s.spl -> %s, errno=%s\n", pl->name, tmpname, strerror(errno)); return -1; } // make sure the file will be deleted afterwards if(unlink(tmpname) < 0) LIBMTP_ERROR("failed to delete temp file for %s.spl -> %s, errno=%s\n", pl->name, tmpname, strerror(errno)); // decide on which version of the .spl format to use uint32_t ver_major; uint32_t ver_minor = 0; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; if(FLAG_PLAYLIST_SPL_V2(ptp_usb)) ver_major = 2; else ver_major = 1; // FLAG_PLAYLIST_SPL_V1() LIBMTP_PLST_DEBUG("%u track%s\n", pl->no_tracks, pl->no_tracks==1?"":"s"); LIBMTP_PLST_DEBUG(".spl version %d.%02d\n", ver_major, ver_minor); // create the text for the playlist spl_text_t_from_tracks(&t, pl->tracks, pl->no_tracks, ver_major, ver_minor, NULL, folders, files); write_from_spl_text_t(device, fd, t); free_spl_text_t(t); // done with the text // create the file object for storing LIBMTP_file_t* f = malloc(sizeof(LIBMTP_file_t)); f->item_id = 0; f->parent_id = pl->parent_id; f->storage_id = pl->storage_id; f->filename = malloc(sizeof(char)*(strlen(pl->name)+5)); strcpy(f->filename, pl->name); strcat(f->filename, ".spl"); // append suffix f->filesize = lseek(fd, 0, SEEK_CUR); // file desc is currently at end of file f->filetype = LIBMTP_FILETYPE_UNKNOWN; f->next = NULL; LIBMTP_PLST_DEBUG("%s is %dB\n", f->filename, (int)f->filesize); // push the playlist to the device lseek(fd, 0, SEEK_SET); // reset file desc. to start of file int ret = LIBMTP_Send_File_From_File_Descriptor(device, fd, f, NULL, NULL); pl->playlist_id = f->item_id; free(f->filename); free(f); // release the memory when we're done with it close(fd); // debug: add a break since this is the top level function call LIBMTP_PLST_DEBUG("------------\n\n"); return ret; } /** * Update a playlist on the device. If only the playlist's name is being * changed the pl->playlist_id will likely remain the same. An updated track * list will result in the old playlist being replaced (ie: new playlist_id). * NOTE: Other playlist metadata aside from playlist name and tracks are * ignored. * * @param device mtp device pointer * @param new the LIBMTP_playlist_t to convert (pl->playlist_id will be updated * with the newly created object's id) * @return 0 on success, any other value means failure. */ int update_spl_playlist(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t * const newlist) { LIBMTP_PLST_DEBUG("pl->name='%s'\n",newlist->name); // read in the playlist of interest LIBMTP_playlist_t * old = LIBMTP_Get_Playlist(device, newlist->playlist_id); // check to see if we found it if (!old) return -1; // check if the playlists match int delta = 0; int i; if(old->no_tracks != newlist->no_tracks) delta++; for(i=0;ino_tracks && delta==0;i++) { if(old->tracks[i] != newlist->tracks[i]) delta++; } // if not, kill the playlist and replace it if(delta) { LIBMTP_PLST_DEBUG("new tracks detected:\n"); LIBMTP_PLST_DEBUG("delete old playlist and build a new one\n"); LIBMTP_PLST_DEBUG(" NOTE: new playlist_id will result!\n"); if(LIBMTP_Delete_Object(device, old->playlist_id) != 0) return -1; if(strcmp(old->name,newlist->name) == 0) LIBMTP_PLST_DEBUG("name unchanged\n"); else LIBMTP_PLST_DEBUG("name is changing too -> %s\n",newlist->name); return LIBMTP_Create_New_Playlist(device, newlist); } // update the name only if(strcmp(old->name,newlist->name) != 0) { LIBMTP_PLST_DEBUG("ONLY name is changing -> %s\n",newlist->name); LIBMTP_PLST_DEBUG("playlist_id will remain unchanged\n"); char* s = malloc(sizeof(char)*(strlen(newlist->name)+5)); strcpy(s, newlist->name); strcat(s,".spl"); // FIXME check for success int ret = LIBMTP_Set_Playlist_Name(device, newlist, s); free(s); return ret; } LIBMTP_PLST_DEBUG("no change\n"); return 0; // nothing to be done, success } /** * Load a file descriptor into a string. * * @param device a pointer to the current device. * (needed for ucs2->utf8 charset conversion) * @param fd the file descriptor to load * @return text_t* a linked list of lines of text, id is left blank, NULL if nothing read in */ static text_t* read_into_spl_text_t(LIBMTP_mtpdevice_t *device, const int fd) { // set MAXREAD to match STRING_BUFFER_LENGTH in unicode.h conversion function const size_t MAXREAD = 1024*2; char t[MAXREAD]; // upto 3 bytes per utf8 character, 2 bytes per ucs2 character, // +1 for '\0' at end of string const size_t WSIZE = MAXREAD/2*3+1; char w[WSIZE]; char* it = t; // iterator on t char* iw = w; ssize_t rdcnt; off_t offcnt; text_t* head = NULL; text_t* tail = NULL; int eof = 0; // reset file descriptor (fd) to start of file offcnt = lseek(fd, 0, SEEK_SET); while(!eof) { // find the current offset in the file // to allow us to determine how many bytes we read if we hit the EOF // where returned rdcnt=0 from read() offcnt = lseek(fd, 0, SEEK_CUR); // read to refill buffer // (there might be data left from an incomplete last string in t, // hence start filling at it) it = t; // set ptr to start of buffer rdcnt = read(fd, it, sizeof(char)*MAXREAD); if(rdcnt < 0) LIBMTP_INFO("load_spl_fd read err %s\n", strerror(errno)); else if(rdcnt == 0) { // for EOF, fix rdcnt if(it-t == MAXREAD) LIBMTP_ERROR("error -- buffer too small to read in .spl playlist entry\n"); rdcnt = lseek(fd, 0, SEEK_CUR) - offcnt; eof = 1; } LIBMTP_PLST_DEBUG("read buff= {%dB new, %dB old/left-over}%s\n",(int)rdcnt, (int)(iw-w), eof?", EOF":""); // while more input bytes char* it_end = t + rdcnt; while(it < it_end) { // copy byte, unless EOL (then replace with end-of-string \0) if(*it == '\r' || *it == '\n') *iw = '\0'; else *iw = *it; it++; iw++; // EOL -- store it if( (iw-w) >= 2 && // we must have at least two bytes *(iw-1) == '\0' && *(iw-2) == '\0' && // 0x0000 is end-of-string // but it must be aligned such that we have an {odd,even} set of // bytes since we are expecting to consume bytes two-at-a-time !((iw-w)%2) ) { // drop empty lines // ... cast as a string of 2 byte characters if(ucs2_strlen((uint16_t*)w) == 0) { iw = w; continue; } // create a new node in the list if(head == NULL) { head = malloc(sizeof(text_t)); tail = head; } else { tail->next = malloc(sizeof(text_t)); tail = tail->next; } // fill in the data for the node // ... cast as a string of 2 byte characters tail->text = utf16_to_utf8(device, (uint16_t*) w); iw = w; // start again LIBMTP_PLST_DEBUG("line: %s\n", tail->text); } // prevent buffer overflow if(iw >= w + WSIZE) { // if we ever see this error its BAD: // we are dropping all the processed bytes for this line and // proceeding on as if everything is okay, probably losing a track // from the playlist LIBMTP_ERROR("ERROR %s:%u:%s(): buffer overflow! .spl line too long @ %zuB\n", __FILE__, __LINE__, __func__, WSIZE); iw = w; // reset buffer } } // if the last thing we did was save our line, then we finished working // on the input buffer and we can start fresh // otherwise we need to save our partial work, if we're not quiting (eof). // there is nothing special we need to do, to achieve this since the // partially completed string will sit in 'w' until we return to complete // the line } // set the next pointer at the end // if there is any list if(head != NULL) tail->next = NULL; // return the head of the list (NULL if no list) return head; } /** * Write a .spl text file to a file in preparation for pushing it * to the device. * * @param fd file descriptor to write to * @param p the text to output one line per string in the linked list * @see playlist_t_to_spl() */ static void write_from_spl_text_t(LIBMTP_mtpdevice_t *device, const int fd, text_t* p) { ssize_t ret; // write out BOM for utf16/ucs2 (byte order mark) ret = write(fd,"\xff\xfe",2); while(p != NULL) { char *const t = (char*) utf8_to_utf16(device, p->text); // note: 2 bytes per ucs2 character const size_t len = ucs2_strlen((uint16_t*)t)*sizeof(uint16_t); int i; LIBMTP_PLST_DEBUG("\nutf8=%s ",p->text); for(i=0;itext);i++) LIBMTP_PLST_DEBUG("%02x ", p->text[i] & 0xff); LIBMTP_PLST_DEBUG("\n"); LIBMTP_PLST_DEBUG("ucs2="); for(i=0;i utf16 ret += write(fd, t, len); // release the converted string free(t); // check for failures if(ret < 0) LIBMTP_ERROR("write spl file failed: %s\n", strerror(errno)); else if(ret != len +2) LIBMTP_ERROR("write spl file wrong number of bytes ret=%d len=%d '%s'\n", (int)ret, (int)len, p->text); // write carriage return, line feed in ucs2 ret = write(fd, "\r\0\n\0", 4); if(ret < 0) LIBMTP_ERROR("write spl file failed: %s\n", strerror(errno)); else if(ret != 4) LIBMTP_ERROR("failed to write the correct number of bytes '\\n'!\n"); // fake out count (first time through has two extra bytes from BOM) ret = 2; // advance to the next line p = p->next; } } /** * Destroy a linked-list of strings. * * @param p the list to destroy * @see spl_to_playlist_t() * @see playlist_t_to_spl() */ static void free_spl_text_t(text_t* p) { text_t* d; while(p != NULL) { d = p; free(p->text); p = p->next; free(d); } } /** * Print a linked-list of strings to stdout. * Used to debug. * * @param p the list to print */ static void print_spl_text_t(text_t* p) { while(p != NULL) { LIBMTP_PLST_DEBUG("%s\n",p->text); p = p->next; } } /** * Count the number of tracks in this playlist. A track will be counted as * such if the line starts with a leading slash. * * @param p the text to search * @return number of tracks in the playlist * @see spl_to_playlist_t() */ static uint32_t trackno_spl_text_t(text_t* p) { uint32_t c = 0; while(p != NULL) { if(p->text[0] == '\\' ) c++; p = p->next; } return c; } /** * Find the track ids for this playlist's files. * (ie: \Music\song.mp3 -> 12345) * * @param p the text to search * @param tracks returned list of track id's for the playlist_t, must be large * enough to accomodate all the tracks as reported by * trackno_spl_text_t() * @param folders the folders list for the device * @param fiels the files list for the device * @see spl_to_playlist_t() */ static void tracks_from_spl_text_t(text_t* p, uint32_t* tracks, LIBMTP_folder_t* folders, LIBMTP_file_t* files) { uint32_t c = 0; while(p != NULL) { if(p->text[0] == '\\' ) { tracks[c] = discover_id_from_filepath(p->text, folders, files); LIBMTP_PLST_DEBUG("track %d = %s (%u)\n", c+1, p->text, tracks[c]); c++; } p = p->next; } } /** * Find the track names (including path) for this playlist's track ids. * (ie: 12345 -> \Music\song.mp3) * * @param p the text to search * @param tracks list of track id's to look up * @param folders the folders list for the device * @param fiels the files list for the device * @see playlist_t_to_spl() */ static void spl_text_t_from_tracks(text_t** p, uint32_t* tracks, const uint32_t trackno, const uint32_t ver_major, const uint32_t ver_minor, char* dnse, LIBMTP_folder_t* folders, LIBMTP_file_t* files) { // HEADER text_t* c = NULL; append_text_t(&c, "SPL PLAYLIST"); *p = c; // save the top of the list! char vs[14]; // "VERSION 2.00\0" sprintf(vs,"VERSION %d.%02d",ver_major,ver_minor); append_text_t(&c, vs); append_text_t(&c, ""); // TRACKS int i; char* f; for(i=0;inext = NULL; // debug LIBMTP_PLST_DEBUG(".spl playlist:\n"); print_spl_text_t(*p); } /** * Find the track names (including path) given a fileid * (ie: 12345 -> \Music\song.mp3) * * @param p returns the file path (ie: \Music\song.mp3), * (*p) == NULL if the look up fails * @param track track id to look up * @param folders the folders list for the device * @param files the files list for the device * @see spl_text_t_from_tracks() */ // returns p = NULL on failure, else the filepath to the track including track name, allocated as a correct length string static void discover_filepath_from_id(char** p, uint32_t track, LIBMTP_folder_t* folders, LIBMTP_file_t* files) { // fill in a string from the right side since we don't know the root till the end const int M = 1024; char w[M]; char* iw = w + M; // iterator on w // in case of failure return NULL string *p = NULL; // find the right file while(files != NULL && files->item_id != track) { files = files->next; } // if we didn't find a matching file, abort if(files == NULL) return; // stuff the filename into our string // FIXME: check for string overflow before it occurs iw = iw - (strlen(files->filename) +1); // leave room for '\0' at the end strcpy(iw,files->filename); // next follow the directories to the root // prepending folders to the path as we go uint32_t id = files->parent_id; char* f = NULL; while(id != 0) { find_folder_name(folders, &id, &f); if(f == NULL) return; // fail if the next part of the path couldn't be found iw = iw - (strlen(f) +1); // FIXME: check for string overflow before it occurs strcpy(iw, f); iw[strlen(f)] = '\\'; free(f); } // prepend a slash iw--; iw[0] = '\\'; // now allocate a string of the right length to be returned *p = strdup(iw); } /** * Find the track id given a track's name (including path) * (ie: \Music\song.mp3 -> 12345) * * @param s file path to look up (ie: \Music\song.mp3), * (*p) == NULL if the look up fails * @param folders the folders list for the device * @param files the files list for the device * @return track id, 0 means failure * @see tracks_from_spl_text_t() */ static uint32_t discover_id_from_filepath(const char* s, LIBMTP_folder_t* folders, LIBMTP_file_t* files) { // abort if this isn't a path if(s[0] != '\\') return 0; int i; uint32_t id = 0; char* sc = strdup(s); char* sci = sc +1; // iterator // skip leading slash in path // convert all \ to \0 size_t len = strlen(s); for(i=0;iparent_id == id) && (strcmp(files->filename, sci) == 0) ) { // found it! id = files->item_id; break; } files = files->next; } } else { // otherwise its part of the directory path id = find_folder_id(folders, id, sci); } // move to next folder/file sci += strlen(sci) +1; } // release our copied string free(sc); // FIXME check that we actually have a file return id; } /** * Find the folder name given the folder's id. * * @param folders the folders list for the device * @param id the folder_id to look up, returns the folder's parent folder_id * @param name returns the name of the folder or NULL on failure * @see discover_filepath_from_id() */ static void find_folder_name(LIBMTP_folder_t* folders, uint32_t* id, char** name) { // FIXME this function is exactly LIBMTP_Find_Folder LIBMTP_folder_t* f = LIBMTP_Find_Folder(folders, *id); if(f == NULL) { *name = NULL; } else { // found it! *name = strdup(f->name); *id = f->parent_id; } } /** * Find the folder id given the folder's name and parent id. * * @param folders the folders list for the device * @param parent the folder's parent's id * @param name the name of the folder * @return the folder_id or 0 on failure * @see discover_filepath_from_id() */ static uint32_t find_folder_id(LIBMTP_folder_t* folders, uint32_t parent, char* name) { if(folders == NULL) return 0; // found it! else if( (folders->parent_id == parent) && (strcmp(folders->name, name) == 0) ) return folders->folder_id; // no luck so far, search both siblings and children else { uint32_t id = 0; if(folders->sibling != NULL) id = find_folder_id(folders->sibling, parent, name); if( (id == 0) && (folders->child != NULL) ) id = find_folder_id(folders->child, parent, name); return id; } } /** * Append a string to a linked-list of strings. * * @param t the list-of-strings, returns with the added string * @param s the string to append * @see spl_text_t_from_tracks() */ static void append_text_t(text_t** t, char* s) { if(*t == NULL) { *t = malloc(sizeof(text_t)); } else { (*t)->next = malloc(sizeof(text_t)); (*t) = (*t)->next; } (*t)->text = strdup(s); } libmtp-1.1.10/src/libmtp.h0000644000175000001440000010671712604225576012252 00000000000000/** * \file libmtp.h * Interface to the Media Transfer Protocol library. * * Copyright (C) 2005-2013 Linus Walleij * Copyright (C) 2005-2008 Richard A. Low * Copyright (C) 2007 Ted Bullock * Copyright (C) 2008 Florent Mertens * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * * #include * */ #ifndef LIBMTP_H_INCLUSION_GUARD #define LIBMTP_H_INCLUSION_GUARD #define LIBMTP_VERSION 1.1.10 #define LIBMTP_VERSION_STRING "1.1.10" /* This handles MSVC pecularities */ #ifdef _MSC_VER #include #define __WIN32__ #define snprintf _snprintf #define ssize_t SSIZE_T /* * Types that do not exist in Windows * sys/types.h, but they exist in mingw32 * sys/types.h. */ typedef char int8_t; typedef unsigned char uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; #endif #include #include /* We use time_t */ #include /** * @defgroup types libmtp global type definitions * @{ */ /** * The debug flags defined here are the external flags used * by the libmtp library interface. * * Please keep this list in sync with libmtp.c. */ #define LIBMTP_DEBUG_NONE 0x00 #define LIBMTP_DEBUG_PTP 0x01 #define LIBMTP_DEBUG_PLST 0x02 #define LIBMTP_DEBUG_USB 0x04 #define LIBMTP_DEBUG_DATA 0x08 #define LIBMTP_DEBUG_ALL 0xFF /** * The filetypes defined here are the external types used * by the libmtp library interface. The types used internally * as PTP-defined enumerator types is something different. */ typedef enum { LIBMTP_FILETYPE_FOLDER, LIBMTP_FILETYPE_WAV, LIBMTP_FILETYPE_MP3, LIBMTP_FILETYPE_WMA, LIBMTP_FILETYPE_OGG, LIBMTP_FILETYPE_AUDIBLE, LIBMTP_FILETYPE_MP4, LIBMTP_FILETYPE_UNDEF_AUDIO, LIBMTP_FILETYPE_WMV, LIBMTP_FILETYPE_AVI, LIBMTP_FILETYPE_MPEG, LIBMTP_FILETYPE_ASF, LIBMTP_FILETYPE_QT, LIBMTP_FILETYPE_UNDEF_VIDEO, LIBMTP_FILETYPE_JPEG, LIBMTP_FILETYPE_JFIF, LIBMTP_FILETYPE_TIFF, LIBMTP_FILETYPE_BMP, LIBMTP_FILETYPE_GIF, LIBMTP_FILETYPE_PICT, LIBMTP_FILETYPE_PNG, LIBMTP_FILETYPE_VCALENDAR1, LIBMTP_FILETYPE_VCALENDAR2, LIBMTP_FILETYPE_VCARD2, LIBMTP_FILETYPE_VCARD3, LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, LIBMTP_FILETYPE_WINEXEC, LIBMTP_FILETYPE_TEXT, LIBMTP_FILETYPE_HTML, LIBMTP_FILETYPE_FIRMWARE, LIBMTP_FILETYPE_AAC, LIBMTP_FILETYPE_MEDIACARD, LIBMTP_FILETYPE_FLAC, LIBMTP_FILETYPE_MP2, LIBMTP_FILETYPE_M4A, LIBMTP_FILETYPE_DOC, LIBMTP_FILETYPE_XML, LIBMTP_FILETYPE_XLS, LIBMTP_FILETYPE_PPT, LIBMTP_FILETYPE_MHT, LIBMTP_FILETYPE_JP2, LIBMTP_FILETYPE_JPX, LIBMTP_FILETYPE_ALBUM, LIBMTP_FILETYPE_PLAYLIST, LIBMTP_FILETYPE_UNKNOWN } LIBMTP_filetype_t; /** * \def LIBMTP_FILETYPE_IS_AUDIO * Audio filetype test. * * For filetypes that can be either audio * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO */ #define LIBMTP_FILETYPE_IS_AUDIO(a)\ (a == LIBMTP_FILETYPE_WAV ||\ a == LIBMTP_FILETYPE_MP3 ||\ a == LIBMTP_FILETYPE_MP2 ||\ a == LIBMTP_FILETYPE_WMA ||\ a == LIBMTP_FILETYPE_OGG ||\ a == LIBMTP_FILETYPE_FLAC ||\ a == LIBMTP_FILETYPE_AAC ||\ a == LIBMTP_FILETYPE_M4A ||\ a == LIBMTP_FILETYPE_AUDIBLE ||\ a == LIBMTP_FILETYPE_UNDEF_AUDIO) /** * \def LIBMTP_FILETYPE_IS_VIDEO * Video filetype test. * * For filetypes that can be either audio * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO */ #define LIBMTP_FILETYPE_IS_VIDEO(a)\ (a == LIBMTP_FILETYPE_WMV ||\ a == LIBMTP_FILETYPE_AVI ||\ a == LIBMTP_FILETYPE_MPEG ||\ a == LIBMTP_FILETYPE_UNDEF_VIDEO) /** * \def LIBMTP_FILETYPE_IS_AUDIOVIDEO * Audio and&slash;or video filetype test. */ #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\ (a == LIBMTP_FILETYPE_MP4 ||\ a == LIBMTP_FILETYPE_ASF ||\ a == LIBMTP_FILETYPE_QT) /** * \def LIBMTP_FILETYPE_IS_TRACK * Test if filetype is a track. * Use this to determine if the File API or Track API * should be used to upload or download an object. */ #define LIBMTP_FILETYPE_IS_TRACK(a)\ (LIBMTP_FILETYPE_IS_AUDIO(a) ||\ LIBMTP_FILETYPE_IS_VIDEO(a) ||\ LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)) /** * \def LIBMTP_FILETYPE_IS_IMAGE * Image filetype test */ #define LIBMTP_FILETYPE_IS_IMAGE(a)\ (a == LIBMTP_FILETYPE_JPEG ||\ a == LIBMTP_FILETYPE_JFIF ||\ a == LIBMTP_FILETYPE_TIFF ||\ a == LIBMTP_FILETYPE_BMP ||\ a == LIBMTP_FILETYPE_GIF ||\ a == LIBMTP_FILETYPE_PICT ||\ a == LIBMTP_FILETYPE_PNG ||\ a == LIBMTP_FILETYPE_JP2 ||\ a == LIBMTP_FILETYPE_JPX ||\ a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT) /** * \def LIBMTP_FILETYPE_IS_ADDRESSBOOK * Addressbook and Business card filetype test */ #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\ (a == LIBMTP_FILETYPE_VCARD2 ||\ a == LIBMTP_FILETYPE_VCARD3) /** * \def LIBMTP_FILETYPE_IS_CALENDAR * Calendar and Appointment filetype test */ #define LIBMTP_FILETYPE_IS_CALENDAR(a)\ (a == LIBMTP_FILETYPE_VCALENDAR1 ||\ a == LIBMTP_FILETYPE_VCALENDAR2) /** * The properties defined here are the external types used * by the libmtp library interface. */ typedef enum { LIBMTP_PROPERTY_StorageID, LIBMTP_PROPERTY_ObjectFormat, LIBMTP_PROPERTY_ProtectionStatus, LIBMTP_PROPERTY_ObjectSize, LIBMTP_PROPERTY_AssociationType, LIBMTP_PROPERTY_AssociationDesc, LIBMTP_PROPERTY_ObjectFileName, LIBMTP_PROPERTY_DateCreated, LIBMTP_PROPERTY_DateModified, LIBMTP_PROPERTY_Keywords, LIBMTP_PROPERTY_ParentObject, LIBMTP_PROPERTY_AllowedFolderContents, LIBMTP_PROPERTY_Hidden, LIBMTP_PROPERTY_SystemObject, LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier, LIBMTP_PROPERTY_SyncID, LIBMTP_PROPERTY_PropertyBag, LIBMTP_PROPERTY_Name, LIBMTP_PROPERTY_CreatedBy, LIBMTP_PROPERTY_Artist, LIBMTP_PROPERTY_DateAuthored, LIBMTP_PROPERTY_Description, LIBMTP_PROPERTY_URLReference, LIBMTP_PROPERTY_LanguageLocale, LIBMTP_PROPERTY_CopyrightInformation, LIBMTP_PROPERTY_Source, LIBMTP_PROPERTY_OriginLocation, LIBMTP_PROPERTY_DateAdded, LIBMTP_PROPERTY_NonConsumable, LIBMTP_PROPERTY_CorruptOrUnplayable, LIBMTP_PROPERTY_ProducerSerialNumber, LIBMTP_PROPERTY_RepresentativeSampleFormat, LIBMTP_PROPERTY_RepresentativeSampleSize, LIBMTP_PROPERTY_RepresentativeSampleHeight, LIBMTP_PROPERTY_RepresentativeSampleWidth, LIBMTP_PROPERTY_RepresentativeSampleDuration, LIBMTP_PROPERTY_RepresentativeSampleData, LIBMTP_PROPERTY_Width, LIBMTP_PROPERTY_Height, LIBMTP_PROPERTY_Duration, LIBMTP_PROPERTY_Rating, LIBMTP_PROPERTY_Track, LIBMTP_PROPERTY_Genre, LIBMTP_PROPERTY_Credits, LIBMTP_PROPERTY_Lyrics, LIBMTP_PROPERTY_SubscriptionContentID, LIBMTP_PROPERTY_ProducedBy, LIBMTP_PROPERTY_UseCount, LIBMTP_PROPERTY_SkipCount, LIBMTP_PROPERTY_LastAccessed, LIBMTP_PROPERTY_ParentalRating, LIBMTP_PROPERTY_MetaGenre, LIBMTP_PROPERTY_Composer, LIBMTP_PROPERTY_EffectiveRating, LIBMTP_PROPERTY_Subtitle, LIBMTP_PROPERTY_OriginalReleaseDate, LIBMTP_PROPERTY_AlbumName, LIBMTP_PROPERTY_AlbumArtist, LIBMTP_PROPERTY_Mood, LIBMTP_PROPERTY_DRMStatus, LIBMTP_PROPERTY_SubDescription, LIBMTP_PROPERTY_IsCropped, LIBMTP_PROPERTY_IsColorCorrected, LIBMTP_PROPERTY_ImageBitDepth, LIBMTP_PROPERTY_Fnumber, LIBMTP_PROPERTY_ExposureTime, LIBMTP_PROPERTY_ExposureIndex, LIBMTP_PROPERTY_DisplayName, LIBMTP_PROPERTY_BodyText, LIBMTP_PROPERTY_Subject, LIBMTP_PROPERTY_Priority, LIBMTP_PROPERTY_GivenName, LIBMTP_PROPERTY_MiddleNames, LIBMTP_PROPERTY_FamilyName, LIBMTP_PROPERTY_Prefix, LIBMTP_PROPERTY_Suffix, LIBMTP_PROPERTY_PhoneticGivenName, LIBMTP_PROPERTY_PhoneticFamilyName, LIBMTP_PROPERTY_EmailPrimary, LIBMTP_PROPERTY_EmailPersonal1, LIBMTP_PROPERTY_EmailPersonal2, LIBMTP_PROPERTY_EmailBusiness1, LIBMTP_PROPERTY_EmailBusiness2, LIBMTP_PROPERTY_EmailOthers, LIBMTP_PROPERTY_PhoneNumberPrimary, LIBMTP_PROPERTY_PhoneNumberPersonal, LIBMTP_PROPERTY_PhoneNumberPersonal2, LIBMTP_PROPERTY_PhoneNumberBusiness, LIBMTP_PROPERTY_PhoneNumberBusiness2, LIBMTP_PROPERTY_PhoneNumberMobile, LIBMTP_PROPERTY_PhoneNumberMobile2, LIBMTP_PROPERTY_FaxNumberPrimary, LIBMTP_PROPERTY_FaxNumberPersonal, LIBMTP_PROPERTY_FaxNumberBusiness, LIBMTP_PROPERTY_PagerNumber, LIBMTP_PROPERTY_PhoneNumberOthers, LIBMTP_PROPERTY_PrimaryWebAddress, LIBMTP_PROPERTY_PersonalWebAddress, LIBMTP_PROPERTY_BusinessWebAddress, LIBMTP_PROPERTY_InstantMessengerAddress, LIBMTP_PROPERTY_InstantMessengerAddress2, LIBMTP_PROPERTY_InstantMessengerAddress3, LIBMTP_PROPERTY_PostalAddressPersonalFull, LIBMTP_PROPERTY_PostalAddressPersonalFullLine1, LIBMTP_PROPERTY_PostalAddressPersonalFullLine2, LIBMTP_PROPERTY_PostalAddressPersonalFullCity, LIBMTP_PROPERTY_PostalAddressPersonalFullRegion, LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode, LIBMTP_PROPERTY_PostalAddressPersonalFullCountry, LIBMTP_PROPERTY_PostalAddressBusinessFull, LIBMTP_PROPERTY_PostalAddressBusinessLine1, LIBMTP_PROPERTY_PostalAddressBusinessLine2, LIBMTP_PROPERTY_PostalAddressBusinessCity, LIBMTP_PROPERTY_PostalAddressBusinessRegion, LIBMTP_PROPERTY_PostalAddressBusinessPostalCode, LIBMTP_PROPERTY_PostalAddressBusinessCountry, LIBMTP_PROPERTY_PostalAddressOtherFull, LIBMTP_PROPERTY_PostalAddressOtherLine1, LIBMTP_PROPERTY_PostalAddressOtherLine2, LIBMTP_PROPERTY_PostalAddressOtherCity, LIBMTP_PROPERTY_PostalAddressOtherRegion, LIBMTP_PROPERTY_PostalAddressOtherPostalCode, LIBMTP_PROPERTY_PostalAddressOtherCountry, LIBMTP_PROPERTY_OrganizationName, LIBMTP_PROPERTY_PhoneticOrganizationName, LIBMTP_PROPERTY_Role, LIBMTP_PROPERTY_Birthdate, LIBMTP_PROPERTY_MessageTo, LIBMTP_PROPERTY_MessageCC, LIBMTP_PROPERTY_MessageBCC, LIBMTP_PROPERTY_MessageRead, LIBMTP_PROPERTY_MessageReceivedTime, LIBMTP_PROPERTY_MessageSender, LIBMTP_PROPERTY_ActivityBeginTime, LIBMTP_PROPERTY_ActivityEndTime, LIBMTP_PROPERTY_ActivityLocation, LIBMTP_PROPERTY_ActivityRequiredAttendees, LIBMTP_PROPERTY_ActivityOptionalAttendees, LIBMTP_PROPERTY_ActivityResources, LIBMTP_PROPERTY_ActivityAccepted, LIBMTP_PROPERTY_Owner, LIBMTP_PROPERTY_Editor, LIBMTP_PROPERTY_Webmaster, LIBMTP_PROPERTY_URLSource, LIBMTP_PROPERTY_URLDestination, LIBMTP_PROPERTY_TimeBookmark, LIBMTP_PROPERTY_ObjectBookmark, LIBMTP_PROPERTY_ByteBookmark, LIBMTP_PROPERTY_LastBuildDate, LIBMTP_PROPERTY_TimetoLive, LIBMTP_PROPERTY_MediaGUID, LIBMTP_PROPERTY_TotalBitRate, LIBMTP_PROPERTY_BitRateType, LIBMTP_PROPERTY_SampleRate, LIBMTP_PROPERTY_NumberOfChannels, LIBMTP_PROPERTY_AudioBitDepth, LIBMTP_PROPERTY_ScanDepth, LIBMTP_PROPERTY_AudioWAVECodec, LIBMTP_PROPERTY_AudioBitRate, LIBMTP_PROPERTY_VideoFourCCCodec, LIBMTP_PROPERTY_VideoBitRate, LIBMTP_PROPERTY_FramesPerThousandSeconds, LIBMTP_PROPERTY_KeyFrameDistance, LIBMTP_PROPERTY_BufferSize, LIBMTP_PROPERTY_EncodingQuality, LIBMTP_PROPERTY_EncodingProfile, LIBMTP_PROPERTY_BuyFlag, LIBMTP_PROPERTY_UNKNOWN } LIBMTP_property_t; /** * These are the data types */ typedef enum { LIBMTP_DATATYPE_INT8, LIBMTP_DATATYPE_UINT8, LIBMTP_DATATYPE_INT16, LIBMTP_DATATYPE_UINT16, LIBMTP_DATATYPE_INT32, LIBMTP_DATATYPE_UINT32, LIBMTP_DATATYPE_INT64, LIBMTP_DATATYPE_UINT64, } LIBMTP_datatype_t; /** * These are device capabilities */ typedef enum { /** * This capability tells whether you can call the funcion getting * partial objects, @see LIBMTP_GetPartialObject() */ LIBMTP_DEVICECAP_GetPartialObject, /** * This capability tells whether you can call the function sending * partial objects. @see LIBMTP_SendPartialObject() */ LIBMTP_DEVICECAP_SendPartialObject, /** * This capability tells whether you can call the functions editing * objects in-place on a device. * @see LIBMTP_BeginEditObject() * @see LIBMTP_EndEditObject() * @see LIBMTP_TruncateObject() */ LIBMTP_DEVICECAP_EditObjects, } LIBMTP_devicecap_t; /** * These are the numbered error codes. You can also * get string representations for errors. */ typedef enum { LIBMTP_ERROR_NONE, LIBMTP_ERROR_GENERAL, LIBMTP_ERROR_PTP_LAYER, LIBMTP_ERROR_USB_LAYER, LIBMTP_ERROR_MEMORY_ALLOCATION, LIBMTP_ERROR_NO_DEVICE_ATTACHED, LIBMTP_ERROR_STORAGE_FULL, LIBMTP_ERROR_CONNECTING, LIBMTP_ERROR_CANCELLED } LIBMTP_error_number_t; typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t; /**< @see LIBMTP_raw_device_struct */ typedef struct LIBMTP_error_struct LIBMTP_error_t; /**< @see LIBMTP_error_struct */ typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t; /**< @see LIBMTP_allowed_values_struct */ typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t; /** < @see LIBMTP_device_extension_struct */ typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP_mtpdevice_struct */ typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_struct */ typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_struct */ typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_playlist_struct */ typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_struct */ typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folder_t */ typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_object_t */ typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @see LIBMTP_filesample_t */ typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @see LIBMTP_devicestorage_t */ /** * The callback type definition. Notice that a progress percentage ratio * is easy to calculate by dividing sent by * total. * @param sent the number of bytes sent so far * @param total the total number of bytes to send * @param data a user-defined dereferencable pointer * @return if anything else than 0 is returned, the current transfer will be * interrupted / cancelled. */ typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, void const * const data); /** * Callback function for get by handler function * @param params the device parameters * @param priv a user-defined dereferencable pointer * @param wantlen the number of bytes wanted * @param data a buffer to write the data to * @param gotlen pointer to the number of bytes actually written * to data * @return LIBMTP_HANDLER_RETURN_OK if successful, * LIBMTP_HANDLER_RETURN_ERROR on error or * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer */ typedef uint16_t (* MTPDataGetFunc) (void* params, void* priv, uint32_t wantlen, unsigned char *data, uint32_t *gotlen); /** * Callback function for put by handler function * @param params the device parameters * @param priv a user-defined dereferencable pointer * @param sendlen the number of bytes available * @param data a buffer to read the data from * @param putlen pointer to the number of bytes actually read * from data * @return LIBMTP_HANDLER_RETURN_OK if successful, * LIBMTP_HANDLER_RETURN_ERROR on error or * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer */ typedef uint16_t (* MTPDataPutFunc) (void* params, void* priv, uint32_t sendlen, unsigned char *data, uint32_t *putlen); /** * The return codes for the get/put functions */ #define LIBMTP_HANDLER_RETURN_OK 0 #define LIBMTP_HANDLER_RETURN_ERROR 1 #define LIBMTP_HANDLER_RETURN_CANCEL 2 /** * @} * @defgroup structar libmtp data structures * @{ */ /** * A data structure to hold MTP device entries. */ struct LIBMTP_device_entry_struct { char *vendor; /**< The vendor of this device */ uint16_t vendor_id; /**< Vendor ID for this device */ char *product; /**< The product name of this device */ uint16_t product_id; /**< Product ID for this device */ uint32_t device_flags; /**< Bugs, device specifics etc */ }; /** * A data structure to hold a raw MTP device connected * to the bus. */ struct LIBMTP_raw_device_struct { LIBMTP_device_entry_t device_entry; /**< The device entry for this raw device */ uint32_t bus_location; /**< Location of the bus, if device available */ uint8_t devnum; /**< Device number on the bus, if device available */ }; /** * A data structure to hold errors from the library. */ struct LIBMTP_error_struct { LIBMTP_error_number_t errornumber; char *error_text; LIBMTP_error_t *next; }; /** * A data structure to hold allowed ranges of values */ struct LIBMTP_allowed_values_struct { uint8_t u8max; uint8_t u8min; uint8_t u8step; uint8_t* u8vals; int8_t i8max; int8_t i8min; int8_t i8step; int8_t* i8vals; uint16_t u16max; uint16_t u16min; uint16_t u16step; uint16_t* u16vals; int16_t i16max; int16_t i16min; int16_t i16step; int16_t* i16vals; uint32_t u32max; uint32_t u32min; uint32_t u32step; uint32_t* u32vals; int32_t i32max; int32_t i32min; int32_t i32step; int32_t* i32vals; uint64_t u64max; uint64_t u64min; uint64_t u64step; uint64_t* u64vals; int64_t i64max; int64_t i64min; int64_t i64step; int64_t* i64vals; /** * Number of entries in the vals array */ uint16_t num_entries; /** * The datatype specifying which of the above is used */ LIBMTP_datatype_t datatype; /** * Non zero for range, 0 for enum */ int is_range; }; /** * MTP device extension holder struct */ struct LIBMTP_device_extension_struct { /** * Name of extension e.g. "foo.com" */ char *name; /** * Major revision of extension */ int major; /** * Minor revision of extension */ int minor; /** * Pointer to the next extension or NULL if this is the * last extension. */ LIBMTP_device_extension_t *next; }; /** * Main MTP device object struct */ struct LIBMTP_mtpdevice_struct { /** * Object bitsize, typically 32 or 64. */ uint8_t object_bitsize; /** * Parameters for this device, must be cast into * \c (PTPParams*) before internal use. */ void *params; /** * USB device for this device, must be cast into * \c (PTP_USB*) before internal use. */ void *usbinfo; /** * The storage for this device, do not use strings in here without * copying them first, and beware that this list may be rebuilt at * any time. * @see LIBMTP_Get_Storage() */ LIBMTP_devicestorage_t *storage; /** * The error stack. This shall be handled using the error getting * and clearing functions, not by dereferencing this list. */ LIBMTP_error_t *errorstack; /** The maximum battery level for this device */ uint8_t maximum_battery_level; /** Default music folder */ uint32_t default_music_folder; /** Default playlist folder */ uint32_t default_playlist_folder; /** Default picture folder */ uint32_t default_picture_folder; /** Default video folder */ uint32_t default_video_folder; /** Default organizer folder */ uint32_t default_organizer_folder; /** Default ZENcast folder (only Creative devices...) */ uint32_t default_zencast_folder; /** Default Album folder */ uint32_t default_album_folder; /** Default Text folder */ uint32_t default_text_folder; /** Per device iconv() converters, only used internally */ void *cd; /** Extension list */ LIBMTP_device_extension_t *extensions; /** Whether the device uses caching, only used internally */ int cached; /** Pointer to next device in linked list; NULL if this is the last device */ LIBMTP_mtpdevice_t *next; }; /** * MTP file struct */ struct LIBMTP_file_struct { uint32_t item_id; /**< Unique item ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this file */ char *filename; /**< Filename of this file */ uint64_t filesize; /**< Size of file in bytes */ time_t modificationdate; /**< Date of last alteration of the file */ LIBMTP_filetype_t filetype; /**< Filetype used for the current file */ LIBMTP_file_t *next; /**< Next file in list or NULL if last file */ }; /** * MTP track struct */ struct LIBMTP_track_struct { uint32_t item_id; /**< Unique item ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this track */ char *title; /**< Track title */ char *artist; /**< Name of recording artist */ char *composer; /**< Name of recording composer */ char *genre; /**< Genre name for track */ char *album; /**< Album name for track */ char *date; /**< Date of original recording as a string */ char *filename; /**< Original filename of this track */ uint16_t tracknumber; /**< Track number (in sequence on recording) */ uint32_t duration; /**< Duration in milliseconds */ uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0xbb80 */ uint16_t nochannels; /**< Number of channels in this recording 0 = unknown, 1 or 2 */ uint32_t wavecodec; /**< FourCC wave codec name */ uint32_t bitrate; /**< (Average) bitrate for this file min=1 max=0x16e360 */ uint16_t bitratetype; /**< 0 = unused, 1 = constant, 2 = VBR, 3 = free */ uint16_t rating; /**< User rating 0-100 (0x00-0x64) */ uint32_t usecount; /**< Number of times used/played */ uint64_t filesize; /**< Size of track file in bytes */ time_t modificationdate; /**< Date of last alteration of the track */ LIBMTP_filetype_t filetype; /**< Filetype used for the current track */ LIBMTP_track_t *next; /**< Next track in list or NULL if last track */ }; /** * MTP Playlist structure */ struct LIBMTP_playlist_struct { uint32_t playlist_id; /**< Unique playlist ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this playlist */ char *name; /**< Name of playlist */ uint32_t *tracks; /**< The tracks in this playlist */ uint32_t no_tracks; /**< The number of tracks in this playlist */ LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */ }; /** * MTP Album structure */ struct LIBMTP_album_struct { uint32_t album_id; /**< Unique playlist ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this album */ char *name; /**< Name of album */ char *artist; /**< Name of album artist */ char *composer; /**< Name of recording composer */ char *genre; /**< Genre of album */ uint32_t *tracks; /**< The tracks in this album */ uint32_t no_tracks; /**< The number of tracks in this album */ LIBMTP_album_t *next; /**< Next album or NULL if last album */ }; /** * MTP Folder structure */ struct LIBMTP_folder_struct { uint32_t folder_id; /**< Unique folder ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this folder */ char *name; /**< Name of folder */ LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no more */ LIBMTP_folder_t *child; /**< Child folder or NULL if no children */ }; /** * LIBMTP Object RepresentativeSampleData Structure */ struct LIBMTP_filesampledata_struct { uint32_t width; /**< Width of sample if it is an image */ uint32_t height; /**< Height of sample if it is an image */ uint32_t duration; /**< Duration in milliseconds if it is audio */ LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ uint64_t size; /**< Size of sample data in bytes */ char *data; /**< Sample data */ }; /** * LIBMTP Device Storage structure */ struct LIBMTP_devicestorage_struct { uint32_t id; /**< Unique ID for this storage */ uint16_t StorageType; /**< Storage type */ uint16_t FilesystemType; /**< Filesystem type */ uint16_t AccessCapability; /**< Access capability */ uint64_t MaxCapacity; /**< Maximum capability */ uint64_t FreeSpaceInBytes; /**< Free space in bytes */ uint64_t FreeSpaceInObjects; /**< Free space in objects */ char *StorageDescription; /**< A brief description of this storage */ char *VolumeIdentifier; /**< A volume identifier */ LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until NULL */ LIBMTP_devicestorage_t *prev; /**< Previous storage */ }; /** * LIBMTP Event structure * TODO: add all externally visible events here */ enum LIBMTP_event_enum { LIBMTP_EVENT_NONE, LIBMTP_EVENT_STORE_ADDED, LIBMTP_EVENT_STORE_REMOVED, LIBMTP_EVENT_OBJECT_ADDED, LIBMTP_EVENT_OBJECT_REMOVED, }; typedef enum LIBMTP_event_enum LIBMTP_event_t; /** @} */ /* Make functions available for C++ */ #ifdef __cplusplus extern "C" { #endif extern int LIBMTP_debug; /** * @defgroup internals The libmtp internals API. * @{ */ void LIBMTP_Set_Debug(int); void LIBMTP_Init(void); int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); /** * @} * @defgroup basic The basic device management API. * @{ */ LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *); int LIBMTP_Check_Specific_Device(int busno, int devno); LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *); LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *); /* Begin old, legacy interface */ LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); /* End old, legacy interface */ void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, uint8_t * const, uint8_t * const); int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); int LIBMTP_Check_Capability(LIBMTP_mtpdevice_t *, LIBMTP_devicecap_t); LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); /** * Get/set arbitrary properties. These do not update the cache; should only be used on * properties not stored in structs */ char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const); uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint64_t const); uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint32_t const); uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint16_t const); uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint8_t const); int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, char const * const); int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint32_t const); int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint16_t const); int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint8_t const); char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty); int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, LIBMTP_filetype_t const); int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, LIBMTP_filetype_t const, LIBMTP_allowed_values_t*); void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*); /** * @} * @defgroup files The file management API. * @{ */ LIBMTP_file_t *LIBMTP_new_file_t(void); void LIBMTP_destroy_file_t(LIBMTP_file_t*); char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t); LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *); LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *, LIBMTP_progressfunc_t const, void const * const); LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *, uint32_t const, uint32_t const); LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const, LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *, LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, LIBMTP_file_t *, const char *); LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, LIBMTP_filetype_t const, LIBMTP_filesampledata_t **); int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_filesampledata_t *); int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_filesampledata_t *); int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const, unsigned char **data, unsigned int *size); /** * @} * @defgroup tracks The track management API. * @{ */ LIBMTP_track_t *LIBMTP_new_track_t(void); void LIBMTP_destroy_track_t(LIBMTP_track_t*); LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*); LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*, LIBMTP_progressfunc_t const, void const * const); LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const, LIBMTP_progressfunc_t const, void const * const); LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const); int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *, char const * const, LIBMTP_track_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, LIBMTP_track_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *, LIBMTP_track_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *, LIBMTP_track_t const * const); int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *); /** @} */ /** * @} * @defgroup folders The folder management API. * @{ */ LIBMTP_folder_t *LIBMTP_new_folder_t(void); void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const); LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *); /** @} */ /** * @} * @defgroup playlists The audio/video playlist management API. * @{ */ LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *); /** * @} * @defgroup albums The audio/video album management API. * @{ */ LIBMTP_album_t *LIBMTP_new_album_t(void); void LIBMTP_destroy_album_t(LIBMTP_album_t *); LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const); LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); /** * @} * @defgroup objects The object management API. * @{ */ int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, uint32_t, unsigned char **, unsigned int *); int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, unsigned char *, unsigned int); int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t); /** * @} * @defgroup files The events API. * @{ */ int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); /** @} */ /* End of C++ exports */ #ifdef __cplusplus } #endif #endif /* LIBMTP_H_INCLUSION_GUARD */ libmtp-1.1.10/src/music-players.h0000644000175000001440000040666512604207031013547 00000000000000/** * \file music-players.h * List of music players as USB ids. * * Copyright (C) 2005-2007 Richard A. Low * Copyright (C) 2005-2013 Linus Walleij * Copyright (C) 2006-2007,2015 Marcus Meissner * Copyright (C) 2007 Ted Bullock * Copyright (C) 2012 Sony Mobile Communications AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * This file is supposed to be included within a struct from both libmtp * and libgphoto2. * * Information can be harvested from Windows driver .INF files, see: * http://msdn.microsoft.com/en-us/library/aa973606.aspx */ /* * MTP device list, trying real bad to get all devices into * this list by stealing from everyone I know. * Some devices taken from the Rockbox device listing: * http://www.rockbox.org/twiki/bin/view/Main/DeviceDetection */ /* * Creative Technology and ZiiLABS * Initially the Creative devices was all we supported so these are * the most thoroughly tested devices. Presumably only the devices * with older firmware (the ones that have 32bit object size) will * need the DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL flag. This bug * manifest itself when you have a lot of folders on the device, * some of the folders will start to disappear when getting all objects * and properties. */ { "Creative", 0x041e, "ZEN Vision", 0x411f, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "Portable Media Center", 0x4123, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Xtra (MTP mode)", 0x4128, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Dell", 0x041e, "DJ (2nd generation)", 0x412f, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Micro (MTP mode)", 0x4130, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Touch (MTP mode)", 0x4131, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Dell", 0x041e, "Dell Pocket DJ (MTP mode)", 0x4132, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN MicroPhoto (alternate version)", 0x4133, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Sleek (MTP mode)", 0x4137, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN MicroPhoto", 0x413c, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Sleek Photo", 0x413d, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Vision:M", 0x413e, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by marazm@o2.pl { "Creative", 0x041e, "ZEN V", 0x4150, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by danielw@iinet.net.au // This version of the Vision:M needs the no release interface flag, // unclear whether the other version above need it too or not. { "Creative", 0x041e, "ZEN Vision:M (DVP-HD0004)", 0x4151, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by Darel on the XNJB forums { "Creative", 0x041e, "ZEN V Plus", 0x4152, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Creative", 0x041e, "ZEN Vision W", 0x4153, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Don't add 0x4155: this is a Zen Stone device which is not MTP // Reported by Paul Kurczaba { "Creative", 0x041e, "ZEN", 0x4157, DEVICE_FLAG_IGNORE_HEADER_ERRORS | DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by Ringofan { "Creative", 0x041e, "ZEN V 2GB", 0x4158, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by j norment { "Creative", 0x041e, "ZEN Mozaic", 0x4161, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by Aaron F. Gonzalez { "Creative", 0x041e, "ZEN X-Fi", 0x4162, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by farmerstimuli { "Creative", 0x041e, "ZEN X-Fi 3", 0x4169, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by Todor Gyumyushev { "ZiiLABS", 0x041e, "Zii EGG", 0x6000, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, /* * Samsung * We suspect that more of these are dual mode. * We suspect more of these might need DEVICE_FLAG_NO_ZERO_READS * We suspect more of these might need DEVICE_FLAG_PLAYLIST_SPL_V1 * or DEVICE_FLAG_PLAYLIST_SPL_V2 to get playlists working. * YP-NEU, YP-NDU, YP-20, YP-800, YP-MF Series, YP-100, YP-30 * YP-700 and YP-90 are NOT MTP, but use a Samsung custom protocol. * See: http://wiki.xiph.org/index.php/PortablePlayers for Ogg * status. */ // From anonymous SourceForge user, not verified { "Samsung", 0x04e8, "YP-900", 0x0409, DEVICE_FLAG_NONE }, // From MItch { "Samsung", 0x04e8, "I550W Phone", 0x04a4, DEVICE_FLAG_NONE }, // From Manfred Enning { "Samsung", 0x04e8, "Jet S8000", 0x4f1f, DEVICE_FLAG_NONE }, // From Gabriel Nunes { "Samsung", 0x04e8, "YH-920 (501d)", 0x501d, DEVICE_FLAG_UNLOAD_DRIVER }, // From Soren O'Neill { "Samsung", 0x04e8, "YH-920 (5022)", 0x5022, DEVICE_FLAG_UNLOAD_DRIVER }, // Contributed by aronvanammers on SourceForge { "Samsung", 0x04e8, "YH-925GS", 0x5024, DEVICE_FLAG_NONE }, // From libgphoto2, according to tests by Stephan Fabel it cannot // get all objects with the getobjectproplist command.. { "Samsung", 0x04e8, "YH-820", 0x502e, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Contributed by polux2001@users.sourceforge.net { "Samsung", 0x04e8, "YH-925(-GS)", 0x502f, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Contributed by anonymous person on SourceForge { "Samsung", 0x04e8, "YH-J70J", 0x5033, DEVICE_FLAG_UNLOAD_DRIVER }, // From XNJB user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-Z5", 0x503c, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // Don't add 0x5041 as this is YP-Z5 in USB mode // Contributed by anonymous person on SourceForge { "Samsung", 0x04e8, "YP-T7J", 0x5047, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by cstrickler@gmail.com { "Samsung", 0x04e8, "YP-U2J (YP-U2JXB/XAA)", 0x5054, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by Andrew Benson { "Samsung", 0x04e8, "YP-F2J", 0x5057, DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by Patrick // Just guessing but looks like .spl v1 http://www.anythingbutipod.com/forum/showthread.php?t=14160 { "Samsung", 0x04e8, "YP-K5", 0x505a, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From dev.local@gmail.com - 0x4e8/0x507c is the UMS mode, apparently // do not add that device. // From m.eik michalke // This device does NOT use the special SPL playlist according to sypqgjxu@gmx.de. { "Samsung", 0x04e8, "YP-U3", 0x507d, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by Matthew Wilcox // Sergio reports this device need the BROKEN ALL flag. // Guessing on .spl flag { "Samsung", 0x04e8, "YP-T9", 0x507f, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Paul Clinch // Just guessing but looks like .spl v1 http://www.anythingbutipod.com/forum/showthread.php?t=14160 // Some versions of the firmware reportedly support OGG, reportedly only the // UMS versions, so MTP+OGG is not possible on this device. { "Samsung", 0x04e8, "YP-K3", 0x5081, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From XNJB user // From Alistair Boyle, .spl v2 required for playlists // According to the device log it properly supports OGG { "Samsung", 0x04e8, "YP-P2", 0x5083, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_PLAYLIST_SPL_V2 }, // From Paul Clinch // Guessing on .spl flag { "Samsung", 0x04e8, "YP-T10", 0x508a, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_NO_ZERO_READS }, // From Wim Verwimp // Not sure about the Ogg and broken proplist flags here. Just guessing. // Guessing on .spl flag { "Samsung", 0x04e8, "YP-S5", 0x508b, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Ludovic Danigo // Guessing on .spl flag { "Samsung", 0x04e8, "YP-S3", 0x5091, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Adrian Levi // Guessing on .spl flag // This one supports OGG properly through the correct MTP type. { "Samsung", 0x04e8, "YP-U4", 0x5093, DEVICE_FLAG_UNLOAD_DRIVER }, // From Chris Le Sueur // Guessing on .spl flag // This one supports OGG properly through the correct MTP type. { "Samsung", 0x04e8, "YP-R1", 0x510f, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_UNIQUE_FILENAMES | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // From Anonymous SourceForge user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-Q1", 0x5115, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Holger { "Samsung", 0x04e8, "YP-M1", 0x5118, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_PLAYLIST_SPL_V2 }, // From Anonymous SourceForge user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-P3", 0x511a, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Anonymous SourceForge user // Guessing on .spl flag { "Samsung", 0x04e8, "YP-Q2", 0x511d, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Marco Pizzocaro // Guessing on .spl flag { "Samsung", 0x04e8, "YP-U5", 0x5121, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_UNIQUE_FILENAMES | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // From Leonardo Accorsi // Guessing on .spl flag { "Samsung", 0x04e8, "YP-R0", 0x5125, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_UNIQUE_FILENAMES | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // The "YP-R2" (0x04e8/0x512d) is NOT MTP, it is UMS only. // Guessing on device flags for the MTP mode... { "Samsung", 0x04e8, "YP-R2", 0x512e, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_UNIQUE_FILENAMES | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From Manuel Carro // Copied from Q2 { "Samsung", 0x04e8, "YP-Q3", 0x5130, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // Reported by: traaf // Guessing on the playlist type! // Appears to present itself properly as a PTP device with MTP extensions! { "Samsung", 0x04e8, "YP-Z3", 0x5137, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // YP-F3 is NOT MTP - USB mass storage // From a rouge .INF file // this device ID seems to have been recycled for: // the Samsung SGH-A707 Cingular cellphone // the Samsung L760-V cellphone // the Samsung SGH-U900 cellphone // the Samsung Fascinate player { "Samsung", 0x04e8, "YH-999 Portable Media Center/SGH-A707/SGH-L760V/SGH-U900/Verizon Intensity/Fascinate", 0x5a0f, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // From Santi Béjar - not sure this is MTP... // { "Samsung", 0x04e8, "Z170 Mobile Phone", 0x6601, DEVICE_FLAG_UNLOAD_DRIVER }, // From Santi Béjar - not sure this is MTP... // { "Samsung", 0x04e8, "E250 Mobile Phone", 0x663e, DEVICE_FLAG_UNLOAD_DRIVER }, // From an anonymous SF user { "Samsung", 0x04e8, "M7600 Beat/GT-S8300T/SGH-F490/S8300", 0x6642, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_BATTERY_LEVEL }, // From Lionel Bouton { "Samsung", 0x04e8, "X830 Mobile Phone", 0x6702, DEVICE_FLAG_UNLOAD_DRIVER }, // From James { "Samsung", 0x04e8, "U600 Mobile Phone", 0x6709, DEVICE_FLAG_UNLOAD_DRIVER }, // From Cesar Cardoso // No confirmation that this is really MTP. { "Samsung", 0x04e8, "F250 Mobile Phone", 0x6727, DEVICE_FLAG_UNLOAD_DRIVER }, // From Charlie Todd 2007-10-31 { "Samsung", 0x04e8, "Juke (SCH-U470)", 0x6734, DEVICE_FLAG_UNLOAD_DRIVER}, // Reported by Tenn { "Samsung", 0x04e8, "GT-B2700", 0x6752, DEVICE_FLAG_UNLOAD_DRIVER }, // Added by Greg Fitzgerald { "Samsung", 0x04e8, "SAMSUNG Trance", 0x6763, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From anonymous sourceforge user // Guessing on .spl flag, maybe needs NO_ZERO_READS, whatdoIknow { "Samsung", 0x04e8, "GT-S8500", 0x6819, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_PLAYLIST_SPL_V1 }, /* * These entries seems to be used on a *lot* of Samsung * Android phones. It is *not* the Android MTP stack but an internal * Samsung stack. The devices present a few different product IDs * depending on mode: * * 0x685b - UMS * 0x685c - MTP + ADB * 0x685e - UMS + CDC (not MTP) * 0x6860 - MTP mode (default) * 0x6863 - USB CDC RNDIS (not MTP) * 0x6865 - PTP mode (not MTP) * 0x6877 - Kies mode? Does it have MTP? * * Used on these samsung devices: * GT P7310/P7510/N7000/I9100/I9250/I9300 * Galaxy Nexus * Galaxy Tab 7.7/10.1 * Galaxy S GT-I9000 * Galaxy S Advance GT-I9070 * Galaxy S2 * Galaxy S3 * Galaxy Note * Gakaxy Xcover * Galaxy Y * * - It seems that some PTP commands are broken. * - Devices seem to have a connection timeout, the session must be * open in about 3 seconds since the device is plugged in, after * that time it will not respond. Thus GUI programs work fine. * - Seems also to be used with Galaxy Nexus debug mode and on * US markets for some weird reason. * * From: Ignacio Martínez and others * From Harrison Metzger */ { "Samsung", 0x04e8, "Galaxy models (MTP+ADB)", 0x685c, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_LONG_TIMEOUT | DEVICE_FLAG_PROPLIST_OVERRIDES_OI | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, { "Samsung", 0x04e8, "Galaxy models (MTP)", 0x6860, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_LONG_TIMEOUT | DEVICE_FLAG_PROPLIST_OVERRIDES_OI | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // From: Erik Berglund // Logs indicate this needs DEVICE_FLAG_NO_ZERO_READS // No Samsung platlists on this device. // https://sourceforge.net/tracker/?func=detail&atid=809061&aid=3026337&group_id=158745 // i5800 duplicate reported by igel // Guessing this has the same problematic MTP stack as the device // above. { "Samsung", 0x04e8, "Galaxy models Kies mode", 0x6877, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_LONG_TIMEOUT | DEVICE_FLAG_PROPLIST_OVERRIDES_OI | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // From: John Gorkos and // Akos Maroy { "Samsung", 0x04e8, "Vibrant SGH-T959/Captivate/Media player mode", 0x68a9, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // Reported by Sleep.Walker { "Samsung", 0x04e8, "GT-B2710/Xcover 271", 0x68af, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_PLAYLIST_SPL_V1 }, // From anonymous Sourceforge user { "Samsung", 0x04e8, "GT-S5230", 0xe20c, DEVICE_FLAG_NONE }, /* * Microsoft * All except the first probably need MTPZ to work */ { "Microsoft/Intel", 0x045e, "Bandon Portable Media Center", 0x00c9, DEVICE_FLAG_NONE }, // HTC Mozart is using the PID, as is Nokia Lumia 800 // May need MTPZ to work { "Microsoft", 0x045e, "Windows Phone", 0x04ec, DEVICE_FLAG_NONE }, // Reported by Tadimarri Sarath // No idea why this use an Intel PID, perhaps a leftover from // the early PMC development days when Intel and Microsoft were // partnering. { "Microsoft", 0x045e, "Windows MTP Simulator", 0x0622, DEVICE_FLAG_NONE }, // Reported by Edward Hutchins (used for Zune HDs) { "Microsoft", 0x045e, "Zune HD", 0x063e, DEVICE_FLAG_NONE }, { "Microsoft", 0x045e, "Kin 1", 0x0640, DEVICE_FLAG_NONE }, { "Microsoft/Sharp/nVidia", 0x045e, "Kin TwoM", 0x0641, DEVICE_FLAG_NONE }, // Reported by Farooq Zaman (used for all Zunes) { "Microsoft", 0x045e, "Zune", 0x0710, DEVICE_FLAG_NONE }, // Reported by Olegs Jeremejevs { "Microsoft/HTC", 0x045e, "HTC 8S", 0xf0ca, DEVICE_FLAG_NONE }, /* * JVC */ // From Mark Veinot { "JVC", 0x04f1, "Alneo XA-HD500", 0x6105, DEVICE_FLAG_NONE }, /* * Philips */ { "Philips", 0x0471, "HDD6320/00 or HDD6330/17", 0x014b, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Anonymous SourceForge user { "Philips", 0x0471, "HDD14XX,HDD1620 or HDD1630/17", 0x014c, DEVICE_FLAG_NONE }, // from discussion forum { "Philips", 0x0471, "HDD085/00 or HDD082/17", 0x014d, DEVICE_FLAG_NONE }, // from XNJB forum { "Philips", 0x0471, "GoGear SA9200", 0x014f, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // From John Coppens { "Philips", 0x0471, "SA1115/55", 0x0164, DEVICE_FLAG_NONE }, // From Gerhard Mekenkamp { "Philips", 0x0471, "GoGear Audio", 0x0165, DEVICE_FLAG_NONE }, // from David Holm { "Philips", 0x0471, "Shoqbox", 0x0172, DEVICE_FLAG_ONLY_7BIT_FILENAMES }, // from npedrosa { "Philips", 0x0471, "PSA610", 0x0181, DEVICE_FLAG_NONE }, // From libgphoto2 source { "Philips", 0x0471, "HDD6320", 0x01eb, DEVICE_FLAG_NONE }, // From Detlef Meier { "Philips", 0x0471, "GoGear SA6014/SA6015/SA6024/SA6025/SA6044/SA6045", 0x084e, DEVICE_FLAG_UNLOAD_DRIVER }, // From anonymous Sourceforge user SA5145/02 { "Philips", 0x0471, "GoGear SA5145", 0x0857, DEVICE_FLAG_UNLOAD_DRIVER }, /* https://sourceforge.net/p/libmtp/bugs/1260/ */ { "Philips", 0x0471, "i908", 0x190b, DEVICE_FLAG_UNLOAD_DRIVER }, // From a { "Philips", 0x0471, "GoGear SA6125/SA6145/SA6185", 0x2002, DEVICE_FLAG_UNLOAD_DRIVER }, // From anonymous Sourceforge user, not verified to be MTP! { "Philips", 0x0471, "GoGear SA3345", 0x2004, DEVICE_FLAG_UNLOAD_DRIVER }, // From Roberto Vidmar { "Philips", 0x0471, "SA5285", 0x2022, DEVICE_FLAG_UNLOAD_DRIVER }, // From Elie De Brauwer { "Philips", 0x0471, "GoGear ViBE SA1VBE04", 0x2075, DEVICE_FLAG_UNLOAD_DRIVER }, // From Anonymous SourceForge user { "Philips", 0x0471, "GoGear Muse", 0x2077, DEVICE_FLAG_UNLOAD_DRIVER }, // From Elie De Brauwer { "Philips", 0x0471, "GoGear ViBE SA1VBE04/08", 0x207b, DEVICE_FLAG_UNLOAD_DRIVER }, // From josmtx { "Philips", 0x0471, "GoGear Aria", 0x207c, DEVICE_FLAG_UNLOAD_DRIVER }, // From epklein { "Philips", 0x0471, "GoGear SA1VBE08KX/78", 0x208e, DEVICE_FLAG_UNLOAD_DRIVER }, // From Anonymous SourceForge User { "Philips", 0x0471, "GoGear VIBE SA2VBE[08|16]K/02", 0x20b7, DEVICE_FLAG_UNLOAD_DRIVER }, // From Anonymous SourceForge User { "Philips", 0x0471, "GoGear Ariaz", 0x20b9, DEVICE_FLAG_UNLOAD_DRIVER }, // From Anonymous SourceForge User { "Philips", 0x0471, "GoGear Vibe/02", 0x20e5, DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by Philip Rhoades { "Philips", 0x0471, "GoGear Ariaz/97", 0x2138, DEVICE_FLAG_UNLOAD_DRIVER }, /* https://sourceforge.net/p/libmtp/bugs/1186/ */ { "Philips", 0x0471, "PI3900B2/58 ", 0x2190, DEVICE_FLAG_UNLOAD_DRIVER }, // from XNJB user { "Philips", 0x0471, "PSA235", 0x7e01, DEVICE_FLAG_NONE }, /* * Acer * Reporters: * Franck VDL * Matthias Arndt * Arvin Schnell * Philippe Marzouk * nE0sIghT * Maxime de Roucy */ { "Acer", 0x0502, "Iconia TAB A500 (ID1)", 0x3325, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A500 (ID2)", 0x3341, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A501 (ID1)", 0x3344, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A501 (ID2)", 0x3345, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A100 (ID1)", 0x3348, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A100 (ID2)", 0x3349, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A101 (ID1)", 0x334a, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A700", 0x3378, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A200 (ID1)", 0x337c, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A200 (ID2)", 0x337d, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A510 (ID1)", 0x3389, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A510 (ID2)", 0x338a, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "S500 CloudMobile", 0x33aa, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "E350 Liquid Gallant Duo (ID1)", 0x33c3, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "E350 Liquid Gallant Duo (ID2)", 0x33c4, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A210", 0x33cb, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia TAB A110", 0x33d8, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Liquid Z120 MT65xx Android Phone", 0x3473, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1029/ */ { "Acer", 0x0502, "Liquid E2", 0x3514, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia A1-810", 0x353c, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Liquid Z130 MT65xx Android Phone", 0x355f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1206/ */ { "Acer", 0x0502, "Iconia A3-A11", 0x3586, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1103/ */ { "Acer", 0x0502, "Liquid E3", 0x35a8, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1147/ */ { "Acer", 0x0502, "Z150", 0x35e4, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1184/ */ { "Acer", 0x0502, "Liquid X1", 0x3609, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1298/ */ { "Acer", 0x0502, "Z160", 0x361d, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "Iconia A1-840FHD", 0x362d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1251/ */ { "Acer", 0x0502, "E39", 0x3643, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1369/ */ { "Acer", 0x0502, "liquid e700", 0x3644, DEVICE_FLAGS_ANDROID_BUGS }, { "Acer", 0x0502, "One 7", 0x3657, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/183/ */ { "Acer", 0x0502, "Z200", 0x3683, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1341/ */ { "Acer", 0x0502, "Liquid S56", 0x3725, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/188/ */ { "Acer", 0x0502, "Liquid Z220", 0x3750, DEVICE_FLAGS_ANDROID_BUGS }, /* * SanDisk * several devices (c150 for sure) are definately dual-mode and must * have the USB mass storage driver that hooks them unloaded first. * They all have problematic dual-mode making the device unload effect * uncertain on these devices. * * All older devices seem to need DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL. * Old chipsets: e200/c200 use PP5024 from Nvidia (formerly PortalPlayer). * m200 use TCC770 from Telechips. * * The newer Sansa v2 chipset, AD3525 from Austriamicrosystems (AMS) found * in e280 v2 c200 v2, Clip, Fuze etc require * DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST * and DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR to work properly. * * For more info see: http://daniel.haxx.se/sansa/v2.html */ // Reported by Brian Robison { "SanDisk", 0x0781, "Sansa m230/m240", 0x7400, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // From Rockbox device listing { "SanDisk", 0x0781, "Sansa m200-tcc (MTP mode)", 0x7401, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by tangent_@users.sourceforge.net { "SanDisk", 0x0781, "Sansa c150", 0x7410, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // From libgphoto2 source // Reported by // Reported by Mike Owen { "SanDisk", 0x0781, "Sansa e200/e250/e260/e270/e280", 0x7420, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Don't add 0x7421 as this is e280 in MSC mode // Reported by XNJB user { "SanDisk", 0x0781, "Sansa e260/e280 v2", 0x7422, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by XNJB user { "SanDisk", 0x0781, "Sansa m240/m250", 0x7430, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by Eugene Brevdo { "SanDisk", 0x0781, "Sansa Clip", 0x7432, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED}, // Reported by HackAR { "SanDisk", 0x0781, "Sansa Clip v2", 0x7434, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED}, // Reported by anonymous user at sourceforge.net { "SanDisk", 0x0781, "Sansa c240/c250", 0x7450, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by anonymous SourceForge user { "SanDisk", 0x0781, "Sansa c250 v2", 0x7452, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by Troy Curtis Jr. { "SanDisk", 0x0781, "Sansa Express", 0x7460, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by XNJB user, and Miguel de Icaza // This has no dual-mode so no need to unload any driver. // This is a Linux based device! { "SanDisk", 0x0781, "Sansa Connect", 0x7480, DEVICE_FLAG_NONE }, // Reported by anonymous SourceForge user { "SanDisk", 0x0781, "Sansa View", 0x74b0, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by Patrick // There are apparently problems with this device. { "SanDisk", 0x0781, "Sansa Fuze", 0x74c0, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Harry Phillips { "SanDisk", 0x0781, "Sansa Fuze v2", 0x74c2, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED }, // Reported by anonymous SourceForge user // Need BROKEN_SET_SAMPLE_DIMENSIONS accordning to // Michael { "SanDisk", 0x0781, "Sansa Clip+", 0x74d0, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED}, // Reported by anonymous SourceForge user { "SanDisk", 0x0781, "Sansa Fuze+", 0x74e0, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED}, // Reported by mattyj2001@users.sourceforge.net { "SanDisk", 0x0781, "Sansa Clip Zip", 0x74e4, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR | DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS | DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED}, /* * iRiver * we assume that PTP_OC_MTP_GetObjPropList is essentially * broken on all iRiver devices, meaning it simply won't return * all properties for a file when asking for metadata 0xffffffff. * Please test on your device if you believe it isn't broken! */ { "iRiver", 0x1006, "H300 Series MTP", 0x3004, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x1006, "Portable Media Center 1", 0x4002, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x1006, "Portable Media Center 2", 0x4003, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // From [st]anislav { "iRiver", 0x1042, "T7 Volcano", 0x1143, DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // From an anonymous person at SourceForge, uncertain about this one { "iRiver", 0x4102, "iFP-880", 0x1008, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // 0x4102, 0x1042 is a USB mass storage mode for E100 v2/Lplayer // From libgphoto2 source { "iRiver", 0x4102, "T10", 0x1113, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x4102, "T20 FM", 0x1114, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // This appears at the MTP-UMS site { "iRiver", 0x4102, "T20", 0x1115, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x4102, "U10", 0x1116, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x4102, "T10b", 0x1117, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x4102, "T20b", 0x1118, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, { "iRiver", 0x4102, "T30", 0x1119, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // Reported by David Wolpoff { "iRiver", 0x4102, "T10 2GB", 0x1120, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // Rough guess this is the MTP device ID... { "iRiver", 0x4102, "N12", 0x1122, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // Reported by Philip Antoniades // Newer iriver devices seem to have shaped-up firmware without any // of the annoying bugs. { "iRiver", 0x4102, "Clix2", 0x1126, DEVICE_FLAG_NONE }, // Reported by Adam Torgerson { "iRiver", 0x4102, "Clix", 0x112a, DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // Reported by Douglas Roth { "iRiver", 0x4102, "X20", 0x1132, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // Reported by Robert Ugo { "iRiver", 0x4102, "T60", 0x1134, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_IRIVER_OGG_ALZHEIMER }, // Reported by two anonymous SourceForge users // Needs the stronger OGG_IS_UNKNOWN flag to support OGG properly, // be aware of newer players that may be needing this too. { "iRiver", 0x4102, "E100", 0x1141, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by anonymous SourceForge user // Need verification of whether this firmware really need all these flags { "iRiver", 0x4102, "E100 v2/Lplayer", 0x1142, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by Richard Vennemann // In USB Mass Storage mode it is 0x4102/0x1047 // Seems to use the new shaped-up firmware. { "iRiver", 0x4102, "Spinn", 0x1147, DEVICE_FLAG_NONE }, // Reported by Tony Janssen { "iRiver", 0x4102, "E50", 0x1151, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by anonymous SourceForge user, guessing on flags { "iRiver", 0x4102, "E150", 0x1152, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by Jakub Matraszek { "iRiver", 0x4102, "T5", 0x1153, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by pyalex@users.sourceforge.net // Guessing that this needs the FLAG_NO_ZERO_READS... { "iRiver", 0x4102, "E30", 0x1167, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // Reported by Scott Call // Assume this actually supports OGG though it reports it doesn't. { "iRiver", 0x4102, "H10 20GB", 0x2101, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, { "iRiver", 0x4102, "H10 5GB", 0x2102, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, // From Rockbox device listing { "iRiver", 0x4102, "H10 5.6GB", 0x2105, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_NO_ZERO_READS | DEVICE_FLAG_OGG_IS_UNKNOWN }, /* * Dell */ { "Dell Inc", 0x413c, "DJ Itty", 0x4500, DEVICE_FLAG_NONE }, /* Reported by: JR */ { "Dell Inc", 0x413c, "Dell Streak 7", 0xb10b, DEVICE_FLAGS_ANDROID_BUGS }, { "Dell Inc", 0x413c, "Dell Venue 7 inch", 0xb11a, DEVICE_FLAGS_ANDROID_BUGS }, { "Dell Inc", 0x413c, "Dell Venue 7 inch (2nd ID)", 0xb11b, DEVICE_FLAGS_ANDROID_BUGS }, /* * Toshiba * Tentatively flagged all Toshiba devices with * DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST after one of them * showed erroneous behaviour. */ { "Toshiba", 0x0930, "Gigabeat MEGF-40", 0x0009, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, { "Toshiba", 0x0930, "Gigabeat", 0x000c, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Nicholas Tripp { "Toshiba", 0x0930, "Gigabeat P20", 0x000f, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // From libgphoto2 { "Toshiba", 0x0930, "Gigabeat S", 0x0010, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Rob Brown { "Toshiba", 0x0930, "Gigabeat P10", 0x0011, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by solanum@users.sourceforge.net { "Toshiba", 0x0930, "Gigabeat V30", 0x0014, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Michael Davis { "Toshiba", 0x0930, "Gigabeat U", 0x0016, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Devon Jacobs { "Toshiba", 0x0930, "Gigabeat MEU202", 0x0018, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Rolf { "Toshiba", 0x0930, "Gigabeat T", 0x0019, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Phil Ingram // Tentatively added - no real reports of this device ID being MTP, // reports as USB Mass Storage currently. { "Toshiba", 0x0930, "Gigabeat MEU201", 0x001a, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by anonymous SourceForge user { "Toshiba", 0x0930, "Gigabeat MET401", 0x001d, DEVICE_FLAG_NO_RELEASE_INTERFACE | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by Andree Jacobson { "Toshiba", 0x0930, "Excite AT300", 0x0963, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Nigel Cunningham // Guessing on Android bugs { "Toshiba", 0x0930, "Thrive AT100/AT105", 0x7100, DEVICE_FLAGS_ANDROID_BUGS }, /* * Archos * These devices have some dual-mode interfaces which will really * respect the driver unloading, so DEVICE_FLAG_UNLOAD_DRIVER * really work on these devices! * * Devices reported by: * Archos * Alexander Haertig * Jan Binder * gudul1@users.sourceforge.net * Etienne Chauchot * Kay McCormick * Joe Rabinoff * Jim Krehl * Adrien Guichard * Clément * Thackert * Till * Sebastien ROHAUT */ { "Archos", 0x0e79, "Gmini XS100", 0x1207, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "XS202 (MTP mode)", 0x1208, DEVICE_FLAG_NONE }, { "Archos", 0x0e79, "104 (MTP mode)", 0x120a, DEVICE_FLAG_NONE }, { "Archos", 0x0e79, "204 (MTP mode)", 0x120c, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "404 (MTP mode)", 0x1301, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "404CAM (MTP mode)", 0x1303, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "504 (MTP mode)", 0x1307, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "604 (MTP mode)", 0x1309, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "604WIFI (MTP mode)", 0x130b, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "704 mobile dvr", 0x130d, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "704TV (MTP mode)", 0x130f, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "405 (MTP mode)", 0x1311, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "605 (MTP mode)", 0x1313, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "605F (MTP mode)", 0x1315, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "705 (MTP mode)", 0x1319, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "TV+ (MTP mode)", 0x131b, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "105 (MTP mode)", 0x131d, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "405HDD (MTP mode)", 0x1321, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "5 (MTP mode 1)", 0x1331, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "5 (MTP mode 2)", 0x1333, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "7 (MTP mode)", 0x1335, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "SPOD (MTP mode)", 0x1341, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "5S IT (MTP mode)", 0x1351, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "5H IT (MTP mode)", 0x1357, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "48 (MTP mode)", 0x1421, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "Arnova Childpad", 0x1458, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "Arnova 8c G3", 0x145e, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "Arnova 10bG3 Tablet", 0x146b, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "97 Xenon", 0x149a, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "97 Titanium", 0x14ad, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "80 Titanium", 0x14bf, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 Titanium", 0x14b9, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/91/ */ { "Archos", 0x0e79, "70b Titanium", 0x14ef, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "8o G9 (MTP mode)", 0x1508, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "8o G9 Turbo (MTP mode)", 0x1509, DEVICE_FLAG_UNLOAD_DRIVER }, { "Archos", 0x0e79, "80G9", 0x1518, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 G9 (ID1)", 0x1528, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 G9 (ID2)", 0x1529, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 G9 Turbo 250 HD", 0x1538, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 G9 Turbo", 0x1539, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 XS", 0x1548, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "70it2 (ID 1)", 0x1568, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "70it2 (ID 2)", 0x1569, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "50c", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "C40", 0x31ab, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1393/ */ { "Archos", 0x0e79, "Phone", 0x31e1, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1325/ */ { "Archos", 0x0e79, "45 Neon", 0x31f3, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1352/ */ { "Archos", 0x0e79, "50 Diamond", 0x3229, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos", 0x0e79, "101 G4", 0x4002, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos (for Tesco)", 0x0e79, "Hudl (ID1)", 0x5008, DEVICE_FLAGS_ANDROID_BUGS }, { "Archos (for Tesco)", 0x0e79, "Hudl (ID2)", 0x5009, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1404/ */ { "Archos", 0x0e79, "AC40DTI", 0x5217, DEVICE_FLAGS_ANDROID_BUGS }, /* * Dunlop (OEM of EGOMAN ltd?) reported by Nanomad * This unit is falsely detected as USB mass storage in Linux * prior to kernel 2.6.19 (fixed by patch from Alan Stern) * so on older kernels special care is needed to remove the * USB mass storage driver that erroneously binds to the device * interface. * * More problematic, this manufacturer+device ID seems to be * reused in a USB Mass Storage device named "Zipy Fox 8GB", * which means libmtp may mistreat it. */ { "Dunlop", 0x10d6, "MP3 player 1GB / EGOMAN MD223AFD", 0x2200, DEVICE_FLAG_UNLOAD_DRIVER}, // Reported by Steven Black // Obviously this company goes by many names. // This device is USB 2.0 only. Broken pipe on closing. // A later report indicates that this is also used by the iRiver E200 { "Memorex or iRiver", 0x10d6, "MMP 8585/8586 or iRiver E200", 0x2300, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_NO_RELEASE_INTERFACE}, /* * Sirius */ { "Sirius", 0x18f6, "Stiletto", 0x0102, DEVICE_FLAG_NONE }, // Reported by Chris Bagwell { "Sirius", 0x18f6, "Stiletto 2", 0x0110, DEVICE_FLAG_NONE }, /* * Nokia * Please verify the low device IDs here, I suspect these might be for * things like USB storage or modem mode actually, whereas the higher * range (0x04nn) could be for MTP. Some of the devices were gathered * from the Nokia WMP drivers: * http://nds2.nokia.com/files/support/global/phones/software/ * Address was gathered from going to: * nseries.com * -> support * -> select supported device * -> PC software * -> Music software * -> Windows Media Player 10 driver */ // From: DoomHammer { "Nokia", 0x0421, "N81 Mobile Phone", 0x000a, DEVICE_FLAG_NONE }, // From an anonymous SourceForge user { "Nokia", 0x0421, "6120c Classic Mobile Phone", 0x002e, DEVICE_FLAG_NONE }, // From Stefano { "Nokia", 0x0421, "N96 Mobile Phone", 0x0039, DEVICE_FLAG_NONE }, // From Martijn van de Streek { "Nokia", 0x0421, "6500c Classic Mobile Phone", 0x003c, DEVICE_FLAG_NONE }, // From: DoomHammer { "Nokia", 0x0421, "3110c Mobile Phone", 0x005f, DEVICE_FLAG_NONE }, // From: Vasily { "Nokia", 0x0421, "3109c Mobile Phone", 0x0065, DEVICE_FLAG_NONE }, // From: { "Nokia", 0x0421, "5310 XpressMusic", 0x006c, DEVICE_FLAG_NONE }, // From: robin (AT) headbank D0Tco DOTuk { "Nokia", 0x0421, "N95 Mobile Phone 8GB", 0x006e, DEVICE_FLAG_NONE }, // From Bastien Nocera { "Nokia", 0x0421, "N82 Mobile Phone", 0x0074, DEVICE_FLAG_UNLOAD_DRIVER }, // From Martijn van de Streek { "Nokia", 0x0421, "N78 Mobile Phone", 0x0079, DEVICE_FLAG_NONE }, // From William Pettersson { "Nokia", 0x0421, "6220 Classic", 0x008d, DEVICE_FLAG_NONE }, // From kellerkev@gmail.com { "Nokia", 0x0421, "N85 Mobile Phone", 0x0092, DEVICE_FLAG_NONE }, // From Alexandre LISSY { "Nokia", 0x0421, "6210 Navigator", 0x0098, DEVICE_FLAG_NONE }, // From: danielw { "Nokia", 0x0421, "E71", 0x00e4, DEVICE_FLAG_NONE }, // From: Laurent Bigonville { "Nokia", 0x0421, "E66", 0x00e5, DEVICE_FLAG_NONE }, // From: Pier { "Nokia", 0x0421, "5320 XpressMusic", 0x00ea, DEVICE_FLAG_NONE }, // From: Gausie { "Nokia", 0x0421, "5800 XpressMusic", 0x0154, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // From: Willy Gardiol (web) // Spurious errors for getting all objects, lead me to believe // this flag atleast is needed { "Nokia", 0x0421, "5800 XpressMusic v2", 0x0155, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Yet another version... I think { "Nokia", 0x0421, "5800 XpressMusic v3", 0x0159, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // From an anonymous SourceForge user // Not verified to be MTP { "Nokia", 0x0421, "E63", 0x0179, DEVICE_FLAG_NONE }, // Reported by: max g // Reported by: oswillios { "Nokia", 0x0421, "N79", 0x0186, DEVICE_FLAG_NONE }, // From an anonymous SourceForge user { "Nokia", 0x0421, "E71x", 0x01a1, DEVICE_FLAG_NONE }, // From Ser { "Nokia", 0x0421, "E52", 0x01cf, DEVICE_FLAG_NONE }, // From Marcus Meissner { "Nokia", 0x0421, "3710", 0x01ee, DEVICE_FLAG_NONE }, // From: AxeL { "Nokia", 0x0421, "N97-1", 0x01f4, DEVICE_FLAG_NONE }, // From: FunkyPenguin { "Nokia", 0x0421, "N97", 0x01f5, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "5130 XpressMusic", 0x0209, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "E72", 0x0221, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "5530", 0x0229, DEVICE_FLAG_NONE }, /* Grzegorz Woźniak */ { "Nokia", 0x0421, "E6", 0x032f, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "N97 mini", 0x026b, DEVICE_FLAG_NONE }, // From: Anonymous SourceForge user { "Nokia", 0x0421, "X6", 0x0274, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // From: Alexander Kojevnikov { "Nokia", 0x0421, "6600i", 0x0297, DEVICE_FLAG_NONE }, // From: Karthik Paithankar { "Nokia", 0x0421, "2710", 0x02c1, DEVICE_FLAG_NONE }, // From: Mick Stephenson { "Nokia", 0x0421, "5230", 0x02e2, DEVICE_FLAG_NONE }, // From: Lan Liu at Nokia { "Nokia", 0x0421, "N8", 0x02fe, DEVICE_FLAG_NONE }, // From: Lan Liu at Nokia { "Nokia", 0x0421, "N8 (Ovi mode)", 0x0302, DEVICE_FLAG_NONE }, // From: Martijn Hoogendoorn { "Nokia", 0x0421, "E7", 0x0334, DEVICE_FLAG_NONE }, // From: Raul Metsma { "Nokia", 0x0421, "E7 (Ovi mode)", 0x0335, DEVICE_FLAG_NONE }, // Reported by Serg // Symbian phone { "Nokia", 0x0421, "C7", 0x03c1, DEVICE_FLAG_NONE }, // Reported by Anonymous SourceForge user { "Nokia", 0x0421, "C7 (ID2)", 0x03cd, DEVICE_FLAG_NONE }, // Reported by Anonymous SourceForge user { "Nokia", 0x0421, "N950", 0x03d2, DEVICE_FLAG_NONE }, // From: http://nds2.nokia.com/files/support/global/phones/software/Nokia_3250_WMP10_driver.inf { "Nokia", 0x0421, "3250 Mobile Phone", 0x0462, DEVICE_FLAG_NONE }, // From http://nds2.nokia.com/files/support/global/phones/software/Nokia_N93_WMP10_Driver.inf { "Nokia", 0x0421, "N93 Mobile Phone", 0x0478, DEVICE_FLAG_NONE }, // From: http://nds2.nokia.com/files/support/global/phones/software/Nokia_5500_Sport_WMP10_driver.inf { "Nokia", 0x0421, "5500 Sport Mobile Phone", 0x047e, DEVICE_FLAG_NONE }, // From http://nds2.nokia.com/files/support/global/phones/software/Nokia_N91_WMP10_Driver.inf { "Nokia", 0x0421, "N91 Mobile Phone", 0x0485, DEVICE_FLAG_NONE }, // From: Christian Rusa { "Nokia", 0x0421, "5700 XpressMusic Mobile Phone", 0x04b4, DEVICE_FLAG_NONE }, // From: Mitchell Hicks { "Nokia", 0x0421, "5300 Mobile Phone", 0x04ba, DEVICE_FLAG_NONE }, // https://sourceforge.net/tracker/index.php?func=detail&aid=2692473&group_id=8874&atid=358874 // From: Tiburce { "Nokia", 0x0421, "5200 Mobile Phone", 0x04be, DEVICE_FLAG_BROKEN_BATTERY_LEVEL }, // From Christian Arnold { "Nokia", 0x0421, "N73 Mobile Phone", 0x04d1, DEVICE_FLAG_UNLOAD_DRIVER }, // From Swapan { "Nokia", 0x0421, "N75 Mobile Phone", 0x04e1, DEVICE_FLAG_NONE }, // From: http://nds2.nokia.com/files/support/global/phones/software/Nokia_N93i_WMP10_driver.inf { "Nokia", 0x0421, "N93i Mobile Phone", 0x04e5, DEVICE_FLAG_NONE }, // From Anonymous Sourceforge User { "Nokia", 0x0421, "N95 Mobile Phone", 0x04ef, DEVICE_FLAG_NONE }, // From: Pat Nicholls { "Nokia", 0x0421, "N80 Internet Edition (Media Player)", 0x04f1, DEVICE_FLAG_UNLOAD_DRIVER }, // From: Maxin B. John { "Nokia", 0x0421, "N9", 0x051a, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/bugs/1308/ */ { "Nokia", 0x0421, "N300", 0x0524, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "C5-00", 0x0592, DEVICE_FLAG_NONE }, { "Nokia", 0x0421, "808 PureView", 0x05d3, DEVICE_FLAG_NONE }, // Reported by Sampo Savola // Covers Lumia 920, 820 and probably any WP8 device. { "Nokia", 0x0421, "Lumia WP8", 0x0661, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/bugs/1176/ */ { "Nokia", 0x0421, "Lumia 301", 0x0666, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/support-requests/146/ */ { "Nokia", 0x0421, "XL", 0x06e8, DEVICE_FLAG_UNLOAD_DRIVER }, /* https://sourceforge.net/p/libmtp/patches/69/ * https://sourceforge.net/p/libmtp/bugs/1285/ * ID is the same for various Lumia version. */ { "Nokia", 0x0421, "Lumia (RM-975)", 0x06fc, DEVICE_FLAG_NONE }, /* * Qualcomm * This vendor ID seems to be used a bit by others. */ // Reported by Richard Wall { "Qualcomm (for Nokia)", 0x05c6, "5530 Xpressmusic", 0x0229, DEVICE_FLAG_NONE }, // One thing stated by reporter (Nokia model) another by the detect log... { "Qualcomm (for Nokia/Verizon)", 0x05c6, "6205 Balboa/Verizon Music Phone", 0x3196, DEVICE_FLAG_NONE }, { "Qualcomm (for Gigabyte)", 0x05c6, "GSmart G1342", 0x8800, DEVICE_FLAG_NONE }, { "Qualcomm (for Smartfren)", 0x05c6, "Andromax U", 0x9025, DEVICE_FLAG_NONE }, // New Android phone of the OnePlus brand : the One model { "Qualcomm (for OnePlus)", 0x05c6, "One (MTP)", 0x6764, DEVICE_FLAGS_ANDROID_BUGS }, { "Qualcomm (for OnePlus)", 0x05c6, "One (MTP+ADB)", 0x6765, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1377/ */ { "Qualcomm (for Xolo)", 0x901b, "Xolo Black (MTP)", 0x9039, DEVICE_FLAGS_ANDROID_BUGS }, { "Qualcomm (for PhiComm)", 0x05c6, "C230w (MTP)", 0x9039, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1284/ */ { "Qualcomm (for Highscreen)", 0x05c6, "Omega Prime S", 0xf003, DEVICE_FLAGS_ANDROID_BUGS }, /* * Vendor ID 0x13d1 is some offshoring company in China, * in one source named "A-Max Technology Macao Commercial * Offshore Co. Ltd." sometime "CCTech". */ // Logik brand { "Logik", 0x13d1, "LOG DAX MP3 and DAB Player", 0x7002, DEVICE_FLAG_UNLOAD_DRIVER }, // Technika brand // Reported by { "Technika", 0x13d1, "MP-709", 0x7017, DEVICE_FLAG_UNLOAD_DRIVER }, /* * RCA / Thomson */ // From kiki { "Thomson", 0x069b, "EM28 Series", 0x0774, DEVICE_FLAG_NONE }, { "Thomson / RCA", 0x069b, "Opal / Lyra MC4002", 0x0777, DEVICE_FLAG_NONE }, { "Thomson", 0x069b, "Lyra MC5104B (M51 Series)", 0x077c, DEVICE_FLAG_NONE }, { "Thomson", 0x069b, "RCA H106", 0x301a, DEVICE_FLAG_UNLOAD_DRIVER }, // From Svenna // Not confirmed to be MTP. { "Thomson", 0x069b, "scenium E308", 0x3028, DEVICE_FLAG_NONE }, // From XNJB user { "Thomson / RCA", 0x069b, "Lyra HC308A", 0x3035, DEVICE_FLAG_NONE }, /* * Fujitsu devices */ { "Fujitsu, Ltd", 0x04c5, "F903iX HIGH-SPEED", 0x1140, DEVICE_FLAG_NONE }, // Reported by Thomas Bretthauer { "Fujitsu, Ltd", 0x04c5, "STYLISTIC M532", 0x133b, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/137/ */ { "Fujitsu, Ltd", 0x04c5, "F02-E", 0x1378, DEVICE_FLAGS_ANDROID_BUGS }, /* * Palm device userland program named Pocket Tunes * Reported by Peter Gyongyosi */ { "NormSoft, Inc.", 0x1703, "Pocket Tunes", 0x0001, DEVICE_FLAG_NONE }, // Reported by anonymous submission { "NormSoft, Inc.", 0x1703, "Pocket Tunes 4", 0x0002, DEVICE_FLAG_NONE }, /* * TrekStor, Medion and Maxfield devices * Their datasheet claims their devices are dualmode so probably needs to * unload the attached drivers here. */ // Reported by Stefan Voss // This is a Sigmatel SoC with a hard disk. { "TrekStor", 0x066f, "Vibez 8/12GB", 0x842a, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by anonymous SourceForge user. // This one done for Medion, whatever that is. Error reported so assume // the same bug flag as its ancestor above. { "Medion", 0x066f, "MD8333 (ID1)", 0x8550, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by anonymous SourceForge user { "Medion", 0x066f, "MD8333 (ID2)", 0x8588, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, /* https://sourceforge.net/p/libmtp/bugs/1359/ */ { "Verizon", 0x0408, "Ellipsis 7", 0x3899, DEVICE_FLAGS_ANDROID_BUGS }, // The vendor ID is "Quanta Computer, Inc." // same as Olivetti Olipad 110 // Guessing on device flags { "Medion", 0x0408, "MD99000 (P9514)/Olivetti Olipad 110", 0xb009, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Richard Eigenmann { "Medion", 0x0408, "Lifetab P9514", 0xb00a, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAGS_ANDROID_BUGS }, // Reported by anonymous SourceForge user { "Maxfield", 0x066f, "G-Flash NG 1GB", 0x846c, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by PaoloC // Apparently SigmaTel has an SDK for MTP players with this ID { "SigmaTel Inc.", 0x066f, "MTPMSCN Audio Player", 0xa010, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Cristi Magherusan { "TrekStor", 0x0402, "i.Beat Sweez FM", 0x0611, DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by Fox-ino // No confirmation that this is really MTP so commented it out. // { "ALi Corp.", 0x0402, "MPMAN 2GB", 0x5668, // DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by Anonymous SourceForge user {"TrekStor", 0x1e68, "i.Beat Organix 2.0", 0x0002, DEVICE_FLAG_UNLOAD_DRIVER }, /* Also Thalia Toline. https://sourceforge.net/p/libmtp/bugs/1156/ */ {"iRiver", 0x1e68, "Tolino Tab 7", 0x1002, DEVICE_FLAGS_ANDROID_BUGS }, /* * Disney/Tevion/MyMusix */ // Reported by XNJB user { "Disney", 0x0aa6, "MixMax", 0x6021, DEVICE_FLAG_NONE }, // Reported by anonymous Sourceforge user { "Tevion", 0x0aa6, "MD 81488", 0x3011, DEVICE_FLAG_NONE }, // Reported by Peter Hedlund { "MyMusix", 0x0aa6, "PD-6070", 0x9601, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST | DEVICE_FLAG_NO_RELEASE_INTERFACE }, /* * Cowon Systems, Inc. * The iAudio audiophile devices don't encourage the use of MTP. * See: http://wiki.xiph.org/index.php/PortablePlayers for Ogg * status */ // Reported by Patrik Johansson { "Cowon", 0x0e21, "iAudio U3 (MTP mode)", 0x0701, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by Kevin Michael Smith { "Cowon", 0x0e21, "iAudio 6 (MTP mode)", 0x0711, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Roberth Karman { "Cowon", 0x0e21, "iAudio 7 (MTP mode)", 0x0751, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by an anonymous SourceForge user { "Cowon", 0x0e21, "iAudio U5 (MTP mode)", 0x0761, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by TJ Something { "Cowon", 0x0e21, "iAudio D2 (MTP mode)", 0x0801, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by anonymous Sourceforge user { "Cowon", 0x0e21, "iAudio D2+ FW 2.x (MTP mode)", 0x0861, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // From Rockbox device listing { "Cowon", 0x0e21, "iAudio D2+ DAB FW 4.x (MTP mode)", 0x0871, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // From Rockbox device listing { "Cowon", 0x0e21, "iAudio D2+ FW 3.x (MTP mode)", 0x0881, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // From Rockbox device listing { "Cowon", 0x0e21, "iAudio D2+ DMB FW 1.x (MTP mode)", 0x0891, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by { "Cowon", 0x0e21, "iAudio S9 (MTP mode)", 0x0901, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by Dan Nicholson { "Cowon", 0x0e21, "iAudio 9 (MTP mode)", 0x0911, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by Franck VDL { "Cowon", 0x0e21, "iAudio J3 (MTP mode)", 0x0921, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by anonymous SourceForge user { "Cowon", 0x0e21, "iAudio X7 (MTP mode)", 0x0931, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, // Reported by anonymous SourceForge user { "Cowon", 0x0e21, "iAudio C2 (MTP mode)", 0x0941, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, { "Cowon", 0x0e21, "iAudio 10 (MTP mode)", 0x0952, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_OGG_IS_UNKNOWN | DEVICE_FLAG_FLAC_IS_UNKNOWN }, /* * Insignia, dual-mode. */ { "Insignia", 0x19ff, "NS-DV45", 0x0303, DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by Rajan Bella { "Insignia", 0x19ff, "Sport Player", 0x0307, DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by "brad" (anonymous, sourceforge) { "Insignia", 0x19ff, "Pilot 4GB", 0x0309, DEVICE_FLAG_UNLOAD_DRIVER }, /* * LG Electronics */ // Uncertain if this is really the MTP mode device ID... { "LG Electronics Inc.", 0x043e, "T54", 0x7040, DEVICE_FLAG_UNLOAD_DRIVER }, // Not verified - anonymous submission { "LG Electronics Inc.", 0x043e, "UP3", 0x70b1, DEVICE_FLAG_NONE }, // Reported by Joseph Nahmias { "LG Electronics Inc.", 0x1004, "VX8550 V CAST Mobile Phone", 0x6010, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR }, // Reported by Cyrille Potereau { "LG Electronics Inc.", 0x1004, "KC910 Renoir Mobile Phone", 0x608f, DEVICE_FLAG_UNLOAD_DRIVER }, // Reported by Aaron Slunt { "LG Electronics Inc.", 0x1004, "GR-500 Music Player", 0x611b, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR }, { "LG Electronics Inc.", 0x1004, "KM900", 0x6132, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_UNLOAD_DRIVER }, { "LG Electronics Inc.", 0x1004, "LG8575", 0x619a, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_UNLOAD_DRIVER }, /* * These two are LG Android phones: * LG-F6 * V909 G-Slate */ { "LG Electronics Inc.", 0x1004, "Android phone (ID1)", 0x61f1, DEVICE_FLAGS_ANDROID_BUGS }, { "LG Electronics Inc.", 0x1004, "Android phone (ID2)", 0x61f9, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1007/ */ { "LG Electronics Inc.", 0x1004, "LG VS980", 0x621c, DEVICE_FLAGS_ANDROID_BUGS }, { "LG Electronics Inc.", 0x1004, "LG2 Optimus", 0x6225, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1386/ */ { "LG Electronics Inc.", 0x1004, "LG VS950", 0x622a, DEVICE_FLAGS_ANDROID_BUGS }, { "LG Electronics Inc.", 0x1004, "LG VS870", 0x6239, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/992/ */ { "LG Electronics Inc.", 0x1004, "LG VS890", 0x623d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/190/ */ { "LG Electronics Inc.", 0x1004, "LG Optimus Zone 2", 0x6259, DEVICE_FLAGS_ANDROID_BUGS }, { "LG Electronics Inc.", 0x1004, "VK810", 0x6265, DEVICE_FLAGS_ANDROID_BUGS }, { "LG Electronics Inc.", 0x1004, "G3", 0x627f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/134/ */ { "LG Electronics Inc.", 0x1004, "G3 (VS985)", 0x626e, DEVICE_FLAGS_ANDROID_BUGS }, /* * This VID+PID is used by a lot of LG models: * E430 * E460 * E610 * E612 * E617G * E970 * P700 */ { "LG Electronics Inc.", 0x1004, "Various E and P models", 0x631c, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1294/ */ { "LG Electronics Inc.", 0x1004, "LG G Flex 2", 0x633e, DEVICE_FLAGS_ANDROID_BUGS }, /* * Sony * It could be that these PIDs are one-per hundred series, so * NWZ-A8xx is 0325, NWZ-S5xx is 0x326 etc. We need more devices * reported to see a pattern here. */ // Reported by Alessandro Radaelli { "Sony", 0x054c, "NWZ-A815/NWZ-A818", 0x0325, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by anonymous Sourceforge user. { "Sony", 0x054c, "NWZ-S516", 0x0326, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Endre Oma { "Sony", 0x054c, "NWZ-S615F/NWZ-S616F/NWZ-S618F", 0x0327, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Jean-Marc Bourguet { "Sony", 0x054c, "NWZ-S716F", 0x035a, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Anon SF User / Anthon van der Neut { "Sony", 0x054c, "NWZ-A826/NWZ-A828/NWZ-A829", 0x035b, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Niek Klaverstijn { "Sony", 0x054c, "NWZ-A726/NWZ-A728/NWZ-A768", 0x035c, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Mehdi AMINI { "Sony", 0x054c, "NWZ-B135", 0x036e, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by { "Sony", 0x054c, "NWZ-E436F", 0x0385, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Michael Wilkinson { "Sony", 0x054c, "NWZ-W202", 0x0388, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Ondrej Sury { "Sony", 0x054c, "NWZ-S739F", 0x038c, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Marco Filipe Nunes Soares Abrantes Pereira { "Sony", 0x054c, "NWZ-S638F", 0x038e, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Elliot { "Sony", 0x054c, "NWZ-X1050B/NWZ-X1060B", 0x0397, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Silvio J. Gutierrez { "Sony", 0x054c, "NWZ-X1051/NWZ-X1061", 0x0398, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Gregory Boddin { "Sony", 0x054c, "NWZ-B142F", 0x03d8, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Rick Warner { "Sony", 0x054c, "NWZ-E344/E345", 0x03fc, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Jonathan Stowe { "Sony", 0x054c, "NWZ-E445", 0x03fd, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Anonymous SourceForge user { "Sony", 0x054c, "NWZ-S545", 0x03fe, DEVICE_FLAGS_SONY_NWZ_BUGS }, { "Sony", 0x054c, "NWZ-A845", 0x0404, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by anonymous SourceForge user { "Sony", 0x054c, "NWZ-W252B", 0x04bb, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Suspect this device has strong DRM features // See https://answers.launchpad.net/ubuntu/+source/libmtp/+question/149587 { "Sony", 0x054c, "NWZ-B153F", 0x04be, DEVICE_FLAGS_SONY_NWZ_BUGS }, { "Sony", 0x054c, "NWZ-E354", 0x04cb, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Toni Burgarello { "Sony", 0x054c, "NWZ-S754", 0x04cc, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Hideki Yamane { "Sony", 0x054c, "Sony Tablet P1", 0x04d1, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by dmiceman { "Sony", 0x054c, "NWZ-B163F", 0x059a, DEVICE_FLAGS_SONY_NWZ_BUGS }, { "Sony", 0x054c, "NWZ-E464", 0x05a6, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Reported by Jan Rheinlaender { "Sony", 0x054c, "NWZ-S765", 0x05a8, DEVICE_FLAGS_SONY_NWZ_BUGS }, // Olivier Keshavjee { "Sony", 0x054c, "Sony Tablet S", 0x05b3, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by ghalambaz { "Sony", 0x054c, "Sony Tablet S1", 0x05b4, DEVICE_FLAGS_ANDROID_BUGS }, { "Sony", 0x054c, "NWZ-B173F", 0x0689, DEVICE_FLAGS_SONY_NWZ_BUGS }, { "Sony", 0x054c, "DCR-SR75", 0x1294, DEVICE_FLAGS_SONY_NWZ_BUGS }, /* * SonyEricsson * These initially seemed to support GetObjPropList but later revisions * of the firmware seem to have broken it, so all are flagged as broken * for now. */ // Reported by Øyvind Stegard { "SonyEricsson", 0x0fce, "K850i", 0x0075, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Michael Eriksson { "SonyEricsson", 0x0fce, "W910", 0x0076, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Zack { "SonyEricsson", 0x0fce, "W890i", 0x00b3, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by robert dot ahlskog at gmail { "SonyEricsson", 0x0fce, "W760i", 0x00c6, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Linus Ã…kesson { "SonyEricsson", 0x0fce, "C902", 0x00d4, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by an anonymous SourceForge user { "SonyEricsson", 0x0fce, "C702", 0x00d9, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Christian Zuckschwerdt { "SonyEricsson", 0x0fce, "W980", 0x00da, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by David Taylor { "SonyEricsson", 0x0fce, "C905", 0x00ef, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by David House { "SonyEricsson", 0x0fce, "W595", 0x00f3, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL | DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST }, // Reported by Mattias Evensson { "SonyEricsson", 0x0fce, "W902", 0x00f5, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Sarunas // Doesn't need any flags according to reporter { "SonyEricsson", 0x0fce, "T700", 0x00fb, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, // Reported by Stéphane Pontier { "SonyEricsson", 0x0fce, "W705/W715", 0x0105, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by HÃ¥kan Kvist { "SonyEricsson", 0x0fce, "W995", 0x0112, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by anonymous SourceForge user { "SonyEricsson", 0x0fce, "U5", 0x0133, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Flo { "SonyEricsson", 0x0fce, "U8i", 0x013a, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by xirotyu { "SonyEricsson", 0x0fce, "j10i2 (Elm)", 0x0144, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Serge Chirik { "SonyEricsson", 0x0fce, "j108i (Cedar)", 0x014e, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Jonas Nyrén { "SonyEricsson", 0x0fce, "W302", 0x10c8, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Anonymous Sourceforge user { "SonyEricsson", 0x0fce, "j10i (Elm)", 0xd144, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Thomas Schweitzer { "SonyEricsson", 0x0fce, "K550i", 0xe000, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, /* * SonyEricsson/SONY Android devices usually have three personalities due to * using composite descriptors and the fact that Windows cannot distinguish * the device unless each composite descriptor is unique. * * Legend: * MTP = Media Transfer Protocol * UMS = USB Mass Storage Protocol * ADB = Android Debug Bridge Protocol * CDC = Communications Device Class, Internet Sharing * * 0x0nnn = MTP * 0x4nnn = MTP + UMS (for CD-ROM) * 0x5nnn = MTP + ADB * 0x6nnn = UMS + ADB * 0x7nnn = MTP + CDC * 0x8nnn = MTP + CDC + ADB * 0xannn = MTP + UMS (MTP for eMMC and UMS for external SD card) * 0xbnnn = MTP + UMS + ADB * 0xennn = UMS only * * The SonyEricsson and SONY devices have (at least) two deployed MTP * stacks: Aricent and Android. These have different bug flags, and * sometimes the same device has firmware upgrades moving it from * the Aricent to Android MTP stack without changing the device * VID+PID (first observed on the SK17i Xperia Mini Pro), so the * detection has to be more elaborate. The code in libmtp.c will do * this and assign the proper bug flags (hopefully). * That is why DEVICE_FLAG_NONE is used for these devices. * * Devices reported by: * Sony Mobile Communications (via Toby Collett) * Jonas Salling * Eamonn Webster * Alejandro DC * StehpanKa * hdhoang * Paul Taylor * Bruno Basilio * Christoffer Holmstedt * equaeghe * Ondra Lengal * Michael K. * Jean-François B. * Eduard Bloch * Ah Hong * Eowyn Carter */ { "SonyEricsson", 0x0fce, "c1605 Xperia Dual E MTP", 0x0146, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "LT15i Xperia arc S MTP", 0x014f, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MT11i Xperia Neo MTP", 0x0156, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "IS12S Xperia Acro MTP", 0x0157, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MK16i Xperia MTP", 0x015a, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "R800/R88i Xperia Play MTP", 0x015d, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST18a Xperia Ray MTP", 0x0161, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP", 0x0166, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST15i Xperia Mini MTP", 0x0167, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP", 0x0168, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26i Xperia S MTP", 0x0169, DEVICE_FLAG_NO_ZERO_READS }, { "SONY", 0x0fce, "WT19i Live Walkman MTP", 0x016d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP", 0x0170, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST15i Xperia U MTP", 0x0171, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT22i Xperia P MTP", 0x0172, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "MT27i Xperia Sola MTP", 0x0173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD IS12S MTP", 0x0175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD SO-03D MTP", 0x0176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP", 0x0177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT29i Xperia GX MTP", 0x0178, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP", 0x017e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST23i Xperia Miro MTP", 0x0180, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-05D Xperia SX MTP", 0x0181, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT30p Xperia T MTP", 0x0182, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT25i Xperia V MTP", 0x0186, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia J MTP", 0x0188, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZL MTP", 0x0189, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E MTP", 0x018c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP 1", 0x018d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia L MTP", 0x0192, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z MTP", 0x0193, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP 2", 0x0194, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia SP MTP", 0x0195, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z Ultra MTP (ID2)", 0x0196, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia ZR MTP", 0x0197, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia A MTP", 0x0198, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia M MTP", 0x019b, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z Ultra MTP (ID3)", 0x019c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z1 MTP", 0x019e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia C MTP", 0x01a3, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z1 Compact D5503", 0x01a7, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 MTP", 0x01aa, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 Dual MTP", 0x01ab, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z2 MTP", 0x01af, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z2 Tablet MTP", 0x01b1, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia Z Ultra MTP", 0x01b6, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia M2 Aqua MTP", 0x01b8, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia Z3 MTP", 0x01ba, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z3 Compact MTP", 0x01bb, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E3 MTP", 0x01bc, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria M4 Aqua Dual MTP", 0x01c4, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "E2115 MTP", 0x01c5, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria Z3+ MTP", 0x01c9, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria E4g MTP", 0x01cb, DEVICE_FLAG_NONE }, /* * MTP+UMS personalities of MTP devices (see above) */ { "SonyEricsson", 0x0fce, "IS12S Xperia Acro MTP+CDROM", 0x4157, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP+CDROM", 0x4168, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26i Xperia S MTP+CDROM", 0x4169, DEVICE_FLAG_NO_ZERO_READS }, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP+CDROM", 0x4170, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST25i Xperia U MTP+CDROM", 0x4171, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT22i Xperia P MTP+CDROM", 0x4172, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "MT27i Xperia Sola MTP+CDROM", 0x4173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD IS12S MTP+CDROM", 0x4175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26w Xperia Acro HD SO-03D MTP+CDROM", 0x4176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+CDROM", 0x4177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT29i Xperia GX MTP+CDROM", 0x4178, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+CDROM", 0x417e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST23i Xperia Miro MTP+CDROM", 0x4180, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-05D Xperia SX MTP+CDROM", 0x4181, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT30p Xperia T MTP+CDROM", 0x4182, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT25i Xperia V MTP+CDROM", 0x4186, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia J MTP+CDROM", 0x4188, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZL MTP+CDROM", 0x4189, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E MTP+CDROM", 0x418c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP+CDROM 1", 0x418d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia L MTP+CDROM", 0x4192, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z MTP+CDROM", 0x4193, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP+CDROM 2", 0x4194, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia SP MTP+CDROM", 0x4195, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M MTP+CDROM", 0x419b, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z Ultra MTP+CDROM (ID3)", 0x419c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z1 MTP+CDROM", 0x419e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia C MTP+CDROM", 0x41a3, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z1 Compact D5503 MTP+CDROM", 0x41a7, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 MTP+CDROM", 0x41aa, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 Dual MTP+CDROM", 0x41ab, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z2 MTP+CDROM", 0x41af, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z2 Tablet MTP+CDROM", 0x41b1, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia Z Ultra MTP+CDROM", 0x41b6, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia M2 Aqua MTP+CDROM", 0x41b8, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia Z3 MTP+CDROM", 0x41ba, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z3 Compact MTP+CDROM", 0x41bb, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E3 MTP+CDROM", 0x41bc, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria M4 Aqua Dual MTP+CDROM", 0x41c4, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "E2115 MTP+CDROM", 0x41c5, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria Z3+ MTP+CDROM", 0x41c9, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria E4g MTP+CDROM", 0x41cb, DEVICE_FLAG_NONE }, /* * MTP+ADB personalities of MTP devices (see above) */ { "SonyEricsson", 0x0fce, "c1605 Xperia Dual E MTP+ADB", 0x5146, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "LT15i Xperia Arc MTP+ADB", 0x514f, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MT11i Xperia Neo MTP+ADB", 0x5156, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "IS12S Xperia Acro MTP+ADB", 0x5157, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "MK16i Xperia MTP+ADB", 0x515a, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "R800/R88i Xperia Play MTP+ADB", 0x515d, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST18i Xperia Ray MTP+ADB", 0x5161, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP+ADB", 0x5166, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST15i Xperia Mini MTP+ADB", 0x5167, DEVICE_FLAG_NONE }, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP+ADB", 0x5168, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT26i Xperia S MTP+ADB", 0x5169, DEVICE_FLAG_NO_ZERO_READS }, { "SonyEricsson", 0x0fce, "WT19i Live Walkman MTP+ADB", 0x516d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP+ADB", 0x5170, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST25i Xperia U MTP+ADB", 0x5171, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT22i Xperia P MTP+ADB", 0x5172, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "MT27i Xperia Sola MTP+ADB", 0x5173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "IS12S Xperia Acro HD MTP+ADB", 0x5175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-03D Xperia Acro HD MTP+ADB", 0x5176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+ADB", 0x5177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT29i Xperia GX MTP+ADB", 0x5178, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+ADB", 0x517e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST23i Xperia Miro MTP+ADB", 0x5180, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-05D Xperia SX MTP+ADB", 0x5181, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT30p Xperia T MTP+ADB", 0x5182, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT25i Xperia V MTP+ADB", 0x5186, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia J MTP+ADB", 0x5188, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZL MTP+ADB", 0x5189, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E MTP+ADB", 0x518c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP+ADB 1", 0x518d, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia L MTP+ADB", 0x5192, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z MTP+ADB", 0x5193, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Tablet Z MTP+ADB 2", 0x5194, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia SP MTP+ADB", 0x5195, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z Ultra MTP+ADB (ID2)", 0x5196, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia ZR MTP+ADB", 0x5197, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia A MTP+ADB", 0x5198, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia M MTP+ADB", 0x519b, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z Ultra MTP+ADB (ID3)", 0x519c, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z1 MTP+ADB", 0x519e, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia C MTP+ADB", 0x51a3, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z1 Compact MTP+ADB", 0x51a7, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 MTP+ADB", 0x51aa, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 Dual MTP+ADB", 0x51ab, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z2 MTP+ADB", 0x51af, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z2 Tablet MTP+ADB", 0x51b1, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia Z Ultra MTP+ADB", 0x51b6, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia M2 Aqua MTP+ADB", 0x51b8, DEVICE_FLAGS_ANDROID_BUGS }, { "SONY", 0x0fce, "Xperia Z3 MTP+ADB", 0x51ba, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia Z3 Compact MTP+ADB", 0x51bb, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "Xperia E3 MTP+ADB", 0x51bc, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria M4 Aqua Dual MTP+ADB", 0x51c4, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "E2115 MTP+ADB", 0x51c5, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria Z3+ MTP+ADB", 0x51c9, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "XPeria E4g MTP+ADB", 0x51cb, DEVICE_FLAG_NONE }, /* * MTP+UMS modes * This mode is for using MTP on the internal storage (eMMC) * and using UMS (Mass Storage Device Class) on the external * SD card */ { "SONY", 0x0fce, "MT27i Xperia Sola MTP+UMS", 0xa173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "IS12S Xperia Acro HD MTP+UMS", 0xa175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-03D Xperia Acro HD MTP+UMS", 0xa176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+UMS", 0xa177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+UMS", 0xa17e, DEVICE_FLAG_NONE }, /* * MTP+UMS+ADB modes * Like the above, but also ADB */ { "SONY", 0x0fce, "MT27i Xperia Sola MTP+UMS+ADB", 0xb173, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "IS12S Xperia Acro MTP+UMS+ADB", 0xb175, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "SO-03D Xperia Acro MTP+UMS+ADB", 0xb176, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "LT28at Xperia Ion MTP+UMS+ADB", 0xb177, DEVICE_FLAG_NONE }, { "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+UMS+ADB", 0xb17e, DEVICE_FLAG_NONE }, /* * Motorola * Assume DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST on all of these. */ /* https://sourceforge.net/p/libmtp/feature-requests/136/ */ { "Motorola", 0x22b8, "XT1524 (MTP)", 0x002e, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by David Boyd { "Motorola", 0x22b8, "V3m/V750 verizon", 0x2a65, DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, { "Motorola", 0x22b8, "Atrix/Razr HD (MTP)", 0x2e32, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Atrix/Razr HD (MTP+ADB)", 0x2e33, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "RAZR M XT907 (MTP)", 0x2e50, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "RAZR M XT907 (MTP+ADB)", 0x2e51, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Moto X (XT1053)", 0x2e62, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Moto X (XT1058)", 0x2e63, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1323/ */ { "Motorola", 0x22b8, "Moto X (XT1080)", 0x2e66, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Droid Maxx (XT1080)", 0x2e67, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Droid Ultra", 0x2e68, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Moto G (ID1)", 0x2e76, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Moto G (ID2)", 0x2e82, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1030/, PTP Id */ { "Motorola", 0x22b8, "Moto G (XT1032)", 0x2e84, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Jader Rodrigues Simoes { "Motorola", 0x22b8, "Xoom 2 Media Edition (ID3)", 0x41cf, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Steven Roemen { "Motorola", 0x22b8, "Droid X/MB525 (Defy)", 0x41d6, DEVICE_FLAG_NONE }, { "Motorola", 0x22b8, "DROID2 (ID1)", 0x41da, DEVICE_FLAG_NONE }, { "Motorola", 0x22b8, "Milestone / Verizon Droid", 0x41dc, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "DROID2 (ID2)", 0x42a7, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Xoom 2 Media Edition (ID2)", 0x4306, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Xoom 2 Media Edition", 0x4311, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by B,H,Kissinger { "Motorola", 0x22b8, "XT912/XT928", 0x4362, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1104/ , PTP id. */ { "Motorola", 0x22b8, "DROID4 (PTP)", 0x4373, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Lundgren { "Motorola", 0x22b8, "DROID4", 0x437f, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Marcus Meissner to libptp2 { "Motorola", 0x22b8, "IdeaPad K1", 0x4811, DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST }, // Reported by Hans-Joachim Baader to libptp2 { "Motorola", 0x22b8, "A1200", 0x60ca, DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST }, // http://mark.cdmaforums.com/Files/Motdmmtp.inf { "Motorola", 0x22b8, "MTP Test Command Interface", 0x6413, DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST }, // Reported by anonymous user { "Motorola", 0x22b8, "RAZR2 V8/U9/Z6", 0x6415, DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST }, // Reported by Rodrigo Angelo Rafael // Razr D1, D3 { "Motorola", 0x22b8, "Razr D1/D3/i (MTP)", 0x64b5, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Razr D1/D3/i (MTP+?)", 0x64b6, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/697/ */ { "Motorola", 0x22b8, "Atrix XT687 (MTP)", 0x64cf, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Brian Dolbec { "Motorola", 0x22b8, "Atrix MB860 (MTP)", 0x7088, DEVICE_FLAGS_ANDROID_BUGS }, /* * Motorola Xoom (Wingray) variants * * These devices seem to use these product IDs simulatenously * https://code.google.com/p/android-source-browsing/source/browse/init.stingray.usb.rc?repo=device--moto--wingray * * 0x70a3 - Factory test - reported as early MTP ID * 0x70a8 - MTP * 0x70a9 - MTP+ADB * 0x70ae - RNDIS * 0x70af - RNDIS+ADB * 0x70b0 - ACM * 0x70b1 - ACM+ADB * 0x70b2 - ACM+RNDIS * 0x70b3 - ACM+RNDIS+ADB * 0x70b4 - PTP * 0x70b5 - PTP+ADB * * Reported by Google Inc's Yavor Goulishev */ { "Motorola", 0x22b8, "Xoom (Factory test)", 0x70a3, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Xoom (MTP)", 0x70a8, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Xoom (MTP+ADB)", 0x70a9, DEVICE_FLAGS_ANDROID_BUGS }, // "carried by C Spire and other CDMA US carriers" { "Motorola", 0x22b8, "Milestone X2", 0x70ca, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "XT890/907/Razr (MTP)", 0x710d, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "XT890/907/Razr (MTP+ADB)", 0x710e, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1183/ */ { "Motorola", 0x22b8, "Droid Turbo (XT1254)", 0x2ea5, DEVICE_FLAGS_ANDROID_BUGS }, { "Motorola", 0x22b8, "Droid Turbo Verizon", 0x2ea8, DEVICE_FLAGS_ANDROID_BUGS }, /* * XT890/907/Razr * 710f is USB mass storage */ /* * Google * These guys lend their Vendor ID to anyone who comes down the * road to produce an Android tablet it seems... The Vendor ID * was originally used for Nexus phones */ { "Google Inc (for Allwinner)", 0x18d1, "A31 SoC", 0x0006, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for Ainol Novo)", 0x18d1, "Fire/Flame", 0x0007, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for Sony)", 0x18d1, "S1", 0x05b3, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by anonymous Sourceforge user { "Google Inc (for Barnes & Noble)", 0x18d1, "Nook Color", 0x2d02, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by anonymous Sourceforge user { "Google Inc (for Asus)", 0x18d1, "TF201 Transformer", 0x4d00, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by anonymous Sourceforge user { "Google Inc (for Asus)", 0x18d1, "TF101 Transformer", 0x4e0f, DEVICE_FLAGS_ANDROID_BUGS }, // 0x4e21 (Nexus S) is a USB Mass Storage device. { "Google Inc (for Samsung)", 0x18d1, "Nexus S (MTP)", 0x4e25, DEVICE_FLAGS_ANDROID_BUGS }, // 0x4e26 is also used by "Ramos W30HD Pro Quad Core" { "Google Inc (for Samsung)", 0x18d1, "Nexus S (MTP+ADB)", 0x4e26, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Chris Smith { "Google Inc (for Asus)", 0x18d1, "Nexus 7 (MTP)", 0x4e41, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Michael Hess { "Google Inc (for Asus)", 0x18d1, "Nexus 7 (MTP+ADB)", 0x4e42, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for LG Electronics/Samsung)", 0x18d1, "Nexus 4/5/7/10 (MTP)", 0x4ee1, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for LG Electronics/Samsung)", 0x18d1, "Nexus 4/5/7/10 (MTP+ADB)", 0x4ee2, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1255/ */ { "Google", 0x18d1, "Nexus 5 (MTP)", 0x4ee5, DEVICE_FLAGS_ANDROID_BUGS }, // WiFi-only version of Xoom // See: http://bugzilla.gnome.org/show_bug.cgi?id=647506 { "Google Inc (for Motorola)", 0x18d1, "Xoom (MZ604)", 0x70a8, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for Toshiba)", 0x18d1, "Thrive 7/AT105", 0x7102, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for Lenovo)", 0x18d1, "Ideapad K1", 0x740a, DEVICE_FLAGS_ANDROID_BUGS }, // Another OEM for Medion { "Google Inc (for Medion)", 0x18d1, "MD99000 (P9514)", 0xb00a, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Frederik Himpe { "Google Inc (for LG Electronics)", 0x18d1, "P990/Optimus (Cyanogen)", 0xd109, DEVICE_FLAGS_ANDROID_BUGS }, { "Google Inc (for LG Electronics)", 0x18d1, "P990/Optimus", 0xd10a, DEVICE_FLAGS_ANDROID_BUGS }, /* * Media Keg */ // Reported by Rajan Bella { "Kenwood", 0x0b28, "Media Keg HD10GB7 Sport Player", 0x100c, DEVICE_FLAG_UNLOAD_DRIVER}, /* * Micro-Star International (MSI) */ // Reported by anonymous sourceforge user. { "Micro-Star International", 0x0db0, "P610/Model MS-5557", 0x5572, DEVICE_FLAG_NONE }, /* * FOMA */ { "FOMA", 0x06d3, "D905i", 0x21ba, DEVICE_FLAG_NONE }, /* * Haier */ // Both reported by an anonymous SourceForge user // This is the 30 GiB model { "Haier", 0x1302, "Ibiza Rhapsody 1", 0x1016, DEVICE_FLAG_NONE }, // This is the 4/8 GiB model { "Haier", 0x1302, "Ibiza Rhapsody 2", 0x1017, DEVICE_FLAG_NONE }, /* * Panasonic */ // Reported by dmizer { "Panasonic", 0x04da, "P905i", 0x2145, DEVICE_FLAG_NONE }, // Reported by Taku { "Panasonic", 0x04da, "P906i", 0x2158, DEVICE_FLAG_NONE }, /* * Polaroid */ { "Polaroid", 0x0546, "Freescape/MPU-433158", 0x2035, DEVICE_FLAG_NONE }, /* * Pioneer */ // Reported by Dan Allen { "Pioneer", 0x08e4, "XMP3", 0x0148, DEVICE_FLAG_NONE }, /* * Slacker Inc. * Put in all evilness flags because it looks fragile. */ // Reported by Pug Fantus { "Slacker Inc.", 0x1bdc, "Slacker Portable Media Player", 0xfabf, DEVICE_FLAG_BROKEN_BATTERY_LEVEL | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST | DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST }, // Reported by anonymous user { "Conceptronic", 0x1e53, "CMTD2", 0x0005, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Demadridsur { "O2 Sistemas", 0x1e53, "ZoltarTV", 0x0006, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by da-beat { "Wyplay", 0x1e53, "Wyplayer", 0x0007, DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST }, // Reported by Sense Hofstede { "Perception Digital, Ltd", 0x0aa6, "Gigaware GX400", 0x9702, DEVICE_FLAG_NONE }, /* * RIM's BlackBerry */ // Reported by Nicolas VIVIEN { "RIM", 0x0fca, "BlackBerry Storm/9650", 0x8007, DEVICE_FLAG_UNLOAD_DRIVER | DEVICE_FLAG_SWITCH_MODE_BLACKBERRY | DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL }, /* * Nextar */ { "Nextar", 0x0402, "MA715A-8R", 0x5668, DEVICE_FLAG_NONE }, /* * Coby */ { "Coby", 0x1e74, "COBY MP705", 0x6512, DEVICE_FLAG_NONE }, #if 0 /* * Apple devices, which are not MTP natively but can be made to speak MTP * using PwnTunes (http://www.pwntunes.net/) * CURRENTLY COMMENTED OUT: * These will make the UDEV rules flag these as MTP devices even if * PwnTunes is NOT installed. That is unacceptable, so a better solution * that actually inspects if the device has PwnTunes/MTP support needs * to be found, see: * https://sourceforge.net/p/libmtp/bugs/759/ */ { "Apple", 0x05ac, "iPhone", 0x1290, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPod Touch 1st Gen", 0x1291, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPhone 3G", 0x1292, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPod Touch 2nd Gen", 0x1293, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPhone 3GS", 0x1294, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "0x1296", 0x1296, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "0x1297", 0x1297, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "0x1298", 0x1298, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPod Touch 3rd Gen", 0x1299, DEVICE_FLAG_NONE }, { "Apple", 0x05ac, "iPad", 0x129a, DEVICE_FLAG_NONE }, #endif // Reported by anonymous SourceForge user, also reported as // Pantech Crux, claming to be: // Manufacturer: Qualcomm // Model: Windows Simulator // Device version: Qualcomm MTP1.0 { "Curitel Communications, Inc.", 0x106c, "Verizon Wireless Device", 0x3215, DEVICE_FLAG_NONE }, // Reported by: Jim Hanrahan { "Pantech", 0x106c, "Crux", 0xf003, DEVICE_FLAG_NONE }, /* * Asus * Pattern of PIDs on Android devices seem to be: * n+0 = MTP * n+1 = MTP+ADB * n+2 = ? * n+3 = ? * n+4 = PTP */ // Reported by Glen Overby { "Asus", 0x0b05, "TF300 Transformer (MTP)", 0x4c80, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by jaile { "Asus", 0x0b05, "TF300 Transformer (MTP+ADB)", 0x4c81, DEVICE_FLAGS_ANDROID_BUGS }, // Repored by Florian Apolloner { "Asus", 0x0b05, "TF700 Transformer (MTP)", 0x4c90, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF700 Transformer (MTP+ADB)", 0x4c91, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF701T Transformer Pad (MTP)", 0x4ca0, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF701T Transformer Pad (MTP+ADB)", 0x4ca1, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/135/ */ { "Asus", 0x0b05, "ME302KL MeMo Pad FHD10 (MTP)", 0x4cc0, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ME302KL MeMo Pad FHD10 (MTP+ADB)", 0x4cc1, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ME301T MeMo Pad Smart 10 (MTP)", 0x4cd0, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ME301T MeMo Pad Smart 10 (MTP+ADB)", 0x4cd1, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Asus Fonepad Note 6 (MTP)", 0x4ce0, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Asus Fonepad Note 6 (MTP+ADB)", 0x4ce1, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF201 Transformer Prime (keyboard dock)", 0x4d00, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF201 Transformer Prime (tablet only)", 0x4d01, DEVICE_FLAGS_ANDROID_BUGS }, // 4d04 is the PTP mode, don't add it { "Asus", 0x0b05, "SL101 (MTP)", 0x4e00, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "SL101 (MTP+ADB)", 0x4e01, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF101 Eeepad Transformer (MTP)", 0x4e0f, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TF101 Eeepad Transformer (MTP+ADB)", 0x4e1f, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Fonepad", 0x514f, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone (MTP)", 0x5200, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone (MTP+ADB)", 0x5201, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ME302C MemoPad (MTP+?)", 0x520f, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone 2 (MTP)", 0x5210, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone 2 (MTP+ADB)", 0x5211, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone 2 (PTP)", 0x5214, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ME302C MemoPad (MTP)", 0x521f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1066/ */ { "Asus", 0x0b05, "PadFone Infinity (2nd ID) (MTP)", 0x5220, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone Infinity (2nd ID) (MTP+ADB)", 0x5221, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone Infinity (MTP)", 0x5230, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "PadFone Infinity (MTP+ADB)", 0x5231, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Memo ME172V (MTP)", 0x5400, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1072/ */ { "Asus", 0x0b05, "Fonepad 7 LTE ME372CL (MTP)", 0x540f, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Memo ME173X (MTP)", 0x5410, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Memo ME173X (MTP+ADB)", 0x5411, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1072/ */ { "Asus", 0x0b05, "Fonepad 7 LTE ME372CL (MTP+ADB)", 0x541f, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Memo K00F (MTP)", 0x5460, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Memo Pad 8 (MTP)", 0x5466, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "Memo K00F (MTP+ADB)", 0x5468, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/158/ */ { "Asus", 0x0b05, "ZenFone 5 (MTP)", 0x5480, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1279/ */ { "Asus", 0x0b05, "ZenFone 5 (MTP+ADB)", 0x5481, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1236/ */ { "Asus", 0x0b05, "ZenFone 6 (MTP)", 0x5490, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ZenFone 6 (MTP+ADB)", 0x5491, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1239/ */ { "Asus", 0x0b05, "K010 (MTP)", 0x5500, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1196/ */ { "Asus", 0x0b05, "MemoPad 7 (MTP+ADB)", 0x5506, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1069/ */ { "Asus", 0x0b05, "K00E (MTP+ADB)", 0x550f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1244/ */ { "Asus", 0x0b05, "MemoPad 8 ME181 CX (MTP)", 0x5561, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1406/ */ { "Asus", 0x0b05, "Zenfone 2 (MTP)", 0x5600, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1364/ */ { "Asus", 0x0b05, "Z00AD (MTP)", 0x5601, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "TX201LA (MTP)", 0x561f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1271/ */ { "Asus", 0x0b05, "ZenFone 4 (MTP)", 0x580f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1179/ */ { "Asus", 0x0b05, "ZenFone 4 A400CG (MTP)", 0x581f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1258/ */ { "Asus", 0x0b05, "A450CG (MTP)", 0x5a0f, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1350/ */ { "Asus", 0x0b05, "Zenfone 2 ZE550ML (MTP)", 0x5f02, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1364/ */ { "Asus", 0x0b05, "Zenfone 2 ZE551ML (MTP)", 0x5f03, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1232/ */ { "Asus", 0x0b05, "MemoPad 7 (ME572CL)", 0x7772, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1351/ */ { "Asus", 0x0b05, "Fonepad 7 (FE375CXG)", 0x7773, DEVICE_FLAGS_ANDROID_BUGS }, { "Asus", 0x0b05, "ZenFone 5 A500KL (MTP)", 0x7780, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1247/ */ { "Asus", 0x0b05, "ZenFone 5 A500KL (MTP+ADB)", 0x7781, DEVICE_FLAGS_ANDROID_BUGS }, /* * Lenovo */ /* https://sourceforge.net/p/libmtp/support-requests/178/ */ { "Lenovo", 0x17ef, "P70-A", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1415/ */ { "Lenovo", 0x17ef, "P70", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Richard Körber { "Lenovo", 0x17ef, "K1", 0x740a, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by anonymous sourceforge user // Adding Android default bug flags since it appears to be an Android { "Lenovo", 0x17ef, "ThinkPad Tablet", 0x741c, DEVICE_FLAGS_ANDROID_BUGS }, // Medion is using Lenovos manufacturer ID it seems. // Reported by Thomas Goss { "Medion", 0x17ef, "Lifetab P9516", 0x7483, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by: XChesser { "Lenovo", 0x17ef, "P700", 0x7497, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1185/ */ { "Lenovo", 0x17ef, "A820", 0x7498, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1190/ */ { "Lenovo", 0x17ef, "P780", 0x74a6, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by: anonymous sourceforge user { "Lenovo", 0x17ef, "Lifetab S9512", 0x74cc, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/170/ */ { "Lenovo", 0x17ef, "S660", 0x74f8, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Brian J. Murrell { "Lenovo", 0x17ef, "IdeaTab A2109A", 0x7542, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/166/ */ { "Lenovo", 0x17ef, "IdeaTab S2210a", 0x757d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1123/ */ { "Lenovo", 0x17ef, "K900 (ID1)", 0x75b5, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by rvelev@mail.bg { "Lenovo", 0x17ef, "IdeaPad A3000 (ID1)", 0x75bc, DEVICE_FLAGS_ANDROID_BUGS }, { "Lenovo", 0x17ef, "IdeaPad A3000 (ID2)", 0x75be, DEVICE_FLAGS_ANDROID_BUGS }, { "Lenovo", 0x17ef, "Toga Tablet B6000-F", 0x76f2, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1122/ */ { "Lenovo", 0x17ef, "S930", 0x7718, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1250/ */ { "Lenovo", 0x17ef, "A5500-F", 0x772b, DEVICE_FLAGS_ANDROID_BUGS }, { "Lenovo", 0x17ef, "LifeTab E733X", 0x775a, DEVICE_FLAGS_ANDROID_BUGS }, { "Lenovo", 0x17ef, "IdeaTab S5000", 0x76e8, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1155/ */ { "Lenovo", 0x17ef, "Yoga Tablet 10 B8000-H", 0x76ff, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1391/ */ { "Lenovo", 0x17ef, "A7600-F", 0x7731, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1291/ */ { "Lenovo", 0x17ef, "A3500-F", 0x7737, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/186/ */ { "Lenovo", 0x17ef, "Yoga Tablet 2 - 1050F", 0x77a4, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/168/ */ { "Lenovo", 0x17ef, "Yoga Tablet 2 Pro", 0x77b1, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/125/ */ { "Lenovo", 0x17ef, "Vibe Z2", 0x77ea, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1360/ */ { "Lenovo", 0x17ef, "K3 Note", 0x7883, DEVICE_FLAGS_ANDROID_BUGS }, /* * Huawei * IDs used by Honor U8860,U8815,U9200,P2 */ { "Huawei", 0x12d1, "MTP device (ID1)", 0x1051, DEVICE_FLAGS_ANDROID_BUGS }, { "Huawei", 0x12d1, "MTP device (ID2)", 0x1052, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1381/ */ { "Huawei", 0x12d1, "H60-L11", 0x1079, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1361/ */ { "Huawei", 0x12d1, "Ascend P8 ", 0x1082, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1418/ */ { "Huawei", 0x12d1, "Honor 3C ", 0x2012, DEVICE_FLAGS_ANDROID_BUGS }, { "Huawei", 0x12d1, "Mediapad (mode 0)", 0x360f, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by Bearsh { "Huawei", 0x12d1, "Mediapad (mode 1)", 0x361f, DEVICE_FLAGS_ANDROID_BUGS }, /* * ZTE * Android devices reported by junwang */ { "ZTE", 0x19d2, "V55 ID 1", 0x0244, DEVICE_FLAGS_ANDROID_BUGS }, { "ZTE", 0x19d2, "V55 ID 2", 0x0245, DEVICE_FLAGS_ANDROID_BUGS }, { "ZTE", 0x19d2, "V790/Blade 3", 0x0306, DEVICE_FLAGS_ANDROID_BUGS }, { "ZTE", 0x19d2, "V880E", 0x0307, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/672/ */ { "ZTE", 0x19d2, "Grand X In", 0x0343, DEVICE_FLAGS_ANDROID_BUGS }, { "ZTE", 0x19d2, "V985", 0x0383, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1328/ */ { "ZTE", 0x19d2, "V5", 0xffce, DEVICE_FLAGS_ANDROID_BUGS }, /* * HTC (High Tech Computer Corp) * Reporters: * Steven Eastland * Kevin Cheng */ /* https://sourceforge.net/p/libmtp/support-requests/181/ */ { "HTC", 0x0bb4, "HTC One M9 (MTP)", 0x040b, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1398/ */ { "HTC", 0x0bb4, "Spreadtrum SH57MYZ03342 (MTP)", 0x05e3, DEVICE_FLAGS_ANDROID_BUGS }, /* reported by Mikkel Oscar Lyderik */ { "HTC", 0x0bb4, "HTC Desire 510 (MTP+ADB)", 0x05fd, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1221/ */ { "HTC", 0x0bb4, "One M8 Google Play Edition (MTP+ADB)", 0x060b, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/support-requests/153/ */ { "HTC", 0x0bb4, "HTC6515LVW/One Remix", 0x07d8, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/support-requests/141/ */ { "HTC", 0x0bb4, "HTC One (HTC6500LVW)", 0x07ae, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/support-requests/128/ */ { "HTC", 0x0bb4, "HTC One M8 (HTC6525LVW)", 0x07ca, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/bugs/1161/ */ { "HTC", 0x0bb4, "HTC One M8 (Verizon) (HTC6525LVW)", 0x07cb, DEVICE_FLAG_NONE }, /* https://sourceforge.net/p/libmtp/bugs/1133/ */ { "HTC", 0x0bb4, "HTC One Remix (HTC6515LVW)", 0x07d9, DEVICE_FLAG_NONE }, // Reported by Markus Heberling { "HTC", 0x0bb4, "Windows Phone 8X ID1", 0x0ba1, DEVICE_FLAG_NONE }, { "HTC", 0x0bb4, "Windows Phone 8X ID2", 0x0ba2, DEVICE_FLAG_NONE }, #if 1 /* after some review I commented it back in. There was apparently * only one or two devices misbehaving (having this ID in mass storage mode), * but more seem to use it regulary as MTP devices. Marcus 20150401 */ /* * This had to be commented out - the same VID+PID is used also for * other modes than MTP, so we need to let mtp-probe do its job on this * device instead of adding it to the database. * used by various devices, like Fairphone, Elephone P5000, etc * https://sourceforge.net/p/libmtp/bugs/1290/ */ { "HTC", 0x0bb4, "Android Device ID1 (Zopo, HD2, Bird...)", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, #endif { "HTC", 0x0bb4, "EVO 4G LTE/One V (ID1)", 0x0c93, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "EVO 4G LTE/One V (ID2)", 0x0ca8, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One S (ID1)", 0x0cec, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "One Mini (ID1)", 0x0dcd, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One 802w (ID1)", 0x0dd2, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC Desire X", 0x0dd5, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (ID1)", 0x0dda, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC Butterfly X290d", 0x0de4, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (MTP+UMS+ADB)", 0x0dea, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC Evo 4G LTE (ID1)", 0x0df5, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One S (ID2)", 0x0df8, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One S (ID3)", 0x0df9, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One X (ID1)", 0x0dfa, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One X (ID2)", 0x0dfb, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One X (ID3)", 0x0dfc, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One X (ID4)", 0x0dfd, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC Butterfly (ID1)", 0x0dfe, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "Droid DNA (MTP+UMS+ADB)", 0x0dff, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC Droid Incredible 4G LTE (MTP)", 0x0e31, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC Droid Incredible 4G LTE (MTP+ADB)", 0x0e32, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "Droid DNA (MTP+UMS)", 0x0ebd, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1182/ */ { "HTC", 0x0bb4, "Desire 310 (MTP)", 0x0ec6, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1420/ */ { "HTC", 0x0bb4, "Desire 816G (MTP)", 0x0edb, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (MTP+ADB+CDC)", 0x0f5f, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (MTP+CDC)", 0x0f60, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (MTP+ADB)", 0x0f63, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (MTP)", 0x0f64, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (MTP+ADB+?)", 0x0f87, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One (ID3)", 0x0f91, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One M8 (MTP)", 0x0f25, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One M8 (MTP+ADB)", 0x061a, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One M8 (MTP+UMS)", 0x0fb5, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "HTC One M8 (MTP+ADB+UMS)", 0x0fb4, DEVICE_FLAGS_ANDROID_BUGS }, #if 1 /* after some review I commented it back in. There was apparently * only one or two devices misbehaving (having this ID in mass storage mode), * but more seem to use it regulary as MTP devices. Marcus 20150401 */ /* * This had to be commented out - the same VID+PID is used also for * other modes than MTP, so we need to let mtp-probe do its job on this * device instead of adding it to the database. * * Apparently also used by a clone called Jiayu G2S * with the MTK6577T chipset * http://www.ejiayu.com/en/Product-19.html * Wiko Cink Peax 2 */ { "HTC", 0x0bb4, "Android Device ID2 (Zopo, HD2...)", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, #endif /* https://sourceforge.net/p/libmtp/bugs/1198/ */ { "HTC", 0x0bb4, "Motorola Razr D1", 0x2012, DEVICE_FLAGS_ANDROID_BUGS }, // These identify themselves as "cm_tenderloin", fun... // Done by HTC for HP I guess. { "HTC (for Hewlett-Packard)", 0x0bb4, "HP Touchpad (MTP)", 0x685c, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC (for Hewlett-Packard)", 0x0bb4, "HP Touchpad (MTP+ADB)", 0x6860, DEVICE_FLAGS_ANDROID_BUGS }, { "HTC", 0x0bb4, "Windows Phone 8s ID1", 0xf0ca, DEVICE_FLAG_NONE }, /* * NEC */ { "NEC", 0x0409, "FOMA N01A", 0x0242, DEVICE_FLAG_NONE }, { "NEC", 0x0409, "Casio C811", 0x0326, DEVICE_FLAG_NONE }, { "NEC", 0x0409, "Casio CA-201L", 0x0432, DEVICE_FLAG_NONE }, /* * nVidia */ // Found on Internet forum { "nVidia", 0x0955, "CM9-Adam", 0x70a9, DEVICE_FLAGS_ANDROID_BUGS }, // Various pads such as Nabi2, Notion Ink Adam, Viewsonic G-Tablet { "nVidia", 0x0955, "Various tablets (ID1)", 0x7100, DEVICE_FLAGS_ANDROID_BUGS }, { "nVidia", 0x0955, "Various tablets (ID2)", 0x7102, DEVICE_FLAGS_ANDROID_BUGS }, { "nVidia", 0x0955, "Shield (ID1)", 0xb400, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1087/ */ { "nVidia", 0x0955, "Tegra Note", 0xcf02, DEVICE_FLAGS_ANDROID_BUGS }, /* benpro82@gmail.com */ { "nVidia", 0x0955, "Shield (ID2)", 0xcf07, DEVICE_FLAGS_ANDROID_BUGS }, /* * Vizio * Reported by: * Michael Gurski */ /* https://sourceforge.net/p/libmtp/support-requests/138/ */ { "InFocus", 0x0489, "M810", 0xc025, DEVICE_FLAGS_ANDROID_BUGS }, { "Vizio", 0x0489, "Unknown 1", 0xc026, DEVICE_FLAGS_ANDROID_BUGS }, { "Vizio", 0x0489, "VTAB1008", 0xe040, DEVICE_FLAGS_ANDROID_BUGS }, { "Vizio (for Lenovo)", 0x0489, "LIFETAB S9714", 0xe111, DEVICE_FLAGS_ANDROID_BUGS }, /* * Amazon */ { "Amazon", 0x1949, "Kindle Fire 2G (ID1)", 0x0005, DEVICE_FLAGS_ANDROID_BUGS }, { "Amazon", 0x1949, "Kindle Fire (ID1)", 0x0007, DEVICE_FLAGS_ANDROID_BUGS }, { "Amazon", 0x1949, "Kindle Fire (ID2)", 0x0008, DEVICE_FLAGS_ANDROID_BUGS }, { "Amazon", 0x1949, "Kindle Fire (ID3)", 0x000a, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1026/ */ { "Amazon", 0x1949, "Kindle Fire (ID6)", 0x000b, DEVICE_FLAGS_ANDROID_BUGS }, { "Amazon", 0x1949, "Kindle Fire (ID4)", 0x000c, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1015/ */ { "Amazon", 0x1949, "Kindle Fire (ID7)", 0x000d, DEVICE_FLAGS_ANDROID_BUGS }, { "Amazon", 0x1949, "Kindle Fire (ID5)", 0x0012, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1353/ */ { "Amazon", 0x1949, "Kindle Fire HD6", 0x00f2, DEVICE_FLAGS_ANDROID_BUGS }, { "Amazon", 0x1949, "Fire Phone", 0x0800, DEVICE_FLAGS_ANDROID_BUGS }, /* * Barnes&Noble */ { "Barnes&Noble", 0x2080, "Nook HD+", 0x0005, DEVICE_FLAGS_ANDROID_BUGS }, { "Barnes&Noble", 0x2080, "Nook HD", 0x0006, DEVICE_FLAGS_ANDROID_BUGS }, /* * Viewpia, bq, YiFang * Seems like some multi-branded OEM product line. */ { "Various", 0x2207, "Viewpia DR/bq Kepler", 0x0001, DEVICE_FLAGS_ANDROID_BUGS }, { "YiFang", 0x2207, "BQ Tesla", 0x0006, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1354/ */ { "Various", 0x2207, "Viewpia DR/bq Kepler Debugging", 0x0011, DEVICE_FLAGS_ANDROID_BUGS }, /* * Kobo */ /* https://sourceforge.net/p/libmtp/bugs/1208/ */ { "Kobo", 0x2237, "Arc 7 HD", 0xb108, DEVICE_FLAGS_ANDROID_BUGS }, // Reported by George Talusan { "Kobo", 0x2237, "Arc (ID1)", 0xd108, DEVICE_FLAGS_ANDROID_BUGS }, { "Kobo", 0x2237, "Arc (ID2)", 0xd109, DEVICE_FLAGS_ANDROID_BUGS }, /* * Hisense */ // Reported by Anonymous SourceForge users { "Hisense", 0x109b, "E860 (ID1)", 0x9106, DEVICE_FLAGS_ANDROID_BUGS }, { "Hisense", 0x109b, "E860 (ID2)", 0x9109, DEVICE_FLAGS_ANDROID_BUGS }, /* * Intel * Also sold rebranded as Orange products */ { "Intel", 0x8087, "Xolo 900/AZ210A", 0x09fb, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1256/ */ { "Intel", 0x8087, "Noblex T7A21", 0x0a16, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1252/ */ { "Intel", 0x8087, "Foxconn iView i700", 0x0a15, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1237/ */ { "Intel", 0x8087, "Telcast Air 3G", 0x0a5e, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1338/ */ { "Intel", 0x8087, "Chuwi vi8", 0x0a5f, DEVICE_FLAGS_ANDROID_BUGS }, /* * Xiaomi */ /* https://sourceforge.net/p/libmtp/bugs/1269/ */ { "Xiaomi", 0x2717, "Mi-3w (MTP)", 0x0360, DEVICE_FLAGS_ANDROID_BUGS }, { "Xiaomi", 0x2717, "Mi-3 (MTP)", 0x0368, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1149/ */ { "Xiaomi", 0x2717, "MiPad (MTP)", 0x0660, DEVICE_FLAGS_ANDROID_BUGS }, { "Xiaomi", 0x2717, "Hongmi (MTP+ADB)", 0x1240, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1095/ */ { "Xiaomi", 0x2717, "Hongmi (MTP)", 0x1248, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1295/ */ { "Redmi", 0x2717, "1S (MTP)", 0x1260, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1164/ */ { "Redmi", 0x2717, "HM 1S (MTP)", 0x1268, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/discussion/535190/ */ { "Xiaomi", 0x2717, "HM NOTE 1LTEW MIUI (MTP)", 0x1368, DEVICE_FLAGS_ANDROID_BUGS }, { "Xiaomi", 0x2717, "Mi-2 (MTP+ADB)", 0x9039, DEVICE_FLAGS_ANDROID_BUGS }, { "Xiaomi", 0x2717, "Mi-2 (MTP)", 0xf003, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1397/ */ { "Xiaomi", 0x2717, "Mi-2s (id2) (MTP)", 0xff40, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1339/ */ { "Xiaomi", 0x2717, "Mi-2s (MTP)", 0xff48, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1402/ */ { "Xiaomi", 0x2717, "Redmi 2 (MTP)", 0xff60, DEVICE_FLAGS_ANDROID_BUGS }, /* * XO Learning Tablet * Also Trio Stealth G2 tablet it seems */ { "Acromag Inc.", 0x16d5, "XO Learning Tablet (MTP+ADB)", 0x8005, DEVICE_FLAGS_ANDROID_BUGS }, { "Acromag Inc.", 0x16d5, "XO Learning Tablet (MTP)", 0x8006, DEVICE_FLAGS_ANDROID_BUGS }, /* * SHARP Corporation */ { "SHARP Corporation", 0x0489, "SH930W", 0xc025, DEVICE_FLAGS_ANDROID_BUGS }, { "SHARP Corporation", 0x04dd, "SBM203SH", 0x9661, DEVICE_FLAGS_ANDROID_BUGS }, { "SHARP Corporation", 0x04dd, "SH-06E", 0x96ca, DEVICE_FLAGS_ANDROID_BUGS }, /* * T & A Mobile phones Alcatel and TCT */ { "Alcatel", 0x1bbb, "One Touch 997D (MTP+ADB)", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, { "Alcatel", 0x1bbb, "One Touch 997D (MTP)", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, { "Alcatel/TCT", 0x1bbb, "6010D/TCL S950", 0x0167, DEVICE_FLAGS_ANDROID_BUGS }, { "Alcatel", 0x1bbb, "6030a", 0x0168, DEVICE_FLAGS_ANDROID_BUGS }, { "Alcatel/Bouygues", 0x1bbb, "BS472", 0x904d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1304/ */ { "Alcatel", 0x1bbb, "OneTouch 5042D (MTP)", 0xa00e, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/189/ */ { "Alcatel", 0x1bbb, "OneTouch Idol 3 small (MTP)", 0xaf2a, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1401/ */ { "Alcatel", 0x1bbb, "OneTouch Idol 3 (MTP)", 0xaf2b, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/114/ */ { "Alcatel", 0x1bbb, "OneTouch 6034R", 0xf003, DEVICE_FLAGS_ANDROID_BUGS }, /* * Kyocera */ { "Kyocera", 0x0482, "Rise", 0x0571, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/134/ */ { "Kyocera", 0x0482, "Torque Model E6715", 0x0059a, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/discussion/535190/thread/6270f5ce/ */ { "Kyocera", 0x0482, "KYL22", 0x0810, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1345/ */ { "Kyocera", 0x0482, "DuraForce", 0x0979, DEVICE_FLAGS_ANDROID_BUGS }, /* * HiSense */ { "HiSense", 0x109b, "Sero 7 Pro", 0x9105, DEVICE_FLAGS_ANDROID_BUGS }, /* * Hewlett-Packard */ { "Hewlett-Packard", 0x03f0, "Slate 7 4600", 0x5c1d, DEVICE_FLAGS_ANDROID_BUGS }, { "Hewlett-Packard", 0x03f0, "Slate 7 2800", 0x5d1d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1366/ */ { "Hewlett-Packard", 0x03f0, "Slate 10 HD", 0x7e1d, DEVICE_FLAGS_ANDROID_BUGS }, /* * MediaTek Inc. */ { "MediaTek Inc", 0x0e8d, "MT5xx and MT6xx SoCs", 0x0050, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1422/ */ { "MediaTek Inc", 0x0e8d, "MT65xx", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/79/ */ { "MediaTek Inc", 0x0e8d, "Elephone P8000", 0x201d, DEVICE_FLAGS_ANDROID_BUGS }, /* * Jolla */ { "Jolla", 0x2931, "Sailfish (ID1)", 0x0a01, DEVICE_FLAGS_ANDROID_BUGS }, /* * TCL? Alcatel? */ { "TCL", 0x0451, "Alcatel one touch 986+", 0xd108, DEVICE_FLAGS_ANDROID_BUGS }, /* * Garmin */ { "Garmin", 0x091e, "Monterra", 0x2585, DEVICE_FLAGS_ANDROID_BUGS }, /* * Wacom */ { "Wacom", 0x0531, "Cintiq Companion Hybrid (MTP+ADB)", 0x2001, DEVICE_FLAGS_ANDROID_BUGS }, /* * Kurio */ { "Kurio", 0x1f3a, "7S", 0x1006, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1245/ */ { "DigiLand", 0x1f3a, "DL701Q", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, /* In update 4 the order of devices was changed for better OS X / Windows suport and another device-id got assigned for the MTP */ { "Jolla", 0x2931, "Sailfish (ID2)", 0x0a05, DEVICE_FLAGS_ANDROID_BUGS }, /* * bq * https://sourceforge.net/p/libmtp/feature-requests/128/ */ { "bq", 0x2a47, "Krillin (MTP)", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, { "bq", 0x2a47, "Krillin (MTP+ADB)", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1311/ */ { "bq", 0x2a47, "Aquarius E5-4G", 0x7f10, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1292/ */ { "Prestigio", 0x29e4, "5505 DUO ", 0x1103, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1243/ */ { "Prestigio", 0x29e4, "5504 DUO ", 0x1203, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/141/ */ { "Prestigio", 0x29e4, "3405 DUO ", 0x3201, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1283/ */ { "Megafon", 0x201e, "MFLogin3T", 0x42ab, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1287/ */ { "Gensis", 0x040d, "GT-7305 ", 0x885c, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/182/ */ { "Oppo", 0x22d9, "Find 5", 0x2764, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1207/ */ { "Oppo", 0x22d9, "Find 7 (ID 1)", 0x2765, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1277/ */ { "Oppo", 0x22d9, "X9006", 0x2773, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/support-requests/129/ */ { "Oppo", 0x22d9, "Find 7 (ID 2)", 0x2774, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1273/ */ { "Gigabyte", 0x0414, "RCT6773W22 (MTP+ADB)", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, { "Gigabyte", 0x0414, "RCT6773W22 (MTP)", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1264/ */ { "Meizu", 0x2a45, "MX Phone (MTP)", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1263/ */ { "Meizu", 0x2a45, "MX Phone (MTP+ADB)", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1201/ */ { "Caterpillar", 0x04b7, "Cat S50", 0x88a9, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/682/ */ { "Pegatron", 0x1d4d, "Chagall (ADB)", 0x5035, DEVICE_FLAGS_ANDROID_BUGS }, { "Pegatron", 0x1d4d, "Chagall", 0x5036, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/115/ */ { "Pegatron", 0x1d4d, "Hudl 2", 0x504a, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1229/ */ { "Yota", 0x2916, "Phone 2", 0x914d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1267/ */ { "Yota", 0x2916, "Phone 2 (ID2)", 0xf003, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1212/ */ { "Fly", 0x2970, "Evo Tech 4", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1303/ */ { "Megafon", 0x1271, "Login+", 0x2012, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1127/ */ { "Fly", 0x2970, "iq4415 era style 3", 0x0c02, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1082/ */ { "Fly", 0x1782, "iq449", 0x4001, DEVICE_FLAGS_ANDROID_BUGS }, /* * YU Yureka. */ { "YU Yureka", 0x1ebf, "Vodafone smart turbo 4", 0x7f29, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1314/ */ { "BenQ", 0x1d45, "F5", 0x459d, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1362/ */ { "TomTom", 0x1390, "Rider 40", 0x5455, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/feature-requests/135/. guessed android. */ { "OUYA", 0x2836, "Videogame Console", 0x0010, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1383/ */ { "BLU", 0x0e8d, "Studio HD", 0x2008, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1423/ */ { "OnePlus", 0x2a70, "ONE A2001", 0x9011, DEVICE_FLAGS_ANDROID_BUGS }, /* https://sourceforge.net/p/libmtp/bugs/1436/ */ { "Parrot", 0x19cf, "Bebop Drone", 0x5038, DEVICE_FLAGS_ANDROID_BUGS }, /* * Other strange stuff. */ { "Isabella", 0x0b20, "Her Prototype", 0xddee, DEVICE_FLAG_NONE } libmtp-1.1.10/src/ptp-pack.c0000644000175000001440000023247712345765122012476 00000000000000/* ptp-pack.c * * Copyright (C) 2001-2004 Mariusz Woloszyn * Copyright (C) 2003-2012 Marcus Meissner * Copyright (C) 2006-2008 Linus Walleij * Copyright (C) 2007 Tero Saarni * Copyright (C) 2009 Axel Waggershauser * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ /* currently this file is included into ptp.c */ #ifdef HAVE_LIMITS_H #include #endif #ifndef UINT_MAX # define UINT_MAX 0xFFFFFFFF #endif #ifdef HAVE_ICONV #include #endif static inline uint16_t htod16p (PTPParams *params, uint16_t var) { return ((params->byteorder==PTP_DL_LE)?htole16(var):htobe16(var)); } static inline uint32_t htod32p (PTPParams *params, uint32_t var) { return ((params->byteorder==PTP_DL_LE)?htole32(var):htobe32(var)); } static inline void htod16ap (PTPParams *params, unsigned char *a, uint16_t val) { if (params->byteorder==PTP_DL_LE) htole16a(a,val); else htobe16a(a,val); } static inline void htod32ap (PTPParams *params, unsigned char *a, uint32_t val) { if (params->byteorder==PTP_DL_LE) htole32a(a,val); else htobe32a(a,val); } static inline void htod64ap (PTPParams *params, unsigned char *a, uint64_t val) { if (params->byteorder==PTP_DL_LE) htole64a(a,val); else htobe64a(a,val); } static inline uint16_t dtoh16p (PTPParams *params, uint16_t var) { return ((params->byteorder==PTP_DL_LE)?le16toh(var):be16toh(var)); } static inline uint32_t dtoh32p (PTPParams *params, uint32_t var) { return ((params->byteorder==PTP_DL_LE)?le32toh(var):be32toh(var)); } static inline uint64_t dtoh64p (PTPParams *params, uint64_t var) { return ((params->byteorder==PTP_DL_LE)?le64toh(var):be64toh(var)); } static inline uint16_t dtoh16ap (PTPParams *params, const unsigned char *a) { return ((params->byteorder==PTP_DL_LE)?le16atoh(a):be16atoh(a)); } static inline uint32_t dtoh32ap (PTPParams *params, const unsigned char *a) { return ((params->byteorder==PTP_DL_LE)?le32atoh(a):be32atoh(a)); } static inline uint64_t dtoh64ap (PTPParams *params, const unsigned char *a) { return ((params->byteorder==PTP_DL_LE)?le64atoh(a):be64atoh(a)); } #define htod8a(a,x) *(uint8_t*)(a) = x #define htod16a(a,x) htod16ap(params,a,x) #define htod32a(a,x) htod32ap(params,a,x) #define htod64a(a,x) htod64ap(params,a,x) #define htod16(x) htod16p(params,x) #define htod32(x) htod32p(params,x) #define htod64(x) htod64p(params,x) #define dtoh8a(x) (*(uint8_t*)(x)) #define dtoh16a(a) dtoh16ap(params,a) #define dtoh32a(a) dtoh32ap(params,a) #define dtoh64a(a) dtoh64ap(params,a) #define dtoh16(x) dtoh16p(params,x) #define dtoh32(x) dtoh32p(params,x) #define dtoh64(x) dtoh64p(params,x) static inline char* ptp_unpack_string(PTPParams *params, unsigned char* data, uint16_t offset, uint8_t *len) { uint8_t length; uint16_t string[PTP_MAXSTRLEN+1]; /* allow for UTF-8: max of 3 bytes per UCS-2 char, plus final null */ char loclstr[PTP_MAXSTRLEN*3+1]; size_t nconv, srclen, destlen; char *src, *dest; length = dtoh8a(&data[offset]); /* PTP_MAXSTRLEN == 255, 8 bit len */ *len = length; if (length == 0) /* nothing to do? */ return(NULL); /* copy to string[] to ensure correct alignment for iconv(3) */ memcpy(string, &data[offset+1], length * sizeof(string[0])); string[length] = 0x0000U; /* be paranoid! add a terminator. */ loclstr[0] = '\0'; /* convert from camera UCS-2 to our locale */ src = (char *)string; srclen = length * sizeof(string[0]); dest = loclstr; destlen = sizeof(loclstr)-1; nconv = (size_t)-1; #ifdef HAVE_ICONV if (params->cd_ucs2_to_locale != (iconv_t)-1) nconv = iconv(params->cd_ucs2_to_locale, &src, &srclen, &dest, &destlen); #endif if (nconv == (size_t) -1) { /* do it the hard way */ int i; /* try the old way, in case iconv is broken */ for (i=0;i127) loclstr[i] = '?'; else loclstr[i] = dtoh16a(&data[offset+1+2*i]); } dest = loclstr+length; } *dest = '\0'; loclstr[sizeof(loclstr)-1] = '\0'; /* be safe? */ return(strdup(loclstr)); } static inline int ucs2strlen(uint16_t const * const unicstr) { int length = 0; /* Unicode strings are terminated with 2 * 0x00 */ for(length = 0; unicstr[length] != 0x0000U; length ++); return length; } static inline void ptp_pack_string(PTPParams *params, char *string, unsigned char* data, uint16_t offset, uint8_t *len) { int packedlen = 0; uint16_t ucs2str[PTP_MAXSTRLEN+1]; char *ucs2strp = (char *) ucs2str; size_t convlen = strlen(string); /* Cannot exceed 255 (PTP_MAXSTRLEN) since it is a single byte, duh ... */ memset(ucs2strp, 0, sizeof(ucs2str)); /* XXX: necessary? */ #ifdef HAVE_ICONV if (params->cd_locale_to_ucs2 != (iconv_t)-1) { size_t nconv; size_t convmax = PTP_MAXSTRLEN * 2; /* Includes the terminator */ char *stringp = string; nconv = iconv(params->cd_locale_to_ucs2, &stringp, &convlen, &ucs2strp, &convmax); if (nconv == (size_t) -1) ucs2str[0] = 0x0000U; } else #endif { unsigned int i; for (i=0;i PTP_MAXSTRLEN-1) { *len=0; return; } /* number of characters including terminating 0 (PTP standard confirmed) */ htod8a(&data[offset],packedlen+1); memcpy(&data[offset+1], &ucs2str[0], packedlen * sizeof(ucs2str[0])); htod16a(&data[offset+packedlen*2+1], 0x0000); /* terminate 0 */ /* The returned length is in number of characters */ *len = (uint8_t) packedlen+1; } static inline unsigned char * ptp_get_packed_stringcopy(PTPParams *params, char *string, uint32_t *packed_size) { uint8_t packed[PTP_MAXSTRLEN*2+3], len; size_t plen; unsigned char *retcopy = NULL; if (string == NULL) ptp_pack_string(params, "", (unsigned char*) packed, 0, &len); else ptp_pack_string(params, string, (unsigned char*) packed, 0, &len); /* returned length is in characters, then one byte for string length */ plen = len*2 + 1; retcopy = malloc(plen); if (!retcopy) { *packed_size = 0; return NULL; } memcpy(retcopy, packed, plen); *packed_size = plen; return (retcopy); } static inline uint32_t ptp_unpack_uint32_t_array(PTPParams *params, unsigned char* data, uint16_t offset, uint32_t **array) { uint32_t n, i=0; *array = NULL; n=dtoh32a(&data[offset]); if (n >= UINT_MAX/sizeof(uint32_t)) return 0; if (!n) return 0; *array = malloc (n*sizeof(uint32_t)); for (i=0;i= UINT_MAX/sizeof(uint16_t)) return 0; if (!n) return 0; *array = malloc (n*sizeof(uint16_t)); for (i=0;iStandardVersion = dtoh16a(&data[PTP_di_StandardVersion]); di->VendorExtensionID = dtoh32a(&data[PTP_di_VendorExtensionID]); di->VendorExtensionVersion = dtoh16a(&data[PTP_di_VendorExtensionVersion]); di->VendorExtensionDesc = ptp_unpack_string(params, data, PTP_di_VendorExtensionDesc, &len); totallen=len*2+1; di->FunctionalMode = dtoh16a(&data[PTP_di_FunctionalMode+totallen]); di->OperationsSupported_len = ptp_unpack_uint16_t_array(params, data, PTP_di_OperationsSupported+totallen, &di->OperationsSupported); totallen=totallen+di->OperationsSupported_len*sizeof(uint16_t)+sizeof(uint32_t); di->EventsSupported_len = ptp_unpack_uint16_t_array(params, data, PTP_di_OperationsSupported+totallen, &di->EventsSupported); totallen=totallen+di->EventsSupported_len*sizeof(uint16_t)+sizeof(uint32_t); di->DevicePropertiesSupported_len = ptp_unpack_uint16_t_array(params, data, PTP_di_OperationsSupported+totallen, &di->DevicePropertiesSupported); totallen=totallen+di->DevicePropertiesSupported_len*sizeof(uint16_t)+sizeof(uint32_t); di->CaptureFormats_len = ptp_unpack_uint16_t_array(params, data, PTP_di_OperationsSupported+totallen, &di->CaptureFormats); totallen=totallen+di->CaptureFormats_len*sizeof(uint16_t)+sizeof(uint32_t); di->ImageFormats_len = ptp_unpack_uint16_t_array(params, data, PTP_di_OperationsSupported+totallen, &di->ImageFormats); totallen=totallen+di->ImageFormats_len*sizeof(uint16_t)+sizeof(uint32_t); di->Manufacturer = ptp_unpack_string(params, data, PTP_di_OperationsSupported+totallen, &len); totallen+=len*2+1; di->Model = ptp_unpack_string(params, data, PTP_di_OperationsSupported+totallen, &len); totallen+=len*2+1; di->DeviceVersion = ptp_unpack_string(params, data, PTP_di_OperationsSupported+totallen, &len); totallen+=len*2+1; di->SerialNumber = ptp_unpack_string(params, data, PTP_di_OperationsSupported+totallen, &len); } inline static void ptp_free_DI (PTPDeviceInfo *di) { if (di->SerialNumber) free (di->SerialNumber); if (di->DeviceVersion) free (di->DeviceVersion); if (di->Model) free (di->Model); if (di->Manufacturer) free (di->Manufacturer); if (di->ImageFormats) free (di->ImageFormats); if (di->CaptureFormats) free (di->CaptureFormats); if (di->VendorExtensionDesc) free (di->VendorExtensionDesc); if (di->OperationsSupported) free (di->OperationsSupported); if (di->EventsSupported) free (di->EventsSupported); if (di->DevicePropertiesSupported) free (di->DevicePropertiesSupported); } /* EOS Device Info unpack */ static inline void ptp_unpack_EOS_DI (PTPParams *params, unsigned char* data, PTPCanonEOSDeviceInfo *di, unsigned int datalen) { unsigned int totallen = 4; memset (di,0, sizeof(*di)); if (datalen < 8) return; /* uint32_t struct len - ignore */ di->EventsSupported_len = ptp_unpack_uint32_t_array(params, data, totallen, &di->EventsSupported); if (!di->EventsSupported) return; totallen += di->EventsSupported_len*sizeof(uint32_t)+4; if (totallen >= datalen) return; di->DevicePropertiesSupported_len = ptp_unpack_uint32_t_array(params, data, totallen, &di->DevicePropertiesSupported); if (!di->DevicePropertiesSupported) return; totallen += di->DevicePropertiesSupported_len*sizeof(uint32_t)+4; if (totallen >= datalen) return; di->unk_len = ptp_unpack_uint32_t_array(params, data, totallen, &di->unk); if (!di->unk) return; totallen += di->unk_len*sizeof(uint32_t)+4; return; } static inline void ptp_free_EOS_DI (PTPCanonEOSDeviceInfo *di) { free (di->EventsSupported); free (di->DevicePropertiesSupported); free (di->unk); } /* ObjectHandles array pack/unpack */ #define PTP_oh 0 static inline void ptp_unpack_OH (PTPParams *params, unsigned char* data, PTPObjectHandles *oh, unsigned int len) { if (len) { oh->n = ptp_unpack_uint32_t_array(params, data, PTP_oh, &oh->Handler); } else { oh->n = 0; oh->Handler = NULL; } } /* StoreIDs array pack/unpack */ #define PTP_sids 0 static inline void ptp_unpack_SIDs (PTPParams *params, unsigned char* data, PTPStorageIDs *sids, unsigned int len) { if (!data || !len) { sids->n = 0; sids->Storage = NULL; return; } sids->n = ptp_unpack_uint32_t_array(params, data, PTP_sids, &sids->Storage); } /* StorageInfo pack/unpack */ #define PTP_si_StorageType 0 #define PTP_si_FilesystemType 2 #define PTP_si_AccessCapability 4 #define PTP_si_MaxCapability 6 #define PTP_si_FreeSpaceInBytes 14 #define PTP_si_FreeSpaceInImages 22 #define PTP_si_StorageDescription 26 static inline void ptp_unpack_SI (PTPParams *params, unsigned char* data, PTPStorageInfo *si, unsigned int len) { uint8_t storagedescriptionlen; si->StorageType=dtoh16a(&data[PTP_si_StorageType]); si->FilesystemType=dtoh16a(&data[PTP_si_FilesystemType]); si->AccessCapability=dtoh16a(&data[PTP_si_AccessCapability]); si->MaxCapability=dtoh64a(&data[PTP_si_MaxCapability]); si->FreeSpaceInBytes=dtoh64a(&data[PTP_si_FreeSpaceInBytes]); si->FreeSpaceInImages=dtoh32a(&data[PTP_si_FreeSpaceInImages]); si->StorageDescription=ptp_unpack_string(params, data, PTP_si_StorageDescription, &storagedescriptionlen); si->VolumeLabel=ptp_unpack_string(params, data, PTP_si_StorageDescription+storagedescriptionlen*2+1, &storagedescriptionlen); } /* ObjectInfo pack/unpack */ #define PTP_oi_StorageID 0 #define PTP_oi_ObjectFormat 4 #define PTP_oi_ProtectionStatus 6 #define PTP_oi_ObjectCompressedSize 8 #define PTP_oi_ThumbFormat 12 #define PTP_oi_ThumbCompressedSize 14 #define PTP_oi_ThumbPixWidth 18 #define PTP_oi_ThumbPixHeight 22 #define PTP_oi_ImagePixWidth 26 #define PTP_oi_ImagePixHeight 30 #define PTP_oi_ImageBitDepth 34 #define PTP_oi_ParentObject 38 #define PTP_oi_AssociationType 42 #define PTP_oi_AssociationDesc 44 #define PTP_oi_SequenceNumber 48 #define PTP_oi_filenamelen 52 #define PTP_oi_Filename 53 /* the max length assuming zero length dates. We have need 3 */ /* bytes for these. */ #define PTP_oi_MaxLen PTP_oi_Filename+(PTP_MAXSTRLEN+1)*2+3 static inline uint32_t ptp_pack_OI (PTPParams *params, PTPObjectInfo *oi, unsigned char** oidataptr) { unsigned char* oidata; uint8_t filenamelen; uint8_t capturedatelen=0; /* let's allocate some memory first; correct assuming zero length dates */ oidata=malloc(PTP_oi_MaxLen + params->ocs64*4); *oidataptr=oidata; /* the caller should free it after use! */ #if 0 char *capture_date="20020101T010101"; /* XXX Fake date */ #endif memset (oidata, 0, PTP_oi_MaxLen + params->ocs64*4); htod32a(&oidata[PTP_oi_StorageID],oi->StorageID); htod16a(&oidata[PTP_oi_ObjectFormat],oi->ObjectFormat); htod16a(&oidata[PTP_oi_ProtectionStatus],oi->ProtectionStatus); htod32a(&oidata[PTP_oi_ObjectCompressedSize],oi->ObjectCompressedSize); if (params->ocs64) oidata += 4; htod16a(&oidata[PTP_oi_ThumbFormat],oi->ThumbFormat); htod32a(&oidata[PTP_oi_ThumbCompressedSize],oi->ThumbCompressedSize); htod32a(&oidata[PTP_oi_ThumbPixWidth],oi->ThumbPixWidth); htod32a(&oidata[PTP_oi_ThumbPixHeight],oi->ThumbPixHeight); htod32a(&oidata[PTP_oi_ImagePixWidth],oi->ImagePixWidth); htod32a(&oidata[PTP_oi_ImagePixHeight],oi->ImagePixHeight); htod32a(&oidata[PTP_oi_ImageBitDepth],oi->ImageBitDepth); htod32a(&oidata[PTP_oi_ParentObject],oi->ParentObject); htod16a(&oidata[PTP_oi_AssociationType],oi->AssociationType); htod32a(&oidata[PTP_oi_AssociationDesc],oi->AssociationDesc); htod32a(&oidata[PTP_oi_SequenceNumber],oi->SequenceNumber); ptp_pack_string(params, oi->Filename, oidata, PTP_oi_filenamelen, &filenamelen); /* filenamelen=(uint8_t)strlen(oi->Filename); htod8a(&req->data[PTP_oi_filenamelen],filenamelen+1); for (i=0;idata[PTP_oi_Filename+i*2]=oi->Filename[i]; } */ /* *XXX Fake date. * for example Kodak sets Capture date on the basis of EXIF data. * Spec says that this field is from perspective of Initiator. */ #if 0 /* seems now we don't need any data packed in OI dataset... for now ;)*/ capturedatelen=strlen(capture_date); htod8a(&data[PTP_oi_Filename+(filenamelen+1)*2], capturedatelen+1); for (i=0;iocs64*4; } static time_t ptp_unpack_PTPTIME (const char *str) { char ptpdate[40]; char tmp[5]; size_t ptpdatelen; struct tm tm; if (!str) return 0; ptpdatelen = strlen(str); if (ptpdatelen >= sizeof (ptpdate)) { /*ptp_debug (params ,"datelen is larger then size of buffer", ptpdatelen, (int)sizeof(ptpdate));*/ return 0; } if (ptpdatelen<15) { /*ptp_debug (params ,"datelen is less than 15 (%d)", ptpdatelen);*/ return 0; } strncpy (ptpdate, str, sizeof(ptpdate)); ptpdate[sizeof(ptpdate) - 1] = '\0'; memset(&tm,0,sizeof(tm)); strncpy (tmp, ptpdate, 4); tmp[4] = 0; tm.tm_year=atoi (tmp) - 1900; strncpy (tmp, ptpdate + 4, 2); tmp[2] = 0; tm.tm_mon = atoi (tmp) - 1; strncpy (tmp, ptpdate + 6, 2); tmp[2] = 0; tm.tm_mday = atoi (tmp); strncpy (tmp, ptpdate + 9, 2); tmp[2] = 0; tm.tm_hour = atoi (tmp); strncpy (tmp, ptpdate + 11, 2); tmp[2] = 0; tm.tm_min = atoi (tmp); strncpy (tmp, ptpdate + 13, 2); tmp[2] = 0; tm.tm_sec = atoi (tmp); tm.tm_isdst = -1; return mktime (&tm); } static inline void ptp_unpack_OI (PTPParams *params, unsigned char* data, PTPObjectInfo *oi, unsigned int len) { uint8_t filenamelen; uint8_t capturedatelen; char *capture_date; oi->StorageID=dtoh32a(&data[PTP_oi_StorageID]); oi->ObjectFormat=dtoh16a(&data[PTP_oi_ObjectFormat]); oi->ProtectionStatus=dtoh16a(&data[PTP_oi_ProtectionStatus]); oi->ObjectCompressedSize=dtoh32a(&data[PTP_oi_ObjectCompressedSize]); /* Stupid Samsung Galaxy developers emit a 64bit objectcompressedsize */ if ((data[PTP_oi_filenamelen] == 0) && (data[PTP_oi_filenamelen+4] != 0)) { params->ocs64 = 1; data += 4; } oi->ThumbFormat=dtoh16a(&data[PTP_oi_ThumbFormat]); oi->ThumbCompressedSize=dtoh32a(&data[PTP_oi_ThumbCompressedSize]); oi->ThumbPixWidth=dtoh32a(&data[PTP_oi_ThumbPixWidth]); oi->ThumbPixHeight=dtoh32a(&data[PTP_oi_ThumbPixHeight]); oi->ImagePixWidth=dtoh32a(&data[PTP_oi_ImagePixWidth]); oi->ImagePixHeight=dtoh32a(&data[PTP_oi_ImagePixHeight]); oi->ImageBitDepth=dtoh32a(&data[PTP_oi_ImageBitDepth]); oi->ParentObject=dtoh32a(&data[PTP_oi_ParentObject]); oi->AssociationType=dtoh16a(&data[PTP_oi_AssociationType]); oi->AssociationDesc=dtoh32a(&data[PTP_oi_AssociationDesc]); oi->SequenceNumber=dtoh32a(&data[PTP_oi_SequenceNumber]); oi->Filename= ptp_unpack_string(params, data, PTP_oi_filenamelen, &filenamelen); capture_date = ptp_unpack_string(params, data, PTP_oi_filenamelen+filenamelen*2+1, &capturedatelen); /* subset of ISO 8601, without '.s' tenths of second and * time zone */ oi->CaptureDate = ptp_unpack_PTPTIME(capture_date); free(capture_date); /* now the modification date ... */ capture_date = ptp_unpack_string(params, data, PTP_oi_filenamelen+filenamelen*2 +capturedatelen*2+2,&capturedatelen); oi->ModificationDate = ptp_unpack_PTPTIME(capture_date); free(capture_date); } /* Custom Type Value Assignement (without Length) macro frequently used below */ #define CTVAL(target,func) { \ if (total - *offset < sizeof(target)) \ return 0; \ target = func(&data[*offset]); \ *offset += sizeof(target); \ } #define RARR(val,member,func) { \ unsigned int n,j; \ if (total - *offset < sizeof(uint32_t)) \ return 0; \ n = dtoh32a (&data[*offset]); \ *offset += sizeof(uint32_t); \ \ if (n >= UINT_MAX/sizeof(val->a.v[0])) \ return 0; \ val->a.count = n; \ val->a.v = malloc(sizeof(val->a.v[0])*n); \ if (!val->a.v) return 0; \ for (j=0;ja.v[j].member, func); \ } static inline unsigned int ptp_unpack_DPV ( PTPParams *params, unsigned char* data, unsigned int *offset, int total, PTPPropertyValue* value, uint16_t datatype ) { switch (datatype) { case PTP_DTC_INT8: CTVAL(value->i8,dtoh8a); break; case PTP_DTC_UINT8: CTVAL(value->u8,dtoh8a); break; case PTP_DTC_INT16: CTVAL(value->i16,dtoh16a); break; case PTP_DTC_UINT16: CTVAL(value->u16,dtoh16a); break; case PTP_DTC_INT32: CTVAL(value->i32,dtoh32a); break; case PTP_DTC_UINT32: CTVAL(value->u32,dtoh32a); break; case PTP_DTC_INT64: CTVAL(value->i64,dtoh64a); break; case PTP_DTC_UINT64: CTVAL(value->u64,dtoh64a); break; case PTP_DTC_UINT128: *offset += 16; /*fprintf(stderr,"unhandled unpack of uint128n");*/ break; case PTP_DTC_INT128: *offset += 16; /*fprintf(stderr,"unhandled unpack of int128n");*/ break; case PTP_DTC_AINT8: RARR(value,i8,dtoh8a); break; case PTP_DTC_AUINT8: RARR(value,u8,dtoh8a); break; case PTP_DTC_AUINT16: RARR(value,u16,dtoh16a); break; case PTP_DTC_AINT16: RARR(value,i16,dtoh16a); break; case PTP_DTC_AUINT32: RARR(value,u32,dtoh32a); break; case PTP_DTC_AINT32: RARR(value,i32,dtoh32a); break; case PTP_DTC_AUINT64: RARR(value,u64,dtoh64a); break; case PTP_DTC_AINT64: RARR(value,i64,dtoh64a); break; /* XXX: other int types are unimplemented */ /* XXX: other int arrays are unimplemented also */ case PTP_DTC_STR: { uint8_t len; /* XXX: max size */ value->str = ptp_unpack_string(params,data,*offset,&len); *offset += len*2+1; if (!value->str) return 1; break; } default: return 0; } return 1; } /* Device Property pack/unpack */ #define PTP_dpd_DevicePropertyCode 0 #define PTP_dpd_DataType 2 #define PTP_dpd_GetSet 4 #define PTP_dpd_FactoryDefaultValue 5 static inline int ptp_unpack_DPD (PTPParams *params, unsigned char* data, PTPDevicePropDesc *dpd, unsigned int dpdlen) { unsigned int offset = 0, ret; memset (dpd, 0, sizeof(*dpd)); dpd->DevicePropertyCode=dtoh16a(&data[PTP_dpd_DevicePropertyCode]); dpd->DataType=dtoh16a(&data[PTP_dpd_DataType]); dpd->GetSet=dtoh8a(&data[PTP_dpd_GetSet]); dpd->FormFlag=PTP_DPFF_None; offset = PTP_dpd_FactoryDefaultValue; ret = ptp_unpack_DPV (params, data, &offset, dpdlen, &dpd->FactoryDefaultValue, dpd->DataType); if (!ret) goto outofmemory; if ((dpd->DataType == PTP_DTC_STR) && (offset == dpdlen)) return 1; ret = ptp_unpack_DPV (params, data, &offset, dpdlen, &dpd->CurrentValue, dpd->DataType); if (!ret) goto outofmemory; /* if offset==0 then Data Type format is not supported by this code or the Data Type is a string (with two empty strings as values). In both cases Form Flag should be set to 0x00 and FORM is not present. */ if (offset==PTP_dpd_FactoryDefaultValue) return 1; dpd->FormFlag=dtoh8a(&data[offset]); offset+=sizeof(uint8_t); switch (dpd->FormFlag) { case PTP_DPFF_Range: ret = ptp_unpack_DPV (params, data, &offset, dpdlen, &dpd->FORM.Range.MinimumValue, dpd->DataType); if (!ret) goto outofmemory; ret = ptp_unpack_DPV (params, data, &offset, dpdlen, &dpd->FORM.Range.MaximumValue, dpd->DataType); if (!ret) goto outofmemory; ret = ptp_unpack_DPV (params, data, &offset, dpdlen, &dpd->FORM.Range.StepSize, dpd->DataType); if (!ret) goto outofmemory; break; case PTP_DPFF_Enumeration: { int i; #define N dpd->FORM.Enum.NumberOfValues N = dtoh16a(&data[offset]); offset+=sizeof(uint16_t); dpd->FORM.Enum.SupportedValue = malloc(N*sizeof(dpd->FORM.Enum.SupportedValue[0])); if (!dpd->FORM.Enum.SupportedValue) goto outofmemory; memset (dpd->FORM.Enum.SupportedValue,0 , N*sizeof(dpd->FORM.Enum.SupportedValue[0])); for (i=0;iFORM.Enum.SupportedValue[i], dpd->DataType); /* Slightly different handling here. The HP PhotoSmart 120 * specifies an enumeration with N in wrong endian * 00 01 instead of 01 00, so we count the enum just until the * the end of the packet. */ if (!ret) { if (!i) goto outofmemory; dpd->FORM.Enum.NumberOfValues = i; break; } } } } #undef N return 1; outofmemory: ptp_free_devicepropdesc(dpd); return 0; } /* Device Property pack/unpack */ #define PTP_dpd_Sony_DevicePropertyCode 0 #define PTP_dpd_Sony_DataType 2 #define PTP_dpd_Sony_GetSet 4 #define PTP_dpd_Sony_Unknown 5 #define PTP_dpd_Sony_FactoryDefaultValue 6 static inline int ptp_unpack_Sony_DPD (PTPParams *params, unsigned char* data, PTPDevicePropDesc *dpd, unsigned int dpdlen, unsigned int *poffset) { unsigned int ret; memset (dpd, 0, sizeof(*dpd)); dpd->DevicePropertyCode=dtoh16a(&data[PTP_dpd_Sony_DevicePropertyCode]); dpd->DataType=dtoh16a(&data[PTP_dpd_Sony_DataType]); #if 0 dpd->GetSet=dtoh8a(&data[PTP_dpd_Sony_GetSet]); #endif dpd->GetSet=1; dpd->FormFlag=PTP_DPFF_None; *poffset = PTP_dpd_Sony_FactoryDefaultValue; ret = ptp_unpack_DPV (params, data, poffset, dpdlen, &dpd->FactoryDefaultValue, dpd->DataType); if (!ret) goto outofmemory; if ((dpd->DataType == PTP_DTC_STR) && (*poffset == dpdlen)) return 1; ret = ptp_unpack_DPV (params, data, poffset, dpdlen, &dpd->CurrentValue, dpd->DataType); if (!ret) goto outofmemory; /* if offset==0 then Data Type format is not supported by this code or the Data Type is a string (with two empty strings as values). In both cases Form Flag should be set to 0x00 and FORM is not present. */ if (*poffset==PTP_dpd_Sony_FactoryDefaultValue) return 1; dpd->FormFlag=dtoh8a(&data[*poffset]); *poffset+=sizeof(uint8_t); switch (dpd->FormFlag) { case PTP_DPFF_Range: ret = ptp_unpack_DPV (params, data, poffset, dpdlen, &dpd->FORM.Range.MinimumValue, dpd->DataType); if (!ret) goto outofmemory; ret = ptp_unpack_DPV (params, data, poffset, dpdlen, &dpd->FORM.Range.MaximumValue, dpd->DataType); if (!ret) goto outofmemory; ret = ptp_unpack_DPV (params, data, poffset, dpdlen, &dpd->FORM.Range.StepSize, dpd->DataType); if (!ret) goto outofmemory; break; case PTP_DPFF_Enumeration: { int i; #define N dpd->FORM.Enum.NumberOfValues N = dtoh16a(&data[*poffset]); *poffset+=sizeof(uint16_t); dpd->FORM.Enum.SupportedValue = malloc(N*sizeof(dpd->FORM.Enum.SupportedValue[0])); if (!dpd->FORM.Enum.SupportedValue) goto outofmemory; memset (dpd->FORM.Enum.SupportedValue,0 , N*sizeof(dpd->FORM.Enum.SupportedValue[0])); for (i=0;iFORM.Enum.SupportedValue[i], dpd->DataType); /* Slightly different handling here. The HP PhotoSmart 120 * specifies an enumeration with N in wrong endian * 00 01 instead of 01 00, so we count the enum just until the * the end of the packet. */ if (!ret) { if (!i) goto outofmemory; dpd->FORM.Enum.NumberOfValues = i; break; } } } } #undef N return 1; outofmemory: ptp_free_devicepropdesc(dpd); return 0; } static inline void duplicate_PropertyValue (const PTPPropertyValue *src, PTPPropertyValue *dst, uint16_t type) { if (type == PTP_DTC_STR) { if (src->str) dst->str = strdup(src->str); else dst->str = NULL; return; } if (type & PTP_DTC_ARRAY_MASK) { unsigned int i; dst->a.count = src->a.count; dst->a.v = malloc (sizeof(src->a.v[0])*src->a.count); for (i=0;ia.count;i++) duplicate_PropertyValue (&src->a.v[i], &dst->a.v[i], type & ~PTP_DTC_ARRAY_MASK); return; } switch (type & ~PTP_DTC_ARRAY_MASK) { case PTP_DTC_INT8: dst->i8 = src->i8; break; case PTP_DTC_UINT8: dst->u8 = src->u8; break; case PTP_DTC_INT16: dst->i16 = src->i16; break; case PTP_DTC_UINT16: dst->u16 = src->u16; break; case PTP_DTC_INT32: dst->i32 = src->i32; break; case PTP_DTC_UINT32: dst->u32 = src->u32; break; case PTP_DTC_UINT64: dst->u64 = src->u64; break; case PTP_DTC_INT64: dst->i64 = src->i64; break; #if 0 case PTP_DTC_INT128: dst->i128 = src->i128; break; case PTP_DTC_UINT128: dst->u128 = src->u128; break; #endif default: break; } return; } static inline void duplicate_DevicePropDesc(const PTPDevicePropDesc *src, PTPDevicePropDesc *dst) { int i; dst->DevicePropertyCode = src->DevicePropertyCode; dst->DataType = src->DataType; dst->GetSet = src->GetSet; duplicate_PropertyValue (&src->FactoryDefaultValue, &dst->FactoryDefaultValue, src->DataType); duplicate_PropertyValue (&src->CurrentValue, &dst->CurrentValue, src->DataType); dst->FormFlag = src->FormFlag; switch (src->FormFlag) { case PTP_DPFF_Range: duplicate_PropertyValue (&src->FORM.Range.MinimumValue, &dst->FORM.Range.MinimumValue, src->DataType); duplicate_PropertyValue (&src->FORM.Range.MaximumValue, &dst->FORM.Range.MaximumValue, src->DataType); duplicate_PropertyValue (&src->FORM.Range.StepSize, &dst->FORM.Range.StepSize, src->DataType); break; case PTP_DPFF_Enumeration: dst->FORM.Enum.NumberOfValues = src->FORM.Enum.NumberOfValues; dst->FORM.Enum.SupportedValue = malloc (sizeof(dst->FORM.Enum.SupportedValue[0])*src->FORM.Enum.NumberOfValues); for (i = 0; iFORM.Enum.NumberOfValues ; i++) duplicate_PropertyValue (&src->FORM.Enum.SupportedValue[i], &dst->FORM.Enum.SupportedValue[i], src->DataType); break; case PTP_DPFF_None: break; } } #define PTP_opd_ObjectPropertyCode 0 #define PTP_opd_DataType 2 #define PTP_opd_GetSet 4 #define PTP_opd_FactoryDefaultValue 5 static inline int ptp_unpack_OPD (PTPParams *params, unsigned char* data, PTPObjectPropDesc *opd, unsigned int opdlen) { unsigned int offset=0, ret; memset (opd, 0, sizeof(*opd)); opd->ObjectPropertyCode=dtoh16a(&data[PTP_opd_ObjectPropertyCode]); opd->DataType=dtoh16a(&data[PTP_opd_DataType]); opd->GetSet=dtoh8a(&data[PTP_opd_GetSet]); offset = PTP_opd_FactoryDefaultValue; ret = ptp_unpack_DPV (params, data, &offset, opdlen, &opd->FactoryDefaultValue, opd->DataType); if (!ret) goto outofmemory; opd->GroupCode=dtoh32a(&data[offset]); offset+=sizeof(uint32_t); opd->FormFlag=dtoh8a(&data[offset]); offset+=sizeof(uint8_t); switch (opd->FormFlag) { case PTP_OPFF_Range: ret = ptp_unpack_DPV (params, data, &offset, opdlen, &opd->FORM.Range.MinimumValue, opd->DataType); if (!ret) goto outofmemory; ret = ptp_unpack_DPV (params, data, &offset, opdlen, &opd->FORM.Range.MaximumValue, opd->DataType); if (!ret) goto outofmemory; ret = ptp_unpack_DPV (params, data, &offset, opdlen, &opd->FORM.Range.StepSize, opd->DataType); if (!ret) goto outofmemory; break; case PTP_OPFF_Enumeration: { unsigned int i; #define N opd->FORM.Enum.NumberOfValues N = dtoh16a(&data[offset]); offset+=sizeof(uint16_t); opd->FORM.Enum.SupportedValue = malloc(N*sizeof(opd->FORM.Enum.SupportedValue[0])); if (!opd->FORM.Enum.SupportedValue) goto outofmemory; memset (opd->FORM.Enum.SupportedValue,0 , N*sizeof(opd->FORM.Enum.SupportedValue[0])); for (i=0;iFORM.Enum.SupportedValue[i], opd->DataType); /* Slightly different handling here. The HP PhotoSmart 120 * specifies an enumeration with N in wrong endian * 00 01 instead of 01 00, so we count the enum just until the * the end of the packet. */ if (!ret) { if (!i) goto outofmemory; opd->FORM.Enum.NumberOfValues = i; break; } } #undef N } } return 1; outofmemory: ptp_free_objectpropdesc(opd); return 0; } static inline uint32_t ptp_pack_DPV (PTPParams *params, PTPPropertyValue* value, unsigned char** dpvptr, uint16_t datatype) { unsigned char* dpv=NULL; uint32_t size=0; unsigned int i; switch (datatype) { case PTP_DTC_INT8: size=sizeof(int8_t); dpv=malloc(size); htod8a(dpv,value->i8); break; case PTP_DTC_UINT8: size=sizeof(uint8_t); dpv=malloc(size); htod8a(dpv,value->u8); break; case PTP_DTC_INT16: size=sizeof(int16_t); dpv=malloc(size); htod16a(dpv,value->i16); break; case PTP_DTC_UINT16: size=sizeof(uint16_t); dpv=malloc(size); htod16a(dpv,value->u16); break; case PTP_DTC_INT32: size=sizeof(int32_t); dpv=malloc(size); htod32a(dpv,value->i32); break; case PTP_DTC_UINT32: size=sizeof(uint32_t); dpv=malloc(size); htod32a(dpv,value->u32); break; case PTP_DTC_INT64: size=sizeof(int64_t); dpv=malloc(size); htod64a(dpv,value->i64); break; case PTP_DTC_UINT64: size=sizeof(uint64_t); dpv=malloc(size); htod64a(dpv,value->u64); break; case PTP_DTC_AUINT8: size=sizeof(uint32_t)+value->a.count*sizeof(uint8_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod8a(&dpv[sizeof(uint32_t)+i*sizeof(uint8_t)],value->a.v[i].u8); break; case PTP_DTC_AINT8: size=sizeof(uint32_t)+value->a.count*sizeof(int8_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod8a(&dpv[sizeof(uint32_t)+i*sizeof(int8_t)],value->a.v[i].i8); break; case PTP_DTC_AUINT16: size=sizeof(uint32_t)+value->a.count*sizeof(uint16_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod16a(&dpv[sizeof(uint32_t)+i*sizeof(uint16_t)],value->a.v[i].u16); break; case PTP_DTC_AINT16: size=sizeof(uint32_t)+value->a.count*sizeof(int16_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod16a(&dpv[sizeof(uint32_t)+i*sizeof(int16_t)],value->a.v[i].i16); break; case PTP_DTC_AUINT32: size=sizeof(uint32_t)+value->a.count*sizeof(uint32_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod32a(&dpv[sizeof(uint32_t)+i*sizeof(uint32_t)],value->a.v[i].u32); break; case PTP_DTC_AINT32: size=sizeof(uint32_t)+value->a.count*sizeof(int32_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod32a(&dpv[sizeof(uint32_t)+i*sizeof(int32_t)],value->a.v[i].i32); break; case PTP_DTC_AUINT64: size=sizeof(uint32_t)+value->a.count*sizeof(uint64_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod64a(&dpv[sizeof(uint32_t)+i*sizeof(uint64_t)],value->a.v[i].u64); break; case PTP_DTC_AINT64: size=sizeof(uint32_t)+value->a.count*sizeof(int64_t); dpv=malloc(size); htod32a(dpv,value->a.count); for (i=0;ia.count;i++) htod64a(&dpv[sizeof(uint32_t)+i*sizeof(int64_t)],value->a.v[i].i64); break; /* XXX: other int types are unimplemented */ case PTP_DTC_STR: { dpv=ptp_get_packed_stringcopy(params, value->str, &size); break; } } *dpvptr=dpv; return size; } #define MAX_MTP_PROPS 127 static inline uint32_t ptp_pack_OPL (PTPParams *params, MTPProperties *props, int nrofprops, unsigned char** opldataptr) { unsigned char* opldata; MTPProperties *propitr; unsigned char *packedprops[MAX_MTP_PROPS]; uint32_t packedpropslens[MAX_MTP_PROPS]; uint32_t packedobjecthandles[MAX_MTP_PROPS]; uint16_t packedpropsids[MAX_MTP_PROPS]; uint16_t packedpropstypes[MAX_MTP_PROPS]; uint32_t totalsize = 0; uint32_t bufp = 0; uint32_t noitems = 0; uint32_t i; totalsize = sizeof(uint32_t); /* 4 bytes to store the number of elements */ propitr = props; while (nrofprops-- && noitems < MAX_MTP_PROPS) { /* Object Handle */ packedobjecthandles[noitems]=propitr->ObjectHandle; totalsize += sizeof(uint32_t); /* Object ID */ /* Metadata type */ packedpropsids[noitems]=propitr->property; totalsize += sizeof(uint16_t); /* Data type */ packedpropstypes[noitems]= propitr->datatype; totalsize += sizeof(uint16_t); /* Add each property to be sent. */ packedpropslens[noitems] = ptp_pack_DPV (params, &propitr->propval, &packedprops[noitems], propitr->datatype); totalsize += packedpropslens[noitems]; noitems ++; propitr ++; } /* Allocate memory for the packed property list */ opldata = malloc(totalsize); htod32a(&opldata[bufp],noitems); bufp += 4; /* Copy into a nice packed list */ for (i = 0; i < noitems; i++) { /* Object ID */ htod32a(&opldata[bufp],packedobjecthandles[i]); bufp += sizeof(uint32_t); htod16a(&opldata[bufp],packedpropsids[i]); bufp += sizeof(uint16_t); htod16a(&opldata[bufp],packedpropstypes[i]); bufp += sizeof(uint16_t); /* The copy the actual property */ memcpy(&opldata[bufp], packedprops[i], packedpropslens[i]); bufp += packedpropslens[i]; free(packedprops[i]); } *opldataptr = opldata; return totalsize; } static int _compare_func(const void* x, const void *y) { const MTPProperties *px = x; const MTPProperties *py = y; return px->ObjectHandle - py->ObjectHandle; } static inline int ptp_unpack_OPL (PTPParams *params, unsigned char* data, MTPProperties **pprops, unsigned int len) { uint32_t prop_count = dtoh32a(data); MTPProperties *props = NULL; unsigned int offset = 0, i; if (prop_count == 0) { *pprops = NULL; return 0; } ptp_debug (params ,"Unpacking MTP OPL, size %d (prop_count %d)", len, prop_count); data += sizeof(uint32_t); len -= sizeof(uint32_t); props = malloc(prop_count * sizeof(MTPProperties)); if (!props) return 0; for (i = 0; i < prop_count; i++) { if (len <= 0) { ptp_debug (params ,"short MTP Object Property List at property %d (of %d)", i, prop_count); ptp_debug (params ,"device probably needs DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL", i); ptp_debug (params ,"or even DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST", i); qsort (props, i, sizeof(MTPProperties),_compare_func); *pprops = props; return i; } props[i].ObjectHandle = dtoh32a(data); data += sizeof(uint32_t); len -= sizeof(uint32_t); props[i].property = dtoh16a(data); data += sizeof(uint16_t); len -= sizeof(uint16_t); props[i].datatype = dtoh16a(data); data += sizeof(uint16_t); len -= sizeof(uint16_t); offset = 0; ptp_unpack_DPV(params, data, &offset, len, &props[i].propval, props[i].datatype); data += offset; len -= offset; } qsort (props, prop_count, sizeof(MTPProperties),_compare_func); *pprops = props; return prop_count; } /* PTP USB Event container unpack Copyright (c) 2003 Nikolai Kopanygin */ #define PTP_ec_Length 0 #define PTP_ec_Type 4 #define PTP_ec_Code 6 #define PTP_ec_TransId 8 #define PTP_ec_Param1 12 #define PTP_ec_Param2 16 #define PTP_ec_Param3 20 static inline void ptp_unpack_EC (PTPParams *params, unsigned char* data, PTPContainer *ec, unsigned int len) { unsigned int length; int type; if (data==NULL) return; memset(ec,0,sizeof(*ec)); length=dtoh32a(&data[PTP_ec_Length]); if (length > len) { ptp_debug (params, "length %d in container, but data only %d bytes?!", length, len); return; } type = dtoh16a(&data[PTP_ec_Type]); ec->Code=dtoh16a(&data[PTP_ec_Code]); ec->Transaction_ID=dtoh32a(&data[PTP_ec_TransId]); if (type!=PTP_USB_CONTAINER_EVENT) { ptp_debug (params, "Unknown canon event type %d (code=%x,tid=%x), please report!",type,ec->Code,ec->Transaction_ID); return; } if (length>=(PTP_ec_Param1+4)) { ec->Param1=dtoh32a(&data[PTP_ec_Param1]); ec->Nparam=1; } if (length>=(PTP_ec_Param2+4)) { ec->Param2=dtoh32a(&data[PTP_ec_Param2]); ec->Nparam=2; } if (length>=(PTP_ec_Param3+4)) { ec->Param3=dtoh32a(&data[PTP_ec_Param3]); ec->Nparam=3; } } /* PTP Canon Folder Entry unpack Copyright (c) 2003 Nikolai Kopanygin */ #define PTP_cfe_ObjectHandle 0 #define PTP_cfe_ObjectFormatCode 4 #define PTP_cfe_Flags 6 #define PTP_cfe_ObjectSize 7 #define PTP_cfe_Time 11 #define PTP_cfe_Filename 15 static inline void ptp_unpack_Canon_FE (PTPParams *params, unsigned char* data, PTPCANONFolderEntry *fe) { int i; if (data==NULL) return; fe->ObjectHandle=dtoh32a(&data[PTP_cfe_ObjectHandle]); fe->ObjectFormatCode=dtoh16a(&data[PTP_cfe_ObjectFormatCode]); fe->Flags=dtoh8a(&data[PTP_cfe_Flags]); fe->ObjectSize=dtoh32a((unsigned char*)&data[PTP_cfe_ObjectSize]); fe->Time=(time_t)dtoh32a(&data[PTP_cfe_Time]); for (i=0; iFilename[i]=(char)dtoh8a(&data[PTP_cfe_Filename+i]); } /* PTP Canon EOS Folder Entry unpack 0: 00 00 08 a0 objectid 4: 01 00 02 00 storageid 8: 01 30 00 00 ofc 12: 01 00 14: 00 00 16: 11 00 00 00 20: 00 00 00 00 24: 00 00 00 80 28: 00 00 08 a0 32: 4d 49 53 43-00 00 00 00 00 00 00 00 name 00 00 00 00 84 bc 74 46 objectime (normal PTP GetObjectInfo) ObjectInfo for 'IMG_0199.JPG': Object ID: 0x92740c72 StorageID: 0x00020001 ObjectFormat: 0x3801 ProtectionStatus: 0x0000 ObjectCompressedSize: 2217241 ThumbFormat: 0x3808 ThumbCompressedSize: 5122 ThumbPixWidth: 160 ThumbPixHeight: 120 ImagePixWidth: 4000 ImagePixHeight: 3000 ImageBitDepth: 24 ParentObject: 0x92740000 AssociationType: 0x0000 AssociationDesc: 0x00000000 SequenceNumber: 0x00000000 ModificationDate: 0x4d985ff0 CaptureDate: 0x4d985ff0 0010 38 00 00 00 Size of this entry 0014 72 0c 74 92 OID 0018 01 00 02 00 StorageID 001c 01 38 00 00 OFC 0020 00 00 00 00 00 00 00 00 ? 0028 19 d5 21 00 Size 002c 00 00 74 92 ? 0030 70 0c 74 92 OID 0034 49 4d 47 5f-30 31 39 39 2e 4a 50 47 IMG_0199.JPG 0040 00 00 00 00 0044 10 7c 98 4d Time */ #define PTP_cefe_ObjectHandle 0 #define PTP_cefe_StorageID 4 #define PTP_cefe_ObjectFormatCode 8 #define PTP_cefe_Flags 12 #define PTP_cefe_ObjectSize 20 #define PTP_cefe_Filename 32 #define PTP_cefe_Time 48 static inline void ptp_unpack_Canon_EOS_FE (PTPParams *params, unsigned char* data, PTPCANONFolderEntry *fe) { int i; fe->ObjectHandle=dtoh32a(&data[PTP_cefe_ObjectHandle]); fe->ObjectFormatCode=dtoh16a(&data[PTP_cefe_ObjectFormatCode]); fe->Flags=dtoh8a(&data[PTP_cefe_Flags]); fe->ObjectSize=dtoh32a((unsigned char*)&data[PTP_cefe_ObjectSize]); fe->Time=(time_t)dtoh32a(&data[PTP_cefe_Time]); for (i=0; iFilename[i]=(char)data[PTP_cefe_Filename+i]; } static inline uint16_t ptp_unpack_EOS_ImageFormat (PTPParams* params, unsigned char** data ) { /* EOS ImageFormat entries (of at least the 5DM2 and the 400D) look like this: uint32: number of entries / generated files (1 or 2) uint32: size of this entry in bytes (most likely allways 0x10) uint32: image type (1 == JPG, 6 == RAW) uint32: image size (0 == Large, 1 == Medium, 2 == Small, 0xe == S1, 0xf == S2, 0x10 == S3) uint32: image compression (2 == Standard/JPG, 3 == Fine/JPG, 4 == Lossles/RAW) If the number of entries is 2 the last 4 uint32 repeat. example: 0: 0x 1 1: 0x 10 2: 0x 6 3: 0x 1 4: 0x 4 The idea is to simply 'condense' these values to just one uint16 to be able to conveniently use the available enumeration facilities (look-up table). The image size and compression values fully describe the image format. Hence we generate a uint16 with the four nibles set as follows: entry 1 size | entry 1 compression | entry 2 size | entry 2 compression. The above example would result in the value 0x1400. The EOS 5D Mark III (and possibly other high-end EOS as well) added the extra fancy S1, S2 and S3 JPEG options. S1 replaces the old Small. -1 the S1/S2/S3 to prevent the 0x10 overflow. */ const unsigned char* d = *data; uint32_t n = dtoh32a( d ); uint32_t l, s1, c1, s2 = 0, c2 = 0; if (n != 1 && n !=2) { ptp_debug (params, "parsing EOS ImageFormat property failed (n != 1 && n != 2: %d)", n); return 0; } l = dtoh32a( d+=4 ); if (l != 0x10) { ptp_debug (params, "parsing EOS ImageFormat property failed (l != 0x10: 0x%x)", l); return 0; } d+=4; /* skip type */ s1 = dtoh32a( d+=4 ); c1 = dtoh32a( d+=4 ); if (n == 2) { l = dtoh32a( d+=4 ); if (l != 0x10) { ptp_debug (params, "parsing EOS ImageFormat property failed (l != 0x10: 0x%x)", l); return 0; } d+=4; /* skip type */ s2 = dtoh32a( d+=4 ); c2 = dtoh32a( d+=4 ); } *data = (unsigned char*) d+4; /* deal with S1/S2/S3 JPEG sizes, see above. */ if( s1 >= 0xe ) s1--; if( s2 >= 0xe ) s2--; return ((s1 & 0xF) << 12) | ((c1 & 0xF) << 8) | ((s2 & 0xF) << 4) | ((c2 & 0xF) << 0); } static inline uint32_t ptp_pack_EOS_ImageFormat (PTPParams* params, unsigned char* data, uint16_t value) { uint32_t n = (value & 0xFF) ? 2 : 1; uint32_t s = 4 + 0x10 * n; if( !data ) return s; #define PACK_5DM3_SMALL_JPEG_SIZE( X ) (X) >= 0xd ? (X)+1 : (X) htod32a(data+=0, n); htod32a(data+=4, 0x10); htod32a(data+=4, ((value >> 8) & 0xF) == 4 ? 6 : 1); htod32a(data+=4, PACK_5DM3_SMALL_JPEG_SIZE((value >> 12) & 0xF)); htod32a(data+=4, (value >> 8) & 0xF); if (n==2) { htod32a(data+=4, 0x10); htod32a(data+=4, ((value >> 0) & 0xF) == 4 ? 6 : 1); htod32a(data+=4, PACK_5DM3_SMALL_JPEG_SIZE((value >> 4) & 0xF)); htod32a(data+=4, (value >> 0) & 0xF); } #undef PACK_5DM3_SMALL_JPEG_SIZE return s; } static inline char* ptp_unpack_EOS_CustomFuncEx (PTPParams* params, unsigned char** data ) { uint32_t s = dtoh32a( *data ); uint32_t n = s/4, i; char* str = (char*)malloc( s*2+s/4+1 ); /* n is size in uint32, maximum %x len is 8 chars and \0*/ if (!str) return str; char* p = str; for (i=0; i < n; ++i) p += sprintf(p, "%x,", dtoh32a( *data + 4*i )); return str; } static inline uint32_t ptp_pack_EOS_CustomFuncEx (PTPParams* params, unsigned char* data, char* str) { uint32_t s = strtoul(str, NULL, 16); uint32_t n = s/4, i, v; if (!data) return s; for (i=0; inrofcanon_props;j++) if (params->canon_props[j].proptype == proptype) break; if (j==params->nrofcanon_props) { ptp_debug (params, "event %d: propdesc %x, default value not found.", i, proptype); break; } dpd = ¶ms->canon_props[j].dpd; /* 1 - uint16 ? * 3 - uint16 * 7 - string? */ if (propxtype != 3) { ptp_debug (params, "event %d: propxtype is %x for %04x, unhandled.", i, propxtype, proptype); for (j=0;j= 2<<16) /* buggy or exploit */ break; ptp_debug (params, "event %d: propxtype is %x, prop is 0x%04x, data type is 0x%04x, propxcnt is %d.", i, propxtype, proptype, dpd->DataType, propxcnt); dpd->FormFlag = PTP_DPFF_Enumeration; dpd->FORM.Enum.NumberOfValues = propxcnt; if (dpd->FORM.Enum.SupportedValue) free (dpd->FORM.Enum.SupportedValue); dpd->FORM.Enum.SupportedValue = malloc (sizeof (PTPPropertyValue)*propxcnt); switch (proptype) { case PTP_DPC_CANON_EOS_ImageFormat: case PTP_DPC_CANON_EOS_ImageFormatCF: case PTP_DPC_CANON_EOS_ImageFormatSD: case PTP_DPC_CANON_EOS_ImageFormatExtHD: /* special handling of ImageFormat properties */ for (j=0;jFORM.Enum.SupportedValue[j].u16 = ptp_unpack_EOS_ImageFormat( params, &xdata ); ptp_debug (params, "event %d: suppval[%d] of %x is 0x%x.", i, j, proptype, dpd->FORM.Enum.SupportedValue[j].u16); } break; default: /* 'normal' enumerated types */ switch (dpd->DataType) { #define XX( TYPE, CONV )\ for (j=0;jFORM.Enum.SupportedValue[j].TYPE = CONV(xdata); \ ptp_debug (params, "event %d: suppval[%d] of %x is 0x%x.", i, j, proptype, CONV(xdata)); \ xdata += 4; /* might only be for propxtype 3 */ \ } \ break; case PTP_DTC_INT16: XX( i16, dtoh16a ); case PTP_DTC_UINT32: XX( u32, dtoh32a ); case PTP_DTC_UINT16: XX( u16, dtoh16a ); case PTP_DTC_UINT8: XX( u8, dtoh8a ); #undef XX default: ptp_debug (params ,"event %d: data type 0x%04x of %x unhandled, raw values:", i, dpd->DataType, proptype, dtoh32a(xdata)); for (j=0;j<(size-PTP_ece_Prop_Desc_Data)/4;j++, xdata+=4) /* 4 is good for propxtype 3 */ ptp_debug (params, " %3d: 0x%8x", j, dtoh32a(xdata)); break; } } break; } case PTP_EC_CANON_EOS_PropValueChanged: if (size >= 0xc) { /* property info */ unsigned int j; uint32_t proptype = dtoh32a(&curdata[PTP_ece_Prop_Subtype]); unsigned char *xdata = &curdata[PTP_ece_Prop_Val_Data]; PTPDevicePropDesc *dpd; ptp_debug (params, "event %d: EOS prop %04x info record, datasize is %d", i, proptype, size-PTP_ece_Prop_Val_Data); for (j=0;jnrofcanon_props;j++) if (params->canon_props[j].proptype == proptype) break; if (jnrofcanon_props) { if ( (params->canon_props[j].size != size) || (memcmp(params->canon_props[j].data,xdata,size-PTP_ece_Prop_Val_Data))) { params->canon_props[j].data = realloc(params->canon_props[j].data,size-PTP_ece_Prop_Val_Data); memcpy (params->canon_props[j].data,xdata,size-PTP_ece_Prop_Val_Data); } } else { if (j) params->canon_props = realloc(params->canon_props, sizeof(params->canon_props[0])*(j+1)); else params->canon_props = malloc(sizeof(params->canon_props[0])); params->canon_props[j].type = type; params->canon_props[j].proptype = proptype; params->canon_props[j].size = size; params->canon_props[j].data = malloc(size-PTP_ece_Prop_Val_Data); memcpy(params->canon_props[j].data, xdata, size-PTP_ece_Prop_Val_Data); memset (¶ms->canon_props[j].dpd,0,sizeof(params->canon_props[j].dpd)); params->canon_props[j].dpd.GetSet = 1; params->canon_props[j].dpd.FormFlag = PTP_DPFF_None; params->nrofcanon_props = j+1; } dpd = ¶ms->canon_props[j].dpd; ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY; ce[i].u.propid = proptype; /* fix GetSet value */ switch (proptype) { #define XX(x) case PTP_DPC_CANON_##x: XX(EOS_FocusMode) XX(EOS_BatteryPower) XX(EOS_BatterySelect) XX(EOS_ModelID) XX(EOS_PTPExtensionVersion) XX(EOS_DPOFVersion) XX(EOS_AvailableShots) XX(EOS_CurrentStorage) XX(EOS_CurrentFolder) XX(EOS_MyMenu) XX(EOS_MyMenuList) XX(EOS_HDDirectoryStructure) XX(EOS_BatteryInfo) XX(EOS_AdapterInfo) XX(EOS_LensStatus) XX(EOS_CardExtension) XX(EOS_TempStatus) XX(EOS_ShutterCounter) XX(EOS_SerialNumber) XX(EOS_DepthOfFieldPreview) XX(EOS_EVFRecordStatus) XX(EOS_LvAfSystem) XX(EOS_FocusInfoEx) XX(EOS_DepthOfField) XX(EOS_Brightness) XX(EOS_EFComp) XX(EOS_LensName) XX(EOS_LensID) #undef XX dpd->GetSet = PTP_DPGS_Get; break; } /* set DataType */ switch (proptype) { case PTP_DPC_CANON_EOS_CameraTime: case PTP_DPC_CANON_EOS_UTCTime: case PTP_DPC_CANON_EOS_Summertime: /* basical the DST flag */ case PTP_DPC_CANON_EOS_AvailableShots: case PTP_DPC_CANON_EOS_CaptureDestination: case PTP_DPC_CANON_EOS_WhiteBalanceXA: case PTP_DPC_CANON_EOS_WhiteBalanceXB: case PTP_DPC_CANON_EOS_CurrentStorage: case PTP_DPC_CANON_EOS_CurrentFolder: case PTP_DPC_CANON_EOS_ShutterCounter: case PTP_DPC_CANON_EOS_ModelID: case PTP_DPC_CANON_EOS_LensID: case PTP_DPC_CANON_EOS_StroboFiring: dpd->DataType = PTP_DTC_UINT32; break; /* enumeration for AEM is never provided, but is available to set */ case PTP_DPC_CANON_EOS_AutoExposureMode: dpd->DataType = PTP_DTC_UINT16; dpd->FormFlag = PTP_DPFF_Enumeration; dpd->FORM.Enum.NumberOfValues = 0; break; case PTP_DPC_CANON_EOS_Aperture: case PTP_DPC_CANON_EOS_ShutterSpeed: case PTP_DPC_CANON_EOS_ISOSpeed: case PTP_DPC_CANON_EOS_FocusMode: case PTP_DPC_CANON_EOS_ColorSpace: case PTP_DPC_CANON_EOS_BatteryPower: case PTP_DPC_CANON_EOS_BatterySelect: case PTP_DPC_CANON_EOS_PTPExtensionVersion: case PTP_DPC_CANON_EOS_DriveMode: case PTP_DPC_CANON_EOS_AEB: case PTP_DPC_CANON_EOS_BracketMode: case PTP_DPC_CANON_EOS_QuickReviewTime: case PTP_DPC_CANON_EOS_EVFMode: case PTP_DPC_CANON_EOS_EVFOutputDevice: case PTP_DPC_CANON_EOS_AutoPowerOff: dpd->DataType = PTP_DTC_UINT16; break; case PTP_DPC_CANON_EOS_PictureStyle: case PTP_DPC_CANON_EOS_WhiteBalance: case PTP_DPC_CANON_EOS_MeteringMode: case PTP_DPC_CANON_EOS_ExpCompensation: /* actually int8 if you calculate */ dpd->DataType = PTP_DTC_UINT8; break; case PTP_DPC_CANON_EOS_Owner: case PTP_DPC_CANON_EOS_Artist: case PTP_DPC_CANON_EOS_Copyright: case PTP_DPC_CANON_EOS_SerialNumber: case PTP_DPC_CANON_EOS_LensName: dpd->DataType = PTP_DTC_STR; break; case PTP_DPC_CANON_EOS_WhiteBalanceAdjustA: case PTP_DPC_CANON_EOS_WhiteBalanceAdjustB: dpd->DataType = PTP_DTC_INT16; break; /* unknown props, listed from dump.... all 16 bit, but vals might be smaller */ case PTP_DPC_CANON_EOS_DPOFVersion: dpd->DataType = PTP_DTC_UINT16; ptp_debug (params, "event %d: Unknown EOS property %04x, datasize is %d, using uint16", i ,proptype, size-PTP_ece_Prop_Val_Data); for (j=0;jDataType = PTP_DTC_UINT8; ptp_debug (params, "event %d: Unknown EOS property %04x, datasize is %d, using uint8", i ,proptype, size-PTP_ece_Prop_Val_Data); for (j=0;jDataType = PTP_DTC_UINT32; ptp_debug (params, "event %d: Unknown EOS property %04x, datasize is %d, using uint32", i ,proptype, size-PTP_ece_Prop_Val_Data); if ((size-PTP_ece_Prop_Val_Data) % sizeof(uint32_t) != 0) ptp_debug (params, "event %d: Warning: datasize modulo sizeof(uint32) is not 0: ", i, (size-PTP_ece_Prop_Val_Data) % sizeof(uint32_t) ); for (j=0;j<(size-PTP_ece_Prop_Val_Data)/sizeof(uint32_t);j++) ptp_debug (params, " %d: 0x%8x", j, ((uint32_t*)xdata)[j]); break; /* ImageFormat properties have to be ignored here, see special handling below */ case PTP_DPC_CANON_EOS_ImageFormat: case PTP_DPC_CANON_EOS_ImageFormatCF: case PTP_DPC_CANON_EOS_ImageFormatSD: case PTP_DPC_CANON_EOS_ImageFormatExtHD: case PTP_DPC_CANON_EOS_CustomFuncEx: break; default: ptp_debug (params, "event %d: Unknown EOS property %04x, datasize is %d", i ,proptype, size-PTP_ece_Prop_Val_Data); for (j=0;jDataType) { case PTP_DTC_UINT32: dpd->FactoryDefaultValue.u32 = dtoh32a(xdata); dpd->CurrentValue.u32 = dtoh32a(xdata); ptp_debug (params ,"event %d: currentvalue of %x is %x", i, proptype, dpd->CurrentValue.u32); break; case PTP_DTC_INT16: dpd->FactoryDefaultValue.i16 = dtoh16a(xdata); dpd->CurrentValue.i16 = dtoh16a(xdata); ptp_debug (params,"event %d: currentvalue of %x is %d", i, proptype, dpd->CurrentValue.i16); break; case PTP_DTC_UINT16: dpd->FactoryDefaultValue.u16 = dtoh16a(xdata); dpd->CurrentValue.u16 = dtoh16a(xdata); ptp_debug (params,"event %d: currentvalue of %x is %x", i, proptype, dpd->CurrentValue.u16); break; case PTP_DTC_UINT8: dpd->FactoryDefaultValue.u8 = dtoh8a(xdata); dpd->CurrentValue.u8 = dtoh8a(xdata); ptp_debug (params,"event %d: currentvalue of %x is %x", i, proptype, dpd->CurrentValue.u8); break; case PTP_DTC_STR: { #if 0 /* 5D MII and 400D aktually store plain ASCII in their string properties */ uint8_t len = 0; dpd->FactoryDefaultValue.str = ptp_unpack_string(params, data, 0, &len); dpd->CurrentValue.str = ptp_unpack_string(params, data, 0, &len); #else if (dpd->FactoryDefaultValue.str) free (dpd->FactoryDefaultValue.str); dpd->FactoryDefaultValue.str = strdup( (char*)xdata ); if (dpd->CurrentValue.str) free (dpd->CurrentValue.str); dpd->CurrentValue.str = strdup( (char*)xdata ); #endif ptp_debug (params,"event %d: currentvalue of %x is %s", i, proptype, dpd->CurrentValue.str); break; } default: /* debug is printed in switch above this one */ break; } /* ImageFormat and customFuncEx special handling (WARNING: dont move this in front of the dpd->DataType switch!) */ switch (proptype) { case PTP_DPC_CANON_EOS_ImageFormat: case PTP_DPC_CANON_EOS_ImageFormatCF: case PTP_DPC_CANON_EOS_ImageFormatSD: case PTP_DPC_CANON_EOS_ImageFormatExtHD: dpd->DataType = PTP_DTC_UINT16; dpd->FactoryDefaultValue.u16 = ptp_unpack_EOS_ImageFormat( params, &xdata ); dpd->CurrentValue.u16 = dpd->FactoryDefaultValue.u16; ptp_debug (params,"event %d: decoded imageformat, currentvalue of %x is %x", i, proptype, dpd->CurrentValue.u16); break; case PTP_DPC_CANON_EOS_CustomFuncEx: dpd->DataType = PTP_DTC_STR; if (dpd->FactoryDefaultValue.str) free (dpd->FactoryDefaultValue.str); if (dpd->CurrentValue.str) free (dpd->CurrentValue.str); dpd->FactoryDefaultValue.str = ptp_unpack_EOS_CustomFuncEx( params, &data ); dpd->CurrentValue.str = strdup( (char*)dpd->FactoryDefaultValue.str ); ptp_debug (params,"event %d: decoded custom function, currentvalue of %x is %s", i, proptype, dpd->CurrentValue.str); break; } break; } /* one more information record handed to us */ case PTP_EC_CANON_EOS_OLCInfoChanged: { uint32_t len, curoff; uint16_t mask,proptype; unsigned int j; PTPDevicePropDesc *dpd; /* unclear what OLC stands for */ ptp_debug (params, "event %d: EOS event OLCInfoChanged (size %d)", i, size); if (size >= 0x8) { /* event info */ unsigned int j; for (j=8;jnrofcanon_props;j++) if (params->canon_props[j].proptype == proptype) break; if (j == params->nrofcanon_props) ptp_debug (params, "event %d: shutterspeed not found yet, handle this", i); dpd = ¶ms->canon_props[j].dpd; dpd->CurrentValue.u16 = curdata[curoff+5]; /* just use last byte */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY; ce[i].u.propid = proptype; curoff += 6; i++; } if (mask & CANON_EOS_OLC_APERTURE) { /* 5 bytes: 01 01 5b 30 30 */ /* this seesm to be the aperture record */ proptype = PTP_DPC_CANON_EOS_Aperture; for (j=0;jnrofcanon_props;j++) if (params->canon_props[j].proptype == proptype) break; if (j == params->nrofcanon_props) ptp_debug (params, "event %d: shutterspeed not found yet, handle this", i); dpd = ¶ms->canon_props[j].dpd; dpd->CurrentValue.u16 = curdata[curoff+4]; /* just use last byte */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY; ce[i].u.propid = proptype; curoff += 5; i++; } if (mask & CANON_EOS_OLC_ISO) { /* 5 bytes: 01 01 00 78 */ /* this seesm to be the aperture record */ proptype = PTP_DPC_CANON_EOS_ISOSpeed; for (j=0;jnrofcanon_props;j++) if (params->canon_props[j].proptype == proptype) break; if (j == params->nrofcanon_props) ptp_debug (params, "event %d: shutterspeed not found yet, handle this", i); dpd = ¶ms->canon_props[j].dpd; dpd->CurrentValue.u16 = curdata[curoff+3]; /* just use last byte */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_PROPERTY; ce[i].u.propid = proptype; curoff += 4; i++; } if (mask & 0x0010) { /* mask 0x0010: 4 bytes, 04 00 00 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0010 content 01234567")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0010 content %02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3] ); curoff += 4; i++; } if (mask & 0x0020) { /* mask 0x0020: 6 bytes, 00 00 00 00 00 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0020 content 0123456789ab")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0020 content %02x%02x%02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3], curdata[curoff+4], curdata[curoff+5] ); curoff += 6; i++; } if (mask & 0x0040) { /* mask 0x0040: 7 bytes, 01 01 00 00 00 00 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0040 content 0123456789abcd")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0040 content %02x%02x%02x%02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3], curdata[curoff+4], curdata[curoff+5], curdata[curoff+6] ); curoff += 7; i++; } if (mask & 0x0080) { /* mask 0x0080: 4 bytes, 00 00 00 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0080 content 01234567")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0080 content %02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3] ); curoff += 4; i++; } if (mask & 0x0100) { /* mask 0x0100: 6 bytes, 00 00 00 00 00 00 (before focus) and 00 00 00 00 01 00 (on focus) observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0100 content 0123456789ab")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0100 content %02x%02x%02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3], curdata[curoff+4], curdata[curoff+5] ); curoff += 6; i++; } if (mask & 0x0200) { /* mask 0x0200: 7 bytes, 00 00 00 00 00 00 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0200 content 0123456789abcd")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0200 content %02x%02x%02x%02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3], curdata[curoff+4], curdata[curoff+5], curdata[curoff+6] ); curoff += 7; i++; } if (mask & 0x0400) { /* mask 0x0400: 7 bytes, 00 00 00 00 00 00 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0400 content 0123456789abcd")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0400 content %02x%02x%02x%02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3], curdata[curoff+4], curdata[curoff+5], curdata[curoff+6] ); curoff += 7; i++; } if (mask & 0x0800) { /* mask 0x0800: 8 bytes, 00 00 00 00 00 00 00 00 and 19 01 00 00 00 00 00 00 and others observed */ /* might be mask of focus points selected */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x0800 content 0123456789abcdef")+1); sprintf(ce[i].u.info,"OLCInfo event 0x0800 content %02x%02x%02x%02x%02x%02x%02x%02x", curdata[curoff], curdata[curoff+1], curdata[curoff+2], curdata[curoff+3], curdata[curoff+4], curdata[curoff+5], curdata[curoff+6], curdata[curoff+7] ); curoff += 8; i++; } if (mask & 0x1000) { /* mask 0x1000: 1 byte, 00 observed */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event 0x1000 content 01")+1); sprintf(ce[i].u.info,"OLCInfo event 0x1000 content %02x", curdata[curoff] ); curoff += 1; i++; } /* handle more masks */ ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("OLCInfo event mask 0123456789")+1); sprintf(ce[i].u.info, "OLCInfo event mask=%x", mask); break; } case PTP_EC_CANON_EOS_CameraStatusChanged: ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_CAMERASTATUS; ce[i].u.status = dtoh32a(curdata+8); ptp_debug (params, "event %d: EOS event CameraStatusChanged (size %d) = %d", i, size, dtoh32a(curdata+8)); params->eos_camerastatus = dtoh32a(curdata+8); break; case 0: /* end marker */ if (size == 8) /* no output */ break; ptp_debug (params, "event %d: EOS event 0, but size %d", i, size); break; case PTP_EC_CANON_EOS_BulbExposureTime: ce[i].type = PTP_CANON_EOS_CHANGES_TYPE_UNKNOWN; ce[i].u.info = malloc(strlen("BulbExposureTime 123456789")); sprintf (ce[i].u.info, "BulbExposureTime %d", dtoh32a(curdata+8)); break; default: switch (type) { #define XX(x) case PTP_EC_CANON_EOS_##x: \ ptp_debug (params, "event %d: unhandled EOS event "#x" (size %d)", i, size); \ ce[i].u.info = malloc(strlen("unhandled EOS event "#x" (size 123456789)")); \ sprintf (ce[i].u.info, "unhandled EOS event "#x" (size %d)", size); \ break; XX(RequestGetEvent) XX(ObjectRemoved) XX(RequestGetObjectInfoEx) XX(StorageStatusChanged) XX(StorageInfoChanged) XX(ObjectInfoChangedEx) XX(ObjectContentChanged) XX(WillSoonShutdown) XX(ShutdownTimerUpdated) XX(RequestCancelTransfer) XX(RequestObjectTransferDT) XX(RequestCancelTransferDT) XX(StoreAdded) XX(StoreRemoved) XX(BulbExposureTime) XX(RecordingTime) XX(RequestObjectTransferTS) XX(AfResult) #undef XX default: ptp_debug (params, "event %d: unknown EOS event %04x", i, type); break; } if (size >= 0x8) { /* event info */ unsigned int j; for (j=8;j (len-PTP_nikon_ec_Code)/PTP_nikon_ec_Size) /* broken cnt? */ return; if (!*cnt) return; *ec = malloc(sizeof(PTPContainer)*(*cnt)); for (i=0;i<*cnt;i++) { memset(&(*ec)[i],0,sizeof(PTPContainer)); (*ec)[i].Code = dtoh16a(&data[PTP_nikon_ec_Code+PTP_nikon_ec_Size*i]); (*ec)[i].Param1 = dtoh32a(&data[PTP_nikon_ec_Param1+PTP_nikon_ec_Size*i]); (*ec)[i].Nparam = 1; } } static inline uint32_t ptp_pack_EK_text(PTPParams *params, PTPEKTextParams *text, unsigned char **data) { int i, len = 0; uint8_t retlen; unsigned char *curdata; len = 2*(strlen(text->title)+1)+1+ 2*(strlen(text->line[0])+1)+1+ 2*(strlen(text->line[1])+1)+1+ 2*(strlen(text->line[2])+1)+1+ 2*(strlen(text->line[3])+1)+1+ 2*(strlen(text->line[4])+1)+1+ 4*2+2*4+2+4+2+5*4*2; *data = malloc(len); if (!*data) return 0; curdata = *data; htod16a(curdata,100);curdata+=2; htod16a(curdata,1);curdata+=2; htod16a(curdata,0);curdata+=2; htod16a(curdata,1000);curdata+=2; htod32a(curdata,0);curdata+=4; htod32a(curdata,0);curdata+=4; htod16a(curdata,6);curdata+=2; htod32a(curdata,0);curdata+=4; ptp_pack_string(params, text->title, curdata, 0, &retlen); curdata+=2*retlen+1;htod16a(curdata,0);curdata+=2; htod16a(curdata,0x10);curdata+=2; for (i=0;i<5;i++) { ptp_pack_string(params, text->line[i], curdata, 0, &retlen); curdata+=2*retlen+1;htod16a(curdata,0);curdata+=2; htod16a(curdata,0x10);curdata+=2; htod16a(curdata,0x01);curdata+=2; htod16a(curdata,0x02);curdata+=2; htod16a(curdata,0x06);curdata+=2; } return len; } #define ptp_canon_dir_version 0x00 #define ptp_canon_dir_ofc 0x02 #define ptp_canon_dir_unk1 0x04 #define ptp_canon_dir_objectid 0x08 #define ptp_canon_dir_parentid 0x0c #define ptp_canon_dir_previd 0x10 /* in same dir */ #define ptp_canon_dir_nextid 0x14 /* in same dir */ #define ptp_canon_dir_nextchild 0x18 /* down one dir */ #define ptp_canon_dir_storageid 0x1c /* only in storage entry */ #define ptp_canon_dir_name 0x20 #define ptp_canon_dir_flags 0x2c #define ptp_canon_dir_size 0x30 #define ptp_canon_dir_unixtime 0x34 #define ptp_canon_dir_year 0x38 #define ptp_canon_dir_month 0x39 #define ptp_canon_dir_mday 0x3a #define ptp_canon_dir_hour 0x3b #define ptp_canon_dir_minute 0x3c #define ptp_canon_dir_second 0x3d #define ptp_canon_dir_unk2 0x3e #define ptp_canon_dir_thumbsize 0x40 #define ptp_canon_dir_width 0x44 #define ptp_canon_dir_height 0x48 static inline uint16_t ptp_unpack_canon_directory ( PTPParams *params, unsigned char *dir, uint32_t cnt, PTPObjectHandles *handles, PTPObjectInfo **oinfos, /* size(handles->n) */ uint32_t **flags /* size(handles->n) */ ) { unsigned int i, j, nrofobs = 0, curob = 0; #define ISOBJECT(ptr) (dtoh32a((ptr)+ptp_canon_dir_storageid) == 0xffffffff) for (i=0;in = nrofobs; handles->Handler = calloc(sizeof(handles->Handler[0]),nrofobs); if (!handles->Handler) return PTP_RC_GeneralError; *oinfos = calloc(sizeof((*oinfos)[0]),nrofobs); if (!*oinfos) return PTP_RC_GeneralError; *flags = calloc(sizeof((*flags)[0]),nrofobs); if (!*flags) return PTP_RC_GeneralError; /* Migrate data into objects ids, handles into * the object handler array. */ curob = 0; for (i=0;iHandler[curob] = dtoh32a(cur + ptp_canon_dir_objectid); oi->StorageID = 0xffffffff; oi->ObjectFormat = dtoh16a(cur + ptp_canon_dir_ofc); oi->ParentObject = dtoh32a(cur + ptp_canon_dir_parentid); oi->Filename = strdup((char*)(cur + ptp_canon_dir_name)); oi->ObjectCompressedSize= dtoh32a(cur + ptp_canon_dir_size); oi->ThumbCompressedSize = dtoh32a(cur + ptp_canon_dir_thumbsize); oi->ImagePixWidth = dtoh32a(cur + ptp_canon_dir_width); oi->ImagePixHeight = dtoh32a(cur + ptp_canon_dir_height); oi->CaptureDate = oi->ModificationDate = dtoh32a(cur + ptp_canon_dir_unixtime); (*flags)[curob] = dtoh32a(cur + ptp_canon_dir_flags); curob++; } /* Walk over Storage ID entries and distribute the IDs to * the parent objects. */ for (i=0;in;j++) if (nextchild == handles->Handler[j]) break; if (j == handles->n) continue; (*oinfos)[j].StorageID = dtoh32a(cur + ptp_canon_dir_storageid); } /* Walk over all objects and distribute the storage ids */ while (1) { unsigned int changed = 0; for (i=0;in;j++) if (oid == handles->Handler[j]) break; if (j == handles->n) { /*fprintf(stderr,"did not find oid in lookup pass for current oid\n");*/ continue; } storageid = (*oinfos)[j].StorageID; if (storageid == 0xffffffff) continue; if (nextoid != 0xffffffff) { for (j=0;jn;j++) if (nextoid == handles->Handler[j]) break; if (j == handles->n) { /*fprintf(stderr,"did not find oid in lookup pass for next oid\n");*/ continue; } if ((*oinfos)[j].StorageID == 0xffffffff) { (*oinfos)[j].StorageID = storageid; changed++; } } if (nextchild != 0xffffffff) { for (j=0;jn;j++) if (nextchild == handles->Handler[j]) break; if (j == handles->n) { /*fprintf(stderr,"did not find oid in lookup pass for next child\n");*/ continue; } if ((*oinfos)[j].StorageID == 0xffffffff) { (*oinfos)[j].StorageID = storageid; changed++; } } } /* Check if we: * - changed no entry (nothing more to do) * - changed all of them at once (usually happens) * break if we do. */ if (!changed || (changed==nrofobs-1)) break; } #undef ISOBJECT return PTP_RC_OK; } libmtp-1.1.10/src/libopenusb1-glue.c0000644000175000001440000024017412540343671014123 00000000000000/* * \file libusb1-glue.c * Low-level USB interface glue towards libusb. * * Copyright (C) 2005-2007 Richard A. Low * Copyright (C) 2005-2012 Linus Walleij * Copyright (C) 2006-2011 Marcus Meissner * Copyright (C) 2007 Ted Bullock * Copyright (C) 2008 Chris Bagwell * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Created by Richard Low on 24/12/2005. (as mtp-utils.c) * Modified by Linus Walleij 2006-03-06 * (Notice that Anglo-Saxons use little-endian dates and Swedes * use big-endian dates.) * */ #include "../config.h" #include "libmtp.h" #include "libusb-glue.h" #include "device-flags.h" #include "util.h" #include "ptp.h" #include #include #include #include #include #include #include "ptp-pack.c" /* Aha, older libusb does not have USB_CLASS_PTP */ #ifndef USB_CLASS_PTP #define USB_CLASS_PTP 6 #endif /* * Default USB timeout length. This can be overridden as needed * but should start with a reasonable value so most common * requests can be completed. The original value of 4000 was * not long enough for large file transfer. Also, players can * spend a bit of time collecting data. Higher values also * make connecting/disconnecting more reliable. */ #define USB_TIMEOUT_DEFAULT 20000 #define USB_TIMEOUT_LONG 60000 static inline int get_timeout(PTP_USB* ptp_usb) { if (FLAG_LONG_TIMEOUT(ptp_usb)) { return USB_TIMEOUT_LONG; } return USB_TIMEOUT_DEFAULT; } /* USB Feature selector HALT */ #ifndef USB_FEATURE_HALT #define USB_FEATURE_HALT 0x00 #endif /* Internal data types */ struct mtpdevice_list_struct { openusb_dev_handle_t device; PTPParams *params; PTP_USB *ptp_usb; uint32_t bus_location; struct mtpdevice_list_struct *next; }; typedef struct mtpdevice_list_struct mtpdevice_list_t; static const LIBMTP_device_entry_t mtp_device_table[] = { /* We include an .h file which is shared between us and libgphoto2 */ #include "music-players.h" }; static const int mtp_device_table_size = sizeof (mtp_device_table) / sizeof (LIBMTP_device_entry_t); // Local functions static void init_usb(); static void close_usb(PTP_USB* ptp_usb); static int find_interface_and_endpoints(openusb_dev_handle_t *dev, uint8_t *conf, uint8_t *interface, uint8_t *altsetting, int* inep, int* inep_maxpacket, int* outep, int* outep_maxpacket, int* intep); static void clear_stall(PTP_USB* ptp_usb); static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, openusb_dev_handle_t * dev); static short ptp_write_func(unsigned long, PTPDataHandler*, void *data, unsigned long*); static short ptp_read_func(unsigned long, PTPDataHandler*, void *data, unsigned long*, int); static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status); // Local USB handles. static openusb_handle_t libmtp_openusb_handle; /** * Get a list of the supported USB devices. * * The developers depend on users of this library to constantly * add in to the list of supported devices. What we need is the * device name, USB Vendor ID (VID) and USB Product ID (PID). * put this into a bug ticket at the project homepage, please. * The VID/PID is used to let e.g. udev lift the device to * console userspace access when it's plugged in. * * @param devices a pointer to a pointer that will hold a device * list after the call to this function, if it was * successful. * @param numdevs a pointer to an integer that will hold the number * of devices in the device list if the call was successful. * @return 0 if the list was successfull retrieved, any other * value means failure. */ int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t * * const devices, int * const numdevs) { *devices = (LIBMTP_device_entry_t *) & mtp_device_table; *numdevs = mtp_device_table_size; return 0; } static void init_usb() { openusb_init(NULL, &libmtp_openusb_handle); } /** * Small recursive function to append a new usb_device to the linked list of * USB MTP devices * @param devlist dynamic linked list of pointers to usb devices with MTP * properties, to be extended with new device. * @param newdevice the new device to add. * @param bus_location bus for this device. * @return an extended array or NULL on failure. */ static mtpdevice_list_t *append_to_mtpdevice_list(mtpdevice_list_t *devlist, openusb_dev_handle_t *newdevice, uint32_t bus_location) { mtpdevice_list_t *new_list_entry; new_list_entry = (mtpdevice_list_t *) malloc(sizeof (mtpdevice_list_t)); if (new_list_entry == NULL) { return NULL; } // Fill in USB device, if we *HAVE* to make a copy of the device do it here. new_list_entry->device = *newdevice; new_list_entry->bus_location = bus_location; new_list_entry->next = NULL; if (devlist == NULL) { return new_list_entry; } else { mtpdevice_list_t *tmp = devlist; while (tmp->next != NULL) { tmp = tmp->next; } tmp->next = new_list_entry; } return devlist; } /** * Small recursive function to free dynamic memory allocated to the linked list * of USB MTP devices * @param devlist dynamic linked list of pointers to usb devices with MTP * properties. * @return nothing */ static void free_mtpdevice_list(mtpdevice_list_t *devlist) { mtpdevice_list_t *tmplist = devlist; if (devlist == NULL) return; while (tmplist != NULL) { mtpdevice_list_t *tmp = tmplist; tmplist = tmplist->next; // Do not free() the fields (ptp_usb, params)! These are used elsewhere. free(tmp); } return; } /** * This checks if a device has an MTP descriptor. The descriptor was * elaborated about in gPhoto bug 1482084, and some official documentation * with no strings attached was published by Microsoft at * http://www.microsoft.com/whdc/system/bus/USB/USBFAQ_intermed.mspx#E3HAC * * @param dev a device struct from libopenusb. * @param dumpfile set to non-NULL to make the descriptors dump out * to this file in human-readable hex so we can scruitinze them. * @return 1 if the device is MTP compliant, 0 if not. */ static int probe_device_descriptor(openusb_dev_handle_t *dev, FILE *dumpfile) { openusb_dev_handle_t *devh = NULL; unsigned char buf[1024], cmd; uint8_t *bufptr = (uint8_t *) &buf; unsigned int buffersize = sizeof(buf); int i; int ret; /* This is to indicate if we find some vendor interface */ int found_vendor_spec_interface = 0; struct usb_device_desc desc; struct usb_interface_desc ifcdesc; ret = openusb_parse_device_desc(libmtp_openusb_handle, *dev, NULL, 0, &desc); if (ret != OPENUSB_SUCCESS) return 0; /* * Don't examine devices that are not likely to * contain any MTP interface, update this the day * you find some weird combination... */ if (!(desc.bDeviceClass == USB_CLASS_PER_INTERFACE || desc.bDeviceClass == USB_CLASS_COMM || desc.bDeviceClass == USB_CLASS_PTP || desc.bDeviceClass == 0xEF || /* Intf. Association Desc.*/ desc.bDeviceClass == USB_CLASS_VENDOR_SPEC)) { return 0; } /* Attempt to open Device on this port */ ret = openusb_open_device(libmtp_openusb_handle, NULL, USB_INIT_DEFAULT, devh); if (ret != OPENUSB_SUCCESS) { /* Could not open this device */ return 0; } /* * This sometimes crashes on the j for loop below * I think it is because config is NULL yet * dev->descriptor.bNumConfigurations > 0 * this check should stop this */ /* * Loop over the device configurations and interfaces. Nokia MTP-capable * handsets (possibly others) typically have the string "MTP" in their * MTP interface descriptions, that's how they can be detected, before * we try the more esoteric "OS descriptors" (below). */ for (i = 0; i < desc.bNumConfigurations; i++) { uint8_t j; struct usb_config_desc config; ret = openusb_parse_config_desc(libmtp_openusb_handle, *dev, NULL, 0, 0, &config); if (ret != OPENUSB_SUCCESS) { LIBMTP_INFO("configdescriptor %d get failed with ret %d in probe_device_descriptor yet dev->descriptor.bNumConfigurations > 0\n", i, ret); continue; } for (j = 0; j < config.bNumInterfaces; j++) { int k = 0; while (openusb_parse_interface_desc(libmtp_openusb_handle, *dev, NULL, 0, 0, j, k++, &ifcdesc) == 0) { /* Current interface descriptor */ /* * MTP interfaces have three endpoints, two bulk and one * interrupt. Don't probe anything else. */ if (ifcdesc.bNumEndpoints != 3) continue; /* * We only want to probe for the OS descriptor if the * device is LIBUSB_CLASS_VENDOR_SPEC or one of the interfaces * in it is, so flag if we find an interface like this. */ if (ifcdesc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { found_vendor_spec_interface = 1; } /* * Check for Still Image Capture class with PIMA 15740 protocol, * also known as PTP */ /* * Next we search for the MTP substring in the interface name. * For example : "RIM MS/MTP" should work. */ buf[0] = '\0'; // FIXME: DK: Find out how to get the string descriptor for an interface? /* ret = libusb_get_string_descriptor_ascii(devh, config->interface[j].altsetting[k].iInterface, buf, 1024); */ if (ret < 3) continue; if (strstr((char *) buf, "MTP") != NULL) { if (dumpfile != NULL) { fprintf(dumpfile, "Configuration %d, interface %d, altsetting %d:\n", i, j, k); fprintf(dumpfile, " Interface description contains the string \"MTP\"\n"); fprintf(dumpfile, " Device recognized as MTP, no further probing.\n"); } //libusb_free_config_descriptor(config); openusb_close_device(*devh); return 1; } } } } /* * Only probe for OS descriptor if the device is vendor specific * or one of the interfaces found is. */ if (desc.bDeviceClass == USB_CLASS_VENDOR_SPEC || found_vendor_spec_interface) { /* Read the special descriptor */ //ret = libusb_get_descriptor(devh, 0x03, 0xee, buf, sizeof (buf)); ret = openusb_get_raw_desc(libmtp_openusb_handle, *dev, USB_DESC_TYPE_STRING, 0xee, 0, &bufptr, (unsigned short *)&buffersize); /* * If something failed we're probably stalled to we need * to clear the stall off the endpoint and say this is not * MTP. */ if (ret < 0) { /* EP0 is the default control endpoint */ //libusb_clear_halt (devh, 0); openusb_close_device(*devh); openusb_free_raw_desc(buf); return 0; } // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device descriptor 0xee:\n"); data_dump_ascii(dumpfile, buf, ret, 16); } /* Check if descriptor length is at least 10 bytes */ if (ret < 10) { openusb_close_device(*devh); openusb_free_raw_desc(buf); return 0; } /* Check if this device has a Microsoft Descriptor */ if (!((buf[2] == 'M') && (buf[4] == 'S') && (buf[6] == 'F') && (buf[8] == 'T'))) { openusb_close_device(*devh); openusb_free_raw_desc(buf); return 0; } /* Check if device responds to control message 1 or if there is an error */ cmd = buf[16]; /* ret = libusb_control_transfer (devh, LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE | LIBUSB_REQUEST_TYPE_VENDOR, cmd, 0, 4, buf, sizeof(buf), USB_TIMEOUT_DEFAULT); */ struct openusb_ctrl_request ctrl; ctrl.setup.bmRequestType = USB_ENDPOINT_IN | USB_RECIP_DEVICE | USB_REQ_TYPE_VENDOR; ctrl.setup.bRequest = cmd; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 4; ctrl.payload = bufptr; // Out ctrl.length = sizeof (buf); ctrl.timeout = USB_TIMEOUT_DEFAULT; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(*devh, 0, USB_ENDPOINT_IN, &ctrl); // Dump it, if requested if (dumpfile != NULL && ctrl.result.transferred_bytes > 0) { fprintf(dumpfile, "Microsoft device response to control message 1, CMD 0x%02x:\n", cmd); data_dump_ascii(dumpfile, buf, ctrl.result.transferred_bytes, 16); } /* If this is true, the device either isn't MTP or there was an error */ if (ctrl.result.transferred_bytes <= 0x15) { /* TODO: If there was an error, flag it and let the user know somehow */ /* if(ret == -1) {} */ openusb_close_device(*devh); return 0; } /* Check if device is MTP or if it is something like a USB Mass Storage device with Janus DRM support */ if ((buf[0x12] != 'M') || (buf[0x13] != 'T') || (buf[0x14] != 'P')) { openusb_close_device(*devh); return 0; } /* After this point we are probably dealing with an MTP device */ /* * Check if device responds to control message 2, which is * the extended device parameters. Most devices will just * respond with a copy of the same message as for the first * message, some respond with zero-length (which is OK) * and some with pure garbage. We're not parsing the result * so this is not very important. */ /* ret = libusb_control_transfer (devh, LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE | LIBUSB_REQUEST_TYPE_VENDOR, cmd, 0, 5, buf, sizeof(buf), USB_TIMEOUT_DEFAULT); */ //struct openusb_ctrl_request ctrl; ctrl.setup.bmRequestType = USB_ENDPOINT_IN | USB_RECIP_DEVICE | USB_REQ_TYPE_VENDOR; ctrl.setup.bRequest = cmd; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 5; ctrl.payload = bufptr; // Out ctrl.length = sizeof (buf); ctrl.timeout = USB_TIMEOUT_DEFAULT; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(*devh, 0, USB_ENDPOINT_IN, &ctrl); // Dump it, if requested if (dumpfile != NULL && ctrl.result.transferred_bytes > 0) { fprintf(dumpfile, "Microsoft device response to control message 2, CMD 0x%02x:\n", cmd); data_dump_ascii(dumpfile, buf, ret, 16); } /* If this is true, the device errored against control message 2 */ if (ctrl.result.transferred_bytes < 0) { /* TODO: Implement callback function to let managing program know there was a problem, along with description of the problem */ LIBMTP_ERROR("Potential MTP Device with VendorID:%04x and " "ProductID:%04x encountered an error responding to " "control message 2.\n" "Problems may arrise but continuing\n", desc.idVendor, desc.idProduct); } else if (dumpfile != NULL && ctrl.result.transferred_bytes == 0) { fprintf(dumpfile, "Zero-length response to control message 2 (OK)\n"); } else if (dumpfile != NULL) { fprintf(dumpfile, "Device responds to control message 2 with some data.\n"); } /* Close the USB device handle */ openusb_close_device(*devh); return 1; } /* Close the USB device handle */ openusb_close_device(*devh); return 0; } /** * This function scans through the connected usb devices on a machine and * if they match known Vendor and Product identifiers appends them to the * dynamic array mtp_device_list. Be sure to call * free_mtpdevice_list(mtp_device_list) when you are done * with it, assuming it is not NULL. * @param mtp_device_list dynamic array of pointers to usb devices with MTP * properties (if this list is not empty, new entries will be appended * to the list). * @return LIBMTP_ERROR_NONE implies that devices have been found, scan the list * appropriately. LIBMTP_ERROR_NO_DEVICE_ATTACHED implies that no * devices have been found. */ static LIBMTP_error_number_t get_mtp_usb_device_list(mtpdevice_list_t ** mtp_device_list) { int nrofdevs = 0; openusb_devid_t *devs = NULL; struct usb_device_desc desc; int ret, i; init_usb(); ret = openusb_get_devids_by_bus(libmtp_openusb_handle, 0, &devs, &nrofdevs); for (i = 0; i < nrofdevs; i++) { openusb_devid_t dev = devs[i]; ret = openusb_parse_device_desc(libmtp_openusb_handle, dev, NULL, 0, &desc); if (ret != OPENUSB_SUCCESS) continue; if (desc.bDeviceClass != USB_CLASS_HUB) { int i; int found = 0; // First check if we know about the device already. // Devices well known to us will not have their descriptors // probed, it caused problems with some devices. for (i = 0; i < mtp_device_table_size; i++) { if (desc.idVendor == mtp_device_table[i].vendor_id && desc.idProduct == mtp_device_table[i].product_id) { /* Append this usb device to the MTP device list */ *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, &dev, 0); found = 1; break; } } // If we didn't know it, try probing the "OS Descriptor". //if (!found) { // if (probe_device_descriptor(&dev, NULL)) { /* Append this usb device to the MTP USB Device List */ // *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, &dev, 0); // } /* * By thomas_-_s: Also append devices that are no MTP but PTP devices * if this is commented out. */ /* else { // Check whether the device is no USB hub but a PTP. if ( dev->config != NULL &&dev->config->interface->altsetting->bInterfaceClass == LIBUSB_CLASS_PTP && dev->descriptor.bDeviceClass != LIBUSB_CLASS_HUB ) { *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, bus->location); } } */ //} } } /* If nothing was found we end up here. */ if (*mtp_device_list == NULL) { return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } return LIBMTP_ERROR_NONE; } /** * Checks if a specific device with a certain bus and device * number has an MTP type device descriptor. * * @param busno the bus number of the device to check * @param deviceno the device number of the device to check * @return 1 if the device is MTP else 0 */ int LIBMTP_Check_Specific_Device(int busno, int devno) { unsigned int nrofdevs; openusb_devid_t **devs = NULL; int i; init_usb(); openusb_get_devids_by_bus(libmtp_openusb_handle, 0, devs, &nrofdevs); for (i = 0; i < nrofdevs; i++) { /* if (bus->location != busno) continue; if (dev->devnum != devno) continue; */ if (probe_device_descriptor(devs[i], NULL)) return 1; } return 0; } /** * Detect the raw MTP device descriptors and return a list of * of the devices found. * * @param devices a pointer to a variable that will hold * the list of raw devices found. This may be NULL * on return if the number of detected devices is zero. * The user shall simply free() this * variable when finished with the raw devices, * in order to release memory. * @param numdevs a pointer to an integer that will hold * the number of devices in the list. This may * be 0. * @return 0 if successful, any other value means failure. */ LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t ** devices, int * numdevs) { mtpdevice_list_t *devlist = NULL; mtpdevice_list_t *dev; LIBMTP_error_number_t ret; LIBMTP_raw_device_t *retdevs; int devs = 0; int i, j; ret = get_mtp_usb_device_list(&devlist); if (ret == LIBMTP_ERROR_NO_DEVICE_ATTACHED) { *devices = NULL; *numdevs = 0; return ret; } else if (ret != LIBMTP_ERROR_NONE) { LIBMTP_ERROR("LIBMTP PANIC: get_mtp_usb_device_list() " "error code: %d on line %d\n", ret, __LINE__); return ret; } // Get list size dev = devlist; while (dev != NULL) { devs++; dev = dev->next; } if (devs == 0) { *devices = NULL; *numdevs = 0; return LIBMTP_ERROR_NONE; } // Conjure a device list retdevs = (LIBMTP_raw_device_t *) malloc(sizeof (LIBMTP_raw_device_t) * devs); if (retdevs == NULL) { // Out of memory *devices = NULL; *numdevs = 0; return LIBMTP_ERROR_MEMORY_ALLOCATION; } dev = devlist; i = 0; while (dev != NULL) { int device_known = 0; struct usb_device_desc desc; openusb_parse_device_desc(libmtp_openusb_handle, dev->device, NULL, 0, &desc); // Assign default device info retdevs[i].device_entry.vendor = NULL; retdevs[i].device_entry.vendor_id = desc.idVendor; retdevs[i].device_entry.product = NULL; retdevs[i].device_entry.product_id = desc.idProduct; retdevs[i].device_entry.device_flags = 0x00000000U; // See if we can locate some additional vendor info and device flags for (j = 0; j < mtp_device_table_size; j++) { if (desc.idVendor == mtp_device_table[j].vendor_id && desc.idProduct == mtp_device_table[j].product_id) { device_known = 1; retdevs[i].device_entry.vendor = mtp_device_table[j].vendor; retdevs[i].device_entry.product = mtp_device_table[j].product; retdevs[i].device_entry.device_flags = mtp_device_table[j].device_flags; // This device is known to the developers LIBMTP_ERROR("Device %d (VID=%04x and PID=%04x) is a %s %s.\n", i, desc.idVendor, desc.idProduct, mtp_device_table[j].vendor, mtp_device_table[j].product); break; } } if (!device_known) { device_unknown(i, desc.idVendor, desc.idProduct); } // Save the location on the bus retdevs[i].bus_location = 0; retdevs[i].devnum = openusb_get_devid(libmtp_openusb_handle, &dev->device); i++; dev = dev->next; } *devices = retdevs; *numdevs = i; free_mtpdevice_list(devlist); return LIBMTP_ERROR_NONE; } /** * This routine just dumps out low-level * USB information about the current device. * @param ptp_usb the USB device to get information from. */ void dump_usbinfo(PTP_USB *ptp_usb) { struct usb_device_desc desc; openusb_parse_device_desc(libmtp_openusb_handle, *ptp_usb->handle, NULL, 0, &desc); LIBMTP_INFO(" bcdUSB: %d\n", desc.bcdUSB); LIBMTP_INFO(" bDeviceClass: %d\n", desc.bDeviceClass); LIBMTP_INFO(" bDeviceSubClass: %d\n", desc.bDeviceSubClass); LIBMTP_INFO(" bDeviceProtocol: %d\n", desc.bDeviceProtocol); LIBMTP_INFO(" idVendor: %04x\n", desc.idVendor); LIBMTP_INFO(" idProduct: %04x\n", desc.idProduct); LIBMTP_INFO(" IN endpoint maxpacket: %d bytes\n", ptp_usb->inep_maxpacket); LIBMTP_INFO(" OUT endpoint maxpacket: %d bytes\n", ptp_usb->outep_maxpacket); LIBMTP_INFO(" Raw device info:\n"); LIBMTP_INFO(" Bus location: %d\n", ptp_usb->rawdevice.bus_location); LIBMTP_INFO(" Device number: %d\n", ptp_usb->rawdevice.devnum); LIBMTP_INFO(" Device entry info:\n"); LIBMTP_INFO(" Vendor: %s\n", ptp_usb->rawdevice.device_entry.vendor); LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.vendor_id); LIBMTP_INFO(" Product: %s\n", ptp_usb->rawdevice.device_entry.product); LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.product_id); LIBMTP_INFO(" Device flags: 0x%08x\n", ptp_usb->rawdevice.device_entry.device_flags); // TODO: (void) probe_device_descriptor(dev, stdout); } /** * Retrieve the apropriate playlist extension for this * device. Rather hacky at the moment. This is probably * desired by the managing software, but when creating * lists on the device itself you notice certain preferences. * @param ptp_usb the USB device to get suggestion for. * @return the suggested playlist extension. */ const char *get_playlist_extension(PTP_USB *ptp_usb) { static char creative_pl_extension[] = ".zpl"; static char default_pl_extension[] = ".pla"; struct usb_device_desc desc; openusb_parse_device_desc(libmtp_openusb_handle, *ptp_usb->handle, NULL, 0, &desc); if (desc.idVendor == 0x041e) return creative_pl_extension; return default_pl_extension; } static void libusb_glue_debug(PTPParams *params, const char *format, ...) { va_list args; va_start(args, format); if (params->debug_func != NULL) params->debug_func(params->data, format, args); else { vfprintf(stderr, format, args); fprintf(stderr, "\n"); fflush(stderr); } va_end(args); } static void libusb_glue_error(PTPParams *params, const char *format, ...) { va_list args; va_start(args, format); if (params->error_func != NULL) params->error_func(params->data, format, args); else { vfprintf(stderr, format, args); fprintf(stderr, "\n"); fflush(stderr); } va_end(args); } /* * ptp_read_func() and ptp_write_func() are * based on same functions usb.c in libgphoto2. * Much reading packet logs and having fun with trials and errors * reveals that WMP / Windows is probably using an algorithm like this * for large transfers: * * 1. Send the command (0x0c bytes) if headers are split, else, send * command plus sizeof(endpoint) - 0x0c bytes. * 2. Send first packet, max size to be sizeof(endpoint) but only when using * split headers. Else goto 3. * 3. REPEAT send 0x10000 byte chunks UNTIL remaining bytes < 0x10000 * We call 0x10000 CONTEXT_BLOCK_SIZE. * 4. Send remaining bytes MOD sizeof(endpoint) * 5. Send remaining bytes. If this happens to be exactly sizeof(endpoint) * then also send a zero-length package. * * Further there is some special quirks to handle zero reads from the * device, since some devices can't do them at all due to shortcomings * of the USB slave controller in the device. */ #define CONTEXT_BLOCK_SIZE_1 0x3e00 #define CONTEXT_BLOCK_SIZE_2 0x200 #define CONTEXT_BLOCK_SIZE CONTEXT_BLOCK_SIZE_1+CONTEXT_BLOCK_SIZE_2 static short ptp_read_func( unsigned long size, PTPDataHandler *handler, void *data, unsigned long *readbytes, int readzero ) { PTP_USB *ptp_usb = (PTP_USB *) data; unsigned long toread = 0; int ret = 0; int xread; unsigned long curread = 0; unsigned long written; unsigned char *bytes; int expect_terminator_byte = 0; unsigned long usb_inep_maxpacket_size; unsigned long context_block_size_1; unsigned long context_block_size_2; uint16_t ptp_dev_vendor_id = ptp_usb->rawdevice.device_entry.vendor_id; //"iRiver" device special handling if (ptp_dev_vendor_id == 0x4102 || ptp_dev_vendor_id == 0x1006) { usb_inep_maxpacket_size = ptp_usb->inep_maxpacket; if (usb_inep_maxpacket_size == 0x400) { context_block_size_1 = CONTEXT_BLOCK_SIZE_1 - 0x200; context_block_size_2 = CONTEXT_BLOCK_SIZE_2 + 0x200; } else { context_block_size_1 = CONTEXT_BLOCK_SIZE_1; context_block_size_2 = CONTEXT_BLOCK_SIZE_2; } } struct openusb_bulk_request bulk; // This is the largest block we'll need to read in. bytes = malloc(CONTEXT_BLOCK_SIZE); while (curread < size) { LIBMTP_USB_DEBUG("Remaining size to read: 0x%04lx bytes\n", size - curread); // check equal to condition here if (size - curread < CONTEXT_BLOCK_SIZE) { // this is the last packet toread = size - curread; // this is equivalent to zero read for these devices if (readzero && FLAG_NO_ZERO_READS(ptp_usb) && toread % 64 == 0) { toread += 1; expect_terminator_byte = 1; } } else if (ptp_dev_vendor_id == 0x4102 || ptp_dev_vendor_id == 0x1006) { //"iRiver" device special handling if (curread == 0) // we are first packet, but not last packet toread = context_block_size_1; else if (toread == context_block_size_1) toread = context_block_size_2; else if (toread == context_block_size_2) toread = context_block_size_1; else LIBMTP_INFO("unexpected toread size 0x%04x, 0x%04x remaining bytes\n", (unsigned int) toread, (unsigned int) (size - curread)); } else toread = CONTEXT_BLOCK_SIZE; LIBMTP_USB_DEBUG("Reading in 0x%04lx bytes\n", toread); /* ret = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, bytes, toread, &xread, ptp_usb->timeout); */ bulk.payload = bytes; bulk.length = toread; bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); xread = bulk.result.transferred_bytes; LIBMTP_USB_DEBUG("Result of read: 0x%04x (%d bytes)\n", ret, xread); if (ret != OPENUSB_SUCCESS) return PTP_ERROR_IO; LIBMTP_USB_DEBUG("<==USB IN\n"); if (xread == 0) LIBMTP_USB_DEBUG("Zero Read\n"); else LIBMTP_USB_DATA(bytes, xread, 16); // want to discard extra byte if (expect_terminator_byte && xread == toread) { LIBMTP_USB_DEBUG("<==USB IN\nDiscarding extra byte\n"); xread--; } int putfunc_ret = handler->putfunc(NULL, handler->priv, xread, bytes, &written); LIBMTP_USB_DEBUG("handler->putfunc ret = 0x%x\n", putfunc_ret); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; ptp_usb->current_transfer_complete += xread; curread += xread; // Increase counters, call callback if (ptp_usb->callback_active) { if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { // send last update and disable callback. ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; ptp_usb->callback_active = 0; } if (ptp_usb->current_transfer_callback != NULL) { int ret; ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, ptp_usb->current_transfer_total, ptp_usb->current_transfer_callback_data); if (ret != 0) { return PTP_ERROR_CANCEL; } } } if (xread < toread) /* short reads are common */ break; } if (readbytes) *readbytes = curread; free(bytes); LIBMTP_USB_DEBUG("Pointer Updated\n"); // there might be a zero packet waiting for us... if (readzero && !FLAG_NO_ZERO_READS(ptp_usb) && curread % ptp_usb->outep_maxpacket == 0) { unsigned char temp; int zeroresult = 0, xread; LIBMTP_USB_DEBUG("<==USB IN\n"); LIBMTP_USB_DEBUG("Zero Read\n"); /* zeroresult = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &temp, 0, &xread, ptp_usb->timeout); */ bulk.payload = &temp; bulk.length = 0; bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); xread = bulk.result.transferred_bytes; if (zeroresult != OPENUSB_SUCCESS) LIBMTP_INFO("LIBMTP panic: unable to read in zero packet, response 0x%04x", zeroresult); } return PTP_RC_OK; } static short ptp_write_func( unsigned long size, PTPDataHandler *handler, void *data, unsigned long *written ) { PTP_USB *ptp_usb = (PTP_USB *) data; unsigned long towrite = 0; int ret = 0; unsigned long curwrite = 0; unsigned char *bytes; struct openusb_bulk_request bulk; // This is the largest block we'll need to read in. bytes = malloc(CONTEXT_BLOCK_SIZE); if (!bytes) { return PTP_ERROR_IO; } while (curwrite < size) { unsigned long usbwritten = 0; int xwritten; towrite = size - curwrite; if (towrite > CONTEXT_BLOCK_SIZE) { towrite = CONTEXT_BLOCK_SIZE; } else { // This magic makes packets the same size that WMP send them. if (towrite > ptp_usb->outep_maxpacket && towrite % ptp_usb->outep_maxpacket != 0) { towrite -= towrite % ptp_usb->outep_maxpacket; } } int getfunc_ret = handler->getfunc(NULL, handler->priv, towrite, bytes, &towrite); if (getfunc_ret != PTP_RC_OK) return getfunc_ret; while (usbwritten < towrite) { /* ret = USB_BULK_WRITE(ptp_usb->handle, ptp_usb->outep, bytes + usbwritten, towrite - usbwritten, &xwritten, ptp_usb->timeout); */ bulk.payload = bytes + usbwritten; bulk.length = towrite - usbwritten; bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->outep, &bulk); xwritten = bulk.result.transferred_bytes; LIBMTP_USB_DEBUG("USB OUT==>\n"); if (ret != OPENUSB_SUCCESS) { return PTP_ERROR_IO; } LIBMTP_USB_DATA(bytes + usbwritten, xwritten, 16); // check for result == 0 perhaps too. // Increase counters ptp_usb->current_transfer_complete += xwritten; curwrite += xwritten; usbwritten += xwritten; } // call callback if (ptp_usb->callback_active) { if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { // send last update and disable callback. ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; ptp_usb->callback_active = 0; } if (ptp_usb->current_transfer_callback != NULL) { int ret; ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, ptp_usb->current_transfer_total, ptp_usb->current_transfer_callback_data); if (ret != 0) { return PTP_ERROR_CANCEL; } } } if (xwritten < towrite) /* short writes happen */ break; } free(bytes); if (written) { *written = curwrite; } // If this is the last transfer send a zero write if required if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { if ((towrite % ptp_usb->outep_maxpacket) == 0) { int xwritten; LIBMTP_USB_DEBUG("USB OUT==>\n"); LIBMTP_USB_DEBUG("Zero Write\n"); /* ret = USB_BULK_WRITE(ptp_usb->handle, ptp_usb->outep, (unsigned char *) "x", 0, &xwritten, ptp_usb->timeout); */ bulk.payload = (unsigned char *) "x"; bulk.length = 0; bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; ret = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->outep, &bulk); xwritten = bulk.result.transferred_bytes; } } if (ret != OPENUSB_SUCCESS) return PTP_ERROR_IO; return PTP_RC_OK; } /* memory data get/put handler */ typedef struct { unsigned char *data; unsigned long size, curoff; } PTPMemHandlerPrivate; static uint16_t memory_getfunc(PTPParams* params, void* private, unsigned long wantlen, unsigned char *data, unsigned long *gotlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*) private; unsigned long tocopy = wantlen; if (priv->curoff + tocopy > priv->size) tocopy = priv->size - priv->curoff; memcpy(data, priv->data + priv->curoff, tocopy); priv->curoff += tocopy; *gotlen = tocopy; return PTP_RC_OK; } static uint16_t memory_putfunc(PTPParams* params, void* private, unsigned long sendlen, unsigned char *data, unsigned long *putlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*) private; if (priv->curoff + sendlen > priv->size) { priv->data = realloc(priv->data, priv->curoff + sendlen); priv->size = priv->curoff + sendlen; } memcpy(priv->data + priv->curoff, data, sendlen); priv->curoff += sendlen; *putlen = sendlen; return PTP_RC_OK; } /* init private struct for receiving data. */ static uint16_t ptp_init_recv_memory_handler(PTPDataHandler *handler) { PTPMemHandlerPrivate* priv; priv = malloc(sizeof (PTPMemHandlerPrivate)); handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = NULL; priv->size = 0; priv->curoff = 0; return PTP_RC_OK; } /* init private struct and put data in for sending data. * data is still owned by caller. */ static uint16_t ptp_init_send_memory_handler(PTPDataHandler *handler, unsigned char *data, unsigned long len ) { PTPMemHandlerPrivate* priv; priv = malloc(sizeof (PTPMemHandlerPrivate)); if (!priv){ return PTP_RC_GeneralError; } handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = data; priv->size = len; priv->curoff = 0; return PTP_RC_OK; } /* free private struct + data */ static uint16_t ptp_exit_send_memory_handler(PTPDataHandler *handler) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*) handler->priv; /* data is owned by caller */ free(priv); return PTP_RC_OK; } /* hand over our internal data to caller */ static uint16_t ptp_exit_recv_memory_handler(PTPDataHandler *handler, unsigned char **data, unsigned long *size ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*) handler->priv; *data = priv->data; *size = priv->size; free(priv); return PTP_RC_OK; } /* send / receive functions */ uint16_t ptp_usb_sendreq(PTPParams* params, PTPContainer* req) { uint16_t ret; PTPUSBBulkContainer usbreq; PTPDataHandler memhandler; unsigned long written = 0; unsigned long towrite; char txt[256]; (void) ptp_render_opcode(params, req->Code, sizeof (txt), txt); LIBMTP_USB_DEBUG("REQUEST: 0x%04x, %s\n", req->Code, txt); /* build appropriate USB container */ usbreq.length = htod32(PTP_USB_BULK_REQ_LEN - (sizeof (uint32_t)*(5 - req->Nparam))); usbreq.type = htod16(PTP_USB_CONTAINER_COMMAND); usbreq.code = htod16(req->Code); usbreq.trans_id = htod32(req->Transaction_ID); usbreq.payload.params.param1 = htod32(req->Param1); usbreq.payload.params.param2 = htod32(req->Param2); usbreq.payload.params.param3 = htod32(req->Param3); usbreq.payload.params.param4 = htod32(req->Param4); usbreq.payload.params.param5 = htod32(req->Param5); /* send it to responder */ towrite = PTP_USB_BULK_REQ_LEN - (sizeof (uint32_t)*(5 - req->Nparam)); ptp_init_send_memory_handler(&memhandler, (unsigned char*) &usbreq, towrite); ret = ptp_write_func( towrite, &memhandler, params->data, &written ); ptp_exit_send_memory_handler(&memhandler); if (ret != PTP_RC_OK && ret != PTP_ERROR_CANCEL) { ret = PTP_ERROR_IO; } if (written != towrite && ret != PTP_ERROR_CANCEL && ret != PTP_ERROR_IO) { libusb_glue_error(params, "PTP: request code 0x%04x sending req wrote only %ld bytes instead of %d", req->Code, written, towrite ); ret = PTP_ERROR_IO; } return ret; } uint16_t ptp_usb_senddata(PTPParams* params, PTPContainer* ptp, uint64_t size, PTPDataHandler *handler ) { uint16_t ret; int wlen, datawlen; unsigned long written; PTPUSBBulkContainer usbdata; uint64_t bytes_left_to_transfer; PTPDataHandler memhandler; LIBMTP_USB_DEBUG("SEND DATA PHASE\n"); /* build appropriate USB container */ usbdata.length = htod32(PTP_USB_BULK_HDR_LEN + size); usbdata.type = htod16(PTP_USB_CONTAINER_DATA); usbdata.code = htod16(ptp->Code); usbdata.trans_id = htod32(ptp->Transaction_ID); ((PTP_USB*) params->data)->current_transfer_complete = 0; ((PTP_USB*) params->data)->current_transfer_total = size + PTP_USB_BULK_HDR_LEN; if (params->split_header_data) { datawlen = 0; wlen = PTP_USB_BULK_HDR_LEN; } else { unsigned long gotlen; /* For all camera devices. */ datawlen = (size < PTP_USB_BULK_PAYLOAD_LEN_WRITE) ? size : PTP_USB_BULK_PAYLOAD_LEN_WRITE; wlen = PTP_USB_BULK_HDR_LEN + datawlen; ret = handler->getfunc(params, handler->priv, datawlen, usbdata.payload.data, &gotlen); if (ret != PTP_RC_OK){ return ret; } if (gotlen != datawlen){ return PTP_RC_GeneralError; } } ptp_init_send_memory_handler(&memhandler, (unsigned char *) &usbdata, wlen); /* send first part of data */ ret = ptp_write_func(wlen, &memhandler, params->data, &written); ptp_exit_send_memory_handler(&memhandler); if (ret != PTP_RC_OK) { return ret; } if (size <= datawlen) return ret; /* if everything OK send the rest */ bytes_left_to_transfer = size - datawlen; ret = PTP_RC_OK; while (bytes_left_to_transfer > 0) { ret = ptp_write_func(bytes_left_to_transfer, handler, params->data, &written); if (ret != PTP_RC_OK){ break; } if (written == 0) { ret = PTP_ERROR_IO; break; } bytes_left_to_transfer -= written; } if (ret != PTP_RC_OK && ret != PTP_ERROR_CANCEL) ret = PTP_ERROR_IO; return ret; } static uint16_t ptp_usb_getpacket(PTPParams *params, PTPUSBBulkContainer *packet, unsigned long *rlen) { PTPDataHandler memhandler; uint16_t ret; unsigned char *x = NULL; unsigned long packet_size; PTP_USB *ptp_usb = (PTP_USB *) params->data; packet_size = ptp_usb->inep_maxpacket; /* read the header and potentially the first data */ if (params->response_packet_size > 0) { /* If there is a buffered packet, just use it. */ memcpy(packet, params->response_packet, params->response_packet_size); *rlen = params->response_packet_size; free(params->response_packet); params->response_packet = NULL; params->response_packet_size = 0; /* Here this signifies a "virtual read" */ return PTP_RC_OK; } ptp_init_recv_memory_handler(&memhandler); ret = ptp_read_func(packet_size, &memhandler, params->data, rlen, 0); ptp_exit_recv_memory_handler(&memhandler, &x, rlen); if (x) { memcpy(packet, x, *rlen); free(x); } return ret; } uint16_t ptp_usb_getdata(PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler) { uint16_t ret; PTPUSBBulkContainer usbdata; unsigned long written; PTP_USB *ptp_usb = (PTP_USB *) params->data; int putfunc_ret; LIBMTP_USB_DEBUG("GET DATA PHASE\n"); struct openusb_bulk_request bulk; memset(&usbdata, 0, sizeof (usbdata)); do { unsigned long len, rlen; ret = ptp_usb_getpacket(params, &usbdata, &rlen); if (ret != PTP_RC_OK) { ret = PTP_ERROR_IO; break; } if (dtoh16(usbdata.type) != PTP_USB_CONTAINER_DATA) { ret = PTP_ERROR_DATA_EXPECTED; break; } if (dtoh16(usbdata.code) != ptp->Code) { if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { libusb_glue_debug(params, "ptp2/ptp_usb_getdata: detected a broken " "PTP header, code field insane, expect problems! (But continuing)"); // Repair the header, so it won't wreak more havoc, don't just ignore it. // Typically these two fields will be broken. usbdata.code = htod16(ptp->Code); usbdata.trans_id = htod32(ptp->Transaction_ID); ret = PTP_RC_OK; } else { ret = dtoh16(usbdata.code); // This filters entirely insane garbage return codes, but still // makes it possible to return error codes in the code field when // getting data. It appears Windows ignores the contents of this // field entirely. if (ret < PTP_RC_Undefined || ret > PTP_RC_SpecificationOfDestinationUnsupported) { libusb_glue_debug(params, "ptp2/ptp_usb_getdata: detected a broken " "PTP header, code field insane."); ret = PTP_ERROR_IO; } break; } } if (rlen == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ) { /* Copy first part of data to 'data' */ putfunc_ret = handler->putfunc( params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data, &written ); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; /* stuff data directly to passed data handler */ while (1) { unsigned long readdata; uint16_t xret; xret = ptp_read_func( 0x20000000, handler, params->data, &readdata, 0 ); if (xret != PTP_RC_OK) return xret; if (readdata < 0x20000000) break; } return PTP_RC_OK; } if (rlen > dtoh32(usbdata.length)) { /* * Buffer the surplus response packet if it is >= * PTP_USB_BULK_HDR_LEN * (i.e. it is probably an entire package) * else discard it as erroneous surplus data. * This will even work if more than 2 packets appear * in the same transaction, they will just be handled * iteratively. * * Marcus observed stray bytes on iRiver devices; * these are still discarded. */ unsigned int packlen = dtoh32(usbdata.length); unsigned int surplen = rlen - packlen; if (surplen >= PTP_USB_BULK_HDR_LEN) { params->response_packet = malloc(surplen); memcpy(params->response_packet, (uint8_t *) & usbdata + packlen, surplen); params->response_packet_size = surplen; /* Ignore reading one extra byte if device flags have been set */ } else if (!FLAG_NO_ZERO_READS(ptp_usb) && (rlen - dtoh32(usbdata.length) == 1)) { libusb_glue_debug(params, "ptp2/ptp_usb_getdata: read %d bytes " "too much, expect problems!", rlen - dtoh32(usbdata.length)); } rlen = packlen; } /* For most PTP devices rlen is 512 == sizeof(usbdata) * here. For MTP devices splitting header and data it might * be 12. */ /* Evaluate full data length. */ len = dtoh32(usbdata.length) - PTP_USB_BULK_HDR_LEN; /* autodetect split header/data MTP devices */ if (dtoh32(usbdata.length) > 12 && (rlen == 12)) params->split_header_data = 1; /* Copy first part of data to 'data' */ putfunc_ret = handler->putfunc( params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data, &written ); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; if (FLAG_NO_ZERO_READS(ptp_usb) && len + PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ) { LIBMTP_USB_DEBUG("Reading in extra terminating byte\n"); // need to read in extra byte and discard it int result = 0, xread; unsigned char byte = 0; /* result = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &byte, 1, &xread, ptp_usb->timeout); */ bulk.payload = &byte; bulk.length = 1; bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); xread = bulk.result.transferred_bytes; if (result != 1) LIBMTP_INFO("Could not read in extra byte for PTP_USB_BULK_HS_MAX_PACKET_LEN_READ long file, return value 0x%04x\n", result); } else if (len + PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ && params->split_header_data == 0) { int zeroresult = 0, xread; unsigned char zerobyte = 0; LIBMTP_INFO("Reading in zero packet after header\n"); /* zeroresult = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &zerobyte, 0, &xread, ptp_usb->timeout); */ bulk.payload = &zerobyte; bulk.length = 0; bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; zeroresult = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->inep, &bulk); xread = bulk.result.transferred_bytes; if (zeroresult != 0) LIBMTP_INFO("LIBMTP panic: unable to read in zero packet, response 0x%04x", zeroresult); } /* Is that all of data? */ if (len + PTP_USB_BULK_HDR_LEN <= rlen) { break; } ret = ptp_read_func(len - (rlen - PTP_USB_BULK_HDR_LEN), handler, params->data, &rlen, 1); if (ret != PTP_RC_OK) { break; } } while (0); return ret; } uint16_t ptp_usb_getresp(PTPParams* params, PTPContainer* resp) { uint16_t ret; unsigned long rlen; PTPUSBBulkContainer usbresp; PTP_USB *ptp_usb = (PTP_USB *) (params->data); LIBMTP_USB_DEBUG("RESPONSE: "); memset(&usbresp, 0, sizeof (usbresp)); /* read response, it should never be longer than sizeof(usbresp) */ ret = ptp_usb_getpacket(params, &usbresp, &rlen); // Fix for bevahiour reported by Scott Snyder on Samsung YP-U3. The player // sends a packet containing just zeroes of length 2 (up to 4 has been seen too) // after a NULL packet when it should send the response. This code ignores // such illegal packets. while (ret == PTP_RC_OK && rlen < PTP_USB_BULK_HDR_LEN && usbresp.length == 0) { libusb_glue_debug(params, "ptp_usb_getresp: detected short response " "of %d bytes, expect problems! (re-reading " "response), rlen"); ret = ptp_usb_getpacket(params, &usbresp, &rlen); } if (ret != PTP_RC_OK) { ret = PTP_ERROR_IO; } else if (dtoh16(usbresp.type) != PTP_USB_CONTAINER_RESPONSE) { ret = PTP_ERROR_RESP_EXPECTED; } else if (dtoh16(usbresp.code) != resp->Code) { ret = dtoh16(usbresp.code); } LIBMTP_USB_DEBUG("%04x\n", ret); if (ret != PTP_RC_OK) { /* libusb_glue_error (params, "PTP: request code 0x%04x getting resp error 0x%04x", resp->Code, ret);*/ return ret; } /* build an appropriate PTPContainer */ resp->Code = dtoh16(usbresp.code); resp->SessionID = params->session_id; resp->Transaction_ID = dtoh32(usbresp.trans_id); if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { if (resp->Transaction_ID != params->transaction_id - 1) { libusb_glue_debug(params, "ptp_usb_getresp: detected a broken " "PTP header, transaction ID insane, expect " "problems! (But continuing)"); // Repair the header, so it won't wreak more havoc. resp->Transaction_ID = params->transaction_id - 1; } } resp->Param1 = dtoh32(usbresp.payload.params.param1); resp->Param2 = dtoh32(usbresp.payload.params.param2); resp->Param3 = dtoh32(usbresp.payload.params.param3); resp->Param4 = dtoh32(usbresp.payload.params.param4); resp->Param5 = dtoh32(usbresp.payload.params.param5); return ret; } /* Event handling functions */ /* PTP Events wait for or check mode */ #define PTP_EVENT_CHECK 0x0000 /* waits for */ #define PTP_EVENT_CHECK_FAST 0x0001 /* checks */ static inline uint16_t ptp_usb_event(PTPParams* params, PTPContainer* event, int wait) { uint16_t ret; int result, xread; unsigned long rlen; PTPUSBEventContainer usbevent; PTP_USB *ptp_usb = (PTP_USB *) (params->data); struct openusb_bulk_request bulk; memset(&usbevent, 0, sizeof (usbevent)); if ((params == NULL) || (event == NULL)) return PTP_ERROR_BADPARAM; ret = PTP_RC_OK; switch (wait) { case PTP_EVENT_CHECK: /* result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof (usbevent), &xread, 0); */ bulk.payload = (unsigned char *) &usbevent; bulk.length = sizeof (usbevent); bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); xread = bulk.result.transferred_bytes; if (result == 0) { /* result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof (usbevent), &xread, 0); */ bulk.payload = (unsigned char *) &usbevent; bulk.length = sizeof (usbevent); bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); xread = bulk.result.transferred_bytes; } if (result < 0) ret = PTP_ERROR_IO; break; case PTP_EVENT_CHECK_FAST: /* result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof (usbevent), &xread, ptp_usb->timeout); */ bulk.payload = (unsigned char *) &usbevent; bulk.length = sizeof (usbevent); bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); xread = bulk.result.transferred_bytes; if (result == 0) { /* result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof (usbevent), &xread, ptp_usb->timeout); */ bulk.payload = (unsigned char *) &usbevent; bulk.length = sizeof (usbevent); bulk.timeout = ptp_usb->timeout; bulk.flags = 0; bulk.next = NULL; result = openusb_bulk_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->intep, &bulk); xread = bulk.result.transferred_bytes; } if (result < 0) ret = PTP_ERROR_IO; break; default: ret = PTP_ERROR_BADPARAM; break; } if (ret != PTP_RC_OK) { libusb_glue_error(params, "PTP: reading event an error 0x%04x occurred", ret); return PTP_ERROR_IO; } rlen = result; if (rlen < 8) { libusb_glue_error(params, "PTP: reading event an short read of %ld bytes occurred", rlen); return PTP_ERROR_IO; } /* if we read anything over interrupt endpoint it must be an event */ /* build an appropriate PTPContainer */ event->Code = dtoh16(usbevent.code); event->SessionID = params->session_id; event->Transaction_ID = dtoh32(usbevent.trans_id); event->Param1 = dtoh32(usbevent.param1); event->Param2 = dtoh32(usbevent.param2); event->Param3 = dtoh32(usbevent.param3); return ret; } uint16_t ptp_usb_event_check(PTPParams* params, PTPContainer* event) { return ptp_usb_event(params, event, PTP_EVENT_CHECK_FAST); } uint16_t ptp_usb_event_wait(PTPParams* params, PTPContainer* event) { return ptp_usb_event(params, event, PTP_EVENT_CHECK); } uint16_t ptp_usb_control_cancel_request(PTPParams *params, uint32_t transactionid) { PTP_USB *ptp_usb = (PTP_USB *) (params->data); int ret; unsigned char buffer[6]; htod16a(&buffer[0], PTP_EC_CancelTransaction); htod32a(&buffer[2], transactionid); /* ret = libusb_control_transfer(ptp_usb->handle, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE, 0x64, 0x0000, 0x0000, buffer, sizeof(buffer), ptp_usb->timeout); */ struct openusb_ctrl_request ctrl; ctrl.setup.bmRequestType = USB_REQ_TYPE_CLASS | USB_RECIP_INTERFACE; ctrl.setup.bRequest = 0x64; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 0; ctrl.payload = (unsigned char *)&buffer; // Out ctrl.length = sizeof (buffer); ctrl.timeout = ptp_usb->timeout; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(*ptp_usb->handle, ptp_usb->interface, ptp_usb->outep, &ctrl); if (ctrl.result.transferred_bytes < sizeof (buffer)) return PTP_ERROR_IO; return PTP_RC_OK; } static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, openusb_dev_handle_t* dev) { openusb_dev_handle_t device_handle; unsigned char buf[255]; int ret, usbresult; params->sendreq_func = ptp_usb_sendreq; params->senddata_func = ptp_usb_senddata; params->getresp_func = ptp_usb_getresp; params->getdata_func = ptp_usb_getdata; params->cancelreq_func = ptp_usb_control_cancel_request; params->data = ptp_usb; params->transaction_id = 0; /* * This is hardcoded here since we have no devices whatsoever that are BE. * Change this the day we run into our first BE device (if ever). */ params->byteorder = PTP_DL_LE; ptp_usb->timeout = get_timeout(ptp_usb); ret = openusb_open_device(libmtp_openusb_handle, *dev, USB_INIT_DEFAULT, &device_handle); if (ret != OPENUSB_SUCCESS) { perror("usb_open()"); return -1; } ptp_usb->handle = malloc(sizeof(openusb_dev_handle_t)); *ptp_usb->handle = device_handle; /* * If this device is known to be wrongfully claimed by other kernel * drivers (such as mass storage), then try to unload it to make it * accessible from user space. * Note: OpenUSB doesn't support this type of operation? */ /* if (FLAG_UNLOAD_DRIVER(ptp_usb) && libusb_kernel_driver_active (device_handle, ptp_usb->interface) ) { if (OPENUSB_SUCCESS != libusb_detach_kernel_driver (device_handle, ptp_usb->interface)) { return -1; } } */ // It seems like on kernel 2.6.31 if we already have it open on another // pthread in our app, we'll get an error if we try to claim it again, // but that error is harmless because our process already claimed the interface usbresult = openusb_claim_interface(device_handle, ptp_usb->interface, USB_INIT_DEFAULT); if (usbresult != 0) fprintf(stderr, "ignoring usb_claim_interface = %d", usbresult); if (FLAG_SWITCH_MODE_BLACKBERRY(ptp_usb)) { int ret; // FIXME : Only for BlackBerry Storm // What does it mean? Maybe switch mode... // This first control message is absolutely necessary usleep(1000); /* ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xaa, 0x00, 0x04, buf, 0x40, 1000); */ struct openusb_ctrl_request ctrl; ctrl.setup.bmRequestType = USB_REQ_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN; ctrl.setup.bRequest = 0xaa; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 4; ctrl.payload = (unsigned char *)&buf; // Out ctrl.length = 0x40; ctrl.timeout = 1000; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); LIBMTP_USB_DEBUG("BlackBerry magic part 1:\n"); LIBMTP_USB_DATA(buf, ctrl.result.transferred_bytes, 16); usleep(1000); // This control message is unnecessary /* ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xa5, 0x00, 0x01, buf, 0x02, 1000); */ ctrl.setup.bmRequestType = USB_REQ_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN; ctrl.setup.bRequest = 0xa5; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 1; ctrl.payload = (unsigned char *)&buf; // Out ctrl.length = 0x02; ctrl.timeout = 1000; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); LIBMTP_USB_DEBUG("BlackBerry magic part 2:\n"); LIBMTP_USB_DATA(buf, ctrl.result.transferred_bytes, 16); usleep(1000); // This control message is unnecessary /* ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xa8, 0x00, 0x01, buf, 0x05, 1000); */ ctrl.setup.bmRequestType = USB_REQ_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN; ctrl.setup.bRequest = 0xa8; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 1; ctrl.payload = (unsigned char *)&buf; // Out ctrl.length = 0x05; ctrl.timeout = 1000; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); LIBMTP_USB_DEBUG("BlackBerry magic part 3:\n"); LIBMTP_USB_DATA(buf, ctrl.result.transferred_bytes, 16); usleep(1000); // This control message is unnecessary /* ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xa8, 0x00, 0x01, buf, 0x11, 1000); */ ctrl.setup.bmRequestType = USB_REQ_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN; ctrl.setup.bRequest = 0xa8; ctrl.setup.wValue = 0; ctrl.setup.wIndex = 1; ctrl.payload = (unsigned char *)&buf; // Out ctrl.length = 0x11; ctrl.timeout = 1000; ctrl.next = NULL; ctrl.flags = 0; ret = openusb_ctrl_xfer(device_handle, ptp_usb->interface, ptp_usb->outep, &ctrl); LIBMTP_USB_DEBUG("BlackBerry magic part 4:\n"); LIBMTP_USB_DATA(buf, ctrl.result.transferred_bytes, 16); usleep(1000); } return 0; } static void clear_stall(PTP_USB* ptp_usb) { uint16_t status; int ret; /* check the inep status */ /* status = 0; ret = usb_get_endpoint_status(ptp_usb, ptp_usb->inep, &status); if (ret < 0) { perror("inep: usb_get_endpoint_status()"); } else if (status) { LIBMTP_INFO("Clearing stall on IN endpoint\n"); ret = libusb_clear_halt(ptp_usb->handle, ptp_usb->inep); if (ret != OPENUSB_SUCCESS) { perror("usb_clear_stall_feature()"); } } /* check the outep status */ /*status = 0; ret = usb_get_endpoint_status(ptp_usb, ptp_usb->outep, &status); if (ret < 0) { perror("outep: usb_get_endpoint_status()"); } else if (status) { LIBMTP_INFO("Clearing stall on OUT endpoint\n"); ret = libusb_clear_halt(ptp_usb->handle, ptp_usb->outep); if (ret != OPENUSB_SUCCESS) { perror("usb_clear_stall_feature()"); } } */ /* TODO: do we need this for INTERRUPT (ptp_usb->intep) too? */ } static void clear_halt(PTP_USB* ptp_usb) { int ret; /* ret = libusb_clear_halt(ptp_usb->handle, ptp_usb->inep); if (ret < 0) { perror("usb_clear_halt() on IN endpoint"); } ret = libusb_clear_halt(ptp_usb->handle, ptp_usb->outep); if (ret < 0) { perror("usb_clear_halt() on OUT endpoint"); } ret = libusb_clear_halt(ptp_usb->handle, ptp_usb->intep); if (ret < 0) { perror("usb_clear_halt() on INTERRUPT endpoint"); } */ } static void close_usb(PTP_USB* ptp_usb) { if (!FLAG_NO_RELEASE_INTERFACE(ptp_usb)) { /* * Clear any stalled endpoints * On misbehaving devices designed for Windows/Mac, quote from: * http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt * Device does Bad Things(tm) when it gets a GET_STATUS after CLEAR_HALT * (...) Windows, when clearing a stall, only sends the CLEAR_HALT command, * and presumes that the stall has cleared. Some devices actually choke * if the CLEAR_HALT is followed by a GET_STATUS (used to determine if the * STALL is persistant or not). */ clear_stall(ptp_usb); // Clear halts on any endpoints clear_halt(ptp_usb); // Added to clear some stuff on the OUT endpoint // TODO: is this good on the Mac too? // HINT: some devices may need that you comment these two out too. //libusb_clear_halt(ptp_usb->handle, ptp_usb->outep); //libusb_release_interface(ptp_usb->handle, (int) ptp_usb->interface); } if (FLAG_FORCE_RESET_ON_CLOSE(ptp_usb)) { /* * Some devices really love to get reset after being * disconnected. Again, since Windows never disconnects * a device closing behaviour is seldom or never exercised * on devices when engineered and often error prone. * Reset may help some. */ openusb_reset(*ptp_usb->handle); } openusb_close_device(*ptp_usb->handle); } /** * Self-explanatory? */ static int find_interface_and_endpoints(openusb_dev_handle_t *dev, uint8_t *conf, uint8_t *interface, uint8_t *altsetting, int* inep, int* inep_maxpacket, int* outep, int *outep_maxpacket, int* intep) { uint8_t i; int ret; struct usb_device_desc desc; ret = openusb_parse_device_desc(libmtp_openusb_handle, *dev, NULL, 0, &desc); if (ret != OPENUSB_SUCCESS) return -1; // Loop over the device configurations for (i = 0; i < desc.bNumConfigurations; i++) { uint8_t j; struct usb_config_desc config; ret = openusb_parse_config_desc(libmtp_openusb_handle, *dev, NULL, 0, i, &config); if (ret != OPENUSB_SUCCESS) continue; *conf = desc.bConfigurationValue; // Loop over each configurations interfaces for (j = 0; j < config.bNumInterfaces; j++) { uint8_t k; uint8_t no_ep; int found_inep = 0; int found_outep = 0; int found_intep = 0; struct usb_endpoint_desc ep; struct usb_interface_desc ifcdesc; openusb_parse_interface_desc(libmtp_openusb_handle, *dev, NULL, 0, i, j, 0, &ifcdesc); // MTP devices shall have 3 endpoints, ignore those interfaces // that haven't. no_ep = ifcdesc.bNumEndpoints; if (no_ep != 3) continue; *interface = ifcdesc.bInterfaceNumber; *altsetting = ifcdesc.bAlternateSetting; // Loop over the three endpoints to locate two bulk and // one interrupt endpoint and FAIL if we cannot, and continue. for (k = 0; k < no_ep; k++) { openusb_parse_endpoint_desc(libmtp_openusb_handle, *dev, NULL, 0, i, j, 0, k, &ep); if (ep.bmAttributes == USB_ENDPOINT_TYPE_BULK) { if ((ep.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_ENDPOINT_DIR_MASK) { *inep = ep.bEndpointAddress; *inep_maxpacket = ep.wMaxPacketSize; found_inep = 1; } if ((ep.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == 0) { *outep = ep.bEndpointAddress; *outep_maxpacket = ep.wMaxPacketSize; found_outep = 1; } } else if (ep.bmAttributes == USB_ENDPOINT_TYPE_INTERRUPT) { if ((ep.bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_ENDPOINT_DIR_MASK) { *intep = ep.bEndpointAddress; found_intep = 1; } } } if (found_inep && found_outep && found_intep) { // We assigned the endpoints so return here. return 0; } // Else loop to next interface/config } } return -1; } /** * This function assigns params and usbinfo given a raw device * as input. * @param device the device to be assigned. * @param usbinfo a pointer to the new usbinfo. * @return an error code. */ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, PTPParams *params, void **usbinfo) { PTP_USB *ptp_usb; openusb_devid_t *ldevice; uint16_t ret = 0; int err, found = 0, i; unsigned int nrofdevs; openusb_devid_t *devs = NULL; struct usb_device_desc desc; /* See if we can find this raw device again... */ init_usb(); openusb_get_devids_by_bus(libmtp_openusb_handle, 0, &devs, &nrofdevs); for (i = 0; i < nrofdevs; i++) { /* if (libusb_get_bus_number(devs[i]) != device->bus_location) continue; if (libusb_get_device_address(devs[i]) != device->devnum) continue; */ ret = openusb_parse_device_desc(libmtp_openusb_handle, devs[i], NULL, 0, &desc); if (ret != OPENUSB_SUCCESS) continue; if (desc.idVendor == device->device_entry.vendor_id && desc.idProduct == device->device_entry.product_id) { ldevice = &devs[i]; found = 1; break; } } /* Device has gone since detecting raw devices! */ if (!found) { openusb_free_devid_list(devs); return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } /* Allocate structs */ ptp_usb = (PTP_USB *) malloc(sizeof (PTP_USB)); if (ptp_usb == NULL) { openusb_free_devid_list(devs); return LIBMTP_ERROR_MEMORY_ALLOCATION; } /* Start with a blank slate (includes setting device_flags to 0) */ memset(ptp_usb, 0, sizeof (PTP_USB)); /* Copy the raw device */ memcpy(&ptp_usb->rawdevice, device, sizeof (LIBMTP_raw_device_t)); /* * Some devices must have their "OS Descriptor" massaged in order * to work. */ if (FLAG_ALWAYS_PROBE_DESCRIPTOR(ptp_usb)) { // Massage the device descriptor (void) probe_device_descriptor(ldevice, NULL); } /* Assign interface and endpoints to usbinfo... */ err = find_interface_and_endpoints(ldevice, &ptp_usb->conf, &ptp_usb->interface, &ptp_usb->altsetting, &ptp_usb->inep, &ptp_usb->inep_maxpacket, &ptp_usb->outep, &ptp_usb->outep_maxpacket, &ptp_usb->intep); if (err) { openusb_free_devid_list(devs); LIBMTP_ERROR("LIBMTP PANIC: Unable to find interface & endpoints of device\n"); return LIBMTP_ERROR_CONNECTING; } /* Copy USB version number */ ptp_usb->bcdusb = desc.bcdUSB; /* Attempt to initialize this device */ if (init_ptp_usb(params, ptp_usb, ldevice) < 0) { LIBMTP_ERROR("LIBMTP PANIC: Unable to initialize device\n"); return LIBMTP_ERROR_CONNECTING; } /* * This works in situations where previous bad applications * have not used LIBMTP_Release_Device on exit */ if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("PTP_ERROR_IO: failed to open session, trying again after resetting USB interface\n"); LIBMTP_ERROR("LIBMTP libusb: Attempt to reset device\n"); openusb_reset(*ptp_usb->handle); close_usb(ptp_usb); if (init_ptp_usb(params, ptp_usb, ldevice) < 0) { LIBMTP_ERROR("LIBMTP PANIC: Could not init USB on second attempt\n"); return LIBMTP_ERROR_CONNECTING; } /* Device has been reset, try again */ if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("LIBMTP PANIC: failed to open session on second attempt\n"); return LIBMTP_ERROR_CONNECTING; } } /* Was the transaction id invalid? Try again */ if (ret == PTP_RC_InvalidTransactionID) { LIBMTP_ERROR("LIBMTP WARNING: Transaction ID was invalid, increment and try again\n"); params->transaction_id += 10; ret = ptp_opensession(params, 1); } if (ret != PTP_RC_SessionAlreadyOpened && ret != PTP_RC_OK) { LIBMTP_ERROR("LIBMTP PANIC: Could not open session! " "(Return code %d)\n Try to reset the device.\n", ret); openusb_release_interface(*ptp_usb->handle, ptp_usb->interface); return LIBMTP_ERROR_CONNECTING; } /* OK configured properly */ *usbinfo = (void *) ptp_usb; return LIBMTP_ERROR_NONE; } void close_device(PTP_USB *ptp_usb, PTPParams *params) { if (ptp_closesession(params) != PTP_RC_OK) LIBMTP_ERROR("ERROR: Could not close session!\n"); close_usb(ptp_usb); } void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout) { ptp_usb->timeout = timeout; } void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout) { *timeout = ptp_usb->timeout; } int guess_usb_speed(PTP_USB *ptp_usb) { int bytes_per_second; /* * We don't know the actual speeds so these are rough guesses * from the info you can find here: * http://en.wikipedia.org/wiki/USB#Transfer_rates * http://www.barefeats.com/usb2.html */ switch (ptp_usb->bcdusb & 0xFF00) { case 0x0100: /* 1.x USB versions let's say 1MiB/s */ bytes_per_second = 1 * 1024 * 1024; break; case 0x0200: case 0x0300: /* USB 2.0 nominal speed 18MiB/s */ /* USB 3.0 won't be worse? */ bytes_per_second = 18 * 1024 * 1024; break; default: /* Half-guess something? */ bytes_per_second = 1 * 1024 * 1024; break; } return bytes_per_second; } static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status) { /* return libusb_control_transfer(ptp_usb->handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_ENDPOINT, LIBUSB_REQUEST_GET_STATUS, USB_FEATURE_HALT, ep, (unsigned char *) status, 2, ptp_usb->timeout); */ struct openusb_ctrl_request ctrl; ctrl.flags = 0; ctrl.length = 2; ctrl.payload = (unsigned char *)status; ctrl.timeout = ptp_usb->timeout; ctrl.next = NULL; ctrl.setup.bRequest = USB_REQ_GET_STATUS; ctrl.setup.bmRequestType = USB_ENDPOINT_IN | USB_RECIP_ENDPOINT; ctrl.setup.wIndex = ep; ctrl.setup.wValue = USB_FEATURE_HALT; openusb_ctrl_xfer(*ptp_usb->handle, ptp_usb->interface, ep, &ctrl); return ctrl.result.status; } libmtp-1.1.10/src/unicode.c0000644000175000001440000001256512121274441012366 00000000000000/** * \file unicode.c * * This file contains general Unicode string manipulation functions. * It mainly consist of functions for converting between UCS-2 (used on * the devices) and UTF-8 (used by several applications). * * For a deeper understanding of Unicode encoding formats see the * Wikipedia entries for * UTF-16/UCS-2 * and UTF-8. * * Copyright (C) 2005-2009 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #include "config.h" #include #include #ifdef HAVE_ICONV #include "iconv.h" #else #error "libmtp unicode.c needs fixing to work without iconv()!" #endif #include "libmtp.h" #include "unicode.h" #include "util.h" #include "ptp.h" /** * The size of the buffer (in characters) used for creating string copies. */ #define STRING_BUFFER_LENGTH 1024 /** * Gets the length (in characters, not bytes) of a unicode * UCS-2 string, eg a string which physically is 0x00 0x41 0x00 0x00 * will return a value of 1. * * @param unicstr a UCS-2 Unicode string * @return the length of the string, in number of characters. If you * want to know the length in bytes, multiply this by two and * add two (for zero terminator). */ int ucs2_strlen(uint16_t const * const unicstr) { int length; /* Unicode strings are terminated with 2 * 0x00 */ for(length = 0; unicstr[length] != 0x0000U; length ++); return length; } /** * Converts a big-endian UTF-16 2-byte string * to a UTF-8 string. Actually just a UCS-2 internal conversion * routine that strips off the BOM if there is one. * * @param device a pointer to the current device. * @param unicstr the UTF-16 unicode string to convert * @return a UTF-8 string. */ char *utf16_to_utf8(LIBMTP_mtpdevice_t *device, const uint16_t *unicstr) { PTPParams *params = (PTPParams *) device->params; char *stringp = (char *) unicstr; char loclstr[STRING_BUFFER_LENGTH*3+1]; // UTF-8 encoding is max 3 bytes per UCS2 char. char *locp = loclstr; size_t nconv; size_t convlen = (ucs2_strlen(unicstr)+1) * sizeof(uint16_t); // UCS-2 is 16 bit wide, include terminator size_t convmax = STRING_BUFFER_LENGTH*3; loclstr[0]='\0'; /* Do the conversion. */ nconv = iconv(params->cd_ucs2_to_locale, &stringp, &convlen, &locp, &convmax); if (nconv == (size_t) -1) { // Return partial string anyway. *locp = '\0'; } loclstr[STRING_BUFFER_LENGTH*3] = '\0'; // Strip off any BOM, it's totally useless... if ((uint8_t) loclstr[0] == 0xEFU && (uint8_t) loclstr[1] == 0xBBU && (uint8_t) loclstr[2] == 0xBFU) { return strdup(loclstr+3); } return strdup(loclstr); } /** * Converts a UTF-8 string to a big-endian UTF-16 2-byte string * Actually just a UCS-2 internal conversion. * * @param device a pointer to the current device. * @param localstr the UTF-8 unicode string to convert * @return a UTF-16 string. */ uint16_t *utf8_to_utf16(LIBMTP_mtpdevice_t *device, const char *localstr) { PTPParams *params = (PTPParams *) device->params; char *stringp = (char *) localstr; // cast away "const" char unicstr[(STRING_BUFFER_LENGTH+1)*2]; // UCS2 encoding is 2 bytes per UTF-8 char. char *unip = unicstr; size_t nconv = 0; size_t convlen = strlen(localstr)+1; // utf8 bytes, include terminator size_t convmax = STRING_BUFFER_LENGTH*2; unicstr[0]='\0'; unicstr[1]='\0'; /* Do the conversion. */ nconv = iconv(params->cd_locale_to_ucs2, &stringp, &convlen, &unip, &convmax); if (nconv == (size_t) -1) { // Return partial string anyway. unip[0] = '\0'; unip[1] = '\0'; } // make sure the string is null terminated unicstr[STRING_BUFFER_LENGTH*2] = '\0'; unicstr[STRING_BUFFER_LENGTH*2+1] = '\0'; // allocate the string to be returned // Note: can't use strdup since every other byte is a null byte int ret_len = ucs2_strlen((uint16_t*)unicstr)*sizeof(uint16_t)+2; uint16_t* ret = malloc(ret_len); memcpy(ret,unicstr,(size_t)ret_len); return ret; } /** * This helper function simply removes any consecutive chars * > 0x7F and replace then with an underscore. In UTF-8 * consequtive chars > 0x7F represent one single character so * it has to be done like this (and it's elegant). It will only * shrink the string in size so no copying is needed. */ void strip_7bit_from_utf8(char *str) { int i,j,k; i = 0; j = 0; k = strlen(str); while (i < k) { if ((uint8_t) str[i] > 0x7FU) { str[j] = '_'; i++; // Skip over any consequtive > 0x7F chars. while((uint8_t) str[i] > 0x7FU) { i++; } } else { str[j] = str[i]; i++; } j++; } // Terminate stripped string... str[j] = '\0'; } libmtp-1.1.10/src/ptp.c0000644000175000001440000064447212345765122011564 00000000000000/* ptp.c * * Copyright (C) 2001-2004 Mariusz Woloszyn * Copyright (C) 2003-2012 Marcus Meissner * Copyright (C) 2006-2008 Linus Walleij * Copyright (C) 2007 Tero Saarni * Copyright (C) 2009 Axel Waggershauser * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #define _BSD_SOURCE #include "config.h" #include "ptp.h" #ifdef HAVE_LIBXML2 # include #endif #include #include #include #include #include #ifdef ENABLE_NLS # include # undef _ # define _(String) dgettext (PACKAGE, String) # ifdef gettext_noop # define N_(String) gettext_noop (String) # else # define N_(String) (String) # endif #else # define textdomain(String) (String) # define gettext(String) (String) # define dgettext(Domain,Message) (Message) # define dcgettext(Domain,Message,Type) (Message) # define bindtextdomain(Domain,Directory) (Domain) # define _(String) (String) # define N_(String) (String) #endif #define CHECK_PTP_RC(result) {uint16_t r=(result); if (r!=PTP_RC_OK) return r;} #define PTP_CNT_INIT(cnt) {memset(&cnt,0,sizeof(cnt));} static uint16_t ptp_exit_recv_memory_handler (PTPDataHandler*,unsigned char**,unsigned long*); static uint16_t ptp_init_recv_memory_handler(PTPDataHandler*); static uint16_t ptp_init_send_memory_handler(PTPDataHandler*,unsigned char*,unsigned long len); static uint16_t ptp_exit_send_memory_handler (PTPDataHandler *handler); void ptp_debug (PTPParams *params, const char *format, ...) { va_list args; va_start (args, format); if (params->debug_func!=NULL) params->debug_func (params->data, format, args); else { vfprintf (stderr, format, args); fprintf (stderr,"\n"); fflush (stderr); } va_end (args); } void ptp_error (PTPParams *params, const char *format, ...) { va_list args; va_start (args, format); if (params->error_func!=NULL) params->error_func (params->data, format, args); else { vfprintf (stderr, format, args); fprintf (stderr,"\n"); fflush (stderr); } va_end (args); } /* Pack / unpack functions */ #include "ptp-pack.c" /* major PTP functions */ /* Transaction data phase description */ #define PTP_DP_NODATA 0x0000 /* no data phase */ #define PTP_DP_SENDDATA 0x0001 /* sending data */ #define PTP_DP_GETDATA 0x0002 /* receiving data */ #define PTP_DP_DATA_MASK 0x00ff /* data phase mask */ /** * ptp_transaction: * params: PTPParams* * PTPContainer* ptp - general ptp container * uint16_t flags - lower 8 bits - data phase description * unsigned int sendlen - senddata phase data length * char** data - send or receive data buffer pointer * int* recvlen - receive data length * * Performs PTP transaction. ptp is a PTPContainer with appropriate fields * filled in (i.e. operation code and parameters). It's up to caller to do * so. * The flags decide thether the transaction has a data phase and what is its * direction (send or receive). * If transaction is sending data the sendlen should contain its length in * bytes, otherwise it's ignored. * The data should contain an address of a pointer to data going to be sent * or is filled with such a pointer address if data are received depending * od dataphase direction (send or received) or is beeing ignored (no * dataphase). * The memory for a pointer should be preserved by the caller, if data are * beeing retreived the appropriate amount of memory is beeing allocated * (the caller should handle that!). * * Return values: Some PTP_RC_* code. * Upon success PTPContainer* ptp contains PTP Response Phase container with * all fields filled in. **/ uint16_t ptp_transaction_new (PTPParams* params, PTPContainer* ptp, uint16_t flags, uint64_t sendlen, PTPDataHandler *handler ) { int tries; uint16_t cmd; if ((params==NULL) || (ptp==NULL)) return PTP_ERROR_BADPARAM; cmd = ptp->Code; ptp->Transaction_ID=params->transaction_id++; ptp->SessionID=params->session_id; /* send request */ CHECK_PTP_RC(params->sendreq_func (params, ptp)); /* is there a dataphase? */ switch (flags&PTP_DP_DATA_MASK) { case PTP_DP_SENDDATA: { uint16_t ret; ret = params->senddata_func(params, ptp, sendlen, handler); if (ret == PTP_ERROR_CANCEL) { ret = params->cancelreq_func(params, params->transaction_id-1); if (ret == PTP_RC_OK) ret = PTP_ERROR_CANCEL; } if (ret != PTP_RC_OK) return ret; } break; case PTP_DP_GETDATA: { uint16_t ret; ret = params->getdata_func(params, ptp, handler); if (ret == PTP_ERROR_CANCEL) { ret = params->cancelreq_func(params, params->transaction_id-1); if (ret == PTP_RC_OK) ret = PTP_ERROR_CANCEL; } if (ret != PTP_RC_OK) return ret; } break; case PTP_DP_NODATA: break; default: return PTP_ERROR_BADPARAM; } tries = 3; while (tries--) { uint16_t ret; /* get response */ ret = params->getresp_func(params, ptp); if (ret == PTP_ERROR_RESP_EXPECTED) { ptp_debug (params,"PTP: response expected but not got, retrying."); tries++; continue; } if (ret != PTP_RC_OK) return ret; if (ptp->Transaction_ID < params->transaction_id-1) { tries++; ptp_debug (params, "PTP: Sequence number mismatch %d vs expected %d, suspecting old reply.", ptp->Transaction_ID, params->transaction_id-1 ); continue; } if (ptp->Transaction_ID != params->transaction_id-1) { /* try to clean up potential left overs from previous session */ if ((cmd == PTP_OC_OpenSession) && tries) continue; ptp_error (params, "PTP: Sequence number mismatch %d vs expected %d.", ptp->Transaction_ID, params->transaction_id-1 ); return PTP_ERROR_BADPARAM; } break; } return ptp->Code; } /* memory data get/put handler */ typedef struct { unsigned char *data; unsigned long size, curoff; } PTPMemHandlerPrivate; static uint16_t memory_getfunc(PTPParams* params, void* private, unsigned long wantlen, unsigned char *data, unsigned long *gotlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)private; unsigned long tocopy = wantlen; if (priv->curoff + tocopy > priv->size) tocopy = priv->size - priv->curoff; memcpy (data, priv->data + priv->curoff, tocopy); priv->curoff += tocopy; *gotlen = tocopy; return PTP_RC_OK; } static uint16_t memory_putfunc(PTPParams* params, void* private, unsigned long sendlen, unsigned char *data, unsigned long *putlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)private; if (priv->curoff + sendlen > priv->size) { priv->data = realloc (priv->data, priv->curoff+sendlen); if (!priv->data) return PTP_RC_GeneralError; priv->size = priv->curoff + sendlen; } memcpy (priv->data + priv->curoff, data, sendlen); priv->curoff += sendlen; *putlen = sendlen; return PTP_RC_OK; } /* init private struct for receiving data. */ static uint16_t ptp_init_recv_memory_handler(PTPDataHandler *handler) { PTPMemHandlerPrivate* priv; priv = malloc (sizeof(PTPMemHandlerPrivate)); if (!priv) return PTP_RC_GeneralError; handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = NULL; priv->size = 0; priv->curoff = 0; return PTP_RC_OK; } /* init private struct and put data in for sending data. * data is still owned by caller. */ static uint16_t ptp_init_send_memory_handler(PTPDataHandler *handler, unsigned char *data, unsigned long len ) { PTPMemHandlerPrivate* priv; priv = malloc (sizeof(PTPMemHandlerPrivate)); if (!priv) return PTP_RC_GeneralError; handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = data; priv->size = len; priv->curoff = 0; return PTP_RC_OK; } /* free private struct + data */ static uint16_t ptp_exit_send_memory_handler (PTPDataHandler *handler) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)handler->priv; /* data is owned by caller */ free (priv); return PTP_RC_OK; } /* hand over our internal data to caller */ static uint16_t ptp_exit_recv_memory_handler (PTPDataHandler *handler, unsigned char **data, unsigned long *size ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)handler->priv; *data = priv->data; *size = priv->size; free (priv); return PTP_RC_OK; } /* fd data get/put handler */ typedef struct { int fd; } PTPFDHandlerPrivate; static uint16_t fd_getfunc(PTPParams* params, void* private, unsigned long wantlen, unsigned char *data, unsigned long *gotlen ) { PTPFDHandlerPrivate* priv = (PTPFDHandlerPrivate*)private; int got; got = read (priv->fd, data, wantlen); if (got != -1) *gotlen = got; else return PTP_RC_GeneralError; return PTP_RC_OK; } static uint16_t fd_putfunc(PTPParams* params, void* private, unsigned long sendlen, unsigned char *data, unsigned long *putlen ) { int written; PTPFDHandlerPrivate* priv = (PTPFDHandlerPrivate*)private; written = write (priv->fd, data, sendlen); if (written != -1) *putlen = written; else return PTP_RC_GeneralError; return PTP_RC_OK; } static uint16_t ptp_init_fd_handler(PTPDataHandler *handler, int fd) { PTPFDHandlerPrivate* priv; priv = malloc (sizeof(PTPFDHandlerPrivate)); if (!priv) return PTP_RC_GeneralError; handler->priv = priv; handler->getfunc = fd_getfunc; handler->putfunc = fd_putfunc; priv->fd = fd; return PTP_RC_OK; } static uint16_t ptp_exit_fd_handler (PTPDataHandler *handler) { PTPFDHandlerPrivate* priv = (PTPFDHandlerPrivate*)handler->priv; free (priv); return PTP_RC_OK; } /* Old style transaction, based on memory */ uint16_t ptp_transaction (PTPParams* params, PTPContainer* ptp, uint16_t flags, uint64_t sendlen, unsigned char **data, unsigned int *recvlen ) { PTPDataHandler handler; uint16_t ret; switch (flags & PTP_DP_DATA_MASK) { case PTP_DP_SENDDATA: ret = ptp_init_send_memory_handler (&handler, *data, sendlen); if (ret != PTP_RC_OK) return ret; break; case PTP_DP_GETDATA: ret = ptp_init_recv_memory_handler (&handler); if (ret != PTP_RC_OK) return ret; break; default:break; } ret = ptp_transaction_new (params, ptp, flags, sendlen, &handler); switch (flags & PTP_DP_DATA_MASK) { case PTP_DP_SENDDATA: ptp_exit_send_memory_handler (&handler); break; case PTP_DP_GETDATA: { unsigned long len; ptp_exit_recv_memory_handler (&handler, data, &len); if (recvlen) *recvlen = len; break; } default:break; } return ret; } /** * PTP operation functions * * all ptp_ functions should take integer parameters * in host byte order! **/ /** * ptp_getdeviceinfo: * params: PTPParams* * * Gets device info dataset and fills deviceinfo structure. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getdeviceinfo (PTPParams* params, PTPDeviceInfo* deviceinfo) { uint16_t ret; unsigned long len; PTPContainer ptp; unsigned char* di=NULL; PTPDataHandler handler; ptp_init_recv_memory_handler (&handler); PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetDeviceInfo; ptp.Nparam=0; len=0; ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); ptp_exit_recv_memory_handler (&handler, &di, &len); if (!di) ret = PTP_RC_GeneralError; if (ret == PTP_RC_OK) ptp_unpack_DI(params, di, deviceinfo, len); free(di); return ret; } uint16_t ptp_canon_eos_getdeviceinfo (PTPParams* params, PTPCanonEOSDeviceInfo*di) { uint16_t ret; PTPContainer ptp; PTPDataHandler handler; unsigned long len; unsigned char *data; ptp_init_recv_memory_handler (&handler); PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_EOS_GetDeviceInfoEx; ptp.Nparam=0; len=0; data=NULL; ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); ptp_exit_recv_memory_handler (&handler, &data, &len); if (ret == PTP_RC_OK) ptp_unpack_EOS_DI(params, data, di, len); free (data); return ret; } #ifdef HAVE_LIBXML2 static int traverse_tree (PTPParams *params, int depth, xmlNodePtr node) { xmlNodePtr next; xmlChar *xchar; int n; char *xx; if (!node) return 0; xx = malloc (depth * 4 + 1); memset (xx, ' ', depth*4); xx[depth*4] = 0; n = xmlChildElementCount (node); next = node; do { fprintf(stderr,"%snode %s\n", xx,next->name); fprintf(stderr,"%selements %d\n", xx,n); xchar = xmlNodeGetContent (next); fprintf(stderr,"%scontent %s\n", xx,xchar); traverse_tree (params, depth+1,xmlFirstElementChild (next)); } while ((next = xmlNextElementSibling (next))); free (xx); return PTP_RC_OK; } static int parse_9301_cmd_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di) { xmlNodePtr next; int cnt; cnt = 0; next = xmlFirstElementChild (node); while (next) { cnt++; next = xmlNextElementSibling (next); } di->OperationsSupported_len = cnt; di->OperationsSupported = malloc (cnt*sizeof(di->OperationsSupported[0])); cnt = 0; next = xmlFirstElementChild (node); while (next) { unsigned int p; sscanf((char*)next->name, "c%04x", &p); ptp_debug( params, "cmd %s / 0x%04x", next->name, p); di->OperationsSupported[cnt++] = p; next = xmlNextElementSibling (next); } return PTP_RC_OK; } static int parse_9301_value (PTPParams *params, const char *str, uint16_t type, PTPPropertyValue *propval) { switch (type) { case 6: { /*UINT32*/ unsigned int x; if (!sscanf(str,"%08x", &x)) { ptp_debug( params, "could not parse uint32 %s", str); return PTP_RC_GeneralError; } ptp_debug( params, "\t%d", x); propval->u32 = x; break; } case 5: { /*INT32*/ int x; if (!sscanf(str,"%08x", &x)) { ptp_debug( params, "could not parse int32 %s", str); return PTP_RC_GeneralError; } ptp_debug( params, "\t%d", x); propval->i32 = x; break; } case 4: { /*UINT16*/ unsigned int x; if (!sscanf(str,"%04x", &x)) { ptp_debug( params, "could not parse uint16 %s", str); return PTP_RC_GeneralError; } ptp_debug( params, "\t%d", x); propval->u16 = x; break; } case 3: { /*INT16*/ int x; if (!sscanf(str,"%04x", &x)) { ptp_debug( params, "could not parse int16 %s", str); return PTP_RC_GeneralError; } ptp_debug( params, "\t%d", x); propval->i16 = x; break; } case 2: { /*UINT8*/ unsigned int x; if (!sscanf(str,"%02x", &x)) { ptp_debug( params, "could not parse uint8 %s", str); return PTP_RC_GeneralError; } ptp_debug( params, "\t%d", x); propval->u8 = x; break; } case 1: { /*INT8*/ int x; if (!sscanf(str,"%02x", &x)) { ptp_debug( params, "could not parse int8 %s", str); return PTP_RC_GeneralError; } ptp_debug( params, "\t%d", x); propval->i8 = x; break; } case 65535: { /* string */ int len; /* ascii ptp string, 1 byte length, little endian 16 bit chars */ if (sscanf(str,"%02x", &len)) { int i; char *xstr = malloc(len+1); for (i=0;i>8) & 0xff) | ((xc & 0xff) << 8); xstr[i] = cx; } xstr[len] = 0; } ptp_debug( params, "\t%s", xstr); propval->str = xstr; break; } ptp_debug( params, "string %s not parseable!", str); return PTP_RC_GeneralError; } case 7: /*INT64*/ case 8: /*UINT64*/ case 9: /*INT128*/ case 10: /*UINT128*/ default: ptp_debug( params, "unhandled data type %d!", type); return PTP_RC_GeneralError; } return PTP_RC_OK; } static int parse_9301_propdesc (PTPParams *params, xmlNodePtr next, PTPDevicePropDesc *dpd) { int type = -1; if (!next) return PTP_RC_GeneralError; ptp_debug (params, "parse_9301_propdesc"); dpd->FormFlag = PTP_DPFF_None; dpd->GetSet = PTP_DPGS_Get; do { if (!strcmp((char*)next->name,"type")) { /* propdesc.DataType */ if (!sscanf((char*)xmlNodeGetContent (next), "%04x", &type)) { ptp_debug( params, "\ttype %s not parseable?",xmlNodeGetContent (next)); return 0; } ptp_debug( params, "type 0x%x", type); dpd->DataType = type; continue; } if (!strcmp((char*)next->name,"attribute")) { /* propdesc.GetSet */ int attr; if (!sscanf((char*)xmlNodeGetContent (next), "%02x", &attr)) { ptp_debug( params, "\tattr %s not parseable",xmlNodeGetContent (next)); return 0; } ptp_debug( params, "attribute 0x%x", attr); dpd->GetSet = attr; continue; } if (!strcmp((char*)next->name,"default")) { /* propdesc.FactoryDefaultValue */ ptp_debug( params, "default value"); parse_9301_value (params, (char*)xmlNodeGetContent (next), type, &dpd->FactoryDefaultValue); continue; } if (!strcmp((char*)next->name,"value")) { /* propdesc.CurrentValue */ ptp_debug( params, "current value"); parse_9301_value (params, (char*)xmlNodeGetContent (next), type, &dpd->CurrentValue); continue; } if (!strcmp((char*)next->name,"enum")) { /* propdesc.FORM.Enum */ int n,i; char *s; ptp_debug( params, "enum"); dpd->FormFlag = PTP_DPFF_Enumeration; s = (char*)xmlNodeGetContent (next); n = 0; do { s = strchr(s,' '); if (s) s++; n++; } while (s); dpd->FORM.Enum.NumberOfValues = n; dpd->FORM.Enum.SupportedValue = malloc (n * sizeof(PTPPropertyValue)); s = (char*)xmlNodeGetContent (next); i = 0; do { parse_9301_value (params, s, type, &dpd->FORM.Enum.SupportedValue[i]); /* should turn ' ' into \0? */ i++; s = strchr(s,' '); if (s) s++; } while (s && (iname,"range")) { /* propdesc.FORM.Enum */ char *s = (char*)xmlNodeGetContent (next); dpd->FormFlag = PTP_DPFF_Range; ptp_debug( params, "range"); parse_9301_value (params, s, type, &dpd->FORM.Range.MinimumValue); /* should turn ' ' into \0? */ s = strchr(s,' '); if (!s) continue; s++; parse_9301_value (params, s, type, &dpd->FORM.Range.MaximumValue); /* should turn ' ' into \0? */ s = strchr(s,' '); if (!s) continue; s++; parse_9301_value (params, s, type, &dpd->FORM.Range.StepSize); /* should turn ' ' into \0? */ continue; } ptp_debug (params, "\tpropdescvar: %s", next->name); traverse_tree (params, 3, next); } while ((next = xmlNextElementSibling (next))); return PTP_RC_OK; } static int parse_9301_prop_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di) { xmlNodePtr next; int cnt; unsigned int i; cnt = 0; next = xmlFirstElementChild (node); while (next) { cnt++; next = xmlNextElementSibling (next); } di->DevicePropertiesSupported_len = cnt; di->DevicePropertiesSupported = malloc (cnt*sizeof(di->DevicePropertiesSupported[0])); cnt = 0; next = xmlFirstElementChild (node); while (next) { unsigned int p; PTPDevicePropDesc dpd; sscanf((char*)next->name, "p%04x", &p); ptp_debug( params, "prop %s / 0x%04x", next->name, p); parse_9301_propdesc (params, xmlFirstElementChild (next), &dpd); dpd.DevicePropertyCode = p; di->DevicePropertiesSupported[cnt++] = p; /* add to cache of device propdesc */ for (i=0;inrofdeviceproperties;i++) if (params->deviceproperties[i].desc.DevicePropertyCode == p) break; if (i == params->nrofdeviceproperties) { if (!i) params->deviceproperties = malloc(sizeof(params->deviceproperties[0])); else params->deviceproperties = realloc(params->deviceproperties,(i+1)*sizeof(params->deviceproperties[0])); memset(¶ms->deviceproperties[i],0,sizeof(params->deviceproperties[0])); params->nrofdeviceproperties++; } else { ptp_free_devicepropdesc (¶ms->deviceproperties[i].desc); } /* FIXME: free old entry */ /* we are not using dpd, so copy it directly to the cache */ time( ¶ms->deviceproperties[i].timestamp); params->deviceproperties[i].desc = dpd; next = xmlNextElementSibling (next); } return PTP_RC_OK; } static int parse_9301_event_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di) { xmlNodePtr next; int cnt; cnt = 0; next = xmlFirstElementChild (node); while (next) { cnt++; next = xmlNextElementSibling (next); } di->EventsSupported_len = cnt; di->EventsSupported = malloc (cnt*sizeof(di->EventsSupported[0])); cnt = 0; next = xmlFirstElementChild (node); while (next) { unsigned int p; sscanf((char*)next->name, "e%04x", &p); ptp_debug( params, "event %s / 0x%04x", next->name, p); di->EventsSupported[cnt++] = p; next = xmlNextElementSibling (next); } return PTP_RC_OK; } static int parse_9301_tree (PTPParams *params, xmlNodePtr node, PTPDeviceInfo *di) { xmlNodePtr next; next = xmlFirstElementChild (node); while (next) { if (!strcmp ((char*)next->name, "cmd")) { parse_9301_cmd_tree (params, next, di); next = xmlNextElementSibling (next); continue; } if (!strcmp ((char*)next->name, "prop")) { parse_9301_prop_tree (params, next, di); next = xmlNextElementSibling (next); continue; } if (!strcmp ((char*)next->name, "event")) { parse_9301_event_tree (params, next, di); next = xmlNextElementSibling (next); continue; } fprintf (stderr,"9301: unhandled type %s\n", next->name); next = xmlNextElementSibling (next); } /*traverse_tree (0, node);*/ return PTP_RC_OK; } static uint16_t ptp_olympus_parse_output_xml(PTPParams* params, char*data, int len, xmlNodePtr *code) { xmlDocPtr docin; xmlNodePtr docroot, output, next; int result, xcode; *code = NULL; docin = xmlReadMemory ((char*)data, len, "http://gphoto.org/", "utf-8", 0); if (!docin) return PTP_RC_GeneralError; docroot = xmlDocGetRootElement (docin); if (!docroot) { xmlFreeDoc (docin); return PTP_RC_GeneralError; } if (strcmp((char*)docroot->name,"x3c")) { ptp_debug (params, "olympus: docroot is not x3c, but %s", docroot->name); xmlFreeDoc (docin); return PTP_RC_GeneralError; } if (xmlChildElementCount(docroot) != 1) { ptp_debug (params, "olympus: x3c: expected 1 child, got %ld", xmlChildElementCount(docroot)); xmlFreeDoc (docin); return PTP_RC_GeneralError; } output = xmlFirstElementChild (docroot); if (strcmp((char*)output->name, "output") != 0) { ptp_debug (params, "olympus: x3c node: expected child 'output', but got %s", (char*)output->name); xmlFreeDoc (docin); return PTP_RC_GeneralError; } next = xmlFirstElementChild (output); result = PTP_RC_GeneralError; while (next) { if (!strcmp((char*)next->name,"result")) { xmlChar *xchar; xchar = xmlNodeGetContent (next); if (!sscanf((char*)xchar,"%04x",&result)) ptp_debug (params, "failed scanning result from %s", xchar); ptp_debug (params, "ptp result is 0x%04x", result); next = xmlNextElementSibling (next); continue; } if (sscanf((char*)next->name,"c%x", &xcode)) { ptp_debug (params, "ptp code node found %s", (char*)next->name); *code = next; next = xmlNextElementSibling (next); continue; } ptp_debug (params, "unhandled node %s", (char*)next->name); next = xmlNextElementSibling (next); } if (result != PTP_RC_OK) { *code = NULL; xmlFreeDoc (docin); } return result; } #endif uint16_t ptp_olympus_getdeviceinfo (PTPParams* params, PTPDeviceInfo *di) { #ifdef HAVE_LIBXML2 uint16_t ret; PTPContainer ptp; PTPDataHandler handler; unsigned char *data; unsigned long len; xmlNodePtr code; memset (di, 0, sizeof(PTPDeviceInfo)); ptp_init_recv_memory_handler (&handler); PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_OLYMPUS_GetDeviceInfo; ptp.Nparam = 0; len = 0; data = NULL; ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); ptp_exit_recv_memory_handler (&handler, &data, &len); ret = ptp_olympus_parse_output_xml(params,(char*)data,len,&code); if (ret != PTP_RC_OK) return ret; ret = parse_9301_tree (params, code, di); xmlFreeDoc(code->doc); return ret; #else return PTP_RC_GeneralError; #endif } uint16_t ptp_olympus_opensession (PTPParams* params, unsigned char**data, unsigned long *len) { uint16_t ret; PTPContainer ptp; PTPDataHandler handler; ptp_init_recv_memory_handler (&handler); PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_OLYMPUS_OpenSession; ptp.Nparam = 0; *len = 0; *data = NULL; ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); ptp_exit_recv_memory_handler (&handler, data, len); return ret; } uint16_t ptp_olympus_getcameraid (PTPParams* params, unsigned char**data, unsigned long *len) { uint16_t ret; PTPContainer ptp; PTPDataHandler handler; ptp_init_recv_memory_handler (&handler); PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_OLYMPUS_GetCameraID; ptp.Nparam = 0; *len = 0; *data = NULL; ret=ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); ptp_exit_recv_memory_handler (&handler, data, len); return ret; } /** * ptp_generic_no_data: * params: PTPParams* * code PTP OP Code * n_param count of parameters * ... variable argument list ... * * Emits a generic PTP command without any data transfer. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_generic_no_data (PTPParams* params, uint16_t code, unsigned int n_param, ...) { PTPContainer ptp; va_list args; unsigned int i; if( n_param > 5 ) return PTP_RC_InvalidParameter; PTP_CNT_INIT(ptp); ptp.Code=code; ptp.Nparam=n_param; va_start(args, n_param); for( i=0; isession_id=0x00000000; /* TransactionID should be set to 0 also! */ params->transaction_id=0x0000000; /* zero out response packet buffer */ params->response_packet = NULL; params->response_packet_size = 0; /* no split headers */ params->split_header_data = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_OpenSession; ptp.Param1=session; ptp.Nparam=1; ret=ptp_transaction_new(params, &ptp, PTP_DP_NODATA, 0, NULL); /* now set the global session id to current session number */ params->session_id=session; return ret; } void ptp_free_devicepropvalue(uint16_t dt, PTPPropertyValue* dpd) { switch (dt) { case PTP_DTC_INT8: case PTP_DTC_UINT8: case PTP_DTC_UINT16: case PTP_DTC_INT16: case PTP_DTC_UINT32: case PTP_DTC_INT32: case PTP_DTC_UINT64: case PTP_DTC_INT64: case PTP_DTC_UINT128: case PTP_DTC_INT128: /* Nothing to free */ break; case PTP_DTC_AINT8: case PTP_DTC_AUINT8: case PTP_DTC_AUINT16: case PTP_DTC_AINT16: case PTP_DTC_AUINT32: case PTP_DTC_AINT32: case PTP_DTC_AUINT64: case PTP_DTC_AINT64: case PTP_DTC_AUINT128: case PTP_DTC_AINT128: if (dpd->a.v) free(dpd->a.v); break; case PTP_DTC_STR: if (dpd->str) free(dpd->str); break; } } void ptp_free_devicepropdesc(PTPDevicePropDesc* dpd) { uint16_t i; ptp_free_devicepropvalue (dpd->DataType, &dpd->FactoryDefaultValue); ptp_free_devicepropvalue (dpd->DataType, &dpd->CurrentValue); switch (dpd->FormFlag) { case PTP_DPFF_Range: ptp_free_devicepropvalue (dpd->DataType, &dpd->FORM.Range.MinimumValue); ptp_free_devicepropvalue (dpd->DataType, &dpd->FORM.Range.MaximumValue); ptp_free_devicepropvalue (dpd->DataType, &dpd->FORM.Range.StepSize); break; case PTP_DPFF_Enumeration: if (dpd->FORM.Enum.SupportedValue) { for (i=0;iFORM.Enum.NumberOfValues;i++) ptp_free_devicepropvalue (dpd->DataType, dpd->FORM.Enum.SupportedValue+i); free (dpd->FORM.Enum.SupportedValue); } } dpd->DataType = PTP_DTC_UNDEF; dpd->FormFlag = PTP_DPFF_None; } void ptp_free_objectpropdesc(PTPObjectPropDesc* opd) { uint16_t i; ptp_free_devicepropvalue (opd->DataType, &opd->FactoryDefaultValue); switch (opd->FormFlag) { case PTP_OPFF_None: break; case PTP_OPFF_Range: ptp_free_devicepropvalue (opd->DataType, &opd->FORM.Range.MinimumValue); ptp_free_devicepropvalue (opd->DataType, &opd->FORM.Range.MaximumValue); ptp_free_devicepropvalue (opd->DataType, &opd->FORM.Range.StepSize); break; case PTP_OPFF_Enumeration: if (opd->FORM.Enum.SupportedValue) { for (i=0;iFORM.Enum.NumberOfValues;i++) ptp_free_devicepropvalue (opd->DataType, opd->FORM.Enum.SupportedValue+i); free (opd->FORM.Enum.SupportedValue); } break; case PTP_OPFF_DateTime: case PTP_OPFF_FixedLengthArray: case PTP_OPFF_RegularExpression: case PTP_OPFF_ByteArray: case PTP_OPFF_LongString: /* Ignore these presently, we cannot unpack them, so there is nothing to be freed. */ break; default: fprintf (stderr, "Unknown OPFF type %d\n", opd->FormFlag); break; } } /** * ptp_free_params: * params: PTPParams* * * Frees all data within the PTPParams struct. * * Return values: Some PTP_RC_* code. **/ void ptp_free_params (PTPParams *params) { unsigned int i; if (params->cameraname) free (params->cameraname); if (params->wifi_profiles) free (params->wifi_profiles); for (i=0;inrofobjects;i++) ptp_free_object (¶ms->objects[i]); free (params->objects); free (params->events); for (i=0;inrofcanon_props;i++) { free (params->canon_props[i].data); ptp_free_devicepropdesc (¶ms->canon_props[i].dpd); } free (params->canon_props); free (params->backlogentries); for (i=0;inrofdeviceproperties;i++) ptp_free_devicepropdesc (¶ms->deviceproperties[i].desc); free (params->deviceproperties); ptp_free_DI (¶ms->deviceinfo); } /** * ptp_getststorageids: * params: PTPParams* * * Gets array of StorageIDs and fills the storageids structure. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getstorageids (PTPParams* params, PTPStorageIDs* storageids) { uint16_t ret; PTPContainer ptp; unsigned int len; unsigned char* sids=NULL; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetStorageIDs; ptp.Nparam=0; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &sids, &len); if (ret == PTP_RC_OK) ptp_unpack_SIDs(params, sids, storageids, len); free(sids); return ret; } /** * ptp_getststorageinfo: * params: PTPParams* * storageid - StorageID * * Gets StorageInfo dataset of desired storage and fills storageinfo * structure. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getstorageinfo (PTPParams* params, uint32_t storageid, PTPStorageInfo* storageinfo) { uint16_t ret; PTPContainer ptp; unsigned char* si=NULL; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetStorageInfo; ptp.Param1=storageid; ptp.Nparam=1; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &si, &len); if (ret == PTP_RC_OK) ptp_unpack_SI(params, si, storageinfo, len); free(si); return ret; } /** * ptp_getobjecthandles: * params: PTPParams* * storage - StorageID * objectformatcode - ObjectFormatCode (optional) * associationOH - ObjectHandle of Association for * wich a list of children is desired * (optional) * objecthandles - pointer to structute * * Fills objecthandles with structure returned by device. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getobjecthandles (PTPParams* params, uint32_t storage, uint32_t objectformatcode, uint32_t associationOH, PTPObjectHandles* objecthandles) { uint16_t ret; PTPContainer ptp; unsigned char* oh=NULL; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetObjectHandles; ptp.Param1=storage; ptp.Param2=objectformatcode; ptp.Param3=associationOH; ptp.Nparam=3; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &oh, &len); if (ret == PTP_RC_OK) { ptp_unpack_OH(params, oh, objecthandles, len); } else { if ( (storage == 0xffffffff) && (objectformatcode == 0) && (associationOH == 0) ) { /* When we query all object handles on all stores and * get an error -> just handle it as "0 handles". */ objecthandles->Handler = NULL; objecthandles->n = 0; ret = PTP_RC_OK; } } free(oh); return ret; } uint16_t ptp_getfilesystemmanifest (PTPParams* params, uint32_t storage, uint32_t objectformatcode, uint32_t associationOH, unsigned char** data) { uint16_t ret; PTPContainer ptp; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetFilesystemManifest; ptp.Param1=storage; ptp.Param2=objectformatcode; ptp.Param3=associationOH; ptp.Nparam=3; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, &len); return ret; } /** * ptp_getnumobjects: * params: PTPParams* * storage - StorageID * objectformatcode - ObjectFormatCode (optional) * associationOH - ObjectHandle of Association for * wich a list of children is desired * (optional) * numobs - pointer to uint32_t that takes number of objects * * Fills numobs with number of objects on device. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getnumobjects (PTPParams* params, uint32_t storage, uint32_t objectformatcode, uint32_t associationOH, uint32_t* numobs) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetNumObjects; ptp.Param1=storage; ptp.Param2=objectformatcode; ptp.Param3=associationOH; ptp.Nparam=3; ret=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if (ret == PTP_RC_OK) { if (ptp.Nparam >= 1) *numobs = ptp.Param1; else ret = PTP_RC_GeneralError; } return ret; } /** * ptp_eos_bulbstart: * params: PTPParams* * * Starts EOS Bulb capture. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_canon_eos_bulbstart (PTPParams* params) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_BulbStart; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ((ret == PTP_RC_OK) && (ptp.Nparam >= 1) && ((ptp.Param1 & 0x7000) == 0x2000)) ret = ptp.Param1; return ret; } /** * ptp_eos_capture: * params: PTPParams* * uint32_t* result * * This starts a EOS400D style capture. You have to use the * get_eos_events to find out what resulted. * The return value is "0" for all OK, and "1" for capture failed. (not fully confirmed) * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_canon_eos_capture (PTPParams* params, uint32_t *result) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_RemoteRelease; ptp.Nparam = 0; *result = 0; ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ((ret == PTP_RC_OK) && (ptp.Nparam >= 1)) *result = ptp.Param1; return ret; } /** * ptp_canon_eos_bulbend: * params: PTPParams* * * Starts EOS Bulb capture. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_canon_eos_bulbend (PTPParams* params) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_BulbEnd; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ((ret == PTP_RC_OK) && (ptp.Nparam >= 1) && ((ptp.Param1 & 0x7000) == 0x2000)) ret = ptp.Param1; return ret; } /** * ptp_getobjectinfo: * params: PTPParams* * handle - Object handle * objectinfo - pointer to objectinfo that is returned * * Get objectinfo structure for handle from device. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getobjectinfo (PTPParams* params, uint32_t handle, PTPObjectInfo* objectinfo) { uint16_t ret; PTPContainer ptp; unsigned char* oi=NULL; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetObjectInfo; ptp.Param1=handle; ptp.Nparam=1; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &oi, &len); if (ret == PTP_RC_OK) ptp_unpack_OI(params, oi, objectinfo, len); free(oi); return ret; } /** * ptp_getobject: * params: PTPParams* * handle - Object handle * object - pointer to data area * * Get object 'handle' from device and store the data in newly * allocated 'object'. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getobject (PTPParams* params, uint32_t handle, unsigned char** object) { PTPContainer ptp; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetObject; ptp.Param1=handle; ptp.Nparam=1; len=0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, &len); } /** * ptp_getobject_to_handler: * params: PTPParams* * handle - Object handle * PTPDataHandler* - pointer datahandler * * Get object 'handle' from device and store the data in newly * allocated 'object'. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getobject_to_handler (PTPParams* params, uint32_t handle, PTPDataHandler *handler) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetObject; ptp.Param1=handle; ptp.Nparam=1; return ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, handler); } /** * ptp_getobject_tofd: * params: PTPParams* * handle - Object handle * fd - File descriptor to write() to * * Get object 'handle' from device and write the data to the * given file descriptor. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getobject_tofd (PTPParams* params, uint32_t handle, int fd) { PTPContainer ptp; PTPDataHandler handler; uint16_t ret; ptp_init_fd_handler (&handler, fd); PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetObject; ptp.Param1=handle; ptp.Nparam=1; ret = ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, &handler); ptp_exit_fd_handler (&handler); return ret; } /** * ptp_getpartialobject: * params: PTPParams* * handle - Object handle * offset - Offset into object * maxbytes - Maximum of bytes to read * object - pointer to data area * len - pointer to returned length * * Get object 'handle' from device and store the data in newly * allocated 'object'. Start from offset and read at most maxbytes. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset, uint32_t maxbytes, unsigned char** object, uint32_t *len) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetPartialObject; ptp.Param1=handle; ptp.Param2=offset; ptp.Param3=maxbytes; ptp.Nparam=3; *len=0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, len); } /** * ptp_getthumb: * params: PTPParams* * handle - Object handle * object - pointer to data area * * Get thumb for object 'handle' from device and store the data in newly * allocated 'object'. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_getthumb (PTPParams* params, uint32_t handle, unsigned char** object, unsigned int *len) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetThumb; ptp.Param1=handle; ptp.Nparam=1; *len = 0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, len); } /** * ptp_deleteobject: * params: PTPParams* * handle - object handle * ofc - object format code (optional) * * Deletes desired objects. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_deleteobject (PTPParams* params, uint32_t handle, uint32_t ofc) { PTPContainer ptp; uint16_t ret; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_DeleteObject; ptp.Param1=handle; ptp.Param2=ofc; ptp.Nparam=2; ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if (ret != PTP_RC_OK) { return ret; } /* If the object is cached and could be removed, cleanse cache. */ ptp_remove_object_from_cache(params, handle); return PTP_RC_OK; } /** * ptp_sendobjectinfo: * params: PTPParams* * uint32_t* store - destination StorageID on Responder * uint32_t* parenthandle - Parent ObjectHandle on responder * uint32_t* handle - see Return values * PTPObjectInfo* objectinfo- ObjectInfo that is to be sent * * Sends ObjectInfo of file that is to be sent via SendFileObject. * * Return values: Some PTP_RC_* code. * Upon success : uint32_t* store - Responder StorageID in which * object will be stored * uint32_t* parenthandle- Responder Parent ObjectHandle * in which the object will be stored * uint32_t* handle - Responder's reserved ObjectHandle * for the incoming object **/ uint16_t ptp_sendobjectinfo (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle, PTPObjectInfo* objectinfo) { uint16_t ret; PTPContainer ptp; unsigned char* oidata=NULL; uint32_t size; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_SendObjectInfo; ptp.Param1=*store; ptp.Param2=*parenthandle; ptp.Nparam=2; size=ptp_pack_OI(params, objectinfo, &oidata); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &oidata, NULL); free(oidata); *store=ptp.Param1; *parenthandle=ptp.Param2; *handle=ptp.Param3; return ret; } /** * ptp_sendobject: * params: PTPParams* * char* object - contains the object that is to be sent * uint64_t size - object size * * Sends object to Responder. * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_sendobject (PTPParams* params, unsigned char* object, uint64_t size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_SendObject; ptp.Nparam=0; return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &object, NULL); } /** * ptp_sendobject_from_handler: * params: PTPParams* * PTPDataHandler* - File descriptor to read() object from * uint64_t size - File/object size * * Sends object from file descriptor by consecutive reads from this * descriptor. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_sendobject_from_handler (PTPParams* params, PTPDataHandler *handler, uint64_t size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_SendObject; ptp.Nparam=0; return ptp_transaction_new(params, &ptp, PTP_DP_SENDDATA, size, handler); } /** * ptp_sendobject_fromfd: * params: PTPParams* * fd - File descriptor to read() object from * uint64_t size - File/object size * * Sends object from file descriptor by consecutive reads from this * descriptor. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_sendobject_fromfd (PTPParams* params, int fd, uint64_t size) { PTPContainer ptp; PTPDataHandler handler; uint16_t ret; ptp_init_fd_handler (&handler, fd); PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_SendObject; ptp.Nparam=0; ret = ptp_transaction_new(params, &ptp, PTP_DP_SENDDATA, size, &handler); ptp_exit_fd_handler (&handler); return ret; } #define PROPCACHE_TIMEOUT 5 /* seconds */ uint16_t ptp_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc* devicepropertydesc) { PTPContainer ptp; uint16_t ret; unsigned int len; unsigned char* dpd=NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_GetDevicePropDesc; ptp.Param1 = propcode; ptp.Nparam = 1; len = 0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpd, &len); if (ret == PTP_RC_OK) { if (params->device_flags & DEVICE_FLAG_OLYMPUS_XML_WRAPPED) { #ifdef HAVE_LIBXML2 xmlNodePtr code; ret = ptp_olympus_parse_output_xml (params,(char*)dpd,len,&code); if (ret == PTP_RC_OK) { int x; if ( (xmlChildElementCount(code) == 1) && (!strcmp((char*)code->name,"c1014")) ) { code = xmlFirstElementChild (code); if ( (sscanf((char*)code->name,"p%x", &x)) && (x == propcode) ) { ret = parse_9301_propdesc (params, xmlFirstElementChild (code), devicepropertydesc); xmlFreeDoc(code->doc); } } } else { ptp_debug(params,"failed to parse output xml, ret %x?", ret); } #endif } else { ptp_unpack_DPD(params, dpd, devicepropertydesc, len); } } free(dpd); return ret; } uint16_t ptp_getdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue* value, uint16_t datatype) { PTPContainer ptp; uint16_t ret; unsigned int len, offset; unsigned char* dpv=NULL; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_GetDevicePropValue; ptp.Param1=propcode; ptp.Nparam=1; len=offset=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &len); if (ret == PTP_RC_OK) { int ret2 = ptp_unpack_DPV(params, dpv, &offset, len, value, datatype); if (!ret2) { ptp_debug (params, "ptp_getdevicepropvalue: unpacking DPV failed"); ret = PTP_RC_GeneralError; } } free(dpv); return ret; } uint16_t ptp_setdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue *value, uint16_t datatype) { PTPContainer ptp; uint16_t ret; uint32_t size; unsigned char* dpv=NULL; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_SetDevicePropValue; ptp.Param1=propcode; ptp.Nparam=1; size=ptp_pack_DPV(params, value, &dpv, datatype); ret=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &dpv, NULL); free(dpv); return ret; } /** * ptp_ek_sendfileobjectinfo: * params: PTPParams* * uint32_t* store - destination StorageID on Responder * uint32_t* parenthandle - Parent ObjectHandle on responder * uint32_t* handle - see Return values * PTPObjectInfo* objectinfo- ObjectInfo that is to be sent * * Sends ObjectInfo of file that is to be sent via SendFileObject. * * Return values: Some PTP_RC_* code. * Upon success : uint32_t* store - Responder StorageID in which * object will be stored * uint32_t* parenthandle- Responder Parent ObjectHandle * in which the object will be stored * uint32_t* handle - Responder's reserved ObjectHandle * for the incoming object **/ uint16_t ptp_ek_sendfileobjectinfo (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle, PTPObjectInfo* objectinfo) { uint16_t ret; PTPContainer ptp; unsigned char* oidata=NULL; uint32_t size; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_EK_SendFileObjectInfo; ptp.Param1=*store; ptp.Param2=*parenthandle; ptp.Nparam=2; size=ptp_pack_OI(params, objectinfo, &oidata); ret=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &oidata, NULL); free(oidata); *store=ptp.Param1; *parenthandle=ptp.Param2; *handle=ptp.Param3; return ret; } /** * ptp_ek_getserial: * params: PTPParams* * char** serial - contains the serial number of the camera * uint32_t* size - contains the string length * * Gets the serial number from the device. (ptp serial) * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_ek_getserial (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_EK_GetSerial; ptp.Nparam = 0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } /** * ptp_ek_setserial: * params: PTPParams* * char* serial - contains the new serial number * uint32_t size - string length * * Sets the serial number of the device. (ptp serial) * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_ek_setserial (PTPParams* params, unsigned char *data, unsigned int size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_EK_SetSerial; ptp.Nparam = 0; return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL); } /* unclear what it does yet */ uint16_t ptp_ek_9007 (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = 0x9007; ptp.Nparam = 0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } /* unclear what it does yet */ uint16_t ptp_ek_9009 (PTPParams* params, uint32_t *p1, uint32_t *p2) { PTPContainer ptp; uint16_t ret; PTP_CNT_INIT(ptp); ptp.Code = 0x9009; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); *p1 = ptp.Param1; *p2 = ptp.Param2; return ret; } /* unclear yet, but I guess it returns the info from 9008 */ uint16_t ptp_ek_900c (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = 0x900c; ptp.Nparam = 0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); /* returned data is 16bit,16bit,32bit,32bit */ } /** * ptp_ek_settext: * params: PTPParams* * PTPEKTextParams* - contains the texts to display. * * Displays the specified texts on the TFT of the camera. * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_ek_settext (PTPParams* params, PTPEKTextParams *text) { PTPContainer ptp; uint16_t ret; unsigned int size; unsigned char *data; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_EK_SetText; ptp.Nparam = 0; if (0 == (size = ptp_pack_EK_text(params, text, &data))) return PTP_ERROR_BADPARAM; ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL); free(data); return ret; } /** * ptp_ek_sendfileobject: * params: PTPParams* * char* object - contains the object that is to be sent * uint32_t size - object size * * Sends object to Responder. * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_ek_sendfileobject (PTPParams* params, unsigned char* object, uint32_t size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_EK_SendFileObject; ptp.Nparam=0; return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &object, NULL); } /** * ptp_ek_sendfileobject_from_handler: * params: PTPParams* * PTPDataHandler* handler - contains the handler of the object that is to be sent * uint32_t size - object size * * Sends object to Responder. * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_ek_sendfileobject_from_handler (PTPParams* params, PTPDataHandler*handler, uint32_t size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_EK_SendFileObject; ptp.Nparam=0; return ptp_transaction_new(params, &ptp, PTP_DP_SENDDATA, size, handler); } /************************************************************************* * * Canon PTP extensions support * * (C) Nikolai Kopanygin 2003 * *************************************************************************/ /** * ptp_canon_getpartialobjectinfo: * params: PTPParams* * uint32_t handle - ObjectHandle * uint32_t p2 - Not fully understood parameter * 0 - returns full size * 1 - returns thumbnail size (or EXIF?) * * Gets form the responder the size of the specified object. * * Return values: Some PTP_RC_* code. * Upon success : uint32_t* size - The object size * uint32_t* rp2 - Still unknown return parameter * (perhaps upper 32bit of size) * * **/ uint16_t ptp_canon_getpartialobjectinfo (PTPParams* params, uint32_t handle, uint32_t p2, uint32_t* size, uint32_t* rp2) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetPartialObjectInfo; ptp.Param1=handle; ptp.Param2=p2; ptp.Nparam=2; ret=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); *size=ptp.Param1; *rp2=ptp.Param2; return ret; } /** * ptp_canon_get_mac_address: * params: PTPParams* * value 0 works. * Gets the MAC address of the wireless transmitter. * * Return values: Some PTP_RC_* code. * Upon success : unsigned char* mac - The MAC address * **/ uint16_t ptp_canon_get_mac_address (PTPParams* params, unsigned char **mac) { PTPContainer ptp; unsigned int size = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetMACAddress; ptp.Nparam=0; *mac = NULL; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, mac, &size); } /** * ptp_canon_get_directory: * params: PTPParams* * Gets the full directory of the camera. * * Return values: Some PTP_RC_* code. * Upon success : PTPObjectHandles *handles - filled out with handles * PTPObjectInfo **oinfos - allocated array of PTP Object Infos * uint32_t **flags - allocated array of CANON Flags * **/ uint16_t ptp_canon_get_directory (PTPParams* params, PTPObjectHandles *handles, PTPObjectInfo **oinfos, /* size(handles->n) */ uint32_t **flags /* size(handles->n) */ ) { PTPContainer ptp; unsigned char *dir = NULL; unsigned int size = 0; uint16_t ret; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetDirectory; ptp.Nparam=0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dir, &size); if (ret != PTP_RC_OK) return ret; ret = ptp_unpack_canon_directory(params, dir, ptp.Param1, handles, oinfos, flags); free (dir); return ret; } /** * ptp_canon_gettreeinfo: * params: PTPParams* * uint32_t *out * * Switches the camera display to on and lets the user * select what to transfer. Sends a 0xc011 event when started * and 0xc013 if direct transfer aborted. * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_canon_gettreeinfo (PTPParams* params, uint32_t *out) { PTPContainer ptp; uint16_t ret; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_GetTreeInfo; ptp.Nparam = 1; ptp.Param1 = 0xf; ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ((ret == PTP_RC_OK) && (ptp.Nparam>0)) *out = ptp.Param1; return ret; } /** * ptp_canon_getpairinginfo: * params: PTPParams* * int nr * * Get the pairing information. * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_canon_getpairinginfo (PTPParams* params, uint32_t nr, unsigned char **data, unsigned int *size) { PTPContainer ptp; uint16_t ret; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_GetPairingInfo; ptp.Nparam = 1; ptp.Param1 = nr; *data = NULL; *size = 0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); if (ret != PTP_RC_OK) return ret; return PTP_RC_OK; } /** * ptp_canon_get_target_handles: * params: PTPParams* * PTPCanon_directtransfer_entry **out * unsigned int *outsize * * Retrieves direct transfer entries specifying the images to transfer * from the camera (to be retrieved after 0xc011 event). * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_canon_gettreesize (PTPParams* params, PTPCanon_directtransfer_entry **entries, unsigned int *cnt) { PTPContainer ptp; uint16_t ret; unsigned char *out = NULL, *cur; unsigned int i, size; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_GetTreeSize; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &out, &size); if (ret != PTP_RC_OK) return ret; *cnt = dtoh32a(out); *entries = malloc(sizeof(PTPCanon_directtransfer_entry)*(*cnt)); if (!*entries) { free (out); return PTP_RC_GeneralError; } cur = out+4; for (i=0;i<*cnt;i++) { unsigned char len; (*entries)[i].oid = dtoh32a(cur); (*entries)[i].str = ptp_unpack_string(params, cur, 4, &len); cur += 4+(cur[4]*2+1); } free (out); return PTP_RC_OK; } /** * ptp_canon_checkevent: * params: PTPParams* * * The camera has a FIFO stack, in which it accumulates events. * Partially these events are communicated also via the USB interrupt pipe * according to the PTP USB specification, partially not. * This operation returns from the device a block of data, empty, * if the event stack is empty, or filled with an event's data otherwise. * The event is removed from the stack in the latter case. * The Remote Capture app sends this command to the camera all the time * of connection, filling with it the gaps between other operations. * * Return values: Some PTP_RC_* code. * Upon success : PTPUSBEventContainer* event - is filled with the event data * if any * int *isevent - returns 1 in case of event * or 0 otherwise **/ uint16_t ptp_canon_checkevent (PTPParams* params, PTPContainer* event, int* isevent) { uint16_t ret; PTPContainer ptp; unsigned char *evdata = NULL; unsigned int len; *isevent=0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_CheckEvent; ptp.Nparam=0; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &evdata, &len); if (evdata!=NULL) { if (ret == PTP_RC_OK) { ptp_unpack_EC(params, evdata, event, len); *isevent=1; } free(evdata); } return ret; } uint16_t ptp_add_event (PTPParams *params, PTPContainer *evt) { if (params->nrofevents) params->events = realloc(params->events, sizeof(PTPContainer)*(params->nrofevents+1)); else params->events = malloc(sizeof(PTPContainer)*1); memcpy (¶ms->events[params->nrofevents],evt,1*sizeof(PTPContainer)); params->nrofevents += 1; return PTP_RC_OK; } uint16_t ptp_check_event (PTPParams *params) { PTPContainer event; uint16_t ret; if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_NIKON) && ptp_operation_issupported(params, PTP_OC_NIKON_CheckEvent) ) { unsigned int evtcnt; PTPContainer *xevent = NULL; ret = ptp_nikon_check_event(params, &xevent, &evtcnt); if (ret != PTP_RC_OK) return ret; if (evtcnt) { if (params->nrofevents) params->events = realloc(params->events, sizeof(PTPContainer)*(evtcnt+params->nrofevents)); else params->events = malloc(sizeof(PTPContainer)*evtcnt); memcpy (¶ms->events[params->nrofevents],xevent,evtcnt*sizeof(PTPContainer)); params->nrofevents += evtcnt; free (xevent); } return PTP_RC_OK; } /* should not get here ... EOS has no normal PTP events and another queue handling. */ if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) && ptp_operation_issupported(params, PTP_OC_CANON_EOS_GetEvent) ) { return PTP_RC_OK; } if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) && ptp_operation_issupported(params, PTP_OC_CANON_CheckEvent) ) { int isevent; ret = ptp_canon_checkevent (params,&event,&isevent); if (ret!=PTP_RC_OK) return ret; if (isevent) goto store_event; /* Event Emulate Mode 0 (unset) and 1-5 get interrupt events. 6-7 does not. */ if (params->canon_event_mode > 5) return ret; /* FIXME: fallthrough or return? */ #ifdef __APPLE__ /* the libusb 1 on darwin currently does not like polling * for interrupts, they have no timeout for it. 2010/08/23 * Check back in 2011 or so. -Marcus */ return ret; #endif } ret = params->event_check(params,&event); store_event: if (ret == PTP_RC_OK) { ptp_debug (params, "event: nparams=0x%X, code=0x%X, trans_id=0x%X, p1=0x%X, p2=0x%X, p3=0x%X", event.Nparam,event.Code,event.Transaction_ID, event.Param1, event.Param2, event.Param3); ptp_add_event (params, &event); } if (ret == PTP_ERROR_TIMEOUT) /* ok, just new events */ ret = PTP_RC_OK; return ret; } int ptp_get_one_event(PTPParams *params, PTPContainer *event) { if (!params->nrofevents) return 0; memcpy (event, params->events, sizeof(PTPContainer)); memmove (params->events, params->events+1, sizeof(PTPContainer)*(params->nrofevents-1)); /* do not realloc on shrink. */ params->nrofevents--; if (!params->nrofevents) { free (params->events); params->events = NULL; } return 1; } /** * ptp_canon_eos_getevent: * * This retrieves configuration status/updates/changes * on EOS cameras. It reads a datablock which has a list of variable * sized structures. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_canon_eos_getevent (PTPParams* params, PTPCanon_changes_entry **entries, int *nrofentries) { PTPContainer ptp; uint16_t ret; unsigned int size = 0; unsigned char *data = NULL; *nrofentries = 0; *entries = NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_GetEvent; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret != PTP_RC_OK) return ret; *nrofentries = ptp_unpack_CANON_changes(params,data,size,entries); free (data); return PTP_RC_OK; } uint16_t ptp_check_eos_events (PTPParams *params) { uint16_t ret; PTPCanon_changes_entry *entries = NULL, *nentries; int nrofentries = 0; while (1) { /* call it repeatedly until the camera does not report any */ ret = ptp_canon_eos_getevent (params, &entries, &nrofentries); if (ret != PTP_RC_OK) return ret; if (!nrofentries) return PTP_RC_OK; if (params->nrofbacklogentries) { nentries = realloc(params->backlogentries,sizeof(entries[0])*(params->nrofbacklogentries+nrofentries)); if (!nentries) return PTP_RC_GeneralError; params->backlogentries = nentries; memcpy (nentries+params->nrofbacklogentries, entries, nrofentries*sizeof(entries[0])); params->nrofbacklogentries += nrofentries; free (entries); } else { params->backlogentries = entries; params->nrofbacklogentries = nrofentries; } } return PTP_RC_OK; } int ptp_get_one_eos_event (PTPParams *params, PTPCanon_changes_entry *entry) { if (!params->nrofbacklogentries) return 0; memcpy (entry, params->backlogentries, sizeof(*entry)); if (params->nrofbacklogentries > 1) { memmove (params->backlogentries,params->backlogentries+1,sizeof(*entry)*(params->nrofbacklogentries-1)); params->nrofbacklogentries--; } else { free (params->backlogentries); params->backlogentries = NULL; params->nrofbacklogentries = 0; } return 1; } uint16_t ptp_canon_eos_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc *dpd) { unsigned int i; for (i=0;inrofcanon_props;i++) if (params->canon_props[i].proptype == propcode) break; if (params->nrofcanon_props == i) return PTP_RC_Undefined; memcpy (dpd, ¶ms->canon_props[i].dpd, sizeof (*dpd)); if (dpd->FormFlag == PTP_DPFF_Enumeration) { /* need to duplicate the Enumeration alloc */ dpd->FORM.Enum.SupportedValue = malloc (sizeof (PTPPropertyValue)*dpd->FORM.Enum.NumberOfValues); memcpy (dpd->FORM.Enum.SupportedValue, params->canon_props[i].dpd.FORM.Enum.SupportedValue, sizeof (PTPPropertyValue)*dpd->FORM.Enum.NumberOfValues ); } if (dpd->DataType == PTP_DTC_STR) { dpd->FactoryDefaultValue.str = strdup( params->canon_props[i].dpd.FactoryDefaultValue.str ); dpd->CurrentValue.str = strdup( params->canon_props[i].dpd.CurrentValue.str ); } return PTP_RC_OK; } uint16_t ptp_canon_eos_getstorageids (PTPParams* params, PTPStorageIDs* storageids) { PTPContainer ptp; unsigned int len = 0; uint16_t ret; unsigned char* sids=NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_GetStorageIDs; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &sids, &len); if (ret == PTP_RC_OK) ptp_unpack_SIDs(params, sids, storageids, len); free(sids); return ret; } uint16_t ptp_canon_eos_getstorageinfo (PTPParams* params, uint32_t p1, unsigned char **data, unsigned int *size) { PTPContainer ptp; uint16_t ret; *size = 0; *data = NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_GetStorageInfo; ptp.Nparam = 1; ptp.Param1 = p1; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); /* FIXME: do stuff with data */ return ret; } uint16_t ptp_canon_eos_getobjectinfoex ( PTPParams* params, uint32_t storageid, uint32_t oid, uint32_t unk, PTPCANONFolderEntry **entries, unsigned int *nrofentries ) { PTPContainer ptp; unsigned int i, size = 0; unsigned char *data, *xdata; uint16_t ret; data = NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_GetObjectInfoEx; ptp.Nparam = 3; ptp.Param1 = storageid; ptp.Param2 = oid; ptp.Param3 = unk; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret != PTP_RC_OK) return ret; if (!data) { *nrofentries = 0; return PTP_RC_OK; } *nrofentries = dtoh32a(data); *entries = malloc(*nrofentries * sizeof(PTPCANONFolderEntry)); if (!*entries) { free (data); return PTP_RC_GeneralError; } xdata = data+sizeof(uint32_t); for (i=0;i<*nrofentries;i++) { ptp_unpack_Canon_EOS_FE (params, &xdata[4], &((*entries)[i])); xdata += dtoh32a(xdata); } free (data); return PTP_RC_OK; } /** * ptp_canon_eos_getpartialobject: * * This retrieves a part of an PTP object which you specify as object id. * The id originates from 0x9116 call. * After finishing it, we seem to need to call ptp_canon_eos_enddirecttransfer. * * params: PTPParams* * oid Object ID * offset The offset where to start the data transfer * xsize Size in bytes of the transfer to do * data Pointer that receives the malloc()ed memory of the transfer. * * Return values: Some PTP_RC_* code. * */ uint16_t ptp_canon_eos_getpartialobject (PTPParams* params, uint32_t oid, uint32_t offset, uint32_t xsize, unsigned char**data) { PTPContainer ptp; unsigned int size = 0; *data = NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_GetPartialObject; ptp.Nparam = 3; ptp.Param1 = oid; ptp.Param2 = offset; ptp.Param3 = xsize; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, &size); } uint16_t ptp_canon_eos_setdevicepropvalueex (PTPParams* params, unsigned char* data, unsigned int size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_SetDevicePropValueEx; ptp.Nparam = 0; return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL); } uint16_t ptp_canon_eos_setdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue *value, uint16_t datatype ) { PTPContainer ptp; uint16_t ret; unsigned int i, size; unsigned char *data; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_EOS_SetDevicePropValueEx; ptp.Nparam = 0; for (i=0;inrofcanon_props;i++) if (params->canon_props[i].proptype == propcode) break; if (params->nrofcanon_props == i) return PTP_RC_Undefined; switch (propcode) { case PTP_DPC_CANON_EOS_ImageFormat: case PTP_DPC_CANON_EOS_ImageFormatCF: case PTP_DPC_CANON_EOS_ImageFormatSD: case PTP_DPC_CANON_EOS_ImageFormatExtHD: /* special handling of ImageFormat properties */ size = 8 + ptp_pack_EOS_ImageFormat( params, NULL, value->u16 ); data = malloc( size ); if (!data) return PTP_RC_GeneralError; params->canon_props[i].dpd.CurrentValue.u16 = value->u16; ptp_pack_EOS_ImageFormat( params, data + 8, value->u16 ); break; case PTP_DPC_CANON_EOS_CustomFuncEx: /* special handling of CustomFuncEx properties */ ptp_debug (params, "ptp2/ptp_canon_eos_setdevicepropvalue: setting EOS prop %x to %s",propcode,value->str); size = 8 + ptp_pack_EOS_CustomFuncEx( params, NULL, value->str ); data = malloc( size ); if (!data) return PTP_RC_GeneralError; params->canon_props[i].dpd.CurrentValue.str = strdup( value->str ); ptp_pack_EOS_CustomFuncEx( params, data + 8, value->str ); break; default: if (datatype != PTP_DTC_STR) { data = calloc(sizeof(uint32_t),3); if (!data) return PTP_RC_GeneralError; size = sizeof(uint32_t)*3; } else { size = strlen(value->str) + 1 + 8; data = calloc(sizeof(char),size); if (!data) return PTP_RC_GeneralError; } switch (datatype) { case PTP_DTC_INT8: case PTP_DTC_UINT8: /*fprintf (stderr, "%x -> %d\n", propcode, value->u8);*/ htod8a(&data[8], value->u8); params->canon_props[i].dpd.CurrentValue.u8 = value->u8; break; case PTP_DTC_UINT16: case PTP_DTC_INT16: /*fprintf (stderr, "%x -> %d\n", propcode, value->u16);*/ htod16a(&data[8], value->u16); params->canon_props[i].dpd.CurrentValue.u16 = value->u16; break; case PTP_DTC_INT32: case PTP_DTC_UINT32: /*fprintf (stderr, "%x -> %d\n", propcode, value->u32);*/ htod32a(&data[8], value->u32); params->canon_props[i].dpd.CurrentValue.u32 = value->u32; break; case PTP_DTC_STR: strcpy((char*)data + 8, value->str); free (params->canon_props[i].dpd.CurrentValue.str); params->canon_props[i].dpd.CurrentValue.str = strdup(value->str); break; } } htod32a(&data[0], size); htod32a(&data[4], propcode); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL); free (data); return ret; } /** * ptp_canon_getpartialobject: * * This operation is used to read from the device a data * block of an object from a specified offset. * * params: PTPParams* * uint32_t handle - the handle of the requested object * uint32_t offset - the offset in bytes from the beginning of the object * uint32_t size - the requested size of data block to read * uint32_t pos - 1 for the first block, 2 - for a block in the middle, * 3 - for the last block * * Return values: Some PTP_RC_* code. * char **block - the pointer to the block of data read * uint32_t* readnum - the number of bytes read * **/ uint16_t ptp_canon_getpartialobject (PTPParams* params, uint32_t handle, uint32_t offset, uint32_t size, uint32_t pos, unsigned char** block, uint32_t* readnum) { uint16_t ret; PTPContainer ptp; unsigned char *data=NULL; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetPartialObjectEx; ptp.Param1=handle; ptp.Param2=offset; ptp.Param3=size; ptp.Param4=pos; ptp.Nparam=4; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &len); if (ret==PTP_RC_OK) { *block=data; *readnum=ptp.Param1; } return ret; } /** * ptp_canon_getviewfinderimage: * * This operation can be used to read the image which is currently * in the camera's viewfinder. The image size is 320x240, format is JPEG. * Of course, prior to calling this operation, one must turn the viewfinder * on with the CANON_ViewfinderOn command. * Invoking this operation many times, one can get live video from the camera! * * params: PTPParams* * * Return values: Some PTP_RC_* code. * char **image - the pointer to the read image * unit32_t *size - the size of the image in bytes * **/ uint16_t ptp_canon_getviewfinderimage (PTPParams* params, unsigned char** image, uint32_t* size) { uint16_t ret; PTPContainer ptp; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetViewfinderImage; ptp.Nparam=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, image, &len); if (ret==PTP_RC_OK) *size=ptp.Param1; return ret; } /** * ptp_canon_getchanges: * * This is an interesting operation, about the effect of which I am not sure. * This command is called every time when a device property has been changed * with the SetDevicePropValue operation, and after some other operations. * This operation reads the array of Device Properties which have been changed * by the previous operation. * Probably, this operation is even required to make those changes work. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * uint16_t** props - the pointer to the array of changed properties * uint32_t* propnum - the number of elements in the *props array * **/ uint16_t ptp_canon_getchanges (PTPParams* params, uint16_t** props, uint32_t* propnum) { uint16_t ret; PTPContainer ptp; unsigned char* data=NULL; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetChanges; ptp.Nparam=0; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &len); if (ret == PTP_RC_OK) *propnum=ptp_unpack_uint16_t_array(params,data,0,props); free(data); return ret; } /** * ptp_canon_getobjectinfo: * * This command reads a specified object's record in a device's filesystem, * or the records of all objects belonging to a specified folder (association). * * params: PTPParams* * uint32_t store - StorageID, * uint32_t p2 - Yet unknown (0 value works OK) * uint32_t parent - Parent Object Handle * # If Parent Object Handle is 0xffffffff, * # the Parent Object is the top level folder. * uint32_t handle - Object Handle * # If Object Handle is 0, the records of all objects * # belonging to the Parent Object are read. * # If Object Handle is not 0, only the record of this * # Object is read. * * Return values: Some PTP_RC_* code. * PTPCANONFolderEntry** entries - the pointer to the folder entry array * uint32_t* entnum - the number of elements of the array * **/ uint16_t ptp_canon_getobjectinfo (PTPParams* params, uint32_t store, uint32_t p2, uint32_t parent, uint32_t handle, PTPCANONFolderEntry** entries, uint32_t* entnum) { uint16_t ret; PTPContainer ptp; unsigned char *data = NULL; unsigned int len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_GetObjectInfoEx; ptp.Param1=store; ptp.Param2=p2; ptp.Param3=parent; ptp.Param4=handle; ptp.Nparam=4; len=0; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &len); if (ret == PTP_RC_OK) { unsigned int i; *entnum=ptp.Param1; *entries=calloc(*entnum, sizeof(PTPCANONFolderEntry)); if (*entries!=NULL) { for(i=0; i<(*entnum); i++) ptp_unpack_Canon_FE(params, data+i*PTP_CANON_FolderEntryLen, &((*entries)[i]) ); } else { ret=PTP_ERROR_IO; /* Cannot allocate memory */ } } free(data); return ret; } /** * ptp_canon_get_objecthandle_by_name: * * This command looks up the specified object on the camera. * * Format is "A:\\PATH". * * The 'A' is the VolumeLabel from GetStorageInfo, * my IXUS has "A" for the card and "V" for internal memory. * * params: PTPParams* * char* name - path name * * Return values: Some PTP_RC_* code. * uint32_t *oid - PTP object id. * **/ uint16_t ptp_canon_get_objecthandle_by_name (PTPParams* params, char* name, uint32_t* objectid) { uint16_t ret; PTPContainer ptp; unsigned char *data = NULL; uint8_t len; PTP_CNT_INIT (ptp); ptp.Code=PTP_OC_CANON_GetObjectHandleByName; ptp.Nparam=0; len=0; data = malloc (2*(strlen(name)+1)+2); memset (data, 0, 2*(strlen(name)+1)+2); ptp_pack_string (params, name, data, 0, &len); ret=ptp_transaction (params, &ptp, PTP_DP_SENDDATA, (len+1)*2+1, &data, NULL); free (data); *objectid = ptp.Param1; return ret; } /** * ptp_canon_get_customize_data: * * This command downloads the specified theme slot, including jpegs * and wav files. * * params: PTPParams* * uint32_t themenr - nr of theme * * Return values: Some PTP_RC_* code. * unsigned char **data - pointer to data pointer * unsigned int *size - size of data returned * **/ uint16_t ptp_canon_get_customize_data (PTPParams* params, uint32_t themenr, unsigned char **data, unsigned int *size) { PTPContainer ptp; *data = NULL; *size = 0; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_CANON_GetCustomizeData; ptp.Param1 = themenr; ptp.Nparam = 1; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } uint16_t ptp_nikon_curve_download (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; *data = NULL; *size = 0; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_NIKON_CurveDownload; ptp.Nparam = 0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } /** * ptp_sony_sdioconnect: * * This changes modes of the camera * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_sony_sdioconnect (PTPParams* params, uint32_t p1, uint32_t p2, uint32_t p3) { PTPContainer ptp; uint16_t ret; unsigned char *xdata = NULL; unsigned int xsize; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_SONY_SDIOConnect; ptp.Nparam = 3; ptp.Param1 = p1; ptp.Param2 = p2; ptp.Param3 = p3; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &xdata, &xsize); free (xdata); return ret; } /** * ptp_sony_get_vendorpropcodes: * * This command downloads the vendor specific property codes. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * unsigned char **data - pointer to data pointer * unsigned int *size - size of data returned * **/ uint16_t ptp_sony_get_vendorpropcodes (PTPParams* params, uint16_t **props, unsigned int *size) { PTPContainer ptp; uint16_t ret; unsigned char *xdata = NULL; unsigned int xsize; *props = NULL; *size = 0; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_SONY_GetSDIOGetExtDeviceInfo; ptp.Nparam = 1; ptp.Param1 = 0xc8; /* unclear */ ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &xdata, &xsize); /* first 16 bit is 0xc8 0x00, then an array of 16 bit PTP ids */ if (ret == PTP_RC_OK) *size = ptp_unpack_uint16_t_array(params,xdata+2,0,props); free (xdata); return ret; } uint16_t ptp_sony_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc *dpd) { PTPContainer ptp; uint16_t ret; unsigned char *xdata = NULL; unsigned int xsize,len = 0; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_SONY_GetDevicePropdesc; ptp.Nparam = 1; ptp.Param1 = propcode; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &xdata, &xsize); /* first 16 bit is 0xc8 0x00, then an array of 16 bit PTP ids */ if (ret == PTP_RC_OK) ret = ptp_unpack_Sony_DPD(params,xdata,dpd,xsize,&len)?PTP_RC_OK:PTP_RC_GeneralError; free (xdata); return ret; } uint16_t ptp_sony_getalldevicepropdesc (PTPParams* params) { PTPContainer ptp; uint16_t ret; unsigned char *data = NULL , *dpddata; uint32_t size = 0, readlen; PTPDevicePropDesc dpd; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_SONY_GetAllDevicePropData; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret != PTP_RC_OK) return ret; dpddata = data+8; /* nr of entries 32bit, 0 32bit */ size -= 8; while (size>0) { unsigned int i; uint16_t propcode; if (!ptp_unpack_Sony_DPD (params, dpddata, &dpd, size, &readlen)) break; propcode = dpd.DevicePropertyCode; for (i=0;inrofdeviceproperties;i++) if (params->deviceproperties[i].desc.DevicePropertyCode == propcode) break; if (i == params->nrofdeviceproperties) { if (!i) params->deviceproperties = malloc(sizeof(params->deviceproperties[0])); else params->deviceproperties = realloc(params->deviceproperties,(i+1)*sizeof(params->deviceproperties[0])); memset(¶ms->deviceproperties[i],0,sizeof(params->deviceproperties[0])); params->nrofdeviceproperties++; } else { ptp_free_devicepropdesc (¶ms->deviceproperties[i].desc); } params->deviceproperties[i].desc = dpd; #if 0 ptp_debug (params, "dpd.DevicePropertyCode %04x, readlen %d, getset %d", dpd.DevicePropertyCode, readlen, dpd.GetSet); switch (dpd.DataType) { case PTP_DTC_INT8: ptp_debug (params, "value %d/%x", dpd.CurrentValue.i8, dpd.CurrentValue.i8); break; case PTP_DTC_UINT8: ptp_debug (params, "value %d/%x", dpd.CurrentValue.u8, dpd.CurrentValue.u8); break; case PTP_DTC_UINT16: ptp_debug (params, "value %d/%x", dpd.CurrentValue.u16, dpd.CurrentValue.u16); break; case PTP_DTC_INT16: ptp_debug (params, "value %d/%x", dpd.CurrentValue.i16, dpd.CurrentValue.i16); break; case PTP_DTC_INT32: ptp_debug (params, "value %d/%x", dpd.CurrentValue.i32, dpd.CurrentValue.i32); break; case PTP_DTC_UINT32: ptp_debug (params, "value %d/%x", dpd.CurrentValue.u32, dpd.CurrentValue.u32); break; default: ptp_debug (params, "unknown type %x", dpd.DataType); break; } #endif dpddata += readlen; size -= readlen; } free(data); return ret; } uint16_t ptp_sony_setdevicecontrolvaluea (PTPParams* params, uint16_t propcode, PTPPropertyValue *value, uint16_t datatype) { PTPContainer ptp; uint16_t ret; uint32_t size; unsigned char* dpv=NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_SONY_SetControlDeviceA; ptp.Param1 = propcode; ptp.Nparam = 1; size = ptp_pack_DPV(params, value, &dpv, datatype); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &dpv, NULL); free(dpv); return ret; } uint16_t ptp_sony_setdevicecontrolvalueb (PTPParams* params, uint16_t propcode, PTPPropertyValue *value, uint16_t datatype) { PTPContainer ptp; uint16_t ret; uint32_t size; unsigned char* dpv=NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_SONY_SetControlDeviceB; ptp.Param1 = propcode; ptp.Nparam = 1; size = ptp_pack_DPV(params, value, &dpv, datatype); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &dpv, NULL); free(dpv); return ret; } /** * ptp_generic_getdevicepropdesc: * * This command gets a propertydesc. * If a vendor specific property desc query is available, it uses that. * If not, it falls back to the generic PTP getdevicepropdesc. * * params: PTPParams* * uint16_t propcode * PTPDevicePropDesc *dpd * * Return values: Some PTP_RC_* code. * **/ /* Cache time in seconds. Should perhaps be more granular... */ #define CACHETIME 2 uint16_t ptp_generic_getdevicepropdesc (PTPParams *params, uint16_t propcode, PTPDevicePropDesc *dpd) { unsigned int i; uint16_t ret; time_t now; for (i=0;inrofdeviceproperties;i++) if (params->deviceproperties[i].desc.DevicePropertyCode == propcode) break; if (i == params->nrofdeviceproperties) { if (!i) params->deviceproperties = malloc(sizeof(params->deviceproperties[0])); else params->deviceproperties = realloc(params->deviceproperties,(i+1)*sizeof(params->deviceproperties[0])); memset(¶ms->deviceproperties[i],0,sizeof(params->deviceproperties[0])); params->nrofdeviceproperties++; } if (params->deviceproperties[i].desc.DataType != PTP_DTC_UNDEF) { time(&now); if ((now - params->deviceproperties[i].timestamp) <= CACHETIME) { duplicate_DevicePropDesc(¶ms->deviceproperties[i].desc, dpd); return PTP_RC_OK; } /* free cached entry as we will refetch it. */ ptp_free_devicepropdesc (¶ms->deviceproperties[i].desc); } if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_SONY) && ptp_operation_issupported(params, PTP_OC_SONY_GetAllDevicePropData) ) { ret = ptp_sony_getalldevicepropdesc (params); if (ret != PTP_RC_OK) return ret; for (i=0;inrofdeviceproperties;i++) if (params->deviceproperties[i].desc.DevicePropertyCode == propcode) break; time(&now); params->deviceproperties[i].timestamp = now; duplicate_DevicePropDesc(¶ms->deviceproperties[i].desc, dpd); return PTP_RC_OK; } if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_SONY) && ptp_operation_issupported(params, PTP_OC_SONY_GetDevicePropdesc) ) { ret = ptp_sony_getdevicepropdesc (params, propcode, ¶ms->deviceproperties[i].desc); if (ret != PTP_RC_OK) return ret; time(&now); params->deviceproperties[i].timestamp = now; duplicate_DevicePropDesc(¶ms->deviceproperties[i].desc, dpd); return PTP_RC_OK; } if (ptp_operation_issupported(params, PTP_OC_GetDevicePropDesc)) { ret = ptp_getdevicepropdesc (params, propcode, ¶ms->deviceproperties[i].desc); if (ret != PTP_RC_OK) return ret; time(&now); params->deviceproperties[i].timestamp = now; duplicate_DevicePropDesc(¶ms->deviceproperties[i].desc, dpd); return PTP_RC_OK; } return PTP_RC_OK; } /** * ptp_generic_setdevicepropvalue: * * This command sets a property value, device specific. * * params: PTPParams* * uint16_t propcode * PTPDevicePropertyValue *value * uint16_t datatype * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_generic_setdevicepropvalue (PTPParams* params, uint16_t propcode, PTPPropertyValue *value, uint16_t datatype) { /* FIXME: change the cache? hmm */ if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_SONY) && ptp_operation_issupported(params, PTP_OC_SONY_SetControlDeviceB) ) return ptp_sony_setdevicecontrolvaluea (params, propcode, value, datatype); return ptp_setdevicepropvalue (params, propcode, value, datatype); } /** * ptp_nikon_get_vendorpropcodes: * * This command downloads the vendor specific property codes. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * unsigned char **data - pointer to data pointer * unsigned int *size - size of data returned * **/ uint16_t ptp_nikon_get_vendorpropcodes (PTPParams* params, uint16_t **props, unsigned int *size) { PTPContainer ptp; uint16_t ret; unsigned char *xdata = NULL; unsigned int xsize; *props = NULL; *size = 0; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_NIKON_GetVendorPropCodes; ptp.Nparam = 0; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &xdata, &xsize); if (ret == PTP_RC_OK) *size = ptp_unpack_uint16_t_array(params,xdata,0,props); free (xdata); return ret; } uint16_t ptp_nikon_getfileinfoinblock ( PTPParams* params, uint32_t p1, uint32_t p2, uint32_t p3, unsigned char **data, unsigned int *size ) { PTPContainer ptp; *data = NULL; *size = 0; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_NIKON_GetFileInfoInBlock; ptp.Nparam = 3; ptp.Param1 = p1; ptp.Param2 = p2; ptp.Param3 = p3; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } /** * ptp_nikon_get_liveview_image: * * This command gets a LiveView image from newer Nikons DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_nikon_get_liveview_image (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_NIKON_GetLiveViewImg; ptp.Nparam=0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } /** * ptp_nikon_get_preview_image: * * This command gets a Preview image from newer Nikons DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_nikon_get_preview_image (PTPParams* params, unsigned char **xdata, unsigned int *xsize, uint32_t *handle) { PTPContainer ptp; uint16_t ret; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_NIKON_GetPreviewImg; ptp.Nparam=0; /* FIXME: * pdslrdashboard passes 3 parameters: * objectid, minimum size, maximum size */ ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, xdata, xsize); if (ret == PTP_RC_OK) { if (ptp.Nparam > 0) *handle = ptp.Param1; } return ret; } /** * ptp_canon_eos_get_viewfinder_image: * * This command gets a Viewfinder image from newer Nikons DSLRs. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_canon_eos_get_viewfinder_image (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_EOS_GetViewFinderData; ptp.Nparam=1; ptp.Param1=0x00100000; /* from trace */ return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } uint16_t ptp_canon_eos_get_viewfinder_image_handler (PTPParams* params, PTPDataHandler*handler) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CANON_EOS_GetViewFinderData; ptp.Nparam=1; ptp.Param1=0x00100000; /* from trace */ return ptp_transaction_new(params, &ptp, PTP_DP_GETDATA, 0, handler); } /** * ptp_nikon_check_event: * * This command checks the event queue on the Nikon. * * params: PTPParams* * PTPUSBEventContainer **event - list of usb events. * int *evtcnt - number of usb events in event structure. * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_nikon_check_event (PTPParams* params, PTPContainer** event, unsigned int* evtcnt) { PTPContainer ptp; uint16_t ret; unsigned char *data = NULL; unsigned int size = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_NIKON_CheckEvent; ptp.Nparam=0; *evtcnt = 0; ret = ptp_transaction (params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret == PTP_RC_OK) { ptp_unpack_Nikon_EC (params, data, size, event, evtcnt); free (data); } return ret; } /** * ptp_nikon_getptpipinfo: * * This command gets the ptpip info data. * * params: PTPParams* * unsigned char *data - data * unsigned int size - size of returned data * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_nikon_getptpipinfo (PTPParams* params, unsigned char **data, unsigned int *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_NIKON_GetDevicePTPIPInfo; ptp.Nparam=0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size); } /** * ptp_nikon_getwifiprofilelist: * * This command gets the wifi profile list. * * params: PTPParams* * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_nikon_getwifiprofilelist (PTPParams* params) { PTPContainer ptp; unsigned char* data; unsigned int size; unsigned int pos; unsigned int profn; unsigned int n; char* buffer; uint8_t len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_NIKON_GetProfileAllData; ptp.Nparam=0; size = 0; data = NULL; CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size)); if (size < 2) return PTP_RC_Undefined; /* FIXME: Add more precise error code */ params->wifi_profiles_version = data[0]; params->wifi_profiles_number = data[1]; if (params->wifi_profiles) free(params->wifi_profiles); params->wifi_profiles = malloc(params->wifi_profiles_number*sizeof(PTPNIKONWifiProfile)); memset(params->wifi_profiles, 0, params->wifi_profiles_number*sizeof(PTPNIKONWifiProfile)); pos = 2; profn = 0; while (profn < params->wifi_profiles_number && pos < size) { if (pos+6 >= size) return PTP_RC_Undefined; params->wifi_profiles[profn].id = data[pos++]; params->wifi_profiles[profn].valid = data[pos++]; n = dtoh32a(&data[pos]); pos += 4; if (pos+n+4 >= size) return PTP_RC_Undefined; strncpy(params->wifi_profiles[profn].profile_name, (char*)&data[pos], n); params->wifi_profiles[profn].profile_name[16] = '\0'; pos += n; params->wifi_profiles[profn].display_order = data[pos++]; params->wifi_profiles[profn].device_type = data[pos++]; params->wifi_profiles[profn].icon_type = data[pos++]; buffer = ptp_unpack_string(params, data, pos, &len); strncpy(params->wifi_profiles[profn].creation_date, buffer, sizeof(params->wifi_profiles[profn].creation_date)); free (buffer); pos += (len*2+1); if (pos+1 >= size) return PTP_RC_Undefined; /* FIXME: check if it is really last usage date */ buffer = ptp_unpack_string(params, data, pos, &len); strncpy(params->wifi_profiles[profn].lastusage_date, buffer, sizeof(params->wifi_profiles[profn].lastusage_date)); free (buffer); pos += (len*2+1); if (pos+5 >= size) return PTP_RC_Undefined; n = dtoh32a(&data[pos]); pos += 4; if (pos+n >= size) return PTP_RC_Undefined; strncpy(params->wifi_profiles[profn].essid, (char*)&data[pos], n); params->wifi_profiles[profn].essid[32] = '\0'; pos += n; pos += 1; profn++; } #if 0 PTPNIKONWifiProfile test; memset(&test, 0, sizeof(PTPNIKONWifiProfile)); strcpy(test.profile_name, "MyTest"); test.icon_type = 1; strcpy(test.essid, "nikon"); test.ip_address = 10 + 11 << 16 + 11 << 24; test.subnet_mask = 24; test.access_mode = 1; test.wifi_channel = 1; test.key_nr = 1; ptp_nikon_writewifiprofile(params, &test); #endif return PTP_RC_OK; } /** * ptp_nikon_writewifiprofile: * * This command gets the ptpip info data. * * params: PTPParams* * unsigned int profilenr - profile number * unsigned char *data - data * unsigned int size - size of returned data * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_nikon_writewifiprofile (PTPParams* params, PTPNIKONWifiProfile* profile) { unsigned char guid[16]; PTPContainer ptp; unsigned char buffer[1024]; unsigned char* data = buffer; int size = 0; int i; uint8_t len; int profilenr = -1; ptp_nikon_getptpipguid(guid); if (!params->wifi_profiles) CHECK_PTP_RC(ptp_nikon_getwifiprofilelist(params)); for (i = 0; i < params->wifi_profiles_number; i++) { if (!params->wifi_profiles[i].valid) { profilenr = params->wifi_profiles[i].id; break; } } if (profilenr == -1) { /* No free profile! */ return PTP_RC_StoreFull; } memset(buffer, 0, 1024); buffer[0x00] = 0x64; /* Version */ /* Profile name */ htod32a(&buffer[0x01], 17); /* 16 as third parameter, so there will always be a null-byte in the end */ strncpy((char*)&buffer[0x05], profile->profile_name, 16); buffer[0x16] = 0x00; /* Display order */ buffer[0x17] = profile->device_type; buffer[0x18] = profile->icon_type; /* FIXME: Creation date: put a real date here */ ptp_pack_string(params, "19990909T090909", data, 0x19, &len); /* IP parameters */ memcpy(&buffer[0x3A],&profile->ip_address,sizeof(profile->ip_address)); /**((unsigned int*)&buffer[0x3A]) = profile->ip_address; *//* Do not reverse bytes */ buffer[0x3E] = profile->subnet_mask; memcpy(&buffer[0x3F],&profile->gateway_address,sizeof(profile->gateway_address)); /**((unsigned int*)&buffer[0x3F]) = profile->gateway_address; */ /* Do not reverse bytes */ buffer[0x43] = profile->address_mode; /* Wifi parameters */ buffer[0x44] = profile->access_mode; buffer[0x45] = profile->wifi_channel; htod32a(&buffer[0x46], 33); /* essid */ /* 32 as third parameter, so there will always be a null-byte in the end */ strncpy((char*)&buffer[0x4A], profile->essid, 32); buffer[0x6B] = profile->authentification; buffer[0x6C] = profile->encryption; htod32a(&buffer[0x6D], 64); for (i = 0; i < 64; i++) { buffer[0x71+i] = profile->key[i]; } buffer[0xB1] = profile->key_nr; memcpy(&buffer[0xB2], guid, 16); switch(profile->encryption) { case 1: /* WEP 64bit */ htod16a(&buffer[0xC2], 5); /* (64-24)/8 = 5 */ break; case 2: /* WEP 128bit */ htod16a(&buffer[0xC2], 13); /* (128-24)/8 = 13 */ break; default: htod16a(&buffer[0xC2], 0); } size = 0xC4; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_NIKON_SendProfileData; ptp.Nparam=1; ptp.Param1=profilenr; return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL); } /** * ptp_mtp_getobjectpropssupported: * * This command gets the object properties possible from the device. * * params: PTPParams* * uint ofc - object format code * unsigned int *propnum - number of elements in returned array * uint16_t *props - array of supported properties * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_mtp_getobjectpropssupported (PTPParams* params, uint16_t ofc, uint32_t *propnum, uint16_t **props ) { PTPContainer ptp; uint16_t ret; unsigned char *data = NULL; unsigned int size = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_MTP_GetObjectPropsSupported; ptp.Nparam = 1; ptp.Param1 = ofc; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret == PTP_RC_OK) *propnum=ptp_unpack_uint16_t_array(params,data,0,props); free(data); return ret; } /** * ptp_mtp_getobjectpropdesc: * * This command gets the object property description. * * params: PTPParams* * uint16_t opc - object property code * uint16_t ofc - object format code * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_mtp_getobjectpropdesc ( PTPParams* params, uint16_t opc, uint16_t ofc, PTPObjectPropDesc *opd ) { PTPContainer ptp; uint16_t ret; unsigned char *data = NULL; unsigned int size = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_MTP_GetObjectPropDesc; ptp.Nparam = 2; ptp.Param1 = opc; ptp.Param2 = ofc; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret == PTP_RC_OK) ptp_unpack_OPD (params, data, opd, size); free(data); return ret; } /** * ptp_mtp_getobjectpropvalue: * * This command gets the object properties of an object handle. * * params: PTPParams* * uint32_t objectid - object format code * uint16_t opc - object prop code * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_mtp_getobjectpropvalue ( PTPParams* params, uint32_t oid, uint16_t opc, PTPPropertyValue *value, uint16_t datatype ) { PTPContainer ptp; uint16_t ret; unsigned char *data = NULL; unsigned int size = 0; unsigned int offset = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_MTP_GetObjectPropValue; ptp.Nparam = 2; ptp.Param1 = oid; ptp.Param2 = opc; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size); if (ret == PTP_RC_OK) { int ret2 = ptp_unpack_DPV(params, data, &offset, size, value, datatype); if (!ret2) { ptp_debug (params, "ptp_mtp_getobjectpropvalue: unpacking DPV failed"); ret = PTP_RC_GeneralError; } } free(data); return ret; } /** * ptp_mtp_setobjectpropvalue: * * This command gets the object properties of an object handle. * * params: PTPParams* * uint32_t objectid - object format code * uint16_t opc - object prop code * * Return values: Some PTP_RC_* code. * **/ uint16_t ptp_mtp_setobjectpropvalue ( PTPParams* params, uint32_t oid, uint16_t opc, PTPPropertyValue *value, uint16_t datatype ) { PTPContainer ptp; uint16_t ret; unsigned char *data = NULL; unsigned int size ; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_MTP_SetObjectPropValue; ptp.Nparam = 2; ptp.Param1 = oid; ptp.Param2 = opc; size = ptp_pack_DPV(params, value, &data, datatype); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL); free(data); return ret; } uint16_t ptp_mtp_getobjectreferences (PTPParams* params, uint32_t handle, uint32_t** ohArray, uint32_t* arraylen) { PTPContainer ptp; uint16_t ret; unsigned char* dpv=NULL; unsigned int dpvlen = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_MTP_GetObjectReferences; ptp.Param1=handle; ptp.Nparam=1; ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &dpv, &dpvlen); if (ret == PTP_RC_OK) { /* Sandisk Sansa skips the DATA phase, but returns OK as response. * this will gives us a NULL here. Handle it. -Marcus */ if ((dpv == NULL) || (dpvlen == 0)) { *arraylen = 0; *ohArray = NULL; } else { *arraylen = ptp_unpack_uint32_t_array(params, dpv, 0, ohArray); } } free(dpv); return ret; } uint16_t ptp_mtp_setobjectreferences (PTPParams* params, uint32_t handle, uint32_t* ohArray, uint32_t arraylen) { PTPContainer ptp; uint16_t ret; uint32_t size; unsigned char* dpv=NULL; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_MTP_SetObjectReferences; ptp.Param1 = handle; ptp.Nparam = 1; size = ptp_pack_uint32_t_array(params, ohArray, arraylen, &dpv); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, (unsigned char **)&dpv, NULL); free(dpv); return ret; } uint16_t ptp_mtp_getobjectproplist (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops) { uint16_t ret; PTPContainer ptp; unsigned char* opldata = NULL; unsigned int oplsize; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_MTP_GetObjPropList; ptp.Param1 = handle; ptp.Param2 = 0x00000000U; /* 0x00000000U should be "all formats" */ ptp.Param3 = 0xFFFFFFFFU; /* 0xFFFFFFFFU should be "all properties" */ ptp.Param4 = 0x00000000U; ptp.Param5 = 0xFFFFFFFFU; /* means - return full tree below the Param1 handle */ ptp.Nparam = 5; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &opldata, &oplsize); if (ret == PTP_RC_OK) *nrofprops = ptp_unpack_OPL(params, opldata, props, oplsize); if (opldata != NULL) free(opldata); return ret; } uint16_t ptp_mtp_getobjectproplist_single (PTPParams* params, uint32_t handle, MTPProperties **props, int *nrofprops) { uint16_t ret; PTPContainer ptp; unsigned char* opldata = NULL; unsigned int oplsize; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_MTP_GetObjPropList; ptp.Param1 = handle; ptp.Param2 = 0x00000000U; /* 0x00000000U should be "all formats" */ ptp.Param3 = 0xFFFFFFFFU; /* 0xFFFFFFFFU should be "all properties" */ ptp.Param4 = 0x00000000U; ptp.Param5 = 0x00000000U; /* means - return single tree below the Param1 handle */ ptp.Nparam = 5; ret = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &opldata, &oplsize); if (ret == PTP_RC_OK) *nrofprops = ptp_unpack_OPL(params, opldata, props, oplsize); if (opldata != NULL) free(opldata); return ret; } uint16_t ptp_mtp_sendobjectproplist (PTPParams* params, uint32_t* store, uint32_t* parenthandle, uint32_t* handle, uint16_t objecttype, uint64_t objectsize, MTPProperties *props, int nrofprops) { uint16_t ret; PTPContainer ptp; unsigned char* opldata=NULL; uint32_t oplsize; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_MTP_SendObjectPropList; ptp.Param1 = *store; ptp.Param2 = *parenthandle; ptp.Param3 = (uint32_t) objecttype; ptp.Param4 = (uint32_t) (objectsize >> 32); ptp.Param5 = (uint32_t) (objectsize & 0xffffffffU); ptp.Nparam = 5; /* Set object handle to 0 for a new object */ oplsize = ptp_pack_OPL(params,props,nrofprops,&opldata); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, oplsize, &opldata, NULL); free(opldata); *store = ptp.Param1; *parenthandle = ptp.Param2; *handle = ptp.Param3; return ret; } uint16_t ptp_mtp_setobjectproplist (PTPParams* params, MTPProperties *props, int nrofprops) { uint16_t ret; PTPContainer ptp; unsigned char* opldata=NULL; uint32_t oplsize; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_MTP_SetObjPropList; ptp.Nparam = 0; oplsize = ptp_pack_OPL(params,props,nrofprops,&opldata); ret = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, oplsize, &opldata, NULL); free(opldata); return ret; } uint16_t ptp_mtpz_sendwmdrmpdapprequest (PTPParams* params, unsigned char *appcertmsg, uint32_t size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_MTP_WMDRMPD_SendWMDRMPDAppRequest; return ptp_transaction (params, &ptp, PTP_DP_SENDDATA, size, &appcertmsg, NULL); } uint16_t ptp_mtpz_getwmdrmpdappresponse (PTPParams* params, unsigned char **response, uint32_t *size) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code = PTP_OC_MTP_WMDRMPD_GetWMDRMPDAppResponse; *size = 0; *response = NULL; return ptp_transaction (params, &ptp, PTP_DP_GETDATA, 0, response, size); } /****** CHDK interface ******/ uint16_t ptp_chdk_get_memory(PTPParams* params, int start, int num, unsigned char **buf) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=3; ptp.Param1=PTP_CHDK_GetMemory; ptp.Param2=start; ptp.Param3=num; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, buf, NULL); } uint16_t ptp_chdk_set_memory_long(PTPParams* params, int addr, int val) { PTPContainer ptp; unsigned char *buf = (unsigned char *) &val; /* FIXME ... endianness? */ PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=3; ptp.Param1=PTP_CHDK_SetMemory; ptp.Param2=addr; ptp.Param3=4; return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, 4, &buf, NULL); } #if 0 int ptp_chdk_upload(PTPParams* params, char *local_fn, char *remote_fn) { uint16_t ret; PTPContainer ptp; char *buf = NULL; FILE *f; unsigned file_len,data_len,file_name_len; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_UploadFile; f = fopen(local_fn,"rb"); if ( f == NULL ) { ptp_error(params,"could not open file \'%s\'",local_fn); return 0; } fseek(f,0,SEEK_END); file_len = ftell(f); fseek(f,0,SEEK_SET); file_name_len = strlen(remote_fn); data_len = 4 + file_name_len + file_len; buf = malloc(data_len); memcpy(buf,&file_name_len,4); memcpy(buf+4,remote_fn,file_name_len); fread(buf+4+file_name_len,1,file_len,f); fclose(f); ret=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, data_len, &buf, NULL); free(buf); if ( ret != PTP_RC_OK ) { ptp_error(params,"unexpected return code 0x%x",ret); return 0; } return 1; } static uint16_t gd_to_file(PTPParams* params, PTPGetdataParams *gdparams, unsigned len, unsigned char *bytes) { FILE *f = (FILE *)gdparams->handler_data; size_t count=fwrite(bytes,1,len,f); if(count != len) { return PTP_ERROR_IO; } return PTP_RC_OK; } int ptp_chdk_download(PTPParams* params, char *remote_fn, char *local_fn) { uint16_t ret; PTPContainer ptp; PTPGetdataParams gdparams; FILE *f; f = fopen(local_fn,"wb"); if ( f == NULL ) { ptp_error(params,"could not open file \'%s\'",local_fn); return 0; } PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=2; ptp.Param1=PTP_CHDK_TempData; ptp.Param2=0; ret=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, strlen(remote_fn), &remote_fn, NULL); if ( ret != PTP_RC_OK ) { ptp_error(params,"unexpected return code 0x%x",ret); fclose(f); return 0; } PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_DownloadFile; PTP_CNT_INIT(gdparams); gdparams.handler = gd_to_file; gdparams.block_size = 0; // default gdparams.handler_data = f; ret=ptp_getdata_transaction(params, &ptp, &gdparams); fclose(f); if ( ret != PTP_RC_OK ) { ptp_error(params,"unexpected return code 0x%x",ret); return 0; } return 1; } #endif /* * Preliminary remote capture over USB code. Corresponding CHDK code is in the ptp-remote-capture-test * This is under development and should not be included in builds for general distribution */ /* * isready: 0: not ready, lowest 2 bits: available image formats, 0x10000000: error */ uint16_t ptp_chdk_rcisready(PTPParams* params, int *isready, int *imgnum) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_RemoteCaptureIsReady; ret=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ( ret != PTP_RC_OK ) return ret; *isready=ptp.Param1; *imgnum=ptp.Param2; return ret; } uint16_t ptp_chdk_rcgetchunk(PTPParams* params, int fmt, ptp_chdk_rc_chunk *chunk) { uint16_t ret; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=2; ptp.Param1=PTP_CHDK_RemoteCaptureGetData; ptp.Param2=fmt; //get chunk chunk->data = NULL; chunk->size = 0; chunk->offset = 0; chunk->last = 0; // TODO should allow ptp_getdata_transaction to send chunks directly to file, or to mem ret=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &chunk->data, NULL); if ( ret != PTP_RC_OK ) return ret; chunk->size = ptp.Param1; chunk->last = (ptp.Param2 == 0); chunk->offset = ptp.Param3; //-1 for none return ret; } uint16_t ptp_chdk_exec_lua(PTPParams* params, char *script, int flags, int *script_id, int *status) { uint16_t r; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=2; ptp.Param1=PTP_CHDK_ExecuteScript; ptp.Param2=PTP_CHDK_SL_LUA | flags; r = ptp_transaction(params, &ptp, PTP_DP_SENDDATA, strlen(script)+1, (unsigned char**)&script, NULL); if ( r != PTP_RC_OK ) { *script_id = 0; *status = 0; return r; } else { *script_id = ptp.Param1; *status = ptp.Param2; //return (*status == PTP_CHDK_S_ERRTYPE_NONE); if (*status == PTP_CHDK_S_ERRTYPE_NONE) return PTP_RC_OK; else return r; } } uint16_t ptp_chdk_get_version(PTPParams* params, int *major, int *minor) { uint16_t r; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_Version; r=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ( r != PTP_RC_OK ) return r; *major = ptp.Param1; *minor = ptp.Param2; return r; } uint16_t ptp_chdk_get_script_status(PTPParams* params, unsigned *status) { uint16_t r; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_ScriptStatus; r=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ( r != PTP_RC_OK ) return r; *status = ptp.Param1; return r; } uint16_t ptp_chdk_get_script_support(PTPParams* params, unsigned *status) { uint16_t r; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_ScriptSupport; r=ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); if ( r != PTP_RC_OK ) return r; *status = ptp.Param1; return r; } uint16_t ptp_chdk_write_script_msg(PTPParams* params, char *data, unsigned size, int target_script_id, int *status) { uint16_t r; PTPContainer ptp; // a zero length data phase appears to do bad things, camera stops responding to PTP if(!size) { ptp_error(params,"zero length message not allowed"); *status = 0; return 0; } PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=2; ptp.Param1=PTP_CHDK_WriteScriptMsg; ptp.Param2=target_script_id; r=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, (unsigned char**)&data, NULL); if ( r != PTP_RC_OK ) { *status = 0; return r; } *status = ptp.Param1; return r; } uint16_t ptp_chdk_read_script_msg(PTPParams* params, ptp_chdk_script_msg **msg) { uint16_t r; PTPContainer ptp; unsigned char *data = NULL; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_ReadScriptMsg; *msg = NULL; /* camera will always send data, otherwise getdata will cause problems */ r=ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, NULL); if ( r != PTP_RC_OK ) return r; /* for convenience, always allocate an extra byte and null it*/ *msg = malloc(sizeof(ptp_chdk_script_msg) + ptp.Param4 + 1); (*msg)->type = ptp.Param1; (*msg)->subtype = ptp.Param2; (*msg)->script_id = ptp.Param3; (*msg)->size = ptp.Param4; memcpy((*msg)->data,data,(*msg)->size); (*msg)->data[(*msg)->size] = 0; free(data); return r; } uint16_t ptp_chdk_get_live_data(PTPParams* params, unsigned flags, unsigned char **data, unsigned int *data_size) { uint16_t r; PTPContainer ptp; unsigned int real_size = 0; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=2; ptp.Param1=PTP_CHDK_GetDisplayData; ptp.Param2=flags; *data = NULL; *data_size = 0; r = ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, &real_size); if ( r != PTP_RC_OK ) return r; *data_size = ptp.Param1; return r; } uint16_t ptp_chdk_call_function(PTPParams* params, int *args, int size, int *ret) { uint16_t r; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_CHDK; ptp.Nparam=1; ptp.Param1=PTP_CHDK_CallFunction; r=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size*sizeof(int), (unsigned char **) &args, NULL); if ( r != PTP_RC_OK ) return r; if ( ret ) *ret = ptp.Param1; return r; } /** * Android MTP Extensions */ /** * ptp_android_getpartialobject64: * params: PTPParams* * handle - Object handle * offset - Offset into object * maxbytes - Maximum of bytes to read * object - pointer to data area * len - pointer to returned length * * Get object 'handle' from device and store the data in newly * allocated 'object'. Start from offset and read at most maxbytes. * * This is a 64bit offset version of the standard GetPartialObject. * * Return values: Some PTP_RC_* code. **/ uint16_t ptp_android_getpartialobject64 (PTPParams* params, uint32_t handle, uint64_t offset, uint32_t maxbytes, unsigned char** object, uint32_t *len) { PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_ANDROID_GetPartialObject64; ptp.Param1=handle; ptp.Param2=offset & 0xFFFFFFFF; ptp.Param3=offset >> 32; ptp.Param4=maxbytes; ptp.Nparam=4; *len=0; return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, object, len); } uint16_t ptp_android_sendpartialobject (PTPParams* params, uint32_t handle, uint64_t offset, unsigned char* object, uint32_t len) { uint32_t err; PTPContainer ptp; PTP_CNT_INIT(ptp); ptp.Code=PTP_OC_ANDROID_SendPartialObject; ptp.Param1=handle; ptp.Param2=offset & 0xFFFFFFFF; ptp.Param3=offset >> 32; ptp.Param4=len; ptp.Nparam=4; /* * MtpServer.cpp is buggy: it uses write() without offset * rather than pwrite to send the data for data coming with * the header packet */ params->split_header_data = 1; err=ptp_transaction(params, &ptp, PTP_DP_SENDDATA, len, &object, NULL); params->split_header_data = 0; return err; } /* Non PTP protocol functions */ /* devinfo testing functions */ int ptp_event_issupported(PTPParams* params, uint16_t event) { unsigned int i=0; for (;ideviceinfo.EventsSupported_len;i++) { if (params->deviceinfo.EventsSupported[i]==event) return 1; } return 0; } int ptp_property_issupported(PTPParams* params, uint16_t property) { unsigned int i; for (i=0;ideviceinfo.DevicePropertiesSupported_len;i++) if (params->deviceinfo.DevicePropertiesSupported[i]==property) return 1; return 0; } void ptp_free_objectinfo (PTPObjectInfo *oi) { if (!oi) return; free (oi->Filename); oi->Filename = NULL; free (oi->Keywords); oi->Keywords = NULL; } void ptp_free_object (PTPObject *ob) { unsigned int i; if (!ob) return; ptp_free_objectinfo (&ob->oi); for (i=0;inrofmtpprops;i++) ptp_destroy_object_prop(&ob->mtpprops[i]); ob->flags = 0; } const char * ptp_strerror(uint16_t error) { int i; /* PTP error descriptions */ static struct { short n; const char *txt; } ptp_errors[] = { {PTP_RC_Undefined, N_("PTP: Undefined Error")}, {PTP_RC_OK, N_("PTP: OK!")}, {PTP_RC_GeneralError, N_("PTP: General Error")}, {PTP_RC_SessionNotOpen, N_("PTP: Session Not Open")}, {PTP_RC_InvalidTransactionID, N_("PTP: Invalid Transaction ID")}, {PTP_RC_OperationNotSupported, N_("PTP: Operation Not Supported")}, {PTP_RC_ParameterNotSupported, N_("PTP: Parameter Not Supported")}, {PTP_RC_IncompleteTransfer, N_("PTP: Incomplete Transfer")}, {PTP_RC_InvalidStorageId, N_("PTP: Invalid Storage ID")}, {PTP_RC_InvalidObjectHandle, N_("PTP: Invalid Object Handle")}, {PTP_RC_DevicePropNotSupported, N_("PTP: Device Prop Not Supported")}, {PTP_RC_InvalidObjectFormatCode, N_("PTP: Invalid Object Format Code")}, {PTP_RC_StoreFull, N_("PTP: Store Full")}, {PTP_RC_ObjectWriteProtected, N_("PTP: Object Write Protected")}, {PTP_RC_StoreReadOnly, N_("PTP: Store Read Only")}, {PTP_RC_AccessDenied, N_("PTP: Access Denied")}, {PTP_RC_NoThumbnailPresent, N_("PTP: No Thumbnail Present")}, {PTP_RC_SelfTestFailed, N_("PTP: Self Test Failed")}, {PTP_RC_PartialDeletion, N_("PTP: Partial Deletion")}, {PTP_RC_StoreNotAvailable, N_("PTP: Store Not Available")}, {PTP_RC_SpecificationByFormatUnsupported, N_("PTP: Specification By Format Unsupported")}, {PTP_RC_NoValidObjectInfo, N_("PTP: No Valid Object Info")}, {PTP_RC_InvalidCodeFormat, N_("PTP: Invalid Code Format")}, {PTP_RC_UnknownVendorCode, N_("PTP: Unknown Vendor Code")}, {PTP_RC_CaptureAlreadyTerminated, N_("PTP: Capture Already Terminated")}, {PTP_RC_DeviceBusy, N_("PTP: Device Busy")}, {PTP_RC_InvalidParentObject, N_("PTP: Invalid Parent Object")}, {PTP_RC_InvalidDevicePropFormat, N_("PTP: Invalid Device Prop Format")}, {PTP_RC_InvalidDevicePropValue, N_("PTP: Invalid Device Prop Value")}, {PTP_RC_InvalidParameter, N_("PTP: Invalid Parameter")}, {PTP_RC_SessionAlreadyOpened, N_("PTP: Session Already Opened")}, {PTP_RC_TransactionCanceled, N_("PTP: Transaction Canceled")}, {PTP_RC_SpecificationOfDestinationUnsupported, N_("PTP: Specification Of Destination Unsupported")}, {PTP_RC_EK_FilenameRequired, N_("PTP: EK Filename Required")}, {PTP_RC_EK_FilenameConflicts, N_("PTP: EK Filename Conflicts")}, {PTP_RC_EK_FilenameInvalid, N_("PTP: EK Filename Invalid")}, {PTP_ERROR_IO, N_("PTP: I/O error")}, {PTP_ERROR_BADPARAM, N_("PTP: Error: bad parameter")}, {PTP_ERROR_DATA_EXPECTED, N_("PTP: Protocol error, data expected")}, {PTP_ERROR_RESP_EXPECTED, N_("PTP: Protocol error, response expected")}, {0, NULL} }; for (i=0; ptp_errors[i].txt!=NULL; i++) if (ptp_errors[i].n == error) return ptp_errors[i].txt; return NULL; } void ptp_perror(PTPParams* params, uint16_t error) { const char *txt = ptp_strerror(error); if (txt != NULL) ptp_error(params, txt); } const char* ptp_get_property_description(PTPParams* params, uint16_t dpc) { int i; /* Device Property descriptions */ struct { uint16_t dpc; const char *txt; } ptp_device_properties[] = { {PTP_DPC_Undefined, N_("Undefined PTP Property")}, {PTP_DPC_BatteryLevel, N_("Battery Level")}, {PTP_DPC_FunctionalMode, N_("Functional Mode")}, {PTP_DPC_ImageSize, N_("Image Size")}, {PTP_DPC_CompressionSetting, N_("Compression Setting")}, {PTP_DPC_WhiteBalance, N_("White Balance")}, {PTP_DPC_RGBGain, N_("RGB Gain")}, {PTP_DPC_FNumber, N_("F-Number")}, {PTP_DPC_FocalLength, N_("Focal Length")}, {PTP_DPC_FocusDistance, N_("Focus Distance")}, {PTP_DPC_FocusMode, N_("Focus Mode")}, {PTP_DPC_ExposureMeteringMode, N_("Exposure Metering Mode")}, {PTP_DPC_FlashMode, N_("Flash Mode")}, {PTP_DPC_ExposureTime, N_("Exposure Time")}, {PTP_DPC_ExposureProgramMode, N_("Exposure Program Mode")}, {PTP_DPC_ExposureIndex, N_("Exposure Index (film speed ISO)")}, {PTP_DPC_ExposureBiasCompensation, N_("Exposure Bias Compensation")}, {PTP_DPC_DateTime, N_("Date & Time")}, {PTP_DPC_CaptureDelay, N_("Pre-Capture Delay")}, {PTP_DPC_StillCaptureMode, N_("Still Capture Mode")}, {PTP_DPC_Contrast, N_("Contrast")}, {PTP_DPC_Sharpness, N_("Sharpness")}, {PTP_DPC_DigitalZoom, N_("Digital Zoom")}, {PTP_DPC_EffectMode, N_("Effect Mode")}, {PTP_DPC_BurstNumber, N_("Burst Number")}, {PTP_DPC_BurstInterval, N_("Burst Interval")}, {PTP_DPC_TimelapseNumber, N_("Timelapse Number")}, {PTP_DPC_TimelapseInterval, N_("Timelapse Interval")}, {PTP_DPC_FocusMeteringMode, N_("Focus Metering Mode")}, {PTP_DPC_UploadURL, N_("Upload URL")}, {PTP_DPC_Artist, N_("Artist")}, {PTP_DPC_CopyrightInfo, N_("Copyright Info")}, {0,NULL} }; struct { uint16_t dpc; const char *txt; } ptp_device_properties_EK[] = { {PTP_DPC_EK_ColorTemperature, N_("Color Temperature")}, {PTP_DPC_EK_DateTimeStampFormat, N_("Date Time Stamp Format")}, {PTP_DPC_EK_BeepMode, N_("Beep Mode")}, {PTP_DPC_EK_VideoOut, N_("Video Out")}, {PTP_DPC_EK_PowerSaving, N_("Power Saving")}, {PTP_DPC_EK_UI_Language, N_("UI Language")}, {0,NULL} }; struct { uint16_t dpc; const char *txt; } ptp_device_properties_Canon[] = { {PTP_DPC_CANON_BeepMode, N_("Beep Mode")}, {PTP_DPC_CANON_BatteryKind, N_("Battery Type")}, {PTP_DPC_CANON_BatteryStatus, N_("Battery Mode")}, {PTP_DPC_CANON_UILockType, N_("UILockType")}, {PTP_DPC_CANON_CameraMode, N_("Camera Mode")}, {PTP_DPC_CANON_ImageQuality, N_("Image Quality")}, {PTP_DPC_CANON_FullViewFileFormat, N_("Full View File Format")}, {PTP_DPC_CANON_ImageSize, N_("Image Size")}, {PTP_DPC_CANON_SelfTime, N_("Self Time")}, {PTP_DPC_CANON_FlashMode, N_("Flash Mode")}, {PTP_DPC_CANON_Beep, N_("Beep")}, {PTP_DPC_CANON_ShootingMode, N_("Shooting Mode")}, {PTP_DPC_CANON_ImageMode, N_("Image Mode")}, {PTP_DPC_CANON_DriveMode, N_("Drive Mode")}, {PTP_DPC_CANON_EZoom, N_("Zoom")}, {PTP_DPC_CANON_MeteringMode, N_("Metering Mode")}, {PTP_DPC_CANON_AFDistance, N_("AF Distance")}, {PTP_DPC_CANON_FocusingPoint, N_("Focusing Point")}, {PTP_DPC_CANON_WhiteBalance, N_("White Balance")}, {PTP_DPC_CANON_SlowShutterSetting, N_("Slow Shutter Setting")}, {PTP_DPC_CANON_AFMode, N_("AF Mode")}, {PTP_DPC_CANON_ImageStabilization, N_("Image Stabilization")}, {PTP_DPC_CANON_Contrast, N_("Contrast")}, {PTP_DPC_CANON_ColorGain, N_("Color Gain")}, {PTP_DPC_CANON_Sharpness, N_("Sharpness")}, {PTP_DPC_CANON_Sensitivity, N_("Sensitivity")}, {PTP_DPC_CANON_ParameterSet, N_("Parameter Set")}, {PTP_DPC_CANON_ISOSpeed, N_("ISO Speed")}, {PTP_DPC_CANON_Aperture, N_("Aperture")}, {PTP_DPC_CANON_ShutterSpeed, N_("Shutter Speed")}, {PTP_DPC_CANON_ExpCompensation, N_("Exposure Compensation")}, {PTP_DPC_CANON_FlashCompensation, N_("Flash Compensation")}, {PTP_DPC_CANON_AEBExposureCompensation, N_("AEB Exposure Compensation")}, {PTP_DPC_CANON_AvOpen, N_("Av Open")}, {PTP_DPC_CANON_AvMax, N_("Av Max")}, {PTP_DPC_CANON_FocalLength, N_("Focal Length")}, {PTP_DPC_CANON_FocalLengthTele, N_("Focal Length Tele")}, {PTP_DPC_CANON_FocalLengthWide, N_("Focal Length Wide")}, {PTP_DPC_CANON_FocalLengthDenominator, N_("Focal Length Denominator")}, {PTP_DPC_CANON_CaptureTransferMode, N_("Capture Transfer Mode")}, {PTP_DPC_CANON_Zoom, N_("Zoom")}, {PTP_DPC_CANON_NamePrefix, N_("Name Prefix")}, {PTP_DPC_CANON_SizeQualityMode, N_("Size Quality Mode")}, {PTP_DPC_CANON_SupportedThumbSize, N_("Supported Thumb Size")}, {PTP_DPC_CANON_SizeOfOutputDataFromCamera, N_("Size of Output Data from Camera")}, {PTP_DPC_CANON_SizeOfInputDataToCamera, N_("Size of Input Data to Camera")}, {PTP_DPC_CANON_RemoteAPIVersion,N_("Remote API Version")}, {PTP_DPC_CANON_FirmwareVersion, N_("Firmware Version")}, {PTP_DPC_CANON_CameraModel, N_("Camera Model")}, {PTP_DPC_CANON_CameraOwner, N_("Camera Owner")}, {PTP_DPC_CANON_UnixTime, N_("UNIX Time")}, {PTP_DPC_CANON_CameraBodyID, N_("Camera Body ID")}, {PTP_DPC_CANON_CameraOutput, N_("Camera Output")}, {PTP_DPC_CANON_DispAv, N_("Disp Av")}, {PTP_DPC_CANON_AvOpenApex, N_("Av Open Apex")}, {PTP_DPC_CANON_DZoomMagnification, N_("Digital Zoom Magnification")}, {PTP_DPC_CANON_MlSpotPos, N_("Ml Spot Position")}, {PTP_DPC_CANON_DispAvMax, N_("Disp Av Max")}, {PTP_DPC_CANON_AvMaxApex, N_("Av Max Apex")}, {PTP_DPC_CANON_EZoomStartPosition, N_("EZoom Start Position")}, {PTP_DPC_CANON_FocalLengthOfTele, N_("Focal Length Tele")}, {PTP_DPC_CANON_EZoomSizeOfTele, N_("EZoom Size of Tele")}, {PTP_DPC_CANON_PhotoEffect, N_("Photo Effect")}, {PTP_DPC_CANON_AssistLight, N_("Assist Light")}, {PTP_DPC_CANON_FlashQuantityCount, N_("Flash Quantity Count")}, {PTP_DPC_CANON_RotationAngle, N_("Rotation Angle")}, {PTP_DPC_CANON_RotationScene, N_("Rotation Scene")}, {PTP_DPC_CANON_EventEmulateMode,N_("Event Emulate Mode")}, {PTP_DPC_CANON_DPOFVersion, N_("DPOF Version")}, {PTP_DPC_CANON_TypeOfSupportedSlideShow, N_("Type of Slideshow")}, {PTP_DPC_CANON_AverageFilesizes,N_("Average Filesizes")}, {PTP_DPC_CANON_ModelID, N_("Model ID")}, {0,NULL} }; struct { uint16_t dpc; const char *txt; } ptp_device_properties_Nikon[] = { {PTP_DPC_NIKON_ShootingBank, /* 0xD010 */ N_("Shooting Bank")}, {PTP_DPC_NIKON_ShootingBankNameA, /* 0xD011 */ N_("Shooting Bank Name A")}, {PTP_DPC_NIKON_ShootingBankNameB, /* 0xD012 */ N_("Shooting Bank Name B")}, {PTP_DPC_NIKON_ShootingBankNameC, /* 0xD013 */ N_("Shooting Bank Name C")}, {PTP_DPC_NIKON_ShootingBankNameD, /* 0xD014 */ N_("Shooting Bank Name D")}, {PTP_DPC_NIKON_ResetBank0, /* 0xD015 */ N_("Reset Bank 0")}, {PTP_DPC_NIKON_RawCompression, /* 0xD016 */ N_("Raw Compression")}, {PTP_DPC_NIKON_WhiteBalanceAutoBias, /* 0xD017 */ N_("Auto White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceTungstenBias, /* 0xD018 */ N_("Tungsten White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceFluorescentBias, /* 0xD019 */ N_("Fluorescent White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceDaylightBias, /* 0xD01a */ N_("Daylight White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceFlashBias, /* 0xD01b */ N_("Flash White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceCloudyBias, /* 0xD01c */ N_("Cloudy White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceShadeBias, /* 0xD01d */ N_("Shady White Balance Bias")}, {PTP_DPC_NIKON_WhiteBalanceColorTemperature, /* 0xD01e */ N_("White Balance Colour Temperature")}, {PTP_DPC_NIKON_WhiteBalancePresetNo, /* 0xD01f */ N_("White Balance Preset Number")}, {PTP_DPC_NIKON_WhiteBalancePresetName0, /* 0xD020 */ N_("White Balance Preset Name 0")}, {PTP_DPC_NIKON_WhiteBalancePresetName1, /* 0xD021 */ N_("White Balance Preset Name 1")}, {PTP_DPC_NIKON_WhiteBalancePresetName2, /* 0xD022 */ N_("White Balance Preset Name 2")}, {PTP_DPC_NIKON_WhiteBalancePresetName3, /* 0xD023 */ N_("White Balance Preset Name 3")}, {PTP_DPC_NIKON_WhiteBalancePresetName4, /* 0xD024 */ N_("White Balance Preset Name 4")}, {PTP_DPC_NIKON_WhiteBalancePresetVal0, /* 0xD025 */ N_("White Balance Preset Value 0")}, {PTP_DPC_NIKON_WhiteBalancePresetVal1, /* 0xD026 */ N_("White Balance Preset Value 1")}, {PTP_DPC_NIKON_WhiteBalancePresetVal2, /* 0xD027 */ N_("White Balance Preset Value 2")}, {PTP_DPC_NIKON_WhiteBalancePresetVal3, /* 0xD028 */ N_("White Balance Preset Value 3")}, {PTP_DPC_NIKON_WhiteBalancePresetVal4, /* 0xD029 */ N_("White Balance Preset Value 4")}, {PTP_DPC_NIKON_ImageSharpening, /* 0xD02a */ N_("Sharpening")}, {PTP_DPC_NIKON_ToneCompensation, /* 0xD02b */ N_("Tone Compensation")}, {PTP_DPC_NIKON_ColorModel, /* 0xD02c */ N_("Color Model")}, {PTP_DPC_NIKON_HueAdjustment, /* 0xD02d */ N_("Hue Adjustment")}, {PTP_DPC_NIKON_NonCPULensDataFocalLength, /* 0xD02e */ N_("Lens Focal Length (Non CPU)")}, {PTP_DPC_NIKON_NonCPULensDataMaximumAperture, /* 0xD02f */ N_("Lens Maximum Aperture (Non CPU)")}, {PTP_DPC_NIKON_ShootingMode, /* 0xD030 */ N_("Shooting Mode")}, {PTP_DPC_NIKON_JPEG_Compression_Policy, /* 0xD031 */ N_("JPEG Compression Policy")}, {PTP_DPC_NIKON_ColorSpace, /* 0xD032 */ N_("Color Space")}, {PTP_DPC_NIKON_AutoDXCrop, /* 0xD033 */ N_("Auto DX Crop")}, {PTP_DPC_NIKON_FlickerReduction, /* 0xD034 */ N_("Flicker Reduction")}, {PTP_DPC_NIKON_RemoteMode, /* 0xD035 */ N_("Remote Mode")}, {PTP_DPC_NIKON_VideoMode, /* 0xD036 */ N_("Video Mode")}, {PTP_DPC_NIKON_EffectMode, /* 0xD037 */ N_("Effect Mode")}, {PTP_DPC_NIKON_CSMMenuBankSelect, /* 0xD040 */ "PTP_DPC_NIKON_CSMMenuBankSelect"}, {PTP_DPC_NIKON_MenuBankNameA, /* 0xD041 */ N_("Menu Bank Name A")}, {PTP_DPC_NIKON_MenuBankNameB, /* 0xD042 */ N_("Menu Bank Name B")}, {PTP_DPC_NIKON_MenuBankNameC, /* 0xD043 */ N_("Menu Bank Name C")}, {PTP_DPC_NIKON_MenuBankNameD, /* 0xD044 */ N_("Menu Bank Name D")}, {PTP_DPC_NIKON_ResetBank, /* 0xD045 */ N_("Reset Menu Bank")}, {PTP_DPC_NIKON_A1AFCModePriority, /* 0xD048 */ "PTP_DPC_NIKON_A1AFCModePriority"}, {PTP_DPC_NIKON_A2AFSModePriority, /* 0xD049 */ "PTP_DPC_NIKON_A2AFSModePriority"}, {PTP_DPC_NIKON_A3GroupDynamicAF, /* 0xD04a */ "PTP_DPC_NIKON_A3GroupDynamicAF"}, {PTP_DPC_NIKON_A4AFActivation, /* 0xD04b */ "PTP_DPC_NIKON_A4AFActivation"}, {PTP_DPC_NIKON_FocusAreaIllumManualFocus, /* 0xD04c */ "PTP_DPC_NIKON_FocusAreaIllumManualFocus"}, {PTP_DPC_NIKON_FocusAreaIllumContinuous, /* 0xD04d */ "PTP_DPC_NIKON_FocusAreaIllumContinuous"}, {PTP_DPC_NIKON_FocusAreaIllumWhenSelected, /* 0xD04e */ "PTP_DPC_NIKON_FocusAreaIllumWhenSelected"}, {PTP_DPC_NIKON_FocusAreaWrap, /* 0xD04f */ N_("Focus Area Wrap")}, {PTP_DPC_NIKON_VerticalAFON, /* 0xD050 */ N_("Vertical AF On")}, {PTP_DPC_NIKON_AFLockOn, /* 0xD051 */ N_("AF Lock On")}, {PTP_DPC_NIKON_FocusAreaZone, /* 0xD052 */ N_("Focus Area Zone")}, {PTP_DPC_NIKON_EnableCopyright, /* 0xD053 */ N_("Enable Copyright")}, {PTP_DPC_NIKON_ISOAuto, /* 0xD054 */ N_("Auto ISO")}, {PTP_DPC_NIKON_EVISOStep, /* 0xD055 */ N_("Exposure ISO Step")}, {PTP_DPC_NIKON_EVStep, /* 0xD056 */ N_("Exposure Step")}, {PTP_DPC_NIKON_EVStepExposureComp, /* 0xD057 */ N_("Exposure Compensation (EV)")}, {PTP_DPC_NIKON_ExposureCompensation, /* 0xD058 */ N_("Exposure Compensation")}, {PTP_DPC_NIKON_CenterWeightArea, /* 0xD059 */ N_("Centre Weight Area")}, {PTP_DPC_NIKON_ExposureBaseMatrix, /* 0xD05A */ N_("Exposure Base Matrix")}, {PTP_DPC_NIKON_ExposureBaseCenter, /* 0xD05B */ N_("Exposure Base Center")}, {PTP_DPC_NIKON_ExposureBaseSpot, /* 0xD05C */ N_("Exposure Base Spot")}, {PTP_DPC_NIKON_LiveViewAFArea, /* 0xD05D */ N_("Live View AF Area")}, {PTP_DPC_NIKON_AELockMode, /* 0xD05E */ N_("Exposure Lock")}, {PTP_DPC_NIKON_AELAFLMode, /* 0xD05F */ N_("Focus Lock")}, {PTP_DPC_NIKON_LiveViewAFFocus, /* 0xD061 */ N_("Live View AF Focus")}, {PTP_DPC_NIKON_MeterOff, /* 0xD062 */ N_("Auto Meter Off Time")}, {PTP_DPC_NIKON_SelfTimer, /* 0xD063 */ N_("Self Timer Delay")}, {PTP_DPC_NIKON_MonitorOff, /* 0xD064 */ N_("LCD Off Time")}, {PTP_DPC_NIKON_ImgConfTime, /* 0xD065 */ N_("Img Conf Time")}, {PTP_DPC_NIKON_AutoOffTimers, /* 0xD066 */ N_("Auto Off Timers")}, {PTP_DPC_NIKON_AngleLevel, /* 0xD067 */ N_("Angle Level")}, {PTP_DPC_NIKON_D1ShootingSpeed, /* 0xD068 */ N_("Shooting Speed")}, {PTP_DPC_NIKON_D2MaximumShots, /* 0xD069 */ N_("Maximum Shots")}, {PTP_DPC_NIKON_ExposureDelayMode, /* 0xD06A */ N_("Exposure delay mode")}, {PTP_DPC_NIKON_LongExposureNoiseReduction, /* 0xD06B */ N_("Long Exposure Noise Reduction")}, {PTP_DPC_NIKON_FileNumberSequence, /* 0xD06C */ N_("File Number Sequencing")}, {PTP_DPC_NIKON_ControlPanelFinderRearControl, /* 0xD06D */ "PTP_DPC_NIKON_ControlPanelFinderRearControl"}, {PTP_DPC_NIKON_ControlPanelFinderViewfinder, /* 0xD06E */ "PTP_DPC_NIKON_ControlPanelFinderViewfinder"}, {PTP_DPC_NIKON_D7Illumination, /* 0xD06F */ N_("LCD Illumination")}, {PTP_DPC_NIKON_NrHighISO, /* 0xD070 */ N_("High ISO noise reduction")}, {PTP_DPC_NIKON_SHSET_CH_GUID_DISP, /* 0xD071 */ N_("On screen tips")}, {PTP_DPC_NIKON_ArtistName, /* 0xD072 */ N_("Artist Name")}, {PTP_DPC_NIKON_CopyrightInfo, /* 0xD073 */ N_("Copyright Information")}, {PTP_DPC_NIKON_FlashSyncSpeed, /* 0xD074 */ N_("Flash Sync. Speed")}, {PTP_DPC_NIKON_FlashShutterSpeed, /* 0xD075 */ N_("Flash Shutter Speed")}, {PTP_DPC_NIKON_E3AAFlashMode, /* 0xD076 */ N_("Flash Mode")}, {PTP_DPC_NIKON_E4ModelingFlash, /* 0xD077 */ N_("Modeling Flash")}, {PTP_DPC_NIKON_BracketSet, /* 0xD078 */ N_("Bracket Set")}, {PTP_DPC_NIKON_E6ManualModeBracketing, /* 0xD079 */ N_("Manual Mode Bracketing")}, {PTP_DPC_NIKON_BracketOrder, /* 0xD07A */ N_("Bracket Order")}, {PTP_DPC_NIKON_E8AutoBracketSelection, /* 0xD07B */ N_("Auto Bracket Selection")}, {PTP_DPC_NIKON_BracketingSet, N_("NIKON Auto Bracketing Set")}, /* 0xD07C */ {PTP_DPC_NIKON_F1CenterButtonShootingMode, /* 0xD080 */ N_("Center Button Shooting Mode")}, {PTP_DPC_NIKON_CenterButtonPlaybackMode, /* 0xD081 */ N_("Center Button Playback Mode")}, {PTP_DPC_NIKON_F2Multiselector, /* 0xD082 */ N_("Multiselector")}, {PTP_DPC_NIKON_F3PhotoInfoPlayback, /* 0xD083 */ N_("Photo Info. Playback")}, {PTP_DPC_NIKON_F4AssignFuncButton, /* 0xD084 */ N_("Assign Func. Button")}, {PTP_DPC_NIKON_F5CustomizeCommDials, /* 0xD085 */ N_("Customise Command Dials")}, {PTP_DPC_NIKON_ReverseCommandDial, /* 0xD086 */ N_("Reverse Command Dial")}, {PTP_DPC_NIKON_ApertureSetting, /* 0xD087 */ N_("Aperture Setting")}, {PTP_DPC_NIKON_MenusAndPlayback, /* 0xD088 */ N_("Menus and Playback")}, {PTP_DPC_NIKON_F6ButtonsAndDials, /* 0xD089 */ N_("Buttons and Dials")}, {PTP_DPC_NIKON_NoCFCard, /* 0xD08A */ N_("No CF Card Release")}, {PTP_DPC_NIKON_CenterButtonZoomRatio, /* 0xD08B */ N_("Center Button Zoom Ratio")}, {PTP_DPC_NIKON_FunctionButton2, /* 0xD08C */ N_("Function Button 2")}, {PTP_DPC_NIKON_AFAreaPoint, /* 0xD08D */ N_("AF Area Point")}, {PTP_DPC_NIKON_NormalAFOn, /* 0xD08E */ N_("Normal AF On")}, {PTP_DPC_NIKON_CleanImageSensor, /* 0xD08F */ N_("Clean Image Sensor")}, {PTP_DPC_NIKON_ImageCommentString, /* 0xD090 */ N_("Image Comment String")}, {PTP_DPC_NIKON_ImageCommentEnable, /* 0xD091 */ N_("Image Comment Enable")}, {PTP_DPC_NIKON_ImageRotation, /* 0xD092 */ N_("Image Rotation")}, {PTP_DPC_NIKON_ManualSetLensNo, /* 0xD093 */ N_("Manual Set Lens Number")}, {PTP_DPC_NIKON_MovScreenSize, /* 0xD0A0 */ N_("Movie Screen Size")}, {PTP_DPC_NIKON_MovVoice, /* 0xD0A1 */ N_("Movie Voice")}, {PTP_DPC_NIKON_MovMicrophone, /* 0xD0A2 */ N_("Movie Microphone")}, {PTP_DPC_NIKON_MovFileSlot, /* 0xD0A3 */ N_("Movie Card Slot")}, {PTP_DPC_NIKON_ManualMovieSetting, /* 0xD0A6 */ N_("Manual Movie Setting")}, {PTP_DPC_NIKON_MonitorOffDelay, /* 0xD0B3 */ N_("Monitor Off Delay")}, {PTP_DPC_NIKON_Bracketing, /* 0xD0C0 */ N_("Bracketing Enable")}, {PTP_DPC_NIKON_AutoExposureBracketStep, /* 0xD0C1 */ N_("Exposure Bracketing Step")}, {PTP_DPC_NIKON_AutoExposureBracketProgram, /* 0xD0C2 */ N_("Exposure Bracketing Program")}, {PTP_DPC_NIKON_AutoExposureBracketCount, /* 0xD0C3 */ N_("Auto Exposure Bracket Count")}, {PTP_DPC_NIKON_WhiteBalanceBracketStep, N_("White Balance Bracket Step")}, /* 0xD0C4 */ {PTP_DPC_NIKON_WhiteBalanceBracketProgram, N_("White Balance Bracket Program")}, /* 0xD0C5 */ {PTP_DPC_NIKON_LensID, /* 0xD0E0 */ N_("Lens ID")}, {PTP_DPC_NIKON_LensSort, /* 0xD0E1 */ N_("Lens Sort")}, {PTP_DPC_NIKON_LensType, /* 0xD0E2 */ N_("Lens Type")}, {PTP_DPC_NIKON_FocalLengthMin, /* 0xD0E3 */ N_("Min. Focal Length")}, {PTP_DPC_NIKON_FocalLengthMax, /* 0xD0E4 */ N_("Max. Focal Length")}, {PTP_DPC_NIKON_MaxApAtMinFocalLength, /* 0xD0E5 */ N_("Max. Aperture at Min. Focal Length")}, {PTP_DPC_NIKON_MaxApAtMaxFocalLength, /* 0xD0E6 */ N_("Max. Aperture at Max. Focal Length")}, {PTP_DPC_NIKON_FinderISODisp, /* 0xD0F0 */ N_("Finder ISO Display")}, {PTP_DPC_NIKON_AutoOffPhoto, /* 0xD0F2 */ N_("Auto Off Photo")}, {PTP_DPC_NIKON_AutoOffMenu, /* 0xD0F3 */ N_("Auto Off Menu")}, {PTP_DPC_NIKON_AutoOffInfo, /* 0xD0F4 */ N_("Auto Off Info")}, {PTP_DPC_NIKON_SelfTimerShootNum, /* 0xD0F5 */ N_("Self Timer Shot Number")}, {PTP_DPC_NIKON_VignetteCtrl, /* 0xD0F7 */ N_("Vignette Control")}, {PTP_DPC_NIKON_AutoDistortionControl, /* 0xD0F8 */ N_("Auto Distortion Control")}, {PTP_DPC_NIKON_SceneMode, /* 0xD0F9 */ N_("Scene Mode")}, {PTP_DPC_NIKON_ExposureTime, /* 0xD100 */ N_("Nikon Exposure Time")}, {PTP_DPC_NIKON_ACPower, N_("AC Power")}, /* 0xD101 */ {PTP_DPC_NIKON_WarningStatus, N_("Warning Status")},/* 0xD102 */ {PTP_DPC_NIKON_MaximumShots, /* 0xD103 */ N_("Maximum Shots")}, {PTP_DPC_NIKON_AFLockStatus, N_("AF Locked")},/* 0xD104 */ {PTP_DPC_NIKON_AELockStatus, N_("AE Locked")},/* 0xD105 */ {PTP_DPC_NIKON_FVLockStatus, N_("FV Locked")},/* 0xD106 */ {PTP_DPC_NIKON_AutofocusLCDTopMode2, /* 0xD107 */ N_("AF LCD Top Mode 2")}, {PTP_DPC_NIKON_AutofocusArea, /* 0xD108 */ N_("Active AF Sensor")}, {PTP_DPC_NIKON_FlexibleProgram, /* 0xD109 */ N_("Flexible Program")}, {PTP_DPC_NIKON_LightMeter, /* 0xD10A */ N_("Exposure Meter")}, {PTP_DPC_NIKON_RecordingMedia, /* 0xD10B */ N_("Recording Media")}, {PTP_DPC_NIKON_USBSpeed, /* 0xD10C */ N_("USB Speed")}, {PTP_DPC_NIKON_CCDNumber, /* 0xD10D */ N_("CCD Serial Number")}, {PTP_DPC_NIKON_CameraOrientation, /* 0xD10E */ N_("Camera Orientation")}, {PTP_DPC_NIKON_GroupPtnType, /* 0xD10F */ N_("Group PTN Type")}, {PTP_DPC_NIKON_FNumberLock, /* 0xD110 */ N_("FNumber Lock")}, {PTP_DPC_NIKON_ExposureApertureLock, /* 0xD111 */ N_("Exposure Aperture Lock")}, {PTP_DPC_NIKON_TVLockSetting, /* 0xD112 */ N_("TV Lock Setting")}, {PTP_DPC_NIKON_AVLockSetting, /* 0xD113 */ N_("AV Lock Setting")}, {PTP_DPC_NIKON_IllumSetting, /* 0xD114 */ N_("Illum Setting")}, {PTP_DPC_NIKON_FocusPointBright, /* 0xD115 */ N_("Focus Point Bright")}, {PTP_DPC_NIKON_ExternalFlashAttached, /* 0xD120 */ N_("External Flash Attached")}, {PTP_DPC_NIKON_ExternalFlashStatus, /* 0xD121 */ N_("External Flash Status")}, {PTP_DPC_NIKON_ExternalFlashSort, /* 0xD122 */ N_("External Flash Sort")}, {PTP_DPC_NIKON_ExternalFlashMode, /* 0xD123 */ N_("External Flash Mode")}, {PTP_DPC_NIKON_ExternalFlashCompensation, /* 0xD124 */ N_("External Flash Compensation")}, {PTP_DPC_NIKON_NewExternalFlashMode, /* 0xD125 */ N_("External Flash Mode")}, {PTP_DPC_NIKON_FlashExposureCompensation, /* 0xD126 */ N_("Flash Exposure Compensation")}, {PTP_DPC_NIKON_HDRMode, /* 0xD130 */ N_("HDR Mode")}, {PTP_DPC_NIKON_HDRHighDynamic, /* 0xD131 */ N_("HDR High Dynamic")}, {PTP_DPC_NIKON_HDRSmoothing, /* 0xD132 */ N_("HDR Smoothing")}, {PTP_DPC_NIKON_OptimizeImage, /* 0xD140 */ N_("Optimize Image")}, {PTP_DPC_NIKON_Saturation, /* 0xD142 */ N_("Saturation")}, {PTP_DPC_NIKON_BW_FillerEffect, /* 0xD143 */ N_("BW Filler Effect")}, {PTP_DPC_NIKON_BW_Sharpness, /* 0xD144 */ N_("BW Sharpness")}, {PTP_DPC_NIKON_BW_Contrast, /* 0xD145 */ N_("BW Contrast")}, {PTP_DPC_NIKON_BW_Setting_Type, /* 0xD146 */ N_("BW Setting Type")}, {PTP_DPC_NIKON_Slot2SaveMode, /* 0xD148 */ N_("Slot 2 Save Mode")}, {PTP_DPC_NIKON_RawBitMode, /* 0xD149 */ N_("Raw Bit Mode")}, {PTP_DPC_NIKON_ActiveDLighting, /* 0xD14E */ N_("Active D-Lighting")}, {PTP_DPC_NIKON_FlourescentType, /* 0xD14F */ N_("Flourescent Type")}, {PTP_DPC_NIKON_TuneColourTemperature, /* 0xD150 */ N_("Tune Colour Temperature")}, {PTP_DPC_NIKON_TunePreset0, /* 0xD151 */ N_("Tune Preset 0")}, {PTP_DPC_NIKON_TunePreset1, /* 0xD152 */ N_("Tune Preset 1")}, {PTP_DPC_NIKON_TunePreset2, /* 0xD153 */ N_("Tune Preset 2")}, {PTP_DPC_NIKON_TunePreset3, /* 0xD154 */ N_("Tune Preset 3")}, {PTP_DPC_NIKON_TunePreset4, /* 0xD155 */ N_("Tune Preset 4")}, {PTP_DPC_NIKON_BeepOff, /* 0xD160 */ N_("AF Beep Mode")}, {PTP_DPC_NIKON_AutofocusMode, /* 0xD161 */ N_("Autofocus Mode")}, {PTP_DPC_NIKON_AFAssist, /* 0xD163 */ N_("AF Assist Lamp")}, {PTP_DPC_NIKON_PADVPMode, /* 0xD164 */ N_("Auto ISO P/A/DVP Setting")}, {PTP_DPC_NIKON_ImageReview, /* 0xD165 */ N_("Image Review")}, {PTP_DPC_NIKON_AFAreaIllumination, /* 0xD166 */ N_("AF Area Illumination")}, {PTP_DPC_NIKON_FlashMode, /* 0xD167 */ N_("Flash Mode")}, {PTP_DPC_NIKON_FlashCommanderMode, /* 0xD168 */ N_("Flash Commander Mode")}, {PTP_DPC_NIKON_FlashSign, /* 0xD169 */ N_("Flash Sign")}, {PTP_DPC_NIKON_ISO_Auto, /* 0xD16A */ N_("ISO Auto")}, {PTP_DPC_NIKON_RemoteTimeout, /* 0xD16B */ N_("Remote Timeout")}, {PTP_DPC_NIKON_GridDisplay, /* 0xD16C */ N_("Viewfinder Grid Display")}, {PTP_DPC_NIKON_FlashModeManualPower, /* 0xD16D */ N_("Flash Mode Manual Power")}, {PTP_DPC_NIKON_FlashModeCommanderPower, /* 0xD16E */ N_("Flash Mode Commander Power")}, {PTP_DPC_NIKON_AutoFP, /* 0xD16F */ N_("Auto FP")}, {PTP_DPC_NIKON_CSMMenu, /* 0xD180 */ N_("CSM Menu")}, {PTP_DPC_NIKON_WarningDisplay, /* 0xD181 */ N_("Warning Display")}, {PTP_DPC_NIKON_BatteryCellKind, /* 0xD182 */ N_("Battery Cell Kind")}, {PTP_DPC_NIKON_ISOAutoHiLimit, /* 0xD183 */ N_("ISO Auto High Limit")}, {PTP_DPC_NIKON_DynamicAFArea, /* 0xD184 */ N_("Dynamic AF Area")}, {PTP_DPC_NIKON_ContinuousSpeedHigh, /* 0xD186 */ N_("Continuous Speed High")}, {PTP_DPC_NIKON_InfoDispSetting, /* 0xD187 */ N_("Info Disp Setting")}, {PTP_DPC_NIKON_PreviewButton, /* 0xD189 */ N_("Preview Button")}, {PTP_DPC_NIKON_PreviewButton2, /* 0xD18A */ N_("Preview Button 2")}, {PTP_DPC_NIKON_AEAFLockButton2, /* 0xD18B */ N_("AEAF Lock Button 2")}, {PTP_DPC_NIKON_IndicatorDisp, /* 0xD18D */ N_("Indicator Display")}, {PTP_DPC_NIKON_CellKindPriority, /* 0xD18E */ N_("Cell Kind Priority")}, {PTP_DPC_NIKON_BracketingFramesAndSteps, /* 0xD190 */ N_("Bracketing Frames and Steps")}, {PTP_DPC_NIKON_LiveViewMode, /* 0xD1A0 */ N_("Live View Mode")}, {PTP_DPC_NIKON_LiveViewDriveMode, /* 0xD1A1 */ N_("Live View Drive Mode")}, {PTP_DPC_NIKON_LiveViewStatus, /* 0xD1A2 */ N_("Live View Status")}, {PTP_DPC_NIKON_LiveViewImageZoomRatio, /* 0xD1A3 */ N_("Live View Image Zoom Ratio")}, {PTP_DPC_NIKON_LiveViewProhibitCondition, /* 0xD1A4 */ N_("Live View Prohibit Condition")}, {PTP_DPC_NIKON_ExposureDisplayStatus, /* 0xD1B0 */ N_("Exposure Display Status")}, {PTP_DPC_NIKON_ExposureIndicateStatus, /* 0xD1B1 */ N_("Exposure Indicate Status")}, {PTP_DPC_NIKON_InfoDispErrStatus, /* 0xD1B2 */ N_("Info Display Error Status")}, {PTP_DPC_NIKON_ExposureIndicateLightup, /* 0xD1B3 */ N_("Exposure Indicate Lightup")}, {PTP_DPC_NIKON_FlashOpen, /* 0xD1C0 */ N_("Flash Open")}, {PTP_DPC_NIKON_FlashCharged, /* 0xD1C1 */ N_("Flash Charged")}, {PTP_DPC_NIKON_FlashMRepeatValue, /* 0xD1D0 */ N_("Flash MRepeat Value")}, {PTP_DPC_NIKON_FlashMRepeatCount, /* 0xD1D1 */ N_("Flash MRepeat Count")}, {PTP_DPC_NIKON_FlashMRepeatInterval, /* 0xD1D2 */ N_("Flash MRepeat Interval")}, {PTP_DPC_NIKON_FlashCommandChannel, /* 0xD1D3 */ N_("Flash Command Channel")}, {PTP_DPC_NIKON_FlashCommandSelfMode, /* 0xD1D4 */ N_("Flash Command Self Mode")}, {PTP_DPC_NIKON_FlashCommandSelfCompensation, /* 0xD1D5 */ N_("Flash Command Self Compensation")}, {PTP_DPC_NIKON_FlashCommandSelfValue, /* 0xD1D6 */ N_("Flash Command Self Value")}, {PTP_DPC_NIKON_FlashCommandAMode, /* 0xD1D7 */ N_("Flash Command A Mode")}, {PTP_DPC_NIKON_FlashCommandACompensation, /* 0xD1D8 */ N_("Flash Command A Compensation")}, {PTP_DPC_NIKON_FlashCommandAValue, /* 0xD1D9 */ N_("Flash Command A Value")}, {PTP_DPC_NIKON_FlashCommandBMode, /* 0xD1DA */ N_("Flash Command B Mode")}, {PTP_DPC_NIKON_FlashCommandBCompensation, /* 0xD1DB */ N_("Flash Command B Compensation")}, {PTP_DPC_NIKON_FlashCommandBValue, /* 0xD1DC */ N_("Flash Command B Value")}, {PTP_DPC_NIKON_ActivePicCtrlItem, /* 0xD200 */ N_("Active Pic Ctrl Item")}, {PTP_DPC_NIKON_ChangePicCtrlItem, /* 0xD201 */ N_("Change Pic Ctrl Item")}, {0,NULL} }; struct { uint16_t dpc; const char *txt; } ptp_device_properties_MTP[] = { {PTP_DPC_MTP_SecureTime, N_("Secure Time")}, /* D101 */ {PTP_DPC_MTP_DeviceCertificate, N_("Device Certificate")}, /* D102 */ {PTP_DPC_MTP_RevocationInfo, N_("Revocation Info")}, /* D103 */ {PTP_DPC_MTP_SynchronizationPartner, /* D401 */ N_("Synchronization Partner")}, {PTP_DPC_MTP_DeviceFriendlyName, /* D402 */ N_("Friendly Device Name")}, {PTP_DPC_MTP_VolumeLevel, N_("Volume Level")}, /* D403 */ {PTP_DPC_MTP_DeviceIcon, N_("Device Icon")}, /* D405 */ {PTP_DPC_MTP_SessionInitiatorInfo, N_("Session Initiator Info")},/* D406 */ {PTP_DPC_MTP_PerceivedDeviceType, N_("Perceived Device Type")},/* D407 */ {PTP_DPC_MTP_PlaybackRate, N_("Playback Rate")}, /* D410 */ {PTP_DPC_MTP_PlaybackObject, N_("Playback Object")}, /* D411 */ {PTP_DPC_MTP_PlaybackContainerIndex, /* D412 */ N_("Playback Container Index")}, {PTP_DPC_MTP_PlaybackPosition, N_("Playback Position")}, /* D413 */ {PTP_DPC_MTP_PlaysForSureID, N_("PlaysForSure ID")}, /* D131 (?) */ {0,NULL} }; struct { uint16_t dpc; const char *txt; } ptp_device_properties_FUJI[] = { {PTP_DPC_FUJI_ColorTemperature, N_("Color Temperature")}, /* 0xD017 */ {PTP_DPC_FUJI_Quality, N_("Quality")}, /* 0xD018 */ {PTP_DPC_FUJI_Quality, N_("Release Mode")}, /* 0xD201 */ {PTP_DPC_FUJI_Quality, N_("Focus Areas")}, /* 0xD206 */ {PTP_DPC_FUJI_Quality, N_("AE Lock")}, /* 0xD213 */ {PTP_DPC_FUJI_Quality, N_("Aperture")}, /* 0xD218 */ {PTP_DPC_FUJI_Quality, N_("Shutter Speed")}, /* 0xD219 */ {0,NULL} }; for (i=0; ptp_device_properties[i].txt!=NULL; i++) if (ptp_device_properties[i].dpc==dpc) return (ptp_device_properties[i].txt); if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_MICROSOFT || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP) for (i=0; ptp_device_properties_MTP[i].txt!=NULL; i++) if (ptp_device_properties_MTP[i].dpc==dpc) return (ptp_device_properties_MTP[i].txt); if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_EASTMAN_KODAK) for (i=0; ptp_device_properties_EK[i].txt!=NULL; i++) if (ptp_device_properties_EK[i].dpc==dpc) return (ptp_device_properties_EK[i].txt); if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_CANON) for (i=0; ptp_device_properties_Canon[i].txt!=NULL; i++) if (ptp_device_properties_Canon[i].dpc==dpc) return (ptp_device_properties_Canon[i].txt); if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_NIKON) for (i=0; ptp_device_properties_Nikon[i].txt!=NULL; i++) if (ptp_device_properties_Nikon[i].dpc==dpc) return (ptp_device_properties_Nikon[i].txt); if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_FUJI) for (i=0; ptp_device_properties_FUJI[i].txt!=NULL; i++) if (ptp_device_properties_FUJI[i].dpc==dpc) return (ptp_device_properties_FUJI[i].txt); return NULL; } static int64_t _value_to_num(PTPPropertyValue *data, uint16_t dt) { if (dt == PTP_DTC_STR) { if (!data->str) return 0; return atol(data->str); } if (dt & PTP_DTC_ARRAY_MASK) { return 0; } else { switch (dt) { case PTP_DTC_UNDEF: return 0; case PTP_DTC_INT8: return data->i8; case PTP_DTC_UINT8: return data->u8; case PTP_DTC_INT16: return data->i16; case PTP_DTC_UINT16: return data->u16; case PTP_DTC_INT32: return data->i32; case PTP_DTC_UINT32: return data->u32; /* PTP_DTC_INT64 PTP_DTC_UINT64 PTP_DTC_INT128 PTP_DTC_UINT128 */ default: return 0; } } return 0; } #define PTP_VAL_BOOL(dpc) {dpc, 0, N_("Off")}, {dpc, 1, N_("On")} #define PTP_VENDOR_VAL_BOOL(dpc,vendor) {dpc, vendor, 0, N_("Off")}, {dpc, vendor, 1, N_("On")} #define PTP_VENDOR_VAL_RBOOL(dpc,vendor) {dpc, vendor, 0, N_("On")}, {dpc, vendor, 1, N_("Off")} #define PTP_VENDOR_VAL_YN(dpc,vendor) {dpc, vendor, 0, N_("No")}, {dpc, vendor, 1, N_("Yes")} int ptp_render_property_value(PTPParams* params, uint16_t dpc, PTPDevicePropDesc *dpd, unsigned int length, char *out) { unsigned int i; int64_t kval; struct { uint16_t dpc; uint16_t vendor; double coef; double bias; const char *format; } ptp_value_trans[] = { {PTP_DPC_BatteryLevel, 0, 1.0, 0.0, "%.0f%%"}, /* 5001 */ {PTP_DPC_FNumber, 0, 0.01, 0.0, "f/%.2g"}, /* 5007 */ {PTP_DPC_FocalLength, 0, 0.01, 0.0, "%.0f mm"}, /* 5008 */ {PTP_DPC_FocusDistance, 0, 0.01, 0.0, "%.0f mm"}, /* 5009 */ {PTP_DPC_ExposureTime, 0, 0.00001, 0.0, "%.2g sec"}, /* 500D */ {PTP_DPC_ExposureIndex, 0, 1.0, 0.0, "ISO %.0f"}, /* 500F */ {PTP_DPC_ExposureBiasCompensation, 0, 0.001, 0.0, N_("%.1f stops")},/* 5010 */ {PTP_DPC_CaptureDelay, 0, 0.001, 0.0, "%.1fs"}, /* 5012 */ {PTP_DPC_DigitalZoom, 0, 0.1, 0.0, "%.1f"}, /* 5016 */ {PTP_DPC_BurstInterval, 0, 0.001, 0.0, "%.1fs"}, /* 5019 */ /* Nikon device properties */ {PTP_DPC_NIKON_LightMeter, PTP_VENDOR_NIKON, 0.08333, 0.0, N_("%.1f stops")},/* D10A */ {PTP_DPC_NIKON_FlashExposureCompensation, PTP_VENDOR_NIKON, 0.16666, 0.0, N_("%.1f stops")}, /* D126 */ {PTP_DPC_NIKON_CenterWeightArea, PTP_VENDOR_NIKON, 2.0, 6.0, N_("%.0f mm")},/* D059 */ {PTP_DPC_NIKON_FocalLengthMin, PTP_VENDOR_NIKON, 0.01, 0.0, "%.0f mm"}, /* D0E3 */ {PTP_DPC_NIKON_FocalLengthMax, PTP_VENDOR_NIKON, 0.01, 0.0, "%.0f mm"}, /* D0E4 */ {PTP_DPC_NIKON_MaxApAtMinFocalLength, PTP_VENDOR_NIKON, 0.01, 0.0, "f/%.2g"}, /* D0E5 */ {PTP_DPC_NIKON_MaxApAtMaxFocalLength, PTP_VENDOR_NIKON, 0.01, 0.0, "f/%.2g"}, /* D0E6 */ {PTP_DPC_NIKON_ExternalFlashCompensation, PTP_VENDOR_NIKON, 1.0/6.0, 0.0,"%.0f"}, /* D124 */ {PTP_DPC_NIKON_ExposureIndicateStatus, PTP_VENDOR_NIKON, 0.08333, 0.0, N_("%.1f stops")},/* D1B1 - FIXME: check if correct. */ {PTP_DPC_NIKON_AngleLevel, PTP_VENDOR_NIKON, 1.0/65536, 0.0, "%.1f'"},/* 0xD067 */ {0, 0, 0.0, 0.0, NULL} }; struct { uint16_t dpc; uint16_t vendor; int64_t key; char *value; } ptp_value_list[] = { {PTP_DPC_CompressionSetting, 0, 0, N_("JPEG Basic")}, /* 5004 */ {PTP_DPC_CompressionSetting, 0, 1, N_("JPEG Norm")}, {PTP_DPC_CompressionSetting, 0, 2, N_("JPEG Fine")}, {PTP_DPC_CompressionSetting, 0, 4, N_("RAW")}, {PTP_DPC_CompressionSetting, 0, 5, N_("RAW + JPEG Basic")}, {PTP_DPC_WhiteBalance, 0, 1, N_("Manual")}, {PTP_DPC_WhiteBalance, 0, 2, N_("Automatic")}, /* 5005 */ {PTP_DPC_WhiteBalance, 0, 3, N_("One-push Automatic")}, {PTP_DPC_WhiteBalance, 0, 4, N_("Daylight")}, {PTP_DPC_WhiteBalance, 0, 5, N_("Fluorescent")}, {PTP_DPC_WhiteBalance, 0, 6, N_("Incandescent")}, {PTP_DPC_WhiteBalance, 0, 7, N_("Flash")}, {PTP_DPC_WhiteBalance, PTP_VENDOR_NIKON, 32784, N_("Cloudy")}, {PTP_DPC_WhiteBalance, PTP_VENDOR_NIKON, 32785, N_("Shade")}, {PTP_DPC_WhiteBalance, PTP_VENDOR_NIKON, 32786, N_("Color Temperature")}, {PTP_DPC_WhiteBalance, PTP_VENDOR_NIKON, 32787, N_("Preset")}, {PTP_DPC_FocusMode, 0, 1, N_("Manual Focus")}, /* 500A */ {PTP_DPC_FocusMode, 0, 2, N_("Automatic")}, {PTP_DPC_FocusMode, 0, 3, N_("Automatic Macro (close-up)")}, {PTP_DPC_FocusMode, PTP_VENDOR_NIKON, 32784, "AF-S"}, {PTP_DPC_FocusMode, PTP_VENDOR_NIKON, 32785, "AF-C"}, {PTP_DPC_FocusMode, PTP_VENDOR_NIKON, 32786, "AF-A"}, {PTP_DPC_ExposureMeteringMode, 0, 1, N_("Average")}, /* 500B */ {PTP_DPC_ExposureMeteringMode, 0, 2, N_("Center Weighted Average")}, {PTP_DPC_ExposureMeteringMode, 0, 3, N_("Multi-spot")}, {PTP_DPC_ExposureMeteringMode, 0, 4, N_("Center-spot")}, {PTP_DPC_FlashMode, 0, 0, N_("Undefined")}, /* 500C */ {PTP_DPC_FlashMode, 0, 1, N_("Automatic flash")}, {PTP_DPC_FlashMode, 0, 2, N_("Flash off")}, {PTP_DPC_FlashMode, 0, 3, N_("Fill flash")}, {PTP_DPC_FlashMode, 0, 4, N_("Automatic Red-eye Reduction")}, {PTP_DPC_FlashMode, 0, 5, N_("Red-eye fill flash")}, {PTP_DPC_FlashMode, 0, 6, N_("External sync")}, {PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32784, N_("Auto")}, {PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32785, N_("Auto Slow Sync")}, {PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32786, N_("Rear Curtain Sync + Slow Sync")}, {PTP_DPC_FlashMode, PTP_VENDOR_NIKON, 32787, N_("Red-eye Reduction + Slow Sync")}, {PTP_DPC_ExposureProgramMode, 0, 1, "M"}, /* 500E */ {PTP_DPC_ExposureProgramMode, 0, 3, "A"}, {PTP_DPC_ExposureProgramMode, 0, 4, "S"}, {PTP_DPC_ExposureProgramMode, 0, 2, "P"}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32784, N_("Auto")}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32785, N_("Portrait")}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32786, N_("Landscape")}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32787, N_("Macro")}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32788, N_("Sports")}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32790, N_("Night Landscape")}, {PTP_DPC_ExposureProgramMode, PTP_VENDOR_NIKON, 32789, N_("Night Portrait")}, {PTP_DPC_StillCaptureMode, 0, 1, N_("Single Shot")}, /* 5013 */ {PTP_DPC_StillCaptureMode, 0, 2, N_("Power Wind")}, {PTP_DPC_StillCaptureMode, 0, 3, N_("Timelapse")}, {PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32784, N_("Continuous Low Speed")}, {PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32785, N_("Timer")}, {PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32787, N_("Remote")}, {PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32787, N_("Mirror Up")}, {PTP_DPC_StillCaptureMode, PTP_VENDOR_NIKON, 32788, N_("Timer + Remote")}, {PTP_DPC_FocusMeteringMode, 0, 1, N_("Centre-spot")}, /* 501C */ {PTP_DPC_FocusMeteringMode, 0, 2, N_("Multi-spot")}, {PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32784, N_("Single Area")}, {PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32785, N_("Closest Subject")}, {PTP_DPC_FocusMeteringMode, PTP_VENDOR_NIKON, 32786, N_("Group Dynamic")}, /* Nikon specific device properties */ {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* D02A */ {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 1, N_("Normal")}, {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 2, N_("Low")}, {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 3, N_("Medium Low")}, {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 4, N_("Medium high")}, {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 5, N_("High")}, {PTP_DPC_NIKON_ImageSharpening, PTP_VENDOR_NIKON, 6, N_("None")}, {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* D02B */ {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 1, N_("Normal")}, {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 2, N_("Low contrast")}, {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 3, N_("Medium Low")}, {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 4, N_("Medium High")}, {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 5, N_("High control")}, {PTP_DPC_NIKON_ToneCompensation, PTP_VENDOR_NIKON, 6, N_("Custom")}, {PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 0, "sRGB"}, /* D02C */ {PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 1, "AdobeRGB"}, {PTP_DPC_NIKON_ColorModel, PTP_VENDOR_NIKON, 2, "sRGB"}, PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_AutoDXCrop,PTP_VENDOR_NIKON), /* D033 */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_FocusAreaWrap,PTP_VENDOR_NIKON), /* D04F */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_EnableCopyright,PTP_VENDOR_NIKON), /* D053 */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ISOAuto,PTP_VENDOR_NIKON), /* D054 */ /* FIXME! this is not ISO Auto (which is a bool) Perhaps ISO Auto Time?*/ {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 0, "1/125"}, /* D054 */ {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 1, "1/60"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 2, "1/30"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 3, "1/15"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 4, "1/8"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 5, "1/4"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 6, "1/2"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 7, "1"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 8, "2"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 9, "4"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 10, "8"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 11, "15"}, {PTP_DPC_NIKON_ISOAuto, PTP_VENDOR_NIKON, 12, "30"}, {PTP_DPC_NIKON_EVStep, PTP_VENDOR_NIKON, 0, "1/3"}, /* D056 */ {PTP_DPC_NIKON_EVStep, PTP_VENDOR_NIKON, 1, "1/2"}, PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ExposureCompensation,PTP_VENDOR_NIKON),/*D058 */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_AELockMode,PTP_VENDOR_NIKON), /* D05E */ {PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 0, N_("AE/AF Lock")}, /* D05F */ {PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 1, N_("AF Lock only")}, {PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 2, N_("AE Lock only")}, {PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 3, N_("AF Lock Hold")}, {PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 4, N_("AF On")}, {PTP_DPC_NIKON_AELAFLMode, PTP_VENDOR_NIKON, 5, N_("Flash Lock")}, {PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 0, N_("4 seconds")}, /* D062 */ {PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 1, N_("6 seconds")}, {PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 2, N_("8 seconds")}, {PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 3, N_("16 seconds")}, {PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 4, N_("30 minutes")}, {PTP_DPC_NIKON_MeterOff, PTP_VENDOR_NIKON, 5, N_("30 seconds")}, {PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 0, N_("2 seconds")}, /* D063 */ {PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 1, N_("5 seconds")}, {PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 2, N_("10 seconds")}, {PTP_DPC_NIKON_SelfTimer, PTP_VENDOR_NIKON, 3, N_("20 seconds")}, {PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 0, N_("10 seconds")}, /* D064 */ {PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 1, N_("20 seconds")}, {PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 2, N_("1 minute")}, {PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 3, N_("5 minutes")}, {PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 4, N_("10 minutes")}, {PTP_DPC_NIKON_MonitorOff, PTP_VENDOR_NIKON, 5, N_("5 seconds")}, /* d80 observed */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ExposureDelayMode,PTP_VENDOR_NIKON), /* D06A */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_LongExposureNoiseReduction,PTP_VENDOR_NIKON), /* D06B */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_FileNumberSequence,PTP_VENDOR_NIKON), /* D06C */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_D7Illumination,PTP_VENDOR_NIKON), /* D06F */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_SHSET_CH_GUID_DISP,PTP_VENDOR_NIKON), /* D071 */ {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 0, "1/60s"}, /* D075 */ {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 1, "1/30s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 2, "1/15s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 3, "1/8s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 4, "1/4s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 5, "1/2s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 6, "1s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 7, "2s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 8, "4s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 9, "8s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 10, "15s"}, {PTP_DPC_NIKON_FlashShutterSpeed, PTP_VENDOR_NIKON, 11, "30s"}, PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_E4ModelingFlash,PTP_VENDOR_NIKON), /* D077 */ {PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 0, N_("AE & Flash")}, /* D078 */ {PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 1, N_("AE only")}, {PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 2, N_("Flash only")}, {PTP_DPC_NIKON_BracketSet, PTP_VENDOR_NIKON, 3, N_("WB bracketing")}, {PTP_DPC_NIKON_BracketOrder, PTP_VENDOR_NIKON, 0, N_("MTR > Under")}, /* D07A */ {PTP_DPC_NIKON_BracketOrder, PTP_VENDOR_NIKON, 1, N_("Under > MTR")}, {PTP_DPC_NIKON_F1CenterButtonShootingMode, PTP_VENDOR_NIKON, 0, N_("Reset focus point to center")}, /* D080 */ {PTP_DPC_NIKON_F1CenterButtonShootingMode, PTP_VENDOR_NIKON, 1, N_("Highlight active focus point")}, {PTP_DPC_NIKON_F1CenterButtonShootingMode, PTP_VENDOR_NIKON, 2, N_("Unused")}, PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_F3PhotoInfoPlayback,PTP_VENDOR_NIKON),/* D083 */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_F5CustomizeCommDials,PTP_VENDOR_NIKON),/* D085 */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ReverseCommandDial,PTP_VENDOR_NIKON), /* D086 */ PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_F6ButtonsAndDials,PTP_VENDOR_NIKON), /* D089 */ PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_NoCFCard,PTP_VENDOR_NIKON), /* D08A */ PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_AFAreaPoint,PTP_VENDOR_NIKON), /* D08D */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_ImageCommentEnable,PTP_VENDOR_NIKON), /* D091 */ PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_ImageRotation,PTP_VENDOR_NIKON), /* D092 */ PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_MovVoice,PTP_VENDOR_NIKON), /* D0A1 */ PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_Bracketing,PTP_VENDOR_NIKON), /* D0C0 */ /* http://www.rottmerhusen.com/objektives/lensid/nikkor.html is complete */ {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 0, N_("Unknown")}, /* D0E0 */ {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 38, "Sigma 70-300mm 1:4-5.6 D APO Macro"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 83, "AF Nikkor 80-200mm 1:2.8 D ED"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 118, "AF Nikkor 50mm 1:1.8 D"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 127, "AF-S Nikkor 18-70mm 1:3.5-4.5G ED DX"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 139, "AF-S Nikkor 18-200mm 1:3.5-5.6 GED DX VR"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 147, "AF-S Nikkor 24-70mm 1:2.8G ED DX"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 154, "AF-S Nikkor 18-55mm 1:3.5-F5.6G DX VR"}, {PTP_DPC_NIKON_LensID, PTP_VENDOR_NIKON, 159, "AF-S Nikkor 35mm 1:1.8G DX"}, {PTP_DPC_NIKON_FinderISODisp, PTP_VENDOR_NIKON, 0, "Show ISO sensitivity"},/* 0xD0F0 */ {PTP_DPC_NIKON_FinderISODisp, PTP_VENDOR_NIKON, 1, "Show ISO/Easy ISO"}, {PTP_DPC_NIKON_FinderISODisp, PTP_VENDOR_NIKON, 2, "Show frame count"}, {PTP_DPC_NIKON_RawCompression, PTP_VENDOR_NIKON, 0, N_("Lossless")}, /* D016 */ {PTP_DPC_NIKON_RawCompression, PTP_VENDOR_NIKON, 1, N_("Lossy")}, PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ACPower,PTP_VENDOR_NIKON), /* D101 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AFLockStatus,PTP_VENDOR_NIKON), /* D104 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AELockStatus,PTP_VENDOR_NIKON), /* D105 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FVLockStatus,PTP_VENDOR_NIKON), /* D106 */ {PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 0, N_("Centre")}, /* D108 */ {PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 1, N_("Top")}, {PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 2, N_("Bottom")}, {PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 3, N_("Left")}, {PTP_DPC_NIKON_AutofocusArea, PTP_VENDOR_NIKON, 4, N_("Right")}, {PTP_DPC_NIKON_RecordingMedia, PTP_VENDOR_NIKON, 0, N_("Card")}, /* D10B */ {PTP_DPC_NIKON_RecordingMedia, PTP_VENDOR_NIKON, 1, N_("SDRam")}, {PTP_DPC_NIKON_USBSpeed, PTP_VENDOR_NIKON, 0, N_("USB 1.1")}, /* D10C */ {PTP_DPC_NIKON_USBSpeed, PTP_VENDOR_NIKON, 1, N_("USB 2.0")}, {PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 0, "0'"}, /* D10E */ {PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 1, "270'"}, {PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 2, "90'"}, {PTP_DPC_NIKON_CameraOrientation, PTP_VENDOR_NIKON, 3, "180'"}, PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FNumberLock,PTP_VENDOR_NIKON), /* D110 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExposureApertureLock,PTP_VENDOR_NIKON), /* D111 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_TVLockSetting,PTP_VENDOR_NIKON), /* D112 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_AVLockSetting,PTP_VENDOR_NIKON), /* D113 */ {PTP_DPC_NIKON_IllumSetting,PTP_VENDOR_NIKON,0,N_("LCD Backlight")}, /* D114 */ {PTP_DPC_NIKON_IllumSetting,PTP_VENDOR_NIKON,1,N_("LCD Backlight and Info Display")}, PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExternalFlashAttached,PTP_VENDOR_NIKON),/* D120 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExternalFlashStatus,PTP_VENDOR_NIKON), /* D121 */ {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 0, N_("Normal")}, /* D140 */ {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 1, N_("Vivid")}, {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 2, N_("Sharper")}, {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 3, N_("Softer")}, {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 4, N_("Direct Print")}, {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 5, N_("Portrait")}, {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 6, N_("Landscape")}, {PTP_DPC_NIKON_OptimizeImage, PTP_VENDOR_NIKON, 7, N_("Custom")}, {PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 0, N_("Normal")}, /* D142 */ {PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 1, N_("Moderate")}, {PTP_DPC_NIKON_Saturation, PTP_VENDOR_NIKON, 2, N_("Enhanced")}, PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_BeepOff,PTP_VENDOR_NIKON), /* D160 */ {PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 0, N_("AF-S")}, /* D161 */ {PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 1, N_("AF-C")}, {PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 2, N_("AF-A")}, {PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 3, N_("MF (fixed)")}, {PTP_DPC_NIKON_AutofocusMode, PTP_VENDOR_NIKON, 4, N_("MF (selection)")}, PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_AFAssist,PTP_VENDOR_NIKON), /* D163 */ {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 0, "1/125"}, /* D164 */ {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 1, "1/60"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 2, "1/30"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 3, "1/15"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 4, "1/8"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 5, "1/4"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 6, "1/2"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 7, "1"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 8, "2"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 9, "4"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 10, "8"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 11, "15"}, {PTP_DPC_NIKON_PADVPMode, PTP_VENDOR_NIKON, 12, "30"}, PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_ImageReview,PTP_VENDOR_NIKON), /* D165 */ {PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* D166 */ {PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 1, N_("Off")}, {PTP_DPC_NIKON_AFAreaIllumination, PTP_VENDOR_NIKON, 2, N_("On")}, {PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 0, "iTTL"}, /* D167 */ {PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 1, N_("Manual")}, {PTP_DPC_NIKON_FlashMode, PTP_VENDOR_NIKON, 2, N_("Commander")}, {PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 0, N_("TTL")}, /* D168 */ {PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 1, N_("Auto Aperture")}, {PTP_DPC_NIKON_FlashCommanderMode, PTP_VENDOR_NIKON, 2, N_("Full Manual")}, PTP_VENDOR_VAL_RBOOL(PTP_DPC_NIKON_FlashSign,PTP_VENDOR_NIKON), /* D169 */ {PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 0, N_("1 min")}, /* D16B */ {PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 1, N_("5 mins")}, {PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 2, N_("10 mins")}, {PTP_DPC_NIKON_RemoteTimeout, PTP_VENDOR_NIKON, 3, N_("15 mins")}, PTP_VENDOR_VAL_BOOL(PTP_DPC_NIKON_GridDisplay,PTP_VENDOR_NIKON), /* D16C */ {PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 0, N_("Full")}, /* D16D */ {PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 1, "1/2"}, {PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 2, "1/4"}, {PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 3, "1/8"}, {PTP_DPC_NIKON_FlashModeManualPower, PTP_VENDOR_NIKON, 4, "1/16"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 0, N_("Full")},/* D16E */ {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 1, "1/2"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 2, "1/4"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 3, "1/8"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 4, "1/16"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 5, "1/32"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 6, "1/64"}, {PTP_DPC_NIKON_FlashModeCommanderPower, PTP_VENDOR_NIKON, 7, "1/128"}, PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_CSMMenu,PTP_VENDOR_NIKON), /* D180 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_WarningDisplay,PTP_VENDOR_NIKON), /* D181 */ {PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 0, "LR6 (AA alkaline)"},/* D182 */ {PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 1, "HR6 (AA Ni-Mh)"}, {PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 2, "FR6 (AA Lithium)"}, {PTP_DPC_NIKON_BatteryCellKind, PTP_VENDOR_NIKON, 3, "ZR6 (AA Ni-Mn)"}, {PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 0, "400"}, /* D183 */ {PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 1, "800"}, {PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 2, "1600"}, {PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 3, "3200"}, {PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 4, "Hi 1"}, {PTP_DPC_NIKON_ISOAutoHiLimit, PTP_VENDOR_NIKON, 5, "Hi 2"}, {PTP_DPC_NIKON_InfoDispSetting, PTP_VENDOR_NIKON, 0, N_("Auto")}, /* 0xD187 */ {PTP_DPC_NIKON_InfoDispSetting, PTP_VENDOR_NIKON, 1, N_("Dark on light")}, {PTP_DPC_NIKON_InfoDispSetting, PTP_VENDOR_NIKON, 2, N_("Light on dark")}, PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_IndicatorDisp,PTP_VENDOR_NIKON), /* D18D */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_LiveViewStatus,PTP_VENDOR_NIKON), /* D1A2 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExposureDisplayStatus,PTP_VENDOR_NIKON),/* D1B0 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_InfoDispErrStatus,PTP_VENDOR_NIKON), /* D1B2 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ExposureIndicateLightup,PTP_VENDOR_NIKON),/* D1B3 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FlashOpen,PTP_VENDOR_NIKON), /* D1C0 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_FlashCharged,PTP_VENDOR_NIKON), /* D1C1 */ PTP_VENDOR_VAL_YN(PTP_DPC_NIKON_ManualMovieSetting,PTP_VENDOR_NIKON), /* 0xD0A6 */ {PTP_DPC_NIKON_FlickerReduction, PTP_VENDOR_NIKON, 0, "50Hz"}, /* 0xD034 */ {PTP_DPC_NIKON_FlickerReduction, PTP_VENDOR_NIKON, 1, "60Hz"}, {PTP_DPC_NIKON_RemoteMode, PTP_VENDOR_NIKON, 0, N_("Delayed Remote")}, /* 0xD035 */ {PTP_DPC_NIKON_RemoteMode, PTP_VENDOR_NIKON, 1, N_("Quick Response")}, /* 0xD035 */ {PTP_DPC_NIKON_RemoteMode, PTP_VENDOR_NIKON, 2, N_("Remote Mirror Up")},/* 0xD035 */ {PTP_DPC_NIKON_MonitorOffDelay, PTP_VENDOR_NIKON, 0, "5min"}, /* 0xD0b3 */ {PTP_DPC_NIKON_MonitorOffDelay, PTP_VENDOR_NIKON, 1, "10min"}, /* 0xD0b3 */ {PTP_DPC_NIKON_MonitorOffDelay, PTP_VENDOR_NIKON, 2, "15min"}, /* 0xD0b3 */ {PTP_DPC_NIKON_MonitorOffDelay, PTP_VENDOR_NIKON, 3, "20min"}, /* 0xD0b3 */ {PTP_DPC_NIKON_MonitorOffDelay, PTP_VENDOR_NIKON, 4, "30min"}, /* 0xD0b3 */ /* Canon stuff */ PTP_VENDOR_VAL_BOOL(PTP_DPC_CANON_AssistLight,PTP_VENDOR_CANON), PTP_VENDOR_VAL_RBOOL(PTP_DPC_CANON_RotationScene,PTP_VENDOR_CANON), PTP_VENDOR_VAL_RBOOL(PTP_DPC_CANON_BeepMode,PTP_VENDOR_CANON), PTP_VENDOR_VAL_BOOL(PTP_DPC_CANON_Beep,PTP_VENDOR_CANON), {PTP_DPC_CANON_RotationAngle, PTP_VENDOR_CANON, 0, "0'"}, {PTP_DPC_CANON_RotationAngle, PTP_VENDOR_CANON, 3, "270'"}, {PTP_DPC_CANON_RotationAngle, PTP_VENDOR_CANON, 1, "90'"}, {PTP_DPC_CANON_BatteryKind, PTP_VENDOR_CANON, 0, N_("Unknown")}, {PTP_DPC_CANON_BatteryKind, PTP_VENDOR_CANON, 1, N_("AC")}, {PTP_DPC_CANON_BatteryKind, PTP_VENDOR_CANON, 2, N_("Lithium Ion")}, {PTP_DPC_CANON_BatteryKind, PTP_VENDOR_CANON, 3, N_("Nickel hydride")}, {PTP_DPC_CANON_BatteryKind, PTP_VENDOR_CANON, 4, N_("Nickel cadmium")}, {PTP_DPC_CANON_BatteryKind, PTP_VENDOR_CANON, 5, N_("Alkalium manganese")}, {PTP_DPC_CANON_BatteryStatus, PTP_VENDOR_CANON, 0, N_("Undefined")}, {PTP_DPC_CANON_BatteryStatus, PTP_VENDOR_CANON, 1, N_("Normal")}, {PTP_DPC_CANON_BatteryStatus, PTP_VENDOR_CANON, 2, N_("Warning Level 1")}, {PTP_DPC_CANON_BatteryStatus, PTP_VENDOR_CANON, 3, N_("Emergency")}, {PTP_DPC_CANON_BatteryStatus, PTP_VENDOR_CANON, 4, N_("Warning Level 0")}, {PTP_DPC_CANON_ImageQuality, PTP_VENDOR_CANON, 0, N_("Undefined")}, {PTP_DPC_CANON_ImageQuality, PTP_VENDOR_CANON, 1, N_("Economy")}, {PTP_DPC_CANON_ImageQuality, PTP_VENDOR_CANON, 2, N_("Normal")}, {PTP_DPC_CANON_ImageQuality, PTP_VENDOR_CANON, 3, N_("Fine")}, {PTP_DPC_CANON_ImageQuality, PTP_VENDOR_CANON, 4, N_("Lossless")}, {PTP_DPC_CANON_ImageQuality, PTP_VENDOR_CANON, 5, N_("SuperFine")}, {PTP_DPC_CANON_FullViewFileFormat, PTP_VENDOR_CANON, 0, N_("Undefined")}, {PTP_DPC_CANON_FullViewFileFormat, PTP_VENDOR_CANON, 1, N_("JPEG")}, {PTP_DPC_CANON_FullViewFileFormat, PTP_VENDOR_CANON, 2, N_("CRW")}, {PTP_DPC_CANON_ImageSize, PTP_VENDOR_CANON, 0, N_("Large")}, {PTP_DPC_CANON_ImageSize, PTP_VENDOR_CANON, 1, N_("Medium 1")}, {PTP_DPC_CANON_ImageSize, PTP_VENDOR_CANON, 2, N_("Small")}, {PTP_DPC_CANON_ImageSize, PTP_VENDOR_CANON, 3, N_("Medium 2")}, {PTP_DPC_CANON_ImageSize, PTP_VENDOR_CANON, 7, N_("Medium 3")}, {PTP_DPC_CANON_SelfTime, PTP_VENDOR_CANON, 0, N_("Not used")}, {PTP_DPC_CANON_SelfTime, PTP_VENDOR_CANON, 100, N_("10 seconds")}, {PTP_DPC_CANON_SelfTime, PTP_VENDOR_CANON, 20, N_("2 seconds")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 0, N_("Off")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 1, N_("Auto")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 2, N_("On")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 3, N_("Red Eye Suppression")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 4, N_("Low Speed Synchronization")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 5, N_("Auto + Red Eye Suppression")}, {PTP_DPC_CANON_FlashMode, PTP_VENDOR_CANON, 6, N_("On + Red Eye Suppression")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 0, N_("Auto")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 1, N_("P")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 2, N_("Tv")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 3, N_("Av")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 4, N_("M")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 5, N_("A_DEP")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 6, N_("M_DEP")}, {PTP_DPC_CANON_ShootingMode, PTP_VENDOR_CANON, 7, N_("Bulb")}, /* more actually */ {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 0, N_("Auto")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 1, N_("Manual")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 2, N_("Distant View")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 3, N_("High-Speed Shutter")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 4, N_("Low-Speed Shutter")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 5, N_("Night View")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 6, N_("Grayscale")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 7, N_("Sepia")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 8, N_("Portrait")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 9, N_("Sports")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 10, N_("Macro")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 11, N_("Monochrome")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 12, N_("Pan Focus")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 13, N_("Neutral")}, {PTP_DPC_CANON_ImageMode, PTP_VENDOR_CANON, 14, N_("Soft")}, {PTP_DPC_CANON_DriveMode, PTP_VENDOR_CANON, 0, N_("Single-Frame Shooting")}, {PTP_DPC_CANON_DriveMode, PTP_VENDOR_CANON, 1, N_("Continuous Shooting")}, {PTP_DPC_CANON_DriveMode, PTP_VENDOR_CANON, 2, N_("Timer (Single) Shooting")}, {PTP_DPC_CANON_DriveMode, PTP_VENDOR_CANON, 4, N_("Continuous Low-speed Shooting")}, {PTP_DPC_CANON_DriveMode, PTP_VENDOR_CANON, 5, N_("Continuous High-speed Shooting")}, {PTP_DPC_CANON_EZoom, PTP_VENDOR_CANON, 0, N_("Off")}, {PTP_DPC_CANON_EZoom, PTP_VENDOR_CANON, 1, N_("2x")}, {PTP_DPC_CANON_EZoom, PTP_VENDOR_CANON, 2, N_("4x")}, {PTP_DPC_CANON_EZoom, PTP_VENDOR_CANON, 3, N_("Smooth")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 0, N_("Center-weighted Metering")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 1, N_("Spot Metering")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 2, N_("Average Metering")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 3, N_("Evaluative Metering")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 4, N_("Partial Metering")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 5, N_("Center-weighted Average Metering")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 6, N_("Spot Metering Interlocked with AF Frame")}, {PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, 7, N_("Multi-Spot Metering")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 0, N_("Manual")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 1, N_("Auto")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 2, N_("Unknown")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 3, N_("Zone Focus (Close-up)")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 4, N_("Zone Focus (Very Close)")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 5, N_("Zone Focus (Close)")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 6, N_("Zone Focus (Medium)")}, {PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, 7, N_("Zone Focus (Far)")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0, N_("Invalid")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x1000, N_("Focusing Point on Center Only, Manual")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x1001, N_("Focusing Point on Center Only, Auto")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x3000, N_("Multiple Focusing Points (No Specification), Manual")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x3001, N_("Multiple Focusing Points, Auto")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x3002, N_("Multiple Focusing Points (Right)")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x3003, N_("Multiple Focusing Points (Center)")}, {PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, 0x3004, N_("Multiple Focusing Points (Left)")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 0, N_("Auto")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 1, N_("Daylight")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 2, N_("Cloudy")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 3, N_("Tungsten")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 4, N_("Fluorescent")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 6, N_("Preset")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 7, N_("Fluorescent H")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 9, N_("Color Temperature")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 10, N_("Custom Whitebalance PC-1")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 11, N_("Custom Whitebalance PC-2")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 12, N_("Custom Whitebalance PC-3")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 13, N_("Missing Number")}, {PTP_DPC_CANON_WhiteBalance, PTP_VENDOR_CANON, 14, N_("Fluorescent H")}, /* dup? */ {PTP_DPC_CANON_SlowShutterSetting, PTP_VENDOR_CANON, 0, N_("Off")}, {PTP_DPC_CANON_SlowShutterSetting, PTP_VENDOR_CANON, 1, N_("Night View")}, {PTP_DPC_CANON_SlowShutterSetting, PTP_VENDOR_CANON, 2, N_("On")}, {PTP_DPC_CANON_SlowShutterSetting, PTP_VENDOR_CANON, 3, N_("Low-speed shutter function not available")}, {PTP_DPC_CANON_AFMode, PTP_VENDOR_CANON, 0, N_("Single Shot")}, {PTP_DPC_CANON_AFMode, PTP_VENDOR_CANON, 1, N_("AI Servo")}, {PTP_DPC_CANON_AFMode, PTP_VENDOR_CANON, 2, N_("AI Focus")}, {PTP_DPC_CANON_AFMode, PTP_VENDOR_CANON, 3, N_("Manual")}, {PTP_DPC_CANON_AFMode, PTP_VENDOR_CANON, 4, N_("Continuous")}, PTP_VENDOR_VAL_BOOL(PTP_DPC_CANON_ImageStabilization,PTP_VENDOR_CANON), {PTP_DPC_CANON_Contrast, PTP_VENDOR_CANON, -2, N_("Low 2")}, {PTP_DPC_CANON_Contrast, PTP_VENDOR_CANON, -1, N_("Low")}, {PTP_DPC_CANON_Contrast, PTP_VENDOR_CANON, 0, N_("Standard")}, {PTP_DPC_CANON_Contrast, PTP_VENDOR_CANON, 1, N_("High")}, {PTP_DPC_CANON_Contrast, PTP_VENDOR_CANON, 2, N_("High 2")}, {PTP_DPC_CANON_ColorGain, PTP_VENDOR_CANON, -2, N_("Low 2")}, {PTP_DPC_CANON_ColorGain, PTP_VENDOR_CANON, -1, N_("Low")}, {PTP_DPC_CANON_ColorGain, PTP_VENDOR_CANON, 0, N_("Standard")}, {PTP_DPC_CANON_ColorGain, PTP_VENDOR_CANON, 1, N_("High")}, {PTP_DPC_CANON_ColorGain, PTP_VENDOR_CANON, 2, N_("High 2")}, {PTP_DPC_CANON_Sharpness, PTP_VENDOR_CANON, -2, N_("Low 2")}, {PTP_DPC_CANON_Sharpness, PTP_VENDOR_CANON, -1, N_("Low")}, {PTP_DPC_CANON_Sharpness, PTP_VENDOR_CANON, 0, N_("Standard")}, {PTP_DPC_CANON_Sharpness, PTP_VENDOR_CANON, 1, N_("High")}, {PTP_DPC_CANON_Sharpness, PTP_VENDOR_CANON, 2, N_("High 2")}, {PTP_DPC_CANON_Sensitivity, PTP_VENDOR_CANON, 0, N_("Standard")}, {PTP_DPC_CANON_Sensitivity, PTP_VENDOR_CANON, 1, N_("Upper 1")}, {PTP_DPC_CANON_Sensitivity, PTP_VENDOR_CANON, 2, N_("Upper 2")}, {PTP_DPC_CANON_ParameterSet, PTP_VENDOR_CANON, 0x08, N_("Standard Development Parameters")}, {PTP_DPC_CANON_ParameterSet, PTP_VENDOR_CANON, 0x10, N_("Development Parameters 1")}, {PTP_DPC_CANON_ParameterSet, PTP_VENDOR_CANON, 0x20, N_("Development Parameters 2")}, {PTP_DPC_CANON_ParameterSet, PTP_VENDOR_CANON, 0x40, N_("Development Parameters 3")}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x00, N_("Auto")}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x28, "6"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x30, "12"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x38, "25"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x40, "50"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x43, "64"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x48, "100"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x50, "200"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x58, "400"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x60, "800"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x68, "1600"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x70, "3200"}, {PTP_DPC_CANON_ISOSpeed, PTP_VENDOR_CANON, 0x78, "6400"}, /* 0xd01d - PTP_DPC_CANON_Aperture */ /* 0xd01e - PTP_DPC_CANON_ShutterSpeed */ /* 0xd01f - PTP_DPC_CANON_ExpCompensation */ /* 0xd020 - PTP_DPC_CANON_FlashCompensation */ /* 0xd021 - PTP_DPC_CANON_AEBExposureCompensation */ /* 0xd023 - PTP_DPC_CANON_AvOpen */ /* 0xd024 - PTP_DPC_CANON_AvMax */ {PTP_DPC_CANON_CameraOutput, PTP_VENDOR_CANON, 0, N_("Undefined")}, {PTP_DPC_CANON_CameraOutput, PTP_VENDOR_CANON, 1, N_("LCD")}, {PTP_DPC_CANON_CameraOutput, PTP_VENDOR_CANON, 2, N_("Video OUT")}, {PTP_DPC_CANON_CameraOutput, PTP_VENDOR_CANON, 3, N_("Off")}, {PTP_DPC_CANON_MlSpotPos, PTP_VENDOR_CANON, 0, N_("MlSpotPosCenter")}, {PTP_DPC_CANON_MlSpotPos, PTP_VENDOR_CANON, 1, N_("MlSpotPosAfLink")}, {PTP_DPC_CANON_PhotoEffect, PTP_VENDOR_CANON, 0, N_("Off")}, {PTP_DPC_CANON_PhotoEffect, PTP_VENDOR_CANON, 1, N_("Vivid")}, {PTP_DPC_CANON_PhotoEffect, PTP_VENDOR_CANON, 2, N_("Neutral")}, {PTP_DPC_CANON_PhotoEffect, PTP_VENDOR_CANON, 3, N_("Soft")}, {PTP_DPC_CANON_PhotoEffect, PTP_VENDOR_CANON, 4, N_("Sepia")}, {PTP_DPC_CANON_PhotoEffect, PTP_VENDOR_CANON, 5, N_("Monochrome")}, {0, 0, 0, NULL} }; for (i=0; ptp_value_trans[i].dpc!=0; i++) { if ((ptp_value_trans[i].dpc == dpc) && (((ptp_value_trans[i].dpc & 0xf000) == 0x5000) || (ptp_value_trans[i].vendor == params->deviceinfo.VendorExtensionID)) ) { double value = _value_to_num(&(dpd->CurrentValue), dpd->DataType); return snprintf(out, length, _(ptp_value_trans[i].format), value * ptp_value_trans[i].coef + ptp_value_trans[i].bias); } } kval = _value_to_num(&(dpd->CurrentValue), dpd->DataType); for (i=0; ptp_value_list[i].dpc!=0; i++) { if ((ptp_value_list[i].dpc == dpc) && (((ptp_value_list[i].dpc & 0xf000) == 0x5000) || (ptp_value_list[i].vendor == params->deviceinfo.VendorExtensionID)) && (ptp_value_list[i].key==kval) ) { return snprintf(out, length, "%s", _(ptp_value_list[i].value)); } } if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_MICROSOFT || params->deviceinfo.VendorExtensionID==PTP_VENDOR_MTP) { switch (dpc) { case PTP_DPC_MTP_SynchronizationPartner: case PTP_DPC_MTP_DeviceFriendlyName: return snprintf(out, length, "%s", dpd->CurrentValue.str); case PTP_DPC_MTP_SecureTime: case PTP_DPC_MTP_DeviceCertificate: { /* FIXME: Convert to use unicode demux functions */ for (i=0;(iCurrentValue.a.count) && (iCurrentValue.a.v[i].u16; if ( dpd->CurrentValue.a.count && (dpd->CurrentValue.a.count < length)) { out[dpd->CurrentValue.a.count-1] = 0; return dpd->CurrentValue.a.count-1; } else { out[length-1] = 0; return length; } break; } default: break; } } return 0; } struct { uint16_t ofc; const char *format; } ptp_ofc_trans[] = { {PTP_OFC_Undefined,"Undefined Type"}, {PTP_OFC_Defined,"Defined Type"}, {PTP_OFC_Association,"Association/Directory"}, {PTP_OFC_Script,"Script"}, {PTP_OFC_Executable,"Executable"}, {PTP_OFC_Text,"Text"}, {PTP_OFC_HTML,"HTML"}, {PTP_OFC_DPOF,"DPOF"}, {PTP_OFC_AIFF,"AIFF"}, {PTP_OFC_WAV,"MS Wave"}, {PTP_OFC_MP3,"MP3"}, {PTP_OFC_AVI,"MS AVI"}, {PTP_OFC_MPEG,"MPEG"}, {PTP_OFC_ASF,"ASF"}, {PTP_OFC_QT,"Apple Quicktime"}, {PTP_OFC_EXIF_JPEG,"JPEG"}, {PTP_OFC_TIFF_EP,"TIFF EP"}, {PTP_OFC_FlashPix,"FlashPix"}, {PTP_OFC_BMP,"BMP"}, {PTP_OFC_CIFF,"CIFF"}, {PTP_OFC_GIF,"GIF"}, {PTP_OFC_JFIF,"JFIF"}, {PTP_OFC_PCD,"PCD"}, {PTP_OFC_PICT,"PICT"}, {PTP_OFC_PNG,"PNG"}, {PTP_OFC_TIFF,"TIFF"}, {PTP_OFC_TIFF_IT,"TIFF_IT"}, {PTP_OFC_JP2,"JP2"}, {PTP_OFC_JPX,"JPX"}, {PTP_OFC_DNG,"DNG"}, }; struct { uint16_t ofc; const char *format; } ptp_ofc_mtp_trans[] = { {PTP_OFC_MTP_MediaCard,N_("Media Card")}, {PTP_OFC_MTP_MediaCardGroup,N_("Media Card Group")}, {PTP_OFC_MTP_Encounter,N_("Encounter")}, {PTP_OFC_MTP_EncounterBox,N_("Encounter Box")}, {PTP_OFC_MTP_M4A,N_("M4A")}, {PTP_OFC_MTP_Firmware,N_("Firmware")}, {PTP_OFC_MTP_WindowsImageFormat,N_("Windows Image Format")}, {PTP_OFC_MTP_UndefinedAudio,N_("Undefined Audio")}, {PTP_OFC_MTP_WMA,"WMA"}, {PTP_OFC_MTP_OGG,"OGG"}, {PTP_OFC_MTP_AAC,"AAC"}, {PTP_OFC_MTP_AudibleCodec,N_("Audible.com Codec")}, {PTP_OFC_MTP_FLAC,"FLAC"}, {PTP_OFC_MTP_SamsungPlaylist,N_("Samsung Playlist")}, {PTP_OFC_MTP_UndefinedVideo,N_("Undefined Video")}, {PTP_OFC_MTP_WMV,"WMV"}, {PTP_OFC_MTP_MP4,"MP4"}, {PTP_OFC_MTP_MP2,"MP2"}, {PTP_OFC_MTP_3GP,"3GP"}, {PTP_OFC_MTP_UndefinedCollection,N_("Undefined Collection")}, {PTP_OFC_MTP_AbstractMultimediaAlbum,N_("Abstract Multimedia Album")}, {PTP_OFC_MTP_AbstractImageAlbum,N_("Abstract Image Album")}, {PTP_OFC_MTP_AbstractAudioAlbum,N_("Abstract Audio Album")}, {PTP_OFC_MTP_AbstractVideoAlbum,N_("Abstract Video Album")}, {PTP_OFC_MTP_AbstractAudioVideoPlaylist,N_("Abstract Audio Video Playlist")}, {PTP_OFC_MTP_AbstractContactGroup,N_("Abstract Contact Group")}, {PTP_OFC_MTP_AbstractMessageFolder,N_("Abstract Message Folder")}, {PTP_OFC_MTP_AbstractChapteredProduction,N_("Abstract Chaptered Production")}, {PTP_OFC_MTP_AbstractAudioPlaylist,N_("Abstract Audio Playlist")}, {PTP_OFC_MTP_AbstractVideoPlaylist,N_("Abstract Video Playlist")}, {PTP_OFC_MTP_AbstractMediacast,N_("Abstract Mediacast")}, {PTP_OFC_MTP_WPLPlaylist,N_("WPL Playlist")}, {PTP_OFC_MTP_M3UPlaylist,N_("M3U Playlist")}, {PTP_OFC_MTP_MPLPlaylist,N_("MPL Playlist")}, {PTP_OFC_MTP_ASXPlaylist,N_("ASX Playlist")}, {PTP_OFC_MTP_PLSPlaylist,N_("PLS Playlist")}, {PTP_OFC_MTP_UndefinedDocument,N_("Undefined Document")}, {PTP_OFC_MTP_AbstractDocument,N_("Abstract Document")}, {PTP_OFC_MTP_XMLDocument,N_("XMLDocument")}, {PTP_OFC_MTP_MSWordDocument,N_("Microsoft Word Document")}, {PTP_OFC_MTP_MHTCompiledHTMLDocument,N_("MHT Compiled HTML Document")}, {PTP_OFC_MTP_MSExcelSpreadsheetXLS,N_("Microsoft Excel Spreadsheet (.xls)")}, {PTP_OFC_MTP_MSPowerpointPresentationPPT,N_("Microsoft Powerpoint (.ppt)")}, {PTP_OFC_MTP_UndefinedMessage,N_("Undefined Message")}, {PTP_OFC_MTP_AbstractMessage,N_("Abstract Message")}, {PTP_OFC_MTP_UndefinedContact,N_("Undefined Contact")}, {PTP_OFC_MTP_AbstractContact,N_("Abstract Contact")}, {PTP_OFC_MTP_vCard2,N_("vCard2")}, {PTP_OFC_MTP_vCard3,N_("vCard3")}, {PTP_OFC_MTP_UndefinedCalendarItem,N_("Undefined Calendar Item")}, {PTP_OFC_MTP_AbstractCalendarItem,N_("Abstract Calendar Item")}, {PTP_OFC_MTP_vCalendar1,N_("vCalendar1")}, {PTP_OFC_MTP_vCalendar2,N_("vCalendar2")}, {PTP_OFC_MTP_UndefinedWindowsExecutable,N_("Undefined Windows Executable")}, {PTP_OFC_MTP_MediaCast,N_("Media Cast")}, {PTP_OFC_MTP_Section,N_("Section")}, }; int ptp_render_ofc(PTPParams* params, uint16_t ofc, int spaceleft, char *txt) { unsigned int i; if (!(ofc & 0x8000)) { for (i=0;ideviceinfo.VendorExtensionID) { case PTP_VENDOR_EASTMAN_KODAK: switch (ofc) { case PTP_OFC_EK_M3U: return snprintf (txt, spaceleft,"M3U"); default: break; } break; case PTP_VENDOR_CANON: switch (ofc) { case PTP_OFC_CANON_CRW: return snprintf (txt, spaceleft,"CRW"); default: break; } break; case PTP_VENDOR_MICROSOFT: case PTP_VENDOR_MTP: for (i=0;ideviceinfo.VendorExtensionID) { case PTP_VENDOR_MICROSOFT: case PTP_VENDOR_MTP: for (i=0;iproperty = PTP_OPC_StorageID; /* Should be "unknown" */ prop->datatype = PTP_DTC_UNDEF; prop->ObjectHandle = 0x00000000U; prop->propval.str = NULL; (*props) = newprops; (*nrofprops)++; return prop; } void ptp_destroy_object_prop(MTPProperties *prop) { if (!prop) return; if (prop->datatype == PTP_DTC_STR && prop->propval.str != NULL) free(prop->propval.str); else if ((prop->datatype == PTP_DTC_AINT8 || prop->datatype == PTP_DTC_AINT16 || prop->datatype == PTP_DTC_AINT32 || prop->datatype == PTP_DTC_AINT64 || prop->datatype == PTP_DTC_AINT128 || prop->datatype == PTP_DTC_AUINT8 || prop->datatype == PTP_DTC_AUINT16 || prop->datatype == PTP_DTC_AUINT32 || prop->datatype == PTP_DTC_AUINT64 || prop->datatype == PTP_DTC_AUINT128) && prop->propval.a.v != NULL) free(prop->propval.a.v); } void ptp_destroy_object_prop_list(MTPProperties *props, int nrofprops) { int i; MTPProperties *prop = props; for (i=0;imtpprops; for (i=0;inrofmtpprops;i++) { if (attribute_id == prop->property) return prop; prop++; } return NULL; } void ptp_remove_object_from_cache(PTPParams *params, uint32_t handle) { unsigned int i; PTPObject *ob; uint16_t ret; ret = ptp_object_find (params, handle, &ob); if (ret != PTP_RC_OK) return; i = ob-params->objects; /* remove object from object info cache */ ptp_free_object (ob); if (i < params->nrofobjects-1) memmove (ob,ob+1,(params->nrofobjects-1-i)*sizeof(PTPObject)); params->nrofobjects--; /* We use less memory than before so this shouldn't fail */ params->objects = realloc(params->objects, sizeof(PTPObject)*params->nrofobjects); } static int _cmp_ob (const void *a, const void *b) { PTPObject *oa = (PTPObject*)a; PTPObject *ob = (PTPObject*)b; return oa->oid - ob->oid; } void ptp_objects_sort (PTPParams *params) { qsort (params->objects, params->nrofobjects, sizeof(PTPObject), _cmp_ob); } /* Binary search in objects. Needs "objects" to be a sorted by objectid list! */ uint16_t ptp_object_find (PTPParams *params, uint32_t handle, PTPObject **retob) { PTPObject tmpob; tmpob.oid = handle; *retob = bsearch (&tmpob, params->objects, params->nrofobjects, sizeof(tmpob), _cmp_ob); if (!*retob) return PTP_RC_GeneralError; return PTP_RC_OK; } /* Binary search in objects + insert of not found. Needs "objects" to be a sorted by objectid list! */ uint16_t ptp_object_find_or_insert (PTPParams *params, uint32_t handle, PTPObject **retob) { unsigned int begin, end, cursor; unsigned int insertat; PTPObject *newobs; if (!handle) return PTP_RC_GeneralError; *retob = NULL; if (!params->nrofobjects) { params->objects = calloc(1,sizeof(PTPObject)); params->nrofobjects = 1; params->objects[0].oid = handle; *retob = ¶ms->objects[0]; return PTP_RC_OK; } begin = 0; end = params->nrofobjects-1; /*ptp_debug (params, "searching %08x, total=%d", handle, params->nrofobjects);*/ while (1) { cursor = (end-begin)/2+begin; /*ptp_debug (params, "ob %d: %08x [%d-%d]", cursor, params->objects[cursor].oid, begin, end);*/ if (params->objects[cursor].oid == handle) { *retob = ¶ms->objects[cursor]; return PTP_RC_OK; } if (params->objects[cursor].oid < handle) begin = cursor; else end = cursor; if ((end - begin) <= 1) break; } if (params->objects[begin].oid == handle) { *retob = ¶ms->objects[begin]; return PTP_RC_OK; } if (params->objects[end].oid == handle) { *retob = ¶ms->objects[end]; return PTP_RC_OK; } if ((begin == 0) && (handle < params->objects[0].oid)) { insertat=begin; } else { if ((end == params->nrofobjects-1) && (handle > params->objects[end].oid)) insertat=end+1; else insertat=begin+1; } /*ptp_debug (params, "inserting oid %x at [%x,%x], begin=%d, end=%d, insertat=%d\n", handle, params->objects[begin].oid, params->objects[end].oid, begin, end, insertat);*/ newobs = realloc (params->objects, sizeof(PTPObject)*(params->nrofobjects+1)); if (!newobs) return PTP_RC_GeneralError; params->objects = newobs; if (insertatnrofobjects) memmove (¶ms->objects[insertat+1],¶ms->objects[insertat],(params->nrofobjects-insertat)*sizeof(PTPObject)); memset(¶ms->objects[insertat],0,sizeof(PTPObject)); params->objects[insertat].oid = handle; *retob = ¶ms->objects[insertat]; params->nrofobjects++; return PTP_RC_OK; } uint16_t ptp_object_want (PTPParams *params, uint32_t handle, unsigned int want, PTPObject **retob) { uint16_t ret; PTPObject *ob; /*Camera *camera = ((PTPData *)params->data)->camera;*/ /* If GetObjectInfo is broken, force GetPropList */ if (params->device_flags & DEVICE_FLAG_PROPLIST_OVERRIDES_OI) want |= PTPOBJECT_MTPPROPLIST_LOADED; *retob = NULL; if (!handle) { ptp_debug (params, "ptp_object_want: querying handle 0?\n"); return PTP_RC_GeneralError; } ret = ptp_object_find_or_insert (params, handle, &ob); if (ret != PTP_RC_OK) return PTP_RC_GeneralError; *retob = ob; /* Do we have all of it already? */ if ((ob->flags & want) == want) return PTP_RC_OK; #define X (PTPOBJECT_OBJECTINFO_LOADED|PTPOBJECT_STORAGEID_LOADED|PTPOBJECT_PARENTOBJECT_LOADED) if ((want & X) && ((ob->flags & X) != X)) { uint32_t saveparent = 0; /* One EOS issue, where getobjecthandles(root) returns obs without root flag. */ if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED) saveparent = ob->oi.ParentObject; ret = ptp_getobjectinfo (params, handle, &ob->oi); if (ret != PTP_RC_OK) { /* kill it from the internal list ... */ ptp_remove_object_from_cache(params, handle); return ret; } if (!ob->oi.Filename) ob->oi.Filename=strdup(""); if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED) ob->oi.ParentObject = saveparent; /* Second EOS issue, 0x20000000 has 0x20000000 as parent */ if (ob->oi.ParentObject == handle) ob->oi.ParentObject = 0; /* Read out the canon special flags */ if ((params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) && ptp_operation_issupported(params,PTP_OC_CANON_GetObjectInfoEx)) { PTPCANONFolderEntry *ents = NULL; uint32_t numents = 0; ret = ptp_canon_getobjectinfo(params, ob->oi.StorageID,0, ob->oi.ParentObject,handle, &ents,&numents ); if ((ret == PTP_RC_OK) && (numents >= 1)) ob->canon_flags = ents[0].Flags; free (ents); } ob->flags |= X; } #undef X if ( (want & PTPOBJECT_MTPPROPLIST_LOADED) && (!(ob->flags & PTPOBJECT_MTPPROPLIST_LOADED)) ) { int nrofprops = 0; MTPProperties *props = NULL; if (params->device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST) { want &= ~PTPOBJECT_MTPPROPLIST_LOADED; goto fallback; } /* Microsoft/MTP has fast directory retrieval. */ if (!ptp_operation_issupported(params,PTP_OC_MTP_GetObjPropList)) { want &= ~PTPOBJECT_MTPPROPLIST_LOADED; goto fallback; } ptp_debug (params, "ptp2/mtpfast: reading mtp proplist of %08x", handle); /* We just want this one object, not all at once. */ ret = ptp_mtp_getobjectproplist_single (params, handle, &props, &nrofprops); if (ret != PTP_RC_OK) goto fallback; ob->mtpprops = props; ob->nrofmtpprops = nrofprops; /* Override the ObjectInfo data with data from properties */ if (params->device_flags & DEVICE_FLAG_PROPLIST_OVERRIDES_OI) { unsigned int i; MTPProperties *prop = ob->mtpprops; for (i=0;inrofmtpprops;i++,prop++) { /* in case we got all subtree objects */ if (prop->ObjectHandle != handle) continue; switch (prop->property) { case PTP_OPC_StorageID: ob->oi.StorageID = prop->propval.u32; break; case PTP_OPC_ObjectFormat: ob->oi.ObjectFormat = prop->propval.u16; break; case PTP_OPC_ProtectionStatus: ob->oi.ProtectionStatus = prop->propval.u16; break; case PTP_OPC_ObjectSize: if (prop->datatype == PTP_DTC_UINT64) { if (prop->propval.u64 > 0xFFFFFFFFU) ob->oi.ObjectCompressedSize = 0xFFFFFFFFU; else ob->oi.ObjectCompressedSize = (uint32_t)prop->propval.u64; } else if (prop->datatype == PTP_DTC_UINT32) { ob->oi.ObjectCompressedSize = prop->propval.u32; } break; case PTP_OPC_AssociationType: ob->oi.AssociationType = prop->propval.u16; break; case PTP_OPC_AssociationDesc: ob->oi.AssociationDesc = prop->propval.u32; break; case PTP_OPC_ObjectFileName: if (prop->propval.str) { free(ob->oi.Filename); ob->oi.Filename = strdup(prop->propval.str); } break; case PTP_OPC_DateCreated: ob->oi.CaptureDate = ptp_unpack_PTPTIME(prop->propval.str); break; case PTP_OPC_DateModified: ob->oi.ModificationDate = ptp_unpack_PTPTIME(prop->propval.str); break; case PTP_OPC_Keywords: if (prop->propval.str) { free(ob->oi.Keywords); ob->oi.Keywords = strdup(prop->propval.str); } break; case PTP_OPC_ParentObject: ob->oi.ParentObject = prop->propval.u32; break; } } } #if 0 MTPProperties *xpl; int j; PTPObjectInfo oinfo; memset (&oinfo,0,sizeof(oinfo)); /* hmm, not necessary ... only if we would use it */ for (j=0;jproperty) { case PTP_OPC_ParentObject: if (xpl->datatype != PTP_DTC_UINT32) { ptp_debug (params, "ptp2/mtpfast: parentobject has type 0x%x???", xpl->datatype); break; } oinfo.ParentObject = xpl->propval.u32; ptp_debug (params, "ptp2/mtpfast: parent 0x%x", xpl->propval.u32); break; case PTP_OPC_ObjectFormat: if (xpl->datatype != PTP_DTC_UINT16) { ptp_debug (params, "ptp2/mtpfast: objectformat has type 0x%x???", xpl->datatype); break; } oinfo.ObjectFormat = xpl->propval.u16; ptp_debug (params, "ptp2/mtpfast: ofc 0x%x", xpl->propval.u16); break; case PTP_OPC_ObjectSize: switch (xpl->datatype) { case PTP_DTC_UINT32: oinfo.ObjectCompressedSize = xpl->propval.u32; break; case PTP_DTC_UINT64: oinfo.ObjectCompressedSize = xpl->propval.u64; break; default: ptp_debug (params, "ptp2/mtpfast: objectsize has type 0x%x???", xpl->datatype); break; } ptp_debug (params, "ptp2/mtpfast: objectsize %u", xpl->propval.u32); break; case PTP_OPC_StorageID: if (xpl->datatype != PTP_DTC_UINT32) { ptp_debug (params, "ptp2/mtpfast: storageid has type 0x%x???", xpl->datatype); break; } oinfo.StorageID = xpl->propval.u32; ptp_debug (params, "ptp2/mtpfast: storageid 0x%x", xpl->propval.u32); break; case PTP_OPC_ProtectionStatus:/*UINT16*/ if (xpl->datatype != PTP_DTC_UINT16) { ptp_debug (params, "ptp2/mtpfast: protectionstatus has type 0x%x???", xpl->datatype); break; } oinfo.ProtectionStatus = xpl->propval.u16; ptp_debug (params, "ptp2/mtpfast: protection 0x%x", xpl->propval.u16); break; case PTP_OPC_ObjectFileName: if (xpl->datatype != PTP_DTC_STR) { ptp_debug (params, "ptp2/mtpfast: filename has type 0x%x???", xpl->datatype); break; } if (xpl->propval.str) { ptp_debug (params, "ptp2/mtpfast: filename %s", xpl->propval.str); oinfo.Filename = strdup(xpl->propval.str); } else { oinfo.Filename = NULL; } break; case PTP_OPC_DateCreated: if (xpl->datatype != PTP_DTC_STR) { ptp_debug (params, "ptp2/mtpfast: datecreated has type 0x%x???", xpl->datatype); break; } ptp_debug (params, "ptp2/mtpfast: capturedate %s", xpl->propval.str); oinfo.CaptureDate = ptp_unpack_PTPTIME (xpl->propval.str); break; case PTP_OPC_DateModified: if (xpl->datatype != PTP_DTC_STR) { ptp_debug (params, "ptp2/mtpfast: datemodified has type 0x%x???", xpl->datatype); break; } ptp_debug (params, "ptp2/mtpfast: moddate %s", xpl->propval.str); oinfo.ModificationDate = ptp_unpack_PTPTIME (xpl->propval.str); break; default: if ((xpl->property & 0xfff0) == 0xdc00) ptp_debug (params, "ptp2/mtpfast:case %x type %x unhandled", xpl->property, xpl->datatype); break; } } if (!oinfo.Filename) /* i have one such file on my Creative */ oinfo.Filename = strdup(""); #endif ob->flags |= PTPOBJECT_MTPPROPLIST_LOADED; fallback: ; } if ((ob->flags & want) == want) return PTP_RC_OK; ptp_debug (params, "ptp_object_want: oid 0x%08x, want flags %x, have only %x?", handle, want, ob->flags); return PTP_RC_GeneralError; } uint16_t ptp_add_object_to_cache(PTPParams *params, uint32_t handle) { PTPObject *ob; return ptp_object_want (params, handle, PTPOBJECT_OBJECTINFO_LOADED|PTPOBJECT_MTPPROPLIST_LOADED, &ob); } libmtp-1.1.10/src/libmtp.c0000644000175000001440000115042612604205544012233 00000000000000/** * \file libmtp.c * * Copyright (C) 2005-2011 Linus Walleij * Copyright (C) 2005-2008 Richard A. Low * Copyright (C) 2007 Ted Bullock * Copyright (C) 2007 Tero Saarni * Copyright (C) 2008 Florent Mertens * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * This file provides an interface "glue" to the underlying * PTP implementation from libgphoto2. It uses some local * code to convert from/to UTF-8 (stored in unicode.c/.h) * and some small utility functions, mainly for debugging * (stored in util.c/.h). * * The three PTP files (ptp.c, ptp.h and ptp-pack.c) are * plain copied from the libhphoto2 codebase. * * The files libusb-glue.c/.h are just what they say: an * interface to libusb for the actual, physical USB traffic. */ #include "config.h" #include "libmtp.h" #include "unicode.h" #include "ptp.h" #include "libusb-glue.h" #include "device-flags.h" #include "playlist-spl.h" #include "util.h" #include "mtpz.h" #include #include #include #include #include #include #include #include #include #ifdef _MSC_VER // For MSVC++ #define USE_WINDOWS_IO_H #include #endif /** * Global debug level * We use a flag system to enable a part of logs. * * The LIBMTP_DEBUG environment variable sets the debug flags for any binary * that uses libmtp and calls LIBMTP_Init. The value can be given in decimal * (must not start with "0" or it will be interpreted in octal), or in * hexadecimal (must start with "0x"). * * The value "-1" enables all debug flags. * * Some of the utilities in examples/ also take a command-line flag "-d" that * enables LIBMTP_DEBUG_PTP and LIBMTP_DEBUG_DATA (same as setting * LIBMTP_DEBUG=9). * * Flags (combine by adding the hex values): * 0x00 [0000 0000] : LIBMTP_DEBUG_NONE : no debug (default) * 0x01 [0000 0001] : LIBMTP_DEBUG_PTP : PTP debug * 0x02 [0000 0010] : LIBMTP_DEBUG_PLST : Playlist debug * 0x04 [0000 0100] : LIBMTP_DEBUG_USB : USB debug * 0x08 [0000 1000] : LIBMTP_DEBUG_DATA : USB data debug * * (Please keep this list in sync with libmtp.h.) */ int LIBMTP_debug = LIBMTP_DEBUG_NONE; /* * This is a mapping between libmtp internal MTP filetypes and * the libgphoto2/PTP equivalent defines. We need this because * otherwise the libmtp.h device has to be dependent on ptp.h * to be installed too, and we don't want that. */ //typedef struct filemap_struct filemap_t; typedef struct filemap_struct { char *description; /**< Text description for the file type */ LIBMTP_filetype_t id; /**< LIBMTP internal type for the file type */ uint16_t ptp_id; /**< PTP ID for the filetype */ struct filemap_struct *next; } filemap_t; /* * This is a mapping between libmtp internal MTP properties and * the libgphoto2/PTP equivalent defines. We need this because * otherwise the libmtp.h device has to be dependent on ptp.h * to be installed too, and we don't want that. */ typedef struct propertymap_struct { char *description; /**< Text description for the property */ LIBMTP_property_t id; /**< LIBMTP internal type for the property */ uint16_t ptp_id; /**< PTP ID for the property */ struct propertymap_struct *next; } propertymap_t; // Global variables // This holds the global filetype mapping table static filemap_t *g_filemap = NULL; // This holds the global property mapping table static propertymap_t *g_propertymap = NULL; /* * Forward declarations of local (static) functions. */ static int register_filetype(char const * const description, LIBMTP_filetype_t const id, uint16_t const ptp_id); static void init_filemap(); static int register_property(char const * const description, LIBMTP_property_t const id, uint16_t const ptp_id); static void init_propertymap(); static void add_error_to_errorstack(LIBMTP_mtpdevice_t *device, LIBMTP_error_number_t errornumber, char const * const error_text); static void add_ptp_error_to_errorstack(LIBMTP_mtpdevice_t *device, uint16_t ptp_error, char const * const error_text); static void flush_handles(LIBMTP_mtpdevice_t *device); static void get_handles_recursively(LIBMTP_mtpdevice_t *device, PTPParams *params, uint32_t storageid, uint32_t parent); static void free_storage_list(LIBMTP_mtpdevice_t *device); static int sort_storage_by(LIBMTP_mtpdevice_t *device, int const sortby); static uint32_t get_writeable_storageid(LIBMTP_mtpdevice_t *device, uint64_t fitsize); static int get_storage_freespace(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage, uint64_t *freespace); static int check_if_file_fits(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage, uint64_t const filesize); static uint16_t map_libmtp_type_to_ptp_type(LIBMTP_filetype_t intype); static LIBMTP_filetype_t map_ptp_type_to_libmtp_type(uint16_t intype); static uint16_t map_libmtp_property_to_ptp_property(LIBMTP_property_t inproperty); static LIBMTP_property_t map_ptp_property_to_libmtp_property(uint16_t intype); static int get_device_unicode_property(LIBMTP_mtpdevice_t *device, char **unicstring, uint16_t property); static uint16_t adjust_u16(uint16_t val, PTPObjectPropDesc *opd); static uint32_t adjust_u32(uint32_t val, PTPObjectPropDesc *opd); static char *get_iso8601_stamp(void); static char *get_string_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id); static uint64_t get_u64_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, uint16_t const attribute_id, uint64_t const value_default); static uint32_t get_u32_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, uint16_t const attribute_id, uint32_t const value_default); static uint16_t get_u16_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint16_t const value_default); static uint8_t get_u8_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint8_t const value_default); static int set_object_string(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, char const * const string); static int set_object_u32(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint32_t const value); static int set_object_u16(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint16_t const value); static int set_object_u8(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint8_t const value); static void get_track_metadata(LIBMTP_mtpdevice_t *device, uint16_t objectformat, LIBMTP_track_t *track); static LIBMTP_folder_t *get_subfolders_for_folder(LIBMTP_folder_t *list, uint32_t parent); static int create_new_abstract_list(LIBMTP_mtpdevice_t *device, char const * const name, char const * const artist, char const * const composer, char const * const genre, uint32_t const parenthandle, uint32_t const storageid, uint16_t const objectformat, char const * const suffix, uint32_t * const newid, uint32_t const * const tracks, uint32_t const no_tracks); static int update_abstract_list(LIBMTP_mtpdevice_t *device, char const * const name, char const * const artist, char const * const composer, char const * const genre, uint32_t const objecthandle, uint16_t const objectformat, uint32_t const * const tracks, uint32_t const no_tracks); static int send_file_object_info(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *filedata); static void add_object_to_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id); static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id); static int set_object_filename(LIBMTP_mtpdevice_t *device, uint32_t object_id, uint16_t ptp_type, const char **newname); static char *generate_unique_filename(PTPParams* params, char const * const filename); static int check_filename_exists(PTPParams* params, char const * const filename); /** * These are to wrap the get/put handlers to convert from the MTP types to PTP types * in a reliable way */ typedef struct _MTPDataHandler { MTPDataGetFunc getfunc; MTPDataPutFunc putfunc; void *priv; } MTPDataHandler; static uint16_t get_func_wrapper(PTPParams* params, void* priv, unsigned long wantlen, unsigned char *data, unsigned long *gotlen); static uint16_t put_func_wrapper(PTPParams* params, void* priv, unsigned long sendlen, unsigned char *data, unsigned long *putlen); /** * Checks if a filename ends with ".ogg". Used in various * situations when the device has no idea that it support * OGG but still does. * * @param name string to be checked. * @return 0 if this does not end with ogg, any other * value means it does. */ static int has_ogg_extension(char *name) { char *ptype; if (name == NULL) return 0; ptype = strrchr(name,'.'); if (ptype == NULL) return 0; if (!strcasecmp (ptype, ".ogg")) return 1; return 0; } /** * Checks if a filename ends with ".flac". Used in various * situations when the device has no idea that it support * FLAC but still does. * * @param name string to be checked. * @return 0 if this does not end with flac, any other * value means it does. */ static int has_flac_extension(char *name) { char *ptype; if (name == NULL) return 0; ptype = strrchr(name,'.'); if (ptype == NULL) return 0; if (!strcasecmp (ptype, ".flac")) return 1; return 0; } /** * Create a new file mapping entry * @return a newly allocated filemapping entry. */ static filemap_t *new_filemap_entry() { filemap_t *filemap; filemap = (filemap_t *)malloc(sizeof(filemap_t)); if( filemap != NULL ) { filemap->description = NULL; filemap->id = LIBMTP_FILETYPE_UNKNOWN; filemap->ptp_id = PTP_OFC_Undefined; filemap->next = NULL; } return filemap; } /** * Register an MTP or PTP filetype for data retrieval * * @param description Text description of filetype * @param id libmtp internal filetype id * @param ptp_id PTP filetype id * @return 0 for success any other value means error. */ static int register_filetype(char const * const description, LIBMTP_filetype_t const id, uint16_t const ptp_id) { filemap_t *new = NULL, *current; // Has this LIBMTP filetype been registered before ? current = g_filemap; while (current != NULL) { if(current->id == id) { break; } current = current->next; } // Create the entry if(current == NULL) { new = new_filemap_entry(); if(new == NULL) { return 1; } new->id = id; if(description != NULL) { new->description = strdup(description); } new->ptp_id = ptp_id; // Add the entry to the list if(g_filemap == NULL) { g_filemap = new; } else { current = g_filemap; while (current->next != NULL ) current=current->next; current->next = new; } // Update the existing entry } else { if (current->description != NULL) { free(current->description); } current->description = NULL; if(description != NULL) { current->description = strdup(description); } current->ptp_id = ptp_id; } return 0; } static void init_filemap() { register_filetype("Folder", LIBMTP_FILETYPE_FOLDER, PTP_OFC_Association); register_filetype("MediaCard", LIBMTP_FILETYPE_MEDIACARD, PTP_OFC_MTP_MediaCard); register_filetype("RIFF WAVE file", LIBMTP_FILETYPE_WAV, PTP_OFC_WAV); register_filetype("ISO MPEG-1 Audio Layer 3", LIBMTP_FILETYPE_MP3, PTP_OFC_MP3); register_filetype("ISO MPEG-1 Audio Layer 2", LIBMTP_FILETYPE_MP2, PTP_OFC_MTP_MP2); register_filetype("Microsoft Windows Media Audio", LIBMTP_FILETYPE_WMA, PTP_OFC_MTP_WMA); register_filetype("Ogg container format", LIBMTP_FILETYPE_OGG, PTP_OFC_MTP_OGG); register_filetype("Free Lossless Audio Codec (FLAC)", LIBMTP_FILETYPE_FLAC, PTP_OFC_MTP_FLAC); register_filetype("Advanced Audio Coding (AAC)/MPEG-2 Part 7/MPEG-4 Part 3", LIBMTP_FILETYPE_AAC, PTP_OFC_MTP_AAC); register_filetype("MPEG-4 Part 14 Container Format (Audio Emphasis)", LIBMTP_FILETYPE_M4A, PTP_OFC_MTP_M4A); register_filetype("MPEG-4 Part 14 Container Format (Audio+Video Emphasis)", LIBMTP_FILETYPE_MP4, PTP_OFC_MTP_MP4); register_filetype("Audible.com Audio Codec", LIBMTP_FILETYPE_AUDIBLE, PTP_OFC_MTP_AudibleCodec); register_filetype("Undefined audio file", LIBMTP_FILETYPE_UNDEF_AUDIO, PTP_OFC_MTP_UndefinedAudio); register_filetype("Microsoft Windows Media Video", LIBMTP_FILETYPE_WMV, PTP_OFC_MTP_WMV); register_filetype("Audio Video Interleave", LIBMTP_FILETYPE_AVI, PTP_OFC_AVI); register_filetype("MPEG video stream", LIBMTP_FILETYPE_MPEG, PTP_OFC_MPEG); register_filetype("Microsoft Advanced Systems Format", LIBMTP_FILETYPE_ASF, PTP_OFC_ASF); register_filetype("Apple Quicktime container format", LIBMTP_FILETYPE_QT, PTP_OFC_QT); register_filetype("Undefined video file", LIBMTP_FILETYPE_UNDEF_VIDEO, PTP_OFC_MTP_UndefinedVideo); register_filetype("JPEG file", LIBMTP_FILETYPE_JPEG, PTP_OFC_EXIF_JPEG); register_filetype("JP2 file", LIBMTP_FILETYPE_JP2, PTP_OFC_JP2); register_filetype("JPX file", LIBMTP_FILETYPE_JPX, PTP_OFC_JPX); register_filetype("JFIF file", LIBMTP_FILETYPE_JFIF, PTP_OFC_JFIF); register_filetype("TIFF bitmap file", LIBMTP_FILETYPE_TIFF, PTP_OFC_TIFF); register_filetype("BMP bitmap file", LIBMTP_FILETYPE_BMP, PTP_OFC_BMP); register_filetype("GIF bitmap file", LIBMTP_FILETYPE_GIF, PTP_OFC_GIF); register_filetype("PICT bitmap file", LIBMTP_FILETYPE_PICT, PTP_OFC_PICT); register_filetype("Portable Network Graphics", LIBMTP_FILETYPE_PNG, PTP_OFC_PNG); register_filetype("Microsoft Windows Image Format", LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, PTP_OFC_MTP_WindowsImageFormat); register_filetype("VCalendar version 1", LIBMTP_FILETYPE_VCALENDAR1, PTP_OFC_MTP_vCalendar1); register_filetype("VCalendar version 2", LIBMTP_FILETYPE_VCALENDAR2, PTP_OFC_MTP_vCalendar2); register_filetype("VCard version 2", LIBMTP_FILETYPE_VCARD2, PTP_OFC_MTP_vCard2); register_filetype("VCard version 3", LIBMTP_FILETYPE_VCARD3, PTP_OFC_MTP_vCard3); register_filetype("Undefined Windows executable file", LIBMTP_FILETYPE_WINEXEC, PTP_OFC_MTP_UndefinedWindowsExecutable); register_filetype("Text file", LIBMTP_FILETYPE_TEXT, PTP_OFC_Text); register_filetype("HTML file", LIBMTP_FILETYPE_HTML, PTP_OFC_HTML); register_filetype("XML file", LIBMTP_FILETYPE_XML, PTP_OFC_MTP_XMLDocument); register_filetype("DOC file", LIBMTP_FILETYPE_DOC, PTP_OFC_MTP_MSWordDocument); register_filetype("XLS file", LIBMTP_FILETYPE_XLS, PTP_OFC_MTP_MSExcelSpreadsheetXLS); register_filetype("PPT file", LIBMTP_FILETYPE_PPT, PTP_OFC_MTP_MSPowerpointPresentationPPT); register_filetype("MHT file", LIBMTP_FILETYPE_MHT, PTP_OFC_MTP_MHTCompiledHTMLDocument); register_filetype("Firmware file", LIBMTP_FILETYPE_FIRMWARE, PTP_OFC_MTP_Firmware); register_filetype("Abstract Album file", LIBMTP_FILETYPE_ALBUM, PTP_OFC_MTP_AbstractAudioAlbum); register_filetype("Abstract Playlist file", LIBMTP_FILETYPE_PLAYLIST, PTP_OFC_MTP_AbstractAudioVideoPlaylist); register_filetype("Undefined filetype", LIBMTP_FILETYPE_UNKNOWN, PTP_OFC_Undefined); } /** * Returns the PTP filetype that maps to a certain libmtp internal file type. * @param intype the MTP library interface type * @return the PTP (libgphoto2) interface type */ static uint16_t map_libmtp_type_to_ptp_type(LIBMTP_filetype_t intype) { filemap_t *current; current = g_filemap; while (current != NULL) { if(current->id == intype) { return current->ptp_id; } current = current->next; } // printf("map_libmtp_type_to_ptp_type: unknown filetype.\n"); return PTP_OFC_Undefined; } /** * Returns the MTP internal interface type that maps to a certain ptp * interface type. * @param intype the PTP (libgphoto2) interface type * @return the MTP library interface type */ static LIBMTP_filetype_t map_ptp_type_to_libmtp_type(uint16_t intype) { filemap_t *current; current = g_filemap; while (current != NULL) { if(current->ptp_id == intype) { return current->id; } current = current->next; } // printf("map_ptp_type_to_libmtp_type: unknown filetype.\n"); return LIBMTP_FILETYPE_UNKNOWN; } /** * Create a new property mapping entry * @return a newly allocated propertymapping entry. */ static propertymap_t *new_propertymap_entry() { propertymap_t *propertymap; propertymap = (propertymap_t *)malloc(sizeof(propertymap_t)); if( propertymap != NULL ) { propertymap->description = NULL; propertymap->id = LIBMTP_PROPERTY_UNKNOWN; propertymap->ptp_id = 0; propertymap->next = NULL; } return propertymap; } /** * Register an MTP or PTP property for data retrieval * * @param description Text description of property * @param id libmtp internal property id * @param ptp_id PTP property id * @return 0 for success any other value means error. */ static int register_property(char const * const description, LIBMTP_property_t const id, uint16_t const ptp_id) { propertymap_t *new = NULL, *current; // Has this LIBMTP propety been registered before ? current = g_propertymap; while (current != NULL) { if(current->id == id) { break; } current = current->next; } // Create the entry if(current == NULL) { new = new_propertymap_entry(); if(new == NULL) { return 1; } new->id = id; if(description != NULL) { new->description = strdup(description); } new->ptp_id = ptp_id; // Add the entry to the list if(g_propertymap == NULL) { g_propertymap = new; } else { current = g_propertymap; while (current->next != NULL ) current=current->next; current->next = new; } // Update the existing entry } else { if (current->description != NULL) { free(current->description); } current->description = NULL; if(description != NULL) { current->description = strdup(description); } current->ptp_id = ptp_id; } return 0; } static void init_propertymap() { register_property("Storage ID", LIBMTP_PROPERTY_StorageID, PTP_OPC_StorageID); register_property("Object Format", LIBMTP_PROPERTY_ObjectFormat, PTP_OPC_ObjectFormat); register_property("Protection Status", LIBMTP_PROPERTY_ProtectionStatus, PTP_OPC_ProtectionStatus); register_property("Object Size", LIBMTP_PROPERTY_ObjectSize, PTP_OPC_ObjectSize); register_property("Association Type", LIBMTP_PROPERTY_AssociationType, PTP_OPC_AssociationType); register_property("Association Desc", LIBMTP_PROPERTY_AssociationDesc, PTP_OPC_AssociationDesc); register_property("Object File Name", LIBMTP_PROPERTY_ObjectFileName, PTP_OPC_ObjectFileName); register_property("Date Created", LIBMTP_PROPERTY_DateCreated, PTP_OPC_DateCreated); register_property("Date Modified", LIBMTP_PROPERTY_DateModified, PTP_OPC_DateModified); register_property("Keywords", LIBMTP_PROPERTY_Keywords, PTP_OPC_Keywords); register_property("Parent Object", LIBMTP_PROPERTY_ParentObject, PTP_OPC_ParentObject); register_property("Allowed Folder Contents", LIBMTP_PROPERTY_AllowedFolderContents, PTP_OPC_AllowedFolderContents); register_property("Hidden", LIBMTP_PROPERTY_Hidden, PTP_OPC_Hidden); register_property("System Object", LIBMTP_PROPERTY_SystemObject, PTP_OPC_SystemObject); register_property("Persistant Unique Object Identifier", LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier, PTP_OPC_PersistantUniqueObjectIdentifier); register_property("Sync ID", LIBMTP_PROPERTY_SyncID, PTP_OPC_SyncID); register_property("Property Bag", LIBMTP_PROPERTY_PropertyBag, PTP_OPC_PropertyBag); register_property("Name", LIBMTP_PROPERTY_Name, PTP_OPC_Name); register_property("Created By", LIBMTP_PROPERTY_CreatedBy, PTP_OPC_CreatedBy); register_property("Artist", LIBMTP_PROPERTY_Artist, PTP_OPC_Artist); register_property("Date Authored", LIBMTP_PROPERTY_DateAuthored, PTP_OPC_DateAuthored); register_property("Description", LIBMTP_PROPERTY_Description, PTP_OPC_Description); register_property("URL Reference", LIBMTP_PROPERTY_URLReference, PTP_OPC_URLReference); register_property("Language Locale", LIBMTP_PROPERTY_LanguageLocale, PTP_OPC_LanguageLocale); register_property("Copyright Information", LIBMTP_PROPERTY_CopyrightInformation, PTP_OPC_CopyrightInformation); register_property("Source", LIBMTP_PROPERTY_Source, PTP_OPC_Source); register_property("Origin Location", LIBMTP_PROPERTY_OriginLocation, PTP_OPC_OriginLocation); register_property("Date Added", LIBMTP_PROPERTY_DateAdded, PTP_OPC_DateAdded); register_property("Non Consumable", LIBMTP_PROPERTY_NonConsumable, PTP_OPC_NonConsumable); register_property("Corrupt Or Unplayable", LIBMTP_PROPERTY_CorruptOrUnplayable, PTP_OPC_CorruptOrUnplayable); register_property("Producer Serial Number", LIBMTP_PROPERTY_ProducerSerialNumber, PTP_OPC_ProducerSerialNumber); register_property("Representative Sample Format", LIBMTP_PROPERTY_RepresentativeSampleFormat, PTP_OPC_RepresentativeSampleFormat); register_property("Representative Sample Sise", LIBMTP_PROPERTY_RepresentativeSampleSize, PTP_OPC_RepresentativeSampleSize); register_property("Representative Sample Height", LIBMTP_PROPERTY_RepresentativeSampleHeight, PTP_OPC_RepresentativeSampleHeight); register_property("Representative Sample Width", LIBMTP_PROPERTY_RepresentativeSampleWidth, PTP_OPC_RepresentativeSampleWidth); register_property("Representative Sample Duration", LIBMTP_PROPERTY_RepresentativeSampleDuration, PTP_OPC_RepresentativeSampleDuration); register_property("Representative Sample Data", LIBMTP_PROPERTY_RepresentativeSampleData, PTP_OPC_RepresentativeSampleData); register_property("Width", LIBMTP_PROPERTY_Width, PTP_OPC_Width); register_property("Height", LIBMTP_PROPERTY_Height, PTP_OPC_Height); register_property("Duration", LIBMTP_PROPERTY_Duration, PTP_OPC_Duration); register_property("Rating", LIBMTP_PROPERTY_Rating, PTP_OPC_Rating); register_property("Track", LIBMTP_PROPERTY_Track, PTP_OPC_Track); register_property("Genre", LIBMTP_PROPERTY_Genre, PTP_OPC_Genre); register_property("Credits", LIBMTP_PROPERTY_Credits, PTP_OPC_Credits); register_property("Lyrics", LIBMTP_PROPERTY_Lyrics, PTP_OPC_Lyrics); register_property("Subscription Content ID", LIBMTP_PROPERTY_SubscriptionContentID, PTP_OPC_SubscriptionContentID); register_property("Produced By", LIBMTP_PROPERTY_ProducedBy, PTP_OPC_ProducedBy); register_property("Use Count", LIBMTP_PROPERTY_UseCount, PTP_OPC_UseCount); register_property("Skip Count", LIBMTP_PROPERTY_SkipCount, PTP_OPC_SkipCount); register_property("Last Accessed", LIBMTP_PROPERTY_LastAccessed, PTP_OPC_LastAccessed); register_property("Parental Rating", LIBMTP_PROPERTY_ParentalRating, PTP_OPC_ParentalRating); register_property("Meta Genre", LIBMTP_PROPERTY_MetaGenre, PTP_OPC_MetaGenre); register_property("Composer", LIBMTP_PROPERTY_Composer, PTP_OPC_Composer); register_property("Effective Rating", LIBMTP_PROPERTY_EffectiveRating, PTP_OPC_EffectiveRating); register_property("Subtitle", LIBMTP_PROPERTY_Subtitle, PTP_OPC_Subtitle); register_property("Original Release Date", LIBMTP_PROPERTY_OriginalReleaseDate, PTP_OPC_OriginalReleaseDate); register_property("Album Name", LIBMTP_PROPERTY_AlbumName, PTP_OPC_AlbumName); register_property("Album Artist", LIBMTP_PROPERTY_AlbumArtist, PTP_OPC_AlbumArtist); register_property("Mood", LIBMTP_PROPERTY_Mood, PTP_OPC_Mood); register_property("DRM Status", LIBMTP_PROPERTY_DRMStatus, PTP_OPC_DRMStatus); register_property("Sub Description", LIBMTP_PROPERTY_SubDescription, PTP_OPC_SubDescription); register_property("Is Cropped", LIBMTP_PROPERTY_IsCropped, PTP_OPC_IsCropped); register_property("Is Color Corrected", LIBMTP_PROPERTY_IsColorCorrected, PTP_OPC_IsColorCorrected); register_property("Image Bit Depth", LIBMTP_PROPERTY_ImageBitDepth, PTP_OPC_ImageBitDepth); register_property("f Number", LIBMTP_PROPERTY_Fnumber, PTP_OPC_Fnumber); register_property("Exposure Time", LIBMTP_PROPERTY_ExposureTime, PTP_OPC_ExposureTime); register_property("Exposure Index", LIBMTP_PROPERTY_ExposureIndex, PTP_OPC_ExposureIndex); register_property("Display Name", LIBMTP_PROPERTY_DisplayName, PTP_OPC_DisplayName); register_property("Body Text", LIBMTP_PROPERTY_BodyText, PTP_OPC_BodyText); register_property("Subject", LIBMTP_PROPERTY_Subject, PTP_OPC_Subject); register_property("Priority", LIBMTP_PROPERTY_Priority, PTP_OPC_Priority); register_property("Given Name", LIBMTP_PROPERTY_GivenName, PTP_OPC_GivenName); register_property("Middle Names", LIBMTP_PROPERTY_MiddleNames, PTP_OPC_MiddleNames); register_property("Family Name", LIBMTP_PROPERTY_FamilyName, PTP_OPC_FamilyName); register_property("Prefix", LIBMTP_PROPERTY_Prefix, PTP_OPC_Prefix); register_property("Suffix", LIBMTP_PROPERTY_Suffix, PTP_OPC_Suffix); register_property("Phonetic Given Name", LIBMTP_PROPERTY_PhoneticGivenName, PTP_OPC_PhoneticGivenName); register_property("Phonetic Family Name", LIBMTP_PROPERTY_PhoneticFamilyName, PTP_OPC_PhoneticFamilyName); register_property("Email: Primary", LIBMTP_PROPERTY_EmailPrimary, PTP_OPC_EmailPrimary); register_property("Email: Personal 1", LIBMTP_PROPERTY_EmailPersonal1, PTP_OPC_EmailPersonal1); register_property("Email: Personal 2", LIBMTP_PROPERTY_EmailPersonal2, PTP_OPC_EmailPersonal2); register_property("Email: Business 1", LIBMTP_PROPERTY_EmailBusiness1, PTP_OPC_EmailBusiness1); register_property("Email: Business 2", LIBMTP_PROPERTY_EmailBusiness2, PTP_OPC_EmailBusiness2); register_property("Email: Others", LIBMTP_PROPERTY_EmailOthers, PTP_OPC_EmailOthers); register_property("Phone Number: Primary", LIBMTP_PROPERTY_PhoneNumberPrimary, PTP_OPC_PhoneNumberPrimary); register_property("Phone Number: Personal", LIBMTP_PROPERTY_PhoneNumberPersonal, PTP_OPC_PhoneNumberPersonal); register_property("Phone Number: Personal 2", LIBMTP_PROPERTY_PhoneNumberPersonal2, PTP_OPC_PhoneNumberPersonal2); register_property("Phone Number: Business", LIBMTP_PROPERTY_PhoneNumberBusiness, PTP_OPC_PhoneNumberBusiness); register_property("Phone Number: Business 2", LIBMTP_PROPERTY_PhoneNumberBusiness2, PTP_OPC_PhoneNumberBusiness2); register_property("Phone Number: Mobile", LIBMTP_PROPERTY_PhoneNumberMobile, PTP_OPC_PhoneNumberMobile); register_property("Phone Number: Mobile 2", LIBMTP_PROPERTY_PhoneNumberMobile2, PTP_OPC_PhoneNumberMobile2); register_property("Fax Number: Primary", LIBMTP_PROPERTY_FaxNumberPrimary, PTP_OPC_FaxNumberPrimary); register_property("Fax Number: Personal", LIBMTP_PROPERTY_FaxNumberPersonal, PTP_OPC_FaxNumberPersonal); register_property("Fax Number: Business", LIBMTP_PROPERTY_FaxNumberBusiness, PTP_OPC_FaxNumberBusiness); register_property("Pager Number", LIBMTP_PROPERTY_PagerNumber, PTP_OPC_PagerNumber); register_property("Phone Number: Others", LIBMTP_PROPERTY_PhoneNumberOthers, PTP_OPC_PhoneNumberOthers); register_property("Primary Web Address", LIBMTP_PROPERTY_PrimaryWebAddress, PTP_OPC_PrimaryWebAddress); register_property("Personal Web Address", LIBMTP_PROPERTY_PersonalWebAddress, PTP_OPC_PersonalWebAddress); register_property("Business Web Address", LIBMTP_PROPERTY_BusinessWebAddress, PTP_OPC_BusinessWebAddress); register_property("Instant Messenger Address 1", LIBMTP_PROPERTY_InstantMessengerAddress, PTP_OPC_InstantMessengerAddress); register_property("Instant Messenger Address 2", LIBMTP_PROPERTY_InstantMessengerAddress2, PTP_OPC_InstantMessengerAddress2); register_property("Instant Messenger Address 3", LIBMTP_PROPERTY_InstantMessengerAddress3, PTP_OPC_InstantMessengerAddress3); register_property("Postal Address: Personal: Full", LIBMTP_PROPERTY_PostalAddressPersonalFull, PTP_OPC_PostalAddressPersonalFull); register_property("Postal Address: Personal: Line 1", LIBMTP_PROPERTY_PostalAddressPersonalFullLine1, PTP_OPC_PostalAddressPersonalFullLine1); register_property("Postal Address: Personal: Line 2", LIBMTP_PROPERTY_PostalAddressPersonalFullLine2, PTP_OPC_PostalAddressPersonalFullLine2); register_property("Postal Address: Personal: City", LIBMTP_PROPERTY_PostalAddressPersonalFullCity, PTP_OPC_PostalAddressPersonalFullCity); register_property("Postal Address: Personal: Region", LIBMTP_PROPERTY_PostalAddressPersonalFullRegion, PTP_OPC_PostalAddressPersonalFullRegion); register_property("Postal Address: Personal: Postal Code", LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode, PTP_OPC_PostalAddressPersonalFullPostalCode); register_property("Postal Address: Personal: Country", LIBMTP_PROPERTY_PostalAddressPersonalFullCountry, PTP_OPC_PostalAddressPersonalFullCountry); register_property("Postal Address: Business: Full", LIBMTP_PROPERTY_PostalAddressBusinessFull, PTP_OPC_PostalAddressBusinessFull); register_property("Postal Address: Business: Line 1", LIBMTP_PROPERTY_PostalAddressBusinessLine1, PTP_OPC_PostalAddressBusinessLine1); register_property("Postal Address: Business: Line 2", LIBMTP_PROPERTY_PostalAddressBusinessLine2, PTP_OPC_PostalAddressBusinessLine2); register_property("Postal Address: Business: City", LIBMTP_PROPERTY_PostalAddressBusinessCity, PTP_OPC_PostalAddressBusinessCity); register_property("Postal Address: Business: Region", LIBMTP_PROPERTY_PostalAddressBusinessRegion, PTP_OPC_PostalAddressBusinessRegion); register_property("Postal Address: Business: Postal Code", LIBMTP_PROPERTY_PostalAddressBusinessPostalCode, PTP_OPC_PostalAddressBusinessPostalCode); register_property("Postal Address: Business: Country", LIBMTP_PROPERTY_PostalAddressBusinessCountry, PTP_OPC_PostalAddressBusinessCountry); register_property("Postal Address: Other: Full", LIBMTP_PROPERTY_PostalAddressOtherFull, PTP_OPC_PostalAddressOtherFull); register_property("Postal Address: Other: Line 1", LIBMTP_PROPERTY_PostalAddressOtherLine1, PTP_OPC_PostalAddressOtherLine1); register_property("Postal Address: Other: Line 2", LIBMTP_PROPERTY_PostalAddressOtherLine2, PTP_OPC_PostalAddressOtherLine2); register_property("Postal Address: Other: City", LIBMTP_PROPERTY_PostalAddressOtherCity, PTP_OPC_PostalAddressOtherCity); register_property("Postal Address: Other: Region", LIBMTP_PROPERTY_PostalAddressOtherRegion, PTP_OPC_PostalAddressOtherRegion); register_property("Postal Address: Other: Postal Code", LIBMTP_PROPERTY_PostalAddressOtherPostalCode, PTP_OPC_PostalAddressOtherPostalCode); register_property("Postal Address: Other: Counrtry", LIBMTP_PROPERTY_PostalAddressOtherCountry, PTP_OPC_PostalAddressOtherCountry); register_property("Organization Name", LIBMTP_PROPERTY_OrganizationName, PTP_OPC_OrganizationName); register_property("Phonetic Organization Name", LIBMTP_PROPERTY_PhoneticOrganizationName, PTP_OPC_PhoneticOrganizationName); register_property("Role", LIBMTP_PROPERTY_Role, PTP_OPC_Role); register_property("Birthdate", LIBMTP_PROPERTY_Birthdate, PTP_OPC_Birthdate); register_property("Message To", LIBMTP_PROPERTY_MessageTo, PTP_OPC_MessageTo); register_property("Message CC", LIBMTP_PROPERTY_MessageCC, PTP_OPC_MessageCC); register_property("Message BCC", LIBMTP_PROPERTY_MessageBCC, PTP_OPC_MessageBCC); register_property("Message Read", LIBMTP_PROPERTY_MessageRead, PTP_OPC_MessageRead); register_property("Message Received Time", LIBMTP_PROPERTY_MessageReceivedTime, PTP_OPC_MessageReceivedTime); register_property("Message Sender", LIBMTP_PROPERTY_MessageSender, PTP_OPC_MessageSender); register_property("Activity Begin Time", LIBMTP_PROPERTY_ActivityBeginTime, PTP_OPC_ActivityBeginTime); register_property("Activity End Time", LIBMTP_PROPERTY_ActivityEndTime, PTP_OPC_ActivityEndTime); register_property("Activity Location", LIBMTP_PROPERTY_ActivityLocation, PTP_OPC_ActivityLocation); register_property("Activity Required Attendees", LIBMTP_PROPERTY_ActivityRequiredAttendees, PTP_OPC_ActivityRequiredAttendees); register_property("Optional Attendees", LIBMTP_PROPERTY_ActivityOptionalAttendees, PTP_OPC_ActivityOptionalAttendees); register_property("Activity Resources", LIBMTP_PROPERTY_ActivityResources, PTP_OPC_ActivityResources); register_property("Activity Accepted", LIBMTP_PROPERTY_ActivityAccepted, PTP_OPC_ActivityAccepted); register_property("Owner", LIBMTP_PROPERTY_Owner, PTP_OPC_Owner); register_property("Editor", LIBMTP_PROPERTY_Editor, PTP_OPC_Editor); register_property("Webmaster", LIBMTP_PROPERTY_Webmaster, PTP_OPC_Webmaster); register_property("URL Source", LIBMTP_PROPERTY_URLSource, PTP_OPC_URLSource); register_property("URL Destination", LIBMTP_PROPERTY_URLDestination, PTP_OPC_URLDestination); register_property("Time Bookmark", LIBMTP_PROPERTY_TimeBookmark, PTP_OPC_TimeBookmark); register_property("Object Bookmark", LIBMTP_PROPERTY_ObjectBookmark, PTP_OPC_ObjectBookmark); register_property("Byte Bookmark", LIBMTP_PROPERTY_ByteBookmark, PTP_OPC_ByteBookmark); register_property("Last Build Date", LIBMTP_PROPERTY_LastBuildDate, PTP_OPC_LastBuildDate); register_property("Time To Live", LIBMTP_PROPERTY_TimetoLive, PTP_OPC_TimetoLive); register_property("Media GUID", LIBMTP_PROPERTY_MediaGUID, PTP_OPC_MediaGUID); register_property("Total Bit Rate", LIBMTP_PROPERTY_TotalBitRate, PTP_OPC_TotalBitRate); register_property("Bit Rate Type", LIBMTP_PROPERTY_BitRateType, PTP_OPC_BitRateType); register_property("Sample Rate", LIBMTP_PROPERTY_SampleRate, PTP_OPC_SampleRate); register_property("Number Of Channels", LIBMTP_PROPERTY_NumberOfChannels, PTP_OPC_NumberOfChannels); register_property("Audio Bit Depth", LIBMTP_PROPERTY_AudioBitDepth, PTP_OPC_AudioBitDepth); register_property("Scan Depth", LIBMTP_PROPERTY_ScanDepth, PTP_OPC_ScanDepth); register_property("Audio WAVE Codec", LIBMTP_PROPERTY_AudioWAVECodec, PTP_OPC_AudioWAVECodec); register_property("Audio Bit Rate", LIBMTP_PROPERTY_AudioBitRate, PTP_OPC_AudioBitRate); register_property("Video Four CC Codec", LIBMTP_PROPERTY_VideoFourCCCodec, PTP_OPC_VideoFourCCCodec); register_property("Video Bit Rate", LIBMTP_PROPERTY_VideoBitRate, PTP_OPC_VideoBitRate); register_property("Frames Per Thousand Seconds", LIBMTP_PROPERTY_FramesPerThousandSeconds, PTP_OPC_FramesPerThousandSeconds); register_property("Key Frame Distance", LIBMTP_PROPERTY_KeyFrameDistance, PTP_OPC_KeyFrameDistance); register_property("Buffer Size", LIBMTP_PROPERTY_BufferSize, PTP_OPC_BufferSize); register_property("Encoding Quality", LIBMTP_PROPERTY_EncodingQuality, PTP_OPC_EncodingQuality); register_property("Encoding Profile", LIBMTP_PROPERTY_EncodingProfile, PTP_OPC_EncodingProfile); register_property("Buy flag", LIBMTP_PROPERTY_BuyFlag, PTP_OPC_BuyFlag); register_property("Unknown property", LIBMTP_PROPERTY_UNKNOWN, 0); } /** * Returns the PTP property that maps to a certain libmtp internal property type. * @param inproperty the MTP library interface property * @return the PTP (libgphoto2) property type */ static uint16_t map_libmtp_property_to_ptp_property(LIBMTP_property_t inproperty) { propertymap_t *current; current = g_propertymap; while (current != NULL) { if(current->id == inproperty) { return current->ptp_id; } current = current->next; } return 0; } /** * Returns the MTP internal interface property that maps to a certain ptp * interface property. * @param inproperty the PTP (libgphoto2) interface property * @return the MTP library interface property */ static LIBMTP_property_t map_ptp_property_to_libmtp_property(uint16_t inproperty) { propertymap_t *current; current = g_propertymap; while (current != NULL) { if(current->ptp_id == inproperty) { return current->id; } current = current->next; } // printf("map_ptp_type_to_libmtp_type: unknown filetype.\n"); return LIBMTP_PROPERTY_UNKNOWN; } /** * Set the debug level. * * By default, the debug level is set to '0' (disable). */ void LIBMTP_Set_Debug(int level) { if (LIBMTP_debug || level) LIBMTP_ERROR("LIBMTP_Set_Debug: Setting debugging level to %d (0x%02x) " "(%s)\n", level, level, level ? "on" : "off"); LIBMTP_debug = level; } /** * Initialize the library. You are only supposed to call this * one, before using the library for the first time in a program. * Never re-initialize libmtp! * * The only thing this does at the moment is to initialise the * filetype mapping table, as well as load MTPZ data if necessary. */ void LIBMTP_Init(void) { const char *env_debug = getenv("LIBMTP_DEBUG"); if (env_debug) { const long debug_flags = strtol(env_debug, NULL, 0); if (debug_flags != LONG_MIN && debug_flags != LONG_MAX && INT_MIN <= debug_flags && debug_flags <= INT_MAX) { LIBMTP_Set_Debug(debug_flags); } else { fprintf(stderr, "LIBMTP_Init: error setting debug flags from environment " "value \"%s\"\n", env_debug); } } init_filemap(); init_propertymap(); if (mtpz_loaddata() == -1) use_mtpz = 0; else use_mtpz = 1; return; } /** * This helper function returns a textual description for a libmtp * file type to be used in dialog boxes etc. * @param intype the libmtp internal filetype to get a description for. * @return a string representing the filetype, this must NOT * be free():ed by the caller! */ char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t intype) { filemap_t *current; current = g_filemap; while (current != NULL) { if(current->id == intype) { return current->description; } current = current->next; } return "Unknown filetype"; } /** * This helper function returns a textual description for a libmtp * property to be used in dialog boxes etc. * @param inproperty the libmtp internal property to get a description for. * @return a string representing the filetype, this must NOT * be free():ed by the caller! */ char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty) { propertymap_t *current; current = g_propertymap; while (current != NULL) { if(current->id == inproperty) { return current->description; } current = current->next; } return "Unknown property"; } /** * This function will do its best to fit a 16bit * value into a PTP object property if the property * is limited in range or step sizes. */ static uint16_t adjust_u16(uint16_t val, PTPObjectPropDesc *opd) { switch (opd->FormFlag) { case PTP_DPFF_Range: if (val < opd->FORM.Range.MinimumValue.u16) { return opd->FORM.Range.MinimumValue.u16; } if (val > opd->FORM.Range.MaximumValue.u16) { return opd->FORM.Range.MaximumValue.u16; } // Round down to last step. if (val % opd->FORM.Range.StepSize.u16 != 0) { return val - (val % opd->FORM.Range.StepSize.u16); } return val; break; case PTP_DPFF_Enumeration: { int i; uint16_t bestfit = opd->FORM.Enum.SupportedValue[0].u16; for (i=0; iFORM.Enum.NumberOfValues; i++) { if (val == opd->FORM.Enum.SupportedValue[i].u16) { return val; } // Rough guess of best fit if (opd->FORM.Enum.SupportedValue[i].u16 < val) { bestfit = opd->FORM.Enum.SupportedValue[i].u16; } } // Just some default that'll work. return bestfit; } default: // Will accept any value break; } return val; } /** * This function will do its best to fit a 32bit * value into a PTP object property if the property * is limited in range or step sizes. */ static uint32_t adjust_u32(uint32_t val, PTPObjectPropDesc *opd) { switch (opd->FormFlag) { case PTP_DPFF_Range: if (val < opd->FORM.Range.MinimumValue.u32) { return opd->FORM.Range.MinimumValue.u32; } if (val > opd->FORM.Range.MaximumValue.u32) { return opd->FORM.Range.MaximumValue.u32; } // Round down to last step. if (val % opd->FORM.Range.StepSize.u32 != 0) { return val - (val % opd->FORM.Range.StepSize.u32); } return val; break; case PTP_DPFF_Enumeration: { int i; uint32_t bestfit = opd->FORM.Enum.SupportedValue[0].u32; for (i=0; iFORM.Enum.NumberOfValues; i++) { if (val == opd->FORM.Enum.SupportedValue[i].u32) { return val; } // Rough guess of best fit if (opd->FORM.Enum.SupportedValue[i].u32 < val) { bestfit = opd->FORM.Enum.SupportedValue[i].u32; } } // Just some default that'll work. return bestfit; } default: // Will accept any value break; } return val; } /** * This function returns a newly created ISO 8601 timestamp with the * current time in as high precision as possible. It even adds * the time zone if it can. */ static char *get_iso8601_stamp(void) { time_t curtime; struct tm *loctime; char tmp[64]; curtime = time(NULL); loctime = localtime(&curtime); strftime (tmp, sizeof(tmp), "%Y%m%dT%H%M%S.0%z", loctime); return strdup(tmp); } /** * Gets the allowed values (range or enum) for a property * @param device a pointer to an MTP device * @param property the property to query * @param filetype the filetype of the object you want to set values for * @param allowed_vals pointer to a LIBMTP_allowed_values_t struct to * receive the allowed values. Call LIBMTP_destroy_allowed_values_t * on this on successful completion. * @return 0 on success, any other value means failure */ int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t *device, LIBMTP_property_t const property, LIBMTP_filetype_t const filetype, LIBMTP_allowed_values_t *allowed_vals) { PTPObjectPropDesc opd; uint16_t ret = 0; ret = ptp_mtp_getobjectpropdesc(device->params, map_libmtp_property_to_ptp_property(property), map_libmtp_type_to_ptp_type(filetype), &opd); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Allowed_Property_Values(): could not get property description."); return -1; } if (opd.FormFlag == PTP_OPFF_Enumeration) { int i = 0; allowed_vals->is_range = 0; allowed_vals->num_entries = opd.FORM.Enum.NumberOfValues; switch (opd.DataType) { case PTP_DTC_INT8: allowed_vals->i8vals = malloc(sizeof(int8_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_INT8; break; case PTP_DTC_UINT8: allowed_vals->u8vals = malloc(sizeof(uint8_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_UINT8; break; case PTP_DTC_INT16: allowed_vals->i16vals = malloc(sizeof(int16_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_INT16; break; case PTP_DTC_UINT16: allowed_vals->u16vals = malloc(sizeof(uint16_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_UINT16; break; case PTP_DTC_INT32: allowed_vals->i32vals = malloc(sizeof(int32_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_INT32; break; case PTP_DTC_UINT32: allowed_vals->u32vals = malloc(sizeof(uint32_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_UINT32; break; case PTP_DTC_INT64: allowed_vals->i64vals = malloc(sizeof(int64_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_INT64; break; case PTP_DTC_UINT64: allowed_vals->u64vals = malloc(sizeof(uint64_t) * opd.FORM.Enum.NumberOfValues); allowed_vals->datatype = LIBMTP_DATATYPE_UINT64; break; } for (i = 0; i < opd.FORM.Enum.NumberOfValues; i++) { switch (opd.DataType) { case PTP_DTC_INT8: allowed_vals->i8vals[i] = opd.FORM.Enum.SupportedValue[i].i8; break; case PTP_DTC_UINT8: allowed_vals->u8vals[i] = opd.FORM.Enum.SupportedValue[i].u8; break; case PTP_DTC_INT16: allowed_vals->i16vals[i] = opd.FORM.Enum.SupportedValue[i].i16; break; case PTP_DTC_UINT16: allowed_vals->u16vals[i] = opd.FORM.Enum.SupportedValue[i].u16; break; case PTP_DTC_INT32: allowed_vals->i32vals[i] = opd.FORM.Enum.SupportedValue[i].i32; break; case PTP_DTC_UINT32: allowed_vals->u32vals[i] = opd.FORM.Enum.SupportedValue[i].u32; break; case PTP_DTC_INT64: allowed_vals->i64vals[i] = opd.FORM.Enum.SupportedValue[i].i64; break; case PTP_DTC_UINT64: allowed_vals->u64vals[i] = opd.FORM.Enum.SupportedValue[i].u64; break; } } ptp_free_objectpropdesc(&opd); return 0; } else if (opd.FormFlag == PTP_OPFF_Range) { allowed_vals->is_range = 1; switch (opd.DataType) { case PTP_DTC_INT8: allowed_vals->i8min = opd.FORM.Range.MinimumValue.i8; allowed_vals->i8max = opd.FORM.Range.MaximumValue.i8; allowed_vals->i8step = opd.FORM.Range.StepSize.i8; allowed_vals->datatype = LIBMTP_DATATYPE_INT8; break; case PTP_DTC_UINT8: allowed_vals->u8min = opd.FORM.Range.MinimumValue.u8; allowed_vals->u8max = opd.FORM.Range.MaximumValue.u8; allowed_vals->u8step = opd.FORM.Range.StepSize.u8; allowed_vals->datatype = LIBMTP_DATATYPE_UINT8; break; case PTP_DTC_INT16: allowed_vals->i16min = opd.FORM.Range.MinimumValue.i16; allowed_vals->i16max = opd.FORM.Range.MaximumValue.i16; allowed_vals->i16step = opd.FORM.Range.StepSize.i16; allowed_vals->datatype = LIBMTP_DATATYPE_INT16; break; case PTP_DTC_UINT16: allowed_vals->u16min = opd.FORM.Range.MinimumValue.u16; allowed_vals->u16max = opd.FORM.Range.MaximumValue.u16; allowed_vals->u16step = opd.FORM.Range.StepSize.u16; allowed_vals->datatype = LIBMTP_DATATYPE_UINT16; break; case PTP_DTC_INT32: allowed_vals->i32min = opd.FORM.Range.MinimumValue.i32; allowed_vals->i32max = opd.FORM.Range.MaximumValue.i32; allowed_vals->i32step = opd.FORM.Range.StepSize.i32; allowed_vals->datatype = LIBMTP_DATATYPE_INT32; break; case PTP_DTC_UINT32: allowed_vals->u32min = opd.FORM.Range.MinimumValue.u32; allowed_vals->u32max = opd.FORM.Range.MaximumValue.u32; allowed_vals->u32step = opd.FORM.Range.StepSize.u32; allowed_vals->datatype = LIBMTP_DATATYPE_UINT32; break; case PTP_DTC_INT64: allowed_vals->i64min = opd.FORM.Range.MinimumValue.i64; allowed_vals->i64max = opd.FORM.Range.MaximumValue.i64; allowed_vals->i64step = opd.FORM.Range.StepSize.i64; allowed_vals->datatype = LIBMTP_DATATYPE_INT64; break; case PTP_DTC_UINT64: allowed_vals->u64min = opd.FORM.Range.MinimumValue.u64; allowed_vals->u64max = opd.FORM.Range.MaximumValue.u64; allowed_vals->u64step = opd.FORM.Range.StepSize.u64; allowed_vals->datatype = LIBMTP_DATATYPE_UINT64; break; } return 0; } else return -1; } /** * Destroys a LIBMTP_allowed_values_t struct * @param allowed_vals the struct to destroy */ void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t *allowed_vals) { if (!allowed_vals->is_range) { switch (allowed_vals->datatype) { case LIBMTP_DATATYPE_INT8: if (allowed_vals->i8vals) free(allowed_vals->i8vals); break; case LIBMTP_DATATYPE_UINT8: if (allowed_vals->u8vals) free(allowed_vals->u8vals); break; case LIBMTP_DATATYPE_INT16: if (allowed_vals->i16vals) free(allowed_vals->i16vals); break; case LIBMTP_DATATYPE_UINT16: if (allowed_vals->u16vals) free(allowed_vals->u16vals); break; case LIBMTP_DATATYPE_INT32: if (allowed_vals->i32vals) free(allowed_vals->i32vals); break; case LIBMTP_DATATYPE_UINT32: if (allowed_vals->u32vals) free(allowed_vals->u32vals); break; case LIBMTP_DATATYPE_INT64: if (allowed_vals->i64vals) free(allowed_vals->i64vals); break; case LIBMTP_DATATYPE_UINT64: if (allowed_vals->u64vals) free(allowed_vals->u64vals); break; } } } /** * Determine if a property is supported for a given file type * @param device a pointer to an MTP device * @param property the property to query * @param filetype the filetype of the object you want to set values for * @return 0 if not supported, positive if supported, negative on error */ int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t *device, LIBMTP_property_t const property, LIBMTP_filetype_t const filetype) { uint16_t *props = NULL; uint32_t propcnt = 0; uint16_t ret = 0; int i = 0; int supported = 0; uint16_t ptp_prop = map_libmtp_property_to_ptp_property(property); if (!ptp_operation_issupported(device->params, PTP_OC_MTP_GetObjectPropsSupported)) return 0; ret = ptp_mtp_getobjectpropssupported(device->params, map_libmtp_type_to_ptp_type(filetype), &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Is_Property_Supported(): could not get properties supported."); return -1; } for (i = 0; i < propcnt; i++) { if (props[i] == ptp_prop) { supported = 1; break; } } free(props); return supported; } /** * Retrieves a string from an object * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @return valid string or NULL on failure. The returned string * must bee free():ed by the caller after * use. */ char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id) { return get_string_from_object(device, object_id, attribute_id); } /** * Retrieves an unsigned 64-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value_default Default value to return on failure * @return the value */ uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, LIBMTP_property_t const attribute_id, uint64_t const value_default) { return get_u64_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value_default); } /** * Retrieves an unsigned 32-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value_default Default value to return on failure * @return the value */ uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, LIBMTP_property_t const attribute_id, uint32_t const value_default) { return get_u32_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value_default); } /** * Retrieves an unsigned 16-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value_default Default value to return on failure * @return a value */ uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id, uint16_t const value_default) { return get_u16_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value_default); } /** * Retrieves an unsigned 8-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value_default Default value to return on failure * @return a value */ uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id, uint8_t const value_default) { return get_u8_from_object(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value_default); } /** * Sets an object attribute from a string * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param string string value to set * @return 0 on success, any other value means failure */ int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id, char const * const string) { return set_object_string(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), string); } /** * Sets an object attribute from an unsigned 32-bit integer * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value 32-bit unsigned integer to set * @return 0 on success, any other value means failure */ int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id, uint32_t const value) { return set_object_u32(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value); } /** * Sets an object attribute from an unsigned 16-bit integer * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value 16-bit unsigned integer to set * @return 0 on success, any other value means failure */ int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id, uint16_t const value) { return set_object_u16(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value); } /** * Sets an object attribute from an unsigned 8-bit integer * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id MTP attribute ID * @param value 8-bit unsigned integer to set * @return 0 on success, any other value means failure */ int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *device, uint32_t const object_id, LIBMTP_property_t const attribute_id, uint8_t const value) { return set_object_u8(device, object_id, map_libmtp_property_to_ptp_property(attribute_id), value); } /** * Retrieves a string from an object * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @return valid string or NULL on failure. The returned string * must bee free():ed by the caller after * use. */ static char *get_string_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id) { PTPPropertyValue propval; char *retstring = NULL; PTPParams *params; uint16_t ret; MTPProperties *prop; if (!device || !object_id) return NULL; params = (PTPParams *) device->params; prop = ptp_find_object_prop_in_cache(params, object_id, attribute_id); if (prop) { if (prop->propval.str != NULL) return strdup(prop->propval.str); else return NULL; } ret = ptp_mtp_getobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_STR); if (ret == PTP_RC_OK) { if (propval.str != NULL) { retstring = (char *) strdup(propval.str); free(propval.str); } } else { add_ptp_error_to_errorstack(device, ret, "get_string_from_object(): could not get object string."); } return retstring; } /** * Retrieves an unsigned 64-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value_default Default value to return on failure * @return the value */ static uint64_t get_u64_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, uint16_t const attribute_id, uint64_t const value_default) { PTPPropertyValue propval; uint64_t retval = value_default; PTPParams *params; uint16_t ret; MTPProperties *prop; if (!device) return value_default; params = (PTPParams *) device->params; prop = ptp_find_object_prop_in_cache(params, object_id, attribute_id); if (prop) return prop->propval.u64; ret = ptp_mtp_getobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT64); if (ret == PTP_RC_OK) { retval = propval.u64; } else { add_ptp_error_to_errorstack(device, ret, "get_u64_from_object(): could not get unsigned 64bit integer from object."); } return retval; } /** * Retrieves an unsigned 32-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value_default Default value to return on failure * @return the value */ static uint32_t get_u32_from_object(LIBMTP_mtpdevice_t *device,uint32_t const object_id, uint16_t const attribute_id, uint32_t const value_default) { PTPPropertyValue propval; uint32_t retval = value_default; PTPParams *params; uint16_t ret; MTPProperties *prop; if (!device) return value_default; params = (PTPParams *) device->params; prop = ptp_find_object_prop_in_cache(params, object_id, attribute_id); if (prop) return prop->propval.u32; ret = ptp_mtp_getobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT32); if (ret == PTP_RC_OK) { retval = propval.u32; } else { add_ptp_error_to_errorstack(device, ret, "get_u32_from_object(): could not get unsigned 32bit integer from object."); } return retval; } /** * Retrieves an unsigned 16-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value_default Default value to return on failure * @return a value */ static uint16_t get_u16_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint16_t const value_default) { PTPPropertyValue propval; uint16_t retval = value_default; PTPParams *params; uint16_t ret; MTPProperties *prop; if (!device) return value_default; params = (PTPParams *) device->params; // This O(n) search should not be used so often, since code // using the cached properties don't usually call this function. prop = ptp_find_object_prop_in_cache(params, object_id, attribute_id); if (prop) return prop->propval.u16; ret = ptp_mtp_getobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT16); if (ret == PTP_RC_OK) { retval = propval.u16; } else { add_ptp_error_to_errorstack(device, ret, "get_u16_from_object(): could not get unsigned 16bit integer from object."); } return retval; } /** * Retrieves an unsigned 8-bit integer from an object attribute * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value_default Default value to return on failure * @return a value */ static uint8_t get_u8_from_object(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint8_t const value_default) { PTPPropertyValue propval; uint8_t retval = value_default; PTPParams *params; uint16_t ret; MTPProperties *prop; if (!device) return value_default; params = (PTPParams *) device->params; // This O(n) search should not be used so often, since code // using the cached properties don't usually call this function. prop = ptp_find_object_prop_in_cache(params, object_id, attribute_id); if (prop) return prop->propval.u8; ret = ptp_mtp_getobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT8); if (ret == PTP_RC_OK) { retval = propval.u8; } else { add_ptp_error_to_errorstack(device, ret, "get_u8_from_object(): could not get unsigned 8bit integer from object."); } return retval; } /** * Sets an object attribute from a string * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param string string value to set * @return 0 on success, any other value means failure */ static int set_object_string(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, char const * const string) { PTPPropertyValue propval; PTPParams *params; uint16_t ret; if (!device || !string) return -1; params = (PTPParams *) device->params; if (!ptp_operation_issupported(params,PTP_OC_MTP_SetObjectPropValue)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_string(): could not set object string: " "PTP_OC_MTP_SetObjectPropValue not supported."); return -1; } propval.str = (char *) string; ret = ptp_mtp_setobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_STR); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "set_object_string(): could not set object string."); return -1; } return 0; } /** * Sets an object attribute from an unsigned 32-bit integer * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value 32-bit unsigned integer to set * @return 0 on success, any other value means failure */ static int set_object_u32(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint32_t const value) { PTPPropertyValue propval; PTPParams *params; uint16_t ret; if (!device) return -1; params = (PTPParams *) device->params; if (!ptp_operation_issupported(params,PTP_OC_MTP_SetObjectPropValue)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_u32(): could not set unsigned 32bit integer property: " "PTP_OC_MTP_SetObjectPropValue not supported."); return -1; } propval.u32 = value; ret = ptp_mtp_setobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT32); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "set_object_u32(): could not set unsigned 32bit integer property."); return -1; } return 0; } /** * Sets an object attribute from an unsigned 16-bit integer * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value 16-bit unsigned integer to set * @return 0 on success, any other value means failure */ static int set_object_u16(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint16_t const value) { PTPPropertyValue propval; PTPParams *params; uint16_t ret; if (!device) return 1; params = (PTPParams *) device->params; if (!ptp_operation_issupported(params,PTP_OC_MTP_SetObjectPropValue)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_u16(): could not set unsigned 16bit integer property: " "PTP_OC_MTP_SetObjectPropValue not supported."); return -1; } propval.u16 = value; ret = ptp_mtp_setobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT16); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "set_object_u16(): could not set unsigned 16bit integer property."); return 1; } return 0; } /** * Sets an object attribute from an unsigned 8-bit integer * * @param device a pointer to an MTP device. * @param object_id Object reference * @param attribute_id PTP attribute ID * @param value 8-bit unsigned integer to set * @return 0 on success, any other value means failure */ static int set_object_u8(LIBMTP_mtpdevice_t *device, uint32_t const object_id, uint16_t const attribute_id, uint8_t const value) { PTPPropertyValue propval; PTPParams *params; uint16_t ret; if (!device) return 1; params = (PTPParams *) device->params; if (!ptp_operation_issupported(params,PTP_OC_MTP_SetObjectPropValue)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_u8(): could not set unsigned 8bit integer property: " "PTP_OC_MTP_SetObjectPropValue not supported."); return -1; } propval.u8 = value; ret = ptp_mtp_setobjectpropvalue(params, object_id, attribute_id, &propval, PTP_DTC_UINT8); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "set_object_u8(): could not set unsigned 8bit integer property."); return 1; } return 0; } /** * Get the first (as in "first in the list of") connected MTP device. * @return a device pointer. * @see LIBMTP_Get_Connected_Devices() */ LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void) { LIBMTP_mtpdevice_t *first_device = NULL; LIBMTP_raw_device_t *devices; int numdevs; LIBMTP_error_number_t ret; ret = LIBMTP_Detect_Raw_Devices(&devices, &numdevs); if (ret != LIBMTP_ERROR_NONE) { return NULL; } if (devices == NULL || numdevs == 0) { free(devices); return NULL; } first_device = LIBMTP_Open_Raw_Device(&devices[0]); free(devices); return first_device; } /** * Overriding debug function. * This way we can disable debug prints. */ static void #ifdef __GNUC__ __attribute__((__format__(printf,2,0))) #endif LIBMTP_ptp_debug(void *data, const char *format, va_list args) { if ((LIBMTP_debug & LIBMTP_DEBUG_PTP) != 0) { vfprintf (stderr, format, args); fprintf (stderr, "\n"); fflush (stderr); } } /** * Overriding error function. * This way we can capture all error etc to our errorstack. */ static void #ifdef __GNUC__ __attribute__((__format__(printf,2,0))) #endif LIBMTP_ptp_error(void *data, const char *format, va_list args) { // if (data == NULL) { vfprintf (stderr, format, args); fflush (stderr); /* FIXME: find out how we shall get the device here. } else { PTP_USB *ptp_usb = data; LIBMTP_mtpdevice_t *device = ...; char buf[2048]; vsnprintf (buf, sizeof (buf), format, args); add_error_to_errorstack(device, LIBMTP_ERROR_PTP_LAYER, buf); } */ } /** * Parses the extension descriptor, there may be stuff in * this that we want to know about. */ static void parse_extension_descriptor(LIBMTP_mtpdevice_t *mtpdevice, char *desc) { int start = 0; int end = 0; /* NULL on Canon A70 */ if (!desc) return; /* descriptors are divided by semicolons */ while (end < strlen(desc)) { /* Skip past initial whitespace */ while ((end < strlen(desc)) && (desc[start] == ' ' )) { start++; end++; } /* Detect extension */ while ((end < strlen(desc)) && (desc[end] != ';')) end++; if (end < strlen(desc)) { char *element = strndup(desc + start, end-start); if (element) { int i = 0; // printf(" Element: \"%s\"\n", element); /* Parse for an extension */ while ((i < strlen(element)) && (element[i] != ':')) i++; if (i < strlen(element)) { char *name = strndup(element, i); int majstart = i+1; // printf(" Extension: \"%s\"\n", name); /* Parse for minor/major punctuation mark for this extension */ while ((i < strlen(element)) && (element[i] != '.')) i++; if (i > majstart && i < strlen(element)) { LIBMTP_device_extension_t *extension; int major = 0; int minor = 0; char *majorstr = strndup(element + majstart, i - majstart); char *minorstr = strndup(element + i + 1, strlen(element) - i - 1); major = atoi(majorstr); minor = atoi(minorstr); // printf(" Major: \"%s\" (parsed %d) Minor: \"%s\" (parsed %d)\n", // majorstr, major, minorstr, minor); free(majorstr); free(minorstr); extension = malloc(sizeof(LIBMTP_device_extension_t)); extension->name = name; extension->major = major; extension->minor = minor; extension->next = NULL; if (mtpdevice->extensions == NULL) { mtpdevice->extensions = extension; } else { LIBMTP_device_extension_t *tmp = mtpdevice->extensions; while (tmp->next != NULL) tmp = tmp->next; tmp->next = extension; } } else { LIBMTP_ERROR("LIBMTP ERROR: couldnt parse extension %s\n", element); } } free(element); } } end++; start = end; } } /** * This function opens a device from a raw device. It is the * preferred way to access devices in the new interface where * several devices can come and go as the library is working * on a certain device. * @param rawdevice the raw device to open a "real" device for. * @return an open device. */ LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *rawdevice) { LIBMTP_mtpdevice_t *mtp_device; uint8_t bs = 0; PTPParams *current_params; PTP_USB *ptp_usb; LIBMTP_error_number_t err; int i; /* Allocate dynamic space for our device */ mtp_device = (LIBMTP_mtpdevice_t *) malloc(sizeof(LIBMTP_mtpdevice_t)); /* Check if there was a memory allocation error */ if(mtp_device == NULL) { /* There has been an memory allocation error. We are going to ignore this device and attempt to continue */ /* TODO: This error statement could probably be a bit more robust */ LIBMTP_ERROR("LIBMTP PANIC: connect_usb_devices encountered a memory " "allocation error with device %d on bus %d, trying to continue", rawdevice->devnum, rawdevice->bus_location); return NULL; } memset(mtp_device, 0, sizeof(LIBMTP_mtpdevice_t)); // Non-cached by default mtp_device->cached = 0; /* Create PTP params */ current_params = (PTPParams *) malloc(sizeof(PTPParams)); if (current_params == NULL) { free(mtp_device); return NULL; } memset(current_params, 0, sizeof(PTPParams)); current_params->device_flags = rawdevice->device_entry.device_flags; current_params->nrofobjects = 0; current_params->objects = NULL; current_params->response_packet_size = 0; current_params->response_packet = NULL; /* This will be a pointer to PTP_USB later */ current_params->data = NULL; /* Set upp local debug and error functions */ current_params->debug_func = LIBMTP_ptp_debug; current_params->error_func = LIBMTP_ptp_error; /* TODO: Will this always be little endian? */ current_params->byteorder = PTP_DL_LE; current_params->cd_locale_to_ucs2 = iconv_open("UCS-2LE", "UTF-8"); current_params->cd_ucs2_to_locale = iconv_open("UTF-8", "UCS-2LE"); if(current_params->cd_locale_to_ucs2 == (iconv_t) -1 || current_params->cd_ucs2_to_locale == (iconv_t) -1) { LIBMTP_ERROR("LIBMTP PANIC: Cannot open iconv() converters to/from UCS-2!\n" "Too old stdlibc, glibc and libiconv?\n"); free(current_params); free(mtp_device); return NULL; } mtp_device->params = current_params; /* Create usbinfo, this also opens the session */ err = configure_usb_device(rawdevice, current_params, &mtp_device->usbinfo); if (err != LIBMTP_ERROR_NONE) { free(current_params); free(mtp_device); return NULL; } ptp_usb = (PTP_USB*) mtp_device->usbinfo; /* Set pointer back to params */ ptp_usb->params = current_params; /* Cache the device information for later use */ if (ptp_getdeviceinfo(current_params, ¤t_params->deviceinfo) != PTP_RC_OK) { LIBMTP_ERROR("LIBMTP PANIC: Unable to read device information on device " "%d on bus %d, trying to continue", rawdevice->devnum, rawdevice->bus_location); /* Prevent memory leaks for this device */ free(mtp_device->usbinfo); free(mtp_device->params); current_params = NULL; free(mtp_device); return NULL; } /* Check: if this is a PTP device, is it really tagged as MTP? */ if (current_params->deviceinfo.VendorExtensionID != 0x00000006) { LIBMTP_ERROR("LIBMTP WARNING: no MTP vendor extension on device " "%d on bus %d", rawdevice->devnum, rawdevice->bus_location); LIBMTP_ERROR("LIBMTP WARNING: VendorExtensionID: %08x", current_params->deviceinfo.VendorExtensionID); LIBMTP_ERROR("LIBMTP WARNING: VendorExtensionDesc: %s", current_params->deviceinfo.VendorExtensionDesc); LIBMTP_ERROR("LIBMTP WARNING: this typically means the device is PTP " "(i.e. a camera) but not an MTP device at all. " "Trying to continue anyway."); } parse_extension_descriptor(mtp_device, current_params->deviceinfo.VendorExtensionDesc); /* * Android has a number of bugs, force-assign these bug flags * if Android is encountered. Same thing for devices we detect * as SONY NWZ Walkmen. I have no clue what "sony.net/WMFU" means * I just know only NWZs have it. */ { LIBMTP_device_extension_t *tmpext = mtp_device->extensions; int is_microsoft_com_wpdna = 0; int is_android = 0; int is_sony_net_wmfu = 0; int is_sonyericsson_com_se = 0; /* Loop over extensions and set flags */ while (tmpext != NULL) { if (!strcmp(tmpext->name, "microsoft.com/WPDNA")) is_microsoft_com_wpdna = 1; if (!strcmp(tmpext->name, "android.com")) is_android = 1; if (!strcmp(tmpext->name, "sony.net/WMFU")) is_sony_net_wmfu = 1; if (!strcmp(tmpext->name, "sonyericsson.com/SE")) is_sonyericsson_com_se = 1; tmpext = tmpext->next; } /* Check for specific stacks */ if (is_microsoft_com_wpdna && is_sonyericsson_com_se && !is_android) { /* * The Aricent stack seems to be detected by providing WPDNA, the SonyEricsson * extension and NO Android extension. */ ptp_usb->rawdevice.device_entry.device_flags |= DEVICE_FLAGS_ARICENT_BUGS; LIBMTP_INFO("Aricent MTP stack device detected, assigning default bug flags\n"); } else if (is_android) { /* * If bugs are fixed in later versions, test on tmpext->major, tmpext->minor */ ptp_usb->rawdevice.device_entry.device_flags |= DEVICE_FLAGS_ANDROID_BUGS; LIBMTP_INFO("Android device detected, assigning default bug flags\n"); } else if (is_sony_net_wmfu) { ptp_usb->rawdevice.device_entry.device_flags |= DEVICE_FLAGS_SONY_NWZ_BUGS; LIBMTP_INFO("SONY NWZ device detected, assigning default bug flags\n"); } } /* * If the OGG or FLAC filetypes are flagged as "unknown", check * if the firmware has been updated to actually support it. */ if (FLAG_OGG_IS_UNKNOWN(ptp_usb)) { for (i=0;ideviceinfo.ImageFormats_len;i++) { if (current_params->deviceinfo.ImageFormats[i] == PTP_OFC_MTP_OGG) { /* This is not unknown anymore, unflag it */ ptp_usb->rawdevice.device_entry.device_flags &= ~DEVICE_FLAG_OGG_IS_UNKNOWN; break; } } } if (FLAG_FLAC_IS_UNKNOWN(ptp_usb)) { for (i=0;ideviceinfo.ImageFormats_len;i++) { if (current_params->deviceinfo.ImageFormats[i] == PTP_OFC_MTP_FLAC) { /* This is not unknown anymore, unflag it */ ptp_usb->rawdevice.device_entry.device_flags &= ~DEVICE_FLAG_FLAC_IS_UNKNOWN; break; } } } /* Determine if the object size supported is 32 or 64 bit wide */ if (ptp_operation_issupported(current_params,PTP_OC_MTP_GetObjectPropsSupported)) { for (i=0;ideviceinfo.ImageFormats_len;i++) { PTPObjectPropDesc opd; if (ptp_mtp_getobjectpropdesc(current_params, PTP_OPC_ObjectSize, current_params->deviceinfo.ImageFormats[i], &opd) != PTP_RC_OK) { LIBMTP_ERROR("LIBMTP PANIC: " "could not inspect object property descriptions!\n"); } else { if (opd.DataType == PTP_DTC_UINT32) { if (bs == 0) { bs = 32; } else if (bs != 32) { LIBMTP_ERROR("LIBMTP PANIC: " "different objects support different object sizes!\n"); bs = 0; break; } } else if (opd.DataType == PTP_DTC_UINT64) { if (bs == 0) { bs = 64; } else if (bs != 64) { LIBMTP_ERROR("LIBMTP PANIC: " "different objects support different object sizes!\n"); bs = 0; break; } } else { // Ignore if other size. LIBMTP_ERROR("LIBMTP PANIC: " "awkward object size data type: %04x\n", opd.DataType); bs = 0; break; } } } } if (bs == 0) { // Could not detect object bitsize, assume 32 bits bs = 32; } mtp_device->object_bitsize = bs; /* No Errors yet for this device */ mtp_device->errorstack = NULL; /* Default Max Battery Level, we will adjust this if possible */ mtp_device->maximum_battery_level = 100; /* Check if device supports reading maximum battery level */ if(!FLAG_BROKEN_BATTERY_LEVEL(ptp_usb) && ptp_property_issupported( current_params, PTP_DPC_BatteryLevel)) { PTPDevicePropDesc dpd; /* Try to read maximum battery level */ if(ptp_getdevicepropdesc(current_params, PTP_DPC_BatteryLevel, &dpd) != PTP_RC_OK) { add_error_to_errorstack(mtp_device, LIBMTP_ERROR_CONNECTING, "Unable to read Maximum Battery Level for this " "device even though the device supposedly " "supports this functionality"); } /* TODO: is this appropriate? */ /* If max battery level is 0 then leave the default, otherwise assign */ if (dpd.FORM.Range.MaximumValue.u8 != 0) { mtp_device->maximum_battery_level = dpd.FORM.Range.MaximumValue.u8; } ptp_free_devicepropdesc(&dpd); } /* Set all default folders to 0xffffffffU (root directory) */ mtp_device->default_music_folder = 0xffffffffU; mtp_device->default_playlist_folder = 0xffffffffU; mtp_device->default_picture_folder = 0xffffffffU; mtp_device->default_video_folder = 0xffffffffU; mtp_device->default_organizer_folder = 0xffffffffU; mtp_device->default_zencast_folder = 0xffffffffU; mtp_device->default_album_folder = 0xffffffffU; mtp_device->default_text_folder = 0xffffffffU; /* Set initial storage information */ mtp_device->storage = NULL; if (LIBMTP_Get_Storage(mtp_device, LIBMTP_STORAGE_SORTBY_NOTSORTED) == -1) { add_error_to_errorstack(mtp_device, LIBMTP_ERROR_GENERAL, "Get Storage information failed."); mtp_device->storage = NULL; } return mtp_device; } LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *rawdevice) { LIBMTP_mtpdevice_t *mtp_device = LIBMTP_Open_Raw_Device_Uncached(rawdevice); if (mtp_device == NULL) return NULL; /* Check for MTPZ devices. */ if (use_mtpz) { LIBMTP_device_extension_t *tmpext = mtp_device->extensions; while (tmpext != NULL) { if (!strcmp(tmpext->name, "microsoft.com/MTPZ")) { LIBMTP_INFO("MTPZ device detected. Authenticating...\n"); if (PTP_RC_OK == ptp_mtpz_handshake(mtp_device->params)) { LIBMTP_INFO ("(MTPZ) Successfully authenticated with device.\n"); } else { LIBMTP_INFO ("(MTPZ) Failure - could not authenticate with device.\n"); } break; } tmpext = tmpext->next; } } // Set up this device as cached mtp_device->cached = 1; /* * Then get the handles and try to locate the default folders. * This has the desired side effect of caching all handles from * the device which speeds up later operations. */ flush_handles(mtp_device); return mtp_device; } /** * To read events sent by the device, repeatedly call this function from a secondary * thread until the return value is < 0. * * @param device a pointer to the MTP device to poll for events. * @param event contains a pointer to be filled in with the event retrieved if the call * is successful. * @param out1 contains the param1 value from the raw event. * @return 0 on success, any other value means the polling loop shall be * terminated immediately for this session. */ int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *device, LIBMTP_event_t *event, uint32_t *out1) { /* * FIXME: Potential race-condition here, if client deallocs device * while we're *not* waiting for input. As we'll be waiting for * input most of the time, it's unlikely but still worth considering * for improvement. Also we cannot affect the state of the cache etc * unless we know we are the sole user on the device. A spinlock or * mutex in the LIBMTP_mtpdevice_t is needed for this to work. */ PTPParams *params = (PTPParams *) device->params; PTPContainer ptp_event; uint16_t ret = ptp_usb_event_wait(params, &ptp_event); uint16_t code; uint32_t session_id; uint32_t param1; if (ret != PTP_RC_OK) { /* Device is closing down or other fatal stuff, exit thread */ return -1; } *event = LIBMTP_EVENT_NONE; /* Process the event */ code = ptp_event.Code; session_id = ptp_event.SessionID; param1 = ptp_event.Param1; switch(code) { case PTP_EC_Undefined: LIBMTP_INFO("Received event PTP_EC_Undefined in session %u\n", session_id); break; case PTP_EC_CancelTransaction: LIBMTP_INFO("Received event PTP_EC_CancelTransaction in session %u\n", session_id); break; case PTP_EC_ObjectAdded: LIBMTP_INFO("Received event PTP_EC_ObjectAdded in session %u\n", session_id); *event = LIBMTP_EVENT_OBJECT_ADDED; *out1 = param1; break; case PTP_EC_ObjectRemoved: LIBMTP_INFO("Received event PTP_EC_ObjectRemoved in session %u\n", session_id); *event = LIBMTP_EVENT_OBJECT_REMOVED; *out1 = param1; break; case PTP_EC_StoreAdded: LIBMTP_INFO("Received event PTP_EC_StoreAdded in session %u\n", session_id); /* TODO: rescan storages */ *event = LIBMTP_EVENT_STORE_ADDED; *out1 = param1; break; case PTP_EC_StoreRemoved: LIBMTP_INFO("Received event PTP_EC_StoreRemoved in session %u\n", session_id); /* TODO: rescan storages */ *event = LIBMTP_EVENT_STORE_REMOVED; *out1 = param1; break; case PTP_EC_DevicePropChanged: LIBMTP_INFO("Received event PTP_EC_DevicePropChanged in session %u\n", session_id); /* TODO: update device properties */ break; case PTP_EC_ObjectInfoChanged: LIBMTP_INFO("Received event PTP_EC_ObjectInfoChanged in session %u\n", session_id); /* TODO: rescan object cache or just for this one object */ break; case PTP_EC_DeviceInfoChanged: LIBMTP_INFO("Received event PTP_EC_DeviceInfoChanged in session %u\n", session_id); /* TODO: update device info */ break; case PTP_EC_RequestObjectTransfer: LIBMTP_INFO("Received event PTP_EC_RequestObjectTransfer in session %u\n", session_id); break; case PTP_EC_StoreFull: LIBMTP_INFO("Received event PTP_EC_StoreFull in session %u\n", session_id); break; case PTP_EC_DeviceReset: LIBMTP_INFO("Received event PTP_EC_DeviceReset in session %u\n", session_id); break; case PTP_EC_StorageInfoChanged : LIBMTP_INFO( "Received event PTP_EC_StorageInfoChanged in session %u\n", session_id); /* TODO: update storage info */ break; case PTP_EC_CaptureComplete : LIBMTP_INFO( "Received event PTP_EC_CaptureComplete in session %u\n", session_id); break; case PTP_EC_UnreportedStatus : LIBMTP_INFO( "Received event PTP_EC_UnreportedStatus in session %u\n", session_id); break; default : LIBMTP_INFO( "Received unknown event in session %u\n", session_id); break; } return 0; } /** * Recursive function that adds MTP devices to a linked list * @param devices a list of raw devices to have real devices created for. * @return a device pointer to a newly created mtpdevice (used in linked * list creation). */ static LIBMTP_mtpdevice_t * create_usb_mtp_devices(LIBMTP_raw_device_t *devices, int numdevs) { uint8_t i; LIBMTP_mtpdevice_t *mtp_device_list = NULL; LIBMTP_mtpdevice_t *current_device = NULL; for (i=0; i < numdevs; i++) { LIBMTP_mtpdevice_t *mtp_device; mtp_device = LIBMTP_Open_Raw_Device(&devices[i]); /* On error, try next device */ if (mtp_device == NULL) continue; /* Add the device to the list */ mtp_device->next = NULL; if (mtp_device_list == NULL) { mtp_device_list = current_device = mtp_device; } else { current_device->next = mtp_device; current_device = mtp_device; } } return mtp_device_list; } /** * Get the number of devices that are available in the listed device list * @param device_list Pointer to a linked list of devices * @return Number of devices in the device list device_list * @see LIBMTP_Get_Connected_Devices() */ uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *device_list) { uint32_t numdevices = 0; LIBMTP_mtpdevice_t *iter; for(iter = device_list; iter != NULL; iter = iter->next) numdevices++; return numdevices; } /** * Get the first connected MTP device node in the linked list of devices. * Currently this only provides access to USB devices * @param device_list A list of devices ready to be used by the caller. You * need to know how many there are. * @return Any error information gathered from device connections * @see LIBMTP_Number_Devices_In_List() */ LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **device_list) { LIBMTP_raw_device_t *devices; int numdevs; LIBMTP_error_number_t ret; ret = LIBMTP_Detect_Raw_Devices(&devices, &numdevs); if (ret != LIBMTP_ERROR_NONE) { *device_list = NULL; return ret; } /* Assign linked list of devices */ if (devices == NULL || numdevs == 0) { *device_list = NULL; free(devices); return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } *device_list = create_usb_mtp_devices(devices, numdevs); free(devices); /* TODO: Add wifi device access here */ /* We have found some devices but create failed */ if (*device_list == NULL) return LIBMTP_ERROR_CONNECTING; return LIBMTP_ERROR_NONE; } /** * This closes and releases an allocated MTP device. * @param device a pointer to the MTP device to release. */ void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t *device) { if(device != NULL) { if(device->next != NULL) { LIBMTP_Release_Device_List(device->next); } LIBMTP_Release_Device(device); } } /** * This closes and releases an allocated MTP device. * @param device a pointer to the MTP device to release. */ void LIBMTP_Release_Device(LIBMTP_mtpdevice_t *device) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; close_device(ptp_usb, params); // Clear error stack LIBMTP_Clear_Errorstack(device); // Free iconv() converters... iconv_close(params->cd_locale_to_ucs2); iconv_close(params->cd_ucs2_to_locale); free(ptp_usb); ptp_free_params(params); free(params); free_storage_list(device); // Free extension list... if (device->extensions != NULL) { LIBMTP_device_extension_t *tmp = device->extensions; while (tmp != NULL) { LIBMTP_device_extension_t *next = tmp->next; if (tmp->name) free(tmp->name); free(tmp); tmp = next; } } free(device); } /** * This can be used by any libmtp-intrinsic code that * need to stack up an error on the stack. You are only * supposed to add errors to the error stack using this * function, do not create and reference error entries * directly. */ static void add_error_to_errorstack(LIBMTP_mtpdevice_t *device, LIBMTP_error_number_t errornumber, char const * const error_text) { LIBMTP_error_t *newerror; if (device == NULL) { LIBMTP_ERROR("LIBMTP PANIC: Trying to add error to a NULL device!\n"); return; } newerror = (LIBMTP_error_t *) malloc(sizeof(LIBMTP_error_t)); newerror->errornumber = errornumber; newerror->error_text = strdup(error_text); newerror->next = NULL; if (device->errorstack == NULL) { device->errorstack = newerror; } else { LIBMTP_error_t *tmp = device->errorstack; while (tmp->next != NULL) { tmp = tmp->next; } tmp->next = newerror; } } /** * Adds an error from the PTP layer to the error stack. */ static void add_ptp_error_to_errorstack(LIBMTP_mtpdevice_t *device, uint16_t ptp_error, char const * const error_text) { if (device == NULL) { LIBMTP_ERROR("LIBMTP PANIC: Trying to add PTP error to a NULL device!\n"); return; } else { char outstr[256]; snprintf(outstr, sizeof(outstr), "PTP Layer error %04x: %s", ptp_error, error_text); outstr[sizeof(outstr)-1] = '\0'; add_error_to_errorstack(device, LIBMTP_ERROR_PTP_LAYER, outstr); snprintf(outstr, sizeof(outstr), "Error %04x: %s", ptp_error, ptp_strerror(ptp_error)); outstr[sizeof(outstr)-1] = '\0'; add_error_to_errorstack(device, LIBMTP_ERROR_PTP_LAYER, outstr); } } /** * This returns the error stack for a device in case you * need to either reference the error numbers (e.g. when * creating multilingual apps with multiple-language text * representations for each error number) or when you need * to build a multi-line error text widget or something like * that. You need to call the LIBMTP_Clear_Errorstack * to clear it when you're finished with it. * @param device a pointer to the MTP device to get the error * stack for. * @return the error stack or NULL if there are no errors * on the stack. * @see LIBMTP_Clear_Errorstack() * @see LIBMTP_Dump_Errorstack() */ LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t *device) { if (device == NULL) { LIBMTP_ERROR("LIBMTP PANIC: Trying to get the error stack of a NULL device!\n"); return NULL; } return device->errorstack; } /** * This function clears the error stack of a device and frees * any memory used by it. Call this when you're finished with * using the errors. * @param device a pointer to the MTP device to clear the error * stack for. */ void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t *device) { if (device == NULL) { LIBMTP_ERROR("LIBMTP PANIC: Trying to clear the error stack of a NULL device!\n"); } else { LIBMTP_error_t *tmp = device->errorstack; while (tmp != NULL) { LIBMTP_error_t *tmp2; if (tmp->error_text != NULL) { free(tmp->error_text); } tmp2 = tmp; tmp = tmp->next; free(tmp2); } device->errorstack = NULL; } } /** * This function dumps the error stack to stderr. * (You still have to clear the stack though.) * @param device a pointer to the MTP device to dump the error * stack for. */ void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t *device) { if (device == NULL) { LIBMTP_ERROR("LIBMTP PANIC: Trying to dump the error stack of a NULL device!\n"); } else { LIBMTP_error_t *tmp = device->errorstack; while (tmp != NULL) { if (tmp->error_text != NULL) { LIBMTP_ERROR("Error %d: %s\n", tmp->errornumber, tmp->error_text); } else { LIBMTP_ERROR("Error %d: (unknown)\n", tmp->errornumber); } tmp = tmp->next; } } } /** * This command gets all handles and stuff by FAST directory retrieveal * which is available by getting all metadata for object * 0xffffffff which simply means "all metadata for all objects". * This works on the vast majority of MTP devices (there ARE exceptions!) * and is quite quick. Check the error stack to see if there were * problems getting the metadata. * @return 0 if all was OK, -1 on failure. */ static int get_all_metadata_fast(LIBMTP_mtpdevice_t *device) { PTPParams *params = (PTPParams *) device->params; int cnt = 0; int i, j, nrofprops; uint32_t lasthandle = 0xffffffff; MTPProperties *props = NULL; MTPProperties *prop; uint16_t ret; int oldtimeout; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; /* * The follow request causes the device to generate * a list of every file on the device and return it * in a single response. * * Some slow devices as well as devices with very * large file systems can easily take longer then * the standard timeout value before it is able * to return a response. * * Temporarly set timeout to allow working with * widest range of devices. */ get_usb_device_timeout(ptp_usb, &oldtimeout); set_usb_device_timeout(ptp_usb, 60000); ret = ptp_mtp_getobjectproplist(params, 0xffffffff, &props, &nrofprops); set_usb_device_timeout(ptp_usb, oldtimeout); if (ret == PTP_RC_MTP_Specification_By_Group_Unsupported) { // What's the point in the device implementing this command if // you cannot use it to get all props for AT LEAST one object? // Well, whatever... add_ptp_error_to_errorstack(device, ret, "get_all_metadata_fast(): " "cannot retrieve all metadata for an object on this device."); return -1; } if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "get_all_metadata_fast(): " "could not get proplist of all objects."); return -1; } if (props == NULL && nrofprops != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "get_all_metadata_fast(): " "call to ptp_mtp_getobjectproplist() returned " "inconsistent results."); return -1; } /* * We count the number of objects by counting the ObjectHandle * references, whenever it changes we get a new object, when it's * the same, it is just different properties of the same object. */ prop = props; for (i=0;iObjectHandle) { cnt++; lasthandle = prop->ObjectHandle; } prop++; } lasthandle = 0xffffffff; params->objects = calloc (cnt, sizeof(PTPObject)); prop = props; i = -1; for (j=0;jObjectHandle) { if (i >= 0) { params->objects[i].flags |= PTPOBJECT_OBJECTINFO_LOADED; if (!params->objects[i].oi.Filename) { /* I have one such file on my Creative (Marcus) */ params->objects[i].oi.Filename = strdup(""); } } i++; lasthandle = prop->ObjectHandle; params->objects[i].oid = prop->ObjectHandle; } switch (prop->property) { case PTP_OPC_ParentObject: params->objects[i].oi.ParentObject = prop->propval.u32; params->objects[i].flags |= PTPOBJECT_PARENTOBJECT_LOADED; break; case PTP_OPC_ObjectFormat: params->objects[i].oi.ObjectFormat = prop->propval.u16; break; case PTP_OPC_ObjectSize: // We loose precision here, up to 32 bits! However the commands that // retrieve metadata for files and tracks will make sure that the // PTP_OPC_ObjectSize is read in and duplicated again. if (device->object_bitsize == 64) { params->objects[i].oi.ObjectCompressedSize = (uint32_t) prop->propval.u64; } else { params->objects[i].oi.ObjectCompressedSize = prop->propval.u32; } break; case PTP_OPC_StorageID: params->objects[i].oi.StorageID = prop->propval.u32; params->objects[i].flags |= PTPOBJECT_STORAGEID_LOADED; break; case PTP_OPC_ObjectFileName: if (prop->propval.str != NULL) params->objects[i].oi.Filename = strdup(prop->propval.str); break; default: { MTPProperties *newprops; /* Copy all of the other MTP oprierties into the per-object proplist */ if (params->objects[i].nrofmtpprops) { newprops = realloc(params->objects[i].mtpprops, (params->objects[i].nrofmtpprops+1)*sizeof(MTPProperties)); } else { newprops = calloc(1,sizeof(MTPProperties)); } if (!newprops) return 0; /* FIXME: error handling? */ params->objects[i].mtpprops = newprops; memcpy(¶ms->objects[i].mtpprops[params->objects[i].nrofmtpprops], &props[j],sizeof(props[j])); params->objects[i].nrofmtpprops++; params->objects[i].flags |= PTPOBJECT_MTPPROPLIST_LOADED; break; } } prop++; } /* mark last entry also */ params->objects[i].flags |= PTPOBJECT_OBJECTINFO_LOADED; params->nrofobjects = i+1; free (props); /* The device might not give the list in linear ascending order */ ptp_objects_sort (params); return 0; } /** * This function will recurse through all the directories on the device, * starting at the root directory, gathering metadata as it moves along. * It works better on some devices that will only return data for a * certain directory and does not respect the option to get all metadata * for all objects. */ static void get_handles_recursively(LIBMTP_mtpdevice_t *device, PTPParams *params, uint32_t storageid, uint32_t parent) { PTPObjectHandles currentHandles; int i = 0; uint16_t ret = ptp_getobjecthandles(params, storageid, PTP_GOH_ALL_FORMATS, parent, ¤tHandles); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "get_handles_recursively(): could not get object handles."); return; } if (currentHandles.Handler == NULL || currentHandles.n == 0) return; // Now descend into any subdirectories found for (i = 0; i < currentHandles.n; i++) { PTPObject *ob; ret = ptp_object_want(params,currentHandles.Handler[i], PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret == PTP_RC_OK) { if (ob->oi.ObjectFormat == PTP_OFC_Association) get_handles_recursively(device, params, storageid, currentHandles.Handler[i]); } else { add_error_to_errorstack(device, LIBMTP_ERROR_CONNECTING, "Found a bad handle, trying to ignore it."); } } free(currentHandles.Handler); } /** * This function refresh the internal handle list whenever * the items stored inside the device is altered. On operations * that do not add or remove objects, this is typically not * called. * @param device a pointer to the MTP device to flush handles for. */ static void flush_handles(LIBMTP_mtpdevice_t *device) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; int ret; uint32_t i; if (!device->cached) { return; } if (params->objects != NULL) { for (i=0;inrofobjects;i++) ptp_free_object (¶ms->objects[i]); free(params->objects); params->objects = NULL; params->nrofobjects = 0; } if (ptp_operation_issupported(params,PTP_OC_MTP_GetObjPropList) && !FLAG_BROKEN_MTPGETOBJPROPLIST(ptp_usb) && !FLAG_BROKEN_MTPGETOBJPROPLIST_ALL(ptp_usb)) { // Use the fast method. Ignore return value for now. ret = get_all_metadata_fast(device); } // If the previous failed or returned no objects, use classic // methods instead. if (params->nrofobjects == 0) { // Get all the handles using just standard commands. if (device->storage == NULL) { get_handles_recursively(device, params, PTP_GOH_ALL_STORAGE, PTP_GOH_ROOT_PARENT); } else { // Get handles for each storage in turn. LIBMTP_devicestorage_t *storage = device->storage; while(storage != NULL) { get_handles_recursively(device, params, storage->id, PTP_GOH_ROOT_PARENT); storage = storage->next; } } } /* * Loop over the handles, fix up any NULL filenames or * keywords, then attempt to locate some default folders * in the root directory of the primary storage. */ for(i = 0; i < params->nrofobjects; i++) { PTPObject *ob, *xob; ob = ¶ms->objects[i]; ret = ptp_object_want(params,params->objects[i].oid, PTPOBJECT_OBJECTINFO_LOADED, &xob); if (ret != PTP_RC_OK) { LIBMTP_ERROR("broken! %x not found\n", params->objects[i].oid); } if (ob->oi.Filename == NULL) ob->oi.Filename = strdup(""); if (ob->oi.Keywords == NULL) ob->oi.Keywords = strdup(""); /* Ignore handles that point to non-folders */ if(ob->oi.ObjectFormat != PTP_OFC_Association) continue; /* Only look in the root folder */ if (ob->oi.ParentObject == 0xffffffffU) { LIBMTP_ERROR("object %x has parent 0xffffffff (-1) continuing anyway\n", ob->oid); } else if (ob->oi.ParentObject != 0x00000000U) continue; /* Only look in the primary storage */ if (device->storage != NULL && ob->oi.StorageID != device->storage->id) continue; /* Is this the Music Folder */ if (!strcasecmp(ob->oi.Filename, "My Music") || !strcasecmp(ob->oi.Filename, "My_Music") || !strcasecmp(ob->oi.Filename, "Music")) { device->default_music_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "My Playlists") || !strcasecmp(ob->oi.Filename, "My_Playlists") || !strcasecmp(ob->oi.Filename, "Playlists")) { device->default_playlist_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "My Pictures") || !strcasecmp(ob->oi.Filename, "My_Pictures") || !strcasecmp(ob->oi.Filename, "Pictures")) { device->default_picture_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "My Video") || !strcasecmp(ob->oi.Filename, "My_Video") || !strcasecmp(ob->oi.Filename, "Video")) { device->default_video_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "My Organizer") || !strcasecmp(ob->oi.Filename, "My_Organizer")) { device->default_organizer_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "ZENcast") || !strcasecmp(ob->oi.Filename, "Datacasts")) { device->default_zencast_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "My Albums") || !strcasecmp(ob->oi.Filename, "My_Albums") || !strcasecmp(ob->oi.Filename, "Albums")) { device->default_album_folder = ob->oid; } else if (!strcasecmp(ob->oi.Filename, "Text") || !strcasecmp(ob->oi.Filename, "Texts")) { device->default_text_folder = ob->oid; } } } /** * This function traverses a devices storage list freeing up the * strings and the structs. * @param device a pointer to the MTP device to free the storage * list for. */ static void free_storage_list(LIBMTP_mtpdevice_t *device) { LIBMTP_devicestorage_t *storage; LIBMTP_devicestorage_t *tmp; storage = device->storage; while(storage != NULL) { if (storage->StorageDescription != NULL) { free(storage->StorageDescription); } if (storage->VolumeIdentifier != NULL) { free(storage->VolumeIdentifier); } tmp = storage; storage = storage->next; free(tmp); } device->storage = NULL; return; } /** * This function traverses a devices storage list freeing up the * strings and the structs. * @param device a pointer to the MTP device to free the storage * list for. */ static int sort_storage_by(LIBMTP_mtpdevice_t *device,int const sortby) { LIBMTP_devicestorage_t *oldhead, *ptr1, *ptr2, *newlist; if (device->storage == NULL) return -1; if (sortby == LIBMTP_STORAGE_SORTBY_NOTSORTED) return 0; oldhead = ptr1 = ptr2 = device->storage; newlist = NULL; while(oldhead != NULL) { ptr1 = ptr2 = oldhead; while(ptr1 != NULL) { if (sortby == LIBMTP_STORAGE_SORTBY_FREESPACE && ptr1->FreeSpaceInBytes > ptr2->FreeSpaceInBytes) ptr2 = ptr1; if (sortby == LIBMTP_STORAGE_SORTBY_MAXSPACE && ptr1->FreeSpaceInBytes > ptr2->FreeSpaceInBytes) ptr2 = ptr1; ptr1 = ptr1->next; } // Make our previous entries next point to our next if(ptr2->prev != NULL) { ptr1 = ptr2->prev; ptr1->next = ptr2->next; } else { oldhead = ptr2->next; if(oldhead != NULL) oldhead->prev = NULL; } // Make our next entries previous point to our previous ptr1 = ptr2->next; if(ptr1 != NULL) { ptr1->prev = ptr2->prev; } else { ptr1 = ptr2->prev; if(ptr1 != NULL) ptr1->next = NULL; } if(newlist == NULL) { newlist = ptr2; newlist->prev = NULL; } else { ptr2->prev = newlist; newlist->next = ptr2; newlist = newlist->next; } } if (newlist != NULL) { newlist->next = NULL; while(newlist->prev != NULL) newlist = newlist->prev; device->storage = newlist; } return 0; } /** * This function grabs the first writeable storageid from the * device storage list. * @param device a pointer to the MTP device to locate writeable * storage for. * @param fitsize a file of this file must fit on the device. */ static uint32_t get_writeable_storageid(LIBMTP_mtpdevice_t *device, uint64_t fitsize) { LIBMTP_devicestorage_t *storage; uint32_t store = 0x00000000; //Should this be 0xffffffffu instead? int subcall_ret; // See if there is some storage we can fit this file on. storage = device->storage; if (storage == NULL) { // Sometimes the storage just cannot be detected. store = 0x00000000U; } else { while(storage != NULL) { // These storages cannot be used. if (storage->StorageType == PTP_ST_FixedROM || storage->StorageType == PTP_ST_RemovableROM) { storage = storage->next; continue; } // Storage IDs with the lower 16 bits 0x0000 are not supposed // to be writeable. if ((storage->id & 0x0000FFFFU) == 0x00000000U) { storage = storage->next; continue; } // Also check the access capability to avoid e.g. deletable only storages if (storage->AccessCapability == PTP_AC_ReadOnly || storage->AccessCapability == PTP_AC_ReadOnly_with_Object_Deletion) { storage = storage->next; continue; } // Then see if we can fit the file. subcall_ret = check_if_file_fits(device, storage, fitsize); if (subcall_ret != 0) { storage = storage->next; } else { // We found a storage that is writable and can fit the file! break; } } if (storage == NULL) { add_error_to_errorstack(device, LIBMTP_ERROR_STORAGE_FULL, "get_writeable_storageid(): " "all device storage is full or corrupt."); return -1; } store = storage->id; } return store; } /** * Tries to suggest a storage_id of a given ID when we have a parent * @param device a pointer to the device where to search for the storage ID * @param fitsize a file of this file must fit on the device. * @param parent_id look for this ID * @ret storageID */ static int get_suggested_storage_id(LIBMTP_mtpdevice_t *device, uint64_t fitsize, uint32_t parent_id) { PTPParams *params = (PTPParams *) device->params; PTPObject *ob; uint16_t ret; ret = ptp_object_want(params, parent_id, PTPOBJECT_MTPPROPLIST_LOADED, &ob); if ((ret != PTP_RC_OK) || (ob->oi.StorageID == 0)) { add_ptp_error_to_errorstack(device, ret, "get_suggested_storage_id(): " "could not get storage id from parent id."); return get_writeable_storageid(device, fitsize); } else { /* OK we know the parent storage, then use that */ return ob->oi.StorageID; } } /** * This function grabs the freespace from a certain storage in * device storage list. * @param device a pointer to the MTP device to free the storage * list for. * @param storageid the storage ID for the storage to flush and * get free space for. * @param freespace the free space on this storage will be returned * in this variable. */ static int get_storage_freespace(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage, uint64_t *freespace) { PTPParams *params = (PTPParams *) device->params; // Always query the device about this, since some models explicitly // needs that. We flush all data on queries storage here. if (ptp_operation_issupported(params,PTP_OC_GetStorageInfo)) { PTPStorageInfo storageInfo; uint16_t ret; ret = ptp_getstorageinfo(params, storage->id, &storageInfo); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "get_storage_freespace(): could not get storage info."); return -1; } if (storage->StorageDescription != NULL) { free(storage->StorageDescription); } if (storage->VolumeIdentifier != NULL) { free(storage->VolumeIdentifier); } storage->StorageType = storageInfo.StorageType; storage->FilesystemType = storageInfo.FilesystemType; storage->AccessCapability = storageInfo.AccessCapability; storage->MaxCapacity = storageInfo.MaxCapability; storage->FreeSpaceInBytes = storageInfo.FreeSpaceInBytes; storage->FreeSpaceInObjects = storageInfo.FreeSpaceInImages; storage->StorageDescription = storageInfo.StorageDescription; storage->VolumeIdentifier = storageInfo.VolumeLabel; } if(storage->FreeSpaceInBytes == (uint64_t) -1) return -1; *freespace = storage->FreeSpaceInBytes; return 0; } /** * This function dumps out a large chunk of textual information * provided from the PTP protocol and additionally some extra * MTP-specific information where applicable. * @param device a pointer to the MTP device to report info from. */ void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t *device) { int i; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; LIBMTP_devicestorage_t *storage = device->storage; LIBMTP_device_extension_t *tmpext = device->extensions; printf("USB low-level info:\n"); dump_usbinfo(ptp_usb); /* Print out some verbose information */ printf("Device info:\n"); printf(" Manufacturer: %s\n", params->deviceinfo.Manufacturer); printf(" Model: %s\n", params->deviceinfo.Model); printf(" Device version: %s\n", params->deviceinfo.DeviceVersion); printf(" Serial number: %s\n", params->deviceinfo.SerialNumber); printf(" Vendor extension ID: 0x%08x\n", params->deviceinfo.VendorExtensionID); printf(" Vendor extension description: %s\n", params->deviceinfo.VendorExtensionDesc); printf(" Detected object size: %d bits\n", device->object_bitsize); printf(" Extensions:\n"); while (tmpext != NULL) { printf(" %s: %d.%d\n", tmpext->name, tmpext->major, tmpext->minor); tmpext = tmpext->next; } printf("Supported operations:\n"); for (i=0;ideviceinfo.OperationsSupported_len;i++) { char txt[256]; (void) ptp_render_opcode(params, params->deviceinfo.OperationsSupported[i], sizeof(txt), txt); printf(" %04x: %s\n", params->deviceinfo.OperationsSupported[i], txt); } printf("Events supported:\n"); if (params->deviceinfo.EventsSupported_len == 0) { printf(" None.\n"); } else { for (i=0;ideviceinfo.EventsSupported_len;i++) { printf(" 0x%04x\n", params->deviceinfo.EventsSupported[i]); } } printf("Device Properties Supported:\n"); for (i=0;ideviceinfo.DevicePropertiesSupported_len;i++) { char const *propdesc = ptp_get_property_description(params, params->deviceinfo.DevicePropertiesSupported[i]); if (propdesc != NULL) { printf(" 0x%04x: %s\n", params->deviceinfo.DevicePropertiesSupported[i], propdesc); } else { uint16_t prop = params->deviceinfo.DevicePropertiesSupported[i]; printf(" 0x%04x: Unknown property\n", prop); } } if (ptp_operation_issupported(params,PTP_OC_MTP_GetObjectPropsSupported)) { printf("Playable File (Object) Types and Object Properties Supported:\n"); for (i=0;ideviceinfo.ImageFormats_len;i++) { char txt[256]; uint16_t ret; uint16_t *props = NULL; uint32_t propcnt = 0; int j; (void) ptp_render_ofc (params, params->deviceinfo.ImageFormats[i], sizeof(txt), txt); printf(" %04x: %s\n", params->deviceinfo.ImageFormats[i], txt); ret = ptp_mtp_getobjectpropssupported (params, params->deviceinfo.ImageFormats[i], &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Dump_Device_Info(): " "error on query for object properties."); } else { for (j=0;jdeviceinfo.ImageFormats[i], &opd); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Dump_Device_Info(): " "could not get property description."); break; } if (opd.DataType == PTP_DTC_STR) { printf(" STRING data type"); switch (opd.FormFlag) { case PTP_OPFF_DateTime: printf(" DATETIME FORM"); break; case PTP_OPFF_RegularExpression: printf(" REGULAR EXPRESSION FORM"); break; case PTP_OPFF_LongString: printf(" LONG STRING FORM"); break; default: break; } } else { if (opd.DataType & PTP_DTC_ARRAY_MASK) { printf(" array of"); } switch (opd.DataType & (~PTP_DTC_ARRAY_MASK)) { case PTP_DTC_UNDEF: printf(" UNDEFINED data type"); break; case PTP_DTC_INT8: printf(" INT8 data type"); switch (opd.FormFlag) { case PTP_OPFF_Range: printf(" range: MIN %d, MAX %d, STEP %d", opd.FORM.Range.MinimumValue.i8, opd.FORM.Range.MaximumValue.i8, opd.FORM.Range.StepSize.i8); break; case PTP_OPFF_Enumeration: printf(" enumeration: "); for(k=0;kdeviceinfo.ImageFormats[i] == PTP_OPC_VideoFourCCCodec) { printf(" enumeration of u32 casted FOURCC: "); for (k=0;k> 24) & 0xFFU; fourcc[1] = (opd.FORM.Enum.SupportedValue[k].u32 >> 16) & 0xFFU; fourcc[2] = (opd.FORM.Enum.SupportedValue[k].u32 >> 8) & 0xFFU; fourcc[3] = opd.FORM.Enum.SupportedValue[k].u32 & 0xFFU; fourcc[4] = '\n'; fourcc[5] = '\0'; printf("\"%s\", ", fourcc); } } } else { printf(" enumeration: "); for(k=0;kid); printf(" StorageType: 0x%04x ",storage->StorageType); switch (storage->StorageType) { case PTP_ST_Undefined: printf("(undefined)\n"); break; case PTP_ST_FixedROM: printf("fixed ROM storage\n"); break; case PTP_ST_RemovableROM: printf("removable ROM storage\n"); break; case PTP_ST_FixedRAM: printf("fixed RAM storage\n"); break; case PTP_ST_RemovableRAM: printf("removable RAM storage\n"); break; default: printf("UNKNOWN storage\n"); break; } printf(" FilesystemType: 0x%04x ",storage->FilesystemType); switch(storage->FilesystemType) { case PTP_FST_Undefined: printf("(undefined)\n"); break; case PTP_FST_GenericFlat: printf("generic flat filesystem\n"); break; case PTP_FST_GenericHierarchical: printf("generic hierarchical\n"); break; case PTP_FST_DCF: printf("DCF\n"); break; default: printf("UNKNONWN filesystem type\n"); break; } printf(" AccessCapability: 0x%04x ",storage->AccessCapability); switch(storage->AccessCapability) { case PTP_AC_ReadWrite: printf("read/write\n"); break; case PTP_AC_ReadOnly: printf("read only\n"); break; case PTP_AC_ReadOnly_with_Object_Deletion: printf("read only + object deletion\n"); break; default: printf("UNKNOWN access capability\n"); break; } printf(" MaxCapacity: %llu\n", (long long unsigned int) storage->MaxCapacity); printf(" FreeSpaceInBytes: %llu\n", (long long unsigned int) storage->FreeSpaceInBytes); printf(" FreeSpaceInObjects: %llu\n", (long long unsigned int) storage->FreeSpaceInObjects); printf(" StorageDescription: %s\n",storage->StorageDescription); printf(" VolumeIdentifier: %s\n",storage->VolumeIdentifier); storage = storage->next; } } printf("Special directories:\n"); printf(" Default music folder: 0x%08x\n", device->default_music_folder); printf(" Default playlist folder: 0x%08x\n", device->default_playlist_folder); printf(" Default picture folder: 0x%08x\n", device->default_picture_folder); printf(" Default video folder: 0x%08x\n", device->default_video_folder); printf(" Default organizer folder: 0x%08x\n", device->default_organizer_folder); printf(" Default zencast folder: 0x%08x\n", device->default_zencast_folder); printf(" Default album folder: 0x%08x\n", device->default_album_folder); printf(" Default text folder: 0x%08x\n", device->default_text_folder); } /** * This resets a device in case it supports the PTP_OC_ResetDevice * operation code (0x1010). * @param device a pointer to the device to reset. * @return 0 on success, any other value means failure. */ int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t *device) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_operation_issupported(params,PTP_OC_ResetDevice)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Reset_Device(): " "device does not support resetting."); return -1; } ret = ptp_resetdevice(params); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "Error resetting."); return -1; } return 0; } /** * This retrieves the manufacturer name of an MTP device. * @param device a pointer to the device to get the manufacturer name for. * @return a newly allocated UTF-8 string representing the manufacturer name. * The string must be freed by the caller after use. If the call * was unsuccessful this will contain NULL. */ char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t *device) { char *retmanuf = NULL; PTPParams *params = (PTPParams *) device->params; if (params->deviceinfo.Manufacturer != NULL) { retmanuf = strdup(params->deviceinfo.Manufacturer); } return retmanuf; } /** * This retrieves the model name (often equal to product name) * of an MTP device. * @param device a pointer to the device to get the model name for. * @return a newly allocated UTF-8 string representing the model name. * The string must be freed by the caller after use. If the call * was unsuccessful this will contain NULL. */ char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t *device) { char *retmodel = NULL; PTPParams *params = (PTPParams *) device->params; if (params->deviceinfo.Model != NULL) { retmodel = strdup(params->deviceinfo.Model); } return retmodel; } /** * This retrieves the serial number of an MTP device. * @param device a pointer to the device to get the serial number for. * @return a newly allocated UTF-8 string representing the serial number. * The string must be freed by the caller after use. If the call * was unsuccessful this will contain NULL. */ char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t *device) { char *retnumber = NULL; PTPParams *params = (PTPParams *) device->params; if (params->deviceinfo.SerialNumber != NULL) { retnumber = strdup(params->deviceinfo.SerialNumber); } return retnumber; } /** * This retrieves the device version (hardware and firmware version) of an * MTP device. * @param device a pointer to the device to get the device version for. * @return a newly allocated UTF-8 string representing the device version. * The string must be freed by the caller after use. If the call * was unsuccessful this will contain NULL. */ char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t *device) { char *retversion = NULL; PTPParams *params = (PTPParams *) device->params; if (params->deviceinfo.DeviceVersion != NULL) { retversion = strdup(params->deviceinfo.DeviceVersion); } return retversion; } /** * This retrieves the "friendly name" of an MTP device. Usually * this is simply the name of the owner or something like * "John Doe's Digital Audio Player". This property should be supported * by all MTP devices. * @param device a pointer to the device to get the friendly name for. * @return a newly allocated UTF-8 string representing the friendly name. * The string must be freed by the caller after use. * @see LIBMTP_Set_Friendlyname() */ char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t *device) { PTPPropertyValue propval; char *retstring = NULL; PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_property_issupported(params, PTP_DPC_MTP_DeviceFriendlyName)) { return NULL; } ret = ptp_getdevicepropvalue(params, PTP_DPC_MTP_DeviceFriendlyName, &propval, PTP_DTC_STR); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "Error getting friendlyname."); return NULL; } if (propval.str != NULL) { retstring = strdup(propval.str); free(propval.str); } return retstring; } /** * Sets the "friendly name" of an MTP device. * @param device a pointer to the device to set the friendly name for. * @param friendlyname the new friendly name for the device. * @return 0 on success, any other value means failure. * @see LIBMTP_Get_Friendlyname() */ int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t *device, char const * const friendlyname) { PTPPropertyValue propval; PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_property_issupported(params, PTP_DPC_MTP_DeviceFriendlyName)) { return -1; } propval.str = (char *) friendlyname; ret = ptp_setdevicepropvalue(params, PTP_DPC_MTP_DeviceFriendlyName, &propval, PTP_DTC_STR); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "Error setting friendlyname."); return -1; } return 0; } /** * This retrieves the syncronization partner of an MTP device. This * property should be supported by all MTP devices. * @param device a pointer to the device to get the sync partner for. * @return a newly allocated UTF-8 string representing the synchronization * partner. The string must be freed by the caller after use. * @see LIBMTP_Set_Syncpartner() */ char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t *device) { PTPPropertyValue propval; char *retstring = NULL; PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_property_issupported(params, PTP_DPC_MTP_SynchronizationPartner)) { return NULL; } ret = ptp_getdevicepropvalue(params, PTP_DPC_MTP_SynchronizationPartner, &propval, PTP_DTC_STR); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "Error getting syncpartner."); return NULL; } if (propval.str != NULL) { retstring = strdup(propval.str); free(propval.str); } return retstring; } /** * Sets the synchronization partner of an MTP device. Note that * we have no idea what the effect of setting this to "foobar" * may be. But the general idea seems to be to tell which program * shall synchronize with this device and tell others to leave * it alone. * @param device a pointer to the device to set the sync partner for. * @param syncpartner the new synchronization partner for the device. * @return 0 on success, any other value means failure. * @see LIBMTP_Get_Syncpartner() */ int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t *device, char const * const syncpartner) { PTPPropertyValue propval; PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_property_issupported(params, PTP_DPC_MTP_SynchronizationPartner)) { return -1; } propval.str = (char *) syncpartner; ret = ptp_setdevicepropvalue(params, PTP_DPC_MTP_SynchronizationPartner, &propval, PTP_DTC_STR); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "Error setting syncpartner."); return -1; } return 0; } /** * Checks if the device can stora a file of this size or * if it's too big. * @param device a pointer to the device. * @param filesize the size of the file to check whether it will fit. * @param storageid the ID of the storage to try to fit the file on. * @return 0 if the file fits, any other value means failure. */ static int check_if_file_fits(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage, uint64_t const filesize) { PTPParams *params = (PTPParams *) device->params; uint64_t freebytes; int ret; // If we cannot check the storage, no big deal. if (!ptp_operation_issupported(params,PTP_OC_GetStorageInfo)) { return 0; } ret = get_storage_freespace(device, storage, &freebytes); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "check_if_file_fits(): error checking free storage."); return -1; } else { // See if it fits. if (filesize > freebytes) { return -1; } } return 0; } /** * This function retrieves the current battery level on the device. * @param device a pointer to the device to get the battery level for. * @param maximum_level a pointer to a variable that will hold the * maximum level of the battery if the call was successful. * @param current_level a pointer to a variable that will hold the * current level of the battery if the call was successful. * A value of 0 means that the device is on external power. * @return 0 if the storage info was successfully retrieved, any other * means failure. A typical cause of failure is that * the device does not support the battery level property. */ int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *device, uint8_t * const maximum_level, uint8_t * const current_level) { PTPPropertyValue propval; uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; *maximum_level = 0; *current_level = 0; if (FLAG_BROKEN_BATTERY_LEVEL(ptp_usb) || !ptp_property_issupported(params, PTP_DPC_BatteryLevel)) { return -1; } ret = ptp_getdevicepropvalue(params, PTP_DPC_BatteryLevel, &propval, PTP_DTC_UINT8); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Batterylevel(): " "could not get device property value."); return -1; } *maximum_level = device->maximum_battery_level; *current_level = propval.u8; return 0; } /** * Formats device storage (if the device supports the operation). * WARNING: This WILL delete all data from the device. Make sure you've * got confirmation from the user BEFORE you call this function. * * @param device a pointer to the device containing the storage to format. * @param storage the actual storage to format. * @return 0 on success, any other value means failure. */ int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; if (!ptp_operation_issupported(params,PTP_OC_FormatStore)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Format_Storage(): " "device does not support formatting storage."); return -1; } ret = ptp_formatstore(params, storage->id); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Format_Storage(): " "failed to format storage."); return -1; } return 0; } /** * Helper function to extract a unicode property off a device. * This is the standard way of retrieveing unicode device * properties as described by the PTP spec. * @param device a pointer to the device to get the property from. * @param unicstring a pointer to a pointer that will hold the * property after this call is completed. * @param property the property to retrieve. * @return 0 on success, any other value means failure. */ static int get_device_unicode_property(LIBMTP_mtpdevice_t *device, char **unicstring, uint16_t property) { PTPPropertyValue propval; PTPParams *params = (PTPParams *) device->params; uint16_t *tmp; uint16_t ret; int i; if (!ptp_property_issupported(params, property)) { return -1; } // Unicode strings are 16bit unsigned integer arrays. ret = ptp_getdevicepropvalue(params, property, &propval, PTP_DTC_AUINT16); if (ret != PTP_RC_OK) { // TODO: add a note on WHICH property that we failed to get. *unicstring = NULL; add_ptp_error_to_errorstack(device, ret, "get_device_unicode_property(): " "failed to get unicode property."); return -1; } // Extract the actual array. // printf("Array of %d elements\n", propval.a.count); tmp = malloc((propval.a.count + 1)*sizeof(uint16_t)); for (i = 0; i < propval.a.count; i++) { tmp[i] = propval.a.v[i].u16; // printf("%04x ", tmp[i]); } tmp[propval.a.count] = 0x0000U; free(propval.a.v); *unicstring = utf16_to_utf8(device, tmp); free(tmp); return 0; } /** * This function returns the secure time as an XML document string from * the device. * @param device a pointer to the device to get the secure time for. * @param sectime the secure time string as an XML document or NULL if the call * failed or the secure time property is not supported. This string * must be free():ed by the caller after use. * @return 0 on success, any other value means failure. */ int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *device, char ** const sectime) { return get_device_unicode_property(device, sectime, PTP_DPC_MTP_SecureTime); } /** * This function returns the device (public key) certificate as an * XML document string from the device. * @param device a pointer to the device to get the device certificate for. * @param devcert the device certificate as an XML string or NULL if the call * failed or the device certificate property is not supported. This * string must be free():ed by the caller after use. * @return 0 on success, any other value means failure. */ int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *device, char ** const devcert) { return get_device_unicode_property(device, devcert, PTP_DPC_MTP_DeviceCertificate); } /** * This function retrieves a list of supported file types, i.e. the file * types that this device claims it supports, e.g. audio file types that * the device can play etc. This list is mitigated to * inlcude the file types that libmtp can handle, i.e. it will not list * filetypes that libmtp will handle internally like playlists and folders. * @param device a pointer to the device to get the filetype capabilities for. * @param filetypes a pointer to a pointer that will hold the list of * supported filetypes if the call was successful. This list must * be free():ed by the caller after use. * @param length a pointer to a variable that will hold the length of the * list of supported filetypes if the call was successful. * @return 0 on success, any other value means failure. * @see LIBMTP_Get_Filetype_Description() */ int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *device, uint16_t ** const filetypes, uint16_t * const length) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; uint16_t *localtypes; uint16_t localtypelen; uint32_t i; // This is more memory than needed if there are unknown types, but what the heck. localtypes = (uint16_t *) malloc(params->deviceinfo.ImageFormats_len * sizeof(uint16_t)); localtypelen = 0; for (i=0;ideviceinfo.ImageFormats_len;i++) { uint16_t localtype = map_ptp_type_to_libmtp_type(params->deviceinfo.ImageFormats[i]); if (localtype != LIBMTP_FILETYPE_UNKNOWN) { localtypes[localtypelen] = localtype; localtypelen++; } } // The forgotten Ogg support on YP-10 and others... if (FLAG_OGG_IS_UNKNOWN(ptp_usb)) { localtypes = (uint16_t *) realloc(localtypes, (params->deviceinfo.ImageFormats_len+1) * sizeof(uint16_t)); localtypes[localtypelen] = LIBMTP_FILETYPE_OGG; localtypelen++; } // The forgotten FLAC support on Cowon iAudio S9 and others... if (FLAG_FLAC_IS_UNKNOWN(ptp_usb)) { localtypes = (uint16_t *) realloc(localtypes, (params->deviceinfo.ImageFormats_len+1) * sizeof(uint16_t)); localtypes[localtypelen] = LIBMTP_FILETYPE_FLAC; localtypelen++; } *filetypes = localtypes; *length = localtypelen; return 0; } /** * This function checks if the device has some specific capabilities, in * order to avoid calling APIs that may disturb the device. * * @param device a pointer to the device to check the capability on. * @param cap the capability to check. * @return 0 if not supported, any other value means the device has the * requested capability. */ int LIBMTP_Check_Capability(LIBMTP_mtpdevice_t *device, LIBMTP_devicecap_t cap) { switch (cap) { case LIBMTP_DEVICECAP_GetPartialObject: return (ptp_operation_issupported(device->params, PTP_OC_GetPartialObject) || ptp_operation_issupported(device->params, PTP_OC_ANDROID_GetPartialObject64)); case LIBMTP_DEVICECAP_SendPartialObject: return ptp_operation_issupported(device->params, PTP_OC_ANDROID_SendPartialObject); case LIBMTP_DEVICECAP_EditObjects: return (ptp_operation_issupported(device->params, PTP_OC_ANDROID_TruncateObject) && ptp_operation_issupported(device->params, PTP_OC_ANDROID_BeginEditObject) && ptp_operation_issupported(device->params, PTP_OC_ANDROID_EndEditObject)); /* * Handle other capabilities here, this is also a good place to * blacklist some advanced operations on specific devices if need * be. */ default: break; } return 0; } /** * This function updates all the storage id's of a device and their * properties, then creates a linked list and puts the list head into * the device struct. It also optionally sorts this list. If you want * to display storage information in your application you should call * this function, then dereference the device struct * (device->storage) to get out information on the storage. * * You need to call this everytime you want to update the * device->storage list, for example anytime you need * to check available storage somewhere. * * WARNING: since this list is dynamically updated, do not * reference its fields in external applications by pointer! E.g * do not put a reference to any char * field. instead * strncpy() it! * * @param device a pointer to the device to get the storage for. * @param sortby an integer that determines the sorting of the storage list. * Valid sort methods are defined in libmtp.h with beginning with * LIBMTP_STORAGE_SORTBY_. 0 or LIBMTP_STORAGE_SORTBY_NOTSORTED to not * sort. * @return 0 on success, 1 success but only with storage id's, storage * properities could not be retrieved and -1 means failure. */ int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *device, int const sortby) { uint32_t i = 0; PTPStorageInfo storageInfo; PTPParams *params = (PTPParams *) device->params; PTPStorageIDs storageIDs; LIBMTP_devicestorage_t *storage = NULL; LIBMTP_devicestorage_t *storageprev = NULL; if (device->storage != NULL) free_storage_list(device); // if (!ptp_operation_issupported(params,PTP_OC_GetStorageIDs)) // return -1; if (ptp_getstorageids (params, &storageIDs) != PTP_RC_OK) return -1; if (storageIDs.n < 1) return -1; if (!ptp_operation_issupported(params,PTP_OC_GetStorageInfo)) { for (i = 0; i < storageIDs.n; i++) { storage = (LIBMTP_devicestorage_t *) malloc(sizeof(LIBMTP_devicestorage_t)); storage->prev = storageprev; if (storageprev != NULL) storageprev->next = storage; if (device->storage == NULL) device->storage = storage; storage->id = storageIDs.Storage[i]; storage->StorageType = PTP_ST_Undefined; storage->FilesystemType = PTP_FST_Undefined; storage->AccessCapability = PTP_AC_ReadWrite; storage->MaxCapacity = (uint64_t) -1; storage->FreeSpaceInBytes = (uint64_t) -1; storage->FreeSpaceInObjects = (uint64_t) -1; storage->StorageDescription = strdup("Unknown storage"); storage->VolumeIdentifier = strdup("Unknown volume"); storage->next = NULL; storageprev = storage; } free(storageIDs.Storage); return 1; } else { for (i = 0; i < storageIDs.n; i++) { uint16_t ret; ret = ptp_getstorageinfo(params, storageIDs.Storage[i], &storageInfo); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Storage(): " "Could not get storage info."); if (device->storage != NULL) { free_storage_list(device); } return -1; } storage = (LIBMTP_devicestorage_t *) malloc(sizeof(LIBMTP_devicestorage_t)); storage->prev = storageprev; if (storageprev != NULL) storageprev->next = storage; if (device->storage == NULL) device->storage = storage; storage->id = storageIDs.Storage[i]; storage->StorageType = storageInfo.StorageType; storage->FilesystemType = storageInfo.FilesystemType; storage->AccessCapability = storageInfo.AccessCapability; storage->MaxCapacity = storageInfo.MaxCapability; storage->FreeSpaceInBytes = storageInfo.FreeSpaceInBytes; storage->FreeSpaceInObjects = storageInfo.FreeSpaceInImages; storage->StorageDescription = storageInfo.StorageDescription; storage->VolumeIdentifier = storageInfo.VolumeLabel; storage->next = NULL; storageprev = storage; } if (storage != NULL) storage->next = NULL; sort_storage_by(device,sortby); free(storageIDs.Storage); return 0; } } /** * This creates a new file metadata structure and allocates memory * for it. Notice that if you add strings to this structure they * will be freed by the corresponding LIBMTP_destroy_file_t * operation later, so be careful of using strdup() when assigning * strings, e.g.: * *
 * LIBMTP_file_t *file = LIBMTP_new_file_t();
 * file->filename = strdup(namestr);
 * ....
 * LIBMTP_destroy_file_t(file);
 * 
* * @return a pointer to the newly allocated metadata structure. * @see LIBMTP_destroy_file_t() */ LIBMTP_file_t *LIBMTP_new_file_t(void) { LIBMTP_file_t *new = (LIBMTP_file_t *) malloc(sizeof(LIBMTP_file_t)); if (new == NULL) { return NULL; } new->filename = NULL; new->item_id = 0; new->parent_id = 0; new->storage_id = 0; new->filesize = 0; new->modificationdate = 0; new->filetype = LIBMTP_FILETYPE_UNKNOWN; new->next = NULL; return new; } /** * This destroys a file metadata structure and deallocates the memory * used by it, including any strings. Never use a file metadata * structure again after calling this function on it. * @param file the file metadata to destroy. * @see LIBMTP_new_file_t() */ void LIBMTP_destroy_file_t(LIBMTP_file_t *file) { if (file == NULL) { return; } if (file->filename != NULL) free(file->filename); free(file); return; } /** * Helper function that takes one PTP object and creates a * LIBMTP_file_t metadata entry. */ static LIBMTP_file_t *obj2file(LIBMTP_mtpdevice_t *device, PTPObject *ob) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; LIBMTP_file_t *file; int i; // Allocate a new file type file = LIBMTP_new_file_t(); file->parent_id = ob->oi.ParentObject; file->storage_id = ob->oi.StorageID; // Set the filetype file->filetype = map_ptp_type_to_libmtp_type(ob->oi.ObjectFormat); /* * A special quirk for devices that doesn't quite * remember that some files marked as "unknown" type are * actually OGG or FLAC files. We look at the filename extension * and see if it happens that this was atleast named "ogg" or "flac" * and fall back on this heuristic approach in that case, * for these bugged devices only. */ if (file->filetype == LIBMTP_FILETYPE_UNKNOWN) { if ((FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) || FLAG_OGG_IS_UNKNOWN(ptp_usb)) && has_ogg_extension(file->filename)) { file->filetype = LIBMTP_FILETYPE_OGG; } if (FLAG_FLAC_IS_UNKNOWN(ptp_usb) && has_flac_extension(file->filename)) { file->filetype = LIBMTP_FILETYPE_FLAC; } } // Set the modification date file->modificationdate = ob->oi.ModificationDate; // We only have 32-bit file size here; later we use the PTP_OPC_ObjectSize property file->filesize = ob->oi.ObjectCompressedSize; if (ob->oi.Filename != NULL) { file->filename = strdup(ob->oi.Filename); } // This is a unique ID so we can keep track of the file. file->item_id = ob->oid; /* * If we have a cached, large set of metadata, then use it! */ if (ob->mtpprops) { MTPProperties *prop = ob->mtpprops; for (i=0; i < ob->nrofmtpprops; i++, prop++) { // Pick ObjectSize here... if (prop->property == PTP_OPC_ObjectSize) { // This may already be set, but this 64bit precision value // is better than the PTP 32bit value, so let it override. if (device->object_bitsize == 64) { file->filesize = prop->propval.u64; } else { file->filesize = prop->propval.u32; } break; } } } else if (ptp_operation_issupported(params,PTP_OC_MTP_GetObjectPropsSupported)) { uint16_t *props = NULL; uint32_t propcnt = 0; int ret; // First see which properties can be retrieved for this object format ret = ptp_mtp_getobjectpropssupported(params, map_libmtp_type_to_ptp_type(file->filetype), &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "obj2file: call to ptp_mtp_getobjectpropssupported() failed."); // Silently fall through. } else { for (i = 0; i < propcnt; i++) { switch (props[i]) { case PTP_OPC_ObjectSize: if (device->object_bitsize == 64) { file->filesize = get_u64_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); } else { file->filesize = get_u32_from_object(device, file->item_id, PTP_OPC_ObjectSize, 0); } break; default: break; } } free(props); } } return file; } /** * This function retrieves the metadata for a single file off * the device. * * Do not call this function repeatedly! The file handles are linearly * searched O(n) and the call may involve (slow) USB traffic, so use * LIBMTP_Get_Filelisting() and cache the file, preferably * as an efficient data structure such as a hash list. * * Incidentally this function will return metadata for * a folder (association) as well, but this is not a proper use * of it, it is intended for file manipulation, not folder manipulation. * * @param device a pointer to the device to get the file metadata from. * @param fileid the object ID of the file that you want the metadata for. * @return a metadata entry on success or NULL on failure. * @see LIBMTP_Get_Filelisting() */ LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *device, uint32_t const fileid) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; PTPObject *ob; // Get all the handles if we haven't already done that // (Only on cached devices.) if (device->cached && params->nrofobjects == 0) { flush_handles(device); } ret = ptp_object_want(params, fileid, PTPOBJECT_OBJECTINFO_LOADED|PTPOBJECT_MTPPROPLIST_LOADED, &ob); if (ret != PTP_RC_OK) return NULL; return obj2file(device, ob); } /** * THIS FUNCTION IS DEPRECATED. PLEASE UPDATE YOUR CODE IN ORDER * NOT TO USE IT. * @see LIBMTP_Get_Filelisting_With_Callback() */ LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *device) { LIBMTP_INFO("WARNING: LIBMTP_Get_Filelisting() is deprecated.\n"); LIBMTP_INFO("WARNING: please update your code to use LIBMTP_Get_Filelisting_With_Callback()\n"); return LIBMTP_Get_Filelisting_With_Callback(device, NULL, NULL); } /** * This returns a long list of all files available * on the current MTP device. Folders will not be returned, but abstract * entities like playlists and albums will show up as "files". Typical usage: * *
 * LIBMTP_file_t *filelist;
 *
 * filelist = LIBMTP_Get_Filelisting_With_Callback(device, callback, data);
 * while (filelist != NULL) {
 *   LIBMTP_file_t *tmp;
 *
 *   // Do something on each element in the list here...
 *   tmp = filelist;
 *   filelist = filelist->next;
 *   LIBMTP_destroy_file_t(tmp);
 * }
 * 
* * If you want to group your file listing by storage (per storage unit) or * arrange files into folders, you must dereference the storage_id * and/or parent_id field of the returned LIBMTP_file_t * struct. To arrange by folders or files you typically have to create the proper * trees by calls to LIBMTP_Get_Storage() and/or * LIBMTP_Get_Folder_List() first. * * @param device a pointer to the device to get the file listing for. * @param callback a function to be called during the tracklisting retrieveal * for displaying progress bars etc, or NULL if you don't want * any callbacks. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return a list of files that can be followed using the next * field of the LIBMTP_file_t data structure. * Each of the metadata tags must be freed after use, and may * contain only partial metadata information, i.e. one or several * fields may be NULL or 0. * @see LIBMTP_Get_Filemetadata() */ LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *device, LIBMTP_progressfunc_t const callback, void const * const data) { uint32_t i = 0; LIBMTP_file_t *retfiles = NULL; LIBMTP_file_t *curfile = NULL; PTPParams *params = (PTPParams *) device->params; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) { flush_handles(device); } for (i = 0; i < params->nrofobjects; i++) { LIBMTP_file_t *file; PTPObject *ob; if (callback != NULL) callback(i, params->nrofobjects, data); ob = ¶ms->objects[i]; if (ob->oi.ObjectFormat == PTP_OFC_Association) { // MTP use this object format for folders which means // these "files" will turn up on a folder listing instead. continue; } // Look up metadata file = obj2file(device, ob); if (file == NULL) { continue; } // Add track to a list that will be returned afterwards. if (retfiles == NULL) { retfiles = file; curfile = file; } else { curfile->next = file; curfile = file; } // Call listing callback // double progressPercent = (double)i*(double)100.0 / (double)params->handles.n; } // Handle counting loop return retfiles; } /** * This function retrieves the contents of a certain folder * with id parent on a certain storage on a certain device. * The result contains both files and folders. * The device used with this operations must have been opened with * LIBMTP_Open_Raw_Device_Uncached() or it will fail. * * NOTE: the request will always perform I/O with the device. * @param device a pointer to the MTP device to report info from. * @param storage a storage on the device to report info from. If * 0 is passed in, the files for the given parent will be * searched across all available storages. * @param parent the parent folder id. */ LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *device, uint32_t const storage, uint32_t const parent) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; LIBMTP_file_t *retfiles = NULL; LIBMTP_file_t *curfile = NULL; PTPObjectHandles currentHandles; uint32_t storageid; uint16_t ret; int i = 0; if (device->cached) { // This function is only supposed to be used by devices // opened as uncached! LIBMTP_ERROR("tried to use %s on a cached device!\n", __func__); return NULL; } if (FLAG_BROKEN_GET_OBJECT_PROPVAL(ptp_usb)) { // These devices cannot handle the commands needed for // Uncached access! LIBMTP_ERROR("tried to use %s on an unsupported device, " "this command does not work on all devices " "due to missing low-level support to read " "information on individual tracks\n", __func__); return NULL; } if (storage == 0) storageid = PTP_GOH_ALL_STORAGE; else storageid = storage; ret = ptp_getobjecthandles(params, storageid, PTP_GOH_ALL_FORMATS, parent, ¤tHandles); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Files_And_Folders(): could not get object handles."); return NULL; } if (currentHandles.Handler == NULL || currentHandles.n == 0) return NULL; for (i = 0; i < currentHandles.n; i++) { LIBMTP_file_t *file; // Get metadata for one file, if it fails, try next file file = LIBMTP_Get_Filemetadata(device, currentHandles.Handler[i]); if (file == NULL) continue; // Add track to a list that will be returned afterwards. if (curfile == NULL) { curfile = file; retfiles = file; } else { curfile->next = file; curfile = file; } } free(currentHandles.Handler); // Return a pointer to the original first file // in the big list. return retfiles; } /** * This creates a new track metadata structure and allocates memory * for it. Notice that if you add strings to this structure they * will be freed by the corresponding LIBMTP_destroy_track_t * operation later, so be careful of using strdup() when assigning * strings, e.g.: * *
 * LIBMTP_track_t *track = LIBMTP_new_track_t();
 * track->title = strdup(titlestr);
 * ....
 * LIBMTP_destroy_track_t(track);
 * 
* * @return a pointer to the newly allocated metadata structure. * @see LIBMTP_destroy_track_t() */ LIBMTP_track_t *LIBMTP_new_track_t(void) { LIBMTP_track_t *new = (LIBMTP_track_t *) malloc(sizeof(LIBMTP_track_t)); if (new == NULL) { return NULL; } new->item_id = 0; new->parent_id = 0; new->storage_id = 0; new->title = NULL; new->artist = NULL; new->composer = NULL; new->album = NULL; new->genre = NULL; new->date = NULL; new->filename = NULL; new->duration = 0; new->tracknumber = 0; new->filesize = 0; new->filetype = LIBMTP_FILETYPE_UNKNOWN; new->samplerate = 0; new->nochannels = 0; new->wavecodec = 0; new->bitrate = 0; new->bitratetype = 0; new->rating = 0; new->usecount = 0; new->modificationdate = 0; new->next = NULL; return new; } /** * This destroys a track metadata structure and deallocates the memory * used by it, including any strings. Never use a track metadata * structure again after calling this function on it. * @param track the track metadata to destroy. * @see LIBMTP_new_track_t() */ void LIBMTP_destroy_track_t(LIBMTP_track_t *track) { if (track == NULL) { return; } if (track->title != NULL) free(track->title); if (track->artist != NULL) free(track->artist); if (track->composer != NULL) free(track->composer); if (track->album != NULL) free(track->album); if (track->genre != NULL) free(track->genre); if (track->date != NULL) free(track->date); if (track->filename != NULL) free(track->filename); free(track); return; } /** * This function maps and copies a property onto the track metadata if applicable. */ static void pick_property_to_track_metadata(LIBMTP_mtpdevice_t *device, MTPProperties *prop, LIBMTP_track_t *track) { switch (prop->property) { case PTP_OPC_Name: if (prop->propval.str != NULL) track->title = strdup(prop->propval.str); else track->title = NULL; break; case PTP_OPC_Artist: if (prop->propval.str != NULL) track->artist = strdup(prop->propval.str); else track->artist = NULL; break; case PTP_OPC_Composer: if (prop->propval.str != NULL) track->composer = strdup(prop->propval.str); else track->composer = NULL; break; case PTP_OPC_Duration: track->duration = prop->propval.u32; break; case PTP_OPC_Track: track->tracknumber = prop->propval.u16; break; case PTP_OPC_Genre: if (prop->propval.str != NULL) track->genre = strdup(prop->propval.str); else track->genre = NULL; break; case PTP_OPC_AlbumName: if (prop->propval.str != NULL) track->album = strdup(prop->propval.str); else track->album = NULL; break; case PTP_OPC_OriginalReleaseDate: if (prop->propval.str != NULL) track->date = strdup(prop->propval.str); else track->date = NULL; break; // These are, well not so important. case PTP_OPC_SampleRate: track->samplerate = prop->propval.u32; break; case PTP_OPC_NumberOfChannels: track->nochannels = prop->propval.u16; break; case PTP_OPC_AudioWAVECodec: track->wavecodec = prop->propval.u32; break; case PTP_OPC_AudioBitRate: track->bitrate = prop->propval.u32; break; case PTP_OPC_BitRateType: track->bitratetype = prop->propval.u16; break; case PTP_OPC_Rating: track->rating = prop->propval.u16; break; case PTP_OPC_UseCount: track->usecount = prop->propval.u32; break; case PTP_OPC_ObjectSize: if (device->object_bitsize == 64) { track->filesize = prop->propval.u64; } else { track->filesize = prop->propval.u32; } break; default: break; } } /** * This function retrieves the track metadata for a track * given by a unique ID. * @param device a pointer to the device to get the track metadata off. * @param trackid the unique ID of the track. * @param objectformat the object format of this track, so we know what it supports. * @param track a metadata set to fill in. */ static void get_track_metadata(LIBMTP_mtpdevice_t *device, uint16_t objectformat, LIBMTP_track_t *track) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; uint32_t i; MTPProperties *prop; PTPObject *ob; /* * If we have a cached, large set of metadata, then use it! */ ret = ptp_object_want(params, track->item_id, PTPOBJECT_MTPPROPLIST_LOADED, &ob); if (ob->mtpprops) { prop = ob->mtpprops; for (i=0;inrofmtpprops;i++,prop++) pick_property_to_track_metadata(device, prop, track); } else { uint16_t *props = NULL; uint32_t propcnt = 0; // First see which properties can be retrieved for this object format ret = ptp_mtp_getobjectpropssupported(params, map_libmtp_type_to_ptp_type(track->filetype), &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "get_track_metadata(): call to ptp_mtp_getobjectpropssupported() failed."); // Just bail out for now, nothing is ever set. return; } else { for (i=0;ititle = get_string_from_object(device, track->item_id, PTP_OPC_Name); break; case PTP_OPC_Artist: track->artist = get_string_from_object(device, track->item_id, PTP_OPC_Artist); break; case PTP_OPC_Composer: track->composer = get_string_from_object(device, track->item_id, PTP_OPC_Composer); break; case PTP_OPC_Duration: track->duration = get_u32_from_object(device, track->item_id, PTP_OPC_Duration, 0); break; case PTP_OPC_Track: track->tracknumber = get_u16_from_object(device, track->item_id, PTP_OPC_Track, 0); break; case PTP_OPC_Genre: track->genre = get_string_from_object(device, track->item_id, PTP_OPC_Genre); break; case PTP_OPC_AlbumName: track->album = get_string_from_object(device, track->item_id, PTP_OPC_AlbumName); break; case PTP_OPC_OriginalReleaseDate: track->date = get_string_from_object(device, track->item_id, PTP_OPC_OriginalReleaseDate); break; // These are, well not so important. case PTP_OPC_SampleRate: track->samplerate = get_u32_from_object(device, track->item_id, PTP_OPC_SampleRate, 0); break; case PTP_OPC_NumberOfChannels: track->nochannels = get_u16_from_object(device, track->item_id, PTP_OPC_NumberOfChannels, 0); break; case PTP_OPC_AudioWAVECodec: track->wavecodec = get_u32_from_object(device, track->item_id, PTP_OPC_AudioWAVECodec, 0); break; case PTP_OPC_AudioBitRate: track->bitrate = get_u32_from_object(device, track->item_id, PTP_OPC_AudioBitRate, 0); break; case PTP_OPC_BitRateType: track->bitratetype = get_u16_from_object(device, track->item_id, PTP_OPC_BitRateType, 0); break; case PTP_OPC_Rating: track->rating = get_u16_from_object(device, track->item_id, PTP_OPC_Rating, 0); break; case PTP_OPC_UseCount: track->usecount = get_u32_from_object(device, track->item_id, PTP_OPC_UseCount, 0); break; case PTP_OPC_ObjectSize: if (device->object_bitsize == 64) { track->filesize = get_u64_from_object(device, track->item_id, PTP_OPC_ObjectSize, 0); } else { track->filesize = (uint64_t) get_u32_from_object(device, track->item_id, PTP_OPC_ObjectSize, 0); } break; } } free(props); } } } /** * THIS FUNCTION IS DEPRECATED. PLEASE UPDATE YOUR CODE IN ORDER * NOT TO USE IT. * @see LIBMTP_Get_Tracklisting_With_Callback() */ LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t *device) { LIBMTP_INFO("WARNING: LIBMTP_Get_Tracklisting() is deprecated.\n"); LIBMTP_INFO("WARNING: please update your code to use LIBMTP_Get_Tracklisting_With_Callback()\n"); return LIBMTP_Get_Tracklisting_With_Callback(device, NULL, NULL); } /** * This returns a long list of all tracks available on the current MTP device. * Tracks include multimedia objects, both music tracks and video tracks. * Typical usage: * *
 * LIBMTP_track_t *tracklist;
 *
 * tracklist = LIBMTP_Get_Tracklisting_With_Callback(device, callback, data);
 * while (tracklist != NULL) {
 *   LIBMTP_track_t *tmp;
 *
 *   // Do something on each element in the list here...
 *   tmp = tracklist;
 *   tracklist = tracklist->next;
 *   LIBMTP_destroy_track_t(tmp);
 * }
 * 
* * If you want to group your track listing by storage (per storage unit) or * arrange tracks into folders, you must dereference the storage_id * and/or parent_id field of the returned LIBMTP_track_t * struct. To arrange by folders or files you typically have to create the proper * trees by calls to LIBMTP_Get_Storage() and/or * LIBMTP_Get_Folder_List() first. * * @param device a pointer to the device to get the track listing for. * @param callback a function to be called during the tracklisting retrieveal * for displaying progress bars etc, or NULL if you don't want * any callbacks. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return a list of tracks that can be followed using the next * field of the LIBMTP_track_t data structure. * Each of the metadata tags must be freed after use, and may * contain only partial metadata information, i.e. one or several * fields may be NULL or 0. * @see LIBMTP_Get_Trackmetadata() */ LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t *device, LIBMTP_progressfunc_t const callback, void const * const data) { return LIBMTP_Get_Tracklisting_With_Callback_For_Storage(device, 0, callback, data); } /** * This returns a long list of all tracks available on the current MTP device. * Tracks include multimedia objects, both music tracks and video tracks. * Typical usage: * *
 * LIBMTP_track_t *tracklist;
 *
 * tracklist = LIBMTP_Get_Tracklisting_With_Callback_For_Storage(device, storage_id, callback, data);
 * while (tracklist != NULL) {
 *   LIBMTP_track_t *tmp;
 *
 *   // Do something on each element in the list here...
 *   tmp = tracklist;
 *   tracklist = tracklist->next;
 *   LIBMTP_destroy_track_t(tmp);
 * }
 * 
* * If you want to group your track listing by storage (per storage unit) or * arrange tracks into folders, you must dereference the storage_id * and/or parent_id field of the returned LIBMTP_track_t * struct. To arrange by folders or files you typically have to create the proper * trees by calls to LIBMTP_Get_Storage() and/or * LIBMTP_Get_Folder_List() first. * * @param device a pointer to the device to get the track listing for. * @param storage_id ID of device storage (if null, no filter) * @param callback a function to be called during the tracklisting retrieveal * for displaying progress bars etc, or NULL if you don't want * any callbacks. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return a list of tracks that can be followed using the next * field of the LIBMTP_track_t data structure. * Each of the metadata tags must be freed after use, and may * contain only partial metadata information, i.e. one or several * fields may be NULL or 0. * @see LIBMTP_Get_Trackmetadata() */ LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t *device, uint32_t const storage_id, LIBMTP_progressfunc_t const callback, void const * const data) { uint32_t i = 0; LIBMTP_track_t *retracks = NULL; LIBMTP_track_t *curtrack = NULL; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) { flush_handles(device); } for (i = 0; i < params->nrofobjects; i++) { LIBMTP_track_t *track; PTPObject *ob; LIBMTP_filetype_t mtptype; if (callback != NULL) callback(i, params->nrofobjects, data); ob = ¶ms->objects[i]; mtptype = map_ptp_type_to_libmtp_type(ob->oi.ObjectFormat); // Ignore stuff we don't know how to handle... // TODO: get this list as an intersection of the sets // supported by the device and the from the device and // all known track files? if (!LIBMTP_FILETYPE_IS_TRACK(mtptype) && // This row lets through undefined files for examination since they may be forgotten OGG files. (ob->oi.ObjectFormat != PTP_OFC_Undefined || (!FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) && !FLAG_OGG_IS_UNKNOWN(ptp_usb) && !FLAG_FLAC_IS_UNKNOWN(ptp_usb))) ) { //printf("Not a music track (name: %s format: %d), skipping...\n", oi->Filename, oi->ObjectFormat); continue; } // Ignore stuff that isn't into the storage device if ((storage_id != 0) && (ob->oi.StorageID != storage_id )) continue; // Allocate a new track type track = LIBMTP_new_track_t(); // This is some sort of unique ID so we can keep track of the track. track->item_id = ob->oid; track->parent_id = ob->oi.ParentObject; track->storage_id = ob->oi.StorageID; track->modificationdate = ob->oi.ModificationDate; track->filetype = mtptype; // Original file-specific properties track->filesize = ob->oi.ObjectCompressedSize; if (ob->oi.Filename != NULL) { track->filename = strdup(ob->oi.Filename); } get_track_metadata(device, ob->oi.ObjectFormat, track); /* * A special quirk for iriver devices that doesn't quite * remember that some files marked as "unknown" type are * actually OGG or FLAC files. We look at the filename extension * and see if it happens that this was atleast named "ogg" or "flac" * and fall back on this heuristic approach in that case, * for these bugged devices only. */ if (track->filetype == LIBMTP_FILETYPE_UNKNOWN && track->filename != NULL) { if ((FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) || FLAG_OGG_IS_UNKNOWN(ptp_usb)) && has_ogg_extension(track->filename)) track->filetype = LIBMTP_FILETYPE_OGG; else if (FLAG_FLAC_IS_UNKNOWN(ptp_usb) && has_flac_extension(track->filename)) track->filetype = LIBMTP_FILETYPE_FLAC; else { // This was not an OGG/FLAC file so discard it and continue LIBMTP_destroy_track_t(track); continue; } } // Add track to a list that will be returned afterwards. if (retracks == NULL) { retracks = track; curtrack = track; } else { curtrack->next = track; curtrack = track; } // Call listing callback // double progressPercent = (double)i*(double)100.0 / (double)params->handles.n; } // Handle counting loop return retracks; } /** * This function retrieves the metadata for a single track off * the device. * * Do not call this function repeatedly! The track handles are linearly * searched O(n) and the call may involve (slow) USB traffic, so use * LIBMTP_Get_Tracklisting() and cache the tracks, preferably * as an efficient data structure such as a hash list. * * @param device a pointer to the device to get the track metadata from. * @param trackid the object ID of the track that you want the metadata for. * @return a track metadata entry on success or NULL on failure. * @see LIBMTP_Get_Tracklisting() */ LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t *device, uint32_t const trackid) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; PTPObject *ob; LIBMTP_track_t *track; LIBMTP_filetype_t mtptype; uint16_t ret; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) flush_handles(device); ret = ptp_object_want (params, trackid, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) return NULL; mtptype = map_ptp_type_to_libmtp_type(ob->oi.ObjectFormat); // Ignore stuff we don't know how to handle... if (!LIBMTP_FILETYPE_IS_TRACK(mtptype) && /* * This row lets through undefined files for examination * since they may be forgotten OGG or FLAC files. */ (ob->oi.ObjectFormat != PTP_OFC_Undefined || (!FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) && !FLAG_OGG_IS_UNKNOWN(ptp_usb) && !FLAG_FLAC_IS_UNKNOWN(ptp_usb))) ) { //printf("Not a music track (name: %s format: %d), skipping...\n", oi->Filename, oi->ObjectFormat); return NULL; } // Allocate a new track type track = LIBMTP_new_track_t(); // This is some sort of unique ID so we can keep track of the track. track->item_id = ob->oid; track->parent_id = ob->oi.ParentObject; track->storage_id = ob->oi.StorageID; track->modificationdate = ob->oi.ModificationDate; track->filetype = mtptype; // Original file-specific properties track->filesize = ob->oi.ObjectCompressedSize; if (ob->oi.Filename != NULL) { track->filename = strdup(ob->oi.Filename); } /* * A special quirk for devices that doesn't quite * remember that some files marked as "unknown" type are * actually OGG or FLAC files. We look at the filename extension * and see if it happens that this was atleast named "ogg" * and fall back on this heuristic approach in that case, * for these bugged devices only. */ if (track->filetype == LIBMTP_FILETYPE_UNKNOWN && track->filename != NULL) { if ((FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) || FLAG_OGG_IS_UNKNOWN(ptp_usb)) && has_ogg_extension(track->filename)) track->filetype = LIBMTP_FILETYPE_OGG; else if (FLAG_FLAC_IS_UNKNOWN(ptp_usb) && has_flac_extension(track->filename)) track->filetype = LIBMTP_FILETYPE_FLAC; else { // This was not an OGG/FLAC file so discard it LIBMTP_destroy_track_t(track); return NULL; } } get_track_metadata(device, ob->oi.ObjectFormat, track); return track; } /** * This is a manual conversion from MTPDataGetFunc to PTPDataGetFunc * to isolate the internal type. */ static uint16_t get_func_wrapper(PTPParams* params, void* priv, unsigned long wantlen, unsigned char *data, unsigned long *gotlen) { MTPDataHandler *handler = (MTPDataHandler *)priv; uint16_t ret; uint32_t local_gotlen = 0; ret = handler->getfunc(params, handler->priv, wantlen, data, &local_gotlen); *gotlen = local_gotlen; switch (ret) { case LIBMTP_HANDLER_RETURN_OK: return PTP_RC_OK; case LIBMTP_HANDLER_RETURN_ERROR: return PTP_ERROR_IO; case LIBMTP_HANDLER_RETURN_CANCEL: return PTP_ERROR_CANCEL; default: return PTP_ERROR_IO; } } /** * This is a manual conversion from MTPDataPutFunc to PTPDataPutFunc * to isolate the internal type. */ static uint16_t put_func_wrapper(PTPParams* params, void* priv, unsigned long sendlen, unsigned char *data, unsigned long *putlen) { MTPDataHandler *handler = (MTPDataHandler *)priv; uint16_t ret; uint32_t local_putlen = 0; ret = handler->putfunc(params, handler->priv, sendlen, data, &local_putlen); *putlen = local_putlen; switch (ret) { case LIBMTP_HANDLER_RETURN_OK: return PTP_RC_OK; case LIBMTP_HANDLER_RETURN_ERROR: return PTP_ERROR_IO; case LIBMTP_HANDLER_RETURN_CANCEL: return PTP_ERROR_CANCEL; default: return PTP_ERROR_IO; } } /** * This gets a file off the device to a local file identified * by a filename. * @param device a pointer to the device to get the track from. * @param id the file ID of the file to retrieve. * @param path a filename to use for the retrieved file. * @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Get_File_To_File_Descriptor() */ int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t *device, uint32_t const id, char const * const path, LIBMTP_progressfunc_t const callback, void const * const data) { int fd = -1; int ret; // Sanity check if (path == NULL) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File(): Bad arguments, path was NULL."); return -1; } // Open file #ifdef __WIN32__ #ifdef USE_WINDOWS_IO_H if ( (fd = _open(path, O_RDWR|O_CREAT|O_TRUNC|O_BINARY,_S_IREAD)) == -1 ) { #else if ( (fd = open(path, O_RDWR|O_CREAT|O_TRUNC|O_BINARY,S_IRWXU)) == -1 ) { #endif #else if ( (fd = open(path, O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP)) == -1) { #endif add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File(): Could not create file."); return -1; } ret = LIBMTP_Get_File_To_File_Descriptor(device, id, fd, callback, data); // Close file close(fd); // Delete partial file. if (ret == -1) { unlink(path); } return ret; } /** * This gets a file off the device to a file identified * by a file descriptor. * * This function can potentially be used for streaming * files off the device for playback or broadcast for example, * by downloading the file into a stream sink e.g. a socket. * * @param device a pointer to the device to get the file from. * @param id the file ID of the file to retrieve. * @param fd a local file descriptor to write the file to. * @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Get_File_To_File() */ int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t *device, uint32_t const id, int const fd, LIBMTP_progressfunc_t const callback, void const * const data) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; PTPObject *ob; ret = ptp_object_want (params, id, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Could not get object info."); return -1; } if (ob->oi.ObjectFormat == PTP_OFC_Association) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Bad object format."); return -1; } // Callbacks ptp_usb->callback_active = 1; ptp_usb->current_transfer_total = ob->oi.ObjectCompressedSize+ PTP_USB_BULK_HDR_LEN+sizeof(uint32_t); // Request length, one parameter ptp_usb->current_transfer_complete = 0; ptp_usb->current_transfer_callback = callback; ptp_usb->current_transfer_callback_data = data; ret = ptp_getobject_tofd(params, id, fd); ptp_usb->callback_active = 0; ptp_usb->current_transfer_callback = NULL; ptp_usb->current_transfer_callback_data = NULL; if (ret == PTP_ERROR_CANCEL) { add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Get_File_From_File_Descriptor(): Cancelled transfer."); return -1; } if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_File_To_File_Descriptor(): Could not get file from device."); return -1; } return 0; } /** * This gets a file off the device and calls put_func * with chunks of data * * @param device a pointer to the device to get the file from. * @param id the file ID of the file to retrieve. * @param put_func the function to call when we have data. * @param priv the user-defined pointer that is passed to * put_func. * @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. */ int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *device, uint32_t const id, MTPDataPutFunc put_func, void * priv, LIBMTP_progressfunc_t const callback, void const * const data) { PTPObject *ob; uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; ret = ptp_object_want (params, id, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Could not get object info."); return -1; } if (ob->oi.ObjectFormat == PTP_OFC_Association) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_File_To_File_Descriptor(): Bad object format."); return -1; } // Callbacks ptp_usb->callback_active = 1; ptp_usb->current_transfer_total = ob->oi.ObjectCompressedSize+ PTP_USB_BULK_HDR_LEN+sizeof(uint32_t); // Request length, one parameter ptp_usb->current_transfer_complete = 0; ptp_usb->current_transfer_callback = callback; ptp_usb->current_transfer_callback_data = data; MTPDataHandler mtp_handler; mtp_handler.getfunc = NULL; mtp_handler.putfunc = put_func; mtp_handler.priv = priv; PTPDataHandler handler; handler.getfunc = NULL; handler.putfunc = put_func_wrapper; handler.priv = &mtp_handler; ret = ptp_getobject_to_handler(params, id, &handler); ptp_usb->callback_active = 0; ptp_usb->current_transfer_callback = NULL; ptp_usb->current_transfer_callback_data = NULL; if (ret == PTP_ERROR_CANCEL) { add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Get_File_From_File_Descriptor(): Cancelled transfer."); return -1; } if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_File_To_File_Descriptor(): Could not get file from device."); return -1; } return 0; } /** * This gets a track off the device to a file identified * by a filename. This is actually just a wrapper for the * \c LIBMTP_Get_Track_To_File() function. * @param device a pointer to the device to get the track from. * @param id the track ID of the track to retrieve. * @param path a filename to use for the retrieved track. * @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Get_Track_To_File_Descriptor() */ int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t *device, uint32_t const id, char const * const path, LIBMTP_progressfunc_t const callback, void const * const data) { // This is just a wrapper return LIBMTP_Get_File_To_File(device, id, path, callback, data); } /** * This gets a track off the device to a file identified * by a file descriptor. This is actually just a wrapper for * the \c LIBMTP_Get_File_To_File_Descriptor() function. * @param device a pointer to the device to get the track from. * @param id the track ID of the track to retrieve. * @param fd a file descriptor to write the track to. * @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Get_Track_To_File() */ int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t *device, uint32_t const id, int const fd, LIBMTP_progressfunc_t const callback, void const * const data) { // This is just a wrapper return LIBMTP_Get_File_To_File_Descriptor(device, id, fd, callback, data); } /** * This gets a track off the device to a handler function. * This is actually just a wrapper for * the \c LIBMTP_Get_File_To_Handler() function. * @param device a pointer to the device to get the track from. * @param id the track ID of the track to retrieve. * @param put_func the function to call when we have data. * @param priv the user-defined pointer that is passed to * put_func. * @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. */ int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *device, uint32_t const id, MTPDataPutFunc put_func, void * priv, LIBMTP_progressfunc_t const callback, void const * const data) { // This is just a wrapper return LIBMTP_Get_File_To_Handler(device, id, put_func, priv, callback, data); } /** * This function sends a track from a local file to an * MTP device. A filename and a set of metadata must be * given as input. * @param device a pointer to the device to send the track to. * @param path the filename of a local file which will be sent. * @param metadata a track metadata set to be written along with the file. * After this call the field metadata->item_id * will contain the new track ID. Other fields such * as the metadata->filename, metadata->parent_id * or metadata->storage_id may also change during this * operation due to device restrictions, so do not rely on the * contents of this struct to be preserved in any way. *
    *
  • metadata->parent_id should be set to the parent * (e.g. folder) to store this track in. Since some * devices are a bit picky about where files * are placed, a default folder will be chosen if libmtp * has detected one for the current filetype and this * parameter is set to 0. If this is 0 and no default folder * can be found, the file will be stored in the root folder. *
  • metadata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this track in. Setting this to 0 will store * the track on the primary storage. *
* @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Send_Track_From_File_Descriptor() * @see LIBMTP_Send_File_From_File() * @see LIBMTP_Delete_Object() */ int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *device, char const * const path, LIBMTP_track_t * const metadata, LIBMTP_progressfunc_t const callback, void const * const data) { int fd; int ret; // Sanity check if (path == NULL) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Track_From_File(): Bad arguments, path was NULL."); return -1; } // Open file #ifdef __WIN32__ #ifdef USE_WINDOWS_IO_H if ( (fd = _open(path, O_RDONLY|O_BINARY)) == -1 ) { #else if ( (fd = open(path, O_RDONLY|O_BINARY)) == -1 ) { #endif #else if ( (fd = open(path, O_RDONLY)) == -1) { #endif LIBMTP_ERROR("LIBMTP_Send_Track_From_File(): Could not open source file \"%s\"\n", path); return -1; } ret = LIBMTP_Send_Track_From_File_Descriptor(device, fd, metadata, callback, data); // Close file. #ifdef USE_WINDOWS_IO_H _close(fd); #else close(fd); #endif return ret; } /** * This helper function checks if a filename already exists on the device * @param PTPParams* * @param string representing the filename * @return 0 if the filename doesn't exist, -1 if it does */ static int check_filename_exists(PTPParams* params, char const * const filename) { int i; for (i = 0; i < params->nrofobjects; i++) { char *fname = params->objects[i].oi.Filename; if ((fname != NULL) && (strcmp(filename, fname) == 0)) { return -1; } } return 0; } /** * This helper function returns a unique filename, with a random string before the extension * @param string representing the original filename * @return a string representing the unique filename */ static char *generate_unique_filename(PTPParams* params, char const * const filename) { int suffix; char * extension_position; if (check_filename_exists(params, filename)) { extension_position = strrchr(filename,'.'); char basename[extension_position - filename + 1]; strncpy(basename, filename, extension_position - filename); basename[extension_position - filename] = '\0'; suffix = 1; char newname[ strlen(basename) + 6 + strlen(extension_position)]; sprintf(newname, "%s_%d%s", basename, suffix, extension_position); while ((check_filename_exists(params, newname)) && (suffix < 1000000)) { suffix++; sprintf(newname, "%s_%d%s", basename, suffix, extension_position); } return strdup(newname); } else { return strdup(filename); } } /** * This function sends a track from a file descriptor to an * MTP device. A filename and a set of metadata must be * given as input. * @param device a pointer to the device to send the track to. * @param fd the filedescriptor for a local file which will be sent. * @param metadata a track metadata set to be written along with the file. * After this call the field metadata->item_id * will contain the new track ID. Other fields such * as the metadata->filename, metadata->parent_id * or metadata->storage_id may also change during this * operation due to device restrictions, so do not rely on the * contents of this struct to be preserved in any way. *
    *
  • metadata->parent_id should be set to the parent * (e.g. folder) to store this track in. Since some * devices are a bit picky about where files * are placed, a default folder will be chosen if libmtp * has detected one for the current filetype and this * parameter is set to 0. If this is 0 and no default folder * can be found, the file will be stored in the root folder. *
  • metadata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this track in. Setting this to 0 will store * the track on the primary storage. *
* @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Send_Track_From_File() * @see LIBMTP_Delete_Object() */ int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *device, int const fd, LIBMTP_track_t * const metadata, LIBMTP_progressfunc_t const callback, void const * const data) { int subcall_ret; LIBMTP_file_t filedata; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; PTPParams *params = (PTPParams *) device->params; // Sanity check, is this really a track? if (!LIBMTP_FILETYPE_IS_TRACK(metadata->filetype)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Track_From_File_Descriptor(): " "I don't think this is actually a track, strange filetype..."); } // Wrap around the file transfer function filedata.item_id = metadata->item_id; filedata.parent_id = metadata->parent_id; filedata.storage_id = metadata->storage_id; if FLAG_UNIQUE_FILENAMES(ptp_usb) { filedata.filename = generate_unique_filename(params, metadata->filename); } else { filedata.filename = metadata->filename; } filedata.filesize = metadata->filesize; filedata.filetype = metadata->filetype; filedata.next = NULL; subcall_ret = LIBMTP_Send_File_From_File_Descriptor(device, fd, &filedata, callback, data); if (subcall_ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Track_From_File_Descriptor(): " "subcall to LIBMTP_Send_File_From_File_Descriptor failed."); // We used to delete the file here, but don't... It might be OK after all. // (void) LIBMTP_Delete_Object(device, metadata->item_id); return -1; } // Pick up new item (and parent, storage) ID metadata->item_id = filedata.item_id; metadata->parent_id = filedata.parent_id; metadata->storage_id = filedata.storage_id; // Set track metadata for the new fine track subcall_ret = LIBMTP_Update_Track_Metadata(device, metadata); if (subcall_ret != 0) { // Subcall will add error to errorstack // We used to delete the file here, but don't... It might be OK after all. // (void) LIBMTP_Delete_Object(device, metadata->item_id); return -1; } // note we don't need to update the cache here because LIBMTP_Send_File_From_File_Descriptor // has added the object handle and LIBMTP_Update_Track_Metadata has added the metadata. return 0; } /** * This function sends a track from a handler function to an * MTP device. A filename and a set of metadata must be * given as input. * @param device a pointer to the device to send the track to. * @param get_func the function to call when we have data. * @param priv the user-defined pointer that is passed to * get_func. * @param metadata a track metadata set to be written along with the file. * After this call the field metadata->item_id * will contain the new track ID. Other fields such * as the metadata->filename, metadata->parent_id * or metadata->storage_id may also change during this * operation due to device restrictions, so do not rely on the * contents of this struct to be preserved in any way. *
    *
  • metadata->parent_id should be set to the parent * (e.g. folder) to store this track in. Since some * devices are a bit picky about where files * are placed, a default folder will be chosen if libmtp * has detected one for the current filetype and this * parameter is set to 0. If this is 0 and no default folder * can be found, the file will be stored in the root folder. *
  • metadata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this track in. Setting this to 0 will store * the track on the primary storage. *
* @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Send_Track_From_File() * @see LIBMTP_Delete_Object() */ int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *device, MTPDataGetFunc get_func, void * priv, LIBMTP_track_t * const metadata, LIBMTP_progressfunc_t const callback, void const * const data) { int subcall_ret; LIBMTP_file_t filedata; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; PTPParams *params = (PTPParams *) device->params; // Sanity check, is this really a track? if (!LIBMTP_FILETYPE_IS_TRACK(metadata->filetype)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Track_From_Handler(): " "I don't think this is actually a track, strange filetype..."); } // Wrap around the file transfer function filedata.item_id = metadata->item_id; filedata.parent_id = metadata->parent_id; filedata.storage_id = metadata->storage_id; if FLAG_UNIQUE_FILENAMES(ptp_usb) { filedata.filename = generate_unique_filename(params, metadata->filename); } else { filedata.filename = metadata->filename; } filedata.filesize = metadata->filesize; filedata.filetype = metadata->filetype; filedata.next = NULL; subcall_ret = LIBMTP_Send_File_From_Handler(device, get_func, priv, &filedata, callback, data); if (subcall_ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Track_From_Handler(): " "subcall to LIBMTP_Send_File_From_Handler failed."); // We used to delete the file here, but don't... It might be OK after all. // (void) LIBMTP_Delete_Object(device, metadata->item_id); return -1; } // Pick up new item (and parent, storage) ID metadata->item_id = filedata.item_id; metadata->parent_id = filedata.parent_id; metadata->storage_id = filedata.storage_id; // Set track metadata for the new fine track subcall_ret = LIBMTP_Update_Track_Metadata(device, metadata); if (subcall_ret != 0) { // Subcall will add error to errorstack // We used to delete the file here, but don't... It might be OK after all. // (void) LIBMTP_Delete_Object(device, metadata->item_id); return -1; } // note we don't need to update the cache here because LIBMTP_Send_File_From_File_Descriptor // has added the object handle and LIBMTP_Update_Track_Metadata has added the metadata. return 0; } /** * This function sends a local file to an MTP device. * A filename and a set of metadata must be * given as input. * @param device a pointer to the device to send the track to. * @param path the filename of a local file which will be sent. * @param filedata a file metadata set to be written along with the file. * After this call the field filedata->item_id * will contain the new file ID. Other fields such * as the filedata->filename, filedata->parent_id * or filedata->storage_id may also change during this * operation due to device restrictions, so do not rely on the * contents of this struct to be preserved in any way. *
    *
  • filedata->parent_id should be set to the parent * (e.g. folder) to store this file in. If this is 0, * the file will be stored in the root folder. *
  • filedata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this file in. Setting this to 0 will store * the file on the primary storage. *
* @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Send_File_From_File_Descriptor() * @see LIBMTP_Delete_Object() */ int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *device, char const * const path, LIBMTP_file_t * const filedata, LIBMTP_progressfunc_t const callback, void const * const data) { int fd; int ret; // Sanity check if (path == NULL) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_File_From_File(): Bad arguments, path was NULL."); return -1; } // Open file #ifdef __WIN32__ #ifdef USE_WINDOWS_IO_H if ( (fd = _open(path, O_RDONLY|O_BINARY)) == -1 ) { #else if ( (fd = open(path, O_RDONLY|O_BINARY)) == -1 ) { #endif #else if ( (fd = open(path, O_RDONLY)) == -1) { #endif add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_File_From_File(): Could not open source file."); return -1; } ret = LIBMTP_Send_File_From_File_Descriptor(device, fd, filedata, callback, data); // Close file. #ifdef USE_WINDOWS_IO_H _close(fd); #else close(fd); #endif return ret; } /** * This function sends a generic file from a file descriptor to an * MTP device. A filename and a set of metadata must be * given as input. * * This can potentially be used for sending in a stream of unknown * length. Send music files with * LIBMTP_Send_Track_From_File_Descriptor() * * @param device a pointer to the device to send the file to. * @param fd the filedescriptor for a local file which will be sent. * @param filedata a file metadata set to be written along with the file. * After this call the field filedata->item_id * will contain the new file ID. Other fields such * as the filedata->filename, filedata->parent_id * or filedata->storage_id may also change during this * operation due to device restrictions, so do not rely on the * contents of this struct to be preserved in any way. *
    *
  • filedata->parent_id should be set to the parent * (e.g. folder) to store this file in. If this is 0, * the file will be stored in the root folder. *
  • filedata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this file in. Setting this to 0 will store * the file on the primary storage. *
* @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Send_File_From_File() * @see LIBMTP_Send_Track_From_File_Descriptor() * @see LIBMTP_Delete_Object() */ int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *device, int const fd, LIBMTP_file_t * const filedata, LIBMTP_progressfunc_t const callback, void const * const data) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; LIBMTP_file_t *newfilemeta; int oldtimeout; int timeout; if (send_file_object_info(device, filedata)) { // no need to output an error since send_file_object_info will already have done so return -1; } // Callbacks ptp_usb->callback_active = 1; // The callback will deactivate itself after this amount of data has been sent // One BULK header for the request, one for the data phase. No parameters to the request. ptp_usb->current_transfer_total = filedata->filesize+PTP_USB_BULK_HDR_LEN*2; ptp_usb->current_transfer_complete = 0; ptp_usb->current_transfer_callback = callback; ptp_usb->current_transfer_callback_data = data; /* * We might need to increase the timeout here, files can be pretty * large. Take the default timeout and add the calculated time for * this transfer */ get_usb_device_timeout(ptp_usb, &oldtimeout); timeout = oldtimeout + (ptp_usb->current_transfer_total / guess_usb_speed(ptp_usb)) * 1000; set_usb_device_timeout(ptp_usb, timeout); ret = ptp_sendobject_fromfd(params, fd, filedata->filesize); ptp_usb->callback_active = 0; ptp_usb->current_transfer_callback = NULL; ptp_usb->current_transfer_callback_data = NULL; set_usb_device_timeout(ptp_usb, oldtimeout); if (ret == PTP_ERROR_CANCEL) { add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Send_File_From_File_Descriptor(): Cancelled transfer."); return -1; } if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_File_From_File_Descriptor(): " "Could not send object."); return -1; } add_object_to_cache(device, filedata->item_id); /* * Get the device-assigned parent_id from the cache. * The operation that adds it to the cache will * look it up from the device, so we get the new * parent_id from the cache. */ newfilemeta = LIBMTP_Get_Filemetadata(device, filedata->item_id); if (newfilemeta != NULL) { filedata->parent_id = newfilemeta->parent_id; filedata->storage_id = newfilemeta->storage_id; LIBMTP_destroy_file_t(newfilemeta); } else { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_File_From_File_Descriptor(): " "Could not retrieve updated metadata."); return -1; } return 0; } /** * This function sends a generic file from a handler function to an * MTP device. A filename and a set of metadata must be * given as input. * * This can potentially be used for sending in a stream of unknown * length. Send music files with * LIBMTP_Send_Track_From_Handler() * * @param device a pointer to the device to send the file to. * @param get_func the function to call to get data to write * @param priv a user-defined pointer that is passed along to * get_func. If not used, this is set to NULL. * @param filedata a file metadata set to be written along with the file. * After this call the field filedata->item_id * will contain the new file ID. Other fields such * as the filedata->filename, filedata->parent_id * or filedata->storage_id may also change during this * operation due to device restrictions, so do not rely on the * contents of this struct to be preserved in any way. *
    *
  • filedata->parent_id should be set to the parent * (e.g. folder) to store this file in. If this is 0, * the file will be stored in the root folder. *
  • filedata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this file in. Setting this to 0 will store * the file on the primary storage. *
* @param callback a progress indicator function or NULL to ignore. * @param data a user-defined pointer that is passed along to * the progress function in order to * pass along some user defined data to the progress * updates. If not used, set this to NULL. * @return 0 if the transfer was successful, any other value means * failure. * @see LIBMTP_Send_File_From_File() * @see LIBMTP_Send_Track_From_File_Descriptor() * @see LIBMTP_Delete_Object() */ int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *device, MTPDataGetFunc get_func, void * priv, LIBMTP_file_t * const filedata, LIBMTP_progressfunc_t const callback, void const * const data) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; LIBMTP_file_t *newfilemeta; if (send_file_object_info(device, filedata)) { // no need to output an error since send_file_object_info will already have done so return -1; } // Callbacks ptp_usb->callback_active = 1; // The callback will deactivate itself after this amount of data has been sent // One BULK header for the request, one for the data phase. No parameters to the request. ptp_usb->current_transfer_total = filedata->filesize+PTP_USB_BULK_HDR_LEN*2; ptp_usb->current_transfer_complete = 0; ptp_usb->current_transfer_callback = callback; ptp_usb->current_transfer_callback_data = data; MTPDataHandler mtp_handler; mtp_handler.getfunc = get_func; mtp_handler.putfunc = NULL; mtp_handler.priv = priv; PTPDataHandler handler; handler.getfunc = get_func_wrapper; handler.putfunc = NULL; handler.priv = &mtp_handler; ret = ptp_sendobject_from_handler(params, &handler, filedata->filesize); ptp_usb->callback_active = 0; ptp_usb->current_transfer_callback = NULL; ptp_usb->current_transfer_callback_data = NULL; if (ret == PTP_ERROR_CANCEL) { add_error_to_errorstack(device, LIBMTP_ERROR_CANCELLED, "LIBMTP_Send_File_From_Handler(): Cancelled transfer."); return -1; } if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_File_From_Handler(): " "Could not send object."); return -1; } add_object_to_cache(device, filedata->item_id); /* * Get the device-assined parent_id from the cache. * The operation that adds it to the cache will * look it up from the device, so we get the new * parent_id from the cache. */ newfilemeta = LIBMTP_Get_Filemetadata(device, filedata->item_id); if (newfilemeta != NULL) { filedata->parent_id = newfilemeta->parent_id; filedata->storage_id = newfilemeta->storage_id; LIBMTP_destroy_file_t(newfilemeta); } else { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_File_From_Handler(): " "Could not retrieve updated metadata."); return -1; } return 0; } /** * This function sends the file object info, ready for sendobject * @param device a pointer to the device to send the file to. * @param filedata a file metadata set to be written along with the file. * @return 0 if the transfer was successful, any other value means * failure. */ static int send_file_object_info(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *filedata) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; uint32_t store; int use_primary_storage = 1; uint16_t of = map_libmtp_type_to_ptp_type(filedata->filetype); LIBMTP_devicestorage_t *storage; uint32_t localph = filedata->parent_id; uint16_t ret; int i; #if 0 // Sanity check: no zerolength files on some devices? // If the zerolength files cause problems on some devices, // then add a bug flag for this. if (filedata->filesize == 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "send_file_object_info(): " "File of zero size."); return -1; } #endif if (filedata->storage_id != 0) { store = filedata->storage_id; } else { store = get_suggested_storage_id(device, filedata->filesize, localph); } // Detect if something non-primary is in use. storage = device->storage; if (storage != NULL && store != storage->id) { use_primary_storage = 0; } /* * If no destination folder was given, look up a default * folder if possible. Perhaps there is some way of retrieveing * the default folder for different forms of content, what * do I know, we use a fixed list in lack of any better method. * Some devices obviously need to have their files in certain * folders in order to find/display them at all (hello Creative), * so we have to have a method for this. We only do this if the * primary storage is in use. */ if (localph == 0 && use_primary_storage) { if (LIBMTP_FILETYPE_IS_AUDIO(filedata->filetype)) { localph = device->default_music_folder; } else if (LIBMTP_FILETYPE_IS_VIDEO(filedata->filetype)) { localph = device->default_video_folder; } else if (of == PTP_OFC_EXIF_JPEG || of == PTP_OFC_JP2 || of == PTP_OFC_JPX || of == PTP_OFC_JFIF || of == PTP_OFC_TIFF || of == PTP_OFC_TIFF_IT || of == PTP_OFC_BMP || of == PTP_OFC_GIF || of == PTP_OFC_PICT || of == PTP_OFC_PNG || of == PTP_OFC_MTP_WindowsImageFormat) { localph = device->default_picture_folder; } else if (of == PTP_OFC_MTP_vCalendar1 || of == PTP_OFC_MTP_vCalendar2 || of == PTP_OFC_MTP_UndefinedContact || of == PTP_OFC_MTP_vCard2 || of == PTP_OFC_MTP_vCard3 || of == PTP_OFC_MTP_UndefinedCalendarItem) { localph = device->default_organizer_folder; } else if (of == PTP_OFC_Text) { localph = device->default_text_folder; } } // Here we wire the type to unknown on bugged, but // Ogg or FLAC-supportive devices. if (FLAG_OGG_IS_UNKNOWN(ptp_usb) && of == PTP_OFC_MTP_OGG) { of = PTP_OFC_Undefined; } if (FLAG_FLAC_IS_UNKNOWN(ptp_usb) && of == PTP_OFC_MTP_FLAC) { of = PTP_OFC_Undefined; } if (ptp_operation_issupported(params, PTP_OC_MTP_SendObjectPropList) && !FLAG_BROKEN_SEND_OBJECT_PROPLIST(ptp_usb)) { /* * MTP enhanched does it this way (from a sniff): * -> PTP_OC_MTP_SendObjectPropList (0x9808): * 20 00 00 00 01 00 08 98 1B 00 00 00 01 00 01 00 * FF FF FF FF 00 30 00 00 00 00 00 00 12 5E 00 00 * Length: 0x00000020 * Type: 0x0001 PTP_USB_CONTAINER_COMMAND * Code: 0x9808 * Transaction ID: 0x0000001B * Param1: 0x00010001 <- store * Param2: 0xffffffff <- parent handle (-1 ?) * Param3: 0x00003000 <- file type PTP_OFC_Undefined - we don't know about PDF files * Param4: 0x00000000 <- file length MSB (-0x0c header len) * Param5: 0x00005e12 <- file length LSB (-0x0c header len) * * -> PTP_OC_MTP_SendObjectPropList (0x9808): * 46 00 00 00 02 00 08 98 1B 00 00 00 03 00 00 00 * 00 00 00 00 07 DC FF FF 0D 4B 00 53 00 30 00 36 - dc07 = file name * 00 30 00 33 00 30 00 36 00 2E 00 70 00 64 00 66 * 00 00 00 00 00 00 00 03 DC 04 00 00 00 00 00 00 - dc03 = protection status * 00 4F DC 02 00 01 - dc4f = non consumable * Length: 0x00000046 * Type: 0x0002 PTP_USB_CONTAINER_DATA * Code: 0x9808 * Transaction ID: 0x0000001B * Metadata.... * 0x00000003 <- Number of metadata items * 0x00000000 <- Object handle, set to 0x00000000 since it is unknown! * 0xdc07 <- metadata type: file name * 0xffff <- metadata type: string * 0x0d <- number of (uint16_t) characters * 4b 53 30 36 30 33 30 36 2e 50 64 66 00 "KS060306.pdf", null terminated * 0x00000000 <- Object handle, set to 0x00000000 since it is unknown! * 0xdc03 <- metadata type: protection status * 0x0004 <- metadata type: uint16_t * 0x0000 <- not protected * 0x00000000 <- Object handle, set to 0x00000000 since it is unknown! * 0xdc4f <- non consumable * 0x0002 <- metadata type: uint8_t * 0x01 <- non-consumable (this device cannot display PDF) * * <- Read 0x18 bytes back * 18 00 00 00 03 00 01 20 1B 00 00 00 01 00 01 00 * 00 00 00 00 01 40 00 00 * Length: 0x000000018 * Type: 0x0003 PTP_USB_CONTAINER_RESPONSE * Code: 0x2001 PTP_OK * Transaction ID: 0x0000001B * Param1: 0x00010001 <- store * Param2: 0x00000000 <- parent handle * Param3: 0x00004001 <- new file/object ID * * -> PTP_OC_SendObject (0x100d) * 0C 00 00 00 01 00 0D 10 1C 00 00 00 * -> ... all the bytes ... * <- Read 0x0c bytes back * 0C 00 00 00 03 00 01 20 1C 00 00 00 * ... Then update metadata one-by one, actually (instead of sending it first!) ... */ MTPProperties *props = NULL; int nrofprops = 0; MTPProperties *prop = NULL; uint16_t *properties = NULL; uint32_t propcnt = 0; // default parent handle if (localph == 0) localph = 0xFFFFFFFFU; // Set to -1 // Must be 0x00000000U for new objects filedata->item_id = 0x00000000U; ret = ptp_mtp_getobjectpropssupported(params, of, &propcnt, &properties); for (i=0;iObjectHandle = filedata->item_id; prop->property = PTP_OPC_ObjectFileName; prop->datatype = PTP_DTC_STR; if (filedata->filename != NULL) { prop->propval.str = strdup(filedata->filename); if (FLAG_ONLY_7BIT_FILENAMES(ptp_usb)) { strip_7bit_from_utf8(prop->propval.str); } } break; case PTP_OPC_ProtectionStatus: prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = filedata->item_id; prop->property = PTP_OPC_ProtectionStatus; prop->datatype = PTP_DTC_UINT16; prop->propval.u16 = 0x0000U; /* Not protected */ break; case PTP_OPC_NonConsumable: prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = filedata->item_id; prop->property = PTP_OPC_NonConsumable; prop->datatype = PTP_DTC_UINT8; prop->propval.u8 = 0x00; /* It is supported, then it is consumable */ break; case PTP_OPC_Name: prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = filedata->item_id; prop->property = PTP_OPC_Name; prop->datatype = PTP_DTC_STR; if (filedata->filename != NULL) prop->propval.str = strdup(filedata->filename); break; case PTP_OPC_DateModified: // Tag with current time if that is supported if (!FLAG_CANNOT_HANDLE_DATEMODIFIED(ptp_usb)) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = filedata->item_id; prop->property = PTP_OPC_DateModified; prop->datatype = PTP_DTC_STR; prop->propval.str = get_iso8601_stamp(); filedata->modificationdate = time(NULL); } break; } } ptp_free_objectpropdesc(&opd); } free(properties); ret = ptp_mtp_sendobjectproplist(params, &store, &localph, &filedata->item_id, of, filedata->filesize, props, nrofprops); /* Free property list */ ptp_destroy_object_prop_list(props, nrofprops); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "send_file_object_info():" "Could not send object property list."); if (ret == PTP_RC_AccessDenied) { add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED."); } return -1; } } else if (ptp_operation_issupported(params,PTP_OC_SendObjectInfo)) { PTPObjectInfo new_file; memset(&new_file, 0, sizeof(PTPObjectInfo)); new_file.Filename = filedata->filename; if (FLAG_ONLY_7BIT_FILENAMES(ptp_usb)) { strip_7bit_from_utf8(new_file.Filename); } if (filedata->filesize > 0xFFFFFFFFL) { // This is a kludge in the MTP standard for large files. new_file.ObjectCompressedSize = (uint32_t) 0xFFFFFFFF; } else { new_file.ObjectCompressedSize = (uint32_t) filedata->filesize; } new_file.ObjectFormat = of; new_file.StorageID = store; new_file.ParentObject = localph; new_file.ModificationDate = time(NULL); // Create the object ret = ptp_sendobjectinfo(params, &store, &localph, &filedata->item_id, &new_file); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "send_file_object_info(): " "Could not send object info."); if (ret == PTP_RC_AccessDenied) { add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED."); } return -1; } // NOTE: the char* pointers inside new_file are not copies so don't // try to destroy this objectinfo! } // Now there IS an object with this parent handle. filedata->parent_id = localph; return 0; } /** * This function updates the MTP track object metadata on a * single file identified by an object ID. * @param device a pointer to the device to update the track * metadata on. * @param metadata a track metadata set to be written to the file. * notice that the track_id field of the * metadata structure must be correct so that the * function can update the right file. If some properties * of this metadata are set to NULL (strings) or 0 * (numerical values) they will be discarded and the * track will not be tagged with these blank values. * @return 0 on success, any other value means failure. If some * or all of the properties fail to update we will still * return success. On some devices (notably iRiver T30) * properties that exist cannot be updated. */ int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *device, LIBMTP_track_t const * const metadata) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; uint32_t i; uint16_t *properties = NULL; uint32_t propcnt = 0; // First see which properties can be set on this file format and apply accordingly // i.e only try to update this metadata for object tags that exist on the current player. ret = ptp_mtp_getobjectpropssupported(params, map_libmtp_type_to_ptp_type(metadata->filetype), &propcnt, &properties); if (ret != PTP_RC_OK) { // Just bail out for now, nothing is ever set. add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not retrieve supported object properties."); return -1; } if (ptp_operation_issupported(params, PTP_OC_MTP_SetObjPropList) && !FLAG_BROKEN_SET_OBJECT_PROPLIST(ptp_usb)) { MTPProperties *props = NULL; MTPProperties *prop = NULL; int nrofprops = 0; for (i=0;ifiletype), &opd); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not get property description."); } else if (opd.GetSet) { switch (properties[i]) { case PTP_OPC_Name: if (metadata->title == NULL) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Name; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(metadata->title); break; case PTP_OPC_AlbumName: if (metadata->album == NULL) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_AlbumName; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(metadata->album); break; case PTP_OPC_Artist: if (metadata->artist == NULL) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Artist; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(metadata->artist); break; case PTP_OPC_Composer: if (metadata->composer == NULL) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Composer; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(metadata->composer); break; case PTP_OPC_Genre: if (metadata->genre == NULL) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Genre; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(metadata->genre); break; case PTP_OPC_Duration: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Duration; prop->datatype = PTP_DTC_UINT32; prop->propval.u32 = adjust_u32(metadata->duration, &opd); break; case PTP_OPC_Track: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Track; prop->datatype = PTP_DTC_UINT16; prop->propval.u16 = adjust_u16(metadata->tracknumber, &opd); break; case PTP_OPC_OriginalReleaseDate: if (metadata->date == NULL) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_OriginalReleaseDate; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(metadata->date); break; case PTP_OPC_SampleRate: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_SampleRate; prop->datatype = PTP_DTC_UINT32; prop->propval.u32 = adjust_u32(metadata->samplerate, &opd); break; case PTP_OPC_NumberOfChannels: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_NumberOfChannels; prop->datatype = PTP_DTC_UINT16; prop->propval.u16 = adjust_u16(metadata->nochannels, &opd); break; case PTP_OPC_AudioWAVECodec: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_AudioWAVECodec; prop->datatype = PTP_DTC_UINT32; prop->propval.u32 = adjust_u32(metadata->wavecodec, &opd); break; case PTP_OPC_AudioBitRate: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_AudioBitRate; prop->datatype = PTP_DTC_UINT32; prop->propval.u32 = adjust_u32(metadata->bitrate, &opd); break; case PTP_OPC_BitRateType: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_BitRateType; prop->datatype = PTP_DTC_UINT16; prop->propval.u16 = adjust_u16(metadata->bitratetype, &opd); break; case PTP_OPC_Rating: // TODO: shall this be set for rating 0? if (metadata->rating == 0) break; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_Rating; prop->datatype = PTP_DTC_UINT16; prop->propval.u16 = adjust_u16(metadata->rating, &opd); break; case PTP_OPC_UseCount: prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_UseCount; prop->datatype = PTP_DTC_UINT32; prop->propval.u32 = adjust_u32(metadata->usecount, &opd); break; case PTP_OPC_DateModified: if (!FLAG_CANNOT_HANDLE_DATEMODIFIED(ptp_usb)) { // Tag with current time if that is supported prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = metadata->item_id; prop->property = PTP_OPC_DateModified; prop->datatype = PTP_DTC_STR; prop->propval.str = get_iso8601_stamp(); } break; default: break; } } ptp_free_objectpropdesc(&opd); } // NOTE: File size is not updated, this should not change anyway. // neither will we change the filename. ret = ptp_mtp_setobjectproplist(params, props, nrofprops); ptp_destroy_object_prop_list(props, nrofprops); if (ret != PTP_RC_OK) { // TODO: return error of which property we couldn't set add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set object property list."); free(properties); return -1; } } else if (ptp_operation_issupported(params,PTP_OC_MTP_SetObjectPropValue)) { for (i=0;ifiletype), &opd); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not get property description."); } else if (opd.GetSet) { switch (properties[i]) { case PTP_OPC_Name: // Update title ret = set_object_string(device, metadata->item_id, PTP_OPC_Name, metadata->title); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track title."); } break; case PTP_OPC_AlbumName: // Update album ret = set_object_string(device, metadata->item_id, PTP_OPC_AlbumName, metadata->album); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track album name."); } break; case PTP_OPC_Artist: // Update artist ret = set_object_string(device, metadata->item_id, PTP_OPC_Artist, metadata->artist); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track artist name."); } break; case PTP_OPC_Composer: // Update composer ret = set_object_string(device, metadata->item_id, PTP_OPC_Composer, metadata->composer); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track composer name."); } break; case PTP_OPC_Genre: // Update genre (but only if valid) if (metadata->genre) { ret = set_object_string(device, metadata->item_id, PTP_OPC_Genre, metadata->genre); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): " "could not set genre."); } } break; case PTP_OPC_Duration: // Update duration if (metadata->duration != 0) { ret = set_object_u32(device, metadata->item_id, PTP_OPC_Duration, adjust_u32(metadata->duration, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track duration."); } } break; case PTP_OPC_Track: // Update track number. if (metadata->tracknumber != 0) { ret = set_object_u16(device, metadata->item_id, PTP_OPC_Track, adjust_u16(metadata->tracknumber, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track tracknumber."); } } break; case PTP_OPC_OriginalReleaseDate: // Update creation datetime // The date can be zero, but some devices do not support setting zero // dates (and it seems that a zero date should never be set anyway) if (metadata->date) { ret = set_object_string(device, metadata->item_id, PTP_OPC_OriginalReleaseDate, metadata->date); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set track release date."); } } break; // These are, well not so important. case PTP_OPC_SampleRate: // Update sample rate if (metadata->samplerate != 0) { ret = set_object_u32(device, metadata->item_id, PTP_OPC_SampleRate, adjust_u32(metadata->samplerate, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set samplerate."); } } break; case PTP_OPC_NumberOfChannels: // Update number of channels if (metadata->nochannels != 0) { ret = set_object_u16(device, metadata->item_id, PTP_OPC_NumberOfChannels, adjust_u16(metadata->nochannels, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set number of channels."); } } break; case PTP_OPC_AudioWAVECodec: // Update WAVE codec if (metadata->wavecodec != 0) { ret = set_object_u32(device, metadata->item_id, PTP_OPC_AudioWAVECodec, adjust_u32(metadata->wavecodec, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set WAVE codec."); } } break; case PTP_OPC_AudioBitRate: // Update bitrate if (metadata->bitrate != 0) { ret = set_object_u32(device, metadata->item_id, PTP_OPC_AudioBitRate, adjust_u32(metadata->bitrate, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set bitrate."); } } break; case PTP_OPC_BitRateType: // Update bitrate type if (metadata->bitratetype != 0) { ret = set_object_u16(device, metadata->item_id, PTP_OPC_BitRateType, adjust_u16(metadata->bitratetype, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set bitratetype."); } } break; case PTP_OPC_Rating: // Update user rating // TODO: shall this be set for rating 0? if (metadata->rating != 0) { ret = set_object_u16(device, metadata->item_id, PTP_OPC_Rating, adjust_u16(metadata->rating, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set user rating."); } } break; case PTP_OPC_UseCount: // Update use count, set even to zero if desired. ret = set_object_u32(device, metadata->item_id, PTP_OPC_UseCount, adjust_u32(metadata->usecount, &opd)); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set use count."); } break; case PTP_OPC_DateModified: if (!FLAG_CANNOT_HANDLE_DATEMODIFIED(ptp_usb)) { // Update modification time if supported char *tmpstamp = get_iso8601_stamp(); ret = set_object_string(device, metadata->item_id, PTP_OPC_DateModified, tmpstamp); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "could not set modification date."); } free(tmpstamp); } break; // NOTE: File size is not updated, this should not change anyway. // neither will we change the filename. default: break; } } ptp_free_objectpropdesc(&opd); } } else { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Update_Track_Metadata(): " "Your device doesn't seem to support any known way of setting metadata."); free(properties); return -1; } // update cached object properties if metadata cache exists update_metadata_cache(device, metadata->item_id); free(properties); return 0; } /** * This function deletes a single file, track, playlist, folder or * any other object off the MTP device, identified by the object ID. * * If you delete a folder, there is no guarantee that the device will * really delete all the files that were in that folder, rather it is * expected that they will not be deleted, and will turn up in object * listings with parent set to a non-existant object ID. The safe way * to do this is to recursively delete all files (and folders) contained * in the folder, then the folder itself. * * @param device a pointer to the device to delete the object from. * @param object_id the object to delete. * @return 0 on success, any other value means failure. */ int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *device, uint32_t object_id) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; ret = ptp_deleteobject(params, object_id, 0); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Delete_Object(): could not delete object."); return -1; } return 0; } /** * Internal function to update an object filename property. */ static int set_object_filename(LIBMTP_mtpdevice_t *device, uint32_t object_id, uint16_t ptp_type, const char **newname_ptr) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; PTPObjectPropDesc opd; uint16_t ret; char *newname; // See if we can modify the filename on this kind of files. ret = ptp_mtp_getobjectpropdesc(params, PTP_OPC_ObjectFileName, ptp_type, &opd); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): " "could not get property description."); return -1; } if (!opd.GetSet) { ptp_free_objectpropdesc(&opd); add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): " " property is not settable."); // TODO: we COULD actually upload/download the object here, if we feel // like wasting time for the user. return -1; } newname = strdup(*newname_ptr); if (FLAG_ONLY_7BIT_FILENAMES(ptp_usb)) { strip_7bit_from_utf8(newname); } if (ptp_operation_issupported(params, PTP_OC_MTP_SetObjPropList) && !FLAG_BROKEN_SET_OBJECT_PROPLIST(ptp_usb)) { MTPProperties *props = NULL; MTPProperties *prop = NULL; int nrofprops = 0; prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = object_id; prop->property = PTP_OPC_ObjectFileName; prop->datatype = PTP_DTC_STR; prop->propval.str = newname; ret = ptp_mtp_setobjectproplist(params, props, nrofprops); ptp_destroy_object_prop_list(props, nrofprops); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): " " could not set object property list."); ptp_free_objectpropdesc(&opd); return -1; } } else if (ptp_operation_issupported(params, PTP_OC_MTP_SetObjectPropValue)) { ret = set_object_string(device, object_id, PTP_OPC_ObjectFileName, newname); if (ret != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): " " could not set object filename."); ptp_free_objectpropdesc(&opd); return -1; } } else { free(newname); add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "set_object_filename(): " " your device doesn't seem to support any known way of setting metadata."); ptp_free_objectpropdesc(&opd); return -1; } ptp_free_objectpropdesc(&opd); // update cached object properties if metadata cache exists update_metadata_cache(device, object_id); return 0; } /** * This function renames a single file. * This simply means that the PTP_OPC_ObjectFileName property * is updated, if this is supported by the device. * * @param device a pointer to the device that contains the file. * @param file the file metadata of the file to rename. * On success, the filename member is updated. Be aware, that * this name can be different than newname depending of device restrictions. * @param newname the new filename for this object. * @return 0 on success, any other value means failure. */ int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *file, const char *newname) { int ret; ret = set_object_filename(device, file->item_id, map_libmtp_type_to_ptp_type(file->filetype), &newname); if (ret != 0) { return ret; } free(file->filename); file->filename = strdup(newname); return ret; } /** * This function renames a single folder. * This simply means that the PTP_OPC_ObjectFileName property * is updated, if this is supported by the device. * * @param device a pointer to the device that contains the file. * @param folder the folder metadata of the folder to rename. * On success, the name member is updated. Be aware, that * this name can be different than newname depending of device restrictions. * @param newname the new name for this object. * @return 0 on success, any other value means failure. */ int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *device, LIBMTP_folder_t *folder, const char* newname) { int ret; ret = set_object_filename(device, folder->folder_id, PTP_OFC_Association, &newname); if (ret != 0) { return ret; } free(folder->name); folder->name = strdup(newname); return ret; } /** * This function renames a single track. * This simply means that the PTP_OPC_ObjectFileName property * is updated, if this is supported by the device. * * @param device a pointer to the device that contains the file. * @param track the track metadata of the track to rename. * On success, the filename member is updated. Be aware, that * this name can be different than newname depending of device restrictions. * @param newname the new filename for this object. * @return 0 on success, any other value means failure. */ int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *device, LIBMTP_track_t *track, const char* newname) { int ret; ret = set_object_filename(device, track->item_id, map_libmtp_type_to_ptp_type(track->filetype), &newname); if (ret != 0) { return ret; } free(track->filename); track->filename = strdup(newname); return ret; } /** * This function renames a single playlist object file holder. * This simply means that the PTP_OPC_ObjectFileName * property is updated, if this is supported by the device. * The playlist filename should nominally end with an extension * like ".pla". * * NOTE: if you want to change the metadata the device display * about a playlist you must not use this function, * use LIBMTP_Update_Playlist() instead! * * @param device a pointer to the device that contains the file. * @param playlist the playlist metadata of the playlist to rename. * On success, the name member is updated. Be aware, that * this name can be different than newname depending of device restrictions. * @param newname the new name for this object. * @return 0 on success, any other value means failure. * @see LIBMTP_Update_Playlist() */ int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *playlist, const char* newname) { int ret; ret = set_object_filename(device, playlist->playlist_id, PTP_OFC_MTP_AbstractAudioVideoPlaylist, &newname); if (ret != 0) { return ret; } free(playlist->name); playlist->name = strdup(newname); return ret; } /** * This function renames a single album. * This simply means that the PTP_OPC_ObjectFileName * property is updated, if this is supported by the device. * The album filename should nominally end with an extension * like ".alb". * * NOTE: if you want to change the metadata the device display * about a playlist you must not use this function, * use LIBMTP_Update_Album() instead! * * @param device a pointer to the device that contains the file. * @param album the album metadata of the album to rename. * On success, the name member is updated. Be aware, that * this name can be different than newname depending of device restrictions. * @param newname the new name for this object. * @return 0 on success, any other value means failure. * @see LIBMTP_Update_Album() */ int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *device, LIBMTP_album_t *album, const char* newname) { int ret; ret = set_object_filename(device, album->album_id, PTP_OFC_MTP_AbstractAudioAlbum, &newname); if (ret != 0) { return ret; } free(album->name); album->name = strdup(newname); return ret; } /** * THIS FUNCTION IS DEPRECATED. PLEASE UPDATE YOUR CODE IN ORDER * NOT TO USE IT. * * @see LIBMTP_Set_File_Name() * @see LIBMTP_Set_Track_Name() * @see LIBMTP_Set_Folder_Name() * @see LIBMTP_Set_Playlist_Name() * @see LIBMTP_Set_Album_Name() */ int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *device, uint32_t object_id, char* newname) { int ret; LIBMTP_file_t *file; file = LIBMTP_Get_Filemetadata(device, object_id); if (file == NULL) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Set_Object_Filename(): " "could not get file metadata for target object."); return -1; } ret = set_object_filename(device, object_id, map_libmtp_type_to_ptp_type(file->filetype), (const char **) &newname); free(file); return ret; } /** * Helper function. This indicates if a track exists on the device * @param device a pointer to the device to get the track from. * @param id the track ID of the track to retrieve. * @return TRUE (!=0) if the track exists, FALSE (0) if not */ int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *device, uint32_t const id) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; PTPObject *ob; ret = ptp_object_want (params, id, 0, &ob); if (ret == PTP_RC_OK) return -1; return 0; } /** * This creates a new folder structure and allocates memory * for it. Notice that if you add strings to this structure they * will be freed by the corresponding LIBMTP_folder_track_t * operation later, so be careful of using strdup() when assigning * strings, e.g.: * * @return a pointer to the newly allocated folder structure. * @see LIBMTP_destroy_folder_t() */ LIBMTP_folder_t *LIBMTP_new_folder_t(void) { LIBMTP_folder_t *new = (LIBMTP_folder_t *) malloc(sizeof(LIBMTP_folder_t)); if (new == NULL) { return NULL; } new->folder_id = 0; new->parent_id = 0; new->storage_id = 0; new->name = NULL; new->sibling = NULL; new->child = NULL; return new; } /** * This recursively deletes the memory for a folder structure. * This shall typically be called on a top-level folder list to * detsroy the entire folder tree. * * @param folder folder structure to destroy * @see LIBMTP_new_folder_t() */ void LIBMTP_destroy_folder_t(LIBMTP_folder_t *folder) { if(folder == NULL) { return; } //Destroy from the bottom up if(folder->child != NULL) { LIBMTP_destroy_folder_t(folder->child); } if(folder->sibling != NULL) { LIBMTP_destroy_folder_t(folder->sibling); } if(folder->name != NULL) { free(folder->name); } free(folder); } /** * Helper function. Returns a folder structure for a * specified id. * * @param folderlist list of folders to search * @id id of folder to look for * @return a folder or NULL if not found */ LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t *folderlist, uint32_t id) { LIBMTP_folder_t *ret = NULL; if(folderlist == NULL) { return NULL; } if(folderlist->folder_id == id) { return folderlist; } if(folderlist->sibling) { ret = LIBMTP_Find_Folder(folderlist->sibling, id); } if(folderlist->child && ret == NULL) { ret = LIBMTP_Find_Folder(folderlist->child, id); } return ret; } /** * Function used to recursively get subfolders from params. */ static LIBMTP_folder_t *get_subfolders_for_folder(LIBMTP_folder_t *list, uint32_t parent) { LIBMTP_folder_t *retfolders = NULL; LIBMTP_folder_t *children, *iter, *curr; iter = list->sibling; while(iter != list) { if (iter->parent_id != parent) { iter = iter->sibling; continue; } /* We know that iter is a child of 'parent', therefore we can safely * hold on to 'iter' locally since no one else will steal it * from the 'list' as we recurse. */ children = get_subfolders_for_folder(list, iter->folder_id); curr = iter; iter = iter->sibling; // Remove curr from the list. curr->child->sibling = curr->sibling; curr->sibling->child = curr->child; // Attach the children to curr. curr->child = children; // Put this folder into the list of siblings. curr->sibling = retfolders; retfolders = curr; } return retfolders; } /** * This returns a list of all folders available * on the current MTP device. * * @param device a pointer to the device to get the folder listing for. * @param storage a storage ID to get the folder list from * @return a list of folders */ LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t *device, uint32_t const storage) { PTPParams *params = (PTPParams *) device->params; LIBMTP_folder_t head, *rv; int i; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) { flush_handles(device); } /* * This creates a temporary list of the folders, this is in a * reverse order and uses the Folder pointers that are already * in the Folder structure. From this we can then build up the * folder hierarchy with only looking at this temporary list, * and removing the folders from this temporary list as we go. * This significantly reduces the number of operations that we * have to do in building the folder hierarchy. Also since the * temp list is in reverse order, when we prepend to the sibling * list things are in the same order as they were originally * in the handle list. */ head.sibling = &head; head.child = &head; for (i = 0; i < params->nrofobjects; i++) { LIBMTP_folder_t *folder; PTPObject *ob; ob = ¶ms->objects[i]; if (ob->oi.ObjectFormat != PTP_OFC_Association) { continue; } if (storage != PTP_GOH_ALL_STORAGE && storage != ob->oi.StorageID) { continue; } /* * Do we know how to handle these? They are part * of the MTP 1.0 specification paragraph 3.6.4. * For AssociationDesc 0x00000001U ptp_mtp_getobjectreferences() * should be called on these to get the contained objects, but * we basically don't care. Hopefully parent_id is maintained for all * children, because we rely on that instead. */ if (ob->oi.AssociationDesc != 0x00000000U) { LIBMTP_INFO("MTP extended association type 0x%08x encountered\n", ob->oi.AssociationDesc); } // Create a folder struct... folder = LIBMTP_new_folder_t(); if (folder == NULL) { // malloc failure or so. return NULL; } folder->folder_id = ob->oid; folder->parent_id = ob->oi.ParentObject; folder->storage_id = ob->oi.StorageID; folder->name = (ob->oi.Filename) ? (char *)strdup(ob->oi.Filename) : NULL; // pretend sibling says next, and child says prev. folder->sibling = head.sibling; folder->child = &head; head.sibling->child = folder; head.sibling = folder; } // We begin at the given root folder and get them all recursively rv = get_subfolders_for_folder(&head, 0x00000000U); // Some buggy devices may have some files in the "root folder" // 0xffffffff so if 0x00000000 didn't return any folders, // look for children of the root 0xffffffffU if (rv == NULL) { rv = get_subfolders_for_folder(&head, 0xffffffffU); if (rv != NULL) LIBMTP_ERROR("Device have files in \"root folder\" 0xffffffffU - " "this is a firmware bug (but continuing)\n"); } // The temp list should be empty. Clean up any orphans just in case. while(head.sibling != &head) { LIBMTP_folder_t *curr = head.sibling; LIBMTP_INFO("Orphan folder with ID: 0x%08x name: \"%s\" encountered.\n", curr->folder_id, curr->name); curr->sibling->child = curr->child; curr->child->sibling = curr->sibling; curr->child = NULL; curr->sibling = NULL; LIBMTP_destroy_folder_t(curr); } return rv; } /** * This returns a list of all folders available * on the current MTP device. * * @param device a pointer to the device to get the folder listing for. * @return a list of folders */ LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t *device) { return LIBMTP_Get_Folder_List_For_Storage(device, PTP_GOH_ALL_STORAGE); } /** * This create a folder on the current MTP device. The PTP name * for a folder is "association". The PTP/MTP devices does not * have an internal "folder" concept really, it contains a flat * list of all files and some file are "associations" that other * files and folders may refer to as its "parent". * * @param device a pointer to the device to create the folder on. * @param name the name of the new folder. Note this can be modified * if the device does not support all the characters in the * name. * @param parent_id id of parent folder to add the new folder to, * or 0 to put it in the root directory. * @param storage_id id of the storage to add this new folder to. * notice that you cannot mismatch storage id and parent id: * they must both be on the same storage! Pass in 0 if you * want to create this folder on the default storage. * @return id to new folder or 0 if an error occured */ uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t *device, char *name, uint32_t parent_id, uint32_t storage_id) { PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; uint32_t parenthandle = 0; uint32_t store; PTPObjectInfo new_folder; uint16_t ret; uint32_t new_id = 0; if (storage_id == 0) { // I'm just guessing that a folder may require 512 bytes store = get_suggested_storage_id(device, 512, parent_id); } else { store = storage_id; } parenthandle = parent_id; memset(&new_folder, 0, sizeof(new_folder)); new_folder.Filename = name; if (FLAG_ONLY_7BIT_FILENAMES(ptp_usb)) { strip_7bit_from_utf8(new_folder.Filename); } new_folder.ObjectCompressedSize = 0; new_folder.ObjectFormat = PTP_OFC_Association; new_folder.ProtectionStatus = PTP_PS_NoProtection; new_folder.AssociationType = PTP_AT_GenericFolder; new_folder.ParentObject = parent_id; new_folder.StorageID = store; // Create the object if (!(params->device_flags & DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST) && ptp_operation_issupported(params,PTP_OC_MTP_SendObjectPropList)) { MTPProperties *props = (MTPProperties*)calloc(2,sizeof(MTPProperties)); props[0].property = PTP_OPC_ObjectFileName; props[0].datatype = PTP_DTC_STR; props[0].propval.str = name; props[1].property = PTP_OPC_Name; props[1].datatype = PTP_DTC_STR; props[1].propval.str = name; ret = ptp_mtp_sendobjectproplist(params, &store, &parenthandle, &new_id, PTP_OFC_Association, 0, props, 1); free(props); } else { ret = ptp_sendobjectinfo(params, &store, &parenthandle, &new_id, &new_folder); } if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Create_Folder: Could not send object info."); if (ret == PTP_RC_AccessDenied) { add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED."); } return 0; } // NOTE: don't destroy the new_folder objectinfo, because it is statically referencing // several strings. add_object_to_cache(device, new_id); return new_id; } /** * This creates a new playlist metadata structure and allocates memory * for it. Notice that if you add strings to this structure they * will be freed by the corresponding LIBMTP_destroy_playlist_t * operation later, so be careful of using strdup() when assigning * strings, e.g.: * *
 * LIBMTP_playlist_t *pl = LIBMTP_new_playlist_t();
 * pl->name = strdup(str);
 * ....
 * LIBMTP_destroy_playlist_t(pl);
 * 
* * @return a pointer to the newly allocated metadata structure. * @see LIBMTP_destroy_playlist_t() */ LIBMTP_playlist_t *LIBMTP_new_playlist_t(void) { LIBMTP_playlist_t *new = (LIBMTP_playlist_t *) malloc(sizeof(LIBMTP_playlist_t)); if (new == NULL) { return NULL; } new->playlist_id = 0; new->parent_id = 0; new->storage_id = 0; new->name = NULL; new->tracks = NULL; new->no_tracks = 0; new->next = NULL; return new; } /** * This destroys a playlist metadata structure and deallocates the memory * used by it, including any strings. Never use a track metadata * structure again after calling this function on it. * @param playlist the playlist metadata to destroy. * @see LIBMTP_new_playlist_t() */ void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *playlist) { if (playlist == NULL) { return; } if (playlist->name != NULL) free(playlist->name); if (playlist->tracks != NULL) free(playlist->tracks); free(playlist); return; } /** * This function returns a list of the playlists available on the * device. Typical usage: * *
 * 
* * @param device a pointer to the device to get the playlist listing from. * @return a playlist list on success, else NULL. If there are no playlists * on the device, NULL will be returned as well. * @see LIBMTP_Get_Playlist() */ LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *device) { PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; const int REQ_SPL = FLAG_PLAYLIST_SPL(ptp_usb); PTPParams *params = (PTPParams *) device->params; LIBMTP_playlist_t *retlists = NULL; LIBMTP_playlist_t *curlist = NULL; uint32_t i; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) { flush_handles(device); } for (i = 0; i < params->nrofobjects; i++) { LIBMTP_playlist_t *pl; PTPObject *ob; uint16_t ret; ob = ¶ms->objects[i]; // Ignore stuff that isn't playlists // For Samsung players we must look for the .spl extension explicitly since // playlists are not stored as playlist objects. if ( REQ_SPL && is_spl_playlist(&ob->oi) ) { // Allocate a new playlist type pl = LIBMTP_new_playlist_t(); spl_to_playlist_t(device, &ob->oi, ob->oid, pl); } else if ( ob->oi.ObjectFormat != PTP_OFC_MTP_AbstractAudioVideoPlaylist ) { continue; } else { // Allocate a new playlist type pl = LIBMTP_new_playlist_t(); // Try to look up proper name, else use the oi->Filename field. pl->name = get_string_from_object(device, ob->oid, PTP_OPC_Name); if (pl->name == NULL) { pl->name = strdup(ob->oi.Filename); } pl->playlist_id = ob->oid; pl->parent_id = ob->oi.ParentObject; pl->storage_id = ob->oi.StorageID; // Then get the track listing for this playlist ret = ptp_mtp_getobjectreferences(params, pl->playlist_id, &pl->tracks, &pl->no_tracks); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist_List(): " "could not get object references."); pl->tracks = NULL; pl->no_tracks = 0; } } // Add playlist to a list that will be returned afterwards. if (retlists == NULL) { retlists = pl; curlist = pl; } else { curlist->next = pl; curlist = pl; } // Call callback here if we decide to add that possibility... } return retlists; } /** * This function retrieves an individual playlist from the device. * @param device a pointer to the device to get the playlist from. * @param plid the unique ID of the playlist to retrieve. * @return a valid playlist metadata post or NULL on failure. * @see LIBMTP_Get_Playlist_List() */ LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *device, uint32_t const plid) { PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; const int REQ_SPL = FLAG_PLAYLIST_SPL(ptp_usb); PTPParams *params = (PTPParams *) device->params; PTPObject *ob; LIBMTP_playlist_t *pl; uint16_t ret; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) { flush_handles(device); } ret = ptp_object_want (params, plid, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) return NULL; // For Samsung players we must look for the .spl extension explicitly since // playlists are not stored as playlist objects. if ( REQ_SPL && is_spl_playlist(&ob->oi) ) { // Allocate a new playlist type pl = LIBMTP_new_playlist_t(); spl_to_playlist_t(device, &ob->oi, ob->oid, pl); return pl; } // Ignore stuff that isn't playlists else if ( ob->oi.ObjectFormat != PTP_OFC_MTP_AbstractAudioVideoPlaylist ) { return NULL; } // Allocate a new playlist type pl = LIBMTP_new_playlist_t(); pl->name = get_string_from_object(device, ob->oid, PTP_OPC_Name); if (pl->name == NULL) { pl->name = strdup(ob->oi.Filename); } pl->playlist_id = ob->oid; pl->parent_id = ob->oi.ParentObject; pl->storage_id = ob->oi.StorageID; // Then get the track listing for this playlist ret = ptp_mtp_getobjectreferences(params, pl->playlist_id, &pl->tracks, &pl->no_tracks); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Playlist(): Could not get object references."); pl->tracks = NULL; pl->no_tracks = 0; } return pl; } /** * This function creates a new abstract list such as a playlist * or an album. * * @param device a pointer to the device to create the new abstract list * on. * @param name the name of the new abstract list. * @param artist the artist of the new abstract list or NULL. * @param genre the genre of the new abstract list or NULL. * @param parenthandle the handle of the parent or 0 for no parent * i.e. the root folder. * @param objectformat the abstract list type to create. * @param suffix the ".foo" (4 characters) suffix to use for the virtual * "file" created by this operation. * @param newid a pointer to a variable that will hold the new object * ID if this call is successful. * @param tracks an array of tracks to associate with this list. * @param no_tracks the number of tracks in the list. * @return 0 on success, any other value means failure. */ static int create_new_abstract_list(LIBMTP_mtpdevice_t *device, char const * const name, char const * const artist, char const * const composer, char const * const genre, uint32_t const parenthandle, uint32_t const storageid, uint16_t const objectformat, char const * const suffix, uint32_t * const newid, uint32_t const * const tracks, uint32_t const no_tracks) { int i; int supported = 0; uint16_t ret; uint16_t *properties = NULL; uint32_t propcnt = 0; uint32_t store; uint32_t localph = parenthandle; uint8_t nonconsumable = 0x00U; /* By default it is consumable */ PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; char fname[256]; //uint8_t data[2]; // NULL check if (!name) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): list name was NULL, using default name \"Unknown\""); return -1; } if (storageid == 0) { // I'm just guessing that an abstract list may require 512 bytes store = get_suggested_storage_id(device, 512, localph); } else { store = storageid; } // Check if we can create an object of this type for ( i=0; i < params->deviceinfo.ImageFormats_len; i++ ) { if (params->deviceinfo.ImageFormats[i] == objectformat) { supported = 1; break; } } if (!supported) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "create_new_abstract_list(): player does not support this abstract type"); LIBMTP_ERROR("Unsupported abstract list type: %04x\n", objectformat); return -1; } // add the new suffix if it isn't there fname[0] = '\0'; if (strlen(name) > strlen(suffix)) { char const * const suff = &name[strlen(name)-strlen(suffix)]; if (!strcmp(suff, suffix)) { // Home free. strncpy(fname, name, sizeof(fname)); } } // If it didn't end with "" then add that here. if (fname[0] == '\0') { strncpy(fname, name, sizeof(fname)-strlen(suffix)-1); strcat(fname, suffix); fname[sizeof(fname)-1] = '\0'; } if (ptp_operation_issupported(params, PTP_OC_MTP_SendObjectPropList) && !FLAG_BROKEN_SEND_OBJECT_PROPLIST(ptp_usb)) { MTPProperties *props = NULL; MTPProperties *prop = NULL; int nrofprops = 0; *newid = 0x00000000U; ret = ptp_mtp_getobjectpropssupported(params, objectformat, &propcnt, &properties); for (i=0;iObjectHandle = *newid; prop->property = PTP_OPC_ObjectFileName; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(fname); if (FLAG_ONLY_7BIT_FILENAMES(ptp_usb)) { strip_7bit_from_utf8(prop->propval.str); } break; case PTP_OPC_ProtectionStatus: prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_ProtectionStatus; prop->datatype = PTP_DTC_UINT16; prop->propval.u16 = 0x0000U; /* Not protected */ break; case PTP_OPC_NonConsumable: prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_NonConsumable; prop->datatype = PTP_DTC_UINT8; prop->propval.u8 = nonconsumable; break; case PTP_OPC_Name: if (name != NULL) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_Name; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(name); } break; case PTP_OPC_AlbumArtist: if (artist != NULL) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_AlbumArtist; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(artist); } break; case PTP_OPC_Artist: if (artist != NULL) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_Artist; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(artist); } break; case PTP_OPC_Composer: if (composer != NULL) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_Composer; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(composer); } break; case PTP_OPC_Genre: if (genre != NULL) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_Genre; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(genre); } break; case PTP_OPC_DateModified: // Tag with current time if that is supported if (!FLAG_CANNOT_HANDLE_DATEMODIFIED(ptp_usb)) { prop = ptp_get_new_object_prop_entry(&props,&nrofprops); prop->ObjectHandle = *newid; prop->property = PTP_OPC_DateModified; prop->datatype = PTP_DTC_STR; prop->propval.str = get_iso8601_stamp(); } break; } } ptp_free_objectpropdesc(&opd); } free(properties); ret = ptp_mtp_sendobjectproplist(params, &store, &localph, newid, objectformat, 0, props, nrofprops); /* Free property list */ ptp_destroy_object_prop_list(props, nrofprops); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send object property list."); if (ret == PTP_RC_AccessDenied) { add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED."); } return -1; } // now send the blank object ret = ptp_sendobject(params, NULL, 0); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send blank object data."); return -1; } } else if (ptp_operation_issupported(params,PTP_OC_SendObjectInfo)) { PTPObjectInfo new_object; new_object.Filename = fname; if (FLAG_ONLY_7BIT_FILENAMES(ptp_usb)) { strip_7bit_from_utf8(new_object.Filename); } // At one point this had to be one new_object.ObjectCompressedSize = 0; new_object.ObjectFormat = objectformat; // Create the object ret = ptp_sendobjectinfo(params, &store, &localph, newid, &new_object); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send object info (the playlist itself)."); if (ret == PTP_RC_AccessDenied) { add_ptp_error_to_errorstack(device, ret, "ACCESS DENIED."); } return -1; } // NOTE: don't destroy new_object objectinfo afterwards - the strings it contains are // not copies. #if 0 /* * At one time we had to send this one blank data byte. * If we didn't, the handle will not be created and thus there is * no playlist. Possibly this was masking some bug, so removing it * now. */ data[0] = '\0'; data[1] = '\0'; ret = ptp_sendobject(params, data, 1); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): Could not send blank object data."); return -1; } #endif // set the properties one by one ret = ptp_mtp_getobjectpropssupported(params, objectformat, &propcnt, &properties); for (i=0;i 0) { // Add tracks to the list as object references. ret = ptp_mtp_setobjectreferences (params, *newid, (uint32_t *) tracks, no_tracks); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "create_new_abstract_list(): could not add tracks as object references."); return -1; } } add_object_to_cache(device, *newid); return 0; } /** * This updates the metadata and track listing * for an abstract list. * @param device a pointer to the device that the abstract list * resides on. * @param name the name of the abstract list. * @param artist the artist of the abstract list or NULL. * @param genre the genre of the abstract list or NULL. * @param objecthandle the object to be updated. * @param objectformat the abstract list type to update. * @param tracks an array of tracks to associate with this list. * @param no_tracks the number of tracks in the list. * @return 0 on success, any other value means failure. */ static int update_abstract_list(LIBMTP_mtpdevice_t *device, char const * const name, char const * const artist, char const * const composer, char const * const genre, uint32_t const objecthandle, uint16_t const objectformat, uint32_t const * const tracks, uint32_t const no_tracks) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; uint16_t *properties = NULL; uint32_t propcnt = 0; int i; // First see which properties can be set // i.e only try to update this metadata for object tags that exist on the current player. ret = ptp_mtp_getobjectpropssupported(params, objectformat, &propcnt, &properties); if (ret != PTP_RC_OK) { // Just bail out for now, nothing is ever set. add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): " "could not retrieve supported object properties."); return -1; } if (ptp_operation_issupported(params,PTP_OC_MTP_SetObjPropList) && !FLAG_BROKEN_SET_OBJECT_PROPLIST(ptp_usb)) { MTPProperties *props = NULL; MTPProperties *prop = NULL; int nrofprops = 0; for (i=0;iObjectHandle = objecthandle; prop->property = PTP_OPC_Name; prop->datatype = PTP_DTC_STR; if (name != NULL) prop->propval.str = strdup(name); break; case PTP_OPC_AlbumArtist: if (artist != NULL) { prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = objecthandle; prop->property = PTP_OPC_AlbumArtist; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(artist); } break; case PTP_OPC_Artist: if (artist != NULL) { prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = objecthandle; prop->property = PTP_OPC_Artist; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(artist); } break; case PTP_OPC_Composer: if (composer != NULL) { prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = objecthandle; prop->property = PTP_OPC_Composer; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(composer); } break; case PTP_OPC_Genre: if (genre != NULL) { prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = objecthandle; prop->property = PTP_OPC_Genre; prop->datatype = PTP_DTC_STR; prop->propval.str = strdup(genre); } break; case PTP_OPC_DateModified: if (!FLAG_CANNOT_HANDLE_DATEMODIFIED(ptp_usb)) { // Tag with current time if that is supported prop = ptp_get_new_object_prop_entry(&props, &nrofprops); prop->ObjectHandle = objecthandle; prop->property = PTP_OPC_DateModified; prop->datatype = PTP_DTC_STR; prop->propval.str = get_iso8601_stamp(); } break; default: break; } } ptp_free_objectpropdesc(&opd); } // proplist could be NULL if we can't write any properties if (props != NULL) { ret = ptp_mtp_setobjectproplist(params, props, nrofprops); ptp_destroy_object_prop_list(props, nrofprops); if (ret != PTP_RC_OK) { // TODO: return error of which property we couldn't set add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "update_abstract_list(): " "could not set object property list."); free(properties); return -1; } } } else if (ptp_operation_issupported(params,PTP_OC_MTP_SetObjectPropValue)) { for (i=0;itracks field of the metadata * contains a track listing, these tracks will be added to the * playlist. * @param device a pointer to the device to create the new playlist on. * @param metadata the metadata for the new playlist. If the function * exits with success, the playlist_id field of this * struct will contain the new playlist ID of the playlist. *
    *
  • metadata->parent_id should be set to the parent * (e.g. folder) to store this track in. Since some * devices are a bit picky about where files * are placed, a default folder will be chosen if libmtp * has detected one for the current filetype and this * parameter is set to 0. If this is 0 and no default folder * can be found, the file will be stored in the root folder. *
  • metadata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this track in. Setting this to 0 will store * the track on the primary storage. *
* @return 0 on success, any other value means failure. * @see LIBMTP_Update_Playlist() * @see LIBMTP_Delete_Object() */ int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t * const metadata) { PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; uint32_t localph = metadata->parent_id; // Use a default folder if none given if (localph == 0) { if (device->default_playlist_folder != 0) localph = device->default_playlist_folder; else localph = device->default_music_folder; } metadata->parent_id = localph; // Samsung needs its own special type of playlists if(FLAG_PLAYLIST_SPL(ptp_usb)) { return playlist_t_to_spl(device, metadata); } // Just create a new abstract audio/video playlist... return create_new_abstract_list(device, metadata->name, NULL, NULL, NULL, localph, metadata->storage_id, PTP_OFC_MTP_AbstractAudioVideoPlaylist, get_playlist_extension(ptp_usb), &metadata->playlist_id, metadata->tracks, metadata->no_tracks); } /** * This routine updates a playlist based on the metadata * supplied. If the tracks field of the metadata * contains a track listing, these tracks will be added to the * playlist in place of those already present, i.e. the * previous track listing will be deleted. For Samsung devices the * playlist id (metadata->playlist_id) is likely to change. * @param device a pointer to the device to create the new playlist on. * @param metadata the metadata for the playlist to be updated. * notice that the field playlist_id * must contain the apropriate playlist ID. Playlist ID * be modified to a new playlist ID by the time the * function returns since edit-in-place is not always possible. * @return 0 on success, any other value means failure. * @see LIBMTP_Create_New_Playlist() * @see LIBMTP_Delete_Object() */ int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t * const metadata) { // Samsung needs its own special type of playlists PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; if(FLAG_PLAYLIST_SPL(ptp_usb)) { return update_spl_playlist(device, metadata); } return update_abstract_list(device, metadata->name, NULL, NULL, NULL, metadata->playlist_id, PTP_OFC_MTP_AbstractAudioVideoPlaylist, metadata->tracks, metadata->no_tracks); } /** * This creates a new album metadata structure and allocates memory * for it. Notice that if you add strings to this structure they * will be freed by the corresponding LIBMTP_destroy_album_t * operation later, so be careful of using strdup() when assigning * strings. * * @return a pointer to the newly allocated metadata structure. * @see LIBMTP_destroy_album_t() */ LIBMTP_album_t *LIBMTP_new_album_t(void) { LIBMTP_album_t *new = (LIBMTP_album_t *) malloc(sizeof(LIBMTP_album_t)); if (new == NULL) { return NULL; } new->album_id = 0; new->parent_id = 0; new->storage_id = 0; new->name = NULL; new->artist = NULL; new->composer = NULL; new->genre = NULL; new->tracks = NULL; new->no_tracks = 0; new->next = NULL; return new; } /** * This recursively deletes the memory for an album structure * * @param album structure to destroy * @see LIBMTP_new_album_t() */ void LIBMTP_destroy_album_t(LIBMTP_album_t *album) { if (album == NULL) { return; } if (album->name != NULL) free(album->name); if (album->artist != NULL) free(album->artist); if (album->composer != NULL) free(album->composer); if (album->genre != NULL) free(album->genre); if (album->tracks != NULL) free(album->tracks); free(album); return; } /** * This function maps and copies a property onto the album metadata if applicable. */ static void pick_property_to_album_metadata(LIBMTP_mtpdevice_t *device, MTPProperties *prop, LIBMTP_album_t *alb) { switch (prop->property) { case PTP_OPC_Name: if (prop->propval.str != NULL) alb->name = strdup(prop->propval.str); else alb->name = NULL; break; case PTP_OPC_AlbumArtist: if (prop->propval.str != NULL) { // This should take precedence over plain "Artist" if (alb->artist != NULL) free(alb->artist); alb->artist = strdup(prop->propval.str); } else alb->artist = NULL; break; case PTP_OPC_Artist: if (prop->propval.str != NULL) { // Only use of AlbumArtist is not set if (alb->artist == NULL) alb->artist = strdup(prop->propval.str); } else alb->artist = NULL; break; case PTP_OPC_Composer: if (prop->propval.str != NULL) alb->composer = strdup(prop->propval.str); else alb->composer = NULL; break; case PTP_OPC_Genre: if (prop->propval.str != NULL) alb->genre = strdup(prop->propval.str); else alb->genre = NULL; break; } } /** * This function retrieves the album metadata for an album * given by a unique ID. * @param device a pointer to the device to get the track metadata off. * @param alb an album metadata metadata set to fill in. */ static void get_album_metadata(LIBMTP_mtpdevice_t *device, LIBMTP_album_t *alb) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; uint32_t i; MTPProperties *prop; PTPObject *ob; /* * If we have a cached, large set of metadata, then use it! */ ret = ptp_object_want(params, alb->album_id, PTPOBJECT_MTPPROPLIST_LOADED, &ob); if (ob->mtpprops) { prop = ob->mtpprops; for (i=0;inrofmtpprops;i++,prop++) pick_property_to_album_metadata(device, prop, alb); } else { uint16_t *props = NULL; uint32_t propcnt = 0; // First see which properties can be retrieved for albums ret = ptp_mtp_getobjectpropssupported(params, PTP_OFC_MTP_AbstractAudioAlbum, &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "get_album_metadata(): call to ptp_mtp_getobjectpropssupported() failed."); // Just bail out for now, nothing is ever set. return; } else { for (i=0;iname = get_string_from_object(device, ob->oid, PTP_OPC_Name); break; case PTP_OPC_AlbumArtist: if (alb->artist != NULL) free(alb->artist); alb->artist = get_string_from_object(device, ob->oid, PTP_OPC_AlbumArtist); break; case PTP_OPC_Artist: if (alb->artist == NULL) alb->artist = get_string_from_object(device, ob->oid, PTP_OPC_Artist); break; case PTP_OPC_Composer: alb->composer = get_string_from_object(device, ob->oid, PTP_OPC_Composer); break; case PTP_OPC_Genre: alb->genre = get_string_from_object(device, ob->oid, PTP_OPC_Genre); break; default: break; } } free(props); } } } /** * This function returns a list of the albums available on the * device. * * @param device a pointer to the device to get the album listing from. * @return an album list on success, else NULL. If there are no albums * on the device, NULL will be returned as well. * @see LIBMTP_Get_Album() */ LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *device) { // Read all storage devices return LIBMTP_Get_Album_List_For_Storage(device, 0); } /** * This function returns a list of the albums available on the * device. You can filter on the storage ID. * * @param device a pointer to the device to get the album listing from. * @param storage_id ID of device storage (if null, all storages) * * @return an album list on success, else NULL. If there are no albums * on the device, NULL will be returned as well. * @see LIBMTP_Get_Album() */ LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *device, uint32_t const storage_id) { PTPParams *params = (PTPParams *) device->params; LIBMTP_album_t *retalbums = NULL; LIBMTP_album_t *curalbum = NULL; uint32_t i; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) flush_handles(device); for (i = 0; i < params->nrofobjects; i++) { LIBMTP_album_t *alb; PTPObject *ob; uint16_t ret; ob = ¶ms->objects[i]; // Ignore stuff that isn't an album if ( ob->oi.ObjectFormat != PTP_OFC_MTP_AbstractAudioAlbum ) continue; // Ignore stuff that isn't into the storage device if ((storage_id != 0) && (ob->oi.StorageID != storage_id )) continue; // Allocate a new album type alb = LIBMTP_new_album_t(); alb->album_id = ob->oid; alb->parent_id = ob->oi.ParentObject; alb->storage_id = ob->oi.StorageID; // Fetch supported metadata get_album_metadata(device, alb); // Then get the track listing for this album ret = ptp_mtp_getobjectreferences(params, alb->album_id, &alb->tracks, &alb->no_tracks); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Album_List(): Could not get object references."); alb->tracks = NULL; alb->no_tracks = 0; } // Add album to a list that will be returned afterwards. if (retalbums == NULL) { retalbums = alb; curalbum = alb; } else { curalbum->next = alb; curalbum = alb; } } return retalbums; } /** * This function retrieves an individual album from the device. * @param device a pointer to the device to get the album from. * @param albid the unique ID of the album to retrieve. * @return a valid album metadata or NULL on failure. * @see LIBMTP_Get_Album_List() */ LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *device, uint32_t const albid) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; PTPObject *ob; LIBMTP_album_t *alb; // Get all the handles if we haven't already done that if (params->nrofobjects == 0) flush_handles(device); ret = ptp_object_want(params, albid, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) return NULL; // Ignore stuff that isn't an album if (ob->oi.ObjectFormat != PTP_OFC_MTP_AbstractAudioAlbum) return NULL; // Allocate a new album type alb = LIBMTP_new_album_t(); alb->album_id = ob->oid; alb->parent_id = ob->oi.ParentObject; alb->storage_id = ob->oi.StorageID; // Fetch supported metadata get_album_metadata(device, alb); // Then get the track listing for this album ret = ptp_mtp_getobjectreferences(params, alb->album_id, &alb->tracks, &alb->no_tracks); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Album: Could not get object references."); alb->tracks = NULL; alb->no_tracks = 0; } return alb; } /** * This routine creates a new album based on the metadata * supplied. If the tracks field of the metadata * contains a track listing, these tracks will be added to the * album. * @param device a pointer to the device to create the new album on. * @param metadata the metadata for the new album. If the function * exits with success, the album_id field of this * struct will contain the new ID of the album. *
    *
  • metadata->parent_id should be set to the parent * (e.g. folder) to store this track in. Since some * devices are a bit picky about where files * are placed, a default folder will be chosen if libmtp * has detected one for the current filetype and this * parameter is set to 0. If this is 0 and no default folder * can be found, the file will be stored in the root folder. *
  • metadata->storage_id should be set to the * desired storage (e.g. memory card or whatever your device * presents) to store this track in. Setting this to 0 will store * the track on the primary storage. *
* @return 0 on success, any other value means failure. * @see LIBMTP_Update_Album() * @see LIBMTP_Delete_Object() */ int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *device, LIBMTP_album_t * const metadata) { uint32_t localph = metadata->parent_id; // Use a default folder if none given if (localph == 0) { if (device->default_album_folder != 0) localph = device->default_album_folder; else localph = device->default_music_folder; } metadata->parent_id = localph; // Just create a new abstract album... return create_new_abstract_list(device, metadata->name, metadata->artist, metadata->composer, metadata->genre, localph, metadata->storage_id, PTP_OFC_MTP_AbstractAudioAlbum, ".alb", &metadata->album_id, metadata->tracks, metadata->no_tracks); } /** * This creates a new sample data metadata structure and allocates memory * for it. Notice that if you add strings to this structure they * will be freed by the corresponding LIBMTP_destroy_sampledata_t * operation later, so be careful of using strdup() when assigning * strings. * * @return a pointer to the newly allocated metadata structure. * @see LIBMTP_destroy_sampledata_t() */ LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void) { LIBMTP_filesampledata_t *new = (LIBMTP_filesampledata_t *) malloc(sizeof(LIBMTP_filesampledata_t)); if (new == NULL) { return NULL; } new->height=0; new->width = 0; new->data = NULL; new->duration = 0; new->size = 0; return new; } /** * This destroys a file sample metadata type. * @param sample the file sample metadata to be destroyed. */ void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t * sample) { if (sample == NULL) { return; } if (sample->data != NULL) { free(sample->data); } free(sample); } /** * This routine figures out whether a certain filetype supports * representative samples (small thumbnail images) or not. This * typically applies to JPEG files, MP3 files and Album abstract * playlists, but in theory any filetype could support representative * samples. * @param device a pointer to the device which is to be examined. * @param filetype the fileype to examine, and return the representative sample * properties for. * @param sample this will contain a new sample type with the fields * filled in with suitable default values. For example, the * supported sample type will be set, the supported height and * width will be set to max values if it is an image sample, * and duration will also be given some suitable default value * which should not be exceeded on audio samples. If the * device does not support samples for this filetype, this * pointer will be NULL. If it is not NULL, the user must * destroy this struct with LIBMTP_destroy_filesampledata_t() * after use. * @return 0 on success, any other value means failure. * @see LIBMTP_Send_Representative_Sample() * @see LIBMTP_Create_New_Album() */ int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *device, LIBMTP_filetype_t const filetype, LIBMTP_filesampledata_t ** sample) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; uint16_t *props = NULL; uint32_t propcnt = 0; int i; // TODO: Get rid of these when we can properly query the device. int support_data = 0; int support_format = 0; int support_height = 0; int support_width = 0; int support_duration = 0; int support_size = 0; PTPObjectPropDesc opd_height; PTPObjectPropDesc opd_width; PTPObjectPropDesc opd_format; PTPObjectPropDesc opd_duration; PTPObjectPropDesc opd_size; // Default to no type supported. *sample = NULL; ret = ptp_mtp_getobjectpropssupported(params, map_libmtp_type_to_ptp_type(filetype), &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample_Format(): could not get object properties."); return -1; } /* * TODO: when walking through these object properties, make calls to * a new function in ptp.h/ptp.c that can send the command * PTP_OC_MTP_GetObjectPropDesc to get max/min values of the properties * supported. */ for (i = 0; i < propcnt; i++) { switch(props[i]) { case PTP_OPC_RepresentativeSampleData: support_data = 1; break; case PTP_OPC_RepresentativeSampleFormat: support_format = 1; break; case PTP_OPC_RepresentativeSampleSize: support_size = 1; break; case PTP_OPC_RepresentativeSampleHeight: support_height = 1; break; case PTP_OPC_RepresentativeSampleWidth: support_width = 1; break; case PTP_OPC_RepresentativeSampleDuration: support_duration = 1; break; default: break; } } free(props); if (support_data && support_format && support_height && support_width && !support_duration) { // Something that supports height and width and not duration is likely to be JPEG LIBMTP_filesampledata_t *retsam = LIBMTP_new_filesampledata_t(); /* * Populate the sample format with the first supported format * * TODO: figure out how to pass back more than one format if more are * supported by the device. */ ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleFormat, map_libmtp_type_to_ptp_type(filetype), &opd_format); retsam->filetype = map_ptp_type_to_libmtp_type(opd_format.FORM.Enum.SupportedValue[0].u16); ptp_free_objectpropdesc(&opd_format); /* Populate the maximum image height */ ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleWidth, map_libmtp_type_to_ptp_type(filetype), &opd_width); retsam->width = opd_width.FORM.Range.MaximumValue.u32; ptp_free_objectpropdesc(&opd_width); /* Populate the maximum image width */ ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleHeight, map_libmtp_type_to_ptp_type(filetype), &opd_height); retsam->height = opd_height.FORM.Range.MaximumValue.u32; ptp_free_objectpropdesc(&opd_height); /* Populate the maximum size */ if (support_size) { ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleSize, map_libmtp_type_to_ptp_type(filetype), &opd_size); retsam->size = opd_size.FORM.Range.MaximumValue.u32; ptp_free_objectpropdesc(&opd_size); } *sample = retsam; } else if (support_data && support_format && !support_height && !support_width && support_duration) { // Another qualified guess LIBMTP_filesampledata_t *retsam = LIBMTP_new_filesampledata_t(); /* * Populate the sample format with the first supported format * * TODO: figure out how to pass back more than one format if more are * supported by the device. */ ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleFormat, map_libmtp_type_to_ptp_type(filetype), &opd_format); retsam->filetype = map_ptp_type_to_libmtp_type(opd_format.FORM.Enum.SupportedValue[0].u16); ptp_free_objectpropdesc(&opd_format); /* Populate the maximum duration */ ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleDuration, map_libmtp_type_to_ptp_type(filetype), &opd_duration); retsam->duration = opd_duration.FORM.Range.MaximumValue.u32; ptp_free_objectpropdesc(&opd_duration); /* Populate the maximum size */ if (support_size) { ptp_mtp_getobjectpropdesc (params, PTP_OPC_RepresentativeSampleSize, map_libmtp_type_to_ptp_type(filetype), &opd_size); retsam->size = opd_size.FORM.Range.MaximumValue.u32; ptp_free_objectpropdesc(&opd_size); } *sample = retsam; } return 0; } /** * This routine sends representative sample data for an object. * This uses the RepresentativeSampleData property of the album, * if the device supports it. The data should be of a format acceptable * to the player (for iRiver and Creative, this seems to be JPEG) and * must not be too large. (for a Creative, max seems to be about 20KB.) * Check by calling LIBMTP_Get_Representative_Sample_Format() to get * maximum size, dimensions, etc.. * @param device a pointer to the device which the object is on. * @param id unique id of the object to set artwork for. * @param pointer to LIBMTP_filesampledata_t struct containing data * @return 0 on success, any other value means failure. * @see LIBMTP_Get_Representative_Sample() * @see LIBMTP_Get_Representative_Sample_Format() * @see LIBMTP_Create_New_Album() */ int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *device, uint32_t const id, LIBMTP_filesampledata_t *sampledata) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo; PTPPropertyValue propval; PTPObject *ob; uint32_t i; uint16_t *props = NULL; uint32_t propcnt = 0; int supported = 0; // get the file format for the object we're going to send representative data for ret = ptp_object_want (params, id, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Representative_Sample(): could not get object info."); return -1; } // check that we can send representative sample data for this object format ret = ptp_mtp_getobjectpropssupported(params, ob->oi.ObjectFormat, &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_Representative_Sample(): could not get object properties."); return -1; } for (i = 0; i < propcnt; i++) { if (props[i] == PTP_OPC_RepresentativeSampleData) { supported = 1; break; } } if (!supported) { free(props); add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Send_Representative_Sample(): object type doesn't support RepresentativeSampleData."); return -1; } free(props); // Go ahead and send the data propval.a.count = sampledata->size; propval.a.v = malloc(sizeof(PTPPropertyValue) * sampledata->size); for (i = 0; i < sampledata->size; i++) { propval.a.v[i].u8 = sampledata->data[i]; } ret = ptp_mtp_setobjectpropvalue(params,id,PTP_OPC_RepresentativeSampleData, &propval,PTP_DTC_AUINT8); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Send_Representative_Sample(): could not send sample data."); free(propval.a.v); return -1; } free(propval.a.v); /* Set the height and width if the sample is an image, otherwise just * set the duration and size */ switch(sampledata->filetype) { case LIBMTP_FILETYPE_JPEG: case LIBMTP_FILETYPE_JFIF: case LIBMTP_FILETYPE_TIFF: case LIBMTP_FILETYPE_BMP: case LIBMTP_FILETYPE_GIF: case LIBMTP_FILETYPE_PICT: case LIBMTP_FILETYPE_PNG: if (!FLAG_BROKEN_SET_SAMPLE_DIMENSIONS(ptp_usb)) { // For images, set the height and width set_object_u32(device, id, PTP_OPC_RepresentativeSampleHeight, sampledata->height); set_object_u32(device, id, PTP_OPC_RepresentativeSampleWidth, sampledata->width); } break; default: // For anything not an image, set the duration and size set_object_u32(device, id, PTP_OPC_RepresentativeSampleDuration, sampledata->duration); set_object_u32(device, id, PTP_OPC_RepresentativeSampleSize, sampledata->size); break; } return 0; } /** * This routine gets representative sample data for an object. * This uses the RepresentativeSampleData property of the album, * if the device supports it. * @param device a pointer to the device which the object is on. * @param id unique id of the object to get data for. * @param pointer to LIBMTP_filesampledata_t struct to receive data * @return 0 on success, any other value means failure. * @see LIBMTP_Send_Representative_Sample() * @see LIBMTP_Get_Representative_Sample_Format() * @see LIBMTP_Create_New_Album() */ int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *device, uint32_t const id, LIBMTP_filesampledata_t *sampledata) { uint16_t ret; PTPParams *params = (PTPParams *) device->params; PTPPropertyValue propval; PTPObject *ob; uint32_t i; uint16_t *props = NULL; uint32_t propcnt = 0; int supported = 0; // get the file format for the object we're going to send representative data for ret = ptp_object_want (params, id, PTPOBJECT_OBJECTINFO_LOADED, &ob); if (ret != PTP_RC_OK) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_Representative_Sample(): could not get object info."); return -1; } // check that we can store representative sample data for this object format ret = ptp_mtp_getobjectpropssupported(params, ob->oi.ObjectFormat, &propcnt, &props); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample(): could not get object properties."); return -1; } for (i = 0; i < propcnt; i++) { if (props[i] == PTP_OPC_RepresentativeSampleData) { supported = 1; break; } } if (!supported) { free(props); add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_Get_Representative_Sample(): object type doesn't support RepresentativeSampleData."); return -1; } free(props); // Get the data ret = ptp_mtp_getobjectpropvalue(params,id,PTP_OPC_RepresentativeSampleData, &propval,PTP_DTC_AUINT8); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "LIBMTP_Get_Representative_Sample(): could not get sample data."); return -1; } // Store it sampledata->size = propval.a.count; sampledata->data = malloc(sizeof(PTPPropertyValue) * propval.a.count); for (i = 0; i < propval.a.count; i++) { sampledata->data[i] = propval.a.v[i].u8; } free(propval.a.v); // Get the other properties sampledata->width = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleWidth, 0); sampledata->height = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleHeight, 0); sampledata->duration = get_u32_from_object(device, id, PTP_OPC_RepresentativeSampleDuration, 0); sampledata->filetype = map_ptp_type_to_libmtp_type( get_u16_from_object(device, id, PTP_OPC_RepresentativeSampleFormat, LIBMTP_FILETYPE_UNKNOWN)); return 0; } /** * Retrieve the thumbnail for a file. * @param device a pointer to the device to get the thumbnail from. * @param id the object ID of the file to retrieve the thumbnail for. * @return 0 on success, any other value means failure. */ int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *device, uint32_t const id, unsigned char **data, unsigned int *size) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; ret = ptp_getthumb(params, id, data, size); if (ret == PTP_RC_OK) return 0; return -1; } int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *device, uint32_t const id, uint64_t offset, uint32_t maxbytes, unsigned char **data, unsigned int *size) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_operation_issupported(params, PTP_OC_ANDROID_GetPartialObject64)) { if (!ptp_operation_issupported(params, PTP_OC_GetPartialObject)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_GetPartialObject: PTP_OC_GetPartialObject not supported"); return -1; } if (offset >> 32 != 0) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_GetPartialObject: PTP_OC_GetPartialObject only supports 32bit offsets"); return -1; } ret = ptp_getpartialobject(params, id, (uint32_t)offset, maxbytes, data, size); } else { ret = ptp_android_getpartialobject64(params, id, offset, maxbytes, data, size); } if (ret == PTP_RC_OK) return 0; return -1; } int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *device, uint32_t const id, uint64_t offset, unsigned char *data, unsigned int size) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_operation_issupported(params, PTP_OC_ANDROID_SendPartialObject)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_SendPartialObject: PTP_OC_ANDROID_SendPartialObject not supported"); return -1; } ret = ptp_android_sendpartialobject(params, id, offset, data, size); if (ret == PTP_RC_OK) return 0; return -1; } int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *device, uint32_t const id) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_operation_issupported(params, PTP_OC_ANDROID_BeginEditObject)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_BeginEditObject: PTP_OC_ANDROID_BeginEditObject not supported"); return -1; } ret = ptp_android_begineditobject(params, id); if (ret == PTP_RC_OK) return 0; return -1; } int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *device, uint32_t const id) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_operation_issupported(params, PTP_OC_ANDROID_EndEditObject)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_EndEditObject: PTP_OC_ANDROID_EndEditObject not supported"); return -1; } ret = ptp_android_endeditobject(params, id); if (ret == PTP_RC_OK) { // update cached object properties if metadata cache exists update_metadata_cache(device, id); return 0; } return -1; } int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *device, uint32_t const id, uint64_t offset) { PTPParams *params = (PTPParams *) device->params; uint16_t ret; if (!ptp_operation_issupported(params, PTP_OC_ANDROID_TruncateObject)) { add_error_to_errorstack(device, LIBMTP_ERROR_GENERAL, "LIBMTP_TruncateObject: PTP_OC_ANDROID_TruncateObject not supported"); return -1; } ret = ptp_android_truncate(params, id, offset); if (ret == PTP_RC_OK) return 0; return -1; } /** * This routine updates an album based on the metadata * supplied. If the tracks field of the metadata * contains a track listing, these tracks will be added to the * album in place of those already present, i.e. the * previous track listing will be deleted. * @param device a pointer to the device to create the new album on. * @param metadata the metadata for the album to be updated. * notice that the field album_id * must contain the apropriate album ID. * @return 0 on success, any other value means failure. * @see LIBMTP_Create_New_Album() * @see LIBMTP_Delete_Object() */ int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *device, LIBMTP_album_t const * const metadata) { return update_abstract_list(device, metadata->name, metadata->artist, metadata->composer, metadata->genre, metadata->album_id, PTP_OFC_MTP_AbstractAudioAlbum, metadata->tracks, metadata->no_tracks); } /** * Dummy function needed to interface to upstream * ptp.c/ptp.h files. */ void ptp_nikon_getptpipguid (unsigned char* guid) { return; } /** * Add an object to cache. * @param device the device which may have a cache to which the object should be added. * @param object_id the object to add to the cache. */ static void add_object_to_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id) { PTPParams *params = (PTPParams *)device->params; uint16_t ret; ret = ptp_add_object_to_cache(params, object_id); if (ret != PTP_RC_OK) { add_ptp_error_to_errorstack(device, ret, "add_object_to_cache(): couldn't add object to cache"); } } /** * Update cache after object has been modified * @param device the device which may have a cache to which the object should be updated. * @param object_id the object to update. */ static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id) { PTPParams *params = (PTPParams *)device->params; ptp_remove_object_from_cache(params, object_id); add_object_to_cache(device, object_id); } libmtp-1.1.10/src/playlist-spl.h0000644000175000001440000000252712121274441013377 00000000000000/* * \file playlist-spl.h * Playlist to .spl conversion functions. * * Copyright (C) 2008 Alistair Boyle * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __MTP__PLAYLIST_SPL__H #define __MTP__PLAYLIST_SPL__H int is_spl_playlist(PTPObjectInfo *oi); void spl_to_playlist_t(LIBMTP_mtpdevice_t* device, PTPObjectInfo *oi, const uint32_t id, LIBMTP_playlist_t * const pl); int playlist_t_to_spl(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t * const metadata); int update_spl_playlist(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t * const newlist); #endif //__MTP__PLAYLIST_SPL__H libmtp-1.1.10/src/_stdint.h0000644000175000001440000000011412604225575012406 00000000000000/* This file is generated automatically by configure */ #include libmtp-1.1.10/src/util.c0000644000175000001440000001002212540343672011707 00000000000000/** * \file util.c * * This file contains generic utility functions such as can be * used for debugging for example. * * Copyright (C) 2005-2007 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* MSVC does not have these */ #ifndef _MSC_VER #include #include #endif #include #include #include #include #include #include #include "config.h" #include "libmtp.h" #include "util.h" /** * This prints to stdout info about device being UNKNOWN, its * ids, and libmtp's version number. * * @param dev_number the device number * @param id_vendor vendor ID from the usb_device_desc struct * @param id_product product ID from the usb_device_desc struct */ void device_unknown(const int dev_number, const int id_vendor, const int id_product) { // This device is unknown to the developers LIBMTP_ERROR("Device %d (VID=%04x and PID=%04x) is UNKNOWN in libmtp v%s.\n", dev_number, id_vendor, id_product, LIBMTP_VERSION_STRING); LIBMTP_ERROR("Please report this VID/PID and the device model to the " "libmtp development team\n"); /* * Trying to get iManufacturer or iProduct from the device at this * point would require opening a device handle, that we don't want * to do right now. (Takes time for no good enough reason.) */ } /** * This dumps out a number of bytes to a textual, hexadecimal * dump. * * @param f the file to dump to (e.g. stdout or stderr) * @param buf a pointer to the buffer containing the bytes to * be dumped out in hex * @param n the number of bytes to dump from this buffer */ void data_dump (FILE *f, void *buf, uint32_t n) { unsigned char *bp = (unsigned char *) buf; uint32_t i; for (i = 0; i < n; i++) { fprintf(f, "%02x ", *bp); bp++; } fprintf(f, "\n"); } /** * This dumps out a number of bytes to a textual, hexadecimal * dump, and also prints out the string ASCII representation * for each line of bytes. It will also print the memory address * offset from a certain boundry. * * @param f the file to dump to (e.g. stdout or stderr) * @param buf a pointer to the buffer containing the bytes to * be dumped out in hex * @param n the number of bytes to dump from this buffer * @param dump_boundry the address offset to start at (usually 0) */ void data_dump_ascii (FILE *f, void *buf, uint32_t n, uint32_t dump_boundry) { uint32_t remain = n; uint32_t ln, lc; int i; unsigned char *bp = (unsigned char *) buf; lc = 0; while (remain) { fprintf(f, "\t%04x:", dump_boundry-0x10); ln = ( remain > 16 ) ? 16 : remain; for (i = 0; i < ln; i++) { if ( ! (i%2) ) fprintf(f, " "); fprintf(f, "%02x", bp[16*lc+i]); } if ( ln < 16 ) { int width = ((16-ln)/2)*5 + (2*(ln%2)); fprintf(f, "%*.*s", width, width, ""); } fprintf(f, "\t"); for (i = 0; i < ln; i++) { unsigned char ch= bp[16*lc+i]; fprintf(f, "%c", ( ch >= 0x20 && ch <= 0x7e ) ? ch : '.'); } fprintf(f, "\n"); lc++; remain -= ln; dump_boundry += ln; } } #ifndef HAVE_STRNDUP char *strndup (const char *s, size_t n) { size_t len = strlen (s); char *ret; if (len <= n) return strdup (s); ret = malloc(n + 1); strncpy(ret, s, n); ret[n] = '\0'; return ret; } #endif libmtp-1.1.10/src/device-flags.h0000644000175000001440000003244712566671664013324 00000000000000/** * \file device-flags.h * Special device flags to deal with bugs in specific devices. * * Copyright (C) 2005-2007 Richard A. Low * Copyright (C) 2005-2012 Linus Walleij * Copyright (C) 2006-2007 Marcus Meissner * Copyright (C) 2007 Ted Bullock * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * This file is supposed to be included by both libmtp and libgphoto2. */ /** * These flags are used to indicate if some or other * device need special treatment. These should be possible * to concatenate using logical OR so please use one bit per * feature and lets pray we don't need more than 32 bits... */ #define DEVICE_FLAG_NONE 0x00000000 /** * This means that the PTP_OC_MTP_GetObjPropList is broken * in the sense that it won't return properly formatted metadata * for ALL files on the device when you request an object * property list for object 0xFFFFFFFF with parameter 3 likewise * set to 0xFFFFFFFF. Compare to * DEVICE_FLAG_BROKEN_MTPGETOBJECTPROPLIST which only signify * that it's broken when getting metadata for a SINGLE object. * A typical way the implementation may be broken is that it * may not return a proper count of the objects, and sometimes * (like on the ZENs) objects are simply missing from the list * if you use this. Sometimes it has been used incorrectly to * mask bugs in the code (like handling transactions of data * with size given to -1 (0xFFFFFFFFU), in that case please * help us remove it now the code is fixed. Sometimes this is * used because getting all the objects is just too slow and * the USB transaction will time out if you use this command. */ #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL 0x00000001 /** * This means that under Linux, another kernel module may * be using this device's USB interface, so we need to detach * it if it is. Typically this is on dual-mode devices that * will present both an MTP compliant interface and device * descriptor *and* a USB mass storage interface. If the USB * mass storage interface is in use, other apps (like our * userspace libmtp through libusb access path) cannot get in * and get cosy with it. So we can remove the offending * application. Typically this means you have to run the program * as root as well. */ #define DEVICE_FLAG_UNLOAD_DRIVER 0x00000002 /** * This means that the PTP_OC_MTP_GetObjPropList (9805) * is broken in some way, either it doesn't work at all * (as for Android devices) or it won't properly return all * object properties if parameter 3 is set to 0xFFFFFFFFU. */ #define DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST 0x00000004 /** * This means the device doesn't send zero packets to indicate * end of transfer when the transfer boundary occurs at a * multiple of 64 bytes (the USB 1.1 endpoint size). Instead, * exactly one extra byte is sent at the end of the transfer * if the size is an integer multiple of USB 1.1 endpoint size * (64 bytes). * * This behaviour is most probably a workaround due to the fact * that the hardware USB slave controller in the device cannot * handle zero writes at all, and the usage of the USB 1.1 * endpoint size is due to the fact that the device will "gear * down" on a USB 1.1 hub, and since 64 bytes is a multiple of * 512 bytes, it will work with USB 1.1 and USB 2.0 alike. */ #define DEVICE_FLAG_NO_ZERO_READS 0x00000008 /** * This flag means that the device is prone to forgetting the * OGG container file type, so that libmtp must look at the * filename extensions in order to determine that a file is * actually OGG. This is a clear and present firmware bug, and * while firmware bugs should be fixed in firmware, we like * OGG so much that we back it by introducing this flag. * The error has only been seen on iriver devices. Turning this * flag on won't hurt anything, just that the check against * filename extension will be done for files of "unknown" type. * If the player does not even know (reports) that it supports * ogg even though it does, please use the stronger * OGG_IS_UNKNOWN flag, which will forcedly support ogg on * anything with the .ogg filename extension. */ #define DEVICE_FLAG_IRIVER_OGG_ALZHEIMER 0x00000010 /** * This flag indicates a limitation in the filenames a device * can accept - they must be 7 bit (all chars <= 127/0x7F). * It was found first on the Philips Shoqbox, and is a deviation * from the PTP standard which mandates that any unicode chars * may be used for filenames. I guess this is caused by a 7bit-only * filesystem being used intrinsically on the device. */ #define DEVICE_FLAG_ONLY_7BIT_FILENAMES 0x00000020 /** * This flag indicates that the device will lock up if you * try to get status of endpoints and/or release the interface * when closing the device. This fixes problems with SanDisk * Sansa devices especially. It may be a side-effect of a * Windows behaviour of never releasing interfaces. */ #define DEVICE_FLAG_NO_RELEASE_INTERFACE 0x00000040 /** * This flag was introduced with the advent of Creative ZEN * 8GB. The device sometimes return a broken PTP header * like this: < 1502 0000 0200 01d1 02d1 01d2 > * the latter 6 bytes (representing "code" and "transaction ID") * contain junk. This is breaking the PTP/MTP spec but works * on Windows anyway, probably because the Windows implementation * does not check that these bytes are valid. To interoperate * with devices like this, we need this flag to emulate the * Windows bug. Broken headers has also been found in the * Aricent MTP stack. */ #define DEVICE_FLAG_IGNORE_HEADER_ERRORS 0x00000080 /** * The Motorola RAZR2 V8 (others?) has broken set object * proplist causing the metadata setting to fail. (The * set object prop to set individual properties work on * this device, but the metadata is plain ignored on * tracks, though e.g. playlist names can be set.) */ #define DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST 0x00000100 /** * The Samsung YP-T10 think Ogg files shall be sent with * the "unknown" (PTP_OFC_Undefined) file type, this gives a * side effect that is a combination of the iRiver Ogg Alzheimer * problem (have to recognized Ogg files on file extension) * and a need to report the Ogg support (the device itself does * not properly claim to support it) and need to set filetype * to unknown when storing Ogg files, even though they're not * actually unknown. Later iRivers seem to need this flag since * they do not report to support OGG even though they actually * do. Often the device supports OGG in USB mass storage mode, * then the firmware simply miss to declare metadata support * for OGG properly. */ #define DEVICE_FLAG_OGG_IS_UNKNOWN 0x00000200 /** * The Creative Zen is quite unstable in libmtp but seems to * be better with later firmware versions. However, it still * frequently crashes when setting album art dimensions. This * flag disables setting the dimensions (which seems to make * no difference to how the graphic is displayed). */ #define DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS 0x00000400 /** * Some devices, particularly SanDisk Sansas, need to always * have their "OS Descriptor" probed in order to work correctly. * This flag provides that extra massage. */ #define DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR 0x00000800 /** * Samsung has implimented its own playlist format as a .spl file * stored in the normal file system, rather than a proper mtp * playlist. There are multiple versions of the .spl format * identified by a line in the file: VERSION X.XX * Version 1.00 is just a simple playlist. */ #define DEVICE_FLAG_PLAYLIST_SPL_V1 0x00001000 /** * Samsung has implimented its own playlist format as a .spl file * stored in the normal file system, rather than a proper mtp * playlist. There are multiple versions of the .spl format * identified by a line in the file: VERSION X.XX * Version 2.00 is playlist but allows DNSe sound settings * to be stored, per playlist. */ #define DEVICE_FLAG_PLAYLIST_SPL_V2 0x00002000 /** * The Sansa E250 is know to have this problem which is actually * that the device claims that property PTP_OPC_DateModified * is read/write but will still fail to update it. It can only * be set properly the first time a file is sent. */ #define DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED 0x00004000 /** * This avoids use of the send object proplist which * is used when creating new objects (not just updating) * The DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST is related * but only concerns the case where the object proplist * is sent in to update an existing object. The Toshiba * Gigabeat MEU202 for example has this problem. */ #define DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST 0x00008000 /** * Devices that cannot support reading out battery * level. */ #define DEVICE_FLAG_BROKEN_BATTERY_LEVEL 0x00010000 /** * Devices that send "ObjectDeleted" events after deletion * of images. (libgphoto2) */ #define DEVICE_FLAG_DELETE_SENDS_EVENT 0x00020000 /** * Cameras that can capture images. (libgphoto2) */ #define DEVICE_FLAG_CAPTURE 0x00040000 /** * Cameras that can capture images. (libgphoto2) */ #define DEVICE_FLAG_CAPTURE_PREVIEW 0x00080000 /** * Nikon broken capture support without proper ObjectAdded events. * (libgphoto2) */ #define DEVICE_FLAG_NIKON_BROKEN_CAPTURE 0x00100000 /** * Broken capture support where cameras do not send CaptureComplete events. * (libgphoto2) */ #define DEVICE_FLAG_NO_CAPTURE_COMPLETE 0x00400000 /** * Direct PTP match required. * (libgphoto2) */ #define DEVICE_FLAG_OLYMPUS_XML_WRAPPED 0x00800000 /** * This flag is like DEVICE_FLAG_OGG_IS_UNKNOWN but for FLAC * files instead. Using the unknown filetype for FLAC files. */ #define DEVICE_FLAG_FLAC_IS_UNKNOWN 0x01000000 /** * Device needs unique filenames, no two files can be * named the same string. */ #define DEVICE_FLAG_UNIQUE_FILENAMES 0x02000000 /** * This flag performs some random magic on the BlackBerry * device to switch from USB mass storage to MTP mode we think. */ #define DEVICE_FLAG_SWITCH_MODE_BLACKBERRY 0x04000000 /** * This flag indicates that the device need an extra long * timeout on some operations. */ #define DEVICE_FLAG_LONG_TIMEOUT 0x08000000 /** * This flag indicates that the device need an explicit * USB reset after each connection. Some devices don't * like this, so it's not done by default. */ #define DEVICE_FLAG_FORCE_RESET_ON_CLOSE 0x10000000 /** * Early Creative Zen (etc) models actually only support * command 9805 (Get object property list) and will hang * if you try to get individual properties of an object. * Or so it seemed. Later bug fixes to the library has made * this work flawlessly so the bug flag is moot. * NOT USED ANYMORE, THIS FLAG MAY BE RECYCLED. */ #define DEVICE_FLAG_BROKEN_GET_OBJECT_PROPVAL 0x20000000 /** * It seems that some devices return an bad data when * using the GetObjectInfo operation. So in these cases * we prefer to override the PTP-compatible object infos * with the MTP property list. * * For example Some Samsung Galaxy S devices contain an MTP * stack that present the ObjectInfo in 64 bit instead of * 32 bit. */ #define DEVICE_FLAG_PROPLIST_OVERRIDES_OI 0x40000000 /** * All these bug flags need to be set on SONY NWZ Walkman * players, and will be autodetected on unknown devices * by detecting the vendor extension descriptor "sony.net" */ #define DEVICE_FLAGS_SONY_NWZ_BUGS \ (DEVICE_FLAG_UNLOAD_DRIVER | \ DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | \ DEVICE_FLAG_UNIQUE_FILENAMES | \ DEVICE_FLAG_FORCE_RESET_ON_CLOSE) /** * All these bug flags need to be set on Android devices, * they claim to support MTP operations they actually * cannot handle, especially 9805 (Get object property list). * These are auto-assigned to devices reporting * "android.com" in their device extension descriptor. */ #define DEVICE_FLAGS_ANDROID_BUGS \ (DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST | \ DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST | \ DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST | \ DEVICE_FLAG_UNLOAD_DRIVER | \ DEVICE_FLAG_LONG_TIMEOUT | \ DEVICE_FLAG_FORCE_RESET_ON_CLOSE) /** * All these bug flags appear on a number of SonyEricsson * devices including Android devices not using the stock * Android 4.0+ (Ice Cream Sandwich) MTP stack. It is highly * supected that these bugs comes from an MTP implementation * from Aricent, so it is called the Aricent bug flags as a * shorthand. Especially the header errors that need to be * ignored is typical for this stack. * * After some guesswork we auto-assign these bug flags to * devices that present the "microsoft.com/WPDNA", and * "sonyericsson.com/SE" but NOT the "android.com" * descriptor. */ #define DEVICE_FLAGS_ARICENT_BUGS \ (DEVICE_FLAG_IGNORE_HEADER_ERRORS | \ DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST | \ DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST) libmtp-1.1.10/src/libmtp.h.in0000644000175000001440000010672512141470641012645 00000000000000/** * \file libmtp.h * Interface to the Media Transfer Protocol library. * * Copyright (C) 2005-2013 Linus Walleij * Copyright (C) 2005-2008 Richard A. Low * Copyright (C) 2007 Ted Bullock * Copyright (C) 2008 Florent Mertens * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * * #include * */ #ifndef LIBMTP_H_INCLUSION_GUARD #define LIBMTP_H_INCLUSION_GUARD #define LIBMTP_VERSION @VERSION@ #define LIBMTP_VERSION_STRING "@VERSION@" /* This handles MSVC pecularities */ #ifdef _MSC_VER #include #define __WIN32__ #define snprintf _snprintf #define ssize_t SSIZE_T /* * Types that do not exist in Windows * sys/types.h, but they exist in mingw32 * sys/types.h. */ typedef char int8_t; typedef unsigned char uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; #endif #include #include /* We use time_t */ #include /** * @defgroup types libmtp global type definitions * @{ */ /** * The debug flags defined here are the external flags used * by the libmtp library interface. * * Please keep this list in sync with libmtp.c. */ #define LIBMTP_DEBUG_NONE 0x00 #define LIBMTP_DEBUG_PTP 0x01 #define LIBMTP_DEBUG_PLST 0x02 #define LIBMTP_DEBUG_USB 0x04 #define LIBMTP_DEBUG_DATA 0x08 #define LIBMTP_DEBUG_ALL 0xFF /** * The filetypes defined here are the external types used * by the libmtp library interface. The types used internally * as PTP-defined enumerator types is something different. */ typedef enum { LIBMTP_FILETYPE_FOLDER, LIBMTP_FILETYPE_WAV, LIBMTP_FILETYPE_MP3, LIBMTP_FILETYPE_WMA, LIBMTP_FILETYPE_OGG, LIBMTP_FILETYPE_AUDIBLE, LIBMTP_FILETYPE_MP4, LIBMTP_FILETYPE_UNDEF_AUDIO, LIBMTP_FILETYPE_WMV, LIBMTP_FILETYPE_AVI, LIBMTP_FILETYPE_MPEG, LIBMTP_FILETYPE_ASF, LIBMTP_FILETYPE_QT, LIBMTP_FILETYPE_UNDEF_VIDEO, LIBMTP_FILETYPE_JPEG, LIBMTP_FILETYPE_JFIF, LIBMTP_FILETYPE_TIFF, LIBMTP_FILETYPE_BMP, LIBMTP_FILETYPE_GIF, LIBMTP_FILETYPE_PICT, LIBMTP_FILETYPE_PNG, LIBMTP_FILETYPE_VCALENDAR1, LIBMTP_FILETYPE_VCALENDAR2, LIBMTP_FILETYPE_VCARD2, LIBMTP_FILETYPE_VCARD3, LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT, LIBMTP_FILETYPE_WINEXEC, LIBMTP_FILETYPE_TEXT, LIBMTP_FILETYPE_HTML, LIBMTP_FILETYPE_FIRMWARE, LIBMTP_FILETYPE_AAC, LIBMTP_FILETYPE_MEDIACARD, LIBMTP_FILETYPE_FLAC, LIBMTP_FILETYPE_MP2, LIBMTP_FILETYPE_M4A, LIBMTP_FILETYPE_DOC, LIBMTP_FILETYPE_XML, LIBMTP_FILETYPE_XLS, LIBMTP_FILETYPE_PPT, LIBMTP_FILETYPE_MHT, LIBMTP_FILETYPE_JP2, LIBMTP_FILETYPE_JPX, LIBMTP_FILETYPE_ALBUM, LIBMTP_FILETYPE_PLAYLIST, LIBMTP_FILETYPE_UNKNOWN } LIBMTP_filetype_t; /** * \def LIBMTP_FILETYPE_IS_AUDIO * Audio filetype test. * * For filetypes that can be either audio * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO */ #define LIBMTP_FILETYPE_IS_AUDIO(a)\ (a == LIBMTP_FILETYPE_WAV ||\ a == LIBMTP_FILETYPE_MP3 ||\ a == LIBMTP_FILETYPE_MP2 ||\ a == LIBMTP_FILETYPE_WMA ||\ a == LIBMTP_FILETYPE_OGG ||\ a == LIBMTP_FILETYPE_FLAC ||\ a == LIBMTP_FILETYPE_AAC ||\ a == LIBMTP_FILETYPE_M4A ||\ a == LIBMTP_FILETYPE_AUDIBLE ||\ a == LIBMTP_FILETYPE_UNDEF_AUDIO) /** * \def LIBMTP_FILETYPE_IS_VIDEO * Video filetype test. * * For filetypes that can be either audio * or video, use LIBMTP_FILETYPE_IS_AUDIOVIDEO */ #define LIBMTP_FILETYPE_IS_VIDEO(a)\ (a == LIBMTP_FILETYPE_WMV ||\ a == LIBMTP_FILETYPE_AVI ||\ a == LIBMTP_FILETYPE_MPEG ||\ a == LIBMTP_FILETYPE_UNDEF_VIDEO) /** * \def LIBMTP_FILETYPE_IS_AUDIOVIDEO * Audio and&slash;or video filetype test. */ #define LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)\ (a == LIBMTP_FILETYPE_MP4 ||\ a == LIBMTP_FILETYPE_ASF ||\ a == LIBMTP_FILETYPE_QT) /** * \def LIBMTP_FILETYPE_IS_TRACK * Test if filetype is a track. * Use this to determine if the File API or Track API * should be used to upload or download an object. */ #define LIBMTP_FILETYPE_IS_TRACK(a)\ (LIBMTP_FILETYPE_IS_AUDIO(a) ||\ LIBMTP_FILETYPE_IS_VIDEO(a) ||\ LIBMTP_FILETYPE_IS_AUDIOVIDEO(a)) /** * \def LIBMTP_FILETYPE_IS_IMAGE * Image filetype test */ #define LIBMTP_FILETYPE_IS_IMAGE(a)\ (a == LIBMTP_FILETYPE_JPEG ||\ a == LIBMTP_FILETYPE_JFIF ||\ a == LIBMTP_FILETYPE_TIFF ||\ a == LIBMTP_FILETYPE_BMP ||\ a == LIBMTP_FILETYPE_GIF ||\ a == LIBMTP_FILETYPE_PICT ||\ a == LIBMTP_FILETYPE_PNG ||\ a == LIBMTP_FILETYPE_JP2 ||\ a == LIBMTP_FILETYPE_JPX ||\ a == LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT) /** * \def LIBMTP_FILETYPE_IS_ADDRESSBOOK * Addressbook and Business card filetype test */ #define LIBMTP_FILETYPE_IS_ADDRESSBOOK(a)\ (a == LIBMTP_FILETYPE_VCARD2 ||\ a == LIBMTP_FILETYPE_VCARD3) /** * \def LIBMTP_FILETYPE_IS_CALENDAR * Calendar and Appointment filetype test */ #define LIBMTP_FILETYPE_IS_CALENDAR(a)\ (a == LIBMTP_FILETYPE_VCALENDAR1 ||\ a == LIBMTP_FILETYPE_VCALENDAR2) /** * The properties defined here are the external types used * by the libmtp library interface. */ typedef enum { LIBMTP_PROPERTY_StorageID, LIBMTP_PROPERTY_ObjectFormat, LIBMTP_PROPERTY_ProtectionStatus, LIBMTP_PROPERTY_ObjectSize, LIBMTP_PROPERTY_AssociationType, LIBMTP_PROPERTY_AssociationDesc, LIBMTP_PROPERTY_ObjectFileName, LIBMTP_PROPERTY_DateCreated, LIBMTP_PROPERTY_DateModified, LIBMTP_PROPERTY_Keywords, LIBMTP_PROPERTY_ParentObject, LIBMTP_PROPERTY_AllowedFolderContents, LIBMTP_PROPERTY_Hidden, LIBMTP_PROPERTY_SystemObject, LIBMTP_PROPERTY_PersistantUniqueObjectIdentifier, LIBMTP_PROPERTY_SyncID, LIBMTP_PROPERTY_PropertyBag, LIBMTP_PROPERTY_Name, LIBMTP_PROPERTY_CreatedBy, LIBMTP_PROPERTY_Artist, LIBMTP_PROPERTY_DateAuthored, LIBMTP_PROPERTY_Description, LIBMTP_PROPERTY_URLReference, LIBMTP_PROPERTY_LanguageLocale, LIBMTP_PROPERTY_CopyrightInformation, LIBMTP_PROPERTY_Source, LIBMTP_PROPERTY_OriginLocation, LIBMTP_PROPERTY_DateAdded, LIBMTP_PROPERTY_NonConsumable, LIBMTP_PROPERTY_CorruptOrUnplayable, LIBMTP_PROPERTY_ProducerSerialNumber, LIBMTP_PROPERTY_RepresentativeSampleFormat, LIBMTP_PROPERTY_RepresentativeSampleSize, LIBMTP_PROPERTY_RepresentativeSampleHeight, LIBMTP_PROPERTY_RepresentativeSampleWidth, LIBMTP_PROPERTY_RepresentativeSampleDuration, LIBMTP_PROPERTY_RepresentativeSampleData, LIBMTP_PROPERTY_Width, LIBMTP_PROPERTY_Height, LIBMTP_PROPERTY_Duration, LIBMTP_PROPERTY_Rating, LIBMTP_PROPERTY_Track, LIBMTP_PROPERTY_Genre, LIBMTP_PROPERTY_Credits, LIBMTP_PROPERTY_Lyrics, LIBMTP_PROPERTY_SubscriptionContentID, LIBMTP_PROPERTY_ProducedBy, LIBMTP_PROPERTY_UseCount, LIBMTP_PROPERTY_SkipCount, LIBMTP_PROPERTY_LastAccessed, LIBMTP_PROPERTY_ParentalRating, LIBMTP_PROPERTY_MetaGenre, LIBMTP_PROPERTY_Composer, LIBMTP_PROPERTY_EffectiveRating, LIBMTP_PROPERTY_Subtitle, LIBMTP_PROPERTY_OriginalReleaseDate, LIBMTP_PROPERTY_AlbumName, LIBMTP_PROPERTY_AlbumArtist, LIBMTP_PROPERTY_Mood, LIBMTP_PROPERTY_DRMStatus, LIBMTP_PROPERTY_SubDescription, LIBMTP_PROPERTY_IsCropped, LIBMTP_PROPERTY_IsColorCorrected, LIBMTP_PROPERTY_ImageBitDepth, LIBMTP_PROPERTY_Fnumber, LIBMTP_PROPERTY_ExposureTime, LIBMTP_PROPERTY_ExposureIndex, LIBMTP_PROPERTY_DisplayName, LIBMTP_PROPERTY_BodyText, LIBMTP_PROPERTY_Subject, LIBMTP_PROPERTY_Priority, LIBMTP_PROPERTY_GivenName, LIBMTP_PROPERTY_MiddleNames, LIBMTP_PROPERTY_FamilyName, LIBMTP_PROPERTY_Prefix, LIBMTP_PROPERTY_Suffix, LIBMTP_PROPERTY_PhoneticGivenName, LIBMTP_PROPERTY_PhoneticFamilyName, LIBMTP_PROPERTY_EmailPrimary, LIBMTP_PROPERTY_EmailPersonal1, LIBMTP_PROPERTY_EmailPersonal2, LIBMTP_PROPERTY_EmailBusiness1, LIBMTP_PROPERTY_EmailBusiness2, LIBMTP_PROPERTY_EmailOthers, LIBMTP_PROPERTY_PhoneNumberPrimary, LIBMTP_PROPERTY_PhoneNumberPersonal, LIBMTP_PROPERTY_PhoneNumberPersonal2, LIBMTP_PROPERTY_PhoneNumberBusiness, LIBMTP_PROPERTY_PhoneNumberBusiness2, LIBMTP_PROPERTY_PhoneNumberMobile, LIBMTP_PROPERTY_PhoneNumberMobile2, LIBMTP_PROPERTY_FaxNumberPrimary, LIBMTP_PROPERTY_FaxNumberPersonal, LIBMTP_PROPERTY_FaxNumberBusiness, LIBMTP_PROPERTY_PagerNumber, LIBMTP_PROPERTY_PhoneNumberOthers, LIBMTP_PROPERTY_PrimaryWebAddress, LIBMTP_PROPERTY_PersonalWebAddress, LIBMTP_PROPERTY_BusinessWebAddress, LIBMTP_PROPERTY_InstantMessengerAddress, LIBMTP_PROPERTY_InstantMessengerAddress2, LIBMTP_PROPERTY_InstantMessengerAddress3, LIBMTP_PROPERTY_PostalAddressPersonalFull, LIBMTP_PROPERTY_PostalAddressPersonalFullLine1, LIBMTP_PROPERTY_PostalAddressPersonalFullLine2, LIBMTP_PROPERTY_PostalAddressPersonalFullCity, LIBMTP_PROPERTY_PostalAddressPersonalFullRegion, LIBMTP_PROPERTY_PostalAddressPersonalFullPostalCode, LIBMTP_PROPERTY_PostalAddressPersonalFullCountry, LIBMTP_PROPERTY_PostalAddressBusinessFull, LIBMTP_PROPERTY_PostalAddressBusinessLine1, LIBMTP_PROPERTY_PostalAddressBusinessLine2, LIBMTP_PROPERTY_PostalAddressBusinessCity, LIBMTP_PROPERTY_PostalAddressBusinessRegion, LIBMTP_PROPERTY_PostalAddressBusinessPostalCode, LIBMTP_PROPERTY_PostalAddressBusinessCountry, LIBMTP_PROPERTY_PostalAddressOtherFull, LIBMTP_PROPERTY_PostalAddressOtherLine1, LIBMTP_PROPERTY_PostalAddressOtherLine2, LIBMTP_PROPERTY_PostalAddressOtherCity, LIBMTP_PROPERTY_PostalAddressOtherRegion, LIBMTP_PROPERTY_PostalAddressOtherPostalCode, LIBMTP_PROPERTY_PostalAddressOtherCountry, LIBMTP_PROPERTY_OrganizationName, LIBMTP_PROPERTY_PhoneticOrganizationName, LIBMTP_PROPERTY_Role, LIBMTP_PROPERTY_Birthdate, LIBMTP_PROPERTY_MessageTo, LIBMTP_PROPERTY_MessageCC, LIBMTP_PROPERTY_MessageBCC, LIBMTP_PROPERTY_MessageRead, LIBMTP_PROPERTY_MessageReceivedTime, LIBMTP_PROPERTY_MessageSender, LIBMTP_PROPERTY_ActivityBeginTime, LIBMTP_PROPERTY_ActivityEndTime, LIBMTP_PROPERTY_ActivityLocation, LIBMTP_PROPERTY_ActivityRequiredAttendees, LIBMTP_PROPERTY_ActivityOptionalAttendees, LIBMTP_PROPERTY_ActivityResources, LIBMTP_PROPERTY_ActivityAccepted, LIBMTP_PROPERTY_Owner, LIBMTP_PROPERTY_Editor, LIBMTP_PROPERTY_Webmaster, LIBMTP_PROPERTY_URLSource, LIBMTP_PROPERTY_URLDestination, LIBMTP_PROPERTY_TimeBookmark, LIBMTP_PROPERTY_ObjectBookmark, LIBMTP_PROPERTY_ByteBookmark, LIBMTP_PROPERTY_LastBuildDate, LIBMTP_PROPERTY_TimetoLive, LIBMTP_PROPERTY_MediaGUID, LIBMTP_PROPERTY_TotalBitRate, LIBMTP_PROPERTY_BitRateType, LIBMTP_PROPERTY_SampleRate, LIBMTP_PROPERTY_NumberOfChannels, LIBMTP_PROPERTY_AudioBitDepth, LIBMTP_PROPERTY_ScanDepth, LIBMTP_PROPERTY_AudioWAVECodec, LIBMTP_PROPERTY_AudioBitRate, LIBMTP_PROPERTY_VideoFourCCCodec, LIBMTP_PROPERTY_VideoBitRate, LIBMTP_PROPERTY_FramesPerThousandSeconds, LIBMTP_PROPERTY_KeyFrameDistance, LIBMTP_PROPERTY_BufferSize, LIBMTP_PROPERTY_EncodingQuality, LIBMTP_PROPERTY_EncodingProfile, LIBMTP_PROPERTY_BuyFlag, LIBMTP_PROPERTY_UNKNOWN } LIBMTP_property_t; /** * These are the data types */ typedef enum { LIBMTP_DATATYPE_INT8, LIBMTP_DATATYPE_UINT8, LIBMTP_DATATYPE_INT16, LIBMTP_DATATYPE_UINT16, LIBMTP_DATATYPE_INT32, LIBMTP_DATATYPE_UINT32, LIBMTP_DATATYPE_INT64, LIBMTP_DATATYPE_UINT64, } LIBMTP_datatype_t; /** * These are device capabilities */ typedef enum { /** * This capability tells whether you can call the funcion getting * partial objects, @see LIBMTP_GetPartialObject() */ LIBMTP_DEVICECAP_GetPartialObject, /** * This capability tells whether you can call the function sending * partial objects. @see LIBMTP_SendPartialObject() */ LIBMTP_DEVICECAP_SendPartialObject, /** * This capability tells whether you can call the functions editing * objects in-place on a device. * @see LIBMTP_BeginEditObject() * @see LIBMTP_EndEditObject() * @see LIBMTP_TruncateObject() */ LIBMTP_DEVICECAP_EditObjects, } LIBMTP_devicecap_t; /** * These are the numbered error codes. You can also * get string representations for errors. */ typedef enum { LIBMTP_ERROR_NONE, LIBMTP_ERROR_GENERAL, LIBMTP_ERROR_PTP_LAYER, LIBMTP_ERROR_USB_LAYER, LIBMTP_ERROR_MEMORY_ALLOCATION, LIBMTP_ERROR_NO_DEVICE_ATTACHED, LIBMTP_ERROR_STORAGE_FULL, LIBMTP_ERROR_CONNECTING, LIBMTP_ERROR_CANCELLED } LIBMTP_error_number_t; typedef struct LIBMTP_device_entry_struct LIBMTP_device_entry_t; /**< @see LIBMTP_device_entry_struct */ typedef struct LIBMTP_raw_device_struct LIBMTP_raw_device_t; /**< @see LIBMTP_raw_device_struct */ typedef struct LIBMTP_error_struct LIBMTP_error_t; /**< @see LIBMTP_error_struct */ typedef struct LIBMTP_allowed_values_struct LIBMTP_allowed_values_t; /**< @see LIBMTP_allowed_values_struct */ typedef struct LIBMTP_device_extension_struct LIBMTP_device_extension_t; /** < @see LIBMTP_device_extension_struct */ typedef struct LIBMTP_mtpdevice_struct LIBMTP_mtpdevice_t; /**< @see LIBMTP_mtpdevice_struct */ typedef struct LIBMTP_file_struct LIBMTP_file_t; /**< @see LIBMTP_file_struct */ typedef struct LIBMTP_track_struct LIBMTP_track_t; /**< @see LIBMTP_track_struct */ typedef struct LIBMTP_playlist_struct LIBMTP_playlist_t; /**< @see LIBMTP_playlist_struct */ typedef struct LIBMTP_album_struct LIBMTP_album_t; /**< @see LIBMTP_album_struct */ typedef struct LIBMTP_folder_struct LIBMTP_folder_t; /**< @see LIBMTP_folder_t */ typedef struct LIBMTP_object_struct LIBMTP_object_t; /**< @see LIBMTP_object_t */ typedef struct LIBMTP_filesampledata_struct LIBMTP_filesampledata_t; /**< @see LIBMTP_filesample_t */ typedef struct LIBMTP_devicestorage_struct LIBMTP_devicestorage_t; /**< @see LIBMTP_devicestorage_t */ /** * The callback type definition. Notice that a progress percentage ratio * is easy to calculate by dividing sent by * total. * @param sent the number of bytes sent so far * @param total the total number of bytes to send * @param data a user-defined dereferencable pointer * @return if anything else than 0 is returned, the current transfer will be * interrupted / cancelled. */ typedef int (* LIBMTP_progressfunc_t) (uint64_t const sent, uint64_t const total, void const * const data); /** * Callback function for get by handler function * @param params the device parameters * @param priv a user-defined dereferencable pointer * @param wantlen the number of bytes wanted * @param data a buffer to write the data to * @param gotlen pointer to the number of bytes actually written * to data * @return LIBMTP_HANDLER_RETURN_OK if successful, * LIBMTP_HANDLER_RETURN_ERROR on error or * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer */ typedef uint16_t (* MTPDataGetFunc) (void* params, void* priv, uint32_t wantlen, unsigned char *data, uint32_t *gotlen); /** * Callback function for put by handler function * @param params the device parameters * @param priv a user-defined dereferencable pointer * @param sendlen the number of bytes available * @param data a buffer to read the data from * @param putlen pointer to the number of bytes actually read * from data * @return LIBMTP_HANDLER_RETURN_OK if successful, * LIBMTP_HANDLER_RETURN_ERROR on error or * LIBMTP_HANDLER_RETURN_CANCEL to cancel the transfer */ typedef uint16_t (* MTPDataPutFunc) (void* params, void* priv, uint32_t sendlen, unsigned char *data, uint32_t *putlen); /** * The return codes for the get/put functions */ #define LIBMTP_HANDLER_RETURN_OK 0 #define LIBMTP_HANDLER_RETURN_ERROR 1 #define LIBMTP_HANDLER_RETURN_CANCEL 2 /** * @} * @defgroup structar libmtp data structures * @{ */ /** * A data structure to hold MTP device entries. */ struct LIBMTP_device_entry_struct { char *vendor; /**< The vendor of this device */ uint16_t vendor_id; /**< Vendor ID for this device */ char *product; /**< The product name of this device */ uint16_t product_id; /**< Product ID for this device */ uint32_t device_flags; /**< Bugs, device specifics etc */ }; /** * A data structure to hold a raw MTP device connected * to the bus. */ struct LIBMTP_raw_device_struct { LIBMTP_device_entry_t device_entry; /**< The device entry for this raw device */ uint32_t bus_location; /**< Location of the bus, if device available */ uint8_t devnum; /**< Device number on the bus, if device available */ }; /** * A data structure to hold errors from the library. */ struct LIBMTP_error_struct { LIBMTP_error_number_t errornumber; char *error_text; LIBMTP_error_t *next; }; /** * A data structure to hold allowed ranges of values */ struct LIBMTP_allowed_values_struct { uint8_t u8max; uint8_t u8min; uint8_t u8step; uint8_t* u8vals; int8_t i8max; int8_t i8min; int8_t i8step; int8_t* i8vals; uint16_t u16max; uint16_t u16min; uint16_t u16step; uint16_t* u16vals; int16_t i16max; int16_t i16min; int16_t i16step; int16_t* i16vals; uint32_t u32max; uint32_t u32min; uint32_t u32step; uint32_t* u32vals; int32_t i32max; int32_t i32min; int32_t i32step; int32_t* i32vals; uint64_t u64max; uint64_t u64min; uint64_t u64step; uint64_t* u64vals; int64_t i64max; int64_t i64min; int64_t i64step; int64_t* i64vals; /** * Number of entries in the vals array */ uint16_t num_entries; /** * The datatype specifying which of the above is used */ LIBMTP_datatype_t datatype; /** * Non zero for range, 0 for enum */ int is_range; }; /** * MTP device extension holder struct */ struct LIBMTP_device_extension_struct { /** * Name of extension e.g. "foo.com" */ char *name; /** * Major revision of extension */ int major; /** * Minor revision of extension */ int minor; /** * Pointer to the next extension or NULL if this is the * last extension. */ LIBMTP_device_extension_t *next; }; /** * Main MTP device object struct */ struct LIBMTP_mtpdevice_struct { /** * Object bitsize, typically 32 or 64. */ uint8_t object_bitsize; /** * Parameters for this device, must be cast into * \c (PTPParams*) before internal use. */ void *params; /** * USB device for this device, must be cast into * \c (PTP_USB*) before internal use. */ void *usbinfo; /** * The storage for this device, do not use strings in here without * copying them first, and beware that this list may be rebuilt at * any time. * @see LIBMTP_Get_Storage() */ LIBMTP_devicestorage_t *storage; /** * The error stack. This shall be handled using the error getting * and clearing functions, not by dereferencing this list. */ LIBMTP_error_t *errorstack; /** The maximum battery level for this device */ uint8_t maximum_battery_level; /** Default music folder */ uint32_t default_music_folder; /** Default playlist folder */ uint32_t default_playlist_folder; /** Default picture folder */ uint32_t default_picture_folder; /** Default video folder */ uint32_t default_video_folder; /** Default organizer folder */ uint32_t default_organizer_folder; /** Default ZENcast folder (only Creative devices...) */ uint32_t default_zencast_folder; /** Default Album folder */ uint32_t default_album_folder; /** Default Text folder */ uint32_t default_text_folder; /** Per device iconv() converters, only used internally */ void *cd; /** Extension list */ LIBMTP_device_extension_t *extensions; /** Whether the device uses caching, only used internally */ int cached; /** Pointer to next device in linked list; NULL if this is the last device */ LIBMTP_mtpdevice_t *next; }; /** * MTP file struct */ struct LIBMTP_file_struct { uint32_t item_id; /**< Unique item ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this file */ char *filename; /**< Filename of this file */ uint64_t filesize; /**< Size of file in bytes */ time_t modificationdate; /**< Date of last alteration of the file */ LIBMTP_filetype_t filetype; /**< Filetype used for the current file */ LIBMTP_file_t *next; /**< Next file in list or NULL if last file */ }; /** * MTP track struct */ struct LIBMTP_track_struct { uint32_t item_id; /**< Unique item ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this track */ char *title; /**< Track title */ char *artist; /**< Name of recording artist */ char *composer; /**< Name of recording composer */ char *genre; /**< Genre name for track */ char *album; /**< Album name for track */ char *date; /**< Date of original recording as a string */ char *filename; /**< Original filename of this track */ uint16_t tracknumber; /**< Track number (in sequence on recording) */ uint32_t duration; /**< Duration in milliseconds */ uint32_t samplerate; /**< Sample rate of original file, min 0x1f80 max 0xbb80 */ uint16_t nochannels; /**< Number of channels in this recording 0 = unknown, 1 or 2 */ uint32_t wavecodec; /**< FourCC wave codec name */ uint32_t bitrate; /**< (Average) bitrate for this file min=1 max=0x16e360 */ uint16_t bitratetype; /**< 0 = unused, 1 = constant, 2 = VBR, 3 = free */ uint16_t rating; /**< User rating 0-100 (0x00-0x64) */ uint32_t usecount; /**< Number of times used/played */ uint64_t filesize; /**< Size of track file in bytes */ time_t modificationdate; /**< Date of last alteration of the track */ LIBMTP_filetype_t filetype; /**< Filetype used for the current track */ LIBMTP_track_t *next; /**< Next track in list or NULL if last track */ }; /** * MTP Playlist structure */ struct LIBMTP_playlist_struct { uint32_t playlist_id; /**< Unique playlist ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this playlist */ char *name; /**< Name of playlist */ uint32_t *tracks; /**< The tracks in this playlist */ uint32_t no_tracks; /**< The number of tracks in this playlist */ LIBMTP_playlist_t *next; /**< Next playlist or NULL if last playlist */ }; /** * MTP Album structure */ struct LIBMTP_album_struct { uint32_t album_id; /**< Unique playlist ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this album */ char *name; /**< Name of album */ char *artist; /**< Name of album artist */ char *composer; /**< Name of recording composer */ char *genre; /**< Genre of album */ uint32_t *tracks; /**< The tracks in this album */ uint32_t no_tracks; /**< The number of tracks in this album */ LIBMTP_album_t *next; /**< Next album or NULL if last album */ }; /** * MTP Folder structure */ struct LIBMTP_folder_struct { uint32_t folder_id; /**< Unique folder ID */ uint32_t parent_id; /**< ID of parent folder */ uint32_t storage_id; /**< ID of storage holding this folder */ char *name; /**< Name of folder */ LIBMTP_folder_t *sibling; /**< Next folder at same level or NULL if no more */ LIBMTP_folder_t *child; /**< Child folder or NULL if no children */ }; /** * LIBMTP Object RepresentativeSampleData Structure */ struct LIBMTP_filesampledata_struct { uint32_t width; /**< Width of sample if it is an image */ uint32_t height; /**< Height of sample if it is an image */ uint32_t duration; /**< Duration in milliseconds if it is audio */ LIBMTP_filetype_t filetype; /**< Filetype used for the sample */ uint64_t size; /**< Size of sample data in bytes */ char *data; /**< Sample data */ }; /** * LIBMTP Device Storage structure */ struct LIBMTP_devicestorage_struct { uint32_t id; /**< Unique ID for this storage */ uint16_t StorageType; /**< Storage type */ uint16_t FilesystemType; /**< Filesystem type */ uint16_t AccessCapability; /**< Access capability */ uint64_t MaxCapacity; /**< Maximum capability */ uint64_t FreeSpaceInBytes; /**< Free space in bytes */ uint64_t FreeSpaceInObjects; /**< Free space in objects */ char *StorageDescription; /**< A brief description of this storage */ char *VolumeIdentifier; /**< A volume identifier */ LIBMTP_devicestorage_t *next; /**< Next storage, follow this link until NULL */ LIBMTP_devicestorage_t *prev; /**< Previous storage */ }; /** * LIBMTP Event structure * TODO: add all externally visible events here */ enum LIBMTP_event_enum { LIBMTP_EVENT_NONE, LIBMTP_EVENT_STORE_ADDED, LIBMTP_EVENT_STORE_REMOVED, LIBMTP_EVENT_OBJECT_ADDED, LIBMTP_EVENT_OBJECT_REMOVED, }; typedef enum LIBMTP_event_enum LIBMTP_event_t; /** @} */ /* Make functions available for C++ */ #ifdef __cplusplus extern "C" { #endif extern int LIBMTP_debug; /** * @defgroup internals The libmtp internals API. * @{ */ void LIBMTP_Set_Debug(int); void LIBMTP_Init(void); int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const, int * const); /** * @} * @defgroup basic The basic device management API. * @{ */ LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t **, int *); int LIBMTP_Check_Specific_Device(int busno, int devno); LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device(LIBMTP_raw_device_t *); LIBMTP_mtpdevice_t *LIBMTP_Open_Raw_Device_Uncached(LIBMTP_raw_device_t *); /* Begin old, legacy interface */ LIBMTP_mtpdevice_t *LIBMTP_Get_First_Device(void); LIBMTP_error_number_t LIBMTP_Get_Connected_Devices(LIBMTP_mtpdevice_t **); uint32_t LIBMTP_Number_Devices_In_List(LIBMTP_mtpdevice_t *); void LIBMTP_Release_Device_List(LIBMTP_mtpdevice_t*); /* End old, legacy interface */ void LIBMTP_Release_Device(LIBMTP_mtpdevice_t*); void LIBMTP_Dump_Device_Info(LIBMTP_mtpdevice_t*); int LIBMTP_Reset_Device(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Manufacturername(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Modelname(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Serialnumber(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Deviceversion(LIBMTP_mtpdevice_t*); char *LIBMTP_Get_Friendlyname(LIBMTP_mtpdevice_t*); int LIBMTP_Set_Friendlyname(LIBMTP_mtpdevice_t*, char const * const); char *LIBMTP_Get_Syncpartner(LIBMTP_mtpdevice_t*); int LIBMTP_Set_Syncpartner(LIBMTP_mtpdevice_t*, char const * const); int LIBMTP_Get_Batterylevel(LIBMTP_mtpdevice_t *, uint8_t * const, uint8_t * const); int LIBMTP_Get_Secure_Time(LIBMTP_mtpdevice_t *, char ** const); int LIBMTP_Get_Device_Certificate(LIBMTP_mtpdevice_t *, char ** const); int LIBMTP_Get_Supported_Filetypes(LIBMTP_mtpdevice_t *, uint16_t ** const, uint16_t * const); int LIBMTP_Check_Capability(LIBMTP_mtpdevice_t *, LIBMTP_devicecap_t); LIBMTP_error_t *LIBMTP_Get_Errorstack(LIBMTP_mtpdevice_t*); void LIBMTP_Clear_Errorstack(LIBMTP_mtpdevice_t*); void LIBMTP_Dump_Errorstack(LIBMTP_mtpdevice_t*); #define LIBMTP_STORAGE_SORTBY_NOTSORTED 0 #define LIBMTP_STORAGE_SORTBY_FREESPACE 1 #define LIBMTP_STORAGE_SORTBY_MAXSPACE 2 int LIBMTP_Get_Storage(LIBMTP_mtpdevice_t *, int const); int LIBMTP_Format_Storage(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *); /** * Get/set arbitrary properties. These do not update the cache; should only be used on * properties not stored in structs */ char *LIBMTP_Get_String_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const); uint64_t LIBMTP_Get_u64_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint64_t const); uint32_t LIBMTP_Get_u32_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint32_t const); uint16_t LIBMTP_Get_u16_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint16_t const); uint8_t LIBMTP_Get_u8_From_Object(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint8_t const); int LIBMTP_Set_Object_String(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, char const * const); int LIBMTP_Set_Object_u32(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint32_t const); int LIBMTP_Set_Object_u16(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint16_t const); int LIBMTP_Set_Object_u8(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_property_t const, uint8_t const); char const * LIBMTP_Get_Property_Description(LIBMTP_property_t inproperty); int LIBMTP_Is_Property_Supported(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, LIBMTP_filetype_t const); int LIBMTP_Get_Allowed_Property_Values(LIBMTP_mtpdevice_t*, LIBMTP_property_t const, LIBMTP_filetype_t const, LIBMTP_allowed_values_t*); void LIBMTP_destroy_allowed_values_t(LIBMTP_allowed_values_t*); /** * @} * @defgroup files The file management API. * @{ */ LIBMTP_file_t *LIBMTP_new_file_t(void); void LIBMTP_destroy_file_t(LIBMTP_file_t*); char const * LIBMTP_Get_Filetype_Description(LIBMTP_filetype_t); LIBMTP_file_t *LIBMTP_Get_Filelisting(LIBMTP_mtpdevice_t *); LIBMTP_file_t *LIBMTP_Get_Filelisting_With_Callback(LIBMTP_mtpdevice_t *, LIBMTP_progressfunc_t const, void const * const); LIBMTP_file_t * LIBMTP_Get_Files_And_Folders(LIBMTP_mtpdevice_t *, uint32_t const, uint32_t const); LIBMTP_file_t *LIBMTP_Get_Filemetadata(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Get_File_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_File_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_File_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_File_From_File(LIBMTP_mtpdevice_t *, char const * const, LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_File_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_File_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *, LIBMTP_file_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Set_File_Name(LIBMTP_mtpdevice_t *, LIBMTP_file_t *, const char *); LIBMTP_filesampledata_t *LIBMTP_new_filesampledata_t(void); void LIBMTP_destroy_filesampledata_t(LIBMTP_filesampledata_t *); int LIBMTP_Get_Representative_Sample_Format(LIBMTP_mtpdevice_t *, LIBMTP_filetype_t const, LIBMTP_filesampledata_t **); int LIBMTP_Send_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_filesampledata_t *); int LIBMTP_Get_Representative_Sample(LIBMTP_mtpdevice_t *, uint32_t const, LIBMTP_filesampledata_t *); int LIBMTP_Get_Thumbnail(LIBMTP_mtpdevice_t *, uint32_t const, unsigned char **data, unsigned int *size); /** * @} * @defgroup tracks The track management API. * @{ */ LIBMTP_track_t *LIBMTP_new_track_t(void); void LIBMTP_destroy_track_t(LIBMTP_track_t*); LIBMTP_track_t *LIBMTP_Get_Tracklisting(LIBMTP_mtpdevice_t*); LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback(LIBMTP_mtpdevice_t*, LIBMTP_progressfunc_t const, void const * const); LIBMTP_track_t *LIBMTP_Get_Tracklisting_With_Callback_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const, LIBMTP_progressfunc_t const, void const * const); LIBMTP_track_t *LIBMTP_Get_Trackmetadata(LIBMTP_mtpdevice_t*, uint32_t const); int LIBMTP_Get_Track_To_File(LIBMTP_mtpdevice_t*, uint32_t, char const * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_Track_To_File_Descriptor(LIBMTP_mtpdevice_t*, uint32_t const, int const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Get_Track_To_Handler(LIBMTP_mtpdevice_t *, uint32_t const, MTPDataPutFunc, void *, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_Track_From_File(LIBMTP_mtpdevice_t *, char const * const, LIBMTP_track_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_Track_From_File_Descriptor(LIBMTP_mtpdevice_t *, int const, LIBMTP_track_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Send_Track_From_Handler(LIBMTP_mtpdevice_t *, MTPDataGetFunc, void *, LIBMTP_track_t * const, LIBMTP_progressfunc_t const, void const * const); int LIBMTP_Update_Track_Metadata(LIBMTP_mtpdevice_t *, LIBMTP_track_t const * const); int LIBMTP_Track_Exists(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Set_Track_Name(LIBMTP_mtpdevice_t *, LIBMTP_track_t *, const char *); /** @} */ /** * @} * @defgroup folders The folder management API. * @{ */ LIBMTP_folder_t *LIBMTP_new_folder_t(void); void LIBMTP_destroy_folder_t(LIBMTP_folder_t*); LIBMTP_folder_t *LIBMTP_Get_Folder_List(LIBMTP_mtpdevice_t*); LIBMTP_folder_t *LIBMTP_Get_Folder_List_For_Storage(LIBMTP_mtpdevice_t*, uint32_t const); LIBMTP_folder_t *LIBMTP_Find_Folder(LIBMTP_folder_t*, uint32_t const); uint32_t LIBMTP_Create_Folder(LIBMTP_mtpdevice_t*, char *, uint32_t, uint32_t); int LIBMTP_Set_Folder_Name(LIBMTP_mtpdevice_t *, LIBMTP_folder_t *, const char *); /** @} */ /** * @} * @defgroup playlists The audio/video playlist management API. * @{ */ LIBMTP_playlist_t *LIBMTP_new_playlist_t(void); void LIBMTP_destroy_playlist_t(LIBMTP_playlist_t *); LIBMTP_playlist_t *LIBMTP_Get_Playlist_List(LIBMTP_mtpdevice_t *); LIBMTP_playlist_t *LIBMTP_Get_Playlist(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Create_New_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); int LIBMTP_Update_Playlist(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t * const); int LIBMTP_Set_Playlist_Name(LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *, const char *); /** * @} * @defgroup albums The audio/video album management API. * @{ */ LIBMTP_album_t *LIBMTP_new_album_t(void); void LIBMTP_destroy_album_t(LIBMTP_album_t *); LIBMTP_album_t *LIBMTP_Get_Album_List(LIBMTP_mtpdevice_t *); LIBMTP_album_t *LIBMTP_Get_Album_List_For_Storage(LIBMTP_mtpdevice_t *, uint32_t const); LIBMTP_album_t *LIBMTP_Get_Album(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_Create_New_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t * const); int LIBMTP_Update_Album(LIBMTP_mtpdevice_t *, LIBMTP_album_t const * const); int LIBMTP_Set_Album_Name(LIBMTP_mtpdevice_t *, LIBMTP_album_t *, const char *); /** * @} * @defgroup objects The object management API. * @{ */ int LIBMTP_Delete_Object(LIBMTP_mtpdevice_t *, uint32_t); int LIBMTP_Set_Object_Filename(LIBMTP_mtpdevice_t *, uint32_t , char *); int LIBMTP_GetPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, uint32_t, unsigned char **, unsigned int *); int LIBMTP_SendPartialObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t, unsigned char *, unsigned int); int LIBMTP_BeginEditObject(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_EndEditObject(LIBMTP_mtpdevice_t *, uint32_t const); int LIBMTP_TruncateObject(LIBMTP_mtpdevice_t *, uint32_t const, uint64_t); /** * @} * @defgroup files The events API. * @{ */ int LIBMTP_Read_Event(LIBMTP_mtpdevice_t *, LIBMTP_event_t *, uint32_t *); /** @} */ /* End of C++ exports */ #ifdef __cplusplus } #endif #endif /* LIBMTP_H_INCLUSION_GUARD */ libmtp-1.1.10/src/chdk_ptp.h0000644000175000001440000003160312345765122012544 00000000000000#ifndef __CHDK_PTP_H #define __CHDK_PTP_H // CHDK PTP protocol interface (can also be used in client PTP programs) // Note: used in modules and platform independent code. // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values) #define PTP_CHDK_VERSION_MAJOR 2 // increase only with backwards incompatible changes (and reset minor) #define PTP_CHDK_VERSION_MINOR 6 // increase with extensions of functionality // minor > 1000 for development versions /* protocol version history 0.1 - initial proposal from mweerden, + luar 0.2 - Added ScriptStatus and ScriptSupport, based on work by ultimA 1.0 - removed old script result code (luar), replace with message system 2.0 - return PTP_CHDK_TYPE_TABLE for tables instead of TYPE_STRING, allow return of empty strings 2.1 - experimental live view, not formally released 2.2 - live view (work in progress) 2.3 - live view - released in 1.1 2.4 - live view protocol 2.1 2.5 - remote capture 2.6 - script execution flags */ #define PTP_OC_CHDK 0x9999 // N.B.: unused parameters should be set to 0 //enum ptp_chdk_command { enum PTP_CHDK_Command { PTP_CHDK_Version = 0, // return param1 is major version number // return param2 is minor version number PTP_CHDK_GetMemory, // param2 is base address (not NULL; circumvent by taking 0xFFFFFFFF and size+1) // param3 is size (in bytes) // return data is memory block PTP_CHDK_SetMemory, // param2 is address // param3 is size (in bytes) // data is new memory block PTP_CHDK_CallFunction, // data is array of function pointer and 32 bit int arguments (max: 10 args prior to protocol 2.5) // return param1 is return value PTP_CHDK_TempData, // data is data to be stored for later // param2 is for the TD flags below PTP_CHDK_UploadFile, // data is 4-byte length of filename, followed by filename and contents PTP_CHDK_DownloadFile, // preceded by PTP_CHDK_TempData with filename // return data are file contents PTP_CHDK_ExecuteScript, // data is script to be executed // param2 is language of script // in proto 2.6 and later, language is the lower byte, rest is used for PTP_CHDK_SCRIPT_FL* flags // return param1 is script id, like a process id // return param2 is status from ptp_chdk_script_error_type PTP_CHDK_ScriptStatus, // Script execution status // return param1 bits // PTP_CHDK_SCRIPT_STATUS_RUN is set if a script running, cleared if not // PTP_CHDK_SCRIPT_STATUS_MSG is set if script messages from script waiting to be read // all other bits and params are reserved for future use PTP_CHDK_ScriptSupport, // Which scripting interfaces are supported in this build // param1 CHDK_PTP_SUPPORT_LUA is set if lua is supported, cleared if not // all other bits and params are reserved for future use PTP_CHDK_ReadScriptMsg, // read next message from camera script system // return param1 is chdk_ptp_s_msg_type // return param2 is message subtype: // for script return and users this is ptp_chdk_script_data_type // for error ptp_chdk_script_error_type // return param3 is script id of script that generated the message // return param4 is length of the message data. // return data is message. // A minimum of 1 bytes of zeros is returned if the message has no data (empty string or type NONE) PTP_CHDK_WriteScriptMsg, // write a message for scripts running on camera // input param2 is target script id, 0=don't care. Messages for a non-running script will be discarded // data length is handled by ptp data phase // input messages do not have type or subtype, they are always a string destined for the script (similar to USER/string) // output param1 is ptp_chdk_script_msg_status PTP_CHDK_GetDisplayData, // Return camera display data // This is defined as separate sub protocol in live_view.h // Changes to the sub-protocol will always be considered a minor change to the main protocol // param2 bitmask of data // output param1 = total size of data // return data is protocol information, frame buffer descriptions and selected display data // Currently a data phase is always returned. Future versions may define other behavior // for values in currently unused parameters. // Direct image capture over USB. // Use lua get_usb_capture_support for available data types, lua init_usb_capture for setup PTP_CHDK_RemoteCaptureIsReady, // Check if data is available // return param1 is status // 0 = not ready // 0x10000000 = remote capture not initialized // otherwise bitmask of PTP_CHDK_CAPTURE_* datatypes // return param2 is image number PTP_CHDK_RemoteCaptureGetData // retrieve data // param2 is bit indicating data type to get // return param1 is length // return param2 more chunks available? // 0 = no more chunks of selected format // return param3 seek required to pos (-1 = no seek) }; // data types as used by ReadScriptMessage enum ptp_chdk_script_data_type { PTP_CHDK_TYPE_UNSUPPORTED = 0, // type name will be returned in data PTP_CHDK_TYPE_NIL, PTP_CHDK_TYPE_BOOLEAN, PTP_CHDK_TYPE_INTEGER, PTP_CHDK_TYPE_STRING, // Empty strings are returned with length=0 PTP_CHDK_TYPE_TABLE, // tables are converted to a string by usb_msg_table_to_string, // this function can be overridden in lua to change the format // the string may be empty for an empty table }; // TempData flags #define PTP_CHDK_TD_DOWNLOAD 0x1 // download data instead of upload #define PTP_CHDK_TD_CLEAR 0x2 // clear the stored data; with DOWNLOAD this // means first download, then clear and // without DOWNLOAD this means no uploading, // just clear // Script Languages - for execution only lua is supported for now #define PTP_CHDK_SL_LUA 0 #define PTP_CHDK_SL_UBASIC 1 #define PTP_CHDK_SL_MASK 0xFF /* standard message chdkptp sends */ #define PTP_CHDK_LUA_SERIALIZE "\n\ serialize_r = function(v,opts,r,seen,depth)\n\ local vt = type(v)\n\ if vt == 'nil' or vt == 'boolean' or vt == 'number' then\n\ table.insert(r,tostring(v))\n\ return\n\ end\n\ if vt == 'string' then\n\ table.insert(r,string.format('%q',v))\n\ return\n\ end\n\ if vt == 'table' then\n\ if not depth then\n\ depth = 1\n\ end\n\ if depth >= opts.maxdepth then\n\ error('serialize: max depth')\n\ end\n\ if not seen then\n\ seen={}\n\ elseif seen[v] then\n\ if opts.err_cycle then\n\ error('serialize: cycle')\n\ else\n\ table.insert(r,'\"cycle:'..tostring(v)..'\"')\n\ return\n\ end\n\ end\n\ seen[v] = true;\n\ table.insert(r,'{')\n\ for k,v1 in pairs(v) do\n\ if opts.pretty then\n\ table.insert(r,'\\n'..string.rep(' ',depth))\n\ end\n\ if type(k) == 'string' and string.match(k,'^[_%a][%a%d_]*$') then\n\ table.insert(r,k)\n\ else\n\ table.insert(r,'[')\n\ serialize_r(k,opts,r,seen,depth+1)\n\ table.insert(r,']')\n\ end\n\ table.insert(r,'=')\n\ serialize_r(v1,opts,r,seen,depth+1)\n\ table.insert(r,',')\n\ end\n\ if opts.pretty then\n\ table.insert(r,'\\n'..string.rep(' ',depth-1))\n\ end\n\ table.insert(r,'}')\n\ return\n\ end\n\ if opts.err_type then\n\ error('serialize: unsupported type ' .. vt, 2)\n\ else\n\ table.insert(r,'\"'..tostring(v)..'\"')\n\ end\n\ end\n\ serialize_defaults = {\n\ maxdepth=10,\n\ err_type=true,\n\ err_cycle=true,\n\ pretty=false,\n\ }\n\ function serialize(v,opts)\n\ if opts then\n\ for k,v in pairs(serialize_defaults) do\n\ if not opts[k] then\n\ opts[k]=v\n\ end\n\ end\n\ else\n\ opts=serialize_defaults\n\ end\n\ local r={}\n\ serialize_r(v,opts,r)\n\ return table.concat(r)\n\ end\n\ \n\ usb_msg_table_to_string=serialize\n" // bit flags for script start #define PTP_CHDK_SCRIPT_FL_NOKILL 0x100 // if script is running return error instead of killing #define PTP_CHDK_SCRIPT_FL_FLUSH_CAM_MSGS 0x200 // discard existing cam->host messages before starting #define PTP_CHDK_SCRIPT_FL_FLUSH_HOST_MSGS 0x400 // discard existing host->cam messages before starting // bit flags for script status #define PTP_CHDK_SCRIPT_STATUS_RUN 0x1 // script running #define PTP_CHDK_SCRIPT_STATUS_MSG 0x2 // messages waiting // bit flags for scripting support #define PTP_CHDK_SCRIPT_SUPPORT_LUA 0x1 // bit flags for remote capture // used to select and also to indicate available data in PTP_CHDK_RemoteCaptureIsReady /* Full jpeg file. Note supported on all cameras, use Lua get_usb_capture_support to check */ #define PTP_CHDK_CAPTURE_JPG 0x1 /* Raw framebuffer data, in camera native format. A subset of rows may be requested in init_usb_capture. */ #define PTP_CHDK_CAPTURE_RAW 0x2 /* DNG header. The header will be DNG version 1.3 Does not include image data, clients wanting to create a DNG file should also request RAW Raw data for all known cameras will be packed, little endian. Client is responsible for reversing the byte order if creating a DNG. Can requested without RAW to get sensor dimensions, exif values etc. ifd 0 specifies a 128x96 RGB thumbnail, 4 byte aligned following the header client is responsible for generating thumbnail data. ifd 0 subifd 0 specifies the main image The image dimensions always contain the full sensor dimensions, if a sub-image was requested with init_usb_capture, the client is responsible for padding the data to the full image or adjusting dimensions. Bad pixels will not be patched, but DNG opcodes will specify how to patch them */ #define PTP_CHDK_CAPTURE_DNGHDR 0x4 // status from PTP_CHDK_RemoteCaptureIsReady if capture not enabled #define PTP_CHDK_CAPTURE_NOTSET 0x10000000 // message types enum ptp_chdk_script_msg_type { PTP_CHDK_S_MSGTYPE_NONE = 0, // no messages waiting PTP_CHDK_S_MSGTYPE_ERR, // error message PTP_CHDK_S_MSGTYPE_RET, // script return value PTP_CHDK_S_MSGTYPE_USER, // message queued by script // TODO chdk console data ? }; // error subtypes for PTP_CHDK_S_MSGTYPE_ERR and script startup status enum ptp_chdk_script_error_type { PTP_CHDK_S_ERRTYPE_NONE = 0, PTP_CHDK_S_ERRTYPE_COMPILE, PTP_CHDK_S_ERRTYPE_RUN, // the following are for ExecuteScript status only, not message types PTP_CHDK_S_ERR_SCRIPTRUNNING = 0x1000, // script already running with NOKILL }; // message status enum ptp_chdk_script_msg_status { PTP_CHDK_S_MSGSTATUS_OK = 0, // queued ok PTP_CHDK_S_MSGSTATUS_NOTRUN, // no script is running PTP_CHDK_S_MSGSTATUS_QFULL, // queue is full PTP_CHDK_S_MSGSTATUS_BADID, // specified ID is not running }; #endif // __CHDK_PTP_H libmtp-1.1.10/src/gphoto2-endian.h0000644000175000001440000001077712604225575013600 00000000000000/* This file is generated automatically by configure */ /* It is valid only for the system type x86_64-suse-linux-gnu */ #ifndef __BYTEORDER_H #define __BYTEORDER_H /* ntohl and relatives live here */ #include /* Define generic byte swapping functions */ #include #define swap16(x) bswap_16(x) #define swap32(x) bswap_32(x) #define swap64(x) bswap_64(x) /* The byte swapping macros have the form: */ /* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */ /* le (little-endian), NN is 16 or 32 (number of bits) and a, */ /* if present, indicates that the endian side is a pointer to an */ /* array of uint8_t bytes instead of an integer of the specified length. */ /* h refers to the host's ordering method. */ /* So, to convert a 32-bit integer stored in a buffer in little-endian */ /* format into a uint32_t usable on this machine, you could use: */ /* uint32_t value = le32atoh(&buf[3]); */ /* To put that value back into the buffer, you could use: */ /* htole32a(&buf[3], value); */ /* Define aliases for the standard byte swapping macros */ /* Arguments to these macros must be properly aligned on natural word */ /* boundaries in order to work properly on all architectures */ #ifndef htobe16 # define htobe16(x) htons(x) #endif #ifndef htobe32 # define htobe32(x) htonl(x) #endif #ifndef be16toh # define be16toh(x) ntohs(x) #endif #ifndef be32toh # define be32toh(x) ntohl(x) #endif #define HTOBE16(x) (x) = htobe16(x) #define HTOBE32(x) (x) = htobe32(x) #define BE32TOH(x) (x) = be32toh(x) #define BE16TOH(x) (x) = be16toh(x) /* On little endian machines, these macros are null */ #ifndef htole16 # define htole16(x) (x) #endif #ifndef htole32 # define htole32(x) (x) #endif #ifndef htole64 # define htole64(x) (x) #endif #ifndef le16toh # define le16toh(x) (x) #endif #ifndef le32toh # define le32toh(x) (x) #endif #ifndef le64toh # define le64toh(x) (x) #endif #define HTOLE16(x) (void) (x) #define HTOLE32(x) (void) (x) #define HTOLE64(x) (void) (x) #define LE16TOH(x) (void) (x) #define LE32TOH(x) (void) (x) #define LE64TOH(x) (void) (x) /* These don't have standard aliases */ #ifndef htobe64 # define htobe64(x) swap64(x) #endif #ifndef be64toh # define be64toh(x) swap64(x) #endif #define HTOBE64(x) (x) = htobe64(x) #define BE64TOH(x) (x) = be64toh(x) /* Define the C99 standard length-specific integer types */ #include <_stdint.h> /* Here are some macros to create integers from a byte array */ /* These are used to get and put integers from/into a uint8_t array */ /* with a specific endianness. This is the most portable way to generate */ /* and read messages to a network or serial device. Each member of a */ /* packet structure must be handled separately. */ /* Non-optimized but portable macros */ #define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1])) #define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) #define be64atoh_x(x,off,shift) (((uint64_t)((x)[off]))<>8), (a)[1]=(uint8_t)(x) #define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \ (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) #define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \ (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \ (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \ (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) #define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \ (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \ (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \ (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) #endif /*__BYTEORDER_H*/ libmtp-1.1.10/src/libusb1-glue.c0000644000175000001440000020446112604206422013231 00000000000000/* * \file libusb1-glue.c * Low-level USB interface glue towards libusb. * * Copyright (C) 2005-2007 Richard A. Low * Copyright (C) 2005-2012 Linus Walleij * Copyright (C) 2006-2012 Marcus Meissner * Copyright (C) 2007 Ted Bullock * Copyright (C) 2008 Chris Bagwell * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Created by Richard Low on 24/12/2005. (as mtp-utils.c) * Modified by Linus Walleij 2006-03-06 * (Notice that Anglo-Saxons use little-endian dates and Swedes * use big-endian dates.) * */ #include "config.h" #include "libmtp.h" #include "libusb-glue.h" #include "device-flags.h" #include "util.h" #include "ptp.h" #include #include #include #include #include #include "ptp-pack.c" /* * Default USB timeout length. This can be overridden as needed * but should start with a reasonable value so most common * requests can be completed. The original value of 4000 was * not long enough for large file transfer. Also, players can * spend a bit of time collecting data. Higher values also * make connecting/disconnecting more reliable. */ #define USB_TIMEOUT_DEFAULT 20000 #define USB_TIMEOUT_LONG 60000 static inline int get_timeout(PTP_USB* ptp_usb) { if (FLAG_LONG_TIMEOUT(ptp_usb)) { return USB_TIMEOUT_LONG; } return USB_TIMEOUT_DEFAULT; } /* USB Feature selector HALT */ #ifndef USB_FEATURE_HALT #define USB_FEATURE_HALT 0x00 #endif /* Internal data types */ struct mtpdevice_list_struct { libusb_device *device; PTPParams *params; PTP_USB *ptp_usb; uint32_t bus_location; struct mtpdevice_list_struct *next; }; typedef struct mtpdevice_list_struct mtpdevice_list_t; static const LIBMTP_device_entry_t mtp_device_table[] = { /* We include an .h file which is shared between us and libgphoto2 */ #include "music-players.h" }; static const int mtp_device_table_size = sizeof(mtp_device_table) / sizeof(LIBMTP_device_entry_t); // Local functions static LIBMTP_error_number_t init_usb(); static void close_usb(PTP_USB* ptp_usb); static int find_interface_and_endpoints(libusb_device *dev, uint8_t *conf, uint8_t *interface, uint8_t *altsetting, int* inep, int* inep_maxpacket, int* outep, int* outep_maxpacket, int* intep); static void clear_stall(PTP_USB* ptp_usb); static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, libusb_device* dev); static short ptp_write_func(unsigned long, PTPDataHandler*, void *data, unsigned long*); static short ptp_read_func (unsigned long, PTPDataHandler*, void *data, unsigned long*, int); static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status); /** * Get a list of the supported USB devices. * * The developers depend on users of this library to constantly * add in to the list of supported devices. What we need is the * device name, USB Vendor ID (VID) and USB Product ID (PID). * put this into a bug ticket at the project homepage, please. * The VID/PID is used to let e.g. udev lift the device to * console userspace access when it's plugged in. * * @param devices a pointer to a pointer that will hold a device * list after the call to this function, if it was * successful. * @param numdevs a pointer to an integer that will hold the number * of devices in the device list if the call was successful. * @return 0 if the list was successfull retrieved, any other * value means failure. */ int LIBMTP_Get_Supported_Devices_List(LIBMTP_device_entry_t ** const devices, int * const numdevs) { *devices = (LIBMTP_device_entry_t *) &mtp_device_table; *numdevs = mtp_device_table_size; return 0; } static LIBMTP_error_number_t init_usb() { static int libusb1_initialized = 0; /* * Some additional libusb debugging please. * We use the same level debug between MTP and USB. */ if (libusb1_initialized) return LIBMTP_ERROR_NONE; if (libusb_init(NULL) < 0) { LIBMTP_ERROR("Libusb1 init failed\n"); return LIBMTP_ERROR_USB_LAYER; } libusb1_initialized = 1; if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) libusb_set_debug(NULL,9); return LIBMTP_ERROR_NONE; } /** * Small recursive function to append a new usb_device to the linked * list of USB MTP devices * @param devlist dynamic linked list of pointers to usb devices with * MTP properties, to be extended with new device. * @param newdevice the new device to add. * @param bus_location bus for this device. * @return an extended array or NULL on failure. */ static mtpdevice_list_t *append_to_mtpdevice_list(mtpdevice_list_t *devlist, libusb_device *newdevice, uint32_t bus_location) { mtpdevice_list_t *new_list_entry; new_list_entry = (mtpdevice_list_t *) malloc(sizeof(mtpdevice_list_t)); if (new_list_entry == NULL) { return NULL; } // Fill in USB device, if we *HAVE* to make a copy of the device do it here. new_list_entry->device = newdevice; new_list_entry->bus_location = bus_location; new_list_entry->next = NULL; if (devlist == NULL) { return new_list_entry; } else { mtpdevice_list_t *tmp = devlist; while (tmp->next != NULL) { tmp = tmp->next; } tmp->next = new_list_entry; } return devlist; } /** * Small recursive function to free dynamic memory allocated to the linked list * of USB MTP devices * @param devlist dynamic linked list of pointers to usb devices with MTP * properties. * @return nothing */ static void free_mtpdevice_list(mtpdevice_list_t *devlist) { mtpdevice_list_t *tmplist = devlist; if (devlist == NULL) return; while (tmplist != NULL) { mtpdevice_list_t *tmp = tmplist; tmplist = tmplist->next; // Do not free() the fields (ptp_usb, params)! These are used elsewhere. free(tmp); } return; } /** * This checks if a device has an MTP descriptor. The descriptor was * elaborated about in gPhoto bug 1482084, and some official documentation * with no strings attached was published by Microsoft at * http://www.microsoft.com/whdc/system/bus/USB/USBFAQ_intermed.mspx#E3HAC * * @param dev a device struct from libusb. * @param dumpfile set to non-NULL to make the descriptors dump out * to this file in human-readable hex so we can scruitinze them. * @return 1 if the device is MTP compliant, 0 if not. */ static int probe_device_descriptor(libusb_device *dev, FILE *dumpfile) { libusb_device_handle *devh; unsigned char buf[1024], cmd; int i; int ret; /* This is to indicate if we find some vendor interface */ int found_vendor_spec_interface = 0; struct libusb_device_descriptor desc; ret = libusb_get_device_descriptor (dev, &desc); if (ret != LIBUSB_SUCCESS) return 0; /* * Don't examine devices that are not likely to * contain any MTP interface, update this the day * you find some weird combination... */ if (!(desc.bDeviceClass == LIBUSB_CLASS_PER_INTERFACE || desc.bDeviceClass == LIBUSB_CLASS_COMM || desc.bDeviceClass == LIBUSB_CLASS_PTP || desc.bDeviceClass == 0xEF || /* Intf. Association Desc.*/ desc.bDeviceClass == LIBUSB_CLASS_VENDOR_SPEC)) { return 0; } /* * Attempt to open Device on this port * * TODO: is there a way to check the number of endpoints etc WITHOUT * opening the device? Some color calibration devices are REALLY * sensitive to this, and I found a Canon custom scanner that doesn't * like it at all either :-( */ ret = libusb_open(dev, &devh); if (ret != LIBUSB_SUCCESS) { /* Could not open this device */ return 0; } /* * Loop over the device configurations and interfaces. Nokia MTP-capable * handsets (possibly others) typically have the string "MTP" in their * MTP interface descriptions, that's how they can be detected, before * we try the more esoteric "OS descriptors" (below). */ for (i = 0; i < desc.bNumConfigurations; i++) { uint8_t j; struct libusb_config_descriptor *config; ret = libusb_get_config_descriptor (dev, i, &config); if (ret != LIBUSB_SUCCESS) { LIBMTP_INFO("configdescriptor %d get failed with ret %d in probe_device_descriptor yet dev->descriptor.bNumConfigurations > 0\n", i, ret); continue; } for (j = 0; j < config->bNumInterfaces; j++) { int k; for (k = 0; k < config->interface[j].num_altsetting; k++) { /* Current interface descriptor */ const struct libusb_interface_descriptor *intf = &config->interface[j].altsetting[k]; /* * MTP interfaces have three endpoints, two bulk and one * interrupt. Don't probe anything else. */ if (intf->bNumEndpoints != 3) continue; /* * We only want to probe for the OS descriptor if the * device is LIBUSB_CLASS_VENDOR_SPEC or one of the interfaces * in it is, so flag if we find an interface like this. */ if (intf->bInterfaceClass == LIBUSB_CLASS_VENDOR_SPEC) { found_vendor_spec_interface = 1; } /* * TODO: Check for Still Image Capture class with PIMA 15740 * protocol, also known as PTP */ #if 0 if (intf->bInterfaceClass == LIBUSB_CLASS_PTP && intf->bInterfaceSubClass == 0x01 && intf->bInterfaceProtocol == 0x01) { if (dumpfile != NULL) { fprintf(dumpfile, "Configuration %d, interface %d, altsetting %d:\n", i, j, k); fprintf(dumpfile, " Found PTP device, check vendor " "extension...\n"); } /* * This is where we may insert code to open a PTP * session and query the vendor extension ID to see * if it is 0xffffffff, i.e. MTP according to the spec. */ if (was_mtp_extension) { libusb_close(devh); return 1; } } #endif /* * Next we search for the MTP substring in the interface name. * For example : "RIM MS/MTP" should work. */ buf[0] = '\0'; ret = libusb_get_string_descriptor_ascii(devh, config->interface[j].altsetting[k].iInterface, buf, 1024); if (ret < 3) continue; if (strstr((char *) buf, "MTP") != NULL) { if (dumpfile != NULL) { fprintf(dumpfile, "Configuration %d, interface %d, altsetting %d:\n", i, j, k); fprintf(dumpfile, " Interface description contains the string \"MTP\"\n"); fprintf(dumpfile, " Device recognized as MTP, no further probing.\n"); } libusb_free_config_descriptor(config); libusb_close(devh); return 1; } if (libusb_kernel_driver_active(devh, config->interface[j].altsetting[k].iInterface)) { /* * Specifically avoid probing anything else than USB mass storage devices * and non-associated drivers in Linux. */ if (config->interface[j].altsetting[k].bInterfaceClass != LIBUSB_CLASS_MASS_STORAGE) { LIBMTP_INFO("avoid probing device using attached kernel interface\n"); libusb_free_config_descriptor(config); libusb_close(devh); return 0; } } } } libusb_free_config_descriptor(config); } /* * Only probe for OS descriptor if the device is vendor specific * or one of the interfaces found is. */ if (desc.bDeviceClass == LIBUSB_CLASS_VENDOR_SPEC || found_vendor_spec_interface) { /* Read the special descriptor */ ret = libusb_get_descriptor(devh, 0x03, 0xee, buf, sizeof(buf)); /* * If something failed we're probably stalled to we need * to clear the stall off the endpoint and say this is not * MTP. */ if (ret < 0) { /* EP0 is the default control endpoint */ libusb_clear_halt (devh, 0); libusb_close(devh); return 0; } // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device descriptor 0xee:\n"); data_dump_ascii(dumpfile, buf, ret, 16); } /* Check if descriptor length is at least 10 bytes */ if (ret < 10) { libusb_close(devh); return 0; } /* Check if this device has a Microsoft Descriptor */ if (!((buf[2] == 'M') && (buf[4] == 'S') && (buf[6] == 'F') && (buf[8] == 'T'))) { libusb_close(devh); return 0; } /* Check if device responds to control message 1 or if there is an error */ cmd = buf[16]; ret = libusb_control_transfer (devh, LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE | LIBUSB_REQUEST_TYPE_VENDOR, cmd, 0, 4, buf, sizeof(buf), USB_TIMEOUT_DEFAULT); // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device response to control message 1, CMD 0x%02x:\n", cmd); data_dump_ascii(dumpfile, buf, ret, 16); } /* If this is true, the device either isn't MTP or there was an error */ if (ret <= 0x15) { /* TODO: If there was an error, flag it and let the user know somehow */ /* if(ret == -1) {} */ libusb_close(devh); return 0; } /* Check if device is MTP or if it is something like a USB Mass Storage device with Janus DRM support */ if ((buf[0x12] != 'M') || (buf[0x13] != 'T') || (buf[0x14] != 'P')) { libusb_close(devh); return 0; } /* After this point we are probably dealing with an MTP device */ /* * Check if device responds to control message 2, which is * the extended device parameters. Most devices will just * respond with a copy of the same message as for the first * message, some respond with zero-length (which is OK) * and some with pure garbage. We're not parsing the result * so this is not very important. */ ret = libusb_control_transfer (devh, LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_DEVICE | LIBUSB_REQUEST_TYPE_VENDOR, cmd, 0, 5, buf, sizeof(buf), USB_TIMEOUT_DEFAULT); // Dump it, if requested if (dumpfile != NULL && ret > 0) { fprintf(dumpfile, "Microsoft device response to control message 2, CMD 0x%02x:\n", cmd); data_dump_ascii(dumpfile, buf, ret, 16); } /* If this is true, the device errored against control message 2 */ if (ret == -1) { /* TODO: Implement callback function to let managing program know there was a problem, along with description of the problem */ LIBMTP_ERROR("Potential MTP Device with VendorID:%04x and " "ProductID:%04x encountered an error responding to " "control message 2.\n" "Problems may arrise but continuing\n", desc.idVendor, desc.idProduct); } else if (dumpfile != NULL && ret == 0) { fprintf(dumpfile, "Zero-length response to control message 2 (OK)\n"); } else if (dumpfile != NULL) { fprintf(dumpfile, "Device responds to control message 2 with some data.\n"); } /* Close the USB device handle */ libusb_close(devh); return 1; } /* Close the USB device handle */ libusb_close(devh); return 0; } /** * This function scans through the connected usb devices on a machine and * if they match known Vendor and Product identifiers appends them to the * dynamic array mtp_device_list. Be sure to call * free_mtpdevice_list(mtp_device_list) when you are done * with it, assuming it is not NULL. * @param mtp_device_list dynamic array of pointers to usb devices with MTP * properties (if this list is not empty, new entries will be appended * to the list). * @return LIBMTP_ERROR_NONE implies that devices have been found, scan the list * appropriately. LIBMTP_ERROR_NO_DEVICE_ATTACHED implies that no * devices have been found. */ static LIBMTP_error_number_t get_mtp_usb_device_list(mtpdevice_list_t ** mtp_device_list) { ssize_t nrofdevs; libusb_device **devs = NULL; int ret, i; LIBMTP_error_number_t init_usb_ret; init_usb_ret = init_usb(); if (init_usb_ret != LIBMTP_ERROR_NONE) return init_usb_ret; nrofdevs = libusb_get_device_list (NULL, &devs); for (i = 0; i < nrofdevs ; i++) { libusb_device *dev = devs[i]; struct libusb_device_descriptor desc; ret = libusb_get_device_descriptor(dev, &desc); if (ret != LIBUSB_SUCCESS) continue; if (desc.bDeviceClass != LIBUSB_CLASS_HUB) { int i; int found = 0; // First check if we know about the device already. // Devices well known to us will not have their descriptors // probed, it caused problems with some devices. for(i = 0; i < mtp_device_table_size; i++) { if(desc.idVendor == mtp_device_table[i].vendor_id && desc.idProduct == mtp_device_table[i].product_id) { /* Append this usb device to the MTP device list */ *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, libusb_get_bus_number(dev)); found = 1; break; } } // If we didn't know it, try probing the "OS Descriptor". if (!found) { if (probe_device_descriptor(dev, NULL)) { /* Append this usb device to the MTP USB Device List */ *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, libusb_get_bus_number(dev)); } /* * By thomas_-_s: Also append devices that are no MTP but PTP devices * if this is commented out. */ /* else { // Check whether the device is no USB hub but a PTP. if ( dev->config != NULL &&dev->config->interface->altsetting->bInterfaceClass == LIBUSB_CLASS_PTP && dev->descriptor.bDeviceClass != LIBUSB_CLASS_HUB ) { *mtp_device_list = append_to_mtpdevice_list(*mtp_device_list, dev, bus->location); } } */ } } } libusb_free_device_list (devs, 0); /* If nothing was found we end up here. */ if(*mtp_device_list == NULL) { return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } return LIBMTP_ERROR_NONE; } /** * Checks if a specific device with a certain bus and device * number has an MTP type device descriptor. * * @param busno the bus number of the device to check * @param deviceno the device number of the device to check * @return 1 if the device is MTP else 0 */ int LIBMTP_Check_Specific_Device(int busno, int devno) { ssize_t nrofdevs; libusb_device **devs = NULL; int i; LIBMTP_error_number_t init_usb_ret; init_usb_ret = init_usb(); if (init_usb_ret != LIBMTP_ERROR_NONE) return 0; nrofdevs = libusb_get_device_list (NULL, &devs); for (i = 0; i < nrofdevs ; i++ ) { if (libusb_get_bus_number(devs[i]) != busno) continue; if (libusb_get_device_address(devs[i]) != devno) continue; if (probe_device_descriptor(devs[i], NULL)) return 1; } return 0; } /** * Detect the raw MTP device descriptors and return a list of * of the devices found. * * @param devices a pointer to a variable that will hold * the list of raw devices found. This may be NULL * on return if the number of detected devices is zero. * The user shall simply free() this * variable when finished with the raw devices, * in order to release memory. * @param numdevs a pointer to an integer that will hold * the number of devices in the list. This may * be 0. * @return 0 if successful, any other value means failure. */ LIBMTP_error_number_t LIBMTP_Detect_Raw_Devices(LIBMTP_raw_device_t ** devices, int * numdevs) { mtpdevice_list_t *devlist = NULL; mtpdevice_list_t *dev; LIBMTP_error_number_t ret; LIBMTP_raw_device_t *retdevs; int devs = 0; int i, j; ret = get_mtp_usb_device_list(&devlist); if (ret == LIBMTP_ERROR_NO_DEVICE_ATTACHED) { *devices = NULL; *numdevs = 0; return ret; } else if (ret != LIBMTP_ERROR_NONE) { LIBMTP_ERROR("LIBMTP PANIC: get_mtp_usb_device_list() " "error code: %d on line %d\n", ret, __LINE__); return ret; } // Get list size dev = devlist; while (dev != NULL) { devs++; dev = dev->next; } if (devs == 0) { *devices = NULL; *numdevs = 0; return LIBMTP_ERROR_NONE; } // Conjure a device list retdevs = (LIBMTP_raw_device_t *) malloc(sizeof(LIBMTP_raw_device_t) * devs); if (retdevs == NULL) { // Out of memory *devices = NULL; *numdevs = 0; return LIBMTP_ERROR_MEMORY_ALLOCATION; } dev = devlist; i = 0; while (dev != NULL) { int device_known = 0; struct libusb_device_descriptor desc; libusb_get_device_descriptor (dev->device, &desc); // Assign default device info retdevs[i].device_entry.vendor = NULL; retdevs[i].device_entry.vendor_id = desc.idVendor; retdevs[i].device_entry.product = NULL; retdevs[i].device_entry.product_id = desc.idProduct; retdevs[i].device_entry.device_flags = 0x00000000U; // See if we can locate some additional vendor info and device flags for(j = 0; j < mtp_device_table_size; j++) { if(desc.idVendor == mtp_device_table[j].vendor_id && desc.idProduct == mtp_device_table[j].product_id) { device_known = 1; retdevs[i].device_entry.vendor = mtp_device_table[j].vendor; retdevs[i].device_entry.product = mtp_device_table[j].product; retdevs[i].device_entry.device_flags = mtp_device_table[j].device_flags; // This device is known to the developers LIBMTP_ERROR("Device %d (VID=%04x and PID=%04x) is a %s %s.\n", i, desc.idVendor, desc.idProduct, mtp_device_table[j].vendor, mtp_device_table[j].product); break; } } if (!device_known) { device_unknown(i, desc.idVendor, desc.idProduct); } // Save the location on the bus retdevs[i].bus_location = libusb_get_bus_number (dev->device); retdevs[i].devnum = libusb_get_device_address (dev->device); i++; dev = dev->next; } *devices = retdevs; *numdevs = i; free_mtpdevice_list(devlist); return LIBMTP_ERROR_NONE; } /** * This routine just dumps out low-level * USB information about the current device. * @param ptp_usb the USB device to get information from. */ void dump_usbinfo(PTP_USB *ptp_usb) { libusb_device *dev; struct libusb_device_descriptor desc; if (libusb_kernel_driver_active(ptp_usb->handle, ptp_usb->interface)) LIBMTP_INFO(" Interface has a kernel driver attached.\n"); dev = libusb_get_device (ptp_usb->handle); libusb_get_device_descriptor (dev, &desc); LIBMTP_INFO(" bcdUSB: %d\n", desc.bcdUSB); LIBMTP_INFO(" bDeviceClass: %d\n", desc.bDeviceClass); LIBMTP_INFO(" bDeviceSubClass: %d\n", desc.bDeviceSubClass); LIBMTP_INFO(" bDeviceProtocol: %d\n", desc.bDeviceProtocol); LIBMTP_INFO(" idVendor: %04x\n", desc.idVendor); LIBMTP_INFO(" idProduct: %04x\n", desc.idProduct); LIBMTP_INFO(" IN endpoint maxpacket: %d bytes\n", ptp_usb->inep_maxpacket); LIBMTP_INFO(" OUT endpoint maxpacket: %d bytes\n", ptp_usb->outep_maxpacket); LIBMTP_INFO(" Raw device info:\n"); LIBMTP_INFO(" Bus location: %d\n", ptp_usb->rawdevice.bus_location); LIBMTP_INFO(" Device number: %d\n", ptp_usb->rawdevice.devnum); LIBMTP_INFO(" Device entry info:\n"); LIBMTP_INFO(" Vendor: %s\n", ptp_usb->rawdevice.device_entry.vendor); LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.vendor_id); LIBMTP_INFO(" Product: %s\n", ptp_usb->rawdevice.device_entry.product); LIBMTP_INFO(" Vendor id: 0x%04x\n", ptp_usb->rawdevice.device_entry.product_id); LIBMTP_INFO(" Device flags: 0x%08x\n", ptp_usb->rawdevice.device_entry.device_flags); (void) probe_device_descriptor(dev, stdout); } /** * Retrieve the apropriate playlist extension for this * device. Rather hacky at the moment. This is probably * desired by the managing software, but when creating * lists on the device itself you notice certain preferences. * @param ptp_usb the USB device to get suggestion for. * @return the suggested playlist extension. */ const char *get_playlist_extension(PTP_USB *ptp_usb) { libusb_device *dev; struct libusb_device_descriptor desc; static char creative_pl_extension[] = ".zpl"; static char default_pl_extension[] = ".pla"; dev = libusb_get_device(ptp_usb->handle); libusb_get_device_descriptor (dev, &desc); if (desc.idVendor == 0x041e) return creative_pl_extension; return default_pl_extension; } static void libusb_glue_debug (PTPParams *params, const char *format, ...) { va_list args; va_start (args, format); if (params->debug_func!=NULL) params->debug_func (params->data, format, args); else { vfprintf (stderr, format, args); fprintf (stderr,"\n"); fflush (stderr); } va_end (args); } static void libusb_glue_error (PTPParams *params, const char *format, ...) { va_list args; va_start (args, format); if (params->error_func!=NULL) params->error_func (params->data, format, args); else { vfprintf (stderr, format, args); fprintf (stderr,"\n"); fflush (stderr); } va_end (args); } /* * ptp_read_func() and ptp_write_func() are * based on same functions usb.c in libgphoto2. * Much reading packet logs and having fun with trials and errors * reveals that WMP / Windows is probably using an algorithm like this * for large transfers: * * 1. Send the command (0x0c bytes) if headers are split, else, send * command plus sizeof(endpoint) - 0x0c bytes. * 2. Send first packet, max size to be sizeof(endpoint) but only when using * split headers. Else goto 3. * 3. REPEAT send 0x10000 byte chunks UNTIL remaining bytes < 0x10000 * We call 0x10000 CONTEXT_BLOCK_SIZE. * 4. Send remaining bytes MOD sizeof(endpoint) * 5. Send remaining bytes. If this happens to be exactly sizeof(endpoint) * then also send a zero-length package. * * Further there is some special quirks to handle zero reads from the * device, since some devices can't do them at all due to shortcomings * of the USB slave controller in the device. */ #define CONTEXT_BLOCK_SIZE_1 0x3e00 #define CONTEXT_BLOCK_SIZE_2 0x200 #define CONTEXT_BLOCK_SIZE CONTEXT_BLOCK_SIZE_1+CONTEXT_BLOCK_SIZE_2 static short ptp_read_func ( unsigned long size, PTPDataHandler *handler,void *data, unsigned long *readbytes, int readzero ) { PTP_USB *ptp_usb = (PTP_USB *)data; unsigned long toread = 0; int ret = 0; int xread; unsigned long curread = 0; unsigned long written; unsigned char *bytes; int expect_terminator_byte = 0; unsigned long usb_inep_maxpacket_size; unsigned long context_block_size_1; unsigned long context_block_size_2; uint16_t ptp_dev_vendor_id = ptp_usb->rawdevice.device_entry.vendor_id; //"iRiver" device special handling if (ptp_dev_vendor_id == 0x4102 || ptp_dev_vendor_id == 0x1006) { usb_inep_maxpacket_size = ptp_usb->inep_maxpacket; if (usb_inep_maxpacket_size == 0x400) { context_block_size_1 = CONTEXT_BLOCK_SIZE_1 - 0x200; context_block_size_2 = CONTEXT_BLOCK_SIZE_2 + 0x200; } else { context_block_size_1 = CONTEXT_BLOCK_SIZE_1; context_block_size_2 = CONTEXT_BLOCK_SIZE_2; } } // This is the largest block we'll need to read in. bytes = malloc(CONTEXT_BLOCK_SIZE); while (curread < size) { LIBMTP_USB_DEBUG("Remaining size to read: 0x%04lx bytes\n", size - curread); // check equal to condition here if (size - curread < CONTEXT_BLOCK_SIZE) { // this is the last packet toread = size - curread; // this is equivalent to zero read for these devices if (readzero && FLAG_NO_ZERO_READS(ptp_usb) && toread % 64 == 0) { toread += 1; expect_terminator_byte = 1; } } else if (ptp_dev_vendor_id == 0x4102 || ptp_dev_vendor_id == 0x1006) { //"iRiver" device special handling if (curread == 0) // we are first packet, but not last packet toread = context_block_size_1; else if (toread == context_block_size_1) toread = context_block_size_2; else if (toread == context_block_size_2) toread = context_block_size_1; else LIBMTP_INFO("unexpected toread size 0x%04x, 0x%04x remaining bytes\n", (unsigned int) toread, (unsigned int) (size-curread)); } else toread = CONTEXT_BLOCK_SIZE; LIBMTP_USB_DEBUG("Reading in 0x%04lx bytes\n", toread); ret = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, bytes, toread, &xread, ptp_usb->timeout); LIBMTP_USB_DEBUG("Result of read: 0x%04x (%d bytes)\n", ret, xread); if (ret != LIBUSB_SUCCESS) return PTP_ERROR_IO; LIBMTP_USB_DEBUG("<==USB IN\n"); if (xread == 0) LIBMTP_USB_DEBUG("Zero Read\n"); else LIBMTP_USB_DATA(bytes, xread, 16); // want to discard extra byte if (expect_terminator_byte && xread == toread) { LIBMTP_USB_DEBUG("<==USB IN\nDiscarding extra byte\n"); xread--; } int putfunc_ret = handler->putfunc(NULL, handler->priv, xread, bytes, &written); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; ptp_usb->current_transfer_complete += xread; curread += xread; // Increase counters, call callback if (ptp_usb->callback_active) { if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { // send last update and disable callback. ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; ptp_usb->callback_active = 0; } if (ptp_usb->current_transfer_callback != NULL) { int ret; ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, ptp_usb->current_transfer_total, ptp_usb->current_transfer_callback_data); if (ret != 0) { return PTP_ERROR_CANCEL; } } } if (xread < toread) /* short reads are common */ break; } if (readbytes) *readbytes = curread; free (bytes); // there might be a zero packet waiting for us... if (readzero && !FLAG_NO_ZERO_READS(ptp_usb) && curread % ptp_usb->outep_maxpacket == 0) { unsigned char temp; int zeroresult = 0, xread; LIBMTP_USB_DEBUG("<==USB IN\n"); LIBMTP_USB_DEBUG("Zero Read\n"); zeroresult = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &temp, 0, &xread, ptp_usb->timeout); if (zeroresult != LIBUSB_SUCCESS) LIBMTP_INFO("LIBMTP panic: unable to read in zero packet, response 0x%04x", zeroresult); } return PTP_RC_OK; } static short ptp_write_func ( unsigned long size, PTPDataHandler *handler, void *data, unsigned long *written ) { PTP_USB *ptp_usb = (PTP_USB *)data; unsigned long towrite = 0; int ret = 0; unsigned long curwrite = 0; unsigned char *bytes; // This is the largest block we'll need to read in. bytes = malloc(CONTEXT_BLOCK_SIZE); if (!bytes) { return PTP_ERROR_IO; } while (curwrite < size) { unsigned long usbwritten = 0; int xwritten = 0; towrite = size-curwrite; if (towrite > CONTEXT_BLOCK_SIZE) { towrite = CONTEXT_BLOCK_SIZE; } else { // This magic makes packets the same size that WMP send them. if (towrite > ptp_usb->outep_maxpacket && towrite % ptp_usb->outep_maxpacket != 0) { towrite -= towrite % ptp_usb->outep_maxpacket; } } int getfunc_ret = handler->getfunc(NULL, handler->priv,towrite,bytes,&towrite); if (getfunc_ret != PTP_RC_OK) { free(bytes); return getfunc_ret; } while (usbwritten < towrite) { ret = USB_BULK_WRITE(ptp_usb->handle, ptp_usb->outep, bytes+usbwritten, towrite-usbwritten, &xwritten, ptp_usb->timeout); LIBMTP_USB_DEBUG("USB OUT==>\n"); if (ret != LIBUSB_SUCCESS) { free(bytes); return PTP_ERROR_IO; } LIBMTP_USB_DATA(bytes+usbwritten, xwritten, 16); // check for result == 0 perhaps too. // Increase counters ptp_usb->current_transfer_complete += xwritten; curwrite += xwritten; usbwritten += xwritten; } // call callback if (ptp_usb->callback_active) { if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { // send last update and disable callback. ptp_usb->current_transfer_complete = ptp_usb->current_transfer_total; ptp_usb->callback_active = 0; } if (ptp_usb->current_transfer_callback != NULL) { int ret; ret = ptp_usb->current_transfer_callback(ptp_usb->current_transfer_complete, ptp_usb->current_transfer_total, ptp_usb->current_transfer_callback_data); if (ret != 0) { free(bytes); return PTP_ERROR_CANCEL; } } } if (xwritten < towrite) /* short writes happen */ break; } free (bytes); if (written) { *written = curwrite; } // If this is the last transfer send a zero write if required if (ptp_usb->current_transfer_complete >= ptp_usb->current_transfer_total) { if ((towrite % ptp_usb->outep_maxpacket) == 0) { int xwritten; LIBMTP_USB_DEBUG("USB OUT==>\n"); LIBMTP_USB_DEBUG("Zero Write\n"); ret =USB_BULK_WRITE(ptp_usb->handle, ptp_usb->outep, (unsigned char *) "x", 0, &xwritten, ptp_usb->timeout); } } if (ret != LIBUSB_SUCCESS) return PTP_ERROR_IO; return PTP_RC_OK; } /* memory data get/put handler */ typedef struct { unsigned char *data; unsigned long size, curoff; } PTPMemHandlerPrivate; static uint16_t memory_getfunc(PTPParams* params, void* private, unsigned long wantlen, unsigned char *data, unsigned long *gotlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)private; unsigned long tocopy = wantlen; if (priv->curoff + tocopy > priv->size) tocopy = priv->size - priv->curoff; memcpy (data, priv->data + priv->curoff, tocopy); priv->curoff += tocopy; *gotlen = tocopy; return PTP_RC_OK; } static uint16_t memory_putfunc(PTPParams* params, void* private, unsigned long sendlen, unsigned char *data, unsigned long *putlen ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)private; if (priv->curoff + sendlen > priv->size) { priv->data = realloc (priv->data, priv->curoff+sendlen); priv->size = priv->curoff + sendlen; } memcpy (priv->data + priv->curoff, data, sendlen); priv->curoff += sendlen; *putlen = sendlen; return PTP_RC_OK; } /* init private struct for receiving data. */ static uint16_t ptp_init_recv_memory_handler(PTPDataHandler *handler) { PTPMemHandlerPrivate* priv; priv = malloc (sizeof(PTPMemHandlerPrivate)); handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = NULL; priv->size = 0; priv->curoff = 0; return PTP_RC_OK; } /* init private struct and put data in for sending data. * data is still owned by caller. */ static uint16_t ptp_init_send_memory_handler(PTPDataHandler *handler, unsigned char *data, unsigned long len ) { PTPMemHandlerPrivate* priv; priv = malloc (sizeof(PTPMemHandlerPrivate)); if (!priv) return PTP_RC_GeneralError; handler->priv = priv; handler->getfunc = memory_getfunc; handler->putfunc = memory_putfunc; priv->data = data; priv->size = len; priv->curoff = 0; return PTP_RC_OK; } /* free private struct + data */ static uint16_t ptp_exit_send_memory_handler (PTPDataHandler *handler) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)handler->priv; /* data is owned by caller */ free (priv); return PTP_RC_OK; } /* hand over our internal data to caller */ static uint16_t ptp_exit_recv_memory_handler (PTPDataHandler *handler, unsigned char **data, unsigned long *size ) { PTPMemHandlerPrivate* priv = (PTPMemHandlerPrivate*)handler->priv; *data = priv->data; *size = priv->size; free (priv); return PTP_RC_OK; } /* send / receive functions */ uint16_t ptp_usb_sendreq (PTPParams* params, PTPContainer* req) { uint16_t ret; PTPUSBBulkContainer usbreq; PTPDataHandler memhandler; unsigned long written = 0; unsigned long towrite; char txt[256]; (void) ptp_render_opcode (params, req->Code, sizeof(txt), txt); LIBMTP_USB_DEBUG("REQUEST: 0x%04x, %s\n", req->Code, txt); /* build appropriate USB container */ usbreq.length=htod32(PTP_USB_BULK_REQ_LEN- (sizeof(uint32_t)*(5-req->Nparam))); usbreq.type=htod16(PTP_USB_CONTAINER_COMMAND); usbreq.code=htod16(req->Code); usbreq.trans_id=htod32(req->Transaction_ID); usbreq.payload.params.param1=htod32(req->Param1); usbreq.payload.params.param2=htod32(req->Param2); usbreq.payload.params.param3=htod32(req->Param3); usbreq.payload.params.param4=htod32(req->Param4); usbreq.payload.params.param5=htod32(req->Param5); /* send it to responder */ towrite = PTP_USB_BULK_REQ_LEN-(sizeof(uint32_t)*(5-req->Nparam)); ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, towrite); ret=ptp_write_func( towrite, &memhandler, params->data, &written ); ptp_exit_send_memory_handler (&memhandler); if (ret != PTP_RC_OK && ret != PTP_ERROR_CANCEL) { ret = PTP_ERROR_IO; } if (written != towrite && ret != PTP_ERROR_CANCEL && ret != PTP_ERROR_IO) { libusb_glue_error (params, "PTP: request code 0x%04x sending req wrote only %ld bytes instead of %d", req->Code, written, towrite ); ret = PTP_ERROR_IO; } return ret; } uint16_t ptp_usb_senddata (PTPParams* params, PTPContainer* ptp, uint64_t size, PTPDataHandler *handler ) { uint16_t ret; int wlen, datawlen; unsigned long written; PTPUSBBulkContainer usbdata; uint64_t bytes_left_to_transfer; PTPDataHandler memhandler; LIBMTP_USB_DEBUG("SEND DATA PHASE\n"); /* build appropriate USB container */ usbdata.length = htod32(PTP_USB_BULK_HDR_LEN+size); usbdata.type = htod16(PTP_USB_CONTAINER_DATA); usbdata.code = htod16(ptp->Code); usbdata.trans_id= htod32(ptp->Transaction_ID); ((PTP_USB*)params->data)->current_transfer_complete = 0; ((PTP_USB*)params->data)->current_transfer_total = size+PTP_USB_BULK_HDR_LEN; if (params->split_header_data) { datawlen = 0; wlen = PTP_USB_BULK_HDR_LEN; } else { unsigned long gotlen; /* For all camera devices. */ datawlen = (sizegetfunc(params, handler->priv, datawlen, usbdata.payload.data, &gotlen); if (ret != PTP_RC_OK) return ret; if (gotlen != datawlen) return PTP_RC_GeneralError; } ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, wlen); /* send first part of data */ ret = ptp_write_func(wlen, &memhandler, params->data, &written); ptp_exit_send_memory_handler (&memhandler); if (ret != PTP_RC_OK) { return ret; } if (size <= datawlen) return ret; /* if everything OK send the rest */ bytes_left_to_transfer = size-datawlen; ret = PTP_RC_OK; while(bytes_left_to_transfer > 0) { ret = ptp_write_func (bytes_left_to_transfer, handler, params->data, &written); if (ret != PTP_RC_OK) break; if (written == 0) { ret = PTP_ERROR_IO; break; } bytes_left_to_transfer -= written; } if (ret != PTP_RC_OK && ret != PTP_ERROR_CANCEL) ret = PTP_ERROR_IO; return ret; } static uint16_t ptp_usb_getpacket(PTPParams *params, PTPUSBBulkContainer *packet, unsigned long *rlen) { PTPDataHandler memhandler; uint16_t ret; unsigned char *x = NULL; unsigned long packet_size; PTP_USB *ptp_usb = (PTP_USB *) params->data; packet_size = ptp_usb->inep_maxpacket; /* read the header and potentially the first data */ if (params->response_packet_size > 0) { /* If there is a buffered packet, just use it. */ memcpy(packet, params->response_packet, params->response_packet_size); *rlen = params->response_packet_size; free(params->response_packet); params->response_packet = NULL; params->response_packet_size = 0; /* Here this signifies a "virtual read" */ return PTP_RC_OK; } ptp_init_recv_memory_handler (&memhandler); ret = ptp_read_func(packet_size, &memhandler, params->data, rlen, 0); ptp_exit_recv_memory_handler (&memhandler, &x, rlen); if (x) { memcpy (packet, x, *rlen); free (x); } return ret; } uint16_t ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler) { uint16_t ret; PTPUSBBulkContainer usbdata; unsigned long written; PTP_USB *ptp_usb = (PTP_USB *) params->data; int putfunc_ret; LIBMTP_USB_DEBUG("GET DATA PHASE\n"); memset(&usbdata,0,sizeof(usbdata)); do { unsigned long len, rlen; ret = ptp_usb_getpacket(params, &usbdata, &rlen); if (ret != PTP_RC_OK) { ret = PTP_ERROR_IO; break; } if (dtoh16(usbdata.type)!=PTP_USB_CONTAINER_DATA) { ret = PTP_ERROR_DATA_EXPECTED; break; } if (dtoh16(usbdata.code)!=ptp->Code) { if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { libusb_glue_debug (params, "ptp2/ptp_usb_getdata: detected a broken " "PTP header, code field insane, expect problems! (But continuing)"); // Repair the header, so it won't wreak more havoc, don't just ignore it. // Typically these two fields will be broken. usbdata.code = htod16(ptp->Code); usbdata.trans_id = htod32(ptp->Transaction_ID); ret = PTP_RC_OK; } else { ret = dtoh16(usbdata.code); // This filters entirely insane garbage return codes, but still // makes it possible to return error codes in the code field when // getting data. It appears Windows ignores the contents of this // field entirely. if (ret < PTP_RC_Undefined || ret > PTP_RC_SpecificationOfDestinationUnsupported) { libusb_glue_debug (params, "ptp2/ptp_usb_getdata: detected a broken " "PTP header, code field insane."); ret = PTP_ERROR_IO; } break; } } if (rlen == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ) { /* Copy first part of data to 'data' */ putfunc_ret = handler->putfunc( params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data, &written ); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; /* stuff data directly to passed data handler */ while (1) { unsigned long readdata; uint16_t xret; xret = ptp_read_func( 0x20000000, handler, params->data, &readdata, 0 ); if (xret != PTP_RC_OK) return xret; if (readdata < 0x20000000) break; } return PTP_RC_OK; } if (rlen > dtoh32(usbdata.length)) { /* * Buffer the surplus response packet if it is >= * PTP_USB_BULK_HDR_LEN * (i.e. it is probably an entire package) * else discard it as erroneous surplus data. * This will even work if more than 2 packets appear * in the same transaction, they will just be handled * iteratively. * * Marcus observed stray bytes on iRiver devices; * these are still discarded. */ unsigned int packlen = dtoh32(usbdata.length); unsigned int surplen = rlen - packlen; if (surplen >= PTP_USB_BULK_HDR_LEN) { params->response_packet = malloc(surplen); memcpy(params->response_packet, (uint8_t *) &usbdata + packlen, surplen); params->response_packet_size = surplen; /* Ignore reading one extra byte if device flags have been set */ } else if(!FLAG_NO_ZERO_READS(ptp_usb) && (rlen - dtoh32(usbdata.length) == 1)) { libusb_glue_debug (params, "ptp2/ptp_usb_getdata: read %d bytes " "too much, expect problems!", rlen - dtoh32(usbdata.length)); } rlen = packlen; } /* For most PTP devices rlen is 512 == sizeof(usbdata) * here. For MTP devices splitting header and data it might * be 12. */ /* Evaluate full data length. */ len=dtoh32(usbdata.length)-PTP_USB_BULK_HDR_LEN; /* autodetect split header/data MTP devices */ if (dtoh32(usbdata.length) > 12 && (rlen==12)) params->split_header_data = 1; /* Copy first part of data to 'data' */ putfunc_ret = handler->putfunc( params, handler->priv, rlen - PTP_USB_BULK_HDR_LEN, usbdata.payload.data, &written ); if (putfunc_ret != PTP_RC_OK) return putfunc_ret; if (FLAG_NO_ZERO_READS(ptp_usb) && len+PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ) { LIBMTP_USB_DEBUG("Reading in extra terminating byte\n"); // need to read in extra byte and discard it int result = 0, xread; unsigned char byte = 0; result = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &byte, 1, &xread, ptp_usb->timeout); if (result != 1) LIBMTP_INFO("Could not read in extra byte for PTP_USB_BULK_HS_MAX_PACKET_LEN_READ long file, return value 0x%04x\n", result); } else if (len+PTP_USB_BULK_HDR_LEN == PTP_USB_BULK_HS_MAX_PACKET_LEN_READ && params->split_header_data == 0) { int zeroresult = 0, xread; unsigned char zerobyte = 0; LIBMTP_INFO("Reading in zero packet after header\n"); zeroresult = USB_BULK_READ(ptp_usb->handle, ptp_usb->inep, &zerobyte, 0, &xread, ptp_usb->timeout); if (zeroresult != 0) LIBMTP_INFO("LIBMTP panic: unable to read in zero packet, response 0x%04x", zeroresult); } /* Is that all of data? */ if (len+PTP_USB_BULK_HDR_LEN<=rlen) { break; } ret = ptp_read_func(len - (rlen - PTP_USB_BULK_HDR_LEN), handler, params->data, &rlen, 1); if (ret != PTP_RC_OK) { break; } } while (0); return ret; } uint16_t ptp_usb_getresp (PTPParams* params, PTPContainer* resp) { uint16_t ret; unsigned long rlen; PTPUSBBulkContainer usbresp; PTP_USB *ptp_usb = (PTP_USB *)(params->data); LIBMTP_USB_DEBUG("RESPONSE: "); memset(&usbresp,0,sizeof(usbresp)); /* read response, it should never be longer than sizeof(usbresp) */ ret = ptp_usb_getpacket(params, &usbresp, &rlen); // Fix for bevahiour reported by Scott Snyder on Samsung YP-U3. The player // sends a packet containing just zeroes of length 2 (up to 4 has been seen too) // after a NULL packet when it should send the response. This code ignores // such illegal packets. while (ret==PTP_RC_OK && rlenCode) { ret = dtoh16(usbresp.code); } LIBMTP_USB_DEBUG("%04x\n", ret); if (ret != PTP_RC_OK) { /* libusb_glue_error (params, "PTP: request code 0x%04x getting resp error 0x%04x", resp->Code, ret);*/ return ret; } /* build an appropriate PTPContainer */ resp->Code=dtoh16(usbresp.code); resp->SessionID=params->session_id; resp->Transaction_ID=dtoh32(usbresp.trans_id); if (FLAG_IGNORE_HEADER_ERRORS(ptp_usb)) { if (resp->Transaction_ID != params->transaction_id-1) { libusb_glue_debug (params, "ptp_usb_getresp: detected a broken " "PTP header, transaction ID insane, expect " "problems! (But continuing)"); // Repair the header, so it won't wreak more havoc. resp->Transaction_ID = params->transaction_id-1; } } resp->Param1=dtoh32(usbresp.payload.params.param1); resp->Param2=dtoh32(usbresp.payload.params.param2); resp->Param3=dtoh32(usbresp.payload.params.param3); resp->Param4=dtoh32(usbresp.payload.params.param4); resp->Param5=dtoh32(usbresp.payload.params.param5); return ret; } /* Event handling functions */ /* PTP Events wait for or check mode */ #define PTP_EVENT_CHECK 0x0000 /* waits for */ #define PTP_EVENT_CHECK_FAST 0x0001 /* checks */ static inline uint16_t ptp_usb_event (PTPParams* params, PTPContainer* event, int wait) { uint16_t ret; int result, xread; unsigned long rlen; PTPUSBEventContainer usbevent; PTP_USB *ptp_usb; memset(&usbevent,0,sizeof(usbevent)); if ((params==NULL) || (event==NULL)) return PTP_ERROR_BADPARAM; ptp_usb = (PTP_USB *)(params->data); ret = PTP_RC_OK; switch(wait) { case PTP_EVENT_CHECK: result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof(usbevent), &xread, 0); if (xread == 0) result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof(usbevent), &xread, 0); if (result < 0) ret = PTP_ERROR_IO; break; case PTP_EVENT_CHECK_FAST: result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof(usbevent), &xread, ptp_usb->timeout); if (xread == 0) result = USB_BULK_READ(ptp_usb->handle, ptp_usb->intep, (unsigned char *) &usbevent, sizeof(usbevent), &xread, ptp_usb->timeout); if (result < 0) ret = PTP_ERROR_IO; break; default: ret = PTP_ERROR_BADPARAM; break; } if (ret != PTP_RC_OK) { libusb_glue_error (params, "PTP: reading event an error 0x%04x occurred", ret); return PTP_ERROR_IO; } rlen = xread; if (rlen < 8) { libusb_glue_error (params, "PTP: reading event an short read of %ld bytes occurred", rlen); return PTP_ERROR_IO; } /* if we read anything over interrupt endpoint it must be an event */ /* build an appropriate PTPContainer */ event->Code=dtoh16(usbevent.code); event->SessionID=params->session_id; event->Transaction_ID=dtoh32(usbevent.trans_id); event->Param1=dtoh32(usbevent.param1); event->Param2=dtoh32(usbevent.param2); event->Param3=dtoh32(usbevent.param3); return ret; } uint16_t ptp_usb_event_check (PTPParams* params, PTPContainer* event) { return ptp_usb_event (params, event, PTP_EVENT_CHECK_FAST); } uint16_t ptp_usb_event_wait (PTPParams* params, PTPContainer* event) { return ptp_usb_event (params, event, PTP_EVENT_CHECK); } uint16_t ptp_usb_control_cancel_request (PTPParams *params, uint32_t transactionid) { PTP_USB *ptp_usb = (PTP_USB *)(params->data); int ret; unsigned char buffer[6]; htod16a(&buffer[0],PTP_EC_CancelTransaction); htod32a(&buffer[2],transactionid); ret = libusb_control_transfer(ptp_usb->handle, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE, 0x64, 0x0000, 0x0000, buffer, sizeof(buffer), ptp_usb->timeout); if (ret < sizeof(buffer)) return PTP_ERROR_IO; return PTP_RC_OK; } static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, libusb_device* dev) { libusb_device_handle *device_handle; unsigned char buf[255]; int ret, usbresult; struct libusb_config_descriptor *config; params->sendreq_func=ptp_usb_sendreq; params->senddata_func=ptp_usb_senddata; params->getresp_func=ptp_usb_getresp; params->getdata_func=ptp_usb_getdata; params->cancelreq_func=ptp_usb_control_cancel_request; params->data=ptp_usb; params->transaction_id=0; /* * This is hardcoded here since we have no devices whatsoever that are BE. * Change this the day we run into our first BE device (if ever). */ params->byteorder = PTP_DL_LE; ptp_usb->timeout = get_timeout(ptp_usb); ret = libusb_open(dev, &device_handle); if (ret != LIBUSB_SUCCESS) { perror("libusb_open() failed!"); return -1; } ptp_usb->handle = device_handle; /* * If this device is known to be wrongfully claimed by other kernel * drivers (such as mass storage), then try to unload it to make it * accessible from user space. */ if (FLAG_UNLOAD_DRIVER(ptp_usb) && libusb_kernel_driver_active(device_handle, ptp_usb->interface) ) { if (LIBUSB_SUCCESS != libusb_detach_kernel_driver(device_handle, ptp_usb->interface)) { perror("libusb_detach_kernel_driver() failed, continuing anyway..."); } } /* * Check if the config is set to something else than what we want * to use. Only set the configuration if we absolutely have to. * Also do not bail out if we fail. * * Note that Darwin will not set the configuration for vendor-specific * devices so we need to go in and set it. */ ret = libusb_get_active_config_descriptor(dev, &config); if (ret != LIBUSB_SUCCESS) { perror("libusb_get_active_config_descriptor(1) failed"); fprintf(stderr, "no active configuration, trying to set configuration\n"); if (libusb_set_configuration(device_handle, ptp_usb->config) != LIBUSB_SUCCESS) { perror("libusb_set_configuration() failed, continuing anyway..."); } ret = libusb_get_active_config_descriptor(dev, &config); if (ret != LIBUSB_SUCCESS) { perror("libusb_get_active_config_descriptor(2) failed"); return -1; } } if (config->bConfigurationValue != ptp_usb->config) { fprintf(stderr, "desired configuration different from current, trying to set configuration\n"); if (libusb_set_configuration(device_handle, ptp_usb->config)) { perror("libusb_set_configuration() failed, continuing anyway..."); } /* Re-fetch the config descriptor if we changed */ libusb_free_config_descriptor(config); ret = libusb_get_active_config_descriptor(dev, &config); if (ret != LIBUSB_SUCCESS) { perror("libusb_get_active_config_descriptor(2) failed"); return -1; } } /* * It seems like on kernel 2.6.31 if we already have it open on another * pthread in our app, we'll get an error if we try to claim it again, * but that error is harmless because our process already claimed the interface */ usbresult = libusb_claim_interface(device_handle, ptp_usb->interface); if (usbresult != 0) fprintf(stderr, "ignoring libusb_claim_interface() = %d", usbresult); /* * If the altsetting is set to something different than we want, switch * it. * * FIXME: this seems to cause trouble on the Mac:s so disable it. Retry * this on the Mac now that it only sets this when the altsetting differs. */ #ifndef __APPLE__ #if 0 /* Disable this always, no idea on how to handle it */ if (config->interface[].altsetting[].bAlternateSetting != ptp_usb->altsetting) { fprintf(stderr, "desired altsetting different from current, trying to set altsetting\n"); usbresult = libusb_set_interface_alt_setting(device_handle, ptp_usb->interface, ptp_usb->altsetting); if (usbresult != 0) fprintf(stderr, "ignoring libusb_set_interface_alt_setting() = %d\n", usbresult); } #endif #endif libusb_free_config_descriptor(config); if (FLAG_SWITCH_MODE_BLACKBERRY(ptp_usb)) { int ret; // FIXME : Only for BlackBerry Storm // What does it mean? Maybe switch mode... // This first control message is absolutely necessary usleep(1000); ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xaa, 0x00, 0x04, buf, 0x40, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 1:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); // This control message is unnecessary ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xa5, 0x00, 0x01, buf, 0x02, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 2:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); // This control message is unnecessary ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xa8, 0x00, 0x01, buf, 0x05, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 3:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); // This control message is unnecessary ret = libusb_control_transfer(device_handle, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, 0xa8, 0x00, 0x01, buf, 0x11, 1000); LIBMTP_USB_DEBUG("BlackBerry magic part 4:\n"); LIBMTP_USB_DATA(buf, ret, 16); usleep(1000); } return 0; } static void clear_stall(PTP_USB* ptp_usb) { uint16_t status; int ret; /* check the inep status */ status = 0; ret = usb_get_endpoint_status(ptp_usb,ptp_usb->inep,&status); if (ret<0) { perror ("inep: usb_get_endpoint_status()"); } else if (status) { LIBMTP_INFO("Clearing stall on IN endpoint\n"); ret = libusb_clear_halt (ptp_usb->handle, ptp_usb->inep); if (ret != LIBUSB_SUCCESS) { perror ("usb_clear_stall_feature()"); } } /* check the outep status */ status=0; ret = usb_get_endpoint_status(ptp_usb,ptp_usb->outep,&status); if (ret<0) { perror("outep: usb_get_endpoint_status()"); } else if (status) { LIBMTP_INFO("Clearing stall on OUT endpoint\n"); ret = libusb_clear_halt(ptp_usb->handle, ptp_usb->outep); if (ret != LIBUSB_SUCCESS) { perror("usb_clear_stall_feature()"); } } /* TODO: do we need this for INTERRUPT (ptp_usb->intep) too? */ } static void close_usb(PTP_USB* ptp_usb) { if (!FLAG_NO_RELEASE_INTERFACE(ptp_usb)) { /* * Clear any stalled endpoints * On misbehaving devices designed for Windows/Mac, quote from: * http://www2.one-eyed-alien.net/~mdharm/linux-usb/target_offenses.txt * Device does Bad Things(tm) when it gets a GET_STATUS after CLEAR_HALT * (...) Windows, when clearing a stall, only sends the CLEAR_HALT command, * and presumes that the stall has cleared. Some devices actually choke * if the CLEAR_HALT is followed by a GET_STATUS (used to determine if the * STALL is persistant or not). */ clear_stall(ptp_usb); libusb_release_interface(ptp_usb->handle, (int) ptp_usb->interface); } if (FLAG_FORCE_RESET_ON_CLOSE(ptp_usb)) { /* * Some devices really love to get reset after being * disconnected. Again, since Windows never disconnects * a device closing behaviour is seldom or never exercised * on devices when engineered and often error prone. * Reset may help some. */ libusb_reset_device (ptp_usb->handle); } libusb_close(ptp_usb->handle); } /** * Self-explanatory? */ static int find_interface_and_endpoints(libusb_device *dev, uint8_t *conf, uint8_t *interface, uint8_t *altsetting, int* inep, int* inep_maxpacket, int* outep, int *outep_maxpacket, int* intep) { uint8_t i, ret; struct libusb_device_descriptor desc; ret = libusb_get_device_descriptor(dev, &desc); if (ret != LIBUSB_SUCCESS) return -1; // Loop over the device configurations for (i = 0; i < desc.bNumConfigurations; i++) { uint8_t j; struct libusb_config_descriptor *config; ret = libusb_get_config_descriptor(dev, i, &config); if (ret != LIBUSB_SUCCESS) continue; *conf = config->bConfigurationValue; // Loop over each configurations interfaces for (j = 0; j < config->bNumInterfaces; j++) { uint8_t k, l; uint8_t no_ep; int found_inep = 0; int found_outep = 0; int found_intep = 0; const struct libusb_endpoint_descriptor *ep; // Inspect the altsettings of this interface... for (k = 0; k < config->interface[j].num_altsetting; k++) { // MTP devices shall have 3 endpoints, ignore those interfaces // that haven't. no_ep = config->interface[j].altsetting[k].bNumEndpoints; if (no_ep != 3) continue; *interface = config->interface[j].altsetting[k].bInterfaceNumber; *altsetting = config->interface[j].altsetting[k].bAlternateSetting; ep = config->interface[j].altsetting[k].endpoint; // Loop over the three endpoints to locate two bulk and // one interrupt endpoint and FAIL if we cannot, and continue. for (l = 0; l < no_ep; l++) { if (ep[l].bmAttributes == LIBUSB_TRANSFER_TYPE_BULK) { if ((ep[l].bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_DIR_MASK) { *inep = ep[l].bEndpointAddress; *inep_maxpacket = ep[l].wMaxPacketSize; found_inep = 1; } if ((ep[l].bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == 0) { *outep = ep[l].bEndpointAddress; *outep_maxpacket = ep[l].wMaxPacketSize; found_outep = 1; } } else if (ep[l].bmAttributes == LIBUSB_TRANSFER_TYPE_INTERRUPT) { if ((ep[l].bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == LIBUSB_ENDPOINT_DIR_MASK) { *intep = ep[l].bEndpointAddress; found_intep = 1; } } } if (found_inep && found_outep && found_intep) { libusb_free_config_descriptor(config); // We assigned the endpoints so return here. return 0; } } // Next altsetting } // Next interface libusb_free_config_descriptor(config); } // Next config return -1; } /** * This function assigns params and usbinfo given a raw device * as input. * @param device the device to be assigned. * @param usbinfo a pointer to the new usbinfo. * @return an error code. */ LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, PTPParams *params, void **usbinfo) { PTP_USB *ptp_usb; libusb_device *ldevice; uint16_t ret = 0; int err, found = 0, i; ssize_t nrofdevs; libusb_device **devs = NULL; struct libusb_device_descriptor desc; LIBMTP_error_number_t init_usb_ret; /* See if we can find this raw device again... */ init_usb_ret = init_usb(); if (init_usb_ret != LIBMTP_ERROR_NONE) return init_usb_ret; nrofdevs = libusb_get_device_list(NULL, &devs); for (i = 0; i < nrofdevs ; i++) { if (libusb_get_bus_number(devs[i]) != device->bus_location) continue; if (libusb_get_device_address(devs[i]) != device->devnum) continue; ret = libusb_get_device_descriptor(devs[i], &desc); if (ret != LIBUSB_SUCCESS) continue; if(desc.idVendor == device->device_entry.vendor_id && desc.idProduct == device->device_entry.product_id ) { ldevice = devs[i]; found = 1; break; } } /* Device has gone since detecting raw devices! */ if (!found) { libusb_free_device_list (devs, 0); return LIBMTP_ERROR_NO_DEVICE_ATTACHED; } /* Allocate structs */ ptp_usb = (PTP_USB *) malloc(sizeof(PTP_USB)); if (ptp_usb == NULL) { libusb_free_device_list (devs, 0); return LIBMTP_ERROR_MEMORY_ALLOCATION; } /* Start with a blank slate (includes setting device_flags to 0) */ memset(ptp_usb, 0, sizeof(PTP_USB)); /* Copy the raw device */ memcpy(&ptp_usb->rawdevice, device, sizeof(LIBMTP_raw_device_t)); /* * Some devices must have their "OS Descriptor" massaged in order * to work. */ if (FLAG_ALWAYS_PROBE_DESCRIPTOR(ptp_usb)) { // Massage the device descriptor (void) probe_device_descriptor(ldevice, NULL); } /* Assign interface and endpoints to usbinfo... */ err = find_interface_and_endpoints(ldevice, &ptp_usb->config, &ptp_usb->interface, &ptp_usb->altsetting, &ptp_usb->inep, &ptp_usb->inep_maxpacket, &ptp_usb->outep, &ptp_usb->outep_maxpacket, &ptp_usb->intep); if (err) { libusb_free_device_list (devs, 0); free (ptp_usb); LIBMTP_ERROR("LIBMTP PANIC: Unable to find interface & endpoints of device\n"); return LIBMTP_ERROR_CONNECTING; } /* Copy USB version number */ ptp_usb->bcdusb = desc.bcdUSB; /* Attempt to initialize this device */ if (init_ptp_usb(params, ptp_usb, ldevice) < 0) { free (ptp_usb); LIBMTP_ERROR("LIBMTP PANIC: Unable to initialize device\n"); libusb_free_device_list (devs, 0); return LIBMTP_ERROR_CONNECTING; } /* * This works in situations where previous bad applications * have not used LIBMTP_Release_Device on exit */ if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("PTP_ERROR_IO: failed to open session, trying again after resetting USB interface\n"); LIBMTP_ERROR("LIBMTP libusb: Attempt to reset device\n"); libusb_reset_device (ptp_usb->handle); close_usb(ptp_usb); if(init_ptp_usb(params, ptp_usb, ldevice) <0) { LIBMTP_ERROR("LIBMTP PANIC: Could not init USB on second attempt\n"); libusb_free_device_list (devs, 0); free (ptp_usb); return LIBMTP_ERROR_CONNECTING; } /* Device has been reset, try again */ if ((ret = ptp_opensession(params, 1)) == PTP_ERROR_IO) { LIBMTP_ERROR("LIBMTP PANIC: failed to open session on second attempt\n"); libusb_free_device_list (devs, 0); free (ptp_usb); return LIBMTP_ERROR_CONNECTING; } } /* Was the transaction id invalid? Try again */ if (ret == PTP_RC_InvalidTransactionID) { LIBMTP_ERROR("LIBMTP WARNING: Transaction ID was invalid, increment and try again\n"); params->transaction_id += 10; ret = ptp_opensession(params, 1); } if (ret != PTP_RC_SessionAlreadyOpened && ret != PTP_RC_OK) { LIBMTP_ERROR("LIBMTP PANIC: Could not open session! " "(Return code %d)\n Try to reset the device.\n", ret); libusb_release_interface(ptp_usb->handle, ptp_usb->interface); libusb_free_device_list (devs, 0); free (ptp_usb); return LIBMTP_ERROR_CONNECTING; } /* OK configured properly */ *usbinfo = (void *) ptp_usb; libusb_free_device_list (devs, 0); return LIBMTP_ERROR_NONE; } void close_device (PTP_USB *ptp_usb, PTPParams *params) { if (ptp_closesession(params)!=PTP_RC_OK) LIBMTP_ERROR("ERROR: Could not close session!\n"); close_usb(ptp_usb); } void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout) { ptp_usb->timeout = timeout; } void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout) { *timeout = ptp_usb->timeout; } int guess_usb_speed(PTP_USB *ptp_usb) { int bytes_per_second; /* * We don't know the actual speeds so these are rough guesses * from the info you can find here: * http://en.wikipedia.org/wiki/USB#Transfer_rates * http://www.barefeats.com/usb2.html */ switch (ptp_usb->bcdusb & 0xFF00) { case 0x0100: /* 1.x USB versions let's say 1MiB/s */ bytes_per_second = 1*1024*1024; break; case 0x0200: case 0x0300: /* USB 2.0 nominal speed 18MiB/s */ /* USB 3.0 won't be worse? */ bytes_per_second = 18*1024*1024; break; default: /* Half-guess something? */ bytes_per_second = 1*1024*1024; break; } return bytes_per_second; } static int usb_get_endpoint_status(PTP_USB* ptp_usb, int ep, uint16_t* status) { return libusb_control_transfer(ptp_usb->handle, LIBUSB_ENDPOINT_IN|LIBUSB_RECIPIENT_ENDPOINT, LIBUSB_REQUEST_GET_STATUS, USB_FEATURE_HALT, ep, (unsigned char *) status, 2, ptp_usb->timeout); } libmtp-1.1.10/src/libmtp.sym0000644000175000001440000000543512502366677012633 00000000000000LIBMTP_Set_Debug LIBMTP_Init LIBMTP_Get_Supported_Devices_List LIBMTP_Detect_Raw_Devices LIBMTP_Check_Specific_Device LIBMTP_Open_Raw_Device LIBMTP_Open_Raw_Device_Uncached LIBMTP_Get_First_Device LIBMTP_Get_Connected_Devices LIBMTP_Number_Devices_In_List LIBMTP_Release_Device_List LIBMTP_Release_Device LIBMTP_Dump_Device_Info LIBMTP_Reset_Device LIBMTP_Get_Manufacturername LIBMTP_Get_Modelname LIBMTP_Get_Serialnumber LIBMTP_Get_Deviceversion LIBMTP_Get_Friendlyname LIBMTP_Set_Friendlyname LIBMTP_Get_Syncpartner LIBMTP_Set_Syncpartner LIBMTP_Get_Batterylevel LIBMTP_Get_Secure_Time LIBMTP_Get_Device_Certificate LIBMTP_Get_Supported_Filetypes LIBMTP_Get_Errorstack LIBMTP_Clear_Errorstack LIBMTP_Dump_Errorstack LIBMTP_Get_Storage LIBMTP_Format_Storage LIBMTP_Get_String_From_Object LIBMTP_Get_u64_From_Object LIBMTP_Get_u32_From_Object LIBMTP_Get_u16_From_Object LIBMTP_Get_u8_From_Object LIBMTP_Set_Object_String LIBMTP_Set_Object_u32 LIBMTP_Set_Object_u16 LIBMTP_Set_Object_u8 LIBMTP_Get_Property_Description LIBMTP_Is_Property_Supported LIBMTP_Get_Allowed_Property_Values LIBMTP_destroy_allowed_values_t LIBMTP_new_file_t LIBMTP_destroy_file_t LIBMTP_Get_Filetype_Description LIBMTP_Get_Filelisting LIBMTP_Get_Filelisting_With_Callback LIBMTP_Get_Files_And_Folders LIBMTP_Get_Filemetadata LIBMTP_Get_File_To_File LIBMTP_Get_File_To_File_Descriptor LIBMTP_Get_File_To_Handler LIBMTP_Send_File_From_File LIBMTP_Send_File_From_File_Descriptor LIBMTP_Send_File_From_Handler LIBMTP_new_filesampledata_t LIBMTP_destroy_filesampledata_t LIBMTP_Get_Representative_Sample_Format LIBMTP_Send_Representative_Sample LIBMTP_Get_Representative_Sample LIBMTP_new_track_t LIBMTP_destroy_track_t LIBMTP_Get_Tracklisting LIBMTP_Get_Tracklisting_With_Callback LIBMTP_Get_Tracklisting_With_Callback_For_Storage LIBMTP_Get_Trackmetadata LIBMTP_Get_Track_To_File LIBMTP_Get_Track_To_File_Descriptor LIBMTP_Get_Track_To_Handler LIBMTP_Send_Track_From_File LIBMTP_Send_Track_From_File_Descriptor LIBMTP_Send_Track_From_Handler LIBMTP_Update_Track_Metadata LIBMTP_Track_Exists LIBMTP_new_folder_t LIBMTP_destroy_folder_t LIBMTP_Get_Folder_List LIBMTP_Get_Folder_List_For_Storage LIBMTP_Find_Folder LIBMTP_Create_Folder LIBMTP_new_playlist_t LIBMTP_destroy_playlist_t LIBMTP_Get_Playlist_List LIBMTP_Get_Playlist LIBMTP_Create_New_Playlist LIBMTP_Update_Playlist LIBMTP_new_album_t LIBMTP_destroy_album_t LIBMTP_Get_Album_List LIBMTP_Get_Album_List_For_Storage LIBMTP_Get_Album LIBMTP_Create_New_Album LIBMTP_Update_Album LIBMTP_Delete_Object LIBMTP_Set_File_Name LIBMTP_Set_Folder_Name LIBMTP_Set_Track_Name LIBMTP_Set_Playlist_Name LIBMTP_Set_Album_Name LIBMTP_Set_Object_Filename LIBMTP_Get_Thumbnail LIBMTP_Read_Event LIBMTP_GetPartialObject LIBMTP_SendPartialObject LIBMTP_BeginEditObject LIBMTP_EndEditObject LIBMTP_TruncateObject LIBMTP_Check_Capability libmtp-1.1.10/src/mtpz.h0000644000175000001440000000245712376430700011742 00000000000000/** * \file mtpz.h * * Copyright (C) 2011-2012 Sajid Anwar * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #ifndef MTPZ_H_INCLUSION_GUARD #define MTPZ_H_INCLUSION_GUARD #include "config.h" /* USE_MTPZ or not */ #include "ptp.h" /* PTPParams */ #ifdef USE_MTPZ uint16_t ptp_mtpz_handshake (PTPParams* params); int mtpz_loaddata(void); #else /* Stubs if mtpz is unused */ static inline uint16_t ptp_mtpz_handshake (PTPParams* params) { return PTP_RC_OperationNotSupported; } static inline int mtpz_loaddata(void) { return -1; } #endif int use_mtpz; #endif /* LIBMTP_H_INCLUSION_GUARD */ libmtp-1.1.10/src/libusb-glue.h0000644000175000001440000001465212376430700013162 00000000000000/** * \file libusb-glue.h * Low-level USB interface glue towards libusb. * * Copyright (C) 2005-2007 Richard A. Low * Copyright (C) 2005-2012 Linus Walleij * Copyright (C) 2006-2011 Marcus Meissner * Copyright (C) 2007 Ted Bullock * Copyright (C) 2008 Chris Bagwell * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Created by Richard Low on 24/12/2005. * Modified by Linus Walleij * */ #ifndef LIBUSB_GLUE_H #define LIBUSB_GLUE_H #include "ptp.h" #ifdef HAVE_LIBUSB1 #include #endif #ifdef HAVE_LIBUSB0 #include #endif #ifdef HAVE_LIBOPENUSB #include #endif #include "libmtp.h" #include "device-flags.h" /* Make functions available for C++ */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * Debug macro */ #define LIBMTP_USB_DEBUG(format, args...) \ do { \ if ((LIBMTP_debug & LIBMTP_DEBUG_USB) != 0) \ fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \ } while (0) #define LIBMTP_USB_DATA(buffer, length, base) \ do { \ if ((LIBMTP_debug & LIBMTP_DEBUG_DATA) != 0) \ data_dump_ascii (stdout, buffer, length, base); \ } while (0) #ifdef HAVE_LIBUSB1 #define USB_BULK_READ libusb_bulk_transfer #define USB_BULK_WRITE libusb_bulk_transfer #endif #ifdef HAVE_LIBUSB0 #define USB_BULK_READ usb_bulk_read #define USB_BULK_WRITE usb_bulk_write #endif #ifdef HAVE_LIBOPENUSB #define USB_BULK_READ openusb_bulk_xfer #define USB_BULK_WRITE openusb_bulk_xfer #endif /** * Internal USB struct. */ typedef struct _PTP_USB PTP_USB; struct _PTP_USB { PTPParams *params; #ifdef HAVE_LIBUSB1 libusb_device_handle* handle; #endif #ifdef HAVE_LIBUSB0 usb_dev_handle* handle; #endif #ifdef HAVE_LIBOPENUSB openusb_dev_handle_t* handle; #endif uint8_t config; uint8_t interface; uint8_t altsetting; int inep; int inep_maxpacket; int outep; int outep_maxpacket; int intep; /** File transfer callbacks and counters */ int callback_active; int timeout; uint16_t bcdusb; uint64_t current_transfer_total; uint64_t current_transfer_complete; LIBMTP_progressfunc_t current_transfer_callback; void const * current_transfer_callback_data; /** Any special device flags, only used internally */ LIBMTP_raw_device_t rawdevice; }; void dump_usbinfo(PTP_USB *ptp_usb); const char *get_playlist_extension(PTP_USB *ptp_usb); void close_device(PTP_USB *ptp_usb, PTPParams *params); LIBMTP_error_number_t configure_usb_device(LIBMTP_raw_device_t *device, PTPParams *params, void **usbinfo); void set_usb_device_timeout(PTP_USB *ptp_usb, int timeout); void get_usb_device_timeout(PTP_USB *ptp_usb, int *timeout); int guess_usb_speed(PTP_USB *ptp_usb); /* Flag check macros */ #define FLAG_BROKEN_MTPGETOBJPROPLIST_ALL(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL) #define FLAG_UNLOAD_DRIVER(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNLOAD_DRIVER) #define FLAG_BROKEN_MTPGETOBJPROPLIST(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST) #define FLAG_NO_ZERO_READS(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_ZERO_READS) #define FLAG_IRIVER_OGG_ALZHEIMER(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IRIVER_OGG_ALZHEIMER) #define FLAG_ONLY_7BIT_FILENAMES(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ONLY_7BIT_FILENAMES) #define FLAG_NO_RELEASE_INTERFACE(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_NO_RELEASE_INTERFACE) #define FLAG_IGNORE_HEADER_ERRORS(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_IGNORE_HEADER_ERRORS) #define FLAG_BROKEN_SET_OBJECT_PROPLIST(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_OBJECT_PROPLIST) #define FLAG_OGG_IS_UNKNOWN(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_OGG_IS_UNKNOWN) #define FLAG_BROKEN_SET_SAMPLE_DIMENSIONS(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS) #define FLAG_ALWAYS_PROBE_DESCRIPTOR(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_ALWAYS_PROBE_DESCRIPTOR) #define FLAG_PLAYLIST_SPL_V1(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V1) #define FLAG_PLAYLIST_SPL_V2(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_PLAYLIST_SPL_V2) #define FLAG_PLAYLIST_SPL(a) \ ((a)->rawdevice.device_entry.device_flags & (DEVICE_FLAG_PLAYLIST_SPL_V1 | DEVICE_FLAG_PLAYLIST_SPL_V2)) #define FLAG_CANNOT_HANDLE_DATEMODIFIED(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_CANNOT_HANDLE_DATEMODIFIED) #define FLAG_BROKEN_SEND_OBJECT_PROPLIST(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_SEND_OBJECT_PROPLIST) #define FLAG_BROKEN_BATTERY_LEVEL(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_BATTERY_LEVEL) #define FLAG_FLAC_IS_UNKNOWN(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FLAC_IS_UNKNOWN) #define FLAG_UNIQUE_FILENAMES(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_UNIQUE_FILENAMES) #define FLAG_SWITCH_MODE_BLACKBERRY(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_SWITCH_MODE_BLACKBERRY) #define FLAG_LONG_TIMEOUT(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_LONG_TIMEOUT) #define FLAG_FORCE_RESET_ON_CLOSE(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_FORCE_RESET_ON_CLOSE) #define FLAG_BROKEN_GET_OBJECT_PROPVAL(a) \ ((a)->rawdevice.device_entry.device_flags & DEVICE_FLAG_BROKEN_GET_OBJECT_PROPVAL) /* connect_first_device return codes */ #define PTP_CD_RC_CONNECTED 0 #define PTP_CD_RC_NO_DEVICES 1 #define PTP_CD_RC_ERROR_CONNECTING 2 #ifdef __cplusplus } #endif /* __cplusplus */ #endif // LIBUSB-GLUE_H libmtp-1.1.10/src/util.h0000644000175000001440000000332012540343672011717 00000000000000/* * \file util.h * Utilityfunctions. * * Copyright (C) 2005-2007 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __MTP__UTIL__H #define __MTP__UTIL__H #include "config.h" // To get HAVE_STRNDUP void data_dump(FILE *f, void *buf, uint32_t nbytes); void data_dump_ascii (FILE *f, void *buf, uint32_t n, uint32_t dump_boundry); #ifndef HAVE_STRNDUP char *strndup (const char *s, size_t n); #endif void device_unknown(const int dev_number, const int id_vendor, const int id_product); /** * Info macro */ #define LIBMTP_INFO(format, args...) \ do { \ if (LIBMTP_debug != 0) \ fprintf(stdout, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \ else \ fprintf(stdout, format, ##args); \ } while (0) /** * Error macro */ #define LIBMTP_ERROR(format, args...) \ do { \ if (LIBMTP_debug != 0) \ fprintf(stderr, "LIBMTP %s[%d]: " format, __FUNCTION__, __LINE__, ##args); \ else \ fprintf(stderr, format, ##args); \ } while (0) #endif //__MTP__UTIL__H libmtp-1.1.10/ChangeLog0000644000175000001440000030165612121274441011561 000000000000002011-01-19 Linus Walleij RETIRING THIS FILE! WE HAVE MIGRATED TO GIT WHICH PROVIDES EASY ACCESS TO THE CHANGELOG, LETS GET RID OF THIS ANCIENT CRUFT 2011-01-09 Linus Walleij * configure.ac: bump to 1.0.4 * src/Makefile.am: bump interface to libmtp.so.8.3.4 * Release libmtp 1.0.4 2010-12-07 Linus Walleij * configure.ac: make sure the prober only compiles for Linux. * src/ptp.c: update to match upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. 2010-12-05 Linus Walleij * utils/mtp-probe.c: enhanced to use libmtp intrinsics and e.g. OS descriptor to probe new devices from udev. * utils/mtp-hotplug.c: utilize mtp-probe. * src/libmtp.h.in: add new interface used by the mtp-probe utility to probe a certain device in a certain bus. * src/libusb-glue.c: introduce new function to probe a certain bus and device. * examples/Makefile.am: reform the way of making all executable examples prefixed with "mtp-*" just set this name in the make target! * configure.ac: drop the default "mtp-*" prefixing of all programs, instead I have renamed the executables. * Makefile.am: install the mtp-probe script in the libexecdir, and FORCE this to be /lib/udev. We now also install the udev rules to $libexecdir/rules.d, which is thus also forced to be /lib/udev/rules.d. 2010-12-01 Linus Walleij * examples/hotplug.c: drop old udev style somewhat. * utils/: move out mtp-hotplug into its own subdir, intend to put programs to probe devices here too. * utils/mtp-hotplug.c: moved the hotplug program here. * utils/check_mtp_device.sh: tentative script for checking MTP devices. * utils/mtp-probe.c: C program intended to check if devices are MTP. 2010-11-24 Linus Walleij * examples/hotplug.c: set the music player environment variable for userspace programs watching udev output to determine what device is plugged in. 2010-10-31 Linus Walleij * src/libusb-glue.c: only reset the device if a connection fails, then retry. We were resetting the device on every close() - not good. 2010-10-17 Linus Walleij * src/libmtp.c: Windows file open fixes from Jelle Geerts. * examples/sendfile.c: exit with 1 on error. * examples/*: condensed connect subprograms to a single header and propagate error codes. 2010-09-18 Linus Walleij * src/libmtp.c: NULL check on abstract lists, drop unused folder variable. 2010-07-25 Linus Walleij * src/libmtp.c: if the Ogg or FLAC filetypes have been flagged as being stored as "unknown" and the device now indicates it supports them: remove the flag. * src/libmtp.c: parse device extensions. * src/libmtp.h.in: stack up device extensions in the device struct. 2010-06-19 Richard Low * src/music-players.h: add Apple devices as supported by PwnTunes 2010-05-23 Linus Walleij * src/libusb-glue.c: don't probe HID equipment for device descriptors, some Kensington mice don't like that and there generally is not point either * src/Makefile.am: interface libmtp.so.8.3.3 * configure.ac: libmtp 1.0.3 * Release 1.0.3 2010-05-16 Richard Low * src/libusb-glue.c: usb bus location fix for Mac and disable usb_set_altinterface on Mac 2010-04-25 Linus Walleij * src/ptp.c: sync to upstream. * src/ptp.h: dito. * src/playlist-spl.c: fix an issue with Samsung playlists disappearing since they were using a custom MTP type. * src/libmtp.c: moan about PTP devices without MTP extension 2010-04-05 Linus Walleij * src/ptp.c: sync to upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. 2010-02-01 Linus Walleij * src/Makefile.am: interface libmtp.so.8.3.2 * configure.ac: libmtp 1.0.2 * Release 1.0.2. 2010-01-30 Linus Walleij * examples/connect.c: bad prototype for sendtrack_. * examples/sentr.c: bad prototype. * src/ptp.c: sync to upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. 2010-01-19 Linus Walleij * src/libmtp.c: handle a root folder with a number of 0xffffffffU (-1), even if the spec says that 0x00000000 is the root folder. Add some warnings. * src/libmtp.c: patch from Kevin Hester to fix the erroneous setting of genre or release date to NULL on some devices. * src/libusb-glue.c: patch to fix a bug in some multithread contexts affecting e.g. Rhythmbox, also by Kevin Hester. * examples/Makefile.am: fix the bad prefixing that came in as part of the Windows fixes. Keep $(EXEEXT). 2010-01-07 Linus Walleij * src/libmtp.c: detect "My_Foo" default folders as well as "My Foo" (underscore) as well. 2010-01-01 Linus Walleij * src/libmtp.h.in: we use time_t so include 2009-12-16 Linus Walleij * src/libusb-glue.c: don't complain so much about the response to command 2. 2009-11-30 Linus Walleij * src/libusb-glue.c: bus detection fix for libusb - bus->location was not properly initialized. 2009-10-10 Linus Walleij * src/libmtp.h.in: move debugmacros to util.h * src/util.h: dito * libmtp.pc.in: erroneouse Libs.private, lacking ":" 2009-09-28 Nicolas VIVIEN * examples/albumart.c : add d option, to enable or not debug ouput. * examples/albums.c : dito. * examples/detect.c : dito. * src/libmtp.c : Add LIBMTP_Set_Debug function. * src/libmtp.h.in : Add LIBMTP_Set_Debug function to API. * src/libmtp.sym : Add LIBMTP_Set_Debug function to exported symbol. * src/libusb-glue.h : Add LIBMTP_USB_DEBUG / LIBMTP_DATA_DEBUG macros. * src/libusb-glue.c : Use previous macros inside of printf. * src/playlist-spl.c : Add LIBMTP_PLST_DEBUG macro. 2009-09-25 Linus Walleij * src/libusb-glue.c: some more BlackBerry fixing from Nicolas. * examples/albumart.c: add p and s switches, to support storage and parent ID:s. (Nicolas) * examples/newplaylist.c: dito. (Nicolas) 2009-09-23 Linus Walleij * src/libmtp.c: patch from Nyall Dawson to make all filenames unique if the device requires this. * src/libusb-glue.h: dito. * src/device-flags.h: dito. * src/music-players.h: dito. 2009-09-23 Linus Walleij * src/libusb-glue.c: several patches from Nicolas Vivien to support the BlackBerry Storm. * src/device-flags.h: add special flag for the BlackBerry "switch mode" command. * src/libusb-glue.h: dito. * src/music-players.h: tag the BlackBerry with this flag. 2009-09-21 Linus Walleij * examples/sendtr.c: patch from Andrea Grillini to support quiet mode operation. 2009-09-12 Linus Walleij * src/libusb-glue.c: skip interfaces with != 3 endpoints and make sure we locate 1 bulk in, 1 bulk out and 1 interrupt endpoint on the interface, else SKIP IT. Based on a patch from Nicolas Vivien . 2009-09-12 Linus Walleij * configure.ac: bump version to libmtp 1.0.1 and release! * src/Makefile.am: bump soversion to libmtp.so.8.3.1 2009-09-11 Linus Walleij * src/music-players.h: tag all SONY NWZ walkmen with DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST. 2009-08-27 Linus Walleij * src/libmtp.c: modernize the album retrieveal functions so they work just as nicely as the track/playlist etc functions. Triggered by Nyalls excellent bug report that showed how libmtp tried to get "composer" info for an album eventhough the device didn't support it. 2009-08-27 Linus Walleij * src/libmtp.c: bugfixes again... 2009-08-25 Linus Walleij * src/libmtp.c: fix a bug where the metadata was cached twice, thx to Marcus for the patch! 2009-08-23 Linus Walleij * src/ptp.c: sync to upstream * src/ptp.h: dito. * src/libmtp.c: patch from Thomas Schweitzer to not use C++ reserved words like "private" and "new", this was changed to "priv" and "newlist" making C++ happy. * src/libusb-glue.h: inclusion guard, export functions to C++ (whoever wants to do that...) * src/libusb-glue.c: define USB_CLASS_PTP unless defined, out-commented code to detect all PTP devices as MTP devices as well. 2009-08-12 Linus Walleij * src/libusb-glue.c: patch from Simon Berg to detect PTP interface descriptors. * src/ptp.c: sync to upstream with correct MTP interface detection in accordance with MTP spec. * src/ptp.h: dito. 2009-08-02 Linus Walleij * configure.ac: tag for libmtp 1.0.0! * src/Makefile.am: bump to compatible API/ABI result = libmtp.so.8.3.0 * src/libmtp.c: missing flag fix from Marcus. 2009-07-24 Linus Walleij * src/device-flags.h: add a flag for unknown FLAC type. * src/music-players.h: tag the Cowon iAudio S9 with this. * src/libmtp.c: implement unknown FLAC type. 2009-07-24 Linus Walleij * src/music-players.h: a number of new devices. * src/ptp.c: sync to upstream. * src/ptp.h: sync to upstream. * src/ptp-pack.c: sync to upstream. 2009-06-24 Linus Walleij * src/music-players.h: tag most all Samsung devices with the UNLOAD_DRIVER flag. Broken GET_ALL info in all Creative devices. 2009-06-20 Linus Walleij * examples/pathutils.c: detect VCF files too. 2009-06-15 Marcus Meissner * configure.ac: use the AC_SYS_LARGEFILE macro instead of the ugly largefile hacks. * src/libmtp.c: fix use of largefile back to the simple functions instead. * examples/albumart.c: dito. * examples/sendfile.c: dito. * examples/sendtr.c: dito. * examples/thumb.c: dito. 2009-06-15 Linus Walleij * configure.ac: some buildsystem updates. * INSTALL: some doc updates. 2009-06-15 Marcus Meissner * src/libmtp.c: synced to new libgphoto2 code. * src/device-flags.h: dito. * src/ptp.h: sync to upstream. * src/ptp.c: dito. * src/ptp-pack.c: dito. The handles, the PTPObjectInfo and the MTP proplists are now consolidated into "PTPObject"s. This and abstraction and the resulting helper functions allow implementation of easier dynamic operations like I need for libgphoto2. Some corner stones: - PTPParams now contains the device flags itself. (from device-flags.h) This is needed due to ptp_object_want() needing to decide whether it can call GetObjPropList, and it makes it cleaner. So the ptp-bugs and device-flags handling are unified. - PTPObjects are sorted by object handle. This allows binary search by handle. - New generic helper functions. * uint16_t ptp_object_find (PTPParams *params, uint32_t handle, PTPObject **retob) binary searches the handle in the object list and returns a pointer to the object. * uint16_t ptp_object_find_or_insert (PTPParams *params, uint32_t handle, PTPObject **retob) binary searches the handle in the object list, inserts it if not there yet, and returns a pointer to the object. * uint16_t ptp_object_want (PTPParams *params, uint32_t handle, int want, PTPObject **retob) The most magic function, which does the "on demand" loading of objectinfos, mtp proplists (and more). want is a flag mask of PTPOBJECT_*_LOADED PTPOBJECT_OBJECTINFO_LOADED clear PTPOBJECT_CANONFLAGS_LOADED (special canon flags) PTPOBJECT_MTPPROPLIST_LOADED mtp properties for this object loaded PTPOBJECT_DIRECTORY_LOADED (only used by libgphoto2 currently) PTPOBJECT_PARENTOBJECT_LOADED this and storageid are interesting for directory based lookups PTPOBJECT_STORAGEID_LOADED and can be filled out by directory loading * void ptp_objects_sort (PTPParams *params); Sort the objects list if you did any modification of your own on it and the order of object handles might not be linear anymore. - Multiple object information loading strategies are possible. libmtp uses getobjecthandles() /getobjectinfo() and getobjectproplist() loading strategies for initial setup. This stays of course, it will just fill out the PTPObject array. libgphoto2 now uses a per-directory getobjecthandles() / getobjectinfo() loading approach, and I will readd the getobjectproplist() approach. It is open what you chose to use here. For libmtp the "load all handles at startup" is good, dynamic loading is better for libgphoto2. Only rule is: The objectlist must be in order of objecthandles! (ptp_object_sort()). 2009-06-02 Linus Walleij * examples/hotplug.c: change the udev match rule from ATTR{dev}!="?*" to ENV{MAJOR}!="?*" at the suggestion of Alan Jenkins, this should be faster. * src/libusb-glue.c: include config.h (Marcus Meissner found this is needed when you're not using iconv().) 2009-05-09 Linus Walleij * src/libmtp.c: include for iconv() compatibility. * src/unicode.c: dito. NOTE: this file needs fixing to work without iconv! * src/ptp.h: sync to upstream and get all the embedded support for FREE! * src/ptp.c: dito. * src/ptp-pack.c: dito. 2009-05-06 Linus Walleij * src/ptp.h: sync to upstream. * src/ptp.c: dito. * src/ptp-pack.c: dito. 2009-05-06 Linus Walleij A host of Windows fixes from Carlo Bramini With this patch everything works fine with cygwin and Debian 5.0. Unfortunately, with MSys the "make install" still fails at the very last actions. It happens that everything is re-linked (strange, but not a big problem) and for some unknown reason it loops forever when executing "examples/hotplug > libmtp.usermap". But hopefully the simple "make" completes without errors. * configure.ac: * iconv is now detected with autotools, this makes libmtp linkable on cygwin too (previously it was not). * the presence of Microsoft LIB.EXE is checked; if it is absent then the MSVC libraries won't be generated. * Added checking for some include files not available on Windows: arpa/inet.h, byteswap.h, sys/uio.h. * Check for presence of mkstemp: a replacement has been written for Windows. * examples/Makefile.am: the creation of the links failed: I added source path and $(EXEEXT) extension for executables. This is tested and working with Mingw+MSys, Cygwin, Debian 5.0. * examples/albumart.c: include sys/uio.h only if it's available. * examples/trexist.c: u_int32_t does not exists, into almost all other parts libmtp is using uint32_t so I fixed it in that manner. (Same for u_int64_t/uint64_t). * examples/getfile.c: dito. * examples/pathutils.c: dito, plus rindex() does not exist under Windows, we must user strrchr() instead. * examples/pathutils.h: fixes for prototypes changes made into examples/pathutils.c * examples/thumb.c: include sys/uio.h only if it's available. * src/Makefile.am: * Several fixes because the check on the presence of LIB.EXE libmtp.sym is now prefixed by $(srcdir), this allows to configure libmtp outside the source tree in Windows too. * Libraries are put into LIBADD instead of LDFLAGS, this is the right place. * Previously the linker crashed because there was -ws2_32 instead of -lws2_32. * src/playlist-spl.c: * include sys/uio.h only if it's available. * include replacement for mkstemp() function. 2009-05-03 Richard Low * src/libmtp.c: add external property types just like file types so any property can be retrieved/set. Add function LIBMTP_Is_Property_Supported to determine if a property is supported for a given object type. Add function LIBMTP_Get_Allowed_Property_Values to get alowed range/enum of a property value. Make LIBMTP_Get_Representative_Sample_Format get the size parameter to allow us to determine the maximum size for a representative sample. * src/libmtp.h.in: ditto * src/libusb-glue.c: update to check the handler function return value so the handler can return PTP_ERROR_CANCEL to cancel the transfer. 2009-05-02 Richard Low * src/ptp-pack.c: add a NULL check 2009-04-18 Richard Low * src/ptp-pack.c: add terminating NULL character 2009-04-11 Richard Low * src/libusb-glue.c: Make get_playlist_extension return type const char * * src/libusb-glue.h: ditto * src/libusb-glue.c: In probe_device_descriptor, check to see if dev->config is NULL before going round the first loop * src/libmtp.c: Add LIBMTP_Get_File_To_Handler, LIBMTP_Send_File_From_Handler, LIBMTP_Get_Track_To_Handler, LIBMTP_Send_Track_From_Handler functions to get/send files/tracks from/to handler functions. Add modificationdate to file and track structs. Add LIBMTP_FILETYPE_ALBUM and LIBMTP_FILETYPE_PLAYLIST filetypes. 2009-03-17 Linus Walleij * src/device-flags.h: discovered a new device that cannot even read out battery level but still claims to be able to. Sigh. * src/libusb-glue.h: flag macro. * src/music-players.h: flag the Slacker. * src/libmtp.c: avoid battery level getting on these devices. * configure.ac: preparing for 0.3.7. * src/Makefile.am: preparing for 0.3.7 (libmtp.so.8.2.2) * Release libmtp 0.3.7. 2009-03-08 Linus Walleij * src/libmtp.c: refactored OGG extenstion check again, same code in three places, broke it out and made it foolproof (hopefully) in one single spot. 2009-03-04 Linus Walleij * src/libusb-glue.c: patch from Marcus to fix an issue with retransmit originally reported by Florent Pillet. 2009-02-21 Linus Walleij * src/libmtp.c: some additional NULL checks from Florent Pillet. 2009-02-18 Linus Walleij * src/libmtp.c: error report from RedHat BZ http://bugzilla.redhat.com/show_bug.cgi?id=485627 led to strange code for detecting anonymous OGG files being rewritten to handle NULL filenames and filenames that do not exceed 4 chars. 2009-01-30 Linus Walleij * src/libmtp.c: store albums and playlists in the default music folder if no default folder for albums resp. playlists has been detected. 2009-01-22 Linus Walleij * configure.ac: bump to 0.3.6 and release. * src/Makefile.am: interface bump to libmtp.so.8.2.1 2009-01-16 Linus Walleij * src/ptp.c: sync to upstream. * src/ptp.h: dito. 2009-01-15 Linus Walleij * src/libmtp.c: include fixes from Yuri Pankov for *BSD. * src/playlist-spl.c: dito. * examples/*.c: (more or less) dito. 2009-01-14 Linus Walleij * src/device-flags.h: new device flag for broken SendObjectPropList, as found broken in MEU202 * src/music-players.h: use the new flag. * src/libmtp.c: implement this device flag. * src/libusb-glue.h: dito. 2009-01-10 Linus Walleij * src/libmtp.h.in: mingw32 fixes from James Ravenscroft. * src/libmtp.c: dito. Replaced "rindex" with "strrchr" * src/Makefile.am: dito. * examples/albumart.c: dito. 2009-01-06 Linus Walleij * src/Makefile.am: patch from Rafael Laboissiere removing a build artifact in distclean. 2009-01-02 Linus Walleij * examples/connect.c: usage patch from Riley Patterson. * examples/sendtr.c: dito. Plus only try to add track to an album if and only if an album name was given. * examples/newfolder.c: real bad bug fixed, didn't even work due to bad args check. * examples/sendfile.c: another bad bug... * examples/common.h: include not "config.h" * src/unicode.h: no reason for this to include config.h! 2008-12-21 Linus Walleij * Release libmtp 0.3.5. 2008-12-15 Nathan Bullock * src/libmtp.c: get folders to a flat list and we get O(n) searching instead of the previous O(n^2) algorithm! 2008-12-13 Linus Walleij * examples/detect.c: make mtp-detect dump out default-capabilities.xml if such a file exists on the device. * m4/stdint.m4: update to newer macro from libgphoto2. * m4/byteorder.m4: update to newer macro from libgphoto2. We find these here: http://gphoto.svn.sourceforge.net/viewvc/gphoto/trunk/m4/ * configure.ac: fix the renamed _stdint.h too. * Doxyfile.in: some config option got obsolete. * libmtp.c: start to use PTP error redirection to the libmtp error stack. This also makes it possible to stop the annoying debug prints. * libusb-glue.c: dito. * ptp.c: sync to upstream. * ptp.h: sync to upstream. 2008-12-02 Linus Walleij * examples/util.c: another NULL check. 2008-11-25 Linus Walleij * src/libmtp.c: fix a bug on handling folder children with an illegal ID of 0. Occured in the ZEN Xi-Fi in the "Recordings" folder, when that is created on the device. 2008-11-17 Alistair Boyle * configure.ac: change release to 0.3.5. * libmtp.c: change metadata const*const to *const to allow playlist_id to be modified by LIBMTP_Update_Playlist. (Samsung playlists) * libmtp.h.in: match libmtp.c 2008-11-11 Linus Walleij * src/libmtp.c: allow for playlists with zero tracks on them, also in update. 2008-11-09 Linus Walleij * src/ptp.h: sync from upstream. * src/ptp.c: sync from upstream. * src/ptp-pack.c: sync from upstream. 2008-11-07 Linus Walleij * Release libmtp 0.3.4. * configure.ac: let's release 0.3.4. * src/Makefile.am: compatible API and ABI. 2008-11-05 Linus Walleij * src/libmtp.c: fix the association type problem on LIBMTP_Create_Folder(). This causes folders not to work properly on some devices!! 2008-11-01 Linus Walleij * src/ptp.h: sync to upstream. * src/ptp.c: sync to upstream. * src/ptp-pack.c: introduce Richards bugfix on top of upstream and take advantage of the ptp_debug() function. * src/libusb-glue.c: make ptp_debug() non-static since ptp-pack.c needs it. 2008-10-21 Linus Walleij * src/device-flags.h: actually the SanDisks cannot handle PTP_OPC_DateModified at ALL, not even as part of the initial update so rename the flag to something sensible. * src/music-players.h: consequental changes. * src/libmtp.c: disable all use of PTP_OPC_DateModified if flag is set, not just updates. 2008-10-16 Linus Walleij * src/device-flags.h: new flag for broken updates of PTP_OPC_DateModified. * src/music-players.h: tag all SanDisk devices with this flag. Bug appeared in them. * libmtp.c: avoid updating PTP_OPC_DateModified on broken devices. 2008-09-28 Alvin * src/libmtp.c: fix several bugs in Ogg filetype support. 2008-09-26 Richard Low * src/libmtp.c: check propdesc before setting props in create_new_abstract_list() 2008-09-25 Linus Walleij * configure.ac: bump to 0.3.3. * src/Makefile.am: interface to .so.8.1.0 * Release as 0.3.3. 2008-09-24 Linus Walleij * src/libmtp.h.in: add new filename setting functions, patch from Florent Mertens . * src/libmtp.c: implementation. * src/playlist-spl.c: consequental changes. * src/libmtp.sym: consequental changes. * Fixup patch from Alvin later this day. * Note to self: remember to bump soname to .so.8.1.0. 2008-09-23 Richard Low * src/libmtp.c: check for NULL storage * src/libusb-glue.c: return PTP_RC_OK on zero read * src/music-players.h: give Samsung YP-10 DEVICE_FLAG_NO_ZERO_READS 2008-09-22 Linus Walleij * src/libmtp.c: make sure we don't try to fit a new file onto a ROM storage. Add some pretty-print to FourCC codecs so you can actually understand the enumerations. 2008-09-20 Joe Nahmias * examples/sendtr.c: added option to specify which storage_id the track should be copied. 2008-09-20 Linus Walleij * configure.ac: bump to 0.3.2. * src/Makefile.am: bump to libmtp.so.8.0.2, compatible interface. * Release this as 0.3.2 mainly to get the Creative fixes out. 2008-09-17 Linus Walleij * src/libmtp.h.in: new helper macros from Alvin plus some docs. 2008-09-12 Linus Walleij * src/music-players.h: drop bug flags off the Creative devices. I am confident that the bugs they were masking have been fixed now. 2008-09-07 Richard Low * src/music-players.h: added Panasonic P905i 2008-09-05 Marcus Meissner * src/libmtp.sym: update symbol export table. * src/Makefile.am: fix up some magic for symbol export. 2008-09-04 Linus Walleij * src/libmtp.c: look up the filename for playlists if the name is missing or not properly set. Not doing the same for albums - these must have proper metadata. * src/music-players.h: more players as usual. * examples/sendtr.c: more warnings. 2008-08-31 Linus Walleij * src/ptp.h: sync to upstream. * src/ptp.c: sync to upstream. 2008-08-30 Chris Bagwell * src/libusb-glue.c: make it possible to have per-command or otherwise altered timeout values for different PTP request/response sequences. * src/libusb-glue.h: dito. * src/libmtp.c: increase USB timeout to 30s when getting a complete track listing off the device. * src/music-players.h: as a consequence, the Sirus Stiletto no longer needs any brokenness flag. 2008-08-30 Linus Walleij * src/ptp.c: sync to upstream. 2008-08-28 Linus Walleij * examples/sendtr.c: fix non-strdup():ed strings to be copied, patch courtesy of Juanan Pereira. 2008-08-25 Linus Walleij * src/Makefile.am: bump interface a patchlevel. (Fully compatible.) * configure.ac: bump version to 0.3.1. * Release as libmtp 0.3.1. 2008-08-18 Linus Walleij * src/libusb-glue.c: some vartype and return flunkies. * configure.ac: check for locale.h * examples/util.c: set locale to pick up environment. 2008-08-17 Linus Walleij * src/libusb-glue.c: some handling of ptp_usb_getdata() when passed in data size was 0xffffffffU, data sent in first transaction was ignored, fix by Rob Woolley. * src/ptp-pack.c: sync in from upstream libgphoto2. * src/README: move relevant stuff to README. * README: see above. 2008-08-15 Alistair Boyle * src/playlist-spl.c: added handling of Samsung's proprietary .spl playlist format. * src/playlist-spl.h: dito. * src/device-flags.h: new flags for Samsung playlists. * src/music-players.h: assign flags. * src/libusb-glue.h: convenience macros. * src/libmtp.c: integrate Samsung playlists. 2008-08-15 Linus Walleij * examples/Makefile.am: break out utility functions (currently only checklang()) to a separate file. * examples/util.h: dito. * examples/util.c: dito. * examples/detect.c: dito. * examples/sendtr.c: dito. * examples/connect.c: dito. 2008-08-14 Linus Walleij * src/libmtp.c: add some documentation to file and track listing functions to that it's clear that you have to inspect storage_id and parent_id in order to group files into storages and/or folders. 2008-07-31 Linus Walleij * src/music-players.h: several new devices and flags. 2008-06-24 Linus Walleij * TODO: updates. * src/Makefile.am: bump interface to libmtp.so.8.0.0. It's NOT compatible! * RELEASE libmtp 0.3.0 and let the apps developers have their apps fixed! 2008-06-22 Linus Walleij * src/libmtp.h.in: removed the parenthandle argument from LIBMTP_Send_File_From_File(), LIBMTP_Send_File_From_File_Descriptor(), LIBMTP_Send_Track_From_File(), LIBMTP_Send_Track_From_File_Descriptor(), LIBMTP_Create_New_Playlist() and LIBMTP_Create_New_Album() Now you must pass in parent ID from a metadata or filedata set. Use the respective field of the file, track, playlist or album struct to pass in a parent handle when calling these functions from now on. The bonus for changing your code is that you can now also pass in a storage_id with any metadata set! Consequently LIBMTP_Create_Folder() was altered to accept THREE metadata arguments: name, parent_id and storage_id. All calls to any of these functions in any referring code need to be altered to use this scheme. It should be quite self-evident for most code and easy to perform. * src/libmtp.c: changed outlined above were implemented. * examples/newfolder.c: consequental changes. * examples/sendfile.c: consequental changes. * examples/sendtr.c: consequental changes. * examples/albumart.c: consequental changes. * examples/newplaylist.c: consequental changes. * examples/files.c: consequental changes. * examples/tracks.c: correct misleading strings. 2008-06-15 Linus Walleij * src/libmtp.c: only look for default folders in the root folder on the primary storage, even. 2008-06-14 Linus Walleij * src/libmtp.c: only look for default folders in the primary storage, and only try to put files there if they are targetting the primary storage. 2008-06-08 Linus Walleij * configure.ac: check for the langinfo.h header. * examples/connect.c: check charset properly. * examples/sendtr.c: dito. * src/music-players.h: new devices galore. 2008-06-03 Linus Walleij * src/device-flags.h: new device flag for devices that always need to have their device descriptor probed. * src/music-players.h: generously add this flag to all SanDisk devices. The e280v2 and Fuze are known to be especially problematic. * src/libusb-glue.h: helper macro. * src/libusb-glue.c: massage "OS Descriptor" on demand when opening the device. * src/music-players.h: detailed info and flags for the SanDisk Sansa players. More to be done, probably. 2008-06-02 Linus Walleij * src/libusb-glue.c: refactor PTP_USB to use the raw device and its contained deviceinfo to store and retrieve the device flags. (This is starting to look object oriented...) * src/libusb-glue.h: accessor functions to simplify switching on the device flags and increase the code readability. * src/libmtp.c: use the new accessor functions. 2008-06-01 Linus Walleij * src/libmtp.c: use LIBMTP_Detect_Raw_Devices() and LIBMTP_Open_Raw_Device() inside LIBMTP_Get_First_Device() refactoring. Move params creation into this file. * src/libusb-glue.c: move params creation away from here. 2008-05-30 Linus Walleij * src/libusb-glue.c: unused variable. * examples/detect.c: switch to using raw device interface for opening devices. 2008-05-28 Linus Walleij * src/libmtp.c: internally using the raw devices to get a list of devices. * src/ptp.c: sync to upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. * src/libmtp.h.in: move raw device detection to use error codes. Add interface to open a raw device! * src/libusb-glue.h: make the old device list internal, use raw device in interface for configuring USB. * src/libusb-glue.c: fix up error messages. Move the raw device detection interface to use error codes. * examples/detect.c: fix up error messages. Use error codes for raw devices. 2008-05-23 Linus Walleij * src/libmtp.c: after sending a file, look up the resulting file metadata from the cache to make sure that parent_id is identical to that the file actually gets on the device. If root folder (0) is selected, we hardcode thing to 0xffffffffu to be used as parent, but it will probably end up being 0 for example. Also fix an issue with ptp_mtp_getobjectproplist() sometimes returning a NULL pointer while still claiming there are props in the list. * src/libusb-glue.h: add a function to get the preferred playlist extension. * src/libusb-glue.c: "written" variable in ptp_usb_sendreq() may end up uninitialized if ptp_write_func() fails. Initialize it to 0. Get the prefered playlist extension. 2008-05-18 Richard Low * src/device-flags.h: added DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS device flag * src/music-players.h: ditto. Also set Samsung YH-999 to DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL based on users experience. * src/libmtp.c: added DEVICE_FLAG_BROKEN_SET_SAMPLE_DIMENSIONS device flag 2008-05-05 Linus Walleij * src/libusb-glue.c: assign device name and flags to detected raw devices, slowly preparing to move to using the raw device detection internally as well. 2008-05-04 Linus Walleij * src/libmtp.h.in: move useful filetype macros here so external programs can use them. * src/libmtp.c: consequental changes. * examples/sendtr.c: use the new macro to detect track content. 2008-05-03 Johannes Huber * src/libmtp.h.in: add interface for setting album composer, needed for classical albums, on abstract albums. * src/libmtp.c: implement it. * examples/albums.c: consequental changes. * examples/connect.c: dito. * examples/sendtr.c: dito. * examples/tracks.c: dito. * AUTHORS: new contributor. 2008-04-27 Linus Walleij * src/libmtp.c: recognize audio files as tracks, since this is what WMP does. (e.g. it sets playlength on movies to enable skip bar) also define macros for audio/video/both types and tidy up a bit. 2008-04-24 Linus Walleij * src/libmtp.h.in: added preliminary interface for getting raw devices. * src/libusb-glue.c: the implementation is all here! * src/libusb-glue.h: add some bus and device fields to the internal device list. * examples/detect.c: exercise the raw device detection code. 2008-03-26 Linus Walleij * examples/pathutils.c: fix a folder identification bug, courtesy of Dr Nicholas Jacobs. 2008-03-12 Linus Walleij * configure.ac: bad mailing list address. (Marcus) Bump to version 0.3.0. * examples/hotplug.c: switch from using "info.bus" to using "info.subsystem" to identify USB events. (Marcus). * src/libmtp.c: add parent_id to albums and playlists, based on a patch by Ali Shah. * src/libmtp.h.in: dito. * examples/playlists.c: consequental changes. * examples/albums.c: consequental changes. * This will be a new major revision of the API/ABI no matter what. 2008-03-08 Linus Walleij * src/libusb-glue.c: left debug prints on :-( * configure.ac: set to 0.2.6.1 * Release as 0.2.6.1 2008-03-02 Linus Walleij * configure.ac: prepare 0.2.6 release. * src/Makefile.am: bump to compatible interface, * src/ptp.c: sync in upstream, a Sansa fix! * src/ptp.h: sync in upstream. * doc/Doxyfile.in: retire obsoleted parameters. * Release this as 0.2.6! 2008-02-24 Richard Low * src/music-players.h: add DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL for a broken Philips player. 2008-02-18 Linus Walleij * examples/pathutils.c: fix up item ID typing to uint32_t, handle file names passed in as arguments at suggestion from anonymous mail list user. * examples/pathutils.h: move a function static. 2008-02-12 Nicolas Pennequin * examples/sendtr.c: add transferred tracks to albums if possible. 2008-02-10 Scott Snyder * src/libusb-glue.c: finally fix up the short header detection to skip over zero packets when encountered. * examples/pathutils.c: fix a problem where all files sent has to include a "." (period). 2008-02-06 Linus Walleij * src/libusb-glue.c: wait for response > 0 instead of > 2. 2008-01-28 Linus Walleij * src/libmtp.c: LIBMTP_Get_Filemetadata() return metadata for folders (associations) too. There is really no reason why it shouldn't and it's good for use internally. LIBMTP_Get_Filelisting_With_Callback() will still not return any associations however. We want to use the folder functions for that. 2008-01-28 Linus Walleij * src/libmtp.h.in: withdraw LIBMTP_Set_Object_Parent() function, no known devices will support this. * src/libmtp.c: dito. Fix up some problems with the LIBMTP_Set_Object_Filename() function. 2008-01-27 Linus Walleij * src/libmtp.c: fix up some minor things and documentation on the object handling functions. 2008-01-27 Florent Mertens * src/libmtp.h.in: new functions to rename object filenames and change object parents. Good when modifying the device as a file system, LIBMTP_Set_Object_Filename(), LIBMTP_Set_Object_Parent(). * src/libmtp.c: implementation. 2008-01-27 Linus Walleij * src/libusb-glue.c: re-read response from device until it atleast exceeds two bytes. This fixes a problem with the Samsung YP-U3 when populated with many, many songs. 2008-01-21 Richard Low * src/music-players.h: add Thomson Lyrca HC308A, remove incorrect ID for Creative Zen 8GB 2008-01-20 Richard Low * src/libmtp.c: add LIBMTP_Get_Representative_Sample() * src/libmtp.h.in: ditto 2008-01-14 Linus Walleij * src/libmtp.c: add LIBMTP_Get_Manufacturername(). Remember to bump soname (compatible) in 0.2.6 (or whatever we name it). 0.3.0 perhaps? * src/libmtp.h.in: dito. * src/libmtp.c: detect default folders named "Datacasts" and "Texts". 2008-01-11 Linus Walleij * examples/pathutils.c: recognize .bin files as firmware, used by e.g. RockBox developers. Doesn't cost anything to add. 2008-01-08 Linus Walleij * configure.ac: bump to 0.2.5. * src/Makefile.am: interface to libmtp.so.7.0.2 (compatible). * Release as libmtp 0.2.5. Why not? 2007-12-28 Linus Walleij * src/libmtp.c: make libmtp use PTP_OPC_AlbumArtist on albums, instead of the (seldom present) PTP_OPC_Artist tag. Use both if both are supported. We're not setting AlbumArtist on regular tracks though, what's the point, and what does it mean if this differs from Artist?? 2007-11-30 Linus Walleij * src/music-players.h: new flag for the YP-T10. * src/device-flags.h: define the new flag, that is needed to support Ogg files on these devices. * src/libmtp.c: recognize and report Ogg support, set type to unknown when transferring. 2007-11-22 Linus Walleij * configure.ac: bump to 0.2.4. * src/Makefile.am: bump age of soversion (compatible). * RELEASE 0.2.4 mainly to get some new device support out there. 2007-11-09 Linus Walleij * src/libusb-glue.c: avoid probing deeper into interfaces that have a string describing them as "MTP" after a suggested patch from Alexander Kanavin . * examples/albumart.c: patch from Chris Waters replacing calls to atoi() with calls to strtoul(). Since object ID:s are unsigned long, atoi() would reject too high object IDs. The patch also fix a few memory leaks. THANKS DEBIAN! We love our downstream! * examples/newplaylist.c: dito. * examples/pathutils.c: dito. * examples/thumb.c: dito. 2007-11-05 Linus Walleij * src/libmtp.c: use OPFF codes instead of DPFF codes, we're dealing with objects, not device props. * src/ptp.c: silence some OPFF freeing warnings. 2007-11-02 Linus Walleij * src/libusb-glue.c: try to repair header here instead of ignoring error in ptp.c. * src/music-players.h: flag some more Creative devices as broken getting all files. * src/Makefile.am: reference the 2 new .h files. 2007-10-31 Linus Walleij * src/ptp.c: bring cache handling into this file. * src/ptp.h: dito. * src/libmtp.c: consequential changes. 2007-10-30 Linus Walleij * src/music-players.h: split this off as a shared file between us and libgphoto2 so we get out of the syncing nightmare. * src/device-flags.h: split out this as well, Marcus might want it. * src/libusb-glue.c: consequential movement. * src/libmtp.c: reference new flag file. * src/ptp.c: sync in upstream. * src/ptp.h: dito. 2007-10-25 Linus Walleij * Release 0.2.3. Nice bunch of cleaned-up code, sad we had too bump soversion but such is life. 2007-10-23 Linus Walleij * src/libmtp.c: make LIBMTP_Send_File_From_File_Descriptor() survive the case where device->storage is NULL. This happens on the Nokia 3110c. 2007-10-19 Linus Walleij * src/libmtp.c: bring the cache handling code together at the end of the file, refactor so as to avoid code duplication, do things in one place only and looking good. Get folder list recursively instead, this works better with fast dir retrieveal I think. 2007-10-18 Linus Walleij * src/libmtp.c: fix the deletion of cached properties when removing objects. This code was seriously broken. 2007-10-16 Jeff Mitchell * src/libusb-glue.c: remove the previously-concatenated vendor and product string "name" field as it's now redundant * src/Makefile.am: interface to libmtp.so.7.0.0 (incompatible, device_entry_struct members changed) * examples/hotplug.c: port to use vendor and product instead of name, also some useful commenting in the fdi file 2007-10-15 Linus Walleij * src/libusb-glue.c: repair headers, don't just ignore them. Add support for broken set object proplist devices. Motorola RAZR2 V8 has this problem. * src/libusb-glue.h: flag for broken set object proplist. * libmtp.c: avoid broken set object proplist. 2007-10-09 Jeff Mitchell * src/libusb-glue.c: add separate vendor and product strings in device entry structs * src/libmtp.h.in: update device entry structs to reflect this 2007-10-04 Linus Walleij * src/libusb-glue.c: rm some pointless confusing defines inherited from libgphoto2. * configure.ac: bump to 0.2.2 * src/Makefile.am: interface to libmtp.so.6.0.2 (compatible) * Release as 0.2.2. Now is as good time as ever. Release early and release often. 2007-10-03 Linus Walleij * src/libusb-glue.c: tag the OLD Creative devices with DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL, after clear indications that it was broken when retrieveing folders on all those devices. The newer devices (those supporting 32bit object size) presumably does not have this limitation. 2007-10-02 Linus Walleij * src/libmtp.c: devices which represented file size with a 32bit value (some Creative devices) would return a bananas file size. Fixed it up by... * src/libmtp.h.in: recycling the uint8_t "interface" field in the device struct as a holder of the object size for the device. This will make the new library binary compatible with version 0.2.1 since no-one should *ever* dereference that value (which used to be the USB interface number and is now the object size). * examples/files.c: display 64bit file sizes in hex correctly. 2007-09-29 Richard Low * src/libmtp.c: avoid crash on failed connect 2007-09-28 Linus Walleij * src/libusb-glue.h: introduce a new device flag for devices that have broken PTP headers, first encountered on the Creative ZEN 8GB. * src/libusb-glue.c: attempt to begin to work around the broken PTP headers. 2007-09-25 Linus Walleij * src/libusb-glue.h: add a new device flag for devices that don't like it if you release the interface (or try to clear endpoints). * src/libusb-glue.c: dito, implement this flag, tag all SanDisk Sansa devices with it except for the Linux-based Sansa Connect. 2007-09-23 Richard Low * src/libusb-glue.c: updated some device flags, removed second call to ptp_getdeviceinfo * src/libmtp.c: property cache fixes 2007-09-23 Linus Walleij * src/libmtp.c: wrapped updating of playlists and albums into an abstract function so we do it consistently. Added support for tagging on modification date to files, tracks, playlists and albums. 2007-09-21 Linus Walleij * src/libusb-glue.c: flag the Samsung YH-820 with DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL after tests by Stephan Fabel. 2007-09-18 Linus Walleij * src/libusb-glue.c: stop the endpoint unhalting/unstalling when closing the USB device. It was AYBABTU the Samsungs (and others). 2007-09-17 Linus Walleij * src/libusb-glue.c: silenced weirdo error message. 2007-09-16 Linus Walleij * src/ptp.c: cancellation working *as it should* * src/ptp.h: dito. * src/libusb-glue.c: dito. * src/libusb-glue.h: dito. * src/libmtp.c: dito. * src/libmtp.h.in: new error code for cancellation. 2007-09-16 Richard Low * src/libusb-glue.c: only read descriptors for devices we don't know since it breaks on some devices * src/libmtp.c: a couple of bugs fixed in metadata retreival 2007-09-15 Linus Walleij * src/ptp.c: get cancellation of xfers working. * src/libusb-glue.c: dito. * src/libusb-glue.h: dito. * src/libmtp.c: dito. 2007-09-14 Linus Walleij * src/ptp.h: sync in upstream to get cancellation prototypes. * src/libusb-glue.c: first try to implement cancellation. * src/libmtp.c: dito. Bugfix to one of Marcus' realloc():s. 2007-09-12 Marcus Meissner * src/ptp-pack.c: sync to upstream, rewrote packing to use a static array to be qsort():ed when reading in proplists. * src/ptp.c: reflect changes. * src/ptp.h: reflect changes. * src/libmtp.c: reflect changes. 2007-09-06 Linus Walleij * examples/hotplug.c: edit up into a udev ruleset that is inexorably complicated but probably compatible with most udev versions out there. Now please DON'T update udev styles again! 2007-09-05 Richard Low * src/libmtp.c: album fixups 2007-09-05 Linus Walleij * examples/hotplug.c: use old udev style by default, use new if requested explicitly by a -U switch. 2007-09-04 Linus Walleij * src/libmtp.c: make sure we query recursively supplying each storage ID in turn, so we spin over storages. Also check what storage may be available to store a file, if the first one fails, try the next! 2007-09-01 Linus Walleij * src/ptp-pack.c: make the resulting MTP proplist sorted by object ID. * hotplug.sh.in: explicitly call BASH instead of just sh. Warn if script is not run as root. 2007-08-29 Linus Walleij * examples/Makefile.am: move include define from AM_CFLAGS to AM_CPPFLAGS (as it should be) bug found by Petar Petrov . * src/libusb-glue.c: strange misleading message corrected. Fix up the horrid interface passing back-and-forward and confusing. * src/libusb-glue.h: dito. * src/libmtp.c: rid interface references, that's a USB issue! * src/libmtp.h.in: flag interface number in device struct as retired. 2007-08-28 Linus Walleij * src/libmtp.c: retire the horrid, broken, stream send facility that does not work on any device since they all want to know the file size in advance. Add in some code to fall back on the recursive metadata retrieveal if getting the whole long list fails. * src/libusb-glue.c: tag all Sansas as having broken GetObjectPropList when all tags for all objects are requested. Scan each INTERFACE of the device for device descriptors. 2007-08-24 Linus Walleij * src/libusb-glue.h: new device flag to strip all non-7bit chars from filenames on some lame devices. * src/libusb-glue.c: tag the Philips Shoqbox with this flag. * src/libmtp.c: strip the non-7bit chars from filenames if that flag is set. * src/unicode.h: introduce a 7bit-strip helper function. * src/unicode.c: dito. 2007-08-22 Linus Walleij * src/libmtp.c: deal with setting of metadata sets for u16/u32:s that are ranges or enums, rounding and twiddling if need be. This is needed because some new devices (like the TrekStor Sweez, has duration defined as a range: MIN 0, MAX 65535000, STEP 1 and Sandisk Sansa c240 has duration as range: MIN 0, MAX 2147483000, STEP 1000) whereas old devices would just accept any value. 2007-08-16 Richard Low * src/ptp-pack.c: allow packing of NULL strings 2007-08-15 Robert Reardon * src/libmtp.c: return device max values for representative samples. 2007-08-15 Richard Low * src/libusb-glue.c: added Philips Shoqbox 2007-08-13 Linus Walleij * src/ptp.c: sync to upstream. 2007-08-07 Linus Walleij * configure.ac: bump to 0.2.1. * src/Makefile.am: interface to libmtp.so.6.0.1. * Release libmtp 0.2.1! 2007-08-06 Linus Walleij * configure.ac: tag on the large file support compilation flag. * src/libmtp.c: smack up the data file transfer function so it works again and *finally* should support 64bit sizes! Then wrapped the track sending function around the file sending function so there is no more pointless code duplication giving rise to ever more bugs. Enable LFS, Large File Support so we can handle 64bit files properly. * examples/sendtr.c: shape up print-outs, LFS support. * examples/sendfile.c: dito. 2007-08-06 Linus Walleij * src/ptp.c: fixed a stray error print bug. * src/libmtp.c: overhaul of all proplist setting to follow the same design pattern. Probably fixed a few opd memory leaks along the road. 2007-08-05 Richard Low * src/libmtp.c: send 64 bit filesize 2007-08-04 Linus Walleij * src/libmtp.c: fix up the 64bit filesize and tracksize support. There were some bugs... * src/Makefile.am: tweak interface revision so that we produce libmtp.so.6 now. * configure.ac: bump library revision to 0.2.0. * examples/hotplug.c: switch to use ATTR{} instead of SYSFS{} * Release libmtp 0.2.0! 2007-08-04 Richard Low * src/libusb-glue.c: add Sansa m240 (a different ID to before) Give the Toshiba Gigabeat S DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL. 2007-08-03 Marcus Meissner * m4/byteorder.m4: byteorder fixes. 2007-07-30 Richard Low * src/ptp-pack.c: fix up array packing 2007-07-30 Linus Walleij * src/ptp-pack.c: try to get a uniform 64 bit support, use some old macro code. 2007-07-29 Richard Low * src/libmtp.c: 64 bit filesize support for tracks * src/ptp-pack.c: ditto * src/ptp.h: ditto 2007-07-27 Richard Low * src/libmtp.c: Some better NULL checks 2007-07-27 Linus Walleij * examples/hotplug.c: changed subsystem from "usb_device" to "usb". Presumably a change in the kernel some time ago. 2007-07-21 Richard Low * src/libmtp.c: Correctly bail out of LIBMTP_Get_Storage 2007-07-17 Linus Walleij * examples/reset.c: Add a device reset program. * src/libmtp.c: Add reset command. * src/ptp.c: dito, and sync in upstream changes. * src/ptp.h: dito, and sync in upstream changes. * src/ptp-pack.c: sync in upstream changes. 2007-07-17 Richard Low * src/libmtp.c: Added some more (paranoid) NULL checks 2007-07-14 Richard Low * src/libmtp.c: Add a NULL check 2007-07-13 Richard Low * src/libusb-glue.c: add Disney MixMax 2007-07-11 Linus Walleij * src/libmtp.c: put in Tero's name in the preamble. * src/libusb-glue.c: make the dump function sump out the zuper zecret devize dezcriptorz in clear text hex. 2007-07-10 Linus Walleij * examples/hotplug.c: force HAL OGG support on iriver devices. They all have it! Also force for two other devices that does this. 2007-07-07 Linus Walleij * src/libusb-glue.h: new flag for the case when getting the object property list of all metadata for all objects is broken. * src/libusb-glue.c: tentatively tag a Philips device with this flag. * src/libmtp.c: fixed usage of returned pointers from realloc(), introduce new flag. 2007-07-05 Tero Saarni * src/libmtp.c: update cache when manipulating objects instead of always flushing the whole cache. 2007-07-03 Linus Walleij * src/libmtp.c: use the params->proplist metadata cache. Help rid all flush_handles() you can in order to add even more to the efficiency of the cache. 2007-07-01 Linus Walleij * src/ptp.c: sync to upstream gPhoto source. * src/ptp.h: dito. * src/ptp-pack.c: dito. * src/libmtp.c: use the params->objectinfo object info cache to speed things up considerably. This is exactly what libgphoto2 does so now we move closer to upstream. I believe this also fixes quite a few memory leaks because we weren't freeing the strings inside the objectinfo previously. 2007-05-29 Linus Walleij * src/libmtp.c: use the set object prop list command to set album props if available. Follow metadata set design pattern used for tracks; check first if the object type can set name/artist/genre. 2007-05-24 Jeff Mitchell * hotplug.sh.in: Properly install the HAL FDI rules if the user so chooses to when prompted. 2007-05-24 Jeff Mitchell * examples/hotplug.c: Fix/update HAL output to conform to new specs. Fix whitespacing to be consistent. 2007-05-17 Richard Low * src/libusb-glue.c: added Samsung YH-920 2007-05-11 Linus Walleij * examples/hotplug.c: output a usb.ids map if need be. * sync-usbids.sh: script to assist in comparing our device database to the linux-usb database so we can submit new entries to it more easily. Please extend this until it creates automated diff:s if you can! 2007-05-10 Linus Walleij * src/libusb-glue.c: some new devices, some rewording etc. 2007-05-05 Linus Walleij * src/libusb-glue.h: removed the DUALMODE flag, it's pointless and equal to the problem solved by the UNLOAD_DRIVER flag. * src/libusb-glue.c: dito, move the only DUALMODE flag into an UNLOAD_DRIVER flag. Added Archos Gmini. 2007-05-05 Richard Low * src/libusb-glue.c: added Philips PSA610 * src/libmtp.c: code to recursively get object handles for each assoc. * src/ptp.h: ditto 2007-04-28 Richard Low * src/libusb-glue.c: new device 2007-04-26 Linus Walleij * src/libusb-glue.c: memory leak: dangling, unused pointer killed. 2007-04-23 Linus Walleij * src/libmtp.h.in: extend LIBMTP_album_t to include fields for artist and genre. This is sort of required so we must change the API to have it working properly. * src/libmtp.c: dito. Reflect changes in implementation. 2007-04-18 Linus Walleij * src/ptp.c: sync to upstream gPhoto source. * src/ptp.h: dito. 2007-04-17 Richard Low * src/libusb-glue.c: new device 2007-04-13 Richard Low * src/libusb-glue.c: new devices 2007-04-12 Linus Walleij * examples/hotplug.c: fix GOTO style in udev map. 2007-04-02 Linus Walleij * examples/files.c: some WIN32 64bit prefix fixup. * examples/tracks.c: dito. 2007-03-28 Ted Bullock * examples/*.c: Print library version number on execution of examples. * src/libmtp.h.in: New version number string to aid version echoing. 2007-03-26 Linus Walleij * configure.ac: bump version to 0.1.5, release 0.1.5! * src/Makefile.am: bump lib interface revision to libmtp.so.5.2.1, backwards compatible to libmtp.so.5. 2007-03-24 Richard Low * src/libusb-glue.c: fixed bug in zero read code 2007-03-23 Linus Walleij * src/libmtp.c: refactored MTP property list handling code to make things simple. Removed the flag for MTP enhanced: there are devices that will not work without MTP enhanced (for example the Samsung YP-K5 will only support setting object property lists, not individual object properties, leaving out parts of the MTP basic subset), thus we are allowed to reverse-engineer and implement this for interoperability. I also made the output from LIBMTP_Dump_Device_Info() considerably more verbose, plotting out the ranges and possible enumerated values of all object properties For example you can see that the secret values associated with Audible.com property 0xda01 is an enumerated value that can be 2, 3 or 4 (etc). 2007-03-22 Richard Low * src/ptp.c: PTP_OC_MTP_SetObjPropList implementation * src/ptp.h: ditto * src/libmtp.c: Use PTP_OC_MTP_SetObjPropList when updating track metadata. 2007-03-18 Richard Low * src/libusb-glue.c: new devices. Some of the Samsung players may need DEVICE_FLAG_NO_ZERO_READS to be set - I only know the YP-K5 needs it. 2007-03-16 Linus Walleij * src/libusb-glue.h: introducing yet another device flag for the irivers bugged firmwares, this is for the Alzheimer disease that cause irivers to forget that OGG files are OGG files. * src/libmtp.c: dito. * src/libusb-glue.c: introduce this flag for all iriver devices. * examples/pathutils.c: found a (small) bug. 2007-03-12 Linus Walleij * Makefile.am: cleanup patch from Rafael Laboissiere. * src/libusb-glue.c: refactored device detection code to immediately test if the device is in the known devices list if it does not feature a MTP device descriptor. This fixes the problem of not being able to mix devices with proper descriptors and non-detected devices. 2007-03-07 Linus Walleij * src/libusb-glue.c: remove libgphoto2 functions that we don't use. * src/libusb-glue.h: export the free_mtpdevice_list() function, new signature of find_usb_devices(). * src/libmtp.c: shrink code, pass as list of devices instead of several huge arrays between libmtp.c and USB glue layer in libusb-glue.c using the nifty list struct defined in libusb-glue.h. * Eventually release libmtp 0.1.4. 2007-03-06 Linus Walleij * src/libusb-glue.c: rewrote one more function to be non-recursive, perhaps I found the remaining bug, just cannot see that right now, will test tomorrow. 2007-03-05 Linus Walleij * src/libmtp.c: rewrite recursive function to linear. * src/libusb-glue.h: create a wrapper type for the device list instead of abusing the libusb device "next" field in our code. * src/libusb-glue.c: rewrite all recursive functions to linear, use wrapper objects, don't copy the libusb device struct, instead just store a pointer to it. This magically solved a bug... 2007-03-04 Linus Walleij * src/Makefile.am: bump library interface to libmtp.so.5.2.0 backwards compatible with any libmtp.so.5 interface, for imminent libmtp 0.1.4 release. 2007-03-03 Ted Bullock * src/libusb-glue.c: Don't echo warnings about reading a single extra byte on devices in which DEVICE_FLAG_NO_ZERO_READS has been set * src/libmtp.c: New API function to retrieve the number of devices in a list of connected devices * src/libmtp.h: New API function to retrieve the number of devices in a list of connected devices * examples/detect.c: Use new API function to count number of devices that were detected 2007-03-03 Linus Walleij * src/libusb-glue.h: Tiresome ramblings to explain exactly what the (now renamed) device flag DEVICE_FLAG_NO_ZERO_READS really means. * src/libusb-glue.c: Renamed flag. Indent code :-) Reading the code and being impressed by our ability to iron out the root cause of this kinda weird thing... Fix a few compile warnings. 2007-03-03 Richard Low * src/libusb-glue.c: (hopefully) fixed iRiver read errors. Enabled get object prop lists for Clix since it appears to work. * src/libusb-glue.h: ditto * src/ptp.h: ditto 2007-02-28 Linus Walleij * src/ptp.h: Upstream accepted our patch so synced it in. 2007-02-27 Linus Walleij * src/ptp.c: Synced in upstream version which removes the offending line. * src/libmtp.c: replaces strcmp() for strcasecmp() in folder detection since Windows and some devices (such as iRivers) ignore case and user capital letters for default folders. 2007-02-22 Ted Bullock * src/ptp.c: Comment out line in ptp_exit_fd_handler that was closing a file descriptor. This is not the responsibility of the PTP Layer. Defect and solution found by Rob Reardon 2007-02-26 Linus Walleij * src/libmtp.c: Implement a check for PTP_OC_MTP_SetObjectPropValue in the LIBMTP_Update_Track_Metadata() function, there are obviously devices that do not support this, but only PTP_OC_MTP_SetObjPropList instead (such as the Samsung YH 925-GS), but we haven't implemented that yet. Problems are atleast reported correctly now. 2007-02-24 Richard Low * src/libusb-glue.c: Fix incorrect transfer sizes causing zero write issues 2007-02-23 Linus Walleij * src/libmtp.c: Undeprecate getting first device code. 2007-02-23 Richard Low * src/libmtp.c: Fix crash when no devices connected 2007-02-23 Ted Bullock * examples/detect.c: Stub out probe functionality * src/libusb-glue.c: Remove old uni-device cruft code * src/libusb-glue.h: Remove old uni-device cruft code * Replace LIBMTP_ERROR_N0_DEVICE_ATTACHED with LIBMTP_ERROR_NO_DEVICE_ATTACHED across entire project 2007-02-22 Ted Bullock * examples/albums.c: Updated to use new multi device code * examples/tracks.c: Updated to use new multi device code * examples/files.c: Updated to use new multi device code 2007-02-18 Ted Bullock * src/libmtp.c: Altered the function LIBMTP_Get_First_Device to wrap around the multi device API. Also added deprecation warnings to avoid using this function 2007-02-17 Richard Low * src/libusb-glue.c: Debug output fixes and read/write sizes changed * src/libmtp.c: memset params to 0 to avoid freeing unalloced memory * src/ptp.h: read/write sizes changed 2007-02-15 Robert Reardon * src/libmtp.c: Fix a segfault in new error handling code. 2007-02-15 Linus Walleij * src/libmtp.c: Adding some sanity checks to error stack code. * examples/newplaylist.c: LGPL boilerplate, crediting Robert. * examples/playlists.c: LGPL boilerplate. * examples/sendfile.c: LGPL boilerplate, crediting me and Chris. * examples/sendtr.c: LGPL boilerplate, crediting me, Chris, Shaun, Enrique. * examples/thumb.c: LGPL boilerplate, crediting Robert. * examples/tracks.c: LGPL boilerplate. * examples/trexist.c: LGPL boilerplate, crediting noone. 2007-02-15 Ted Bullock * examples/folders.c: Updated to use new multi device code * src/libmtp.c: Fixed potential memory leaks * src/libusb-glue.c: Fixed potential memory leaks and fixed device release segfault for multiple devices 2007-02-14 Ted Bullock * src/libusb-glue.c: Wrote three new recursive functions to avoid extreme levels of multiple indirection and to clean the code up a bit for multiple devices. * examples/detect.c: Adjusted function calls to use new multiple device code. * src/libmtp.h.in: Added prototype for LIBMTP_Release_Device_List 2007-02-12 Ted Bullock * src/libmtp.c: Two new functions (create_usb_mtp_devices and LIBMTP_Get_Connected_Devices) to add support for multiple devices to client applications * src/libmtp.h: Added LIBMTP_Get_Connected_Devices as a publicly accessible function *libusb-glue.c: Renamed connect_mtp_devices to find_usb_devices *libusb-glue.h: Renamed connect_mtp_devices to find_usb_devices 2007-02-09 Ted Bullock * src/libusb-glue.c: Addressed a number of potential memory leaks in the new multiple device code 2007-02-05 Linus Walleij * src/libmtp.h.in: LGPL boilerplate. * src/libusb-glue.h: LGPL boilerplate. * src/unicode.h: LGPL boilerplate. * src/util.h: LGPL boilerplate. * examples/albumart.c: LGPL boilerplate, crediting Andy. * examples/pathutils.h: LGPL boilerplate, crediting Chris. * examples/pathutils.c: LGPL boilerplate, crediting me and Chris. * examples/common.h: LGPL boilerplate. * examples/albums.c: LGPL boilerplate, crediting Chris. * examples/connect.c: LGPL boilerplate, crediting Chris. * examples/delfile.c: LGPL boilerplate, crediting me and Chris. * examples/detect.c: LGPL boilerplate. * examples/emptyfolders.c: LGPL boilerplate, crediting Andy. * examples/files.c: LGPL boilerplate. * examples/folders.c: LGPL boilerplate. * examples/format.c: LGPL boilerplate. * examples/getfile.c: LGPL boilerplate, crediting me and Chris. * examples/getplaylist.c: LGPL boilerplate. * examples/hotplug.c: LGPL boilerplate, crediting me and Marcus. * examples/newfolder.c: LGPL boilerplate, crediting me and Chris. 2007-02-02 Linus Walleij * src/ptp.c: sync upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. * src/libmtp.c: make changes necessary to handle the new iconv(3) code in ptp-pack.c. People will have to use recent stdlibc, glibc or libiconv. Also call new memory clean-up functions. Fix LGPL boilerplate text. * src/unicode.c: Fix LGPL boilerplate text. * src/utils.c: Fix LGPL boilerplate text. * src/libusb-glue.c: Fix LGPL boilerplate text. 2007-01-24 Ted Bullock * src/libusb-glue.c: new function to retrieve multiple device instances. * src/libusb-glue.h: dito. * src/libmtp.h.in: new error codes. 2007-01-22 Linus Walleij * examples/albumart.c: use the new errostack. * examples/delfile.c: dito. * examples/detect.c: dito. * examples/emptyfolders.c: dito. * examples/format.c: dito. * examples/getfile.c: dito. * examples/getplaylist.c: dito. * examples/newfolder.c: dito. * examples/newplaylist.c: dito. * examples/playlists.c: dito. * examples/sendfile.c: dito. * examples/sendtr.c: dito. * examples/thumb.c: dito. * src/libmtp.c: add some errors to the stack so we can see how it's to be used. (Just a first try...) * src/libusb-glue.c: move the LIBMTP_Get_Supported_Devices() function into this file cause it only return USB devices anyway and could be renamed LIBMTP_Get_Supported_USB_Devices() (but let's not do that renaming since it would break the API). For now let's understand this is a USB-only function by simply putting it in the libusb-glue.c file. 2007-01-22 Ted Bullock * src/libusb-glue.c: first hack at creating an interface to retrieve multiple devices. * src/libmtp.h.in: new error codes related to multiple devices. 2007-01-21 Richard Low * src/libusb-glue.c: more new devices 2007-01-20 Linus Walleij * src/libmtp.h.in: error stack handling like in libnjb. just bare bones implementation as of now but the idea should be clearly visible. TODO: add a plethora of errors and adjust examples to make use of the error stack. * src/libmtp.c: dito. 2007-01-20 Richard Low * src/libusb-glue.c: new device 'Philips PSA235' 2007-01-16 Linus Walleij * configure.ac: bump and release 0.1.3. * src/Makefile.am: bump interface REVISION. Nothing changed externally really. 2007-01-11 Linus Walleij * src/libmtp.sym: updated symbol table for mingw32 but does anyone use this? Also I believe one could auto-generate this some way, just haven't figured out how... Perhaps with a funky script that massage libmtp.h if nothing else. 2007-01-11 Richard Low * src/libusb-glue.c: a zero read fix * src/libmtp.c: fix spelling mistake 2007-01-09 Linus Walleij * src/libusb-glue.c: repair callbacks, structure the code just a little bit. * src/libmtp.c: don't assign values to writes or reads, use the PTP transport intrinsics instead. 2007-01-07 Orson Teodoro * src/ptp.h: Encoding profile. * src/ptp.c: Dito. 2006-01-07 Linus Walleij * src/libusb-glue.c: (re)introduce de-halting of endpoints as this is needed by VMWare emulation. Must check whether this causes problems for other archs! Problem was reported by Orson Teodoro under i686 Gentoo, with a suggested patch. 2006-01-07 Marcus Meissner * src/ptp.c: sync to upstream libgphoto2. * src/ptp.h: dito. * src/ptp-pack.c: dito. * libusb-glue.c: fixes to move low-level functions out of ptp.c and into this libmtp-specific portion. libgphoto2 has been similarly altered to use a usb.c file for the low-level stuff. (This was a long needed split anyway.) 2007-01-03 Richard Low * src/libusb-glue.c: fix zero write bug * src/ptp.c: ditto 2007-01-02 Linus Walleij * src/libusb-glue.c: fix up comments, remove things refering to stuff we don't have. 2007-01-02 Richard Low * src/libmtp.c: another try at split headers/packet sizes * src/ptp.c: ditto * src/libusb-glue.c: ditto 2007-01-01 Linus Walleij * src/libmtp.c: move default setting of split headers off to ptp.c open session. * src/ptp.c: dito. 2007-01-01 Richard Low * src/libmtp.c: split headers/packet size fix * src/ptp.c: ditto * src/ptp.h: ditto * src/libusb-glue.c: ditto 2007-01-01 Orson Teodoro * src/ptp.h: changed some WMDRMND def codes to AAVT def codes. addition of AAVT error codes. * src/ptp.c: changes to reflect modifications done in ptp.h 2006-12-31 Linus Walleij * configure.ac: bump to 0.1.2. * src/Makefile.am: bump interface revision. (Compatible.) * RELEASE 0.1.2. 2006-12-30 Linus Walleij * examples/pathutils.c: reflect new filetypes. * examples/sendtr.c: dito. 2006-12-30 Orson Teodoro * src/ptp.h: added WMDRMPD, WMDRMND, WMPPD, WPDWCN extension codes. added more format object codes flac, m4a, 3gp, aac, xml, xls, ppt, etc. 0x9101-0x910B identfiers are infixed with WMDRMPD. Added more object properties codes (0xDCD3-0xDD72). Added more device property codes. Changed PTP_OFC_MTP_WindowsImageFormat to 0xb881 reflect spec. * src/ptp.c: added changes to reflect new extensions, object codes, device property codes. * src/libmtp.c: modified mp4 to reflect it is a container format not a codec. Added more descriptions in init_filemap(). mp4 container format is ambiguous in LIBMTP_Send_File_From_File_Descriptor(). Audio? video? both?. mp4 searched in video by default. Added comments about this. Added support for the new format object types. * src/libmtp.h.in: added constants to reflect changes to init_filemap(). 2006-12-30 Richard Low * src/libusb-glue.c: fixed bug in debug printing 2006-12-29 Richard Low * src/libmtp.c: Made abstract list creation to be more WMP like * src/libusb-glue.c: added Philips GoGear SA9200 * src/ptp-pack.c: fixed packing bug in ptp_pack_OI 2006-12-29 Marcus Meissner * src/ptp.h: API changes for libgphoto2 to use the file retrieveal functions. * src/ptp.c: dito. * src/libusb-glue.c: changes in libmtp reflecting the new API for libgphoto2. 2006-12-28 Linus Walleij * configure.ac: making older autotools happy. Bump to 0.1.1. * src/Makefile.am: bump interface for release, also autotools. * RELEASE libmtp 0.1.1. 2006-12-19 Matthew Wilcox * src/ptp.c: fix a (serious) short file bug. 2006-12-17 Richard Low * src/libmtp.c: don't bail out on failures when setting metadata. 2006-12-16 Linus Walleij * src/ptp.c: sync to upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. 2006-12-15 Linus Walleij * src/libmtp.h.in: make the format function take a storage as parameter. Add comments to device storage. * src/libmtp.c: dito, fix up some code and docs. * examples/format.c: make the format command comply with the new API. 2006-12-14 Linus Walleij * src/libmtp.c: make get_first_storage_freespace() always query the first storage when the space is requested. And some other janitorial stuff. 2006-12-13 Linus Walleij * src/libusb-glue.c: one more device. * examples/detect.c: compilation warnings fixed. 2006-12-13 Robert Reardon * src/ptp.c: add 0xD901 flag as BuyNow property of objects. * src/ptp.h: ditto. 2006-12-12 Daniel Williams * src/libmtp.h.in: revamped storage API. * src/libmtp.c: dito. * examples/detect.c: dito. 2006-12-12 Robert Reardon * src/libmtp.c: Send_Representative_Sample() updated to set image height and width, or audio duration and size. 2006-12-07 Linus Walleij * src/libmtp.h.in: support firmware object type. (Dangerous.) * src/libmtp.c: dito. 2006-12-07 Linus Walleij * src/libmtp.c: default text folder detection (used in Samsung Yepp T9) also add a few "My Foo" folder strings, remove the "remaining directories" kludge. * src/libmtp.h.in: default text folder. 2006-12-06 Linus Walleij * src/libmtp.h.in: extend the respresentative sample API a bit. * src/libmtp.c: dito. * examples/albumart.c: free memory after use. * examples/thumb.c: dito. * RELEASE this as libmtp 0.1.0! 2006-12-04 Linus Walleij * src/ptp.c: enable split headers on sending object lists again. 2006-12-04 Robert Reardon * src/libmtp.c: abstract Send_Representative_Sample() so it can send samples for any format that supports it * src/libmtp.h.in: same as above * examples/albumart.c: altered to use new abstract function above * example/thumb.c: sample program to upload thumbnails * example/Makefile.am: add sample thumbnail program 2006-12-03 Linus Walleij * src/libmtp.c: check space on disk before sending tracks or files. * src/libmtp.h.in: refactor LIBMTP_Send_Album_Art() into LIBMTP_Send_Representative_Sample(). * src/libmtp.c: dito. * examples/albumart.c: dito. 2006-12-02 Marcus Meissner * examples/Makefile.am: make sure symlinks really end up in the correct dir. 2006-11-30 Linus Walleij * src/ptp.c: make Matthews patch thread-safe and fix it so it will handle more than one surplus packet. * src/ptp.h: dito. 2006-11-30 Richard Low * src/libmtp.c: memset PTPObjectInfo structs to 0 2006-11-30 Matthew Wilcox * src/ptp.c: on some devices, surplus packet data is sometimes returned during read, i.e. a header of the next package is typically attacked to the incoming data, as if someone was sending several packets at once. If this happens we buffer the surplus packet. * src/libusb-glue.c: revert my own mistakes by making them Windows-only. 2006-11-30 Linus Walleij * configure.ac: this *is* gonna be libmtp 0.1.0! * src/Makefile.am: age interface to 4-0-0 to indicate that intefaces have been removed. * src/libmtp.h.in: removed external object interface. * src/libmtp.c: dito. Made all object manipulation functions static. 2006-11-29 Richard Low * src/libusb-glue.c: added new devices 2006-11-29 Linus Walleij * src/libusb-glue.c: remove some pointless #include <> clutter, call usb_set_configuration() as needed by Windows. * src/libmtp.c: various fixups to enable use of Windows include file. * README.windows.txt: added a quick porting guide for MSVC by Farooq Zaman. 2006-11-28 Linus Walleij * src/libmtp.h.in: removed filetype mapping API. We can handle everything inside of libmtp now so no need for this. * src/libmtp.c: dito. 2006-11-27 Linus Walleij * examples/files.c: unsigned int sized printout. * examples/tracks.c: sort of the same. * Makefile.am: HAL style map output by default. 2006-11-26 Richard Low * src/libmtp.c: object handles for proplists * src/ptp-pack.c: ditto * src/ptp.c: ditto * src/ptp.h: ditto 2006-11-25 Marcus Meissner * examples/hotplug.c: adding HAL style XML output for the devices. * examples/Makefile.am: fixing a bug in the automake file (pathutils.h missing!) * Makefile.am: fix the problem with re-making sources (you had to run ./autogen.sh before!) 2006-11-23 Linus Walleij * src/libusb-glue.h: add a new bug flag for devices that have broken PTP_OC_MTP_GetObjPropList implementations. * src/libusb-glue.c: state that all iRivers have this problem. * src/libmtp.c: disable the user of ptp_mtp_getobjectproplist() for these devices. 2006-11-21 Robert Reardon * src/libmtp.c: set handle ids for new objects to 0 when creating new albums and playlists. 2006-11-21 Linus Walleij * src/libmtp.c: enabled enhanced mode for metadata retrieval by default. * src/libmtp.c: fixed the problem with sending files using enhanced commands. 2006-11-20 Linus Walleij * src/ptp.h: sync to upstream libgphoto2 * src/ptp.c: dito. * src/ptp-pack.c: dito. * src/libmtp.c: check for zerolength files/tracks. 2006-11-20 Andy Kelk * src/libmtp.h.in: add "parent_id" property to LIBMTP_track_struct. * src/libmtp.c: get "parent_id" property when reading tracks. * examples/emptyfolders.c: new example program for pruning empty folders. (does a dummy run by default). 2006-11-19 Robert Reardon * src/libmtp.c: use enhanced MTP commands to create playlists and send files * examples/newplaylist.c: demo program for creating new playlists * examples/Makefile.am: add demo newplaylists program 2006-11-19 Daniel Williams * src/libusb-glue.c: fix error on reconnect. 2006-11-18 Richard Low * src/ptp.c: tidy up ptp_usb_getdata 2006-11-17 Richard Low * src/libmtp.c: fixed parent handle for uploaded tracks 2006-11-17 Robert Reardon * src/libmtp.c: fixed up album art using enhanced commands. 2006-11-16 Richard Low * src/libmtp.c: a crude implementation of ptp_mtp_getobjectproplist * src/ptp.c: ditto * src/ptp.h: ditto * src/ptp-pack.c: ditto 2006-11-16 Robert Reardon * src/libmtp.c: use enhanced MTP commands to create albums and add detection of the default album folder. * src/libmtp.h.in: add a holder for album default folder. 2006-11-15 Richard Low * src/ptp-pack.c: set string buffer to correct size. 2006-11-14 Richard Low * examples/tracks.c: really use undeprecated API entry. 2006-11-13 Richard Low , Linus Walleij * src/libmtp.h.in: add LIBMTP_Get_Tracklisting_With_Callback() and LIBMTP_Get_Filelisting_With_Callback() * src/libmtp.c: dito, deprecate LIBMTP_Get_Tracklisting() and LIBMTP_Get_Filelisting() * examples/tracks.c: use undeprecated API entry. * examples/connect.c: ditto. * examples/detect.c: ditto. * examples/files.c: ditto. * src/ptp.c: working on getting object prop lists. * src/ptp.h: dito. 2006-11-12 Richard Low * src/libusb-glue.c: added Zen Vision W to devices 2006-11-07 Richard Low * src/libmtp.c: added checks for supported properties 2006-11-06 Richard Low * src/libmtp.c: added a check for NULL filenames in LIBMTP_Get_Folder_List. 2006-11-01 Linus Walleij * src/libmtp.h.in: set/get uint8 to/from objects * src/libmtp.c: send object property list. * src/ptp.c: dito. * src/ptp.h: dito. * src/ptp-pack.c: dito. 2006-10-29 Andy Kelk * examples/albumart.c: simple tool for adding album art. * src/libmtp.c: graceful handling of players not supporting abstract album objects. 2006-10-27 Linus Walleij * src/Makefile.am: bump library interface to reflect the new album methods. * configure.ac: bump to 0.0.22 for the next release. 2006-10-27 Andy Kelk * src/libmtp.c: add support form abstract audio/video albums. * src/libmtp.h.in: dito. 2006-10-23 Linus Walleij * src/libmtp.c: retire opcode rendering (moved to ptp.c) * src/ptp.c: sync to upstream. * src/ptp.h: dito. * src/ptp-pack.c: dito. 2006-10-20 Linus Walleij * Release 0.0.21 to get all the new device support out. 2006-10-16 Linus Walleij * configure.ac: bump to 0.0.21. * src/libusb-glue.c: add code to unload a kernel driver for the primary interface if it is already in use under Linux. * src/libusb-glue.h: add a device flag to make this possible. 2006-10-11 Linus Walleij * examples/delfile.c: patch from Chris Debenham straingtening out the command-line interface a bit more. 2006-10-10 Linus Walleij * examples/delfile.c: patch from Chris Debenham to make this command take an optional filename as parameter instead of file ID. 2006-09-26 Linus Walleij * libmtp.pc.in: require libusb instead of just linking it. * configure.ac: bump release to 0.0.20 and release. 2006-09-25 Linus Walleij * examples/evolution-sync.sh: example script to illustrate to to transfer calendar, task and contact information to a device supporting this. 2006-09-19 Linus Walleij * src/libmtp.h.in: fixed attribute IDs to be 16bit. * src/libmtp.c: dito. * examples/sendfile.c: support vcard3. 2006-09-16 Linus Walleij * configure.ac: bump to 0.0.19 and release. There are some new devices as well. * src/unicode.c: retire unused code. 2006-09-13 Linus Walleij * examples/format.c: formatting test program. * examples.Makefile.am: added format. 2006-09-13 Andy Kelk * src/libmtp.h.in: added interface to format storage. * src/libmtp.c: dito. * src/ptp.c: dito. * src/ptp.h: dito. 2006-09-12 Linus Walleij * configure.ac: bump release. Released 0.0.18 yesterday. * src/libmtp.c: do not try to read battery max level unless the device supports it. (Bug occurred on Toshiba Gigabeat P10.) 2006-09-11 Linus Walleij * src/libusb-glue.c: messed around a bit with device descriptor detection so as to bring closer to libgphoto2 detection algorithm. I've seen things that might be false positives, possibly USB mass storage devices with additional MSFT descriptors to indicate they have Janus DRM. * src/libmtp.c: use UCS-2-INTERNAL if we're not on glibc. glibc knows that UCS-2 is in machine endianness but Darwin and *BSD does not. Detect C library and switch accordingly. * src/unicode.c: retire old unicode code only keep things we cannot live without. Remove the own internal UCS-2 conversion engine and the internal iconv() engine and use the one already available in PTPParams. * src/unicode.h: dito. 2006-09-07 Linus Walleij * src/libusb-glue.h: added device flags so we can make the code behave differently on certain devices. * src/libusb-glue.c: dito, plus removed some debug prints. * src/libmtp.c: docs. * src/libmtp.h.in: added device_flags to device list struct. * src/Makefile.am: bumped to compatible library interface. * configure.ac: bump version to 0.0.18 (0.0.17 released yesterday). 2006-09-06 Richard Low * src/libusb-glue.c: changed packet sizes to improve transfer speeds. * src/libmtp.c: changed packet sizes to improve transfer transfer speeds. Also stopped extra ptp_getobjectinfo calls when getting directories on connect. 2006-09-06 Linus Walleij * src/libusb-glue.c: fixed some endpoint size detection and sending special file sizes stuff. Real hairy bug... Also messed around a bit with the callbacks. * src/libmtp.c: changes for callback size detection. 2006-09-04 Linus Walleij * src/libmtp.c: bug in streaming code, use defined USB_BULK_HDR_SIZE instead of magic values. 2006-09-02 Linus Walleij * src/libmtp.c: add some code to have LIBMTP_Send_File_From_File_Descriptor() accept a stream if size is set to (uint64_t) -1, plus documentation fixes. I don't think the streaming code will work but whoever want to experiment with it has a place to start. * examples/refactortest.c: removed. Who uses this? 2006-08-30 Linus Walleij * configure.ac: version bump. * src/libmtp.c: more debug prints. * src/libusb-glue.c: new iRiver device called Clix. By the way I released libmtp 0.0.16 yesterday. 2006-08-28 Linus Walleij * configure.ac: version bump. * src/ptp-pack.c: upstream has committed my patch giving full unicode support in libgphoto2 ptp2 camlib. No need for any more ugly workarounds, plus we now have full unicode filenames! * src/ptp.c: dito. * src/ptp.h: dito. * src/libmtp.c: revamp to use the new unicode support in libgphoto2. * src/unicode.c: remove unused functionality. * src/unicode.h: dito. 2006-08-27 Linus Walleij * configure.ac: version bump. Release all these fixes as 0.0.15. * src/libusb-glue.c: fixed sucky errors. Added callback code when reading files. * src/libusb-glue.h: const correctness. * src/libmtp.h.in: finally fixup the type on the callbacks. * src/libmtp.c: more accurate sending callbacks. Callbacks when getting files also, working correctly. Typeing of callbacks now OK. * examples/getfile.c: some display bar cosmetic fixup. * TODO: lots of the things todo are now done. 2006-08-26 Linus Walleij * configure.ac: version bump. * src/libmtp.c: fix bug and reinstate callbacks. * src/libusb-glue.h: dito. * src/libusb-glue.c: dito. 2006-08-25 Linus Walleij * src/libmtp.c: use the new file descriptor sender function. Going to release this as 0.0.13. * src/ptp.c: upstream accepted patches synced in. * src/ptp.h: dito. 2006-08-22 Linus Walleij * src/libusb-glue.c: found a real nasty endpoint bug, code from libgphoto2 was assuming max packet size of 512 bytes while it is 64 when a USB 2.0 device is plugged into an UHCI hub. 2006-08-22 Linus Walleij * configure.ac: bump to 0.0.13, also released 0.0.12 now. 2006-08-21 Linus Walleij * src/libmtp.c: fixup mmap() usage and add madvise() as result of experiments by Gavin McCullagh. Upstream accept patch to get files directly to file descriptor. Move iconv() converters into device struct for thread safety. * src/ptp.c: sync to upstream which merges patch to get file directly to file descriptor. * src/ptp.h: dito. * src/unicode.c: move iconv() converters into the device struct for thread safety. * src/unicode.h: dito. 2006-08-20 Linus Walleij * src/libmtp.h.in: set friendly name and sync partner, rename ownername to friendlyname. * src/libmtp.c: dito. * examples/detect.c: reflect changes. * src/Makefile.am: interface is incompatible so age it. 2006-08-19 Linus Walleij * src/libmtp.h.in: add function to get syncronization partner for the device. * src/libmtp.c: dito. * examples/detect.c: use that function. * src/Makefile.am: backward-compatible interface bump. 2006-08-17 Linus Walleij * configure.ac: bump to 0.0.12 and require iconv.h. 2006-08-16 Linus Walleij * src/unicode.c: remove bigendian weirdness and switch to using iconv() instead. * src/unicode.h: dito. * src/libmtp.c: reflect changes. 2006-08-09 Linus Walleij * Release libmtp 0.0.11. 2006-08-04 Linus Walleij * src/libmtp.c: patch from Dan Aloni to make sendfile use mmap and avoid memory drainage. * src/libusb-glue.c: patch from Andy Kelk to avoid exit():ing when the interface cannot be claimed. * configure.ac: version bump. 2006-07-27 Linus Walleij * Release libmtp 0.0.10. 2006-07-26 Linus Walleij * src/libusb-glue.c: new SanDisk devices. * src/libmtp.c: only set metdata properties supported by the device, duh. * src/ptp.c: sync to upstream. * src/ptp.h: sync to upstream. * configure.ac: bump to 0.0.10. 2006-06-22 Linus Walleij * Release libmtp 0.0.9. 2006-06-21 Linus Walleij * src/libmtp.h.in: added function to retrieve supported filetypes. * src/libmtp.c: ditto. * examples/detect.c: use that function. 2006-06-19 Linus Walleij * src/unicode.c: support all endianness, detect byte-order-mark * src/unicode.h: ditto. * src/libmtp.c: ditto. * examples/detect.c: use proper tempfile function. * src/libmtp.h.in: add some more track properties. * src/libmtp.c: ditto. * examples/tracks.c: ditto. 2006-06-16 Linus Walleij * src/libmtp.h.in: new interfaces for single metadata post retrieveal. * src/libmtp.c: ditto. * examples/playlists.c: display track info using the new individual track metadata retrieveal method. * examples/getplaylist.c: ditto. 2006-06-13 Linus Walleij * src/libmtp.h.in: added default folders to device struct. Add some new function prototypes. * src/libmtp.c: discover and use the default folders if we can find them. Retrieve device secure time and cert out of sheer curiosity. * src/ptp.c: sync to libgphoto2 with my patches. * src/ptp.h: ditto. 2006-06-07 Linus Walleij * src/libmtp.h.in: new playlist API and refactorings. * src/libmtp.c: ditto, and refactorings. * src/unicode.h: const correctness. * src/unicode.c: ditto. * examples/playlists.c: new example program. * configure.ac: bump to 0.0.9 * src/Makefile.am: bump library interface. 2006-06-05 Linus Walleij * examples/sendtr.c: fixed annoying bug that made this program totally useless. * src/libmtp.c: cosmetics. * configure.ac: bump to 0.0.8. 2006-06-03 Linus Walleij * src/libmtp.c: metadata bugs, album name and genre confused. Fixe it and released libmtp 0.0.7. 2006-06-01 Linus Walleij * Released libmtp 0.0.6. 2006-05-31 Linus Walleij * src/libmtp.c: fixed mapping for JPEG vs JFIF * src/libmtp.h.in: added proper type for JPEG * examples/sendfile.c: send proper JPEG type 2006-05-30 Flavien Lebarbe * src/libmtp.c: fixed a bug in update metadata due to bad use of return code. * src/libusb-glue.c: fixed a loop exiting problem with good 'ol GOTO. 2006-05-29 Linus Walleij * src/libusb-glue.c: one more device. * doc/examples.h: produce correct documentation. * configure.ac: bump to 0.0.6. * src/ptp.c: sync to libgphoto2. * src/ptp.h: ditto. * src/ptp-pack.c: ditto. * src/libmtp.c: fixed all filetype API related functions not to use any PTP intrinsic defines at all, made all parameters to functions use the internal libmtp interface enumerations and definitions. Removed LIBMTP_Release(): we can live with the memory lost during init. You're not supposed to re-initialize the device. Consequently removed the delete function that cleaned the filetype assoc list. * examples/refactortest.c: reflect changes. 2006-05-26 Dave Kelly * src/libmtp.c: refactored object handling to be more generic * src/libmtp.h.in: ditto * examples/refactortest.c: Added simple example to use refactoring * examples/getplaylist.c: Added example to extract playlist data * src/ptp.c: Re-added ptp_get/set_objectreferences to allow for playlist handling * src/ptp.h: ditto 2006-05-08 Linus Walleij * src/libmtp.h.in: add simple detection function. * src/libusb-glue.c: implement MTP "OS descriptor" for looking for MTP devices. * examples/detect.c: make it possible to do very rudimentary detection with "detect -p". * configure.ac: bump to 0.0.5. 2006-05-07 Linus Walleij * COPYING: since we no longer use any parts of libptp2 and only files from libgphoto2, we switch to the GNU Lesser General Public License (GNU LGPL). libptp2 is a derived work from libgphoto2, and so is libmtp, there are no remnants of libptp2 in libmtp anymore. 2006-05-04 Linus Walleij * examples/sendfile.c: fixes some more filetypes. * src/libmtp.c: respectfully rearranged to use a filetype mapping table. * src/ptp-pack.c: real nasty unicode packing bug. * Release libmtp 0.0.4. 2006-05-02 Linus Walleij * src/libmtp.c: general shaping up for release. All track and file sending functions now respects a parent ID to be sent along with files and tracks. * src/libmtp.h.in: dito. * src/libusb-glue.c: dito. * examples/sendfile.c: interface dependency changes. * examples/sendtr.c: dito. 2006-04-30 Linus Walleij * src/ptp.c: sync upstream. * src/ptp.h: dito. 2006-04-27 Linus Walleij * examples/sendfile.c: first file sender program based on API implementation and changes by Chris Allegretta. * examples/Makefile.am: new program, new entry. * src/libmtp.c: reflect this new functionality. * src/libmtp.h.in: dito. 2006-04-25 Linus Walleij * Rebased the sources around libgphoto2 instead. This was a major revision... * src/ptp.c: imported libgphoto2 version verbatim. * src/ptp.h: imported libgphoto2 version, minor patch. * src/ptp-pack.c: imported libgphoto2 version, minor patch. * src/ptp-pack.h: dropped, libgphoto2 does not use it. * src/mtp.c: dropped, since all functions are now in ptp.c * src/mtp-pack.c: dropped, same reason. * src/mtp.h: dropped, same reason. * src/mtp-pack.h: dropped, same reason. 2006-04-21 Linus Walleij * Released libmtp 0.0.3 * Bumped source to 0.0.4 2006-04-21 Linus Walleij * src/ptp-pack.c: GCC 4.x compilation patch from Diego Pettenò. * src/libusb-glue.c: New Samsung device and some from libgphoto2. * src/ptp.h: some defines from libgphoto2 to get a bit more compatible. * src/libmtp.c: Added a folder API implementation by Dave "ravelox" Kelly. * src/libmtp.h.in: dito. * examples/folders.c: dito. * examples/newfolder.c: dito. * examples/trexist.c: dito. 2006-03-28 Linus Walleij * m4/*: updated macros to work with GCC 4.1.0. * examples/hotplug.c: new program to create device ID lists. * libmtp.rules: now an auto-generated file. * libmtp.usermap: now an auto-generated file. 2006-03-24 Linus Walleij * Beginning a file API, fixed some example program names and such. 2006-03-18 Linus Walleij * Fixed up callback interface to a simpler version, the old one was bloated stuff from libnjb anyway. Bump to 0.0.2. 2006-03-16 Linus Walleij * Fixed the .h file and implementation so you really only need this one .h file to interface the library. 2006-03-15 Linus Walleij * Added three device information retrieval functions. 2006-03-06 Linus Walleij * Moving some things around to structure the source. More will be needed... 2006-02-27 Linus Walleij * Release libmtp 0.0.1 so people have something to play with, what the heck. Probably saves someones day. 2006-02-24 Linus Walleij * Deltr example program to delete tracks, plus corresponding interface call. 2006-02-23 Linus Walleij * Fixed up sendtr program and metadata tagging function that is used after sending files. 2006-02-22 Linus Walleij * Untested gettr.c and sendtr.c programs to get and send tracks created. 2006-01-30 Linus Walleij * Created the initial GNU source directory structure. * Added the most basic files. libmtp-1.1.10/util/0000755000175000001440000000000012604234355011037 500000000000000libmtp-1.1.10/util/Makefile.in0000644000175000001440000005465712604225567013052 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@ @USE_LINUX_TRUE@bin_PROGRAMS = mtp-hotplug$(EXEEXT) @USE_LINUX_TRUE@mtp_probe_PROGRAMS = mtp-probe$(EXEEXT) subdir = util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/byteorder.m4 \ $(top_srcdir)/m4/iconv.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)/m4/stdint.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__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mtp_probedir)" PROGRAMS = $(bin_PROGRAMS) $(mtp_probe_PROGRAMS) am__mtp_hotplug_SOURCES_DIST = mtp-hotplug.c @USE_LINUX_TRUE@am_mtp_hotplug_OBJECTS = mtp-hotplug.$(OBJEXT) mtp_hotplug_OBJECTS = $(am_mtp_hotplug_OBJECTS) mtp_hotplug_LDADD = $(LDADD) mtp_hotplug_DEPENDENCIES = ../src/libmtp.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__mtp_probe_SOURCES_DIST = mtp-probe.c @USE_LINUX_TRUE@am_mtp_probe_OBJECTS = mtp-probe.$(OBJEXT) mtp_probe_OBJECTS = $(am_mtp_probe_OBJECTS) mtp_probe_LDADD = $(LDADD) mtp_probe_DEPENDENCIES = ../src/libmtp.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(mtp_hotplug_SOURCES) $(mtp_probe_SOURCES) DIST_SOURCES = $(am__mtp_hotplug_SOURCES_DIST) \ $(am__mtp_probe_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)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBUSB_REQUIRES = @LIBUSB_REQUIRES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ 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@ OSFLAGS = @OSFLAGS@ 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@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UDEV = @UDEV@ UDEV_GROUP = @UDEV_GROUP@ UDEV_MODE = @UDEV_MODE@ UDEV_RULES = @UDEV_RULES@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ effective_target = @effective_target@ 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@ ms_lib_exe = @ms_lib_exe@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @USE_LINUX_TRUE@mtp_hotplug_SOURCES = mtp-hotplug.c @USE_LINUX_TRUE@mtp_probedir = @UDEV@ @USE_LINUX_TRUE@mtp_probe_SOURCES = mtp-probe.c AM_CPPFLAGS = -I$(top_builddir)/src LDADD = ../src/libmtp.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 util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign 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): 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 install-mtp_probePROGRAMS: $(mtp_probe_PROGRAMS) @$(NORMAL_INSTALL) @list='$(mtp_probe_PROGRAMS)'; test -n "$(mtp_probedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(mtp_probedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(mtp_probedir)" || 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)$(mtp_probedir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(mtp_probedir)$$dir" || exit $$?; \ } \ ; done uninstall-mtp_probePROGRAMS: @$(NORMAL_UNINSTALL) @list='$(mtp_probe_PROGRAMS)'; test -n "$(mtp_probedir)" || 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)$(mtp_probedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(mtp_probedir)" && rm -f $$files clean-mtp_probePROGRAMS: @list='$(mtp_probe_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 mtp-hotplug$(EXEEXT): $(mtp_hotplug_OBJECTS) $(mtp_hotplug_DEPENDENCIES) $(EXTRA_mtp_hotplug_DEPENDENCIES) @rm -f mtp-hotplug$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_hotplug_OBJECTS) $(mtp_hotplug_LDADD) $(LIBS) mtp-probe$(EXEEXT): $(mtp_probe_OBJECTS) $(mtp_probe_DEPENDENCIES) $(EXTRA_mtp_probe_DEPENDENCIES) @rm -f mtp-probe$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_probe_OBJECTS) $(mtp_probe_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtp-hotplug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtp-probe.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mtp_probedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-mtp_probePROGRAMS 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-mtp_probePROGRAMS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-mtp_probePROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool \ clean-mtp_probePROGRAMS cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-mtp_probePROGRAMS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-mtp_probePROGRAMS .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: libmtp-1.1.10/util/Makefile.am0000644000175000001440000000033012505772321013007 00000000000000if USE_LINUX bin_PROGRAMS=mtp-hotplug mtp_hotplug_SOURCES=mtp-hotplug.c mtp_probedir=@UDEV@ mtp_probe_PROGRAMS=mtp-probe mtp_probe_SOURCES=mtp-probe.c endif AM_CPPFLAGS=-I$(top_builddir)/src LDADD=../src/libmtp.la libmtp-1.1.10/util/mtp-probe.c0000644000175000001440000001642012604206573013034 00000000000000/** * \file mtp-probe.c * Program to probe newly connected device interfaces from * userspace to determine if they are MTP devices, used for * udev rules. * * Invoke the program from udev to check it for MTP signatures, * e.g. * ATTR{bDeviceClass}=="ff", * PROGRAM="/mtp-probe /sys$env{DEVPATH} $attr{busnum} $attr{devnum}", * RESULT=="1", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1", * SYMLINK+="libmtp-%k", MODE="666" * * Is you issue this before testing your /var/log/messages * will be more verbose: * * udevadm control --log-priority=debug * * Exits with status code 1 if the device is an MTP device, * else exits with 0. * * Copyright (C) 2011-2012 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __linux__ #error "This program should only be compiled for Linux!" #endif #include #include #include #include #include #include #include #include #include #include #include enum ep_type { OTHER_EP, BULK_OUT_EP, BULK_IN_EP, INTERRUPT_IN_EP, INTERRUPT_OUT_EP, }; static enum ep_type get_ep_type(char *path) { char pbuf[FILENAME_MAX]; int len = strlen(path); int fd; char buf[128]; int bread; int is_out = 0; int is_in = 0; int is_bulk = 0; int is_interrupt = 0; int i; strcpy(pbuf, path); pbuf[len++] = '/'; /* Check the type */ strncpy(pbuf + len, "type", FILENAME_MAX - len); pbuf[FILENAME_MAX - 1] = '\0'; /* Sentinel */ fd = open(pbuf, O_RDONLY); if (fd < 0) return OTHER_EP; bread = read(fd, buf, sizeof(buf)); close(fd); if (bread < 2) return OTHER_EP; for (i = 0; i < bread; i++) if(buf[i] == 0x0d || buf[i] == 0x0a) buf[i] = '\0'; if (!strcmp(buf, "Bulk")) is_bulk = 1; if (!strcmp(buf, "Interrupt")) is_interrupt = 1; /* Check the direction */ strncpy(pbuf + len, "direction", FILENAME_MAX - len); pbuf[FILENAME_MAX - 1] = '\0'; /* Sentinel */ fd = open(pbuf, O_RDONLY); if (fd < 0) return OTHER_EP; bread = read(fd, buf, sizeof(buf)); close(fd); if (bread < 2) return OTHER_EP; for (i = 0; i < bread; i++) if(buf[i] == 0x0d || buf[i] == 0x0a) buf[i] = '\0'; if (!strcmp(buf, "in")) is_in = 1; if (!strcmp(buf, "out")) is_out = 1; if (is_bulk && is_in) return BULK_IN_EP; if (is_bulk && is_out) return BULK_OUT_EP; if (is_interrupt && is_in) return INTERRUPT_IN_EP; if (is_interrupt && is_out) return INTERRUPT_OUT_EP; return OTHER_EP; } static int has_3_ep(char *path) { char pbuf[FILENAME_MAX]; int len = strlen(path); int fd; char buf[128]; int bread; strcpy(pbuf, path); pbuf[len++] = '/'; strncpy(pbuf + len, "bNumEndpoints", FILENAME_MAX - len); pbuf[FILENAME_MAX - 1] = '\0'; /* Sentinel */ fd = open(pbuf, O_RDONLY); if (fd < 0) return -1; /* Read all contents to buffer */ bread = read(fd, buf, sizeof(buf)); close(fd); if (bread < 2) return 0; /* 0x30, 0x33 = "03", maybe we should parse it? */ if (buf[0] == 0x30 && buf[1] == 0x33) return 1; return 0; } static int check_interface(char *sysfspath) { char dirbuf[FILENAME_MAX]; int len = strlen(sysfspath); DIR *dir; struct dirent *dent; regex_t r; int ret; int bulk_out_ep_found = 0; int bulk_in_ep_found = 0; int interrupt_in_ep_found = 0; ret = has_3_ep(sysfspath); if (ret <= 0) return ret; /* Yes it has three endpoints ... look even closer! */ dir = opendir(sysfspath); if (!dir) return -1; strcpy(dirbuf, sysfspath); dirbuf[len++] = '/'; /* Check for dirs that identify endpoints */ ret = regcomp(&r, "^ep_[0-9a-f]+$", REG_EXTENDED | REG_NOSUB); if (ret) { closedir(dir); return -1; } while ((dent = readdir(dir))) { struct stat st; /* No need to check those beginning with a period */ if (dent->d_name[0] == '.') continue; strncpy(dirbuf + len, dent->d_name, FILENAME_MAX - len); dirbuf[FILENAME_MAX - 1] = '\0'; /* Sentinel */ ret = lstat(dirbuf, &st); if (ret) continue; if (S_ISDIR(st.st_mode) && !regexec(&r, dent->d_name, 0, 0, 0)) { enum ep_type ept; ept = get_ep_type(dirbuf); if (ept == BULK_OUT_EP) bulk_out_ep_found = 1; else if (ept == BULK_IN_EP) bulk_in_ep_found = 1; else if (ept == INTERRUPT_IN_EP) interrupt_in_ep_found = 1; } } regfree(&r); closedir(dir); /* * If this is fulfilled the interface is an MTP candidate */ if (bulk_out_ep_found && bulk_in_ep_found && interrupt_in_ep_found) { return 1; } return 0; } static int check_sysfs(char *sysfspath) { char dirbuf[FILENAME_MAX]; int len = strlen(sysfspath); DIR *dir; struct dirent *dent; regex_t r; int ret; int look_closer = 0; dir = opendir(sysfspath); if (!dir) return -1; strcpy(dirbuf, sysfspath); dirbuf[len++] = '/'; /* Check for dirs that identify interfaces */ ret = regcomp(&r, "^[0-9]+-[0-9]+(.[0-9])?\\:[0-9]+\\.[0-9]+$", REG_EXTENDED | REG_NOSUB); if (ret) { closedir(dir); return -1; } while ((dent = readdir(dir))) { struct stat st; int ret; /* No need to check those beginning with a period */ if (dent->d_name[0] == '.') continue; strncpy(dirbuf + len, dent->d_name, FILENAME_MAX - len); dirbuf[FILENAME_MAX - 1] = '\0'; /* Sentinel */ ret = lstat(dirbuf, &st); if (ret) continue; /* Look closer at dirs that may be interfaces */ if (S_ISDIR(st.st_mode)) { if (!regexec(&r, dent->d_name, 0, 0, 0)) if (check_interface(dirbuf) > 0) /* potential MTP interface! */ look_closer = 1; } } regfree(&r); closedir(dir); return look_closer; } int main (int argc, char **argv) { char *fname; int busno; int devno; int ret; if (argc < 4) { syslog(LOG_INFO, "need device path, busnumber, device number as argument\n"); printf("0"); exit(0); } fname = argv[1]; busno = atoi(argv[2]); devno = atoi(argv[3]); syslog(LOG_INFO, "checking bus %d, device %d: \"%s\"\n", busno, devno, fname); ret = check_sysfs(fname); /* * This means that regular directory check either agrees that this may be a * MTP device, or that it doesn't know (failed). In that case, kick the deeper * check inside LIBMTP. */ if (ret != 0) ret = LIBMTP_Check_Specific_Device(busno, devno); if (ret) { syslog(LOG_INFO, "bus: %d, device: %d was an MTP device\n", busno, devno); printf("1"); } else { syslog(LOG_INFO, "bus: %d, device: %d was not an MTP device\n", busno, devno); printf("0"); } exit(0); } libmtp-1.1.10/util/mtp-hotplug.c0000644000175000001440000002763212503576660013423 00000000000000/** * \file mtp-hotplug.c * Program to create hotplug scripts. * * Copyright (C) 2005-2012 Linus Walleij * Copyright (C) 2006-2008 Marcus Meissner * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include static void usage(void) { fprintf(stderr, "usage: hotplug [-u -H -i -a\"ACTION\"] -p\"DIR\" -g\"GROUP\" -m\"MODE\"\n"); fprintf(stderr, " -w: use hwdb syntax\n"); fprintf(stderr, " -u: use udev syntax\n"); fprintf(stderr, " -o: use old udev syntax\n"); fprintf(stderr, " -H: use hal syntax\n"); fprintf(stderr, " -i: use usb.ids simple list syntax\n"); fprintf(stderr, " -a\"ACTION\": perform udev action ACTION on attachment\n"); fprintf(stderr, " -p\"DIR\": directory where mtp-probe will be installed\n"); fprintf(stderr, " -g\"GROUP\": file group for device nodes\n"); fprintf(stderr, " -m\"MODE\": file mode for device nodes\n"); exit(1); } enum style { style_usbmap, style_udev, style_udev_old, style_hal, style_usbids, style_hwdb }; int main (int argc, char **argv) { LIBMTP_device_entry_t *entries; int numentries; int i; int ret; enum style style = style_usbmap; int opt; extern int optind; extern char *optarg; char *udev_action = NULL; /* * You could tag on MODE="0666" here to enfore writeable * device nodes, use the command line argument for that. * Current udev default rules will make any device tagged * with ENV{ID_MEDIA_PLAYER}=1 writable for the console * user. */ char default_udev_action[] = "SYMLINK+=\"libmtp-%k\", ENV{ID_MTP_DEVICE}=\"1\", ENV{ID_MEDIA_PLAYER}=\"1\""; char *action; // To hold the action actually used. uint16_t last_vendor = 0x0000U; char mtp_probe_dir[256]; char *udev_group= NULL; char *udev_mode = NULL; while ( (opt = getopt(argc, argv, "wuoiHa:p:g:m:")) != -1 ) { switch (opt) { case 'a': udev_action = strdup(optarg); break; case 'u': style = style_udev; break; case 'o': style = style_udev_old; break; case 'H': style = style_hal; break; case 'i': style = style_usbids; break; case 'w': style = style_hwdb; break; case 'p': strncpy(mtp_probe_dir,optarg,sizeof(mtp_probe_dir)); mtp_probe_dir[sizeof(mtp_probe_dir)-1] = '\0'; if (strlen(mtp_probe_dir) <= 1) { printf("Supply some sane mtp-probe dir\n"); exit(1); } /* Make sure the dir ends with '/' */ if (mtp_probe_dir[strlen(mtp_probe_dir)-1] != '/') { int index = strlen(mtp_probe_dir); if (index >= (sizeof(mtp_probe_dir)-1)) { exit(1); } mtp_probe_dir[index] = '/'; mtp_probe_dir[index+1] = '\0'; } /* Don't add the standard udev path... */ if (!strcmp(mtp_probe_dir, "/lib/udev/")) { mtp_probe_dir[0] = '\0'; } break; case 'g': udev_group = strdup(optarg); break; case 'm': udev_mode = strdup(optarg); break; default: usage(); } } if (udev_action != NULL) { action = udev_action; } else { action = default_udev_action; } LIBMTP_Init(); ret = LIBMTP_Get_Supported_Devices_List(&entries, &numentries); if (ret == 0) { switch (style) { case style_udev: printf("# UDEV-style hotplug map for libmtp\n"); printf("# Put this file in /etc/udev/rules.d\n\n"); printf("ACTION!=\"add\", GOTO=\"libmtp_rules_end\"\n"); printf("ENV{MAJOR}!=\"?*\", GOTO=\"libmtp_rules_end\"\n"); printf("SUBSYSTEM==\"usb\", GOTO=\"libmtp_usb_rules\"\n" "GOTO=\"libmtp_rules_end\"\n\n" "LABEL=\"libmtp_usb_rules\"\n\n"); printf("# Some sensitive devices we surely don\'t wanna probe\n"); printf("# Color instruments\n"); printf("ATTR{idVendor}==\"0670\", GOTO=\"libmtp_rules_end\"\n"); printf("ATTR{idVendor}==\"0765\", GOTO=\"libmtp_rules_end\"\n"); printf("ATTR{idVendor}==\"085c\", GOTO=\"libmtp_rules_end\"\n"); printf("ATTR{idVendor}==\"0971\", GOTO=\"libmtp_rules_end\"\n"); printf("# Canon scanners that look like MTP devices (PID 0x22nn)\n"); printf("ATTR{idVendor}==\"04a9\", ATTR{idProduct}==\"22*\", GOTO=\"libmtp_rules_end\"\n"); printf("# Canon digital camera (EOS 3D) that looks like MTP device (PID 0x3113)\n"); printf("ATTR{idVendor}==\"04a9\", ATTR{idProduct}==\"3113\", GOTO=\"libmtp_rules_end\"\n"); printf("# Sensitive Atheros devices that look like MTP devices\n"); printf("ATTR{idVendor}==\"0cf3\", GOTO=\"libmtp_rules_end\"\n"); printf("# Sensitive Atmel JTAG programmers\n"); printf("ATTR{idVendor}==\"03eb\", GOTO=\"libmtp_rules_end\"\n"); printf("# Sensitive Philips device\n"); printf("ATTR{idVendor}==\"0471\", ATTR{idProduct}==\"083f\", GOTO=\"libmtp_rules_end\"\n"); break; case style_udev_old: printf("# UDEV-style hotplug map for libmtp\n"); printf("# Put this file in /etc/udev/rules.d\n\n"); printf("ACTION!=\"add\", GOTO=\"libmtp_rules_end\"\n"); printf("ENV{MAJOR}!=\"?*\", GOTO=\"libmtp_rules_end\"\n"); printf("SUBSYSTEM==\"usb_device\", GOTO=\"libmtp_usb_device_rules\"\n" "GOTO=\"libmtp_rules_end\"\n\n" "LABEL=\"libmtp_usb_device_rules\"\n\n"); break; case style_usbmap: printf("# This usermap will call the script \"libmtp.sh\" whenever a known MTP device is attached.\n\n"); break; case style_hal: printf(" \n"); printf("\n", argv[0]); printf("\n"); printf(" \n"); printf(" \n"); break; case style_usbids: printf("# usb.ids style device list from libmtp\n"); printf("# Compare: http://www.linux-usb.org/usb.ids\n"); break; case style_hwdb: printf("# hardware database file for libmtp supported devices\n"); break; } for (i = 0; i < numentries; i++) { LIBMTP_device_entry_t * entry = &entries[i]; switch (style) { case style_udev: case style_udev_old: printf("# %s %s\n", entry->vendor, entry->product); printf("ATTR{idVendor}==\"%04x\", ATTR{idProduct}==\"%04x\", %s", entry->vendor_id, entry->product_id, action); if (udev_group != NULL) printf(", GROUP=\"%s\"", udev_group); if (udev_mode != NULL) printf(", MODE=\"%s\"", udev_mode); printf("\n"); break; case style_usbmap: printf("# %s %s\n", entry->vendor, entry->product); printf("libmtp.sh 0x0003 0x%04x 0x%04x 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000\n", entry->vendor_id, entry->product_id); break; case style_hal: printf(" \n", entry->vendor, entry->product); printf(" \n", entry->vendor_id); printf(" \n", entry->product_id); /* FIXME: If hal >=0.5.10 can be depended upon, the matches below with contains_not can instead use addset */ printf(" \n"); printf(" portable_audio_player\n"); printf(" \n"); printf(" %s\n", entry->vendor); printf(" %s\n", entry->product); printf(" portable_audio_player\n"); printf(" user\n"); printf(" \n"); printf(" mtp\n"); printf(" \n"); printf(" libmtp\n"); /* FIXME: needs true list of formats ... But all of them can do MP3 and WMA */ printf(" \n"); printf(" audio/mpeg\n"); printf(" \n"); printf(" \n"); printf(" audio/x-ms-wma\n"); printf(" \n"); /* Special hack to support the OGG format - irivers, TrekStor and NormSoft (Palm) can always play these files! */ if (entry->vendor_id == 0x4102 || // iriver entry->vendor_id == 0x066f || // TrekStor entry->vendor_id == 0x1703) { // NormSoft, Inc. printf(" \n"); printf(" application/ogg\n"); printf(" \n"); } printf(" mtp\n"); printf(" \n"); printf(" \n"); break; case style_usbids: if (last_vendor != entry->vendor_id) { printf("%04x\n", entry->vendor_id); } printf("\t%04x %s %s\n", entry->product_id, entry->vendor, entry->product); break; case style_hwdb: printf("# %s %s\n", entry->vendor, entry->product); printf("usb:v%04xp%04x*\n", entry->vendor_id, entry->product_id); printf(" ID_MEDIA_PLAYER=1\n"); printf(" ID_MTP_DEVICE=1\n"); printf("\n"); break; } last_vendor = entry->vendor_id; } } else { printf("Error.\n"); exit(1); } // Then the footer. switch (style) { case style_usbmap: case style_hwdb: break; case style_udev: case style_udev_old: /* * This is code that invokes the mtp-probe program on * every USB device that is either PTP or vendor specific */ printf("\n# Autoprobe vendor-specific, communication and PTP devices\n"); printf("ENV{ID_MTP_DEVICE}!=\"1\", ENV{MTP_NO_PROBE}!=\"1\", ENV{COLOR_MEASUREMENT_DEVICE}!=\"1\", ENV{libsane_matched}!=\"yes\", ATTR{bDeviceClass}==\"00|02|06|ef|ff\", PROGRAM=\"%smtp-probe /sys$env{DEVPATH} $attr{busnum} $attr{devnum}\", RESULT==\"1\", %s", mtp_probe_dir, action); if (udev_group != NULL) printf(", GROUP=\"%s\"", udev_group); if (udev_mode != NULL) printf(", MODE=\"%s\"", udev_mode); printf("\n"); printf("\nLABEL=\"libmtp_rules_end\"\n"); break; case style_hal: printf(" \n"); printf(" \n"); printf("\n"); break; case style_usbids: printf("\n"); } exit (0); } libmtp-1.1.10/config.rpath0000644000175000001440000000000012121274471012272 00000000000000libmtp-1.1.10/libmtp.sh.in0000644000175000001440000000235112121274441012225 00000000000000#!/bin/sh # Lifts a plugged in MTP device to user space and # optionally runs a client program. # Written by Linus Walleij 2006, based on the "usbcam" # script by Nalin Dahyabhai. DEVICEOWNER=root DEVICEPERMS=666 # Special quirk for SuSE systems using "resmgr" # (see http://rechner.lst.de/~okir/resmgr/) if [ -f /sbin/resmgr ] then /sbin/resmgr "${ACTION}" "${DEVICE}" desktop usb exit 0 fi # This is for most other distributions if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then # New code, using lock files instead of copying /dev/console permissions # This also works with non-gdm logins (e.g. on a virtual terminal) # Idea and code from Nalin Dahyabhai if [ "x$DEVICEOWNER" = "xCONSOLE" ] then if [ -f /var/run/console/console.lock ] then DEVICEOWNER=`cat /var/run/console/console.lock` elif [ -f /var/run/console.lock ] then DEVICEOWNER=`cat /var/run/console.lock` elif [ -f /var/lock/console.lock ] then DEVICEOWNER=`cat /var/lock/console.lock` else DEVICEOWNER="nobody" DEVICEPERMS="666" fi fi if [ -n "$DEVICEOWNER" ] then chmod 0000 "${DEVICE}" chown "${DEVICEOWNER}" "${DEVICE}" chmod "${DEVICEPERMS}" "${DEVICE}" fi fi libmtp-1.1.10/configure.ac0000644000175000001440000001574712604225563012307 00000000000000# Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) AC_INIT([libmtp], [1.1.10], [libmtp-discuss@lists.sourceforge.net]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_SRCDIR([src/libmtp.c]) AM_CONFIG_HEADER(config.h) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AM_ICONV # Optionally set install location of udev UDEV=/usr/lib/udev AC_ARG_WITH(udev, AC_HELP_STRING([--with-udev=DIR], [directory where udev is installed [default=/usr/lib/udev]]), [UDEV="${withval}"], []) AC_SUBST(UDEV) # Optionally set name of udev rules file, default # priority is 69, to appear before 70-acl.rules which handles # access control to the devices. We try to let all other userspace # libusb-based device handlers take precedence since libmtp may # attempt to autoprobe the devices. # # Later rules can then use the identifiers for its processing. UDEV_RULES=69-libmtp.rules AC_ARG_WITH(udev-rules, AC_HELP_STRING([--with-udev-rules=NAME], [file name for udev rules [default=69-libmtp.rules]]), [UDEV_RULES="${withval}"], []) AC_SUBST(UDEV_RULES) # Optionally set group for device nodes UDEV_GROUP= AC_ARG_WITH(udev-group, AC_HELP_STRING([--with-udev-group=GROUP], [file group for device nodes [default: none specified]]), [UDEV_GROUP="-g\"${withval}\""], []) AC_SUBST(UDEV_GROUP) # Optionally set mode for device nodes UDEV_MODE= AC_ARG_WITH(udev-mode, AC_HELP_STRING([--with-udev-mode=GROUP], [file mode for device nodes [default: none specified]]), [UDEV_MODE="-m\"${withval}\""], []) AC_SUBST(UDEV_MODE) # Optionally enable and check for doxygen AC_ARG_ENABLE([doxygen], AS_HELP_STRING([--enable-doxygen], [Build API documentation using Doxygen [default=auto]]), [ac_enable_doxygen=$enableval], [ac_enable_doxygen=auto]) if test "x$ac_enable_doxygen" != "xno"; then AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) if test "x$HAVE_DOXYGEN" = "xfalse" -a "x$ac_enable_doxygen" = "xyes"; then AC_MSG_ERROR([*** API documentation explicitly requested but Doxygen not found]) fi if test "x$HAVE_DOXYGEN" = "xtrue"; then AC_MSG_NOTICE([API documentation will be generated using Doxygen]) fi else HAVE_DOXYGEN=false AC_MSG_NOTICE([API documentation will not be generated]) fi AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) # Check for Darwin AC_MSG_CHECKING([if the host operating system is Darwin]) case "$host" in *-darwin*) AC_MSG_RESULT([yes]) CFLAGS="$CFLAGS -DUSE_DARWIN" OSFLAGS="-framework IOKit" ;; *) AC_MSG_RESULT([no]) ;; esac AC_SUBST(OSFLAGS) AC_MSG_CHECKING([if the host operating system is Linux]) AC_TRY_COMPILE([#ifndef __linux__ #error "FAIL" #endif ], [int test;], [ AC_MSG_RESULT(yes) AM_CONDITIONAL(USE_LINUX, true) ], [ AC_MSG_RESULT(no) AM_CONDITIONAL(USE_LINUX, false) ]) # Check for mingw compiler platform AC_MSG_CHECKING([For MinGW32]) case "$host" in *-*-mingw*) AC_MSG_RESULT([yes]) mingw_compiler=yes ;; *) AC_MSG_RESULT([no]) ;; esac AM_CONDITIONAL(COMPILE_MINGW32, [test "$mingw_compiler" = "yes"]) # Check if Microsoft LIB.EXE is available if test "$mingw_compiler" = "yes"; then AC_CHECK_PROG(ms_lib_exe, lib.exe, yes, no) fi AM_CONDITIONAL(MS_LIB_EXE, test x$ms_lib_exe = xyes) # Check for libusb-1.0 PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.0,[ LIBUSB_VER=`pkg-config --modversion libusb-1.0` LIBUSB_REQUIRES='libusb-1.0' AC_DEFINE(HAVE_LIBUSB1, [], [Have libusb 1.0]) found_libusb1_pkg=yes ],[ # Check for libopenusb second AC_CHECK_LIB([openusb], [openusb_init],[ AC_DEFINE(HAVE_OPENUSB, [], [Have libopenusb 1.0]) LIBUSB_VER=1.0 ],[ PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.8, [ LIBUSB_VER=`pkg-config --modversion libusb` LIBUSB_REQUIRES='libusb' AC_DEFINE(HAVE_LIBUSB0, [], [Have libusb 0.x]) found_libusb0_pkg=yes ],[ # Some systems don't use pkg-config for libusb, so double check. AC_CHECK_LIB([usb], [usb_open],[ LIBUSB_VER=0.1 AC_DEFINE(HAVE_LIBUSB0, [], [Have libusb 0.x]) found_libusb0_pkg=yes ],[ AC_MSG_ERROR([*** libusb not found! (missing -dev/-devel package?) ***\n*** prefer to install libusb-1 if you can! ***]) ]) ]) ]) ]) # Optionally disable MTPZ functionality. AC_ARG_ENABLE([mtpz], AC_HELP_STRING([--disable-mtpz], [Disable functionality to connect to MTPZ devices (e.g. Zune)]), [use_mtpz=$enableval], [use_mtpz="yes"]) # Include MTPZ if not disabled. if test x"$use_mtpz" = "xyes" ; then # Check for libgcrypt. AC_MSG_CHECKING([for libgcrypt]) AC_CHECK_LIB([gcrypt], [gcry_check_version], , [AC_MSG_NOTICE([*** libgcrypt not found - disabling MTPZ support ***]) ; use_mtpz="no"]) fi if test x"$use_mtpz" = "xyes" ; then AC_DEFINE(USE_MTPZ, [], [Enable MTPZ functionality]) AC_MSG_NOTICE([MTPZ functionality enabled]); else AC_MSG_NOTICE([MTPZ functionality disable]); fi AC_SUBST(LIBUSB_CFLAGS) AC_SUBST(LIBUSB_LIBS) AC_SUBST(LIBUSB_REQUIRES) AM_CONDITIONAL(MTPZ_COMPILE, test x"$use_mtpz" = "xyes") AM_CONDITIONAL(LIBUSB1_COMPILE, test x"$found_libusb1_pkg" = "xyes") AM_CONDITIONAL(LIBUSB0_COMPILE, test x"$found_libusb0_pkg" = "xyes") AM_CONDITIONAL(LIBOPENUSB_COMPILE, test x"$ac_cv_lib_openusb_openusb_init" = "xyes") AC_MSG_NOTICE([*** using libusb $LIBUSB_VER ***]) # Checks for header files. AC_HEADER_STDC AC_HEADER_TIME # zlib.h the day we need to decompress firmware AC_CHECK_HEADERS([ctype.h errno.h fcntl.h getopt.h libgen.h \ limits.h stdio.h string.h sys/stat.h sys/time.h unistd.h \ langinfo.h locale.h arpa/inet.h byteswap.h sys/uio.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIGNAL AC_TYPE_SIZE_T AC_STRUCT_ST_BLKSIZE # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_FUNC_STAT AC_CHECK_FUNCS(basename memset select strdup strerror strndup strrchr strtoul usleep mkstemp) # Switches. # Enable LFS (Large File Support) AC_SYS_LARGEFILE # Stick in "-Werror" if you want to be more aggressive. # (No need to use AC_SUBST on this default substituted environment variable.) # Only add these additional CFLAGS if we are using GCC. Other C compilers may # not support them. if test x"$GCC" == "xyes" ; then CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" fi # Output files # Create a stdint.h-like file containing size-specific integer definitions # that will always be available. The file is required by the # library, but we provide this anyway because the libptp2 stuff wants this # file. AX_NEED_STDINT_H([src/_stdint.h]) # Create a header file containing NetBSD-style byte swapping macros. # This m4 macros has caused severe pain, I am considering creating a # hard-coded byte swapper that will be eternally portable. AC_NEED_BYTEORDER_H(src/gphoto2-endian.h) AC_CONFIG_FILES([src/libmtp.h doc/Doxyfile Makefile doc/Makefile src/Makefile examples/Makefile util/Makefile libmtp.sh hotplug.sh libmtp.pc]) AC_OUTPUT chmod +x hotplug.sh libmtp-1.1.10/INSTALL0000644000175000001440000002605412121274441011034 00000000000000INSTALLATION OVERVIEW ===================== Once libmtp is built and installed, you will have the following files ($PREFIX is the --prefix option given to the "configure" script and defaults to /usr/local/): $PREFIX/lib/libmtp.a Static C library $PREFIX/lib/libmtp.so.x.y.z Dynamic C library $PREFIX/lib/libmtp.so.x A link to the library $PREFIX/lib/libmtp.so A link to the library $PREFIX/include/libmtp.h C header file for libmtp API $PREFIX/lib/pkgconfig/libmtp.pc pkg-config configuration file Sample programs will be built in the "example" directory, and should help you get used to using the libmtp API, as well as provide some immediate gratification. Links to other programs using the libmtp API may be found at the homepage: http://libmtp.sourceforge.net/ Install From Distribution ------------------------- You should probably prefer to install libmtp from the distribution source you're using. Last time we checked, libmtp was part of Ubuntu, Fedora, OpenSUSE, Debian testing, Gentoo, FreeBSD ports and OpenBSD packages/ports. Dependencies ------------ To build libmtp you should only need development files for libusb. (Often named libusb-devel or similar.) For working with CVS versions you may need autoconf, automake, libtool, gettext(-devel). To enable the optional MTPZ support using libgcrypt you need the libgcrypt library installed as well. Shared Library Support ---------------------- Shared library linking is supported. You will need to 'make install' the library before you can execute the sample binaries, and add the libmtp install directory to your shared library search path. On Linux, you would add the line "/usr/local/lib" to your "/etc/ld.so.conf" or as a oneliner in for example a "/etc/ld.so.conf.d/local.conf" file and run the program "ldconfig" to scan in the shared libraries at the new path. This is a part of the Linux shared library loader actually. To access the library from real odd locations you can use the LD_LIBRARY_PATH environment variable by setting it before you run your program, for example: % export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib % my_program To check whether you need to do something this: % ldd /usr/lib/rhytmbox/plugins/mtpdevice/libmtpdevice.so | grep mtp % ldd /usr/bin/gnomad2 | grep mtp If the program is linking to a packaged version of libmtp it will likely say something like this: libmtp.so.N => /usr/lib/libmtp.so.N (0xb4e4b000) In this case you may have your freshly compiled library in /usr/local/lib or something like that, and you need to do the LD_LIBRARY_PATH trick. Verify by using "ldd" again. This way of enabling the library to link is a workaround hack. Note that the LD_LIBRARY_PATH is actually supposed to be used for testing, not production systems or distributions. It is commonly used as a workaround when a user is installing libraries in her/his home directory however. Read more about this environment variable here: http://www.visi.com/~barr/ldpath.html The shared library comes with different interface version numbers, for example libmtp.so.4, libmtp.so.5 and so forth. This is used so that both old and new libmtp libraries shall be able to coexist on the same system. When you compile your programs they will typically bind to the latest version of the shared library. A link to the latest version is always provided as $PREFIX/lib/libmtp.so. libusb support -------------- This package depends on libusb. Get libusb from sourceforge at: http://www.sourceforge.net/projects/libusb/ libusb 1.0 and later is preferred for libmtp, but currently also older 0.1.x versions of libusb are supported. libgcrypt support ----------------- The MTPZ extension to libmtp requires libgcrypt to be installed. http://www.gnu.org/software/libgcrypt/ MTPZ support will not be built unless the configure script finds libgcrypt. BASIC BUILD PROCEDURE ===================== To build the package: % ./configure % make % make install By default, libmtp will add the program-prefix "mtp-" to all the example programs prior to installation. The program-prefix option makes libmtp sample programs avoid collision with other programs like sox' "play" program. If the default prefix for some reason fail, try to tag on "--program-prefix=mtp-" to the "configure" command. The "libexedir" in the configure file is hardcoded to /lib/udev to make the mtp-probe (which is built for Linux only) install into that directory. This is the only location that makes sens for this executable. if you want to install the documentation type: % make install-docs if you checked out the sources from CVS, you must first run the autogen.sh script that generates all the GNU autotools files. Notice that this requires GNU autoconf, automake and libtool and possibly some other packages like gettext, readline, intltool and other M4 macro sources. This is done with: % ./autogen.sh Linux hotplugging ----------------- After compilation and installation you may (and should) add hotplugging support by running the hotplug script, if your distribution supports hotplugging (all do). This typically means you have something in /etc/hotplug and that hotplugging is started when you boot your machine in a script named /etc/init.d/hotplug or similar. Activate hotplugging by running: %./hotplug.sh Hotplug will (typically) use the device map file installed by hotplug.sh at /etc/hotplug/usb/libmtp.usermap to lift the device to userspace for the current user by running the script /etc/hotplug/usb/libmtp.sh. If you have the program "resmgr" installed (currently used only by SuSE to our knowledge) that program will be used for enabling desktop user access, otherwise the current user of the desktop will be determined from files in /var/run. (See the script "libmtp.sh" for details.) Linux udev hotplugging ---------------------- Newer Linux distributions have dropped support for the old hotplug system and rely solely on udev, and rules stored below /etc/udev/rules.d to handle permissions and actions on device connections. It's quite solid but the whole thing is rather shaky when it comes to such things as custom devices handled solely by libusb, which is what libmtp and for example SANE backends use. The libmtp.rules file that comes with libmtp can be used as a starter. This will set the environment variables ID_MEDIA_PLAYER and ID_MTP_DEVICE to "1" and the former one will be recognized by the scripts distributed by recent versions of udev to be a console-writable device that should be accessible for all users. Ancient udev, HAL, libusb ------------------------- The old script for udev used to set the device access to "666" which is rather nasty (not that big security issue, unless you think someone will break into your jukebox) some systems used to let PAM do this by placing a configuration file in /etc/security/ somewhere. Then it was replaced with simple udev rules. At one point HAL was used to take devices detected by udev and signal to userspace that they were available and provide some information about them. This was unnecessary middleware, it has been killed and most userspace applications now get their information directly from udev instead. In old libusb first you need a crazy rule that creates a device node in the /dev/bus/usb hierarchy whenever any USB device is connected. The script has this at the top, you can comment it in if your distribution does not already create these device nodes. Then libusb may need to be patched to recognize this hierarchy. The 0.1.12 version is the first which is properly fixed. If you cannot run hotplugging ----------------------------- If you have a distro without hotplugging enabled try this as root: % chmod -R a+w /dev/bus/usb Or if it's *really* ancient you could try: % chmod -R a+w /proc/bus/usb You have to do this again every time you unplug/replug your USB cable or restart the jukebox, every time you quit libnjb and restart it, etc etc etc an alternative is to run libmtp as root which works just fine. The problem is to somehow assure that you (ie the current user) always has write access to these files. You can find the Linux hotplug project at: http://linux-hotplug.sourceforge.net/ Compilation for embedded devices -------------------------------- Problems with Autoconf complaining about a missing malloc() function during cross-compilation can be solved with this hack if you're using glibc: % export ac_cv_func_malloc_0_nonnull=yes % ./configure If you're using uclibc you may have to smack in a custom rpl_malloc() function in your program, see the Autoconf texinfo documentation. See further: http://wiki.buici.com/wiki/Autoconf_and_RPL_MALLOC Compilation for Solaris/SunOS ----------------------------- libmtp builds on Solaris/SunOS with either gcc or SunStudio 12. It does require GNU Make (aka gmake) to be installed. Building libmtp on Solaris 10 and Solaris 11 differ slightly, so alternate instructions are provided for each Solaris version. For Solaris 10 -------------- To build using GCC: % CFLAGS="I/usr/sfw/lib -L/usr/sfw/lib -R/usr/sfw/lib" MAKE=gmake \ INSTALL=/usr/ucb/install ./configure % gmake % gmake install Custom CLFAGS are required for libusb.so as it lives in /usr/sfw/lib, and this path is not in the default search path for ld. If these CFLAGS are not set, several components of ./configure will fail leading to a failed build. To build using SunStudio 12: % CFLAGS="I/usr/sfw/lib -L/usr/sfw/lib -R/usr/sfw/lib" MAKE=gmake \ INSTALL=/usr/ucb/install CC=cc ./configure % gmake % gmake install General Notes: All MTP devices on Solaris 10u2+ are driven by the usb_mid driver, which will automatically export ugen device interfaces with the correct device permissions. No special configuration is required. See the usb_mid(7D) and ugen(7D) manpages and /usr/sfw/share/doc/libusb/libusb.txt for more information. For Solaris 11 -------------- Building libmtp on Solaris 11 is very similar to those instructions for Solaris 10, however libusb now lives in /usr/lib, and openusb is also available as an alternative USB library. Oracle does not provide a libusb v1.0 API compatible version of libusb, instead providing the older v0.1 API interface version of libusb. As mentioned, Oracle also provides the OpenUSB USB library as an alternate to libusb v1.0, however OpenUSB is not source or binary compatible with libusb. Before building/installing libmtp there are some components missing from the base Solaris 11 installation, and are required to be installed prior to building/installing libmtp. The 'libusbugen' package must be installed before libusb itself is usable on Solaris 11, alternatively the 'openusb' package may be used. To build using GCC: % ./configure % gmake % sudo gmake install To build using SunStudio 12: % CC=cc ./configure % gmake % sudo gmake install General Notes: All MTP devices on Solaris 11+ are driven by the usb_mid driver, which will automatically export ugen device interfaces with the correct device permissions. No special configuration is required. See the usb_mid(7D) and ugen(7D) manpages and /usr/share/doc/libusb/libusb.txt for more information. libmtp-1.1.10/config.guess0000755000175000001440000012442112601454751012327 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-11-04' # 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;hb=HEAD # # 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-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." 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 case "${UNAME_MACHINE}" in i?86) test -z "$VENDOR" && VENDOR=pc ;; *) test -z "$VENDOR" && VENDOR=unknown ;; esac test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-${VENDOR}-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-${VENDOR}-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-${VENDOR}-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-${VENDOR}-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-${VENDOR}-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-${VENDOR}-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}-${VENDOR}-osf1mk else echo ${UNAME_MACHINE}-${VENDOR}-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-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *: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-${VENDOR}-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-${VENDOR}-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-${VENDOR}-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-${VENDOR}-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-${VENDOR}-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}-${VENDOR}-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-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}-${VENDOR}-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-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}-${VENDOR}-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-${VENDOR}-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-${VENDOR}-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-${VENDOR}-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-${VENDOR}-linux-${LIBC} ;; PA8*) echo hppa2.0-${VENDOR}-linux-${LIBC} ;; *) echo hppa-${VENDOR}-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-${VENDOR}-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-${VENDOR}-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-${VENDOR}-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-${VENDOR}-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-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}-${VENDOR}-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-${VENDOR}-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-${VENODR}-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}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-${VENODR}-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-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-${VENDOR}-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-${VENDOR}-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-${VENDOR}-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if 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 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 ;; *: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}-${VENDOR}-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-${VENDOR}-tops10 exit ;; *:TENEX:*:*) echo pdp10-${VENDOR}-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-${VENDOR}-tops20 exit ;; *:ITS:*:*) echo pdp10-${VENDOR}-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-${VENDOR}-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}-${VENDOR}-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libmtp-1.1.10/missing0000755000175000001440000001533012601454751011404 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: libmtp-1.1.10/examples/0000755000175000001440000000000012604234355011700 500000000000000libmtp-1.1.10/examples/evolution-sync.sh0000755000175000001440000000616212121274441015154 00000000000000#!/bin/bash # Example evolution synchronization script by Nicolas Tetreault, # modified by Linus Walleij. # Define target files SYNC_HOME=$HOME/MTP_device_sync # Define tool locations SENDFILE=`which mtp-sendfile` # SENDFILE="$HOME/comp-apps/bin/sendfile" #EADDEXP=`which evolution-addressbook-export` # This is the location in Fedora Core 5: EADDEXP="/usr/libexec/evolution/2.6/evolution-addressbook-export" # You need to change the name of the files # that contains the calendar and contacts on your device. # You can find out by starting Gnomad2, choose the data transfer # tab, sort by size (it should be small files, extension .ics and .vcf) # On my Zen Microphoto, the calendar and contacts files are called # 6651416 with the ics and vcf extensions, respectively. CALENDAR_FILE="6651416.ics" CONTACTS_FILE="6651416.vcf" # The evolution address book. To list your addressbooks, type: # evolution-addressbook-export -l # the output for me: # "file:///home/nt271/.evolution/addressbook/local/system # ","Personal",26 # "file:///home/nt271/.evolution/addressbook/local/1158600180.5386.0@sierra" # ,"MicroPhoto",24 # I only want the Microphoto addressbook and the output will be # $SYNC_HOME/contacts/Evolution_contacts.vcf EVOLUTION_CONTACTS="file:///home/linus/.evolution/addressbook/local/system" # Check for sync dir, create it if needed if test -d $SYNC_HOME ; then echo "$SYNC_HOME exists, OK." else echo "$SYNC_HOME must first be created..." mkdir $SYNC_HOME # This is a working dir for contact merging, you can put # in some extra .vcf files here as well if you like. mkdir $SYNC_HOME/contacts # Here you can place some extra calendars to be sync:ed, you # can put in some extra .ics files of any kind here. mkdir $SYNC_HOME/calendars fi # Check for prerequisites if test -f $EADDEXP ; then echo "evolution-addressbook-export present in $EADDEXP, OK." else echo "Cannot locate evolution-addressbook-export!!" exit 0 fi # Next line merges all of your tasklist, your personal calendar, # and then any saved to disk calendar you have placed in # $SYNC_HOME/calendars cat $HOME/.evolution/tasks/local/system/tasks.ics \ $HOME/.evolution/calendar/local/system/calendar.ics \ $SYNC_HOME/calendars/*.ics > $SYNC_HOME/$CALENDAR_FILE # Use evolution-addressbook-export (installed with Evolution) to # export your contacts to vcard. $EADDEXP --format=vcard \ --output=$SYNC_HOME/contacts/Evolution_contacts.vcf \ $EVOLUTION_CONTACTS # Repeat for each addressbook you want to upload. # The next command will then merge all the contact lists cat $SYNC_HOME/contacts/*.vcf > $SYNC_HOME/$CONTACTS_FILE # The calendar and contacts files now need to be converted from unix # to DOS linefeeds (CR+LF instead of just LF) unix2dos $SYNC_HOME/$CALENDAR_FILE $SYNC_HOME/$CONTACTS_FILE # You can now upload the ics and vcf files to you My Organizer folder # on your device. Change the path to your sendfile command. # Sending the vcf file is only supported in CVS version at this time $SENDFILE -f "My Organizer" -t ics $SYNC_HOME/$CALENDAR_FILE $SENDFILE -f "My Organizer" -t vcf $SYNC_HOME/$CONTACTS_FILE libmtp-1.1.10/examples/trexist.c0000644000175000001440000000342712121274441013466 00000000000000/** * \file trexist.c * Example program to check if a certain track exists on the device. * * Copyright (C) 2006 The libmtp development team. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include static void usage (void) { fprintf(stderr, "trexist \n"); } int main (int argc, char **argv) { LIBMTP_mtpdevice_t *device; uint32_t id; char *endptr; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); // We need track ID if ( argc != 2 ) { usage(); return 1; } // Sanity check song ID id = strtoul(argv[1], &endptr, 10); if ( *endptr != 0 ) { fprintf(stderr, "illegal value %s\n", argv[1]); return 1; } else if ( ! id ) { fprintf(stderr, "bad song id %u\n", id); return 1; } LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices. Connect/replug device and try again.\n"); exit (0); } printf("%s\n", LIBMTP_Track_Exists(device, id) ? "Yes" : "No"); LIBMTP_Release_Device(device); printf("OK.\n"); exit (0); } libmtp-1.1.10/examples/playlists.c0000644000175000001440000000446612121274441014014 00000000000000/** * \file playlists.c * Example program to list the playlists on a device. * * Copyright (C) 2005-2007 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static void dump_plinfo(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *pl) { uint32_t i; printf("Playlist ID: %d\n", pl->playlist_id); if (pl->name != NULL) printf(" Name: %s\n", pl->name); printf(" Parent ID: %d\n", pl->parent_id); printf(" Tracks:\n"); for (i = 0; i < pl->no_tracks; i++) { LIBMTP_track_t *track; track = LIBMTP_Get_Trackmetadata(device, pl->tracks[i]); if (track != NULL) { printf(" %u: %s - %s\n", pl->tracks[i], track->artist, track->title); LIBMTP_destroy_track_t(track); } else { printf(" %u: INVALID TRACK REFERENCE!\n", pl->tracks[i]); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } } } int main (int argc, char **argv) { LIBMTP_mtpdevice_t *device; LIBMTP_playlist_t *playlists; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); exit (0); } // Get playlist listing. playlists = LIBMTP_Get_Playlist_List(device); if (playlists == NULL) { printf("No playlists.\n"); } else { LIBMTP_playlist_t *pl, *tmp; pl = playlists; while (pl != NULL) { dump_plinfo(device, pl); tmp = pl; pl = pl->next; LIBMTP_destroy_playlist_t(tmp); } } LIBMTP_Release_Device(device); printf("OK.\n"); exit (0); } libmtp-1.1.10/examples/getplaylist.c0000644000175000001440000000474312121274441014327 00000000000000/** * \file getplaylist.c * Example program that lists the abstract playlists on the device. * * Copyright (C) 2005-2007 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include static uint32_t dump_playlist(LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *pl) { uint32_t i; printf("Number of items: %u\n", pl->no_tracks); if(pl->no_tracks > 0) { for(i=0;ino_tracks;i++) { LIBMTP_track_t *track; track = LIBMTP_Get_Trackmetadata(device, pl->tracks[i]); if (track != NULL) { printf(" %u: %s - %s\n", pl->tracks[i], track->artist, track->title); LIBMTP_destroy_track_t(track); } else { printf(" %u: INVALID TRACK REFERENCE!\n", pl->tracks[i]); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } } } return 0; } int main (int argc, char **argv) { LIBMTP_mtpdevice_t *device; LIBMTP_playlist_t *playlist; uint32_t id; char *endptr; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); // We need file ID if ( argc != 2 ) { fprintf(stderr, "Just a playlist ID is required\n"); return 1; } // Sanity check playlist ID id = strtoul(argv[1], &endptr, 10); if ( *endptr != 0 ) { fprintf(stderr, "illegal value %s\n", argv[1]); return 1; } else if ( ! id ) { fprintf(stderr, "bad playlist id %u\n", id); return 1; } LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices. Connect/replug device and try again.\n"); exit (0); } playlist = LIBMTP_Get_Playlist(device,id); if (playlist != NULL) { dump_playlist(device,playlist); } LIBMTP_destroy_playlist_t(playlist); LIBMTP_Release_Device(device); printf("OK.\n"); exit (0); } libmtp-1.1.10/examples/newplaylist.c0000644000175000001440000000602212121274441014331 00000000000000/** * \file newplaylist.c * Example program to create a playlist on a device. * * Copyright (C) 2006 Robert Reardon * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include "string.h" #include #include #include #include #include static void usage(void) { printf("Usage: newplaylist -i -n -s -p \n"); exit(0); } int main (int argc, char **argv) { int opt; extern int optind; extern char *optarg; LIBMTP_mtpdevice_t *device = NULL; int idcount = 0; uint32_t *ids = NULL; uint32_t *tmp = NULL; char *playlistname = NULL; char *rest; uint32_t storageid = 0; uint32_t parentid = 0; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); while ( (opt = getopt(argc, argv, "hn:i:s:p:")) != -1 ) { switch (opt) { case 'h': usage(); case 'i': idcount++; if ((tmp = realloc(ids, sizeof(uint32_t) * (idcount))) == NULL) { printf("realloc failed\n"); return 1; } ids = tmp; ids[(idcount-1)] = strtoul(optarg, &rest, 0); break; case 'n': playlistname = strdup(optarg); break; case 's': storageid = (uint32_t) strtoul(optarg, NULL, 0); break; case 'p': parentid = (uint32_t) strtoul(optarg, NULL, 0); break; default: usage(); } } argc -= optind; argv += optind; if ( playlistname == NULL) { printf("You need to supply a playlist name.\n"); usage(); } if (idcount == 0) { printf("You need to supply one or more track IDs\n"); usage(); } LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); return 0; } LIBMTP_playlist_t *playlist = LIBMTP_new_playlist_t(); playlist->name = playlistname; playlist->no_tracks = idcount; playlist->tracks = ids; playlist->parent_id = parentid; playlist->storage_id = storageid; int ret = LIBMTP_Create_New_Playlist(device,playlist); if (ret != 0) { printf("Couldn't create playlist object\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } else { printf("Created new playlist: %u\n", playlist->playlist_id); } LIBMTP_Release_Device(device); printf("OK.\n"); return 0; } libmtp-1.1.10/examples/Makefile.in0000644000175000001440000007261212604225567013702 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 = mtp-connect$(EXEEXT) mtp-detect$(EXEEXT) \ mtp-tracks$(EXEEXT) mtp-files$(EXEEXT) mtp-folders$(EXEEXT) \ mtp-trexist$(EXEEXT) mtp-playlists$(EXEEXT) \ mtp-getplaylist$(EXEEXT) mtp-format$(EXEEXT) \ mtp-albumart$(EXEEXT) mtp-albums$(EXEEXT) \ mtp-newplaylist$(EXEEXT) mtp-emptyfolders$(EXEEXT) \ mtp-thumb$(EXEEXT) mtp-reset$(EXEEXT) mtp-filetree$(EXEEXT) subdir = examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/byteorder.m4 \ $(top_srcdir)/m4/iconv.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)/m4/stdint.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__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_mtp_albumart_OBJECTS = albumart.$(OBJEXT) util.$(OBJEXT) mtp_albumart_OBJECTS = $(am_mtp_albumart_OBJECTS) mtp_albumart_LDADD = $(LDADD) mtp_albumart_DEPENDENCIES = ../src/libmtp.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_mtp_albums_OBJECTS = albums.$(OBJEXT) util.$(OBJEXT) mtp_albums_OBJECTS = $(am_mtp_albums_OBJECTS) mtp_albums_LDADD = $(LDADD) mtp_albums_DEPENDENCIES = ../src/libmtp.la am_mtp_connect_OBJECTS = connect.$(OBJEXT) delfile.$(OBJEXT) \ getfile.$(OBJEXT) newfolder.$(OBJEXT) sendfile.$(OBJEXT) \ sendtr.$(OBJEXT) pathutils.$(OBJEXT) util.$(OBJEXT) mtp_connect_OBJECTS = $(am_mtp_connect_OBJECTS) mtp_connect_LDADD = $(LDADD) mtp_connect_DEPENDENCIES = ../src/libmtp.la am_mtp_detect_OBJECTS = detect.$(OBJEXT) util.$(OBJEXT) mtp_detect_OBJECTS = $(am_mtp_detect_OBJECTS) mtp_detect_LDADD = $(LDADD) mtp_detect_DEPENDENCIES = ../src/libmtp.la am_mtp_emptyfolders_OBJECTS = emptyfolders.$(OBJEXT) util.$(OBJEXT) mtp_emptyfolders_OBJECTS = $(am_mtp_emptyfolders_OBJECTS) mtp_emptyfolders_LDADD = $(LDADD) mtp_emptyfolders_DEPENDENCIES = ../src/libmtp.la am_mtp_files_OBJECTS = files.$(OBJEXT) util.$(OBJEXT) mtp_files_OBJECTS = $(am_mtp_files_OBJECTS) mtp_files_LDADD = $(LDADD) mtp_files_DEPENDENCIES = ../src/libmtp.la am_mtp_filetree_OBJECTS = filetree.$(OBJEXT) util.$(OBJEXT) mtp_filetree_OBJECTS = $(am_mtp_filetree_OBJECTS) mtp_filetree_LDADD = $(LDADD) mtp_filetree_DEPENDENCIES = ../src/libmtp.la am_mtp_folders_OBJECTS = folders.$(OBJEXT) util.$(OBJEXT) mtp_folders_OBJECTS = $(am_mtp_folders_OBJECTS) mtp_folders_LDADD = $(LDADD) mtp_folders_DEPENDENCIES = ../src/libmtp.la am_mtp_format_OBJECTS = format.$(OBJEXT) util.$(OBJEXT) mtp_format_OBJECTS = $(am_mtp_format_OBJECTS) mtp_format_LDADD = $(LDADD) mtp_format_DEPENDENCIES = ../src/libmtp.la am_mtp_getplaylist_OBJECTS = getplaylist.$(OBJEXT) util.$(OBJEXT) mtp_getplaylist_OBJECTS = $(am_mtp_getplaylist_OBJECTS) mtp_getplaylist_LDADD = $(LDADD) mtp_getplaylist_DEPENDENCIES = ../src/libmtp.la am_mtp_newplaylist_OBJECTS = newplaylist.$(OBJEXT) util.$(OBJEXT) mtp_newplaylist_OBJECTS = $(am_mtp_newplaylist_OBJECTS) mtp_newplaylist_LDADD = $(LDADD) mtp_newplaylist_DEPENDENCIES = ../src/libmtp.la am_mtp_playlists_OBJECTS = playlists.$(OBJEXT) util.$(OBJEXT) mtp_playlists_OBJECTS = $(am_mtp_playlists_OBJECTS) mtp_playlists_LDADD = $(LDADD) mtp_playlists_DEPENDENCIES = ../src/libmtp.la am_mtp_reset_OBJECTS = reset.$(OBJEXT) util.$(OBJEXT) mtp_reset_OBJECTS = $(am_mtp_reset_OBJECTS) mtp_reset_LDADD = $(LDADD) mtp_reset_DEPENDENCIES = ../src/libmtp.la am_mtp_thumb_OBJECTS = thumb.$(OBJEXT) util.$(OBJEXT) mtp_thumb_OBJECTS = $(am_mtp_thumb_OBJECTS) mtp_thumb_LDADD = $(LDADD) mtp_thumb_DEPENDENCIES = ../src/libmtp.la am_mtp_tracks_OBJECTS = tracks.$(OBJEXT) util.$(OBJEXT) mtp_tracks_OBJECTS = $(am_mtp_tracks_OBJECTS) mtp_tracks_LDADD = $(LDADD) mtp_tracks_DEPENDENCIES = ../src/libmtp.la am_mtp_trexist_OBJECTS = trexist.$(OBJEXT) util.$(OBJEXT) mtp_trexist_OBJECTS = $(am_mtp_trexist_OBJECTS) mtp_trexist_LDADD = $(LDADD) mtp_trexist_DEPENDENCIES = ../src/libmtp.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(mtp_albumart_SOURCES) $(mtp_albums_SOURCES) \ $(mtp_connect_SOURCES) $(mtp_detect_SOURCES) \ $(mtp_emptyfolders_SOURCES) $(mtp_files_SOURCES) \ $(mtp_filetree_SOURCES) $(mtp_folders_SOURCES) \ $(mtp_format_SOURCES) $(mtp_getplaylist_SOURCES) \ $(mtp_newplaylist_SOURCES) $(mtp_playlists_SOURCES) \ $(mtp_reset_SOURCES) $(mtp_thumb_SOURCES) \ $(mtp_tracks_SOURCES) $(mtp_trexist_SOURCES) DIST_SOURCES = $(mtp_albumart_SOURCES) $(mtp_albums_SOURCES) \ $(mtp_connect_SOURCES) $(mtp_detect_SOURCES) \ $(mtp_emptyfolders_SOURCES) $(mtp_files_SOURCES) \ $(mtp_filetree_SOURCES) $(mtp_folders_SOURCES) \ $(mtp_format_SOURCES) $(mtp_getplaylist_SOURCES) \ $(mtp_newplaylist_SOURCES) $(mtp_playlists_SOURCES) \ $(mtp_reset_SOURCES) $(mtp_thumb_SOURCES) \ $(mtp_tracks_SOURCES) $(mtp_trexist_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)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_DOXYGEN = @HAVE_DOXYGEN@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBUSB_REQUIRES = @LIBUSB_REQUIRES@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ 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@ OSFLAGS = @OSFLAGS@ 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@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UDEV = @UDEV@ UDEV_GROUP = @UDEV_GROUP@ UDEV_MODE = @UDEV_MODE@ UDEV_RULES = @UDEV_RULES@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ effective_target = @effective_target@ 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@ ms_lib_exe = @ms_lib_exe@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ mtp_connect_SOURCES = connect.c connect.h delfile.c getfile.c newfolder.c \ sendfile.c sendtr.c pathutils.c pathutils.h \ util.c util.h common.h mtp_detect_SOURCES = detect.c util.c util.h common.h mtp_tracks_SOURCES = tracks.c util.c util.h common.h mtp_files_SOURCES = files.c util.c util.h common.h mtp_folders_SOURCES = folders.c util.c util.h common.h mtp_trexist_SOURCES = trexist.c util.c util.h common.h mtp_playlists_SOURCES = playlists.c util.c util.h common.h mtp_getplaylist_SOURCES = getplaylist.c util.c util.h common.h mtp_newplaylist_SOURCES = newplaylist.c util.c util.h common.h mtp_format_SOURCES = format.c util.c util.h common.h mtp_albumart_SOURCES = albumart.c util.c util.h common.h mtp_albums_SOURCES = albums.c util.c util.h common.h mtp_emptyfolders_SOURCES = emptyfolders.c util.c util.h common.h mtp_thumb_SOURCES = thumb.c util.c util.h common.h mtp_reset_SOURCES = reset.c util.c util.h common.h mtp_filetree_SOURCES = filetree.c util.c util.h common.h AM_CPPFLAGS = -I$(top_builddir)/src LDADD = ../src/libmtp.la EXTRA_DIST = evolution-sync.sh 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 examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign examples/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || 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 mtp-albumart$(EXEEXT): $(mtp_albumart_OBJECTS) $(mtp_albumart_DEPENDENCIES) $(EXTRA_mtp_albumart_DEPENDENCIES) @rm -f mtp-albumart$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_albumart_OBJECTS) $(mtp_albumart_LDADD) $(LIBS) mtp-albums$(EXEEXT): $(mtp_albums_OBJECTS) $(mtp_albums_DEPENDENCIES) $(EXTRA_mtp_albums_DEPENDENCIES) @rm -f mtp-albums$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_albums_OBJECTS) $(mtp_albums_LDADD) $(LIBS) mtp-connect$(EXEEXT): $(mtp_connect_OBJECTS) $(mtp_connect_DEPENDENCIES) $(EXTRA_mtp_connect_DEPENDENCIES) @rm -f mtp-connect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_connect_OBJECTS) $(mtp_connect_LDADD) $(LIBS) mtp-detect$(EXEEXT): $(mtp_detect_OBJECTS) $(mtp_detect_DEPENDENCIES) $(EXTRA_mtp_detect_DEPENDENCIES) @rm -f mtp-detect$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_detect_OBJECTS) $(mtp_detect_LDADD) $(LIBS) mtp-emptyfolders$(EXEEXT): $(mtp_emptyfolders_OBJECTS) $(mtp_emptyfolders_DEPENDENCIES) $(EXTRA_mtp_emptyfolders_DEPENDENCIES) @rm -f mtp-emptyfolders$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_emptyfolders_OBJECTS) $(mtp_emptyfolders_LDADD) $(LIBS) mtp-files$(EXEEXT): $(mtp_files_OBJECTS) $(mtp_files_DEPENDENCIES) $(EXTRA_mtp_files_DEPENDENCIES) @rm -f mtp-files$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_files_OBJECTS) $(mtp_files_LDADD) $(LIBS) mtp-filetree$(EXEEXT): $(mtp_filetree_OBJECTS) $(mtp_filetree_DEPENDENCIES) $(EXTRA_mtp_filetree_DEPENDENCIES) @rm -f mtp-filetree$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_filetree_OBJECTS) $(mtp_filetree_LDADD) $(LIBS) mtp-folders$(EXEEXT): $(mtp_folders_OBJECTS) $(mtp_folders_DEPENDENCIES) $(EXTRA_mtp_folders_DEPENDENCIES) @rm -f mtp-folders$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_folders_OBJECTS) $(mtp_folders_LDADD) $(LIBS) mtp-format$(EXEEXT): $(mtp_format_OBJECTS) $(mtp_format_DEPENDENCIES) $(EXTRA_mtp_format_DEPENDENCIES) @rm -f mtp-format$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_format_OBJECTS) $(mtp_format_LDADD) $(LIBS) mtp-getplaylist$(EXEEXT): $(mtp_getplaylist_OBJECTS) $(mtp_getplaylist_DEPENDENCIES) $(EXTRA_mtp_getplaylist_DEPENDENCIES) @rm -f mtp-getplaylist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_getplaylist_OBJECTS) $(mtp_getplaylist_LDADD) $(LIBS) mtp-newplaylist$(EXEEXT): $(mtp_newplaylist_OBJECTS) $(mtp_newplaylist_DEPENDENCIES) $(EXTRA_mtp_newplaylist_DEPENDENCIES) @rm -f mtp-newplaylist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_newplaylist_OBJECTS) $(mtp_newplaylist_LDADD) $(LIBS) mtp-playlists$(EXEEXT): $(mtp_playlists_OBJECTS) $(mtp_playlists_DEPENDENCIES) $(EXTRA_mtp_playlists_DEPENDENCIES) @rm -f mtp-playlists$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_playlists_OBJECTS) $(mtp_playlists_LDADD) $(LIBS) mtp-reset$(EXEEXT): $(mtp_reset_OBJECTS) $(mtp_reset_DEPENDENCIES) $(EXTRA_mtp_reset_DEPENDENCIES) @rm -f mtp-reset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_reset_OBJECTS) $(mtp_reset_LDADD) $(LIBS) mtp-thumb$(EXEEXT): $(mtp_thumb_OBJECTS) $(mtp_thumb_DEPENDENCIES) $(EXTRA_mtp_thumb_DEPENDENCIES) @rm -f mtp-thumb$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_thumb_OBJECTS) $(mtp_thumb_LDADD) $(LIBS) mtp-tracks$(EXEEXT): $(mtp_tracks_OBJECTS) $(mtp_tracks_DEPENDENCIES) $(EXTRA_mtp_tracks_DEPENDENCIES) @rm -f mtp-tracks$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_tracks_OBJECTS) $(mtp_tracks_LDADD) $(LIBS) mtp-trexist$(EXEEXT): $(mtp_trexist_OBJECTS) $(mtp_trexist_DEPENDENCIES) $(EXTRA_mtp_trexist_DEPENDENCIES) @rm -f mtp-trexist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtp_trexist_OBJECTS) $(mtp_trexist_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/albumart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/albums.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/detect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emptyfolders.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/files.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filetree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/folders.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getplaylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newfolder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newplaylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pathutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playlists.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendtr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thumb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trexist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS @$(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-binPROGRAMS .MAKE: install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-hook install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS .PRECIOUS: Makefile install-exec-hook: ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-delfile$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-getfile$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-newfolder$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendfile$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendtr$(EXEEXT) # 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: libmtp-1.1.10/examples/filetree.c0000644000175000001440000001013412246425460013563 00000000000000/** * \file filetree.c * List all files and folders of all storages recursively * * Copyright (C) 2011 Linus Walleij * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include "util.h" #include #include #include #include #include /* Clever prototype to be able to recurse */ void recursive_file_tree(LIBMTP_mtpdevice_t *, LIBMTP_devicestorage_t *, uint32_t, int); void recursive_file_tree(LIBMTP_mtpdevice_t *device, LIBMTP_devicestorage_t *storage, uint32_t leaf, int depth) { LIBMTP_file_t *files; LIBMTP_file_t *file; files = LIBMTP_Get_Files_And_Folders(device, storage->id, leaf); if (files == NULL) { return; } /* Iterate over the filelisting */ file = files; while (file != NULL) { int i; LIBMTP_file_t *oldfile; /* Indent */ for (i = 0; i < depth; i++) { printf(" "); } printf("%u %s\n", file->item_id, file->filename); if (file->filetype == LIBMTP_FILETYPE_FOLDER) { recursive_file_tree(device, storage, file->item_id, depth+2); } oldfile = file; file = file->next; LIBMTP_destroy_file_t(oldfile); } } int main (int argc, char **argv) { LIBMTP_raw_device_t * rawdevices; int numrawdevices; LIBMTP_error_number_t err; int i; int opt; extern int optind; extern char *optarg; while ((opt = getopt(argc, argv, "d")) != -1 ) { switch (opt) { case 'd': LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); break; } } argc -= optind; argv += optind; LIBMTP_Init(); err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); switch(err) { case LIBMTP_ERROR_NO_DEVICE_ATTACHED: fprintf(stdout, " No raw devices found.\n"); return 0; case LIBMTP_ERROR_CONNECTING: fprintf(stderr, "Detect: There has been an error connecting. Exiting\n"); return 1; case LIBMTP_ERROR_MEMORY_ALLOCATION: fprintf(stderr, "Detect: Encountered a Memory Allocation Error. Exiting\n"); return 1; case LIBMTP_ERROR_NONE: break; case LIBMTP_ERROR_GENERAL: default: fprintf(stderr, "Unknown connection error.\n"); return 1; } /* Iterate over connected MTP devices */ fprintf(stdout, "Attempting to connect device(s)\n"); for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; char *friendlyname; int ret; device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); if (device == NULL) { fprintf(stderr, "Unable to open raw device %d\n", i); continue; } LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); friendlyname = LIBMTP_Get_Friendlyname(device); if (friendlyname == NULL) { printf("Device: (NULL)\n"); } else { printf("Device: %s\n", friendlyname); free(friendlyname); } /* Get all storages for this device */ ret = LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED); if (ret != 0) { perror("LIBMTP_Get_Storage()"); goto bailout; } /* Loop over storages */ for (storage = device->storage; storage != 0; storage = storage->next) { fprintf(stdout, "Storage: %s\n", storage->StorageDescription); recursive_file_tree(device, storage, 0, 0); } bailout: LIBMTP_Release_Device(device); } /* End For Loop */ free(rawdevices); printf("OK.\n"); return 0; } libmtp-1.1.10/examples/Makefile.am0000644000175000001440000000315512121274441013652 00000000000000bin_PROGRAMS=mtp-connect mtp-detect mtp-tracks mtp-files \ mtp-folders mtp-trexist mtp-playlists mtp-getplaylist \ mtp-format mtp-albumart mtp-albums mtp-newplaylist mtp-emptyfolders \ mtp-thumb mtp-reset mtp-filetree mtp_connect_SOURCES=connect.c connect.h delfile.c getfile.c newfolder.c \ sendfile.c sendtr.c pathutils.c pathutils.h \ util.c util.h common.h mtp_detect_SOURCES=detect.c util.c util.h common.h mtp_tracks_SOURCES=tracks.c util.c util.h common.h mtp_files_SOURCES=files.c util.c util.h common.h mtp_folders_SOURCES=folders.c util.c util.h common.h mtp_trexist_SOURCES=trexist.c util.c util.h common.h mtp_playlists_SOURCES=playlists.c util.c util.h common.h mtp_getplaylist_SOURCES=getplaylist.c util.c util.h common.h mtp_newplaylist_SOURCES=newplaylist.c util.c util.h common.h mtp_format_SOURCES=format.c util.c util.h common.h mtp_albumart_SOURCES=albumart.c util.c util.h common.h mtp_albums_SOURCES=albums.c util.c util.h common.h mtp_emptyfolders_SOURCES=emptyfolders.c util.c util.h common.h mtp_thumb_SOURCES=thumb.c util.c util.h common.h mtp_reset_SOURCES=reset.c util.c util.h common.h mtp_filetree_SOURCES=filetree.c util.c util.h common.h AM_CPPFLAGS=-I$(top_builddir)/src LDADD=../src/libmtp.la EXTRA_DIST=evolution-sync.sh install-exec-hook: ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-delfile$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-getfile$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-newfolder$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendfile$(EXEEXT) ln -f -s mtp-connect$(EXEEXT) $(DESTDIR)$(bindir)/mtp-sendtr$(EXEEXT) libmtp-1.1.10/examples/pathutils.h0000644000175000001440000000217312121274441014003 00000000000000/** * \file pathutils.h * * Copyright (C) 2006 Chris A. Debenham * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef PATHUTILS_H_INCLUSION_GUARD #define PATHUTILS_H_INCLUSION_GUARD int parse_path (char *, LIBMTP_file_t *, LIBMTP_folder_t *); LIBMTP_filetype_t find_filetype (const char *); int progress (const uint64_t, const uint64_t, void const * const); #ifndef HAVE_LIBGEN_H char *basename(char *in); #endif #endif libmtp-1.1.10/examples/folders.c0000644000175000001440000000751412246425460013432 00000000000000/** * \file folders.c * Example program that lists all folders on a device. * * Copyright (C) 2005-2011 Linus Walleij * Copyright (C) 2007 Ted Bullock * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static void dump_folder_list(LIBMTP_folder_t *folderlist, int level) { int i; if(folderlist==NULL) { return; } printf("%u\t", folderlist->folder_id); for(i=0;iname); dump_folder_list(folderlist->child, level+1); dump_folder_list(folderlist->sibling, level); } int main (int argc, char **argv) { LIBMTP_raw_device_t *rawdevices; int numrawdevices; int i; LIBMTP_Init(); printf("Attempting to connect device(s)\n"); switch (LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices)) { case LIBMTP_ERROR_NO_DEVICE_ATTACHED: printf("mtp-folders: no devices found\n"); return 0; case LIBMTP_ERROR_CONNECTING: fprintf(stderr, "mtp-folders: There has been an error connecting. Exit\n"); return 1; case LIBMTP_ERROR_MEMORY_ALLOCATION: fprintf(stderr, "mtp-folders: Memory Allocation Error. Exit\n"); return 1; /* Unknown general errors - This should never execute */ case LIBMTP_ERROR_GENERAL: default: fprintf(stderr, "mtp-folders: Unknown error, please report " "this to the libmtp developers\n"); return 1; /* Successfully connected at least one device, so continue */ case LIBMTP_ERROR_NONE: printf("mtp-folders: Successfully connected\n"); } /* iterate through connected MTP devices */ for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; char *friendlyname; int ret; device = LIBMTP_Open_Raw_Device(&rawdevices[i]); if (device == NULL) { fprintf(stderr, "Unable to open raw device %d\n", i); continue; } /* Echo the friendly name so we know which device we are working with */ friendlyname = LIBMTP_Get_Friendlyname(device); if (friendlyname == NULL) { printf("Friendly name: (NULL)\n"); } else { printf("Friendly name: %s\n", friendlyname); free(friendlyname); } LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); /* Get all storages for this device */ ret = LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED); if (ret != 0) { perror("LIBMTP_Get_Storage()\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); continue; } /* Loop over storages, dump folder for each one */ for (storage = device->storage; storage != 0; storage = storage->next) { LIBMTP_folder_t *folders; printf("Storage: %s\n", storage->StorageDescription); folders = LIBMTP_Get_Folder_List_For_Storage(device, storage->id); if (folders == NULL) { fprintf(stdout, "No folders found\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } else { dump_folder_list(folders,0); } LIBMTP_destroy_folder_t(folders); } LIBMTP_Release_Device(device); } free(rawdevices); printf("OK.\n"); return 0; } libmtp-1.1.10/examples/sendtr.c0000644000175000001440000003202412604202742013257 00000000000000/** * \file sendtr.c * Example program to send a music track to a device. * This program is derived from the exact equivalent in libnjb. * based on Enrique Jorreto Ledesma's work on the original program by * Shaun Jackman and Linus Walleij. * * Copyright (C) 2003-2010 Linus Walleij * Copyright (C) 2003-2005 Shaun Jackman * Copyright (C) 2003-2005 Enrique Jorrete Ledesma * Copyright (C) 2006 Chris A. Debenham * Copyright (C) 2008 Nicolas Pennequin * Copyright (C) 2008 Joseph Nahmias * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #ifdef HAVE_LANGINFO_H #include #endif #include "config.h" #include "common.h" #include "util.h" #include "connect.h" #include "libmtp.h" #include "pathutils.h" extern LIBMTP_folder_t *folders; extern LIBMTP_file_t *files; extern LIBMTP_mtpdevice_t *device; void sendtrack_usage (void) { fprintf(stderr, "usage: sendtr [ -D debuglvl ] [ -q ]\n"); fprintf(stderr, "-t -a <artist> -A <Album artist> -w <writer or composer>\n"); fprintf(stderr, " -l <album> -c <codec> -g <genre> -n <track number> -y <year>\n"); fprintf(stderr, " -d <duration in seconds> -s <storage_id> <local path> <remote path>\n"); fprintf(stderr, "(-q means the program will not ask for missing information.)\n"); } static char *prompt (const char *prompt, char *buffer, size_t bufsz, int required) { char *cp, *bp; while (1) { fprintf(stdout, "%s> ", prompt); if ( fgets(buffer, bufsz, stdin) == NULL ) { if (ferror(stdin)) { perror("fgets"); } else { fprintf(stderr, "EOF on stdin\n"); } return NULL; } cp = strrchr(buffer, '\n'); if ( cp != NULL ) *cp = '\0'; bp = buffer; while ( bp != cp ) { if ( *bp != ' ' && *bp != '\t' ) return bp; bp++; } if (! required) return bp; } } static int add_track_to_album(LIBMTP_album_t *albuminfo, LIBMTP_track_t *trackmeta) { LIBMTP_album_t *album; LIBMTP_album_t *album_orig; LIBMTP_album_t *found_album = NULL; int ret; /* Look for the album */ album = LIBMTP_Get_Album_List(device); album_orig = album; while(album != NULL) { if ((album->name != NULL && album->artist != NULL && !strcmp(album->name, albuminfo->name) && !strcmp(album->artist, albuminfo->artist)) || (album->name != NULL && album->composer != NULL && !strcmp(album->name, albuminfo->name) && !strcmp(album->composer, albuminfo->composer))) { /* Disconnect this album for later use */ found_album = album; album = album->next; found_album->next = NULL; } else { album = album->next; } } if (found_album == NULL) { printf("Could not find Album. Retrying with only Album name\n"); album = album_orig; while(album != NULL) { if ((album->name != NULL) && !strcmp(album->name, albuminfo->name) ){ /* Disconnect this album for later use */ found_album = album; album = album->next; found_album->next = NULL; } else { album = album->next; } } } if (found_album != NULL) { uint32_t *tracks; tracks = (uint32_t *)malloc((found_album->no_tracks+1) * sizeof(uint32_t)); printf("Album \"%s\" found: updating...\n", found_album->name); if (!tracks) { printf("failed malloc in add_track_to_album()\n"); return 1; } found_album->no_tracks++; if (found_album->tracks != NULL) { memcpy(tracks, found_album->tracks, found_album->no_tracks * sizeof(uint32_t)); free(found_album->tracks); } tracks[found_album->no_tracks-1] = trackmeta->item_id; found_album->tracks = tracks; ret = LIBMTP_Update_Album(device, found_album); } else { uint32_t *trackid; trackid = (uint32_t *)malloc(sizeof(uint32_t)); *trackid = trackmeta->item_id; albuminfo->tracks = trackid; albuminfo->no_tracks = 1; albuminfo->storage_id = trackmeta->storage_id; printf("Album doesn't exist: creating...\n"); ret = LIBMTP_Create_New_Album(device, albuminfo); /* albuminfo will be destroyed later by caller */ } /* Delete the earlier retrieved Album list */ album=album_orig; while(album!=NULL){ LIBMTP_album_t *tmp; tmp = album; album = album->next; LIBMTP_destroy_album_t(tmp); } if (ret != 0) { printf("Error creating or updating album.\n"); printf("(This could be due to that your device does not support albums.)\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } else { printf("success!\n"); } return ret; } int sendtrack_function(char * from_path, char * to_path, char *partist, char *palbumartist, char *ptitle, char *pgenre, char *palbum, char *pcomposer, uint16_t tracknum, uint16_t length, uint16_t year, uint32_t storageid, uint16_t quiet) { char *filename, *parent; char artist[80], albumartist[80], title[80], genre[80], album[80], composer[80]; char *to_path_copy = NULL; char num[80]; uint64_t filesize; uint32_t parent_id = 0; struct stat sb; LIBMTP_track_t *trackmeta; LIBMTP_album_t *albuminfo; int ret; printf("Sending track %s to %s\n", from_path, to_path); to_path_copy = strdup(to_path); parent = dirname(to_path_copy); parent_id = parse_path (parent,files,folders); if (parent_id == -1) { free (to_path_copy); printf("Parent folder could not be found, skipping\n"); return 1; } strcpy (to_path_copy,to_path); filename = basename(to_path_copy); if (stat(from_path, &sb) == -1) { fprintf(stderr, "%s: ", from_path); perror("stat"); free (to_path_copy); return 1; } if (!S_ISREG(sb.st_mode)) { free (to_path_copy); return 0; } filesize = sb.st_size; trackmeta = LIBMTP_new_track_t(); trackmeta->filetype = find_filetype (from_path); if (!LIBMTP_FILETYPE_IS_TRACK(trackmeta->filetype)) { printf("Not a valid track codec: \"%s\"\n", LIBMTP_Get_Filetype_Description(trackmeta->filetype)); LIBMTP_destroy_track_t(trackmeta); free (to_path_copy); return 1; } if ((ptitle == NULL) && (quiet == 0)) { if ( (ptitle = prompt("Title", title, 80, 0)) != NULL ) if (!strlen(ptitle)) ptitle = NULL; } if ((palbum == NULL) && (quiet == 0)) { if ( (palbum = prompt("Album", album, 80, 0)) != NULL ) if (!strlen(palbum)) palbum = NULL; } if ((palbumartist == NULL) && (quiet == 0)) { if ( (palbumartist = prompt("Album artist", albumartist, 80, 0)) != NULL ) if (!strlen(palbumartist)) palbumartist = NULL; } if ((partist == NULL) && (quiet == 0)) { if ( (partist = prompt("Artist", artist, 80, 0)) != NULL ) if (!strlen(partist)) partist = NULL; } if ((pcomposer == NULL) && (quiet == 0)) { if ( (pcomposer = prompt("Writer or Composer", composer, 80, 0)) != NULL ) if (!strlen(pcomposer)) pcomposer = NULL; } if ((pgenre == NULL) && (quiet == 0)) { if ( (pgenre = prompt("Genre", genre, 80, 0)) != NULL ) if (!strlen(pgenre)) pgenre = NULL; } if ((tracknum == 0) && (quiet == 0)) { char *pnum; if ( (pnum = prompt("Track number", num, 80, 0)) == NULL ) tracknum = 0; else tracknum = strtoul(pnum, 0, 10); } if ((year == 0) && (quiet == 0)) { char *pnum; if ( (pnum = prompt("Year", num, 80, 0)) == NULL ) year = 0; else year = strtoul(pnum, 0, 10); } if ((length == 0) && (quiet == 0)) { char *pnum; if ( (pnum = prompt("Length", num, 80, 0)) == NULL ) length = 0; else length = strtoul(pnum, 0, 10); } printf("Sending track:\n"); printf("Codec: %s\n", LIBMTP_Get_Filetype_Description(trackmeta->filetype)); if (ptitle) { printf("Title: %s\n", ptitle); trackmeta->title = strdup(ptitle); } albuminfo = LIBMTP_new_album_t(); if (palbum) { printf("Album: %s\n", palbum); trackmeta->album = strdup(palbum); albuminfo->name = strdup(palbum); } if (palbumartist) { printf("Album artist: %s\n", palbumartist); albuminfo->artist = strdup(palbumartist); } if (partist) { printf("Artist: %s\n", partist); trackmeta->artist = strdup(partist); if (palbumartist == NULL) albuminfo->artist = strdup(partist); } if (pcomposer) { printf("Writer or Composer: %s\n", pcomposer); trackmeta->composer = strdup(pcomposer); albuminfo->composer = strdup(pcomposer); } if (pgenre) { printf("Genre: %s\n", pgenre); trackmeta->genre = strdup(pgenre); albuminfo->genre = strdup(pgenre); } if (year > 0) { char tmp[80]; printf("Year: %d\n", year); snprintf(tmp, sizeof(tmp)-1, "%4d0101T0000.0", year); tmp[sizeof(tmp)-1] = '\0'; trackmeta->date = strdup(tmp); } if (tracknum > 0) { printf("Track no: %d\n", tracknum); trackmeta->tracknumber = tracknum; } if (length > 0) { printf("Length: %d\n", length); // Multiply by 1000 since this is in milliseconds trackmeta->duration = length * 1000; } // We should always have this if (filename != NULL) { trackmeta->filename = strdup(filename); } trackmeta->filesize = filesize; trackmeta->parent_id = parent_id; { int rc; char *desc = NULL; LIBMTP_devicestorage_t *pds = NULL; if (0 != (rc=LIBMTP_Get_Storage(device, LIBMTP_STORAGE_SORTBY_NOTSORTED))) { perror("LIBMTP_Get_Storage()"); exit(-1); } for (pds = device->storage; pds != NULL; pds = pds->next) { if (pds->id == storageid) { desc = strdup(pds->StorageDescription); break; } } if (NULL != desc) { printf("Storage ID: %s (%u)\n", desc, storageid); free(desc); } else printf("Storage ID: %u\n", storageid); trackmeta->storage_id = storageid; } printf("Sending track...\n"); ret = LIBMTP_Send_Track_From_File(device, from_path, trackmeta, progress, NULL); printf("\n"); if (ret != 0) { printf("Error sending track.\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); ret = 1; } else { printf("New track ID: %d\n", trackmeta->item_id); } /* Add here add to album call */ if (palbum) ret = add_track_to_album(albuminfo, trackmeta); LIBMTP_destroy_album_t(albuminfo); LIBMTP_destroy_track_t(trackmeta); free (to_path_copy); return ret; } int sendtrack_command (int argc, char **argv) { int opt, ret; extern int optind; extern char *optarg; char *partist = NULL; char *palbumartist = NULL; char *pcomposer = NULL; char *ptitle = NULL; char *pgenre = NULL; char *pcodec = NULL; char *palbum = NULL; uint16_t tracknum = 0; uint16_t length = 0; uint16_t year = 0; uint16_t quiet = 0; uint32_t storageid = 0; while ( (opt = getopt(argc, argv, "qD:t:a:A:w:l:c:g:n:d:y:s:")) != -1 ) { switch (opt) { case 't': free (ptitle); ptitle = strdup(optarg); break; case 'a': free (partist); partist = strdup(optarg); break; case 'A': free (palbumartist); palbumartist = strdup(optarg); break; case 'w': free (pcomposer); pcomposer = strdup(optarg); break; case 'l': free (palbum); palbum = strdup(optarg); break; case 'c': free (pcodec); pcodec = strdup(optarg); // FIXME: DSM check for MP3, WAV or WMA break; case 'g': free (pgenre); pgenre = strdup(optarg); break; case 'n': tracknum = atoi(optarg); break; case 's': storageid = (uint32_t) strtoul(optarg, NULL, 0); break; case 'd': length = atoi(optarg); break; case 'y': year = atoi(optarg); break; case 'q': quiet = 1; break; default: sendtrack_usage(); } } argc -= optind; argv += optind; if ( argc != 2 ) { printf("You need to pass a filename and destination.\n"); sendtrack_usage(); ret = 0; } else { checklang(); printf("%s,%s,%s,%s,%s,%s,%s,%s,%d%d,%d,%u,%d\n",argv[0],argv[1],partist,palbumartist,ptitle,pgenre,palbum,pcomposer,tracknum, length, year, storageid, quiet); ret = sendtrack_function(argv[0],argv[1],partist,palbumartist,ptitle,pgenre,palbum,pcomposer, tracknum, length, year, storageid, quiet); } free (ptitle); free (partist); free (palbumartist); free (pcomposer); free (palbum); free (pcodec); free (pgenre); return ret; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/reset.c����������������������������������������������������������������������0000644�0001750�0000144�00000004266�12121274441�013110� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file reset.c * Example program that resets the device. * * Copyright (C) 2007 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" /** * Returns 0 if OK (yes), 1 if not OK (no) */ static int prompt() { char buff[2]; while (1) { fprintf(stdout, "> "); if ( fgets(buff, sizeof(buff), stdin) == NULL ) { if (ferror(stdin)) { fprintf(stderr, "File error on stdin\n"); } else { fprintf(stderr, "EOF on stdin\n"); } return 1; } if (buff[0] == 'y') { return 0; } else if (buff[0] == 'n') { return 1; } } } int main (int argc, char **argv) { LIBMTP_mtpdevice_t *device; int ret; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); return 0; } printf("I will now reset your device. This means that\n"); printf("the device may go inactive immediately and may report errors.\n"); printf("Continue? (y/n)\n"); if (prompt() == 0) { ret = LIBMTP_Reset_Device(device); } else { printf("Aborted.\n"); ret = 0; } if ( ret != 0 ) { printf("Failed to reset device.\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); LIBMTP_Release_Device(device); return 1; } // It is not possible to release the device after successful reset! // LIBMTP_Release_Device(device); printf("OK.\n"); return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/delfile.c��������������������������������������������������������������������0000644�0001750�0000144�00000005442�12121274441�013367� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file delfile.c * Example program to delete a file off the device. * * Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se> * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include <limits.h> #include "common.h" #include "string.h" #include "pathutils.h" #include "connect.h" extern LIBMTP_mtpdevice_t *device; extern LIBMTP_folder_t *folders; extern LIBMTP_file_t *files; void delfile_usage(void) { printf("Usage: delfile [-n] <fileid/trackid> | -f <filename>\n"); } int delfile_function(char * path) { uint32_t id = parse_path (path,files,folders); if (id > 0) { printf("Deleting %s which has item_id:%d\n",path,id); int ret = 1; ret = LIBMTP_Delete_Object(device, id); if (ret != 0) { LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); printf("Failed to remove file\n"); return 1; } } return 0; } int delfile_command(int argc, char **argv) { int FILENAME = 1; int ITEMID = 2; int field_type = 0; int i; int ret = 0; if ( argc > 2 ) { if (strncmp(argv[1],"-f",2) == 0) { field_type = FILENAME; strcpy(argv[1],""); } else if (strncmp(argv[1],"-n",2) == 0) { field_type = ITEMID; strcpy(argv[1],"0"); } else { delfile_usage(); return 0; } } else { delfile_usage(); return 0; } for (i=1;i<argc;i++) { uint32_t id; char *endptr; if (field_type == ITEMID) { // Sanity check song ID id = strtoul(argv[i], &endptr, 10); if ( *endptr != 0 ) { fprintf(stderr, "illegal value %s .. skipping\n", argv[i]); id = 0; } } else { if (strlen(argv[i]) > 0) { id = parse_path (argv[i],files,folders); } else { id = 0; } } if (id > 0 ) { printf("Deleting %s\n",argv[i]); ret = LIBMTP_Delete_Object(device, id); } if ( ret != 0 ) { printf("Failed to delete file:%s\n",argv[i]); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); ret = 1; } } return ret; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/newfolder.c������������������������������������������������������������������0000644�0001750�0000144�00000004254�12121274441�013750� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file newfolder.c * Example program to create a folder on the device. * * Copyright (C) 2006-2009 Linus Walleij <triad@df.lth.se> * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include <libgen.h> #include "common.h" #include "pathutils.h" #include "connect.h" extern LIBMTP_folder_t *folders; extern LIBMTP_file_t *files; extern LIBMTP_mtpdevice_t *device; int newfolder_command (int argc, char **argv) { uint32_t newid; if(argc != 4) { printf("Usage: newfolder name <parent> <storage>\n"); printf(" parent = parent folder or 0 to create the new folder in the root dir\n"); printf(" storage = storage id or 0 to create the new folder on the primary storage\n"); return 0; } newid = LIBMTP_Create_Folder(device, argv[1], atol(argv[2]), atol(argv[3])); if (newid == 0) { printf("Folder creation failed.\n"); return 1; } else { printf("New folder created with ID: %d\n", newid); } return 0; } int newfolder_function(char * path) { printf("Creating new folder %s\n",path); char * parent = dirname(path); char * folder = basename(path); int id = parse_path (parent,files,folders); int newid = LIBMTP_Create_Folder(device, folder, id, 0); if (newid == 0) { printf("Folder creation failed.\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); return 1; } else { printf("New folder created with ID: %d\n", newid); } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/detect.c���������������������������������������������������������������������0000644�0001750�0000144�00000021137�12566671664�013257� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file detect.c * Example program to detect a device and list capabilities. * * Copyright (C) 2005-2015 Linus Walleij <triad@df.lth.se> * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include "util.h" #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #define XML_BUFSIZE 0x10000 static void dump_xml_fragment(uint8_t *buf, uint32_t len) { static int endianness = 0; // 0 = LE, 1 = BE uint32_t bp = 0; while (bp < len) { if (buf[bp+0] == 0xFF && buf[bp+1] == 0xFE) { endianness = 0; } else if (buf[bp+0] == 0xFE && buf[bp+1] == 0xff) { endianness = 1; } else { uint16_t tmp; if (endianness == 0) { tmp = buf[bp+1] << 8 | buf[bp+0]; } else { tmp = buf[bp+0] << 8 | buf[bp+1]; } // Fix this some day, we only print ISO 8859-1 correctly here, // should atleast support UTF-8. printf("%c", (uint8_t) tmp); } bp += 2; } printf("\n"); } int main (int argc, char **argv) { LIBMTP_raw_device_t * rawdevices; int numrawdevices; LIBMTP_error_number_t err; int i; int opt; extern int optind; extern char *optarg; while ((opt = getopt(argc, argv, "d")) != -1 ) { switch (opt) { case 'd': LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); break; } } argc -= optind; argv += optind; LIBMTP_Init(); fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); fprintf(stdout, "Listing raw device(s)\n"); err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); switch(err) { case LIBMTP_ERROR_NO_DEVICE_ATTACHED: fprintf(stdout, " No raw devices found.\n"); return 0; case LIBMTP_ERROR_CONNECTING: fprintf(stderr, "Detect: There has been an error connecting. Exiting\n"); return 1; case LIBMTP_ERROR_MEMORY_ALLOCATION: fprintf(stderr, "Detect: Encountered a Memory Allocation Error. Exiting\n"); return 1; case LIBMTP_ERROR_NONE: { int i; fprintf(stdout, " Found %d device(s):\n", numrawdevices); for (i = 0; i < numrawdevices; i++) { if (rawdevices[i].device_entry.vendor != NULL || rawdevices[i].device_entry.product != NULL) { fprintf(stdout, " %s: %s (%04x:%04x) @ bus %d, dev %d\n", rawdevices[i].device_entry.vendor, rawdevices[i].device_entry.product, rawdevices[i].device_entry.vendor_id, rawdevices[i].device_entry.product_id, rawdevices[i].bus_location, rawdevices[i].devnum); } else { fprintf(stdout, " %04x:%04x @ bus %d, dev %d\n", rawdevices[i].device_entry.vendor_id, rawdevices[i].device_entry.product_id, rawdevices[i].bus_location, rawdevices[i].devnum); } } } break; case LIBMTP_ERROR_GENERAL: default: fprintf(stderr, "Unknown connection error.\n"); return 1; } /* Iterate over connected MTP devices */ fprintf(stdout, "Attempting to connect device(s)\n"); for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; char *friendlyname; char *syncpartner; char *sectime; char *devcert; uint16_t *filetypes; uint16_t filetypes_len; uint8_t maxbattlevel; uint8_t currbattlevel; int ret; device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); if (device == NULL) { fprintf(stderr, "Unable to open raw device %d\n", i); continue; } LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); LIBMTP_Dump_Device_Info(device); printf("MTP-specific device properties:\n"); // The friendly name friendlyname = LIBMTP_Get_Friendlyname(device); if (friendlyname == NULL) { fprintf(stdout, " Friendly name: (NULL)\n"); } else { fprintf(stdout, " Friendly name: %s\n", friendlyname); free(friendlyname); } syncpartner = LIBMTP_Get_Syncpartner(device); if (syncpartner == NULL) { fprintf(stdout, " Synchronization partner: (NULL)\n"); } else { fprintf(stdout, " Synchronization partner: %s\n", syncpartner); free(syncpartner); } // Some battery info ret = LIBMTP_Get_Batterylevel(device, &maxbattlevel, &currbattlevel); if (ret == 0) { fprintf(stdout, " Battery level %d of %d (%d%%)\n",currbattlevel, maxbattlevel, (int) ((float) currbattlevel/ (float) maxbattlevel * 100.0)); } else { // Silently ignore. Some devices does not support getting the // battery level. LIBMTP_Clear_Errorstack(device); } ret = LIBMTP_Get_Supported_Filetypes(device, &filetypes, &filetypes_len); if (ret == 0) { uint16_t i; printf("libmtp supported (playable) filetypes:\n"); for (i = 0; i < filetypes_len; i++) { fprintf(stdout, " %s\n", LIBMTP_Get_Filetype_Description(filetypes[i])); } } else { LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } // Secure time XML fragment ret = LIBMTP_Get_Secure_Time(device, §ime); if (ret == 0 && sectime != NULL) { fprintf(stdout, "\nSecure Time:\n%s\n", sectime); free(sectime); } else { // Silently ignore - there may be devices not supporting secure time. LIBMTP_Clear_Errorstack(device); } // Device certificate XML fragment if (rawdevices[i].device_entry.vendor_id == 0x041e) { /* * This code is currently disabled except for vendors we * know does support it: all devices say that * they support getting a device certificate but a lot of * them obviously doesn't, instead they crash when you try * to obtain it. */ ret = LIBMTP_Get_Device_Certificate(device, &devcert); if (ret == 0 && devcert != NULL) { fprintf(stdout, "\nDevice Certificate:\n%s\n", devcert); free(devcert); } else { fprintf(stdout, "Unable to acquire device certificate, perhaps this device " "does not support this\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } } /* Try to get Media player device info XML file... */ /* Loop over storages */ for (storage = device->storage; storage != 0; storage = storage->next) { LIBMTP_file_t *files; /* Get file listing for the root directory, no other dirs */ files = LIBMTP_Get_Files_And_Folders(device, storage->id, 0); if (files != NULL) { LIBMTP_file_t *file, *tmp; file = files; while (file != NULL) { if (!strcmp(file->filename, "WMPInfo.xml") || !strcmp(file->filename, "WMPinfo.xml") || !strcmp(file->filename, "default-capabilities.xml")) { if (file->item_id != 0) { /* Dump this file */ FILE *xmltmp = tmpfile(); int tmpfiledescriptor = fileno(xmltmp); if (tmpfiledescriptor != -1) { int ret = LIBMTP_Get_Track_To_File_Descriptor(device, file->item_id, tmpfiledescriptor, NULL, NULL); if (ret == 0) { uint8_t *buf = NULL; uint32_t readbytes; buf = malloc(XML_BUFSIZE); if (buf == NULL) { printf("Could not allocate %08x bytes...\n", XML_BUFSIZE); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); free(rawdevices); return 1; } lseek(tmpfiledescriptor, 0, SEEK_SET); readbytes = read(tmpfiledescriptor, (void*) buf, XML_BUFSIZE); if (readbytes >= 2 && readbytes < XML_BUFSIZE) { fprintf(stdout, "\n%s file contents:\n", file->filename); dump_xml_fragment(buf, readbytes); } else { perror("Unable to read file"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } free(buf); } else { LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } fclose(xmltmp); } } } tmp = file; file = file->next; LIBMTP_destroy_file_t(tmp); } } } LIBMTP_Release_Device(device); } /* End For Loop */ free(rawdevices); printf("OK.\n"); return 0; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/format.c���������������������������������������������������������������������0000644�0001750�0000144�00000004360�12121274441�013251� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file format.c * Example program that formats the device storage. * * Copyright (C) 2006-2007 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" /** * Returns 0 if OK (yes), 1 if not OK (no) */ static int prompt() { char buff[2]; while (1) { fprintf(stdout, "> "); if ( fgets(buff, sizeof(buff), stdin) == NULL ) { if (ferror(stdin)) { fprintf(stderr, "File error on stdin\n"); } else { fprintf(stderr, "EOF on stdin\n"); } return 1; } if (buff[0] == 'y') { return 0; } else if (buff[0] == 'n') { return 1; } } } int main (int argc, char **argv) { LIBMTP_mtpdevice_t *device; int ret; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); return 0; } printf("I will now format your device. This means that\n"); printf("all content (and licenses) will be lost forever.\n"); printf("you will not be able to undo this operation.\n"); printf("Continue? (y/n)\n"); if (prompt() == 0) { // This will just format the first storage. ret = LIBMTP_Format_Storage(device, device->storage); } else { printf("Aborted.\n"); ret = 0; } if ( ret != 0 ) { printf("Failed to format device.\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); LIBMTP_Release_Device(device); return 1; } LIBMTP_Release_Device(device); printf("OK.\n"); return 0; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/files.c����������������������������������������������������������������������0000644�0001750�0000144�00000010657�12566671664�013116� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file files.c * Example program that lists all files on a device. * * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se> * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include <stdlib.h> static void dump_fileinfo(LIBMTP_file_t *file) { printf("File ID: %u\n", file->item_id); if (file->filename != NULL) printf(" Filename: %s\n", file->filename); // This is sort of special... if (file->filesize == (uint32_t) -1) { printf(" None. (abstract file, size = -1)\n"); } else { #ifdef __WIN32__ printf(" File size %llu (0x%016I64X) bytes\n", file->filesize, file->filesize); #else printf(" File size %llu (0x%016llX) bytes\n", (long long unsigned int) file->filesize, (long long unsigned int) file->filesize); #endif } printf(" Parent ID: %u\n", file->parent_id); printf(" Storage ID: 0x%08X\n", file->storage_id); printf(" Filetype: %s\n", LIBMTP_Get_Filetype_Description(file->filetype)); } static void dump_files(LIBMTP_mtpdevice_t *device, uint32_t storageid, int leaf) { LIBMTP_file_t *files; /* Get file listing. */ files = LIBMTP_Get_Files_And_Folders(device, storageid, leaf); if (files == NULL) { LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } else { LIBMTP_file_t *file, *tmp; file = files; while (file != NULL) { /* Please don't print these */ if (file->filetype == LIBMTP_FILETYPE_FOLDER) { dump_files(device, storageid, file->item_id); } else { dump_fileinfo(file); } tmp = file; file = file->next; LIBMTP_destroy_file_t(tmp); } } } int main(int argc, char **argv) { LIBMTP_raw_device_t *rawdevices; int numrawdevices; LIBMTP_error_number_t err; int i; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); LIBMTP_Init(); err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); switch(err) { case LIBMTP_ERROR_NO_DEVICE_ATTACHED: fprintf(stdout, "mtp-files: No Devices have been found\n"); return 0; case LIBMTP_ERROR_CONNECTING: fprintf(stderr, "mtp-files: There has been an error connecting. Exit\n"); return 1; case LIBMTP_ERROR_MEMORY_ALLOCATION: fprintf(stderr, "mtp-files: Memory Allocation Error. Exit\n"); return 1; /* Unknown general errors - This should never execute */ case LIBMTP_ERROR_GENERAL: default: fprintf(stderr, "mtp-files: Unknown error, please report " "this to the libmtp developers\n"); return 1; /* Successfully connected at least one device, so continue */ case LIBMTP_ERROR_NONE: fprintf(stdout, "mtp-files: Successfully connected\n"); fflush(stdout); break; } /* iterate through connected MTP devices */ for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; char *friendlyname; device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); if (device == NULL) { fprintf(stderr, "Unable to open raw device %d\n", i); continue; } /* Echo the friendly name so we know which device we are working with */ friendlyname = LIBMTP_Get_Friendlyname(device); if (friendlyname == NULL) { printf("Listing File Information on Device with name: (NULL)\n"); } else { printf("Listing File Information on Device with name: %s\n", friendlyname); free(friendlyname); } LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); /* Loop over storages */ for (storage = device->storage; storage != 0; storage = storage->next) { dump_files(device, storage->id, 0); } LIBMTP_Release_Device(device); } free(rawdevices); printf("OK.\n"); exit (0); } ���������������������������������������������������������������������������������libmtp-1.1.10/examples/emptyfolders.c���������������������������������������������������������������0000644�0001750�0000144�00000006055�12121274441�014501� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file emptyfolders.c * Example program that prunes empty folders. * * Copyright (C) 2006 Andy Kelk <andy@mopoke.co.uk> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include <stdlib.h> static void prune_empty_folders(LIBMTP_mtpdevice_t *device, LIBMTP_file_t *files, LIBMTP_folder_t *folderlist, int do_delete) { if(folderlist==NULL) return; if(folderlist->child == NULL) { // this *might* be empty // therefore, check every file for this parent_id int found = 0; LIBMTP_file_t *file; file = files; while (file != NULL) { if(file->parent_id == folderlist->folder_id) { // folder has a child found = 1; break; } file = file->next; } if(found == 0) { // no files claim this as a parent printf("empty folder %u (%s)\n",folderlist->folder_id,folderlist->name); if(do_delete) { if (LIBMTP_Delete_Object(device,folderlist->folder_id) != 0) { printf("Couldn't delete folder %u\n",folderlist->folder_id); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } } } } prune_empty_folders(device,files,folderlist->child,do_delete); // recurse down prune_empty_folders(device,files,folderlist->sibling,do_delete); // recurse along } int main (int argc, char **argv) { // check if we're doing a dummy run int do_delete = 0; int opt; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); while ( (opt = getopt(argc, argv, "d")) != -1 ) { switch (opt) { case 'd': do_delete = 1; break; default: break; } } if(do_delete == 0) { printf("This is a dummy run. No folders will be deleted.\n"); printf("To delete folders, use the '-d' option.\n"); } LIBMTP_mtpdevice_t *device; LIBMTP_folder_t *folders; LIBMTP_file_t *files; LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); exit (0); } // Get file listing. files = LIBMTP_Get_Filelisting_With_Callback(device,NULL,NULL); // Get folder listing. folders = LIBMTP_Get_Folder_List(device); if(folders == NULL) { printf("No folders found\n"); } else { prune_empty_folders(device,files,folders,do_delete); } LIBMTP_destroy_folder_t(folders); LIBMTP_destroy_file_t(files); LIBMTP_Release_Device(device); printf("OK.\n"); exit (0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/getfile.c��������������������������������������������������������������������0000644�0001750�0000144�00000004677�12121274441�013413� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file getfile.c * Example program to retrieve a file off the device. * * Copyright (C) 2005-2007 Linus Walleij <triad@df.lth.se> * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include <limits.h> #include "common.h" #include "pathutils.h" #include "connect.h" extern LIBMTP_folder_t *folders; extern LIBMTP_file_t *files; extern LIBMTP_mtpdevice_t *device; void getfile_usage (void) { fprintf(stderr, "getfile <fileid/trackid> <filename>\n"); } int getfile_function(char * from_path,char * to_path) { int id = parse_path (from_path,files,folders); if (id > 0) { printf("Getting %s to %s\n",from_path,to_path); if (LIBMTP_Get_File_To_File(device, id, to_path, progress, NULL) != 0 ) { printf("\nError getting file from MTP device.\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); return 1; } } return 0; } int getfile_command(int argc, char **argv) { uint32_t id; char *endptr; char *file; int ret = 0; // We need file ID and filename if ( argc != 3 ) { getfile_usage(); return 0; } // Sanity check song ID id = strtoul(argv[1], &endptr, 10); if ( *endptr != 0 ) { fprintf(stderr, "illegal value %s\n", argv[1]); return 1; } else if ( ! id ) { fprintf(stderr, "bad file/track id %u\n", id); return 1; } // Filename, e.g. "foo.mp3" file = argv[2]; printf("Getting file/track %d to local file %s\n", id, file); // This function will also work just as well for tracks. if (LIBMTP_Get_File_To_File(device, id, file, progress, NULL) != 0 ) { printf("\nError getting file from MTP device.\n"); ret = 1; } // Terminate progress bar. printf("\n"); return ret; } �����������������������������������������������������������������libmtp-1.1.10/examples/common.h���������������������������������������������������������������������0000644�0001750�0000144�00000002167�12121274441�013261� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file common.h * These headers are used by absolutely all sample programs. * Special quirks that apply to all samples go here. * * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <libmtp.h> #ifndef _MSC_VER #include <config.h> #ifdef HAVE_GETOPT_H #include <getopt.h> #else #include <unistd.h> #endif #else // Only if using MSVC... #include "..\windows\getopt.h" #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/util.c�����������������������������������������������������������������������0000644�0001750�0000144�00000004070�12121274441�012734� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file util.c * A set of common utility functions found * in all samples. * * Copyright (C) 2008 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include "util.h" #ifdef HAVE_LANGINFO_H #include <langinfo.h> #endif #ifdef HAVE_LOCALE_H #include <locale.h> #endif #include <stdlib.h> #include <stdio.h> #include <string.h> #include <strings.h> void checklang(void) { const char *langsuff = NULL; const char *lang = getenv("LANG"); #ifdef HAVE_LOCALE_H // Set the locale in accordance with environment setlocale(LC_ALL, ""); #endif #ifdef HAVE_LANGINFO_H langsuff = nl_langinfo(CODESET); #else /* * Check environment variables $LANG and $LC_CTYPE * to see if we want to support UTF-8 unicode */ if (lang != NULL) { const char *sep = strrchr(lang, '.'); if (sep != NULL) { langsuff = sep + 1; } else { langsuff = lang; } } #endif if (langsuff == NULL) { printf("Could not determine language suffix for your system. Please check your setup!\n"); } else if (strcasecmp(langsuff, "UTF-8") && strcasecmp(langsuff, "UTF8")) { printf("Your system does not appear to have UTF-8 enabled ($LANG=\"%s\")\n", lang); printf("If you want to have support for diacritics and Unicode characters,\n"); printf("please switch your locale to an UTF-8 locale, e.g. \"en_US.UTF-8\".\n"); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/tracks.c���������������������������������������������������������������������0000644�0001750�0000144�00000013215�12566671664�013274� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file tracks.c * Example program to list the tracks on a device. * * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se> * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include <stdlib.h> static void dump_trackinfo(LIBMTP_track_t *track) { printf("Track ID: %u\n", track->item_id); if (track->title != NULL) printf(" Title: %s\n", track->title); if (track->artist != NULL) printf(" Artist: %s\n", track->artist); if (track->genre != NULL) printf(" Genre: %s\n", track->genre); if (track->composer != NULL) printf(" Composer: %s\n", track->composer); if (track->album != NULL) printf(" Album: %s\n", track->album); if (track->date != NULL) printf(" Date: %s\n", track->date); if (track->filename != NULL) printf(" Origfilename: %s\n", track->filename); printf(" Track number: %d\n", track->tracknumber); printf(" Duration: %d milliseconds\n", track->duration); #ifdef __WIN32__ printf(" File size %I64u bytes\n", track->filesize); #else printf(" File size %llu bytes\n", (long long unsigned int) track->filesize); #endif printf(" Filetype: %s\n", LIBMTP_Get_Filetype_Description(track->filetype)); if (track->samplerate != 0) { printf(" Sample rate: %u Hz\n", track->samplerate); } if (track->nochannels != 0) { printf(" Number of channels: %u\n", track->nochannels); } if (track->wavecodec != 0) { printf(" WAVE fourCC code: 0x%08X\n", track->wavecodec); } if (track->bitrate != 0) { printf(" Bitrate: %u bits/s\n", track->bitrate); } if (track->bitratetype != 0) { if (track->bitratetype == 1) { printf(" Bitrate type: Constant\n"); } else if (track->bitratetype == 2) { printf(" Bitrate type: Variable (VBR)\n"); } else if (track->bitratetype == 3) { printf(" Bitrate type: Free\n"); } else { printf(" Bitrate type: Unknown/Erroneous value\n"); } } if (track->rating != 0) { printf(" User rating: %u (out of 100)\n", track->rating); } if (track->usecount != 0) { printf(" Use count: %u times\n", track->usecount); } } static void dump_tracks(LIBMTP_mtpdevice_t *device, uint32_t storageid, int leaf) { LIBMTP_file_t *files; /* Get track listing. */ files = LIBMTP_Get_Files_And_Folders(device, storageid, leaf); if (files == NULL) { LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } else { LIBMTP_file_t *file, *tmp; file = files; while (file != NULL) { /* Please don't print these */ if (file->filetype == LIBMTP_FILETYPE_FOLDER) { dump_tracks(device, storageid, file->item_id); } else if (LIBMTP_FILETYPE_IS_TRACK(file->filetype)) { LIBMTP_track_t *track; track = LIBMTP_Get_Trackmetadata(device, file->item_id); dump_trackinfo(track); LIBMTP_destroy_track_t(track); } tmp = file; file = file->next; LIBMTP_destroy_file_t(tmp); } } } int main (int argc, char **argv) { LIBMTP_raw_device_t *rawdevices; int numrawdevices; LIBMTP_error_number_t err; int i; LIBMTP_Init(); fprintf(stdout, "Attempting to connect device(s)\n"); err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); switch(err) { case LIBMTP_ERROR_NO_DEVICE_ATTACHED: fprintf(stdout, "mtp-tracks: No Devices have been found\n"); return 0; case LIBMTP_ERROR_CONNECTING: fprintf(stderr, "mtp-tracks: There has been an error connecting. Exit\n"); return 1; case LIBMTP_ERROR_MEMORY_ALLOCATION: fprintf(stderr, "mtp-tracks: Memory Allocation Error. Exit\n"); return 1; /* Unknown general errors - This should never execute */ case LIBMTP_ERROR_GENERAL: default: fprintf(stderr, "mtp-tracks: Unknown error, please report " "this to the libmtp developers\n"); return 1; /* Successfully connected at least one device, so continue */ case LIBMTP_ERROR_NONE: fprintf(stdout, "mtp-tracks: Successfully connected\n"); fflush(stdout); break; } /* Iterate through connected MTP devices */ for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; char *friendlyname; device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); if (device == NULL) { fprintf(stderr, "Unable to open raw device %d\n", i); continue; } /* Echo the friendly name so we know which device we are working with */ friendlyname = LIBMTP_Get_Friendlyname(device); if (friendlyname == NULL) { printf("Friendly name: (NULL)\n"); } else { printf("Friendly name: %s\n", friendlyname); free(friendlyname); } LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); /* Loop over storages */ for (storage = device->storage; storage != 0; storage = storage->next) { dump_tracks(device, storage->id, 0); } LIBMTP_Release_Device(device); } printf("OK.\n"); exit (0); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/connect.c��������������������������������������������������������������������0000644�0001750�0000144�00000010453�12121274441�013412� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file connect.c * Main programs implementing several utilities in one. * * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * Copyright (C) 2008-2010 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include <libgen.h> #include <getopt.h> #include <string.h> #include "common.h" #include "util.h" #include "pathutils.h" #include "connect.h" LIBMTP_folder_t *folders; LIBMTP_file_t *files; LIBMTP_mtpdevice_t *device; static void split_arg(char * argument, char ** part1, char ** part2) { char *sepp; *part1 = NULL; *part2 = NULL; sepp = argument + strcspn(argument, ","); sepp[0] = '\0'; *part1 = argument; *part2 = sepp+1; } static void usage(void) { printf("Usage: connect <command1> <command2>\n"); printf("Commands: --delete [filename]\n"); printf(" --sendfile [source] [destination]\n"); printf(" --sendtrack [source] [destination]\n"); printf(" --getfile [source] [destination]\n"); printf(" --newfolder [foldername]\n"); } int main (int argc, char **argv) { int ret = 0; checklang(); LIBMTP_Init(); fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); return 0; } files = LIBMTP_Get_Filelisting_With_Callback (device, NULL, NULL); folders = LIBMTP_Get_Folder_List (device); if ((strncmp(basename(argv[0]),"mtp-delfile",11) == 0) || (strncmp(basename(argv[0]),"delfile",7) == 0)) { ret = delfile_command(argc,argv); } else if ((strncmp(basename(argv[0]),"mtp-getfile",13) == 0) || (strncmp(basename(argv[0]),"getfile",9) == 0)) { ret = getfile_command(argc,argv); } else if ((strncmp(basename(argv[0]),"mtp-newfolder",13) == 0) || (strncmp(basename(argv[0]),"newfolder",9) == 0)) { ret = newfolder_command(argc,argv); } else if ((strncmp(basename(argv[0]),"mtp-sendfile",11) == 0) || (strncmp(basename(argv[0]),"sendfile",7) == 0)) { ret = sendfile_command(argc, argv); } else if ((strncmp(basename(argv[0]),"mtp-sendtr",10) == 0) || (strncmp(basename(argv[0]),"sendtr",6) == 0)) { ret = sendtrack_command(argc, argv); } else { if ( argc < 2 ) { usage (); return 1; } while (1) { int option_index = 0; static struct option long_options[] = { {"delete", 1, 0, 'd'}, {"sendfile", 1, 0, 'f'}, {"getfile", 1, 0, 'g'}, {"newfolder", 1, 0, 'n'}, {"sendtrack", 1, 0, 't'}, {0, 0, 0, 0} }; int c = getopt_long (argc, argv, "d:f:g:n:t:", long_options, &option_index); if (c == -1) break; char *arg1, *arg2; switch (c) { case 'd': printf("Delete %s\n",optarg); ret = delfile_function(optarg); break; case 'f': printf("Send file %s\n",optarg); split_arg(optarg,&arg1,&arg2); ret = sendfile_function(arg1,arg2); break; case 'g': printf("Get file %s\n",optarg); split_arg(optarg,&arg1,&arg2); ret = getfile_function(arg1,arg2); break; case 'n': printf("New folder %s\n",optarg); ret = newfolder_function(optarg); break; case 't': printf("Send track %s\n",optarg); split_arg(optarg,&arg1,&arg2); ret = sendtrack_function(arg1,arg2,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0); break; } } if (optind < argc) { printf("Unknown options: "); while (optind < argc) printf("%s ", argv[optind++]); printf("\n"); } } LIBMTP_Release_Device(device); return ret; } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/connect.h��������������������������������������������������������������������0000644�0001750�0000144�00000002763�12121274441�013424� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file connect.h * Header file for connect subfunctions * * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * Copyright (C) 2008-2010 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ int delfile_function(char *); int delfile_command(int, char **); void delfile_usage(void); int sendtrack_function (char *, char *, char *, char *, char *, char *, char *, char *, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t); int sendtrack_command (int, char **); void sendtrack_usage(void); int sendfile_function(char *,char *); int sendfile_command(int, char **); void sendfile_usage(void); int getfile_function(char *,char *); int getfile_command(int, char **); void getfile_usage(void); int newfolder_function(char *); int newfolder_command(int,char **); void newfolder_usage(void); �������������libmtp-1.1.10/examples/albums.c���������������������������������������������������������������������0000644�0001750�0000144�00000010731�12566671664�013270� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file albums.c * Example program that lists the albums on the device. * * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include <stdlib.h> static void dump_albuminfo(LIBMTP_album_t *album) { printf("Album ID: %d\n",album->album_id); printf(" Parent ID: %d\n",album->parent_id); printf(" Name: %s\n",album->name); printf(" Artist: %s\n", album->artist); printf(" Composer: %s\n", album->composer); printf(" Genre: %s\n", album->genre); printf(" Tracks: %d\n\n",album->no_tracks); } static void dump_albums(LIBMTP_mtpdevice_t *device, uint32_t storageid, int leaf) { LIBMTP_file_t *files; /* Get file listing. */ files = LIBMTP_Get_Files_And_Folders(device, storageid, leaf); if (files == NULL) { LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } else { LIBMTP_file_t *file, *tmp; file = files; while (file != NULL) { /* Please don't print these */ if (file->filetype == LIBMTP_FILETYPE_FOLDER) { dump_albums(device, storageid, file->item_id); } else if (file->filetype == LIBMTP_FILETYPE_ALBUM) { LIBMTP_album_t *album; album = LIBMTP_Get_Album(device, file->item_id); dump_albuminfo(album); LIBMTP_destroy_album_t(album); } tmp = file; file = file->next; LIBMTP_destroy_file_t(tmp); } } } int main (int argc, char *argv[]) { LIBMTP_raw_device_t *rawdevices; int numrawdevices; LIBMTP_error_number_t err; int i; int opt; extern int optind; extern char *optarg; while ((opt = getopt(argc, argv, "d")) != -1 ) { switch (opt) { case 'd': LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); break; } } argc -= optind; argv += optind; LIBMTP_Init(); fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); err = LIBMTP_Detect_Raw_Devices(&rawdevices, &numrawdevices); switch(err) { case LIBMTP_ERROR_NO_DEVICE_ATTACHED: fprintf(stdout, "mtp-albums: No Devices have been found\n"); return 0; case LIBMTP_ERROR_CONNECTING: fprintf(stderr, "mtp-albums: There has been an error connecting. Exit\n"); return 1; case LIBMTP_ERROR_MEMORY_ALLOCATION: fprintf(stderr, "mtp-albums: Memory Allocation Error. Exit\n"); return 1; /* Unknown general errors - This should never execute */ case LIBMTP_ERROR_GENERAL: default: fprintf(stderr, "mtp-albums: Unknown error, please report " "this to the libmtp developers\n"); return 1; /* Successfully connected at least one device, so continue */ case LIBMTP_ERROR_NONE: fprintf(stdout, "mtp-albums: Successfully connected\n"); fflush(stdout); break; } /* iterate through connected MTP devices */ for (i = 0; i < numrawdevices; i++) { LIBMTP_mtpdevice_t *device; LIBMTP_devicestorage_t *storage; char *friendlyname; device = LIBMTP_Open_Raw_Device_Uncached(&rawdevices[i]); if (device == NULL) { fprintf(stderr, "Unable to open raw device %d\n", i); continue; } /* Echo the friendly name so we know which device we are working with */ friendlyname = LIBMTP_Get_Friendlyname(device); if (friendlyname == NULL) { printf("Retrieving Albums on Device with name: (NULL)\n"); } else { printf("Retrieving Albums on Device with name: %s\n", friendlyname); free(friendlyname); } LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); /* Loop over storages */ for (storage = device->storage; storage != 0; storage = storage->next) { dump_albums(device, storage->id, 0); } LIBMTP_Release_Device(device); } free(rawdevices); printf("OK.\n"); return 0; } ���������������������������������������libmtp-1.1.10/examples/albumart.c�������������������������������������������������������������������0000644�0001750�0000144�00000010417�12604222605�013571� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file albumart.c * Example program to send album art. * * Copyright (C) 2006 Andy Kelk <andy@mopoke.co.uk> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include "common.h" #include "string.h" #include <stdlib.h> #include <limits.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <sys/stat.h> #include <sys/types.h> #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif static void usage(void) { printf("Usage: albumart -d -i <fileid/trackid> -n <albumname> -s <storage_id> -p <parent_id> <imagefile>\n"); exit(0); } int main (int argc, char **argv) { int opt; extern int optind; extern char *optarg; LIBMTP_mtpdevice_t *device = NULL; int idcount = 0; int fd; uint32_t *ids = NULL; uint32_t *tmp = NULL; uint64_t filesize; char *imagedata = NULL; char *albumname = NULL; char *path = NULL; char *rest; struct stat statbuff; uint32_t storageid = 0; uint32_t parentid = 0; int ret; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); while ( (opt = getopt(argc, argv, "dhn:i:s:p:")) != -1 ) { switch (opt) { case 'h': usage(); case 'd': LIBMTP_Set_Debug(LIBMTP_DEBUG_PTP | LIBMTP_DEBUG_DATA); break; case 'i': idcount++; if ((tmp = realloc(ids, sizeof(uint32_t) * (idcount))) == NULL) { printf("realloc failed\n"); return 1; } ids = tmp; ids[(idcount-1)] = strtoul(optarg, &rest, 0); break; case 'n': albumname = strdup(optarg); break; case 's': storageid = (uint32_t) strtoul(optarg, NULL, 0); break; case 'p': parentid = (uint32_t) strtoul(optarg, NULL, 0); break; default: usage(); } } argc -= optind; argv += optind; if ( argc != 1 ) { printf("You need to pass a filename.\n"); usage(); } if ( albumname == NULL) { printf("You need to supply an album name.\n"); usage(); } if (idcount == 0) { printf("You need to supply one or more track IDs\n"); usage(); } path = argv[0]; if ( stat(path, &statbuff) == -1 ) { fprintf(stderr, "%s: ", path); perror("stat"); exit(1); } filesize = (uint64_t) statbuff.st_size; imagedata = malloc(filesize * sizeof(uint8_t)); #ifdef __WIN32__ if ( (fd = open(path, O_RDONLY|O_BINARY) == -1) ) { #else if ( (fd = open(path, O_RDONLY)) == -1) { #endif printf("Couldn't open image file %s (%s)\n",path,strerror(errno)); return 1; } else { ret = read(fd, imagedata, filesize); if (ret == -1) perror("read"); close(fd); } LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); return 0; } LIBMTP_filesampledata_t *albumart = LIBMTP_new_filesampledata_t(); albumart->data = imagedata; albumart->size = filesize; albumart->filetype = LIBMTP_FILETYPE_JPEG; LIBMTP_album_t *album = LIBMTP_new_album_t(); album->name = albumname; album->no_tracks = idcount; album->tracks = ids; album->parent_id = parentid; album->storage_id = storageid; ret = LIBMTP_Create_New_Album(device,album); if (ret == 0) { ret = LIBMTP_Send_Representative_Sample(device,album->album_id, albumart); if (ret != 0) { printf("Couldn't send album art\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } } else { printf("Couldn't create album object\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } LIBMTP_destroy_filesampledata_t(albumart); LIBMTP_destroy_album_t(album); LIBMTP_Release_Device(device); printf("OK.\n"); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/sendfile.c�������������������������������������������������������������������0000644�0001750�0000144�00000005253�12121274441�013554� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file sendfile.c * Example program to send an arbitrary file to a device. * * Copyright (C) 2005-2010 Linus Walleij <triad@df.lth.se> * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <libgen.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include "common.h" #include "libmtp.h" #include "pathutils.h" #include "util.h" #include "connect.h" extern LIBMTP_folder_t *folders; extern LIBMTP_file_t *files; extern LIBMTP_mtpdevice_t *device; void sendfile_usage(void) { fprintf(stderr, "usage: sendfile <local filename> <remote filename>\n"); } int sendfile_function(char * from_path, char *to_path) { printf("Sending %s to %s\n",from_path,to_path); char *filename; uint64_t filesize; struct stat sb; LIBMTP_file_t *genfile; int ret; uint32_t parent_id = 0; if ( stat(from_path, &sb) == -1 ) { fprintf(stderr, "%s: ", from_path); perror("stat"); return 1; } filesize = sb.st_size; filename = basename(from_path); parent_id = parse_path (to_path,files,folders); if (parent_id == -1) { printf("Parent folder could not be found, skipping\n"); return 0; } genfile = LIBMTP_new_file_t(); genfile->filesize = filesize; genfile->filename = strdup(filename); genfile->filetype = find_filetype (filename); genfile->parent_id = parent_id; genfile->storage_id = 0; printf("Sending file...\n"); ret = LIBMTP_Send_File_From_File(device, from_path, genfile, progress, NULL); printf("\n"); if (ret != 0) { printf("Error sending file.\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); ret = 1; } else { printf("New file ID: %d\n", genfile->item_id); } LIBMTP_destroy_file_t(genfile); return ret; } int sendfile_command (int argc, char **argv) { if (argc < 3) { sendfile_usage(); return 0; } checklang(); return sendfile_function(argv[1],argv[2]); } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/pathutils.c������������������������������������������������������������������0000644�0001750�0000144�00000016214�12121274441�013777� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file pathutils.c * * Copyright (C) 2005-2008 Linus Walleij <triad@df.lth.se> * Copyright (C) 2006 Chris A. Debenham <chris@adebenham.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include "pathutils.h" #include <stdlib.h> #include <limits.h> #include <string.h> #include <libgen.h> /* Find the folder_id of a given path * Runs by walking through folders structure */ static uint32_t lookup_folder_id (LIBMTP_folder_t * folder, char * path, char * parent) { char * current; uint32_t ret = (uint32_t) -1; if (strcmp(path,"/")==0) return 0; if (folder == NULL) { return ret; } current = malloc (strlen(parent) + strlen(folder->name) + 2); sprintf(current,"%s/%s",parent,folder->name); if (strcasecmp (path, current) == 0) { free (current); return folder->folder_id; } if (strncasecmp (path, current, strlen (current)) == 0) { ret = lookup_folder_id (folder->child, path, current); } free (current); if (ret != (uint32_t) (-1)) { return ret; } ret = lookup_folder_id (folder->sibling, path, parent); return ret; } /* Parses a string to find item_id */ int parse_path (char * path, LIBMTP_file_t * files, LIBMTP_folder_t * folders) { char *rest; uint32_t item_id; // Check if path is an item_id if (*path != '/') { item_id = strtoul(path, &rest, 0); // really should check contents of "rest" here... /* if not number, assume a file name */ if (item_id == 0) { LIBMTP_file_t * file = files; /* search for matching name */ while (file != NULL) { if (strcasecmp (file->filename, path) == 0) { return file->item_id; } file = file->next; } } return item_id; } // Check if path is a folder item_id = lookup_folder_id(folders,path,""); if (item_id == (uint32_t) -1) { char * dirc = strdup(path); char * basec = strdup(path); char * parent = dirname(dirc); char * filename = basename(basec); uint32_t parent_id = lookup_folder_id(folders,parent,""); LIBMTP_file_t * file; file = files; while (file != NULL) { if (file->parent_id == parent_id) { if (strcasecmp (file->filename, filename) == 0) { free(dirc); free(basec); return file->item_id; } } file = file->next; } free(dirc); free(basec); } else { return item_id; } return -1; } int progress (const uint64_t sent, const uint64_t total, void const * const data) { int percent = (sent*100)/total; #ifdef __WIN32__ printf("Progress: %I64u of %I64u (%d%%)\r", sent, total, percent); #else printf("Progress: %llu of %llu (%d%%)\r", sent, total, percent); #endif fflush(stdout); return 0; } /* Find the file type based on extension */ LIBMTP_filetype_t find_filetype (const char * filename) { char *ptype; LIBMTP_filetype_t filetype; #ifdef __WIN32__ ptype = strrchr(filename, '.'); #else ptype = rindex(filename,'.'); #endif // This accounts for the case with a filename without any "." (period). if (!ptype) { ptype = ""; } else { ++ptype; } /* This need to be kept constantly updated as new file types arrive. */ if (!strcasecmp (ptype, "wav")) { filetype = LIBMTP_FILETYPE_WAV; } else if (!strcasecmp (ptype, "mp3")) { filetype = LIBMTP_FILETYPE_MP3; } else if (!strcasecmp (ptype, "wma")) { filetype = LIBMTP_FILETYPE_WMA; } else if (!strcasecmp (ptype, "ogg")) { filetype = LIBMTP_FILETYPE_OGG; } else if (!strcasecmp (ptype, "mp4")) { filetype = LIBMTP_FILETYPE_MP4; } else if (!strcasecmp (ptype, "wmv")) { filetype = LIBMTP_FILETYPE_WMV; } else if (!strcasecmp (ptype, "avi")) { filetype = LIBMTP_FILETYPE_AVI; } else if (!strcasecmp (ptype, "mpeg") || !strcasecmp (ptype, "mpg")) { filetype = LIBMTP_FILETYPE_MPEG; } else if (!strcasecmp (ptype, "asf")) { filetype = LIBMTP_FILETYPE_ASF; } else if (!strcasecmp (ptype, "qt") || !strcasecmp (ptype, "mov")) { filetype = LIBMTP_FILETYPE_QT; } else if (!strcasecmp (ptype, "wma")) { filetype = LIBMTP_FILETYPE_WMA; } else if (!strcasecmp (ptype, "jpg") || !strcasecmp (ptype, "jpeg")) { filetype = LIBMTP_FILETYPE_JPEG; } else if (!strcasecmp (ptype, "jfif")) { filetype = LIBMTP_FILETYPE_JFIF; } else if (!strcasecmp (ptype, "tif") || !strcasecmp (ptype, "tiff")) { filetype = LIBMTP_FILETYPE_TIFF; } else if (!strcasecmp (ptype, "bmp")) { filetype = LIBMTP_FILETYPE_BMP; } else if (!strcasecmp (ptype, "gif")) { filetype = LIBMTP_FILETYPE_GIF; } else if (!strcasecmp (ptype, "pic") || !strcasecmp (ptype, "pict")) { filetype = LIBMTP_FILETYPE_PICT; } else if (!strcasecmp (ptype, "png")) { filetype = LIBMTP_FILETYPE_PNG; } else if (!strcasecmp (ptype, "wmf")) { filetype = LIBMTP_FILETYPE_WINDOWSIMAGEFORMAT; } else if (!strcasecmp (ptype, "ics")) { filetype = LIBMTP_FILETYPE_VCALENDAR2; } else if (!strcasecmp (ptype, "exe") || !strcasecmp (ptype, "com") || !strcasecmp (ptype, "bat") || !strcasecmp (ptype, "dll") || !strcasecmp (ptype, "sys")) { filetype = LIBMTP_FILETYPE_WINEXEC; } else if (!strcasecmp (ptype, "aac")) { filetype = LIBMTP_FILETYPE_AAC; } else if (!strcasecmp (ptype, "mp2")) { filetype = LIBMTP_FILETYPE_MP2; } else if (!strcasecmp (ptype, "flac")) { filetype = LIBMTP_FILETYPE_FLAC; } else if (!strcasecmp (ptype, "m4a")) { filetype = LIBMTP_FILETYPE_M4A; } else if (!strcasecmp (ptype, "doc")) { filetype = LIBMTP_FILETYPE_DOC; } else if (!strcasecmp (ptype, "xml")) { filetype = LIBMTP_FILETYPE_XML; } else if (!strcasecmp (ptype, "xls")) { filetype = LIBMTP_FILETYPE_XLS; } else if (!strcasecmp (ptype, "ppt")) { filetype = LIBMTP_FILETYPE_PPT; } else if (!strcasecmp (ptype, "mht")) { filetype = LIBMTP_FILETYPE_MHT; } else if (!strcasecmp (ptype, "jp2")) { filetype = LIBMTP_FILETYPE_JP2; } else if (!strcasecmp (ptype, "jpx")) { filetype = LIBMTP_FILETYPE_JPX; } else if (!strcasecmp (ptype, "bin")) { filetype = LIBMTP_FILETYPE_FIRMWARE; } else if (!strcasecmp (ptype, "vcf")) { filetype = LIBMTP_FILETYPE_VCARD3; } else { /* Tagging as unknown file type */ filetype = LIBMTP_FILETYPE_UNKNOWN; } printf("type: %s, %d\n", ptype, filetype); return filetype; } /* Function that compensate for missing libgen.h on Windows */ #ifndef HAVE_LIBGEN_H static char *basename(char *in) { char *p; if (in == NULL) return NULL; p = in + strlen(in) - 1; while (*p != '\\' && *p != '/' && *p != ':') { p--; } return ++p; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libmtp-1.1.10/examples/thumb.c����������������������������������������������������������������������0000644�0001750�0000144�00000005771�12604220733�013110� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file thumb.c * Example program to send and associate album art to an entity * on a device. * * Copyright (C) 2006 Robert Reardon <rreardon@monkshatch.vispa.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "config.h" #include "common.h" #include "string.h" #include <fcntl.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <limits.h> #include <sys/types.h> #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #endif #include <sys/stat.h> static void usage(void) { printf("Usage: thumb -i <fileid/trackid> <imagefile>\n"); exit(0); } int main (int argc, char **argv) { int opt; extern int optind; extern char *optarg; LIBMTP_mtpdevice_t *device = NULL; int fd; uint32_t id = 0; uint64_t filesize; char *imagedata = NULL; char *path = NULL; char *rest; struct stat statbuff; int ret; fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n"); while ( (opt = getopt(argc, argv, "hi:")) != -1 ) { switch (opt) { case 'h': usage(); case 'i': id = strtoul(optarg, &rest, 0); break; default: usage(); } } argc -= optind; argv += optind; if ( argc != 1 ) { printf("You need to pass a filename.\n"); usage(); } path = argv[0]; if ( stat(path, &statbuff) == -1 ) { fprintf(stderr, "%s: ", path); perror("stat"); exit(1); } filesize = statbuff.st_size; imagedata = malloc(filesize); #ifdef __WIN32__ if ( (fd = open(path, O_RDONLY|O_BINARY) == -1) ) { #else if ( (fd = open(path, O_RDONLY)) == -1) { #endif printf("Couldn't open image file %s (%s)\n",path,strerror(errno)); return 1; } else { ret = read(fd, imagedata, filesize); if (ret == -1) perror("read thumb data"); close(fd); } LIBMTP_Init(); device = LIBMTP_Get_First_Device(); if (device == NULL) { printf("No devices.\n"); return 0; } LIBMTP_filesampledata_t *thumb = LIBMTP_new_filesampledata_t(); thumb->data = imagedata; thumb->size = filesize; thumb->filetype = LIBMTP_FILETYPE_JPEG; ret = LIBMTP_Send_Representative_Sample(device,id,thumb); if (ret != 0) { printf("Couldn't send thumbnail\n"); LIBMTP_Dump_Errorstack(device); LIBMTP_Clear_Errorstack(device); } LIBMTP_destroy_filesampledata_t(thumb); LIBMTP_Release_Device(device); printf("OK.\n"); return 0; } �������libmtp-1.1.10/examples/util.h�����������������������������������������������������������������������0000644�0001750�0000144�00000001733�12121274441�012744� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/** * \file util.h * Header for a set of common utility functions found * in all samples. * * Copyright (C) 2008 Linus Walleij <triad@df.lth.se> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef LIBMTP_EXAMPLES_UTIL_H #define LIBMTP_EXAMPLES_UTIL_H void checklang(void); #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������