diff options
author | Justin Dickow <jjdickow@gmail.com> | 2014-10-27 16:59:35 -0400 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2014-10-27 16:59:35 -0400 |
commit | 4ce70ef2086fd944eb1dabad15e0c2882b7cca6a (patch) | |
tree | 7177c29620384dbce06ca3eed35679ec053bcef5 | |
parent | 46ca411137a3845ab35d90c810f0371a6d254448 (diff) | |
download | sdl_core-4ce70ef2086fd944eb1dabad15e0c2882b7cca6a.tar.gz |
3.10.1
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
295 files changed, 49299 insertions, 2124 deletions
diff --git a/src/3rd_party-static/MessageBroker/include/mb_controller.hpp b/src/3rd_party-static/MessageBroker/include/mb_controller.hpp index 31d8f6efe4..930a53b385 100644 --- a/src/3rd_party-static/MessageBroker/include/mb_controller.hpp +++ b/src/3rd_party-static/MessageBroker/include/mb_controller.hpp @@ -190,7 +190,6 @@ namespace NsMessageBroker virtual void exitReceivingThread() { Close(); stop = true; - sync_primitives::AutoLock auto_lock(receiving_thread_lock_); } protected: diff --git a/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerAVA.hpp b/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerAVA.hpp index fed3ee58a1..47e684a7e4 100644 --- a/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerAVA.hpp +++ b/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerAVA.hpp @@ -20,7 +20,7 @@ namespace NsMessageBroker
{
/**
- *\class CMessageBrokerControllerAVA
+ * \class CMessageBrokerControllerAVA
* \brief MessageBroker Controller.
*/
class CMessageBrokerControllerAVA : public CMessageBrokerController
diff --git a/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerBackend.hpp b/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerBackend.hpp index bda828beeb..b79411dc98 100644 --- a/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerBackend.hpp +++ b/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerBackend.hpp @@ -19,7 +19,7 @@ namespace NsMessageBroker
{
/**
- *\class CMessageBrokerControllerBackend
+ * \class CMessageBrokerControllerBackend
* \brief MessageBroker Controller.
*/
diff --git a/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerPhone.hpp b/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerPhone.hpp index 899d1a289d..e6f4898226 100644 --- a/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerPhone.hpp +++ b/src/3rd_party-static/MessageBroker/src/example/MessageBrokerControllerPhone.hpp @@ -20,7 +20,7 @@ namespace NsMessageBroker
{
/**
- *\class CMessageBrokerControllerPhone
+ * \class CMessageBrokerControllerPhone
* \brief MessageBroker Controller Phone.
*/
class CMessageBrokerControllerPhone : public CMessageBrokerController
diff --git a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/output.0 b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/output.0 new file mode 100644 index 0000000000..5feeff5217 --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/output.0 @@ -0,0 +1,21759 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.69. +@%:@ +@%:@ +@%:@ Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +@%:@ +@%:@ +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in @%:@( + *posix*) : + set -o posix ;; @%:@( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in @%:@( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in @%:@(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in @%:@ (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in @%:@( + *posix*) : + set -o posix ;; @%:@( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in @%:@( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in @%:@ (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org 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 @S|@? 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 "@S|@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 @S|@as_val. Take advantage of shells that can avoid forks. The arguments +@%:@ must be portable across @S|@(()) 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 @S|@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'" + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + +# 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 + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + +test -n "$DJDIR" || exec 7<&0 </dev/null +exec 6>&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=. +LIB@&t@OBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="src/main/cpp/logger.cpp" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='LTLIBOBJS +LIB@&t@OBJS +LOGCHAR_IS_UNICHAR +LOGCHAR_IS_WCHAR +LOGCHAR_IS_UTF8 +CHARSET_EBCDIC +CHARSET_USASCII +CHARSET_ISO88591 +CHARSET_UTF8 +CFSTRING_API +UNICHAR_API +WCHAR_T_API +CHAR_API +HAS_LIBESMTP +CPPFLAGS_ODBC +LIBS_ODBC +IODBC_CONFIG +HAS_ODBC +HAS_FWIDE +HAS_WCHAR_T +HAS_STD_LOCALE +HAS_SYSLOG +HAS_WCSTOMBS +HAS_MBSRTOWCS +APU_LIBS +APR_LIBS +base_dir +manual_dest +enable_latex_docs +enable_html_docs +enable_dot +LATEX_DOC_FALSE +LATEX_DOC_TRUE +DOC_FALSE +DOC_TRUE +DOT +DOXYGEN +LIBTOOL +ac_ct_F77 +FFLAGS +F77 +CXXCPP +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +CPP +RANLIB +AR +ECHO +LN_S +EGREP +GREP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +LT_VERSION +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +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_shared +enable_static +enable_fast_install +enable_dependency_tracking +with_gnu_ld +enable_libtool_lock +with_pic +with_tags +enable_doxygen +enable_dot +enable_html_docs +enable_latex_docs +with_apr +with_apr_util +with_ODBC +with_SMTP +enable_char +enable_wchar_t +enable_unichar +enable_cfstring +with_charset +with_logchar +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +CXXCPP +F77 +FFLAGS' + + +# 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}' +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 this package 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 + @<:@@S|@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/PACKAGE@:>@ + --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] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared@<:@=PKGS@:>@ build shared libraries @<:@default=yes@:>@ + --enable-static@<:@=PKGS@:>@ build static libraries @<:@default=yes@:>@ + --enable-fast-install@<:@=PKGS@:>@ + optimize for fast installation @<:@default=yes@:>@ + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-doxygen enable documentation generation with doxygen (auto) + --enable-dot use 'dot' to generate graphs in doxygen (auto) + --enable-html-docs enable HTML generation with doxygen (yes) + --enable-latex-docs enable LaTeX documentation generation with doxygen + (no) + --enable-char enable char API (yes) + --enable-wchar_t enable wchar_t API (yes if wchar_t available) + --enable-unichar enable unichar API (no) + --enable-cfstring enable cfstring API (no) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld @<:@default=no@:>@ + --with-pic try to use only PIC/non-PIC objects @<:@default=use + both@:>@ + --with-tags@<:@=TAGS@:>@ include additional configurations @<:@automatic@:>@ + --with-apr=PATH prefix for installed APR or the full path to + apr-config + --with-apr-util=PATH prefix for installed APU or the full path to + apu-config + --with-ODBC ODBC support. Accepted arguments : unixODBC, iODBC, + Microsoft, no (default=no) + --with-SMTP SMTP support. Accepted arguments : libesmtp, no + (default=no) + --with-charset=TYPE locale charset. Accepted TYPE variants: auto, utf-8, + iso-8859-1, usascii, ebcdic (default=auto) + --with-logchar=TYPE type for logchar. Accepted TYPE variants: utf-8, + wchar_t, unichar (default=utf-8) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + LIBS libraries to pass to the linker, e.g. -l<library> + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if + you have headers in a nonstandard directory <include dir> + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + +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 the package provider. +_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 +configure +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.@S|@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.@S|@ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_link + +@%:@ ac_fn_c_try_cpp LINENO +@%:@ ---------------------- +@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_cpp + +@%:@ ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +@%:@ ------------------------------------------------------- +@%:@ Tests whether HEADER exists, giving a warning if it cannot be compiled using +@%:@ the include files in INCLUDES and setting the cache variable VAR +@%:@ accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +@%:@include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +@%:@include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} @%:@ ac_fn_c_check_header_mongrel + +@%:@ ac_fn_c_try_run LINENO +@%:@ ---------------------- +@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. Assumes +@%:@ that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_run + +@%:@ ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +@%:@ ------------------------------------------------------- +@%:@ Tests whether HEADER exists and can be compiled using the include files in +@%:@ INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +@%:@include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} @%:@ ac_fn_c_check_header_compile + +@%:@ ac_fn_c_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 <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#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_cxx_try_compile LINENO +@%:@ ---------------------------- +@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_cxx_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_cxx_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_cxx_try_compile + +@%:@ ac_fn_cxx_try_cpp LINENO +@%:@ ------------------------ +@%:@ Try to preprocess conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_cxx_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_cxx_preproc_warn_flag$ac_cxx_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_cxx_try_cpp + +@%:@ ac_fn_cxx_try_link LINENO +@%:@ ------------------------- +@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_cxx_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_cxx_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_cxx_try_link + +@%:@ ac_fn_f77_try_compile LINENO +@%:@ ---------------------------- +@%:@ Try to compile conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_f77_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_f77_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_f77_try_compile + +@%:@ ac_fn_f77_try_link LINENO +@%:@ ------------------------- +@%:@ Try to link conftest.@S|@ac_ext, and return whether this succeeded. +ac_fn_f77_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_f77_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_f77_try_link + +@%:@ ac_fn_cxx_check_func LINENO FUNC VAR +@%:@ ------------------------------------ +@%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_cxx_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 <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#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_cxx_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_cxx_check_func + +@%:@ ac_fn_cxx_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_cxx_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_cxx_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_cxx_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_cxx_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;} + ;; +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_cxx_check_header_mongrel +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 $as_me, 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 + + + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# autoconf 2.50 or higher to rebuild aclocal.m4, because the +# AC_CREATE_PREFIX_CONFIG_H macro needs the AS_DIRNAME macro. + + +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. + + +# 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 + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +# +# +1 : ? : +1 == new interface that does not break old one +# +1 : ? : 0 == new interface that breaks old one +# ? : ? : 0 == no new interfaces, but breaks apps +# ? :+1 : ? == just some internal changes, nothing breaks but might work +# better +# CURRENT : REVISION : AGE +LT_VERSION=10:0:0 + + + + + +am__api_version="1.9" +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in @%:@(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +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 + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 +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=log4cxx + VERSION=0.10.0 + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# 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="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +# Checks for programs +# ---------------------------------------------------------------------------- + +@%:@ 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 --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 + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.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 +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +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='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $@%:@ != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +@%:@include <stdio.h> +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 <stdarg.h> +#include <stdio.h> +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + 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 + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + 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 + ;; + none) break ;; + esac + # 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. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} 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 for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${lt_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + # 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 +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 $lt_ac_count -gt 10 && 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 + +fi + +SED=$lt_cv_path_SED +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 +$as_echo "$SED" >&6; } + +{ $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" + + + +@%:@ 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 + +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 ${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 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&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 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&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 $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 + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD-compatible nm" >&5 +$as_echo_n "checking for BSD-compatible 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +NM="$lt_cv_path_NM" + +{ $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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognise dependent libraries" >&5 +$as_echo_n "checking how to recognise 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 +# which 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 +aix4* | aix5*) + 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'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | kfreebsd*-gnu | 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 + ;; + +gnu*) + 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]) 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 + ;; + +interix3*) + # 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 Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + 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=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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 + ;; + +solaris*) + 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 + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + 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_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# 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 whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && 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 which ABI we are using. + 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 which ABI we are using. + echo '#line __oline__ "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 "$lt_cv_prog_gnu_ld" = yes; 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* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + 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-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|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-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + 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 x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + 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*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + + +esac + +need_locks="$enable_libtool_lock" + + +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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@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 <ac_nonexistent.h> +_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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@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 <ac_nonexistent.h> +_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 <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +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 <string.h> + +_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 <stdlib.h> + +_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 <ctype.h> +#include <stdlib.h> +#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_mongrel "$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 + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + 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_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$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 +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +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_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + 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 + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" 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_CXX_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'. + 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_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + 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 + ;; + none) break ;; + esac + # 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. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} 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_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if ac_fn_cxx_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 <ac_nonexistent.h> +_ACEOF +if ac_fn_cxx_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_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if ac_fn_cxx_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 <ac_nonexistent.h> +_ACEOF +if ac_fn_cxx_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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor + 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_F77+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5 +$as_echo "$F77" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor +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_F77+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$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_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_F77" >&5 +$as_echo "$ac_ct_F77" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_F77" && break +done + + if test "x$ac_ct_F77" = x; then + F77="" + 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 + F77=$ac_ct_F77 + fi +fi + + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 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 +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran 77 compiler" >&5 +$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; } +if ${ac_cv_f77_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +if ac_fn_f77_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_f77_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_compiler_gnu" >&5 +$as_echo "$ac_cv_f77_compiler_gnu" >&6; } +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -g" >&5 +$as_echo_n "checking whether $F77 accepts -g... " >&6; } +if ${ac_cv_prog_f77_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + FFLAGS=-g +cat > conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +if ac_fn_f77_try_compile "$LINENO"; then : + ac_cv_prog_f77_g=yes +else + ac_cv_prog_f77_g=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_g" >&5 +$as_echo "$ac_cv_prog_f77_g" >&6; } +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +if test $ac_compiler_gnu = yes; then + G77=yes +else + G77= +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# 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*) + # 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; + ;; + + 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; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # 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 + ;; + + 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 + ;; + *) + # 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. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + 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` + ;; + 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 + + + + +# 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]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + 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 + +# 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 + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, 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. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +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 <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_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_save_LIBS" + CFLAGS="$lt_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 -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; 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 + +{ $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 + + + + + +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 "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +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 avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$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}ar" + $as_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 + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$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="ar" + $as_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 + + 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 +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}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 + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +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 <<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 + +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 <<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 + +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 + +enable_dlopen=no +enable_win32_dll=no + +@%:@ Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +@%:@ Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +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;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# 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 warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$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 +printf "$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 conftest* + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +{ $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 + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # 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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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 x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; 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= + +{ $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 test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # 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' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # 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' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + interix3*) + # 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 + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # 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='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + 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 "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # 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' + ;; + + 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' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # 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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + 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 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + +# +# 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_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # 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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works" >&5 +$as_echo "$lt_prog_compiler_pic_works" >&6; } + +if test x"$lt_prog_compiler_pic_works" = xyes; 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 +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +# +# 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_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works" >&5 +$as_echo "$lt_prog_compiler_static_works" >&6; } + +if test x"$lt_prog_compiler_static_works" = xyes; 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 + printf "$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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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 .. + rmdir 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 "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # 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_" + # 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. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # 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 "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; 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 2>/dev/null` in + *\ [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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, 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 modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + 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 + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach <jrb3@best.com> 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*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + 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/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + 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 (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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 + ;; + + interix3*) + 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' + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + 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; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # 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; $echo \"$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' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; 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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs=no + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + 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 $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' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<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. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + 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 + ;; + + 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 can not +*** 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 + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$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 $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 + + if test "$ld_shlibs" = no; 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 "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; 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 AIX nm, but means don't demangle with GNU 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")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | 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 + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + 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_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; 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 + hardcode_direct=yes + 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 "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # 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_use_runtimelinking" = yes; 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. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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 "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; 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. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + 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 + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # 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. + 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 `echo "$deplibs" | $SED -e '\''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' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=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 -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # GNU/kFreeBSD uses gcc -shared to do shared libraries. + kfreebsd*-gnu) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + link_all_deplibs=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $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 $output_objdir/$soname = $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 "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${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 "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + hardcode_direct=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 "$GCC" = yes -a "$with_gnu_ld" = no; 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 ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${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' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=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 "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + 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 + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; 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 + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; 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" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${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='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -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; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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 + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${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 ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + 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' + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; 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*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; 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 can NOT 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='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$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 + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +# +# 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 "$enable_shared" = yes && test "$GCC" = yes; 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; } + $rm conftest* + printf "$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 + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } +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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # 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. + 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 +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +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 + 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' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; 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 + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.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}' + else + # 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' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + 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=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $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' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + 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*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + 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' + 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="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + 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 + ;; + 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 + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # 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}${versuffix}$shared_ext ${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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + 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='GNU ld.so' + ;; + +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[123]*) 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} $libname${shared_ext}' + 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 + ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + 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 + 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 "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + 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' + ;; + +interix3*) + version_type=linux + 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 "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + 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 + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + 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 + # 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 + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' + ;; + +netbsdelf*-gnu) + version_type=linux + 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='NetBSD ld.elf_so' + ;; + +knetbsd*-gnu) + version_type=linux + 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='GNU 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 + 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=linux + 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 + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + 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 + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +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" + ;; + +solaris*) + version_type=linux + 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 "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + 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 + export_dynamic_flag_spec='${wl}-Blargedynsym' + 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 + 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=freebsd-elf + 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 + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + 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' + ;; + +uts4*) + version_type=linux + 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 "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ $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 "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # 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 "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; 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 "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +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" + { $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 + +if test "x$enable_dlopen" != xyes; 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*) + 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 + + ;; + + *) + 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="-dld" +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="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && 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 "$cross_compiling" = yes; 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 <<EOF +#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#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 + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=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; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +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 "x$lt_cv_dlopen_self" = xyes; 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 "$cross_compiling" = yes; 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 <<EOF +#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#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 + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=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; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +} +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 + + +# Report which 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 "$can_build_shared" = "no" && 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 "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + 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 "$enable_shared" = yes || enable_static=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5 +$as_echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# 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. + +# 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//" + +# 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 + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# 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 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# 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 + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# 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 + +# 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 + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# 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 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# 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 + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# 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 and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# 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 + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# 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 in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# 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 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# 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 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 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# 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 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_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 + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\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 "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # 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" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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" + + +@%:@ Check whether --with-tags was given. +if test "${with_tags+set}" = set; then : + withval=$with_tags; tagnames="$withval" +fi + + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist" >&5 +$as_echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +$as_echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +$as_echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) as_fn_error $? "invalid tag name: $tagname" "$LINENO" 5 + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + as_fn_error $? "tag name \"$tagname\" already exists" "$LINENO" 5 + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# 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 warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$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 +printf "$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 conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +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++"} +compiler=$CC +compiler_CXX=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +@%:@ 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 + +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 ${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 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&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 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_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 "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${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 + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + 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. + archive_cmds_CXX='$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 "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +{ $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; } +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; 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 + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + 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_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; 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 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=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_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # 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_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$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. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${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_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$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 (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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 + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$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' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "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~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=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 + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $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) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=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 + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$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; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${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 + ld_shlibs_CXX=no + fi + ;; + esac + ;; + interix3*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${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_CXX='$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_CXX='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++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -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. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + 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. + archive_cmds_CXX='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' + archive_expsym_cmds_CXX='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; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # 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."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$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 + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$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' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$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 + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # 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=`echo $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; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=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::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + 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. + archive_cmds_CXX='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' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # 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=`echo $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; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # 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 "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + 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. + archive_cmds_CXX='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' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='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' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # 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=`echo $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; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # 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 "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$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' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='echo' + + # 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. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$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. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -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 \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$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 -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 \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT 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. + # 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. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$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 + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +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 + # 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 + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p 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 "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${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 "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$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 "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +# PORTME: override above test on systems where it is broken +case $host_os in +interix3*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +solaris*) + case $cc_basename in + CC*) + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + postdeps_CXX='-lCstd -lCrun' + ;; + esac + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +{ $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; } + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # 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_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # 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_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + interix3*) + # 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_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # 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*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--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 + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+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_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-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_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_prog_compiler_pic_CXX" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if ${lt_prog_compiler_pic_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # 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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_CXX" >&5 +$as_echo "$lt_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ $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_prog_compiler_static_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works_CXX=yes + fi + else + lt_prog_compiler_static_works_CXX=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works_CXX" >&5 +$as_echo "$lt_prog_compiler_static_works_CXX" >&6; } + +if test x"$lt_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +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_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_CXX=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 .. + rmdir conftest + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + kfreebsd*-gnu) + link_all_deplibs_CXX=no + ;; + linux*) + link_all_deplibs_CXX=no + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX 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; } + $rm conftest* + printf "$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_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 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 + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5 +$as_echo "$archive_cmds_need_lc_CXX" >&6; } + ;; + esac + fi + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } +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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # 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. + 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 +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +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 + 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' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; 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 + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.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}' + else + # 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' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + 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=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $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' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + 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*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + 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' + 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="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + 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 + ;; + 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 + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # 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}${versuffix}$shared_ext ${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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + 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='GNU ld.so' + ;; + +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[123]*) 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} $libname${shared_ext}' + 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 + ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + 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 + 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 "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + 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' + ;; + +interix3*) + version_type=linux + 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 "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + 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 + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + 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 + # 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 + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' + ;; + +netbsdelf*-gnu) + version_type=linux + 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='NetBSD ld.elf_so' + ;; + +knetbsd*-gnu) + version_type=linux + 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='GNU 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 + 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=linux + 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 + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + 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 + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +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" + ;; + +solaris*) + version_type=linux + 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 "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + 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 + export_dynamic_flag_spec='${wl}-Blargedynsym' + 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 + 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=freebsd-elf + 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 + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + 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' + ;; + +uts4*) + version_type=linux + 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 "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ $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_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # 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 "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +$as_echo "$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# 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 + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# 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 + +# 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 + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# 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 + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# 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 + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# 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 in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# 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_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# 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_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +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 + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# 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 warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$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 +printf "$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 conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +{ $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 "$can_build_shared" = "no" && 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 "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + 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 "$enable_shared" = yes || enable_static=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +{ $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 test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # 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_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # 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_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + interix3*) + # 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_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # 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_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # 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_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-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_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_F77" >&5 +$as_echo "$lt_prog_compiler_pic_F77" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; } +if ${lt_prog_compiler_pic_works_F77+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # 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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_F77" >&5 +$as_echo "$lt_prog_compiler_pic_works_F77" >&6; } + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\" +{ $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_prog_compiler_static_works_F77+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works_F77=yes + fi + else + lt_prog_compiler_static_works_F77=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works_F77" >&5 +$as_echo "$lt_prog_compiler_static_works_F77" >&6; } + +if test x"$lt_prog_compiler_static_works_F77" = xyes; then + : +else + lt_prog_compiler_static_F77= +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_F77+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_F77=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 .. + rmdir conftest + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # 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_F77="_GLOBAL_OFFSET_TABLE_" + # 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. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # 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 "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; 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_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${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_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, 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 modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$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_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$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 (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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_F77=no + fi + ;; + + interix3*) + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${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_F77='$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_F77='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' + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$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' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs_F77=no + else + ld_shlibs_F77=no + fi + ;; + + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $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_F77=no + cat <<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. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_F77=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** 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 + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$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_F77=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; 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 AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | 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 + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + 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_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; 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 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=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_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # 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_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat > conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +if ac_fn_f77_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$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. + cat > conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +if ac_fn_f77_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${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_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77='$convenience' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$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_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # 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. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=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_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=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_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # GNU/kFreeBSD uses gcc -shared to do shared libraries. + kfreebsd*-gnu) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + link_all_deplibs_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${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_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + *) + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$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' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + no_undefined_flag_F77='${wl}-z,text' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT 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_F77='${wl}-z,text' + allow_undefined_flag_F77='${wl}-z,nodefs' + archive_cmds_need_lc_F77=no + hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5 +$as_echo "$ld_shlibs_F77" >&6; } +test "$ld_shlibs_F77" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 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; } + $rm conftest* + printf "$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_F77 + pic_flag=$lt_prog_compiler_pic_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_F77 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 + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_F77" >&5 +$as_echo "$archive_cmds_need_lc_F77" >&6; } + ;; + esac + fi + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } +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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # 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. + 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 +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +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 + 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' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; 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 + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.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}' + else + # 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' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + 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=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $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' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + 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*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + 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' + 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="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + 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 + ;; + 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 + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # 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}${versuffix}$shared_ext ${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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + 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='GNU ld.so' + ;; + +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[123]*) 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} $libname${shared_ext}' + 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 + ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + 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 + 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 "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + 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' + ;; + +interix3*) + version_type=linux + 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 "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + 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 + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + 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 + # 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 + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' + ;; + +netbsdelf*-gnu) + version_type=linux + 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='NetBSD ld.elf_so' + ;; + +knetbsd*-gnu) + version_type=linux + 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='GNU 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 + 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=linux + 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 + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + 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 + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +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" + ;; + +solaris*) + version_type=linux + 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 "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + 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 + export_dynamic_flag_spec='${wl}-Blargedynsym' + 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 + 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=freebsd-elf + 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 + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + 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' + ;; + +uts4*) + version_type=linux + 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 "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ $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_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # 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 "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5 +$as_echo "$hardcode_action_F77" >&6; } + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# 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 + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# 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 + +# 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 + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# 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 + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# 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 + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# 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 in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# 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_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# 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_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# 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 warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$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 +printf "$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 conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +old_archive_cmds_GCJ=$old_archive_cmds + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +{ $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 + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # 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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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 x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +{ $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 test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # 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_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # 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_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + interix3*) + # 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_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # 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_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # 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_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-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_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_GCJ" >&5 +$as_echo "$lt_prog_compiler_pic_GCJ" >&6; } + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... " >&6; } +if ${lt_prog_compiler_pic_works_GCJ+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # 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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_works_GCJ" >&5 +$as_echo "$lt_prog_compiler_pic_works_GCJ" >&6; } + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\" +{ $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_prog_compiler_static_works_GCJ+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works_GCJ=yes + fi + else + lt_prog_compiler_static_works_GCJ=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_static_works_GCJ" >&5 +$as_echo "$lt_prog_compiler_static_works_GCJ" >&6; } + +if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then + : +else + lt_prog_compiler_static_GCJ= +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_GCJ+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$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:__oline__: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_GCJ=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 .. + rmdir conftest + $rm conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_GCJ" >&6; } + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # 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_GCJ="_GLOBAL_OFFSET_TABLE_" + # 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. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # 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 "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; 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_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${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_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, 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 modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$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_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach <jrb3@best.com> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$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 (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; 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_GCJ=no + fi + ;; + + interix3*) + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${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_GCJ='$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_GCJ='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' + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$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' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + link_all_deplibs_GCJ=no + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $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_GCJ=no + cat <<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. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs_GCJ=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** 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 + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$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_GCJ=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; 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 AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | 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 + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + 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_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; 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 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=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_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; 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 "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # 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_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$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. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${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_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ='$convenience' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$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_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # 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. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=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_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=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_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # GNU/kFreeBSD uses gcc -shared to do shared libraries. + kfreebsd*-gnu) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + link_all_deplibs_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${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_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + *) + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd* | netbsdelf*-gnu | knetbsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$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' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z,text' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT 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_GCJ='${wl}-z,text' + allow_undefined_flag_GCJ='${wl}-z,nodefs' + archive_cmds_need_lc_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_GCJ" >&5 +$as_echo "$ld_shlibs_GCJ" >&6; } +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ 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; } + $rm conftest* + printf "$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_GCJ + pic_flag=$lt_prog_compiler_pic_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_GCJ 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 + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_GCJ" >&5 +$as_echo "$archive_cmds_need_lc_GCJ" >&6; } + ;; + esac + fi + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } +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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # 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. + 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 +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +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 + 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' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; 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 + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.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}' + else + # 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' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + 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=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $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' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + 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*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + 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' + 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="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + 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 + ;; + 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 + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # 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}${versuffix}$shared_ext ${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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + 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 + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + 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='GNU ld.so' + ;; + +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[123]*) 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} $libname${shared_ext}' + 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 + ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + 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 + 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 "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + 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' + ;; + +interix3*) + version_type=linux + 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 "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + 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 + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + 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 + # 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 + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;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' + ;; + +netbsdelf*-gnu) + version_type=linux + 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='NetBSD ld.elf_so' + ;; + +knetbsd*-gnu) + version_type=linux + 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='GNU 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 + 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=linux + 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 + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + 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 + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +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" + ;; + +solaris*) + version_type=linux + 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 "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + 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 + export_dynamic_flag_spec='${wl}-Blargedynsym' + 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 + 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=freebsd-elf + 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 + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + 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' + ;; + +uts4*) + version_type=linux + 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 "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +{ $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_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # 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 "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_GCJ" >&5 +$as_echo "$hardcode_action_GCJ" >&6; } + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# 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 + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# 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 + +# 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 + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# 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 + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# 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 + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# 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 in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# 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_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# 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_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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" + + else + tagname="" + fi + ;; + + RC) + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# 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. + +# 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 warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$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 +printf "$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 conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# 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 + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# 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 + +# 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 + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# 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 + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# 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 + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# 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 in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# 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_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# 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_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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" + + ;; + + *) + as_fn_error $? "Unsupported tag name: $tagname" "$LINENO" 5 + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + as_fn_error $? "unable to update list of available tagged configurations." "$LINENO" 5 + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + + +{ $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 + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC + 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_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$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 +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC QCC +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_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + 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 + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" 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_CXX_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'. + 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_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + 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 + ;; + none) break ;; + esac + # 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. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} 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_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if ac_fn_cxx_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 <ac_nonexistent.h> +_ACEOF +if ac_fn_cxx_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_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +@%:@else +@%:@ include <assert.h> +@%:@endif + Syntax error +_ACEOF +if ac_fn_cxx_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 <ac_nonexistent.h> +_ACEOF +if ac_fn_cxx_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 \"$CXXCPP\" 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 + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +# CXX fine tuning +case "$host" in + *-dec-osf*) + CXXFLAGS="$CXXFLAGS -std strict_ansi_errors" + ;; + *) + ;; +esac + +# Doxygen + +@%:@ Check whether --enable-doxygen was given. +if test "${enable_doxygen+set}" = set; then : + enableval=$enable_doxygen; +fi + + +@%:@ Check whether --enable-dot was given. +if test "${enable_dot+set}" = set; then : + enableval=$enable_dot; +fi + + +@%:@ Check whether --enable-html-docs was given. +if test "${enable_html_docs+set}" = set; then : + enableval=$enable_html_docs; +else + enable_html_docs=yes +fi + + +@%:@ Check whether --enable-latex-docs was given. +if test "${enable_latex_docs+set}" = set; then : + enableval=$enable_latex_docs; +else + enable_latex_docs=no +fi + + +if test "x$enable_doxygen" = xno; then + enable_doc=no +else + # Extract the first word of "doxygen", so it can be a program name with args. +set dummy doxygen; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOXYGEN+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOXYGEN in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOXYGEN=$ac_cv_path_DOXYGEN +if test -n "$DOXYGEN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 +$as_echo "$DOXYGEN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$DOXYGEN" = x; then + if test "x$enable_doxygen" = xyes; then + as_fn_error $? "could not find doxygen" "$LINENO" 5 + fi + enable_doc=no + else + enable_doc=yes + # Extract the first word of "dot", so it can be a program name with args. +set dummy dot; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi + + +if test x$enable_doc = xyes; then + DOC_TRUE= + DOC_FALSE='#' +else + DOC_TRUE='#' + DOC_FALSE= +fi + + + +if test x$enable_latex_docs = xyes; then + LATEX_DOC_TRUE= + LATEX_DOC_FALSE='#' +else + LATEX_DOC_TRUE='#' + LATEX_DOC_FALSE= +fi + + +if test x$DOT = x; then + if test "x$enable_dot" = xyes; then + as_fn_error $? "could not find dot" "$LINENO" 5 + fi + enable_dot=no +else + enable_dot=yes +fi + +manual_dest="manual" +base_dir=`(cd $srcdir && pwd)` + + + + + + + + + + +# Checks header files +# ---------------------------------------------------------------------------- + + apr_found="no" + + if test "$target_os" = "os2-emx"; then + # Scripts don't pass test -x on OS/2 + TEST_X="test -f" + else + TEST_X="test -x" + fi + + acceptable_majors="1" + + apr_temp_acceptable_apr_config="" + for apr_temp_major in $acceptable_majors + do + case $apr_temp_major in + 0) + apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config" + ;; + *) + apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config" + ;; + esac + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for APR" >&5 +$as_echo_n "checking for APR... " >&6; } + +@%:@ Check whether --with-apr was given. +if test "${with_apr+set}" = set; then : + withval=$with_apr; + if test "$withval" = "no" || test "$withval" = "yes"; then + as_fn_error $? "--with-apr requires a directory or file to be provided" "$LINENO" 5 + fi + + for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config + do + for lookdir in "$withval/bin" "$withval" + do + if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then + apr_config="$lookdir/$apr_temp_apr_config_file" + + apr_found="yes" + break 2 + fi + done + done + + if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then + apr_config="$withval" + apr_found="yes" + fi + + if test "$apr_found" != "yes"; then + as_fn_error $? "the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file." "$LINENO" 5 + fi + +else + + if test -n "1" && test "1" = "1"; then + for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config + do + if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then + apr_config="$apr_temp_apr_config_file" + + apr_found="yes" + break + else + for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do + if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then + apr_config="$lookdir/bin/$apr_temp_apr_config_file" + + apr_found="yes" + break 2 + fi + done + fi + done + fi + if test "$apr_found" = "no" && test -d ""; then + apr_temp_abs_srcdir="`cd && pwd`" + apr_found="reconfig" + apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"/include/apr_version.h\"`" + case $apr_bundled_major in + "") + as_fn_error $? "failed to find major version of bundled APR" "$LINENO" 5 + ;; + 0) + apr_temp_apr_config_file="apr-config" + ;; + *) + apr_temp_apr_config_file="apr-$apr_bundled_major-config" + ;; + esac + if test -n ""; then + apr_config="/$apr_temp_apr_config_file" + else + apr_config="/$apr_temp_apr_config_file" + fi + fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_found" >&5 +$as_echo "$apr_found" >&6; } + +if test "$apr_found" = "no"; then + as_fn_error $? "APR could not be located. Please use the --with-apr option." "$LINENO" 5 +fi + +CPPFLAGS="$CPPFLAGS `$apr_config --cppflags` `$apr_config --includes`" +APR_LIBS="`$apr_config --link-ld --libs`" + +LDFLAGS="$LDFLAGS $APR_LIBS" + + + apu_found="no" + + if test "$target_os" = "os2-emx"; then + # Scripts don't pass test -x on OS/2 + TEST_X="test -f" + else + TEST_X="test -x" + fi + + acceptable_majors="1" + + apu_temp_acceptable_apu_config="" + for apu_temp_major in $acceptable_majors + do + case $apu_temp_major in + 0) + apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config" + ;; + *) + apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config" + ;; + esac + done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for APR-util" >&5 +$as_echo_n "checking for APR-util... " >&6; } + +@%:@ Check whether --with-apr-util was given. +if test "${with_apr_util+set}" = set; then : + withval=$with_apr_util; + if test "$withval" = "no" || test "$withval" = "yes"; then + as_fn_error $? "--with-apr-util requires a directory or file to be provided" "$LINENO" 5 + fi + + for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config + do + for lookdir in "$withval/bin" "$withval" + do + if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then + apu_config="$lookdir/$apu_temp_apu_config_file" + + apu_found="yes" + break 2 + fi + done + done + + if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then + apu_config="$withval" + apu_found="yes" + fi + + if test "$apu_found" != "yes"; then + as_fn_error $? "the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file." "$LINENO" 5 + fi + +else + + if test -n "1" && test "1" = "1"; then + for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config + do + if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then + apu_config="$apu_temp_apu_config_file" + + apu_found="yes" + break + else + for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do + if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then + apu_config="$lookdir/bin/$apu_temp_apu_config_file" + + apu_found="yes" + break 2 + fi + done + fi + done + fi + if test "$apu_found" = "no" && test -d ""; then + apu_temp_abs_srcdir="`cd && pwd`" + apu_found="reconfig" + apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"/include/apu_version.h\"`" + case $apu_bundled_major in + "") + as_fn_error $? "failed to find major version of bundled APU" "$LINENO" 5 + ;; + 0) + apu_temp_apu_config_file="apu-config" + ;; + *) + apu_temp_apu_config_file="apu-$apu_bundled_major-config" + ;; + esac + if test -n ""; then + apu_config="/$apu_temp_apu_config_file" + else + apu_config="/$apu_temp_apu_config_file" + fi + fi + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $apu_found" >&5 +$as_echo "$apu_found" >&6; } + +if test "$apu_found" = "no"; then + as_fn_error $? "APR-util could not be located. Please use the --with-apr-util option." "$LINENO" 5 +fi + +CPPFLAGS="$CPPFLAGS `$apu_config --includes`" +APU_LIBS="`$apu_config --link-ld --libs`" + +LDFLAGS="$LDFLAGS $APU_LIBS" + +# Checks local idioms +# ---------------------------------------------------------------------------- + +# for local syslog() function for SyslogAppender +for ac_func in mbsrtowcs +do : + ac_fn_cxx_check_func "$LINENO" "mbsrtowcs" "ac_cv_func_mbsrtowcs" +if test "x$ac_cv_func_mbsrtowcs" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_MBSRTOWCS 1 +_ACEOF + have_mbsrtowcs=yes +else + have_mbsrtowcs=no +fi +done + +if test "$have_mbsrtowcs" = "yes" +then + HAS_MBSRTOWCS=1 + +else + HAS_MBSRTOWCS=0 + +fi + +for ac_func in wcstombs +do : + ac_fn_cxx_check_func "$LINENO" "wcstombs" "ac_cv_func_wcstombs" +if test "x$ac_cv_func_wcstombs" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_WCSTOMBS 1 +_ACEOF + have_wcstombs=yes +else + have_wcstombs=no +fi +done + +if test "$have_wcstombs" = "yes" +then + HAS_WCSTOMBS=1 + +else + HAS_WCSTOMBS=0 + +fi + +# for local syslog() function for SyslogAppender +for ac_func in syslog +do : + ac_fn_cxx_check_func "$LINENO" "syslog" "ac_cv_func_syslog" +if test "x$ac_cv_func_syslog" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_SYSLOG 1 +_ACEOF + have_syslog=yes +else + have_syslog=no +fi +done + +if test "$have_syslog" = "yes" +then + HAS_SYSLOG=1 + +else + HAS_SYSLOG=0 + +fi + + +ac_fn_cxx_check_header_mongrel "$LINENO" "locale" "ac_cv_header_locale" "$ac_includes_default" +if test "x$ac_cv_header_locale" = xyes; then : + have_locale=yes +else + have_locale=no +fi + + +if test "$have_locale" = "yes" +then + HAS_STD_LOCALE=1 + +else + HAS_STD_LOCALE=0 + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 +$as_echo_n "checking for wchar_t... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <string> + std::wstring w; +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + have_wchar_t=yes +else + have_wchar_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_wchar_t" >&5 +$as_echo "$have_wchar_t" >&6; } +if test "$have_wchar_t" = "yes" +then + HAS_WCHAR_T=1 + +else + HAS_WCHAR_T=0 + +fi + +for ac_func in fwide +do : + ac_fn_cxx_check_func "$LINENO" "fwide" "ac_cv_func_fwide" +if test "x$ac_cv_func_fwide" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_FWIDE 1 +_ACEOF + have_fwide=yes +else + have_fwide=no +fi +done + +if test "$have_fwide" = "yes" +then + HAS_FWIDE=1 + +else + HAS_FWIDE=0 + +fi + + +# Checks for libraries +# ---------------------------------------------------------------------------- + +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 + + + +#for ODBCAppender +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ODBC support" >&5 +$as_echo_n "checking for ODBC support... " >&6; } + +@%:@ Check whether --with-ODBC was given. +if test "${with_ODBC+set}" = set; then : + withval=$with_ODBC; ac_with_odbc=$withval +else + ac_with_odbc=no +fi + +case "$ac_with_odbc" in + Microsoft) + HAS_ODBC=1 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Microsoft" >&5 +$as_echo "Microsoft" >&6; } + LIBS_ODBC="-lodbc32" + ;; + unixODBC) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unixODBC" >&5 +$as_echo "unixODBC" >&6; } + ac_fn_cxx_check_header_mongrel "$LINENO" "sqlext.h" "ac_cv_header_sqlext_h" "$ac_includes_default" +if test "x$ac_cv_header_sqlext_h" = xyes; then : + +else + as_fn_error $? "unixODBC not found !" "$LINENO" 5 +fi + + + HAS_ODBC=1 + + LIBS_ODBC="-lodbc" + ;; + iODBC) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: iODBC" >&5 +$as_echo "iODBC" >&6; } + # Extract the first word of "iodbc-config", so it can be a program name with args. +set dummy iodbc-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_prog_IODBC_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$IODBC_CONFIG"; then + ac_cv_prog_IODBC_CONFIG="$IODBC_CONFIG" # 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_IODBC_CONFIG="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_IODBC_CONFIG" && ac_cv_prog_IODBC_CONFIG="no" +fi +fi +IODBC_CONFIG=$ac_cv_prog_IODBC_CONFIG +if test -n "$IODBC_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IODBC_CONFIG" >&5 +$as_echo "$IODBC_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$IODBC_CONFIG" = "xyes" + then + HAS_ODBC=1 + + LIBS_ODBC="`iodbc-config --libs`" + CPPFLAGS_ODBC="`iodbc-config --cflags`" + else + as_fn_error $? "iODBC not found !" "$LINENO" 5 + fi + ;; + no) + HAS_ODBC=0 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 +$as_echo "???" >&6; } + as_fn_error $? "Unknown option : $ac_with_odbc" "$LINENO" 5 + ;; +esac + + + + +#for SMTPAppender +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SMTP support" >&5 +$as_echo_n "checking for SMTP support... " >&6; } + +@%:@ Check whether --with-SMTP was given. +if test "${with_SMTP+set}" = set; then : + withval=$with_SMTP; ac_with_smtp=$withval +else + ac_with_smtp=no +fi + +case "$ac_with_smtp" in + libesmtp) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libesmtp" >&5 +$as_echo "libesmtp" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for smtp_create_session in -lesmtp" >&5 +$as_echo_n "checking for smtp_create_session in -lesmtp... " >&6; } +if ${ac_cv_lib_esmtp_smtp_create_session+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lesmtp -lesmtp $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 smtp_create_session (); +int +main () +{ +return smtp_create_session (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_esmtp_smtp_create_session=yes +else + ac_cv_lib_esmtp_smtp_create_session=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_esmtp_smtp_create_session" >&5 +$as_echo "$ac_cv_lib_esmtp_smtp_create_session" >&6; } +if test "x$ac_cv_lib_esmtp_smtp_create_session" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBESMTP 1 +_ACEOF + + LIBS="-lesmtp $LIBS" + +else + as_fn_error $? "libesmtp library not found !" "$LINENO" 5 +fi + + HAS_LIBESMTP=1 + + LIBS="-lesmtp $LIBS" + ;; + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + HAS_LIBESMTP=0 + + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 +$as_echo "???" >&6; } + as_fn_error $? "Unknown option : $ac_with_smtp" "$LINENO" 5 + ;; +esac + +#for char api +@%:@ Check whether --enable-char was given. +if test "${enable_char+set}" = set; then : + enableval=$enable_char; +fi + +if test "x$enable_char" = xno; then + have_char_api=no +else + have_char_api=yes +fi + +if test "$have_char_api" = "yes" +then + CHAR_API=1 + +else + CHAR_API=0 + +fi + +#for wchar_t api +@%:@ Check whether --enable-wchar_t was given. +if test "${enable_wchar_t+set}" = set; then : + enableval=$enable_wchar_t; +fi + +if test "x$enable_wchar_t" = xno; then + have_wchar_t_api=no +else + if test "$have_wchar_t" = "yes" + then + have_wchar_t_api=yes + else + have_wchar_t_api=no + fi +fi + +if test "$have_wchar_t_api" = "yes" +then + WCHAR_T_API=1 + +else + WCHAR_T_API=0 + +fi + +#for unichar api +@%:@ Check whether --enable-unichar was given. +if test "${enable_unichar+set}" = set; then : + enableval=$enable_unichar; +fi + +if test "x$enable_unichar" = "yes" +then + UNICHAR_API=1 + +else + UNICHAR_API=0 + +fi + +#for cfstring api +@%:@ Check whether --enable-cfstring was given. +if test "${enable_cfstring+set}" = set; then : + enableval=$enable_cfstring; +fi + +if test "x$enable_cfstring" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cfstring" >&5 +$as_echo_n "checking for cfstring... " >&6; } + CPPFLAGS="$CPPFLAGS -framework CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <CoreFoundation/CFString.h> + CFStringRef x = CFSTR("Hello"); +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + have_cfstring_api=yes +else + have_cfstring_api=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_cfstring_api" >&5 +$as_echo "$have_cfstring_api" >&6; } +else + have_cfstring_api=no +fi + +if test "$have_cfstring_api" = "yes" +then + CFSTRING_API=1 + +else + CFSTRING_API=0 + +fi + +#determine charset type +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking charset type" >&5 +$as_echo_n "checking charset type... " >&6; } + +@%:@ Check whether --with-charset was given. +if test "${with_charset+set}" = set; then : + withval=$with_charset; ac_with_charset=$withval +else + ac_with_charset=auto +fi + + +case "$ac_with_charset" in + utf-8) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: utf-8" >&5 +$as_echo "utf-8" >&6; } + CHARSET_UTF8=1 + + CHARSET_ISO88591=0 + + CHARSET_USASCII=0 + + CHARSET_EBCDIC=0 + + ;; + + iso-8859-1) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: iso-8859-1" >&5 +$as_echo "iso-8859-1" >&6; } + CHARSET_UTF8=0 + + CHARSET_ISO88591=1 + + CHARSET_USASCII=0 + + CHARSET_EBCDIC=0 + + ;; + + usascii) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: usascii" >&5 +$as_echo "usascii" >&6; } + CHARSET_UTF8=0 + + CHARSET_ISO88591=0 + + CHARSET_USASCII=1 + + CHARSET_EBCDIC=0 + + ;; + + ebcdic) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: usascii" >&5 +$as_echo "usascii" >&6; } + CHARSET_UTF8=0 + + CHARSET_ISO88591=0 + + CHARSET_USASCII=0 + + CHARSET_EBCDIC=1 + + ;; + + auto) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: auto" >&5 +$as_echo "auto" >&6; } + CHARSET_UTF8=0 + + CHARSET_ISO88591=0 + + CHARSET_USASCII=0 + + CHARSET_EBCDIC=0 + + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 +$as_echo "???" >&6; } + as_fn_error $? "Invalid charset type: $ac_with_charset" "$LINENO" 5 + ;; +esac + + + +#determine logchar type +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking logchar type" >&5 +$as_echo_n "checking logchar type... " >&6; } + +@%:@ Check whether --with-logchar was given. +if test "${with_logchar+set}" = set; then : + withval=$with_logchar; ac_with_logchar=$withval +else + ac_with_logchar=utf-8 +fi + + +case "$ac_with_logchar" in + utf-8) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: utf-8" >&5 +$as_echo "utf-8" >&6; } + LOGCHAR_IS_UTF8=1 + + LOGCHAR_IS_WCHAR=0 + + LOGCHAR_IS_UNICHAR=0 + + ;; + + wchar_t) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: wchar_t" >&5 +$as_echo "wchar_t" >&6; } + LOGCHAR_IS_UTF8=0 + + LOGCHAR_IS_WCHAR=1 + + LOGCHAR_IS_UNICHAR=0 + + ;; + + unichar) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unichar" >&5 +$as_echo "unichar" >&6; } + LOGCHAR_IS_UTF8=0 + + LOGCHAR_IS_WCHAR=0 + + LOGCHAR_IS_UNICHAR=1 + + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ???" >&5 +$as_echo "???" >&6; } + as_fn_error $? "Invalid logchar type: $ac_with_logchar" "$LINENO" 5 + ;; +esac + + + +# Create files +# ---------------------------------------------------------------------------- + +ac_config_files="$ac_config_files Makefile liblog4cxx.pc src/Makefile src/main/Makefile src/main/cpp/Makefile src/main/include/Makefile src/main/include/log4cxx/log4cxx.h src/main/include/log4cxx/private/log4cxx_private.h src/main/include/log4cxx/private/Makefile src/main/include/log4cxx/Makefile src/main/include/log4cxx/helpers/Makefile src/main/include/log4cxx/net/Makefile src/main/include/log4cxx/nt/Makefile src/main/include/log4cxx/spi/Makefile src/main/include/log4cxx/spi/location/Makefile src/main/include/log4cxx/varia/Makefile src/main/include/log4cxx/xml/Makefile src/main/include/log4cxx/config/Makefile src/main/include/log4cxx/db/Makefile src/main/include/log4cxx/rolling/Makefile src/main/include/log4cxx/pattern/Makefile src/main/include/log4cxx/filter/Makefile src/site/Makefile src/site/doxy/Makefile src/site/doxy/Doxyfile src/test/Makefile src/test/resources/Makefile src/test/resources/input/Makefile src/test/resources/input/ndc/Makefile src/test/resources/input/rolling/Makefile src/test/resources/input/xml/Makefile src/test/cpp/Makefile src/test/resources/witness/Makefile src/test/resources/witness/encoding/Makefile src/test/resources/witness/ndc/Makefile src/test/resources/witness/rolling/Makefile src/examples/Makefile src/examples/cpp/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIB@&t@OBJS; 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 +LIB@&t@OBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DOC_TRUE}" && test -z "${DOC_FALSE}"; then + as_fn_error $? "conditional \"DOC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${LATEX_DOC_TRUE}" && test -z "${LATEX_DOC_FALSE}"; then + as_fn_error $? "conditional \"LATEX_DOC\" 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 @S|@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 @S|@? 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 @S|@as_val. Take advantage of shells that can avoid forks. The arguments +@%:@ must be portable across @S|@(()) 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 "@S|@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 $as_me, 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 + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +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 + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +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' +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;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "liblog4cxx.pc") CONFIG_FILES="$CONFIG_FILES liblog4cxx.pc" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/main/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/Makefile" ;; + "src/main/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/cpp/Makefile" ;; + "src/main/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/Makefile" ;; + "src/main/include/log4cxx/log4cxx.h") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/log4cxx.h" ;; + "src/main/include/log4cxx/private/log4cxx_private.h") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/private/log4cxx_private.h" ;; + "src/main/include/log4cxx/private/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/private/Makefile" ;; + "src/main/include/log4cxx/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/Makefile" ;; + "src/main/include/log4cxx/helpers/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/helpers/Makefile" ;; + "src/main/include/log4cxx/net/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/net/Makefile" ;; + "src/main/include/log4cxx/nt/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/nt/Makefile" ;; + "src/main/include/log4cxx/spi/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/spi/Makefile" ;; + "src/main/include/log4cxx/spi/location/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/spi/location/Makefile" ;; + "src/main/include/log4cxx/varia/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/varia/Makefile" ;; + "src/main/include/log4cxx/xml/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/xml/Makefile" ;; + "src/main/include/log4cxx/config/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/config/Makefile" ;; + "src/main/include/log4cxx/db/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/db/Makefile" ;; + "src/main/include/log4cxx/rolling/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/rolling/Makefile" ;; + "src/main/include/log4cxx/pattern/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/pattern/Makefile" ;; + "src/main/include/log4cxx/filter/Makefile") CONFIG_FILES="$CONFIG_FILES src/main/include/log4cxx/filter/Makefile" ;; + "src/site/Makefile") CONFIG_FILES="$CONFIG_FILES src/site/Makefile" ;; + "src/site/doxy/Makefile") CONFIG_FILES="$CONFIG_FILES src/site/doxy/Makefile" ;; + "src/site/doxy/Doxyfile") CONFIG_FILES="$CONFIG_FILES src/site/doxy/Doxyfile" ;; + "src/test/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/Makefile" ;; + "src/test/resources/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/Makefile" ;; + "src/test/resources/input/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/Makefile" ;; + "src/test/resources/input/ndc/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/ndc/Makefile" ;; + "src/test/resources/input/rolling/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/rolling/Makefile" ;; + "src/test/resources/input/xml/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/input/xml/Makefile" ;; + "src/test/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/cpp/Makefile" ;; + "src/test/resources/witness/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/Makefile" ;; + "src/test/resources/witness/encoding/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/encoding/Makefile" ;; + "src/test/resources/witness/ndc/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/ndc/Makefile" ;; + "src/test/resources/witness/rolling/Makefile") CONFIG_FILES="$CONFIG_FILES src/test/resources/witness/rolling/Makefile" ;; + "src/examples/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;; + "src/examples/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/cpp/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_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 2>/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 +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$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" + + +eval set X " :F $CONFIG_FILES :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 +_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 +$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 + ;; + + + :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"" || for mf in $CONFIG_FILES; 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. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/requests b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/requests new file mode 100644 index 0000000000..4230a26bbf --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/requests @@ -0,0 +1,78 @@ +# This file was generated by Autom4te Thu Apr 10 10:06:43 UTC 2014. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'aclocal.m4', + 'configure.in' + ], + { + 'AM_MAKEFILE_INCLUDE' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'sinclude' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AM_GNU_GETTEXT' => 1, + '_AM_COND_ELSE' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'AC_CONFIG_LINKS' => 1, + 'm4_sinclude' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AM_PROG_CC_C_O' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AM_SILENT_RULES' => 1, + 'AM_PROG_F77_C_O' => 1, + 'AC_SUBST' => 1, + 'm4_pattern_forbid' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_FC_FREEFORM' => 1, + 'AM_POT_TOOLS' => 1, + 'AC_CANONICAL_HOST' => 1, + 'LT_INIT' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + '_AM_MAKEFILE_INCLUDE' => 1, + 'AC_FC_PP_SRCEXT' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + '_LT_AC_TAGCONFIG' => 1, + 'AM_PATH_GUILE' => 1, + 'AC_CONFIG_FILES' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AC_INIT' => 1, + 'AC_SUBST_TRACE' => 1, + 'AM_PROG_AR' => 1, + 'm4_include' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, + 'AH_OUTPUT' => 1, + 'AC_FC_PP_DEFINE' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'm4_pattern_allow' => 1, + 'AM_CONDITIONAL' => 1, + '_AM_COND_ENDIF' => 1, + '_AM_COND_IF' => 1, + 'AM_PROG_MOC' => 1, + 'AM_PROG_CXX_C_O' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'include' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AM_XGETTEXT_OPTION' => 1, + 'AM_NLS' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AC_PROG_LIBTOOL' => 1, + '_m4_warn' => 1, + 'AC_FC_SRCEXT' => 1 + } + ], 'Autom4te::Request' ) + ); + diff --git a/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/traces.0 b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/traces.0 new file mode 100644 index 0000000000..e3e68a1a13 --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/autom4te.cache/traces.0 @@ -0,0 +1,1131 @@ +m4trace:aclocal.m4:7256: -1- m4_include([find_apr.m4]) +m4trace:aclocal.m4:7257: -1- m4_include([find_apu.m4]) +m4trace:configure.in:1: -1- AC_INIT([src/main/cpp/logger.cpp]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.in:1: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.in:1: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.in:1: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.in:1: -1- AC_SUBST([SHELL]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([SHELL]) +m4trace:configure.in:1: -1- m4_pattern_allow([^SHELL$]) +m4trace:configure.in:1: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PATH_SEPARATOR$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_NAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_STRING]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:1: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([PACKAGE_URL]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_URL$]) +m4trace:configure.in:1: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([exec_prefix]) +m4trace:configure.in:1: -1- m4_pattern_allow([^exec_prefix$]) +m4trace:configure.in:1: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([prefix]) +m4trace:configure.in:1: -1- m4_pattern_allow([^prefix$]) +m4trace:configure.in:1: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([program_transform_name]) +m4trace:configure.in:1: -1- m4_pattern_allow([^program_transform_name$]) +m4trace:configure.in:1: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([bindir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^bindir$]) +m4trace:configure.in:1: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([sbindir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^sbindir$]) +m4trace:configure.in:1: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([libexecdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^libexecdir$]) +m4trace:configure.in:1: -1- AC_SUBST([datarootdir], ['${prefix}/share']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([datarootdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^datarootdir$]) +m4trace:configure.in:1: -1- AC_SUBST([datadir], ['${datarootdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([datadir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^datadir$]) +m4trace:configure.in:1: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([sysconfdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^sysconfdir$]) +m4trace:configure.in:1: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([sharedstatedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^sharedstatedir$]) +m4trace:configure.in:1: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([localstatedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.in:1: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([includedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^includedir$]) +m4trace:configure.in:1: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([oldincludedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^oldincludedir$]) +m4trace:configure.in:1: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([docdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^docdir$]) +m4trace:configure.in:1: -1- AC_SUBST([infodir], ['${datarootdir}/info']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([infodir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^infodir$]) +m4trace:configure.in:1: -1- AC_SUBST([htmldir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([htmldir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^htmldir$]) +m4trace:configure.in:1: -1- AC_SUBST([dvidir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([dvidir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^dvidir$]) +m4trace:configure.in:1: -1- AC_SUBST([pdfdir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([pdfdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^pdfdir$]) +m4trace:configure.in:1: -1- AC_SUBST([psdir], ['${docdir}']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([psdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^psdir$]) +m4trace:configure.in:1: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([libdir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^libdir$]) +m4trace:configure.in:1: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([localedir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^localedir$]) +m4trace:configure.in:1: -1- AC_SUBST([mandir], ['${datarootdir}/man']) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([mandir]) +m4trace:configure.in:1: -1- m4_pattern_allow([^mandir$]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +@%:@undef PACKAGE_NAME]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +@%:@undef PACKAGE_TARNAME]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +@%:@undef PACKAGE_VERSION]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +@%:@undef PACKAGE_STRING]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +@%:@undef PACKAGE_BUGREPORT]) +m4trace:configure.in:1: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL]) +m4trace:configure.in:1: -1- m4_pattern_allow([^PACKAGE_URL$]) +m4trace:configure.in:1: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */ +@%:@undef PACKAGE_URL]) +m4trace:configure.in:1: -1- AC_SUBST([DEFS]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([DEFS]) +m4trace:configure.in:1: -1- m4_pattern_allow([^DEFS$]) +m4trace:configure.in:1: -1- AC_SUBST([ECHO_C]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_C]) +m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_C$]) +m4trace:configure.in:1: -1- AC_SUBST([ECHO_N]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_N]) +m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_N$]) +m4trace:configure.in:1: -1- AC_SUBST([ECHO_T]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([ECHO_T]) +m4trace:configure.in:1: -1- m4_pattern_allow([^ECHO_T$]) +m4trace:configure.in:1: -1- AC_SUBST([LIBS]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:1: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:1: -1- AC_SUBST([build_alias]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([build_alias]) +m4trace:configure.in:1: -1- m4_pattern_allow([^build_alias$]) +m4trace:configure.in:1: -1- AC_SUBST([host_alias]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([host_alias]) +m4trace:configure.in:1: -1- m4_pattern_allow([^host_alias$]) +m4trace:configure.in:1: -1- AC_SUBST([target_alias]) +m4trace:configure.in:1: -1- AC_SUBST_TRACE([target_alias]) +m4trace:configure.in:1: -1- m4_pattern_allow([^target_alias$]) +m4trace:configure.in:22: -1- AC_CANONICAL_HOST +m4trace:configure.in:22: -1- AC_CANONICAL_BUILD +m4trace:configure.in:22: -1- AC_REQUIRE_AUX_FILE([config.sub]) +m4trace:configure.in:22: -1- AC_REQUIRE_AUX_FILE([config.guess]) +m4trace:configure.in:22: -1- AC_SUBST([build], [$ac_cv_build]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([build]) +m4trace:configure.in:22: -1- m4_pattern_allow([^build$]) +m4trace:configure.in:22: -1- AC_SUBST([build_cpu], [$[1]]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([build_cpu]) +m4trace:configure.in:22: -1- m4_pattern_allow([^build_cpu$]) +m4trace:configure.in:22: -1- AC_SUBST([build_vendor], [$[2]]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([build_vendor]) +m4trace:configure.in:22: -1- m4_pattern_allow([^build_vendor$]) +m4trace:configure.in:22: -1- AC_SUBST([build_os]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([build_os]) +m4trace:configure.in:22: -1- m4_pattern_allow([^build_os$]) +m4trace:configure.in:22: -1- AC_SUBST([host], [$ac_cv_host]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([host]) +m4trace:configure.in:22: -1- m4_pattern_allow([^host$]) +m4trace:configure.in:22: -1- AC_SUBST([host_cpu], [$[1]]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([host_cpu]) +m4trace:configure.in:22: -1- m4_pattern_allow([^host_cpu$]) +m4trace:configure.in:22: -1- AC_SUBST([host_vendor], [$[2]]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([host_vendor]) +m4trace:configure.in:22: -1- m4_pattern_allow([^host_vendor$]) +m4trace:configure.in:22: -1- AC_SUBST([host_os]) +m4trace:configure.in:22: -1- AC_SUBST_TRACE([host_os]) +m4trace:configure.in:22: -1- m4_pattern_allow([^host_os$]) +m4trace:configure.in:23: -1- AC_CANONICAL_TARGET +m4trace:configure.in:23: -1- AC_SUBST([target], [$ac_cv_target]) +m4trace:configure.in:23: -1- AC_SUBST_TRACE([target]) +m4trace:configure.in:23: -1- m4_pattern_allow([^target$]) +m4trace:configure.in:23: -1- AC_SUBST([target_cpu], [$[1]]) +m4trace:configure.in:23: -1- AC_SUBST_TRACE([target_cpu]) +m4trace:configure.in:23: -1- m4_pattern_allow([^target_cpu$]) +m4trace:configure.in:23: -1- AC_SUBST([target_vendor], [$[2]]) +m4trace:configure.in:23: -1- AC_SUBST_TRACE([target_vendor]) +m4trace:configure.in:23: -1- m4_pattern_allow([^target_vendor$]) +m4trace:configure.in:23: -1- AC_SUBST([target_os]) +m4trace:configure.in:23: -1- AC_SUBST_TRACE([target_os]) +m4trace:configure.in:23: -1- m4_pattern_allow([^target_os$]) +m4trace:configure.in:34: -1- AC_SUBST([LT_VERSION]) +m4trace:configure.in:34: -1- AC_SUBST_TRACE([LT_VERSION]) +m4trace:configure.in:34: -1- m4_pattern_allow([^LT_VERSION$]) +m4trace:configure.in:36: -1- AH_OUTPUT([HAVE_NO_EXPLICIT_EXPORTS], [/* no explicit exports */ +#define LOG4CXX_EXPORT]) +m4trace:configure.in:40: -1- AM_INIT_AUTOMAKE([log4cxx], [0.10.0]) +m4trace:configure.in:40: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) +m4trace:configure.in:40: -1- AM_AUTOMAKE_VERSION([1.9.6]) +m4trace:configure.in:40: -1- AC_REQUIRE_AUX_FILE([install-sh]) +m4trace:configure.in:40: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) +m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.in:40: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) +m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.in:40: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_DATA]) +m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.in:40: -1- AC_SUBST([CYGPATH_W]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([CYGPATH_W]) +m4trace:configure.in:40: -1- m4_pattern_allow([^CYGPATH_W$]) +m4trace:configure.in:40: -1- AC_SUBST([PACKAGE], [log4cxx]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([PACKAGE]) +m4trace:configure.in:40: -1- m4_pattern_allow([^PACKAGE$]) +m4trace:configure.in:40: -1- AC_SUBST([VERSION], [0.10.0]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([VERSION]) +m4trace:configure.in:40: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.in:40: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) +m4trace:configure.in:40: -1- m4_pattern_allow([^PACKAGE$]) +m4trace:configure.in:40: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ +@%:@undef PACKAGE]) +m4trace:configure.in:40: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) +m4trace:configure.in:40: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.in:40: -1- AH_OUTPUT([VERSION], [/* Version number of package */ +@%:@undef VERSION]) +m4trace:configure.in:40: -1- AC_SUBST([ACLOCAL]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([ACLOCAL]) +m4trace:configure.in:40: -1- m4_pattern_allow([^ACLOCAL$]) +m4trace:configure.in:40: -1- AC_SUBST([AUTOCONF]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([AUTOCONF]) +m4trace:configure.in:40: -1- m4_pattern_allow([^AUTOCONF$]) +m4trace:configure.in:40: -1- AC_SUBST([AUTOMAKE]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([AUTOMAKE]) +m4trace:configure.in:40: -1- m4_pattern_allow([^AUTOMAKE$]) +m4trace:configure.in:40: -1- AC_SUBST([AUTOHEADER]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([AUTOHEADER]) +m4trace:configure.in:40: -1- m4_pattern_allow([^AUTOHEADER$]) +m4trace:configure.in:40: -1- AC_SUBST([MAKEINFO]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([MAKEINFO]) +m4trace:configure.in:40: -1- m4_pattern_allow([^MAKEINFO$]) +m4trace:configure.in:40: -1- AC_SUBST([install_sh]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([install_sh]) +m4trace:configure.in:40: -1- m4_pattern_allow([^install_sh$]) +m4trace:configure.in:40: -1- AC_SUBST([STRIP]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([STRIP]) +m4trace:configure.in:40: -1- m4_pattern_allow([^STRIP$]) +m4trace:configure.in:40: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM]) +m4trace:configure.in:40: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$]) +m4trace:configure.in:40: -1- AC_SUBST([mkdir_p]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([mkdir_p]) +m4trace:configure.in:40: -1- m4_pattern_allow([^mkdir_p$]) +m4trace:configure.in:40: -1- AC_SUBST([AWK]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([AWK]) +m4trace:configure.in:40: -1- m4_pattern_allow([^AWK$]) +m4trace:configure.in:40: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([SET_MAKE]) +m4trace:configure.in:40: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.in:40: -1- AC_SUBST([am__leading_dot]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([am__leading_dot]) +m4trace:configure.in:40: -1- m4_pattern_allow([^am__leading_dot$]) +m4trace:configure.in:40: -1- AC_SUBST([AMTAR]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([AMTAR]) +m4trace:configure.in:40: -1- m4_pattern_allow([^AMTAR$]) +m4trace:configure.in:40: -1- AC_SUBST([am__tar]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([am__tar]) +m4trace:configure.in:40: -1- m4_pattern_allow([^am__tar$]) +m4trace:configure.in:40: -1- AC_SUBST([am__untar]) +m4trace:configure.in:40: -1- AC_SUBST_TRACE([am__untar]) +m4trace:configure.in:40: -1- m4_pattern_allow([^am__untar$]) +m4trace:configure.in:45: -1- AC_PROG_LIBTOOL +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... +aclocal.m4:1927: AC_ENABLE_SHARED is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... +aclocal.m4:1966: AC_ENABLE_STATIC is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... +aclocal.m4:2005: AC_ENABLE_FAST_INSTALL is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- AC_SUBST([CC]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:45: -1- AC_SUBST([CFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([LIBS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([CC]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:45: -1- AC_SUBST([CC]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:45: -1- AC_SUBST([CC]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:45: -1- AC_SUBST([CC]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:45: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.in:45: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.in:45: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([EXEEXT]) +m4trace:configure.in:45: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.in:45: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([OBJEXT]) +m4trace:configure.in:45: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.in:45: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([DEPDIR]) +m4trace:configure.in:45: -1- m4_pattern_allow([^DEPDIR$]) +m4trace:configure.in:45: -1- AC_SUBST([am__include]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__include]) +m4trace:configure.in:45: -1- m4_pattern_allow([^am__include$]) +m4trace:configure.in:45: -1- AC_SUBST([am__quote]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__quote]) +m4trace:configure.in:45: -1- m4_pattern_allow([^am__quote$]) +m4trace:configure.in:45: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +m4trace:configure.in:45: -1- AC_SUBST([AMDEP_TRUE]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([AMDEP_TRUE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^AMDEP_TRUE$]) +m4trace:configure.in:45: -1- AC_SUBST([AMDEP_FALSE]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([AMDEP_FALSE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^AMDEP_FALSE$]) +m4trace:configure.in:45: -1- AC_SUBST([AMDEPBACKSLASH]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([AMDEPBACKSLASH]) +m4trace:configure.in:45: -1- m4_pattern_allow([^AMDEPBACKSLASH$]) +m4trace:configure.in:45: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CCDEPMODE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CCDEPMODE$]) +m4trace:configure.in:45: -1- AM_CONDITIONAL([am__fastdepCC], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCC_TRUE]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCC_TRUE$]) +m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCC_FALSE]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCC_FALSE$]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1481: AC_ARG_WITH is expanded from... +aclocal.m4:2146: AC_PROG_LD is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- AC_SUBST([GREP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.in:45: -1- AC_SUBST([EGREP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.in:45: -1- AC_SUBST([LN_S], [$as_ln_s]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LN_S]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LN_S$]) +m4trace:configure.in:45: -1- AC_SUBST([ECHO]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([ECHO]) +m4trace:configure.in:45: -1- m4_pattern_allow([^ECHO$]) +m4trace:configure.in:45: -1- AC_SUBST([AR]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([AR]) +m4trace:configure.in:45: -1- m4_pattern_allow([^AR$]) +m4trace:configure.in:45: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([RANLIB]) +m4trace:configure.in:45: -1- m4_pattern_allow([^RANLIB$]) +m4trace:configure.in:45: -1- AC_SUBST([STRIP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([STRIP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^STRIP$]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1462: AC_ARG_ENABLE is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1481: AC_ARG_WITH is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... +aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... +aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:2687: AC_TRY_LINK is expanded from... +../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from... +../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:475: _LT_AC_LOCK is expanded from... +aclocal.m4:1079: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from... +aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... +aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... +../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... +aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... +aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... +aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... +aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... +../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... +aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... +aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... +aclocal.m4:2669: _LT_AC_LANG_C_CONFIG is expanded from... +aclocal.m4:2668: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the <dlfcn.h> header file. */ +@%:@undef HAVE_DLFCN_H]) +m4trace:configure.in:45: -1- AC_SUBST([CPP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([CPP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:45: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.in:45: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +@%:@undef STDC_HEADERS]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */ +@%:@undef HAVE_SYS_TYPES_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */ +@%:@undef HAVE_SYS_STAT_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */ +@%:@undef HAVE_STDLIB_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */ +@%:@undef HAVE_STRING_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */ +@%:@undef HAVE_MEMORY_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the <strings.h> header file. */ +@%:@undef HAVE_STRINGS_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */ +@%:@undef HAVE_INTTYPES_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */ +@%:@undef HAVE_STDINT_H]) +m4trace:configure.in:45: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */ +@%:@undef HAVE_UNISTD_H]) +m4trace:configure.in:45: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DLFCN_H]) +m4trace:configure.in:45: -1- m4_pattern_allow([^HAVE_DLFCN_H$]) +m4trace:configure.in:45: -1- _LT_AC_TAGCONFIG +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +../../lib/autoconf/general.m4:1481: AC_ARG_WITH is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists], [aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- AC_SUBST([CXX]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXX]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.in:45: -1- AC_SUBST([CXXFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CXXFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([LIBS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([CXX]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXX]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.in:45: -1- AC_SUBST([ac_ct_CXX]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([ac_ct_CXX]) +m4trace:configure.in:45: -1- m4_pattern_allow([^ac_ct_CXX$]) +m4trace:configure.in:45: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXDEPMODE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CXXDEPMODE$]) +m4trace:configure.in:45: -1- AM_CONDITIONAL([am__fastdepCXX], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCXX_TRUE]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCXX_TRUE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) +m4trace:configure.in:45: -1- AC_SUBST([am__fastdepCXX_FALSE]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([am__fastdepCXX_FALSE]) +m4trace:configure.in:45: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) +m4trace:configure.in:45: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXCPP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CXXCPP$]) +m4trace:configure.in:45: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([CXXCPP]) +m4trace:configure.in:45: -1- m4_pattern_allow([^CXXCPP$]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... +../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... +aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... +aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... +aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... +../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... +aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... +aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... +aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works_CXX, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... +aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works_CXX, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:2746: _LT_AC_LANG_CXX_CONFIG is expanded from... +aclocal.m4:2745: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- AC_SUBST([F77]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([F77]) +m4trace:configure.in:45: -1- m4_pattern_allow([^F77$]) +m4trace:configure.in:45: -1- AC_SUBST([FFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([FFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^FFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:45: -1- AC_SUBST([LIBS]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:45: -1- AC_SUBST([F77]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([F77]) +m4trace:configure.in:45: -1- m4_pattern_allow([^F77$]) +m4trace:configure.in:45: -1- AC_SUBST([ac_ct_F77]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([ac_ct_F77]) +m4trace:configure.in:45: -1- m4_pattern_allow([^ac_ct_F77$]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works_F77, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:3909: _LT_AC_LANG_F77_CONFIG is expanded from... +aclocal.m4:3908: AC_LIBTOOL_LANG_F77_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works_F77, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:3909: _LT_AC_LANG_F77_CONFIG is expanded from... +aclocal.m4:3908: AC_LIBTOOL_LANG_F77_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... +aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_pic_works_GCJ, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:621: AC_LIBTOOL_COMPILER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_CACHE_VAL(lt_prog_compiler_static_works_GCJ, ...): suspicious cache-id, must contain _cv_ to be cached], [../../lib/autoconf/general.m4:2031: AC_CACHE_VAL is expanded from... +../../lib/autoconf/general.m4:2052: AC_CACHE_CHECK is expanded from... +aclocal.m4:666: AC_LIBTOOL_LINKER_OPTION is expanded from... +aclocal.m4:4821: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from... +aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... +../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... +aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... +aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... +aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2661: _AC_LINK_IFELSE is expanded from... +../../lib/autoconf/general.m4:2678: AC_LINK_IFELSE is expanded from... +aclocal.m4:295: _LT_AC_SYS_LIBPATH_AIX is expanded from... +aclocal.m4:5348: AC_LIBTOOL_PROG_LD_SHLIBS is expanded from... +aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/lang.m4:134: AC_LANG_RESTORE is expanded from... +aclocal.m4:4011: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4010: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... +aclocal.m4:4067: _LT_AC_LANG_RC_CONFIG is expanded from... +aclocal.m4:4066: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. +You should run autoupdate.], [../../lib/autoconf/lang.m4:134: AC_LANG_RESTORE is expanded from... +aclocal.m4:4067: _LT_AC_LANG_RC_CONFIG is expanded from... +aclocal.m4:4066: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +aclocal.m4:1805: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:86: AC_LIBTOOL_SETUP is expanded from... +aclocal.m4:66: _AC_PROG_LIBTOOL is expanded from... +aclocal.m4:31: AC_PROG_LIBTOOL is expanded from... +aclocal.m4:6337: AM_PROG_LIBTOOL is expanded from... +configure.in:45: the top level]) +m4trace:configure.in:45: -1- AC_SUBST([LIBTOOL]) +m4trace:configure.in:45: -1- AC_SUBST_TRACE([LIBTOOL]) +m4trace:configure.in:45: -1- m4_pattern_allow([^LIBTOOL$]) +m4trace:configure.in:47: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:47: -1- AC_SUBST_TRACE([SET_MAKE]) +m4trace:configure.in:47: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.in:49: -1- AC_SUBST([CXX]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXX]) +m4trace:configure.in:49: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.in:49: -1- AC_SUBST([CXXFLAGS]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXXFLAGS]) +m4trace:configure.in:49: -1- m4_pattern_allow([^CXXFLAGS$]) +m4trace:configure.in:49: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:49: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:49: -1- AC_SUBST([LIBS]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:49: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:49: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:49: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:49: -1- AC_SUBST([CXX]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXX]) +m4trace:configure.in:49: -1- m4_pattern_allow([^CXX$]) +m4trace:configure.in:49: -1- AC_SUBST([ac_ct_CXX]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([ac_ct_CXX]) +m4trace:configure.in:49: -1- m4_pattern_allow([^ac_ct_CXX$]) +m4trace:configure.in:49: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([CXXDEPMODE]) +m4trace:configure.in:49: -1- m4_pattern_allow([^CXXDEPMODE$]) +m4trace:configure.in:49: -1- AM_CONDITIONAL([am__fastdepCXX], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:49: -1- AC_SUBST([am__fastdepCXX_TRUE]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([am__fastdepCXX_TRUE]) +m4trace:configure.in:49: -1- m4_pattern_allow([^am__fastdepCXX_TRUE$]) +m4trace:configure.in:49: -1- AC_SUBST([am__fastdepCXX_FALSE]) +m4trace:configure.in:49: -1- AC_SUBST_TRACE([am__fastdepCXX_FALSE]) +m4trace:configure.in:49: -1- m4_pattern_allow([^am__fastdepCXX_FALSE$]) +m4trace:configure.in:51: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:51: -1- AC_SUBST_TRACE([CXXCPP]) +m4trace:configure.in:51: -1- m4_pattern_allow([^CXXCPP$]) +m4trace:configure.in:51: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:51: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:51: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:51: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:51: -1- AC_SUBST_TRACE([CXXCPP]) +m4trace:configure.in:51: -1- m4_pattern_allow([^CXXCPP$]) +m4trace:configure.in:66: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:66: the top level]) +m4trace:configure.in:70: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:70: the top level]) +m4trace:configure.in:74: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:74: the top level]) +m4trace:configure.in:80: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:80: the top level]) +m4trace:configure.in:88: -1- AC_SUBST([DOXYGEN]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([DOXYGEN]) +m4trace:configure.in:88: -1- m4_pattern_allow([^DOXYGEN$]) +m4trace:configure.in:96: -1- AC_SUBST([DOT]) +m4trace:configure.in:96: -1- AC_SUBST_TRACE([DOT]) +m4trace:configure.in:96: -1- m4_pattern_allow([^DOT$]) +m4trace:configure.in:99: -1- AM_CONDITIONAL([DOC], [test x$enable_doc = xyes]) +m4trace:configure.in:99: -1- AC_SUBST([DOC_TRUE]) +m4trace:configure.in:99: -1- AC_SUBST_TRACE([DOC_TRUE]) +m4trace:configure.in:99: -1- m4_pattern_allow([^DOC_TRUE$]) +m4trace:configure.in:99: -1- AC_SUBST([DOC_FALSE]) +m4trace:configure.in:99: -1- AC_SUBST_TRACE([DOC_FALSE]) +m4trace:configure.in:99: -1- m4_pattern_allow([^DOC_FALSE$]) +m4trace:configure.in:100: -1- AM_CONDITIONAL([LATEX_DOC], [test x$enable_latex_docs = xyes]) +m4trace:configure.in:100: -1- AC_SUBST([LATEX_DOC_TRUE]) +m4trace:configure.in:100: -1- AC_SUBST_TRACE([LATEX_DOC_TRUE]) +m4trace:configure.in:100: -1- m4_pattern_allow([^LATEX_DOC_TRUE$]) +m4trace:configure.in:100: -1- AC_SUBST([LATEX_DOC_FALSE]) +m4trace:configure.in:100: -1- AC_SUBST_TRACE([LATEX_DOC_FALSE]) +m4trace:configure.in:100: -1- m4_pattern_allow([^LATEX_DOC_FALSE$]) +m4trace:configure.in:114: -1- AC_SUBST([enable_dot]) +m4trace:configure.in:114: -1- AC_SUBST_TRACE([enable_dot]) +m4trace:configure.in:114: -1- m4_pattern_allow([^enable_dot$]) +m4trace:configure.in:115: -1- AC_SUBST([enable_html_docs]) +m4trace:configure.in:115: -1- AC_SUBST_TRACE([enable_html_docs]) +m4trace:configure.in:115: -1- m4_pattern_allow([^enable_html_docs$]) +m4trace:configure.in:116: -1- AC_SUBST([enable_latex_docs]) +m4trace:configure.in:116: -1- AC_SUBST_TRACE([enable_latex_docs]) +m4trace:configure.in:116: -1- m4_pattern_allow([^enable_latex_docs$]) +m4trace:configure.in:117: -1- AC_SUBST([manual_dest]) +m4trace:configure.in:117: -1- AC_SUBST_TRACE([manual_dest]) +m4trace:configure.in:117: -1- m4_pattern_allow([^manual_dest$]) +m4trace:configure.in:118: -1- AC_SUBST([base_dir]) +m4trace:configure.in:118: -1- AC_SUBST_TRACE([base_dir]) +m4trace:configure.in:118: -1- m4_pattern_allow([^base_dir$]) +m4trace:configure.in:132: -1- AC_SUBST([APR_LIBS]) +m4trace:configure.in:132: -1- AC_SUBST_TRACE([APR_LIBS]) +m4trace:configure.in:132: -1- m4_pattern_allow([^APR_LIBS$]) +m4trace:configure.in:142: -1- AC_SUBST([APU_LIBS]) +m4trace:configure.in:142: -1- AC_SUBST_TRACE([APU_LIBS]) +m4trace:configure.in:142: -1- m4_pattern_allow([^APU_LIBS$]) +m4trace:configure.in:149: -1- AH_OUTPUT([HAVE_MBSRTOWCS], [/* Define to 1 if you have the `mbsrtowcs\' function. */ +@%:@undef HAVE_MBSRTOWCS]) +m4trace:configure.in:149: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MBSRTOWCS]) +m4trace:configure.in:149: -1- m4_pattern_allow([^HAVE_MBSRTOWCS$]) +m4trace:configure.in:152: -1- AC_SUBST([HAS_MBSRTOWCS], [1]) +m4trace:configure.in:152: -1- AC_SUBST_TRACE([HAS_MBSRTOWCS]) +m4trace:configure.in:152: -1- m4_pattern_allow([^HAS_MBSRTOWCS$]) +m4trace:configure.in:154: -1- AC_SUBST([HAS_MBSRTOWCS], [0]) +m4trace:configure.in:154: -1- AC_SUBST_TRACE([HAS_MBSRTOWCS]) +m4trace:configure.in:154: -1- m4_pattern_allow([^HAS_MBSRTOWCS$]) +m4trace:configure.in:157: -1- AH_OUTPUT([HAVE_WCSTOMBS], [/* Define to 1 if you have the `wcstombs\' function. */ +@%:@undef HAVE_WCSTOMBS]) +m4trace:configure.in:157: -1- AC_DEFINE_TRACE_LITERAL([HAVE_WCSTOMBS]) +m4trace:configure.in:157: -1- m4_pattern_allow([^HAVE_WCSTOMBS$]) +m4trace:configure.in:160: -1- AC_SUBST([HAS_WCSTOMBS], [1]) +m4trace:configure.in:160: -1- AC_SUBST_TRACE([HAS_WCSTOMBS]) +m4trace:configure.in:160: -1- m4_pattern_allow([^HAS_WCSTOMBS$]) +m4trace:configure.in:162: -1- AC_SUBST([HAS_WCSTOMBS], [0]) +m4trace:configure.in:162: -1- AC_SUBST_TRACE([HAS_WCSTOMBS]) +m4trace:configure.in:162: -1- m4_pattern_allow([^HAS_WCSTOMBS$]) +m4trace:configure.in:166: -1- AH_OUTPUT([HAVE_SYSLOG], [/* Define to 1 if you have the `syslog\' function. */ +@%:@undef HAVE_SYSLOG]) +m4trace:configure.in:166: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SYSLOG]) +m4trace:configure.in:166: -1- m4_pattern_allow([^HAVE_SYSLOG$]) +m4trace:configure.in:169: -1- AC_SUBST([HAS_SYSLOG], [1]) +m4trace:configure.in:169: -1- AC_SUBST_TRACE([HAS_SYSLOG]) +m4trace:configure.in:169: -1- m4_pattern_allow([^HAS_SYSLOG$]) +m4trace:configure.in:171: -1- AC_SUBST([HAS_SYSLOG], [0]) +m4trace:configure.in:171: -1- AC_SUBST_TRACE([HAS_SYSLOG]) +m4trace:configure.in:171: -1- m4_pattern_allow([^HAS_SYSLOG$]) +m4trace:configure.in:177: -1- AC_SUBST([HAS_STD_LOCALE], [1]) +m4trace:configure.in:177: -1- AC_SUBST_TRACE([HAS_STD_LOCALE]) +m4trace:configure.in:177: -1- m4_pattern_allow([^HAS_STD_LOCALE$]) +m4trace:configure.in:179: -1- AC_SUBST([HAS_STD_LOCALE], [0]) +m4trace:configure.in:179: -1- AC_SUBST_TRACE([HAS_STD_LOCALE]) +m4trace:configure.in:179: -1- m4_pattern_allow([^HAS_STD_LOCALE$]) +m4trace:configure.in:183: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2590: _AC_COMPILE_IFELSE is expanded from... +../../lib/autoconf/general.m4:2606: AC_COMPILE_IFELSE is expanded from... +configure.in:183: the top level]) +m4trace:configure.in:189: -1- AC_SUBST([HAS_WCHAR_T], [1]) +m4trace:configure.in:189: -1- AC_SUBST_TRACE([HAS_WCHAR_T]) +m4trace:configure.in:189: -1- m4_pattern_allow([^HAS_WCHAR_T$]) +m4trace:configure.in:191: -1- AC_SUBST([HAS_WCHAR_T], [0]) +m4trace:configure.in:191: -1- AC_SUBST_TRACE([HAS_WCHAR_T]) +m4trace:configure.in:191: -1- m4_pattern_allow([^HAS_WCHAR_T$]) +m4trace:configure.in:194: -1- AH_OUTPUT([HAVE_FWIDE], [/* Define to 1 if you have the `fwide\' function. */ +@%:@undef HAVE_FWIDE]) +m4trace:configure.in:194: -1- AC_DEFINE_TRACE_LITERAL([HAVE_FWIDE]) +m4trace:configure.in:194: -1- m4_pattern_allow([^HAVE_FWIDE$]) +m4trace:configure.in:197: -1- AC_SUBST([HAS_FWIDE], [1]) +m4trace:configure.in:197: -1- AC_SUBST_TRACE([HAS_FWIDE]) +m4trace:configure.in:197: -1- m4_pattern_allow([^HAS_FWIDE$]) +m4trace:configure.in:199: -1- AC_SUBST([HAS_FWIDE], [0]) +m4trace:configure.in:199: -1- AC_SUBST_TRACE([HAS_FWIDE]) +m4trace:configure.in:199: -1- m4_pattern_allow([^HAS_FWIDE$]) +m4trace:configure.in:206: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:206: -1- AC_SUBST_TRACE([RANLIB]) +m4trace:configure.in:206: -1- m4_pattern_allow([^RANLIB$]) +m4trace:configure.in:212: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:212: the top level]) +m4trace:configure.in:218: -1- AC_SUBST([HAS_ODBC], [1], [ODBC support]) +m4trace:configure.in:218: -1- AC_SUBST_TRACE([HAS_ODBC]) +m4trace:configure.in:218: -1- m4_pattern_allow([^HAS_ODBC$]) +m4trace:configure.in:225: -1- AC_SUBST([HAS_ODBC], [1], [ODBC support]) +m4trace:configure.in:225: -1- AC_SUBST_TRACE([HAS_ODBC]) +m4trace:configure.in:225: -1- m4_pattern_allow([^HAS_ODBC$]) +m4trace:configure.in:230: -1- AC_SUBST([IODBC_CONFIG]) +m4trace:configure.in:230: -1- AC_SUBST_TRACE([IODBC_CONFIG]) +m4trace:configure.in:230: -1- m4_pattern_allow([^IODBC_CONFIG$]) +m4trace:configure.in:233: -1- AC_SUBST([HAS_ODBC], [1], [ODBC support]) +m4trace:configure.in:233: -1- AC_SUBST_TRACE([HAS_ODBC]) +m4trace:configure.in:233: -1- m4_pattern_allow([^HAS_ODBC$]) +m4trace:configure.in:241: -1- AC_SUBST([HAS_ODBC], [0], [No ODBC support]) +m4trace:configure.in:241: -1- AC_SUBST_TRACE([HAS_ODBC]) +m4trace:configure.in:241: -1- m4_pattern_allow([^HAS_ODBC$]) +m4trace:configure.in:249: -1- AC_SUBST([LIBS_ODBC]) +m4trace:configure.in:249: -1- AC_SUBST_TRACE([LIBS_ODBC]) +m4trace:configure.in:249: -1- m4_pattern_allow([^LIBS_ODBC$]) +m4trace:configure.in:250: -1- AC_SUBST([CPPFLAGS_ODBC]) +m4trace:configure.in:250: -1- AC_SUBST_TRACE([CPPFLAGS_ODBC]) +m4trace:configure.in:250: -1- m4_pattern_allow([^CPPFLAGS_ODBC$]) +m4trace:configure.in:256: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:256: the top level]) +m4trace:configure.in:263: -1- AH_OUTPUT([HAVE_LIBESMTP], [/* Define to 1 if you have the `esmtp\' library (-lesmtp). */ +@%:@undef HAVE_LIBESMTP]) +m4trace:configure.in:263: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBESMTP]) +m4trace:configure.in:263: -1- m4_pattern_allow([^HAVE_LIBESMTP$]) +m4trace:configure.in:266: -1- AC_SUBST([HAS_LIBESMTP], [1], [SMTP support through libesmtp library.]) +m4trace:configure.in:266: -1- AC_SUBST_TRACE([HAS_LIBESMTP]) +m4trace:configure.in:266: -1- m4_pattern_allow([^HAS_LIBESMTP$]) +m4trace:configure.in:271: -1- AC_SUBST([HAS_LIBESMTP], [0], [SMTP support through libesmtp library.]) +m4trace:configure.in:271: -1- AC_SUBST_TRACE([HAS_LIBESMTP]) +m4trace:configure.in:271: -1- m4_pattern_allow([^HAS_LIBESMTP$]) +m4trace:configure.in:281: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:281: the top level]) +m4trace:configure.in:291: -1- AC_SUBST([CHAR_API], [1]) +m4trace:configure.in:291: -1- AC_SUBST_TRACE([CHAR_API]) +m4trace:configure.in:291: -1- m4_pattern_allow([^CHAR_API$]) +m4trace:configure.in:293: -1- AC_SUBST([CHAR_API], [0]) +m4trace:configure.in:293: -1- AC_SUBST_TRACE([CHAR_API]) +m4trace:configure.in:293: -1- m4_pattern_allow([^CHAR_API$]) +m4trace:configure.in:298: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:298: the top level]) +m4trace:configure.in:313: -1- AC_SUBST([WCHAR_T_API], [1]) +m4trace:configure.in:313: -1- AC_SUBST_TRACE([WCHAR_T_API]) +m4trace:configure.in:313: -1- m4_pattern_allow([^WCHAR_T_API$]) +m4trace:configure.in:315: -1- AC_SUBST([WCHAR_T_API], [0]) +m4trace:configure.in:315: -1- AC_SUBST_TRACE([WCHAR_T_API]) +m4trace:configure.in:315: -1- m4_pattern_allow([^WCHAR_T_API$]) +m4trace:configure.in:320: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:320: the top level]) +m4trace:configure.in:324: -1- AC_SUBST([UNICHAR_API], [1]) +m4trace:configure.in:324: -1- AC_SUBST_TRACE([UNICHAR_API]) +m4trace:configure.in:324: -1- m4_pattern_allow([^UNICHAR_API$]) +m4trace:configure.in:326: -1- AC_SUBST([UNICHAR_API], [0]) +m4trace:configure.in:326: -1- AC_SUBST_TRACE([UNICHAR_API]) +m4trace:configure.in:326: -1- m4_pattern_allow([^UNICHAR_API$]) +m4trace:configure.in:331: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:331: the top level]) +m4trace:configure.in:336: -1- _m4_warn([syntax], [AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body], [../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... +../../lib/autoconf/general.m4:2590: _AC_COMPILE_IFELSE is expanded from... +../../lib/autoconf/general.m4:2606: AC_COMPILE_IFELSE is expanded from... +configure.in:336: the top level]) +m4trace:configure.in:346: -1- AC_SUBST([CFSTRING_API], [1]) +m4trace:configure.in:346: -1- AC_SUBST_TRACE([CFSTRING_API]) +m4trace:configure.in:346: -1- m4_pattern_allow([^CFSTRING_API$]) +m4trace:configure.in:348: -1- AC_SUBST([CFSTRING_API], [0]) +m4trace:configure.in:348: -1- AC_SUBST_TRACE([CFSTRING_API]) +m4trace:configure.in:348: -1- m4_pattern_allow([^CFSTRING_API$]) +m4trace:configure.in:354: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:354: the top level]) +m4trace:configure.in:362: -1- AC_SUBST([CHARSET_UTF8], [1]) +m4trace:configure.in:362: -1- AC_SUBST_TRACE([CHARSET_UTF8]) +m4trace:configure.in:362: -1- m4_pattern_allow([^CHARSET_UTF8$]) +m4trace:configure.in:363: -1- AC_SUBST([CHARSET_ISO88591], [0]) +m4trace:configure.in:363: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) +m4trace:configure.in:363: -1- m4_pattern_allow([^CHARSET_ISO88591$]) +m4trace:configure.in:364: -1- AC_SUBST([CHARSET_USASCII], [0]) +m4trace:configure.in:364: -1- AC_SUBST_TRACE([CHARSET_USASCII]) +m4trace:configure.in:364: -1- m4_pattern_allow([^CHARSET_USASCII$]) +m4trace:configure.in:365: -1- AC_SUBST([CHARSET_EBCDIC], [0]) +m4trace:configure.in:365: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) +m4trace:configure.in:365: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) +m4trace:configure.in:370: -1- AC_SUBST([CHARSET_UTF8], [0]) +m4trace:configure.in:370: -1- AC_SUBST_TRACE([CHARSET_UTF8]) +m4trace:configure.in:370: -1- m4_pattern_allow([^CHARSET_UTF8$]) +m4trace:configure.in:371: -1- AC_SUBST([CHARSET_ISO88591], [1]) +m4trace:configure.in:371: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) +m4trace:configure.in:371: -1- m4_pattern_allow([^CHARSET_ISO88591$]) +m4trace:configure.in:372: -1- AC_SUBST([CHARSET_USASCII], [0]) +m4trace:configure.in:372: -1- AC_SUBST_TRACE([CHARSET_USASCII]) +m4trace:configure.in:372: -1- m4_pattern_allow([^CHARSET_USASCII$]) +m4trace:configure.in:373: -1- AC_SUBST([CHARSET_EBCDIC], [0]) +m4trace:configure.in:373: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) +m4trace:configure.in:373: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) +m4trace:configure.in:378: -1- AC_SUBST([CHARSET_UTF8], [0]) +m4trace:configure.in:378: -1- AC_SUBST_TRACE([CHARSET_UTF8]) +m4trace:configure.in:378: -1- m4_pattern_allow([^CHARSET_UTF8$]) +m4trace:configure.in:379: -1- AC_SUBST([CHARSET_ISO88591], [0]) +m4trace:configure.in:379: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) +m4trace:configure.in:379: -1- m4_pattern_allow([^CHARSET_ISO88591$]) +m4trace:configure.in:380: -1- AC_SUBST([CHARSET_USASCII], [1]) +m4trace:configure.in:380: -1- AC_SUBST_TRACE([CHARSET_USASCII]) +m4trace:configure.in:380: -1- m4_pattern_allow([^CHARSET_USASCII$]) +m4trace:configure.in:381: -1- AC_SUBST([CHARSET_EBCDIC], [0]) +m4trace:configure.in:381: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) +m4trace:configure.in:381: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) +m4trace:configure.in:386: -1- AC_SUBST([CHARSET_UTF8], [0]) +m4trace:configure.in:386: -1- AC_SUBST_TRACE([CHARSET_UTF8]) +m4trace:configure.in:386: -1- m4_pattern_allow([^CHARSET_UTF8$]) +m4trace:configure.in:387: -1- AC_SUBST([CHARSET_ISO88591], [0]) +m4trace:configure.in:387: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) +m4trace:configure.in:387: -1- m4_pattern_allow([^CHARSET_ISO88591$]) +m4trace:configure.in:388: -1- AC_SUBST([CHARSET_USASCII], [0]) +m4trace:configure.in:388: -1- AC_SUBST_TRACE([CHARSET_USASCII]) +m4trace:configure.in:388: -1- m4_pattern_allow([^CHARSET_USASCII$]) +m4trace:configure.in:389: -1- AC_SUBST([CHARSET_EBCDIC], [1]) +m4trace:configure.in:389: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) +m4trace:configure.in:389: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) +m4trace:configure.in:394: -1- AC_SUBST([CHARSET_UTF8], [0]) +m4trace:configure.in:394: -1- AC_SUBST_TRACE([CHARSET_UTF8]) +m4trace:configure.in:394: -1- m4_pattern_allow([^CHARSET_UTF8$]) +m4trace:configure.in:395: -1- AC_SUBST([CHARSET_ISO88591], [0]) +m4trace:configure.in:395: -1- AC_SUBST_TRACE([CHARSET_ISO88591]) +m4trace:configure.in:395: -1- m4_pattern_allow([^CHARSET_ISO88591$]) +m4trace:configure.in:396: -1- AC_SUBST([CHARSET_USASCII], [0]) +m4trace:configure.in:396: -1- AC_SUBST_TRACE([CHARSET_USASCII]) +m4trace:configure.in:396: -1- m4_pattern_allow([^CHARSET_USASCII$]) +m4trace:configure.in:397: -1- AC_SUBST([CHARSET_EBCDIC], [0]) +m4trace:configure.in:397: -1- AC_SUBST_TRACE([CHARSET_EBCDIC]) +m4trace:configure.in:397: -1- m4_pattern_allow([^CHARSET_EBCDIC$]) +m4trace:configure.in:411: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from... +configure.in:411: the top level]) +m4trace:configure.in:419: -1- AC_SUBST([LOGCHAR_IS_UTF8], [1]) +m4trace:configure.in:419: -1- AC_SUBST_TRACE([LOGCHAR_IS_UTF8]) +m4trace:configure.in:419: -1- m4_pattern_allow([^LOGCHAR_IS_UTF8$]) +m4trace:configure.in:420: -1- AC_SUBST([LOGCHAR_IS_WCHAR], [0]) +m4trace:configure.in:420: -1- AC_SUBST_TRACE([LOGCHAR_IS_WCHAR]) +m4trace:configure.in:420: -1- m4_pattern_allow([^LOGCHAR_IS_WCHAR$]) +m4trace:configure.in:421: -1- AC_SUBST([LOGCHAR_IS_UNICHAR], [0]) +m4trace:configure.in:421: -1- AC_SUBST_TRACE([LOGCHAR_IS_UNICHAR]) +m4trace:configure.in:421: -1- m4_pattern_allow([^LOGCHAR_IS_UNICHAR$]) +m4trace:configure.in:426: -1- AC_SUBST([LOGCHAR_IS_UTF8], [0]) +m4trace:configure.in:426: -1- AC_SUBST_TRACE([LOGCHAR_IS_UTF8]) +m4trace:configure.in:426: -1- m4_pattern_allow([^LOGCHAR_IS_UTF8$]) +m4trace:configure.in:427: -1- AC_SUBST([LOGCHAR_IS_WCHAR], [1]) +m4trace:configure.in:427: -1- AC_SUBST_TRACE([LOGCHAR_IS_WCHAR]) +m4trace:configure.in:427: -1- m4_pattern_allow([^LOGCHAR_IS_WCHAR$]) +m4trace:configure.in:428: -1- AC_SUBST([LOGCHAR_IS_UNICHAR], [0]) +m4trace:configure.in:428: -1- AC_SUBST_TRACE([LOGCHAR_IS_UNICHAR]) +m4trace:configure.in:428: -1- m4_pattern_allow([^LOGCHAR_IS_UNICHAR$]) +m4trace:configure.in:433: -1- AC_SUBST([LOGCHAR_IS_UTF8], [0]) +m4trace:configure.in:433: -1- AC_SUBST_TRACE([LOGCHAR_IS_UTF8]) +m4trace:configure.in:433: -1- m4_pattern_allow([^LOGCHAR_IS_UTF8$]) +m4trace:configure.in:434: -1- AC_SUBST([LOGCHAR_IS_WCHAR], [0]) +m4trace:configure.in:434: -1- AC_SUBST_TRACE([LOGCHAR_IS_WCHAR]) +m4trace:configure.in:434: -1- m4_pattern_allow([^LOGCHAR_IS_WCHAR$]) +m4trace:configure.in:435: -1- AC_SUBST([LOGCHAR_IS_UNICHAR], [1]) +m4trace:configure.in:435: -1- AC_SUBST_TRACE([LOGCHAR_IS_UNICHAR]) +m4trace:configure.in:435: -1- m4_pattern_allow([^LOGCHAR_IS_UNICHAR$]) +m4trace:configure.in:449: -1- AC_CONFIG_FILES([ +Makefile +liblog4cxx.pc +src/Makefile +src/main/Makefile +src/main/cpp/Makefile +src/main/include/Makefile +src/main/include/log4cxx/log4cxx.h +src/main/include/log4cxx/private/log4cxx_private.h +src/main/include/log4cxx/private/Makefile +src/main/include/log4cxx/Makefile +src/main/include/log4cxx/helpers/Makefile +src/main/include/log4cxx/net/Makefile +src/main/include/log4cxx/nt/Makefile +src/main/include/log4cxx/spi/Makefile +src/main/include/log4cxx/spi/location/Makefile +src/main/include/log4cxx/varia/Makefile +src/main/include/log4cxx/xml/Makefile +src/main/include/log4cxx/config/Makefile +src/main/include/log4cxx/db/Makefile +src/main/include/log4cxx/rolling/Makefile +src/main/include/log4cxx/pattern/Makefile +src/main/include/log4cxx/filter/Makefile +src/site/Makefile +src/site/doxy/Makefile +src/site/doxy/Doxyfile +src/test/Makefile +src/test/resources/Makefile +src/test/resources/input/Makefile +src/test/resources/input/ndc/Makefile +src/test/resources/input/rolling/Makefile +src/test/resources/input/xml/Makefile +src/test/cpp/Makefile +src/test/resources/witness/Makefile +src/test/resources/witness/encoding/Makefile +src/test/resources/witness/ndc/Makefile +src/test/resources/witness/rolling/Makefile +src/examples/Makefile +src/examples/cpp/Makefile +]) +m4trace:configure.in:489: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) +m4trace:configure.in:489: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.in:489: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([LTLIBOBJS]) +m4trace:configure.in:489: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([top_build_prefix]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([srcdir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_srcdir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([top_srcdir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_top_srcdir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([builddir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_builddir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([abs_top_builddir]) +m4trace:configure.in:489: -1- AC_SUBST_TRACE([INSTALL]) diff --git a/src/3rd_party/apache-log4cxx-0.10.0/configure b/src/3rd_party/apache-log4cxx-0.10.0/configure index 83ae6de8ae..02ec84a747 100755 --- a/src/3rd_party/apache-log4cxx-0.10.0/configure +++ b/src/3rd_party/apache-log4cxx-0.10.0/configure @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ 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 @@ -167,7 +190,8 @@ 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\$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'\" && @@ -212,21 +236,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # 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 - export CONFIG_SHELL - 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+"$@"} + 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 : @@ -328,6 +356,14 @@ $as_echo X"$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 @@ -449,6 +485,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits 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). @@ -483,16 +523,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... 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 -p'. + # 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 -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -504,28 +544,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +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'" @@ -1392,8 +1412,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1675,9 +1693,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +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 @@ -1753,7 +1771,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -2138,7 +2156,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -2222,7 +2240,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -2399,7 +2417,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2957,7 +2975,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + 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. @@ -3126,7 +3144,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3260,7 +3278,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3300,7 +3318,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3513,7 +3531,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3553,7 +3571,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3606,7 +3624,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3647,7 +3665,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3705,7 +3723,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -3749,7 +3767,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -4195,8 +4213,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> +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); @@ -4463,7 +4480,7 @@ do 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" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + 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 @@ -4529,7 +4546,7 @@ do 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" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + 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 @@ -4997,7 +5014,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5000 "configure"' > conftest.$ac_ext + echo '#line 5017 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5458,7 +5475,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5502,7 +5519,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5942,7 +5959,7 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then - for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor 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 @@ -5960,7 +5977,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5986,7 +6003,7 @@ fi fi if test -z "$F77"; then ac_ct_F77=$F77 - for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn + for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -6004,7 +6021,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_F77="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6566,7 +6583,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6606,7 +6623,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6658,7 +6675,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -6698,7 +6715,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -6750,7 +6767,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -6790,7 +6807,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -7103,11 +7120,11 @@ else -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:7106: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7123: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7110: \$? = $ac_status" >&5 + echo "$as_me:7127: \$? = $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. @@ -7371,11 +7388,11 @@ else -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:7374: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7391: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7378: \$? = $ac_status" >&5 + echo "$as_me:7395: \$? = $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. @@ -7475,11 +7492,11 @@ else -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:7478: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7495: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7482: \$? = $ac_status" >&5 + echo "$as_me:7499: \$? = $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 @@ -9466,7 +9483,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9469 "configure" +#line 9486 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9566,7 +9583,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9569 "configure" +#line 9586 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11842,11 +11859,11 @@ else -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:11845: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11862: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11849: \$? = $ac_status" >&5 + echo "$as_me:11866: \$? = $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. @@ -11946,11 +11963,11 @@ else -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:11949: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11966: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11953: \$? = $ac_status" >&5 + echo "$as_me:11970: \$? = $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 @@ -13534,11 +13551,11 @@ else -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:13537: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13554: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13541: \$? = $ac_status" >&5 + echo "$as_me:13558: \$? = $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. @@ -13638,11 +13655,11 @@ else -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:13641: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13658: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13645: \$? = $ac_status" >&5 + echo "$as_me:13662: \$? = $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 @@ -15812,11 +15829,11 @@ else -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:15815: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15832: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15819: \$? = $ac_status" >&5 + echo "$as_me:15836: \$? = $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. @@ -16080,11 +16097,11 @@ else -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:16083: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16100: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16087: \$? = $ac_status" >&5 + echo "$as_me:16104: \$? = $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. @@ -16184,11 +16201,11 @@ else -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:16187: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16204: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16191: \$? = $ac_status" >&5 + echo "$as_me:16208: \$? = $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 @@ -18871,7 +18888,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -18915,7 +18932,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -19410,7 +19427,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -19457,7 +19474,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -19914,7 +19931,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -19954,7 +19971,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + 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 @@ -20044,7 +20061,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_IODBC_CONFIG="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -20884,16 +20901,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... 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 -p'. + # 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 -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -20953,28 +20970,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# 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'" @@ -20996,7 +21001,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -21053,10 +21058,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +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." @@ -21135,7 +21140,7 @@ 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 + 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' diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/changes/Makefile.in b/src/3rd_party/apache-log4cxx-0.10.0/src/changes/Makefile.in new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/src/changes/Makefile.in diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/site/apt/Makefile.in b/src/3rd_party/apache-log4cxx-0.10.0/src/site/apt/Makefile.in new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/src/site/apt/Makefile.in diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/site/fml/Makefile.in b/src/3rd_party/apache-log4cxx-0.10.0/src/site/fml/Makefile.in new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/src/site/fml/Makefile.in diff --git a/src/3rd_party/apache-log4cxx-0.10.0/src/site/xdoc/Makefile.in b/src/3rd_party/apache-log4cxx-0.10.0/src/site/xdoc/Makefile.in new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/3rd_party/apache-log4cxx-0.10.0/src/site/xdoc/Makefile.in diff --git a/src/3rd_party/apache-log4cxx-cmake/CMakeLists.txt b/src/3rd_party/apache-log4cxx-cmake/CMakeLists.txt index 86139300ac..bac9aa6df4 100644 --- a/src/3rd_party/apache-log4cxx-cmake/CMakeLists.txt +++ b/src/3rd_party/apache-log4cxx-cmake/CMakeLists.txt @@ -65,7 +65,7 @@ add_custom_command(OUTPUT ${LOG4CXX_BUILD_DIRECTORY}/Makefile ) add_custom_target(liblog4cxx ALL make - COMMAND /bin/bash -c \"grep \\".commit_hash\\" ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\; if [ ! \\\$$? == 0 ]\; then cd ${CMAKE_CURRENT_SOURCE_DIR} && git log --pretty=\\"format:%H\\" -1 ${LOG4CXX_SOURCE_DIRECTORY} > /tmp/commit_hash 2>/dev/null && echo \\"Adding .commit_hash section\\" && ${objcopy} --add-section .commit_hash=/tmp/commit_hash ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\; fi\" + COMMAND /bin/bash -c \"if [ ${is_git_folder} == 0 ]; then grep \\".commit_hash\\" ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\; if [ ! \\\$$? == 0 ]\; then cd ${CMAKE_CURRENT_SOURCE_DIR} && git log --pretty=\\"format:%H\\" -1 ${LOG4CXX_SOURCE_DIRECTORY} > /tmp/commit_hash 2>/dev/null && echo \\"Adding .commit_hash section\\" && ${objcopy} --add-section .commit_hash=/tmp/commit_hash ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so ${LOG4CXX_LIBS_DIRECTORY}/liblog4cxx.so 1>/dev/null 2>&1\; fi; fi\" DEPENDS ${LOG4CXX_BUILD_DIRECTORY}/Makefile WORKING_DIRECTORY ${LOG4CXX_BUILD_DIRECTORY} ) diff --git a/src/3rd_party/apr-1.5.0/include/apr.h b/src/3rd_party/apr-1.5.0/include/apr.h index 3b0e3d0e52..acf69814a6 100644 --- a/src/3rd_party/apr-1.5.0/include/apr.h +++ b/src/3rd_party/apr-1.5.0/include/apr.h @@ -80,7 +80,7 @@ #define APR_HAVE_LIMITS_H 1 #define APR_HAVE_NETDB_H 1 #define APR_HAVE_NETINET_IN_H 1 -#define APR_HAVE_NETINET_SCTP_H 0 +#define APR_HAVE_NETINET_SCTP_H 1 #define APR_HAVE_NETINET_SCTP_UIO_H 0 #define APR_HAVE_NETINET_TCP_H 1 #define APR_HAVE_PROCESS_H 0 @@ -260,7 +260,7 @@ extern "C" { #define APR_HAVE_MEMCHR 1 #define APR_HAVE_STRUCT_RLIMIT 1 #define APR_HAVE_UNION_SEMUN 0 -#define APR_HAVE_SCTP 0 +#define APR_HAVE_SCTP 1 #define APR_HAVE_IOVEC 1 /* APR Feature Macros */ @@ -276,7 +276,7 @@ extern "C" { #define APR_HAS_UNICODE_FS 0 #define APR_HAS_PROC_INVOKED 0 #define APR_HAS_USER 1 -#define APR_HAS_LARGE_FILES 0 +#define APR_HAS_LARGE_FILES 1 #define APR_HAS_XTHREAD_FILES 0 #define APR_HAS_OS_UUID 1 @@ -314,7 +314,7 @@ typedef unsigned short apr_uint16_t; typedef int apr_int32_t; typedef unsigned int apr_uint32_t; -#define APR_SIZEOF_VOIDP 8 +#define APR_SIZEOF_VOIDP 4 /* * Darwin 10's default compiler (gcc42) builds for both 64 and @@ -349,15 +349,15 @@ typedef unsigned int apr_uint32_t; #define UINT64_C(v) (v ## ULL) #endif #else - typedef long apr_int64_t; - typedef unsigned long apr_uint64_t; + typedef long long apr_int64_t; + typedef unsigned long long apr_uint64_t; #endif typedef size_t apr_size_t; typedef ssize_t apr_ssize_t; -typedef off_t apr_off_t; +typedef off64_t apr_off_t; typedef socklen_t apr_socklen_t; -typedef ino_t apr_ino_t; +typedef unsigned long apr_ino_t; #if APR_SIZEOF_VOIDP == 8 typedef apr_uint64_t apr_uintptr_t; @@ -530,25 +530,25 @@ typedef apr_uint32_t apr_uintptr_t; * configure.in. */ -#define APR_SSIZE_T_FMT "ld" +#define APR_SSIZE_T_FMT "d" /* And APR_SIZE_T_FMT */ -#define APR_SIZE_T_FMT "lu" +#define APR_SIZE_T_FMT "u" /* And APR_OFF_T_FMT */ -#define APR_OFF_T_FMT "ld" +#define APR_OFF_T_FMT APR_INT64_T_FMT /* And APR_PID_T_FMT */ #define APR_PID_T_FMT "d" /* And APR_INT64_T_FMT */ -#define APR_INT64_T_FMT "ld" +#define APR_INT64_T_FMT "lld" /* And APR_UINT64_T_FMT */ -#define APR_UINT64_T_FMT "lu" +#define APR_UINT64_T_FMT "llu" /* And APR_UINT64_T_HEX_FMT */ -#define APR_UINT64_T_HEX_FMT "lx" +#define APR_UINT64_T_HEX_FMT "llx" /* * Ensure we work with universal binaries on Darwin diff --git a/src/3rd_party/dbus-1.7.8/test/data/sha-1/Readme.txt b/src/3rd_party/dbus-1.7.8/test/data/sha-1/Readme.txt index 0fca3f950b..cf7b02329f 100644 --- a/src/3rd_party/dbus-1.7.8/test/data/sha-1/Readme.txt +++ b/src/3rd_party/dbus-1.7.8/test/data/sha-1/Readme.txt @@ -42,10 +42,10 @@ procedure MonteCarlo(string SEED) M := SEED; for j = 0 to 99 do { for i = 1 to 50000 do { - for a = 1 to (j/4*8 + 24) do M := M || 0; /*0' is the binary zero bit. */ - M := M || i; /* Here, the value for i is expressed as a 32-bit word - and concatenated with M. The first bit - concatenated with M is the most significant bit of + for a = 1 to (j/4*8 + 24) do M := M || ’0’; /*‘0' is the binary zero bit. */ + M := M || i; /* Here, the value for ‘i’ is expressed as a 32-bit word + and concatenated with ‘M’. The first bit + concatenated with ‘M’ is the most significant bit of this 32-bit word. */ M := SHA(M); } @@ -54,7 +54,7 @@ procedure MonteCarlo(string SEED) } NOTE: In the above procedure, || denotes concatenation. Also, M || i denotes appending the 32-bit -word representing the value i, as defined in section 2 of the SHS. Within the procedure, M is a string +word representing the value ‘i’, as defined in section 2 of the SHS. Within the procedure, M is a string of variable length. The initial length of 416 bits ensures that the length of M never exceeds 512 bits during execution of the above procedure, and it ensures that messages will be of a byte length. Each element printed should be 160 bits in length. diff --git a/src/3rd_party/expat-2.1.0/CMakeLists.txt b/src/3rd_party/expat-2.1.0/CMakeLists.txt index 2769e38813..2769e38813 100755..100644 --- a/src/3rd_party/expat-2.1.0/CMakeLists.txt +++ b/src/3rd_party/expat-2.1.0/CMakeLists.txt diff --git a/src/3rd_party/expat-2.1.0/ConfigureChecks.cmake b/src/3rd_party/expat-2.1.0/ConfigureChecks.cmake index 5cdf01e8d3..5cdf01e8d3 100755..100644 --- a/src/3rd_party/expat-2.1.0/ConfigureChecks.cmake +++ b/src/3rd_party/expat-2.1.0/ConfigureChecks.cmake diff --git a/src/3rd_party/expat-2.1.0/amiga/expat_68k.h b/src/3rd_party/expat-2.1.0/amiga/expat_68k.h index 6f1aac59b8..6f1aac59b8 100755..100644 --- a/src/3rd_party/expat-2.1.0/amiga/expat_68k.h +++ b/src/3rd_party/expat-2.1.0/amiga/expat_68k.h diff --git a/src/3rd_party/expat-2.1.0/amiga/expat_68k_handler_stubs.c b/src/3rd_party/expat-2.1.0/amiga/expat_68k_handler_stubs.c index aca33c6ecd..aca33c6ecd 100755..100644 --- a/src/3rd_party/expat-2.1.0/amiga/expat_68k_handler_stubs.c +++ b/src/3rd_party/expat-2.1.0/amiga/expat_68k_handler_stubs.c diff --git a/src/3rd_party/expat-2.1.0/amiga/expat_lib.c b/src/3rd_party/expat-2.1.0/amiga/expat_lib.c index 70e91b101a..70e91b101a 100755..100644 --- a/src/3rd_party/expat-2.1.0/amiga/expat_lib.c +++ b/src/3rd_party/expat-2.1.0/amiga/expat_lib.c diff --git a/src/3rd_party/expat-2.1.0/amiga/launch.c b/src/3rd_party/expat-2.1.0/amiga/launch.c index 20b069c3f8..20b069c3f8 100755..100644 --- a/src/3rd_party/expat-2.1.0/amiga/launch.c +++ b/src/3rd_party/expat-2.1.0/amiga/launch.c diff --git a/src/3rd_party/expat-2.1.0/expat_config.h.cmake b/src/3rd_party/expat-2.1.0/expat_config.h.cmake index e5147915b5..e5147915b5 100755..100644 --- a/src/3rd_party/expat-2.1.0/expat_config.h.cmake +++ b/src/3rd_party/expat-2.1.0/expat_config.h.cmake diff --git a/src/3rd_party/expat-2.1.0/xmlwf/codepage.c b/src/3rd_party/expat-2.1.0/xmlwf/codepage.c index 57e48ff2d1..57e48ff2d1 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/codepage.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/codepage.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/codepage.h b/src/3rd_party/expat-2.1.0/xmlwf/codepage.h index 6a4df68883..6a4df68883 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/codepage.h +++ b/src/3rd_party/expat-2.1.0/xmlwf/codepage.h diff --git a/src/3rd_party/expat-2.1.0/xmlwf/ct.c b/src/3rd_party/expat-2.1.0/xmlwf/ct.c index 95903a3450..95903a3450 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/ct.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/ct.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/filemap.h b/src/3rd_party/expat-2.1.0/xmlwf/filemap.h index 814edec252..814edec252 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/filemap.h +++ b/src/3rd_party/expat-2.1.0/xmlwf/filemap.h diff --git a/src/3rd_party/expat-2.1.0/xmlwf/readfilemap.c b/src/3rd_party/expat-2.1.0/xmlwf/readfilemap.c index bd32b93414..bd32b93414 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/readfilemap.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/readfilemap.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/unixfilemap.c b/src/3rd_party/expat-2.1.0/xmlwf/unixfilemap.c index 93adce32e8..93adce32e8 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/unixfilemap.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/unixfilemap.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/win32filemap.c b/src/3rd_party/expat-2.1.0/xmlwf/win32filemap.c index 41dc35b614..41dc35b614 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/win32filemap.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/win32filemap.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.c b/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.c index 99eeeaaef2..99eeeaaef2 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.h b/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.h index d093ecc06f..d093ecc06f 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.h +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmlfile.h diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.c b/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.c index 56a0e7f40e..56a0e7f40e 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.c diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.h b/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.h index bf0356df0d..bf0356df0d 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.h +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmlmime.h diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmltchar.h b/src/3rd_party/expat-2.1.0/xmlwf/xmltchar.h index 1088575512..1088575512 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmltchar.h +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmltchar.h diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmlurl.h b/src/3rd_party/expat-2.1.0/xmlwf/xmlurl.h index d329913ac8..d329913ac8 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmlurl.h +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmlurl.h diff --git a/src/3rd_party/expat-2.1.0/xmlwf/xmlwf.c b/src/3rd_party/expat-2.1.0/xmlwf/xmlwf.c index 4fc77da944..4fc77da944 100755..100644 --- a/src/3rd_party/expat-2.1.0/xmlwf/xmlwf.c +++ b/src/3rd_party/expat-2.1.0/xmlwf/xmlwf.c diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index 05e48e4048..7e23cdc6a0 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -219,6 +219,7 @@ if(ENABLE_LOG) list(APPEND test_exec_libraries expat -L${EXPAT_LIBS_DIRECTORY}) endif() + include(${CMAKE_SOURCE_DIR}/src/components/policy/test/include.cmake) IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX") list(REMOVE_ITEM test_exec_libraries dl) diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json index de4e49216f..e97a222368 100644 --- a/src/appMain/hmi_capabilities.json +++ b/src/appMain/hmi_capabilities.json @@ -1,7 +1,7 @@ { "UI": { - "language":"EN-US", + "language":"EN_US", "languages":[ "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW", "JA_JP","AR_SA","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO" @@ -326,7 +326,7 @@ "VR": { "capabilities":["TEXT"], - "language":"EN-US", + "language":"EN_US", "languages": [ "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW", @@ -336,7 +336,7 @@ "TTS": { "capabilities":"TEXT", - "language":"EN-US", + "language":"EN_US", "languages": [ "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW", diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc index 0111214846..8d4926510b 100644 --- a/src/appMain/life_cycle.cc +++ b/src/appMain/life_cycle.cc @@ -40,6 +40,8 @@ #include "security_manager/crypto_manager_impl.h" #endif // ENABLE_SECURITY +#include "utils/threads/thread_manager.h" + using threads::Thread; namespace main_namespace { @@ -80,7 +82,7 @@ LifeCycle::LifeCycle() , mb_server_thread_(NULL) , mb_adapter_thread_(NULL) #endif // MESSAGEBROKER_HMIADAPTER - , components_started(false) + , components_started_(false) { } bool LifeCycle::StartComponents() { @@ -143,7 +145,7 @@ bool LifeCycle::StartComponents() { if (protocol_name == "TLSv1.0") { protocol = security_manager::TLSv1; } else if (protocol_name == "TLSv1.1") { - protocol = security_manager::TLSv1_1; + protocol = security_manager::TLSv1_1; } else if (protocol_name == "TLSv1.2") { protocol = security_manager::TLSv1_2; } else if (protocol_name == "SSLv3") { @@ -206,7 +208,7 @@ bool LifeCycle::StartComponents() { // start transport manager transport_manager_->Visibility(true); - components_started = true; + components_started_ = true; return true; } @@ -330,12 +332,33 @@ bool LifeCycle::InitMessageSystem() { hmi_message_adapter_); return true; } + #endif // MQUEUE_HMIADAPTER +namespace { + void sig_handler(int sig) { + MessageQueue<threads::ThreadManager::ThreadDesc>& threads = ::threads::ThreadManager::instance()->threads_to_terminate; + threads.Shutdown(); + } +} + +void LifeCycle::Run() { + // First, register signal handler + ::utils::SubscribeToTerminateSignal(&sig_handler); + // Then run main loop until signal caught + MessageQueue<threads::ThreadManager::ThreadDesc>& threads = ::threads::ThreadManager::instance()->threads_to_terminate; + while(!threads.IsShuttingDown()) { + while (!threads.empty()) { + ::threads::ThreadManager::ThreadDesc desc = threads.pop(); + pthread_join(desc.handle, NULL); + delete desc.delegate; + } + threads.wait(); + } +} void LifeCycle::StopComponents() { - LOG4CXX_TRACE(logger_, "enter"); - if (components_started == false) { + if (!components_started_) { LOG4CXX_TRACE(logger_, "exit"); LOG4CXX_ERROR(logger_, "Components wasn't started"); return; @@ -443,7 +466,7 @@ void LifeCycle::StopComponents() { time_tester_ = NULL; } #endif // TIME_TESTER - components_started =false; + components_started_ = false; LOG4CXX_TRACE(logger_, "exit"); } diff --git a/src/appMain/life_cycle.h b/src/appMain/life_cycle.h index 9096bff7b8..3494575680 100644 --- a/src/appMain/life_cycle.h +++ b/src/appMain/life_cycle.h @@ -80,6 +80,10 @@ class LifeCycle : public utils::Singleton<LifeCycle> { * @return true if success otherwise false. */ bool InitMessageSystem(); + /** + * \brief Main loop + */ + void Run(); void StopComponents(); private: @@ -113,7 +117,7 @@ class LifeCycle : public utils::Singleton<LifeCycle> { #endif // MESSAGEBROKER_HMIADAPTER - bool components_started; + bool components_started_; FRIEND_BASE_SINGLETON_CLASS(LifeCycle); DISALLOW_COPY_AND_ASSIGN(LifeCycle); }; diff --git a/src/appMain/main.cc b/src/appMain/main.cc index db947014c8..331b0397ee 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -66,6 +66,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "appMain") + extern const char* gitVersion; namespace { @@ -139,13 +140,16 @@ bool InitHmi() { * \return EXIT_SUCCESS or EXIT_FAILURE */ int32_t main(int32_t argc, char** argv) { - threads::Thread::MaskSignals(); - threads::Thread::SetMainThread(); // -------------------------------------------------------------------------- // Logger initialization INIT_LOGGER("log4cxx.properties"); LOG4CXX_INFO(logger_, gitVersion); +#if defined(__QNXNTO__) and defined(GCOV_ENABLED) + LOG4CXX_WARN(logger_, + "Attention! This application was built with unsupported " + "configuration (gcov + QNX). Use it at your own risk."); +#endif threads::Thread::SetNameForId(threads::Thread::CurrentId(), "MainThread"); @@ -220,10 +224,7 @@ int32_t main(int32_t argc, char** argv) { } // -------------------------------------------------------------------------- - utils::SubscribeToTerminateSignal(main_namespace::dummy_signal_handler); - threads::Thread::UnmaskSignals(); - - pause(); + main_namespace::LifeCycle::instance()->Run(); LOG4CXX_INFO(logger_, "Stopping application due to signal caught"); main_namespace::LifeCycle::instance()->StopComponents(); diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index 5ec1f748cc..c30255da40 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -38,7 +38,8 @@ ThreadStackSize = 16384 MixingAudioSupported = true HMICapabilities = hmi_capabilities.json MaxCmdID = 2000000000 -DefaultTimeout = 10 +; Default request timeout in milliseconds +DefaultTimeout = 10000 AppDirectoryQuota = 104857600 AppHMILevelNoneTimeScaleMaxRequests = 100 AppHMILevelNoneRequestsTimeScale = 10 diff --git a/src/components/HMI/app/controller/SettingsController.js b/src/components/HMI/app/controller/SettingsController.js index e8f7c84653..a9a5d1a004 100644 --- a/src/components/HMI/app/controller/SettingsController.js +++ b/src/components/HMI/app/controller/SettingsController.js @@ -64,9 +64,32 @@ SDL.SettingsController = Em.Object.create( { },
phoneCall: function() {
+
+ FFW.BasicCommunication.OnPhoneCall(true);
+
+ SDL.SDLModel.phoneCallActive = true;
+
+ var appID = null;
+
if (SDL.SDLAppController.model) {
- SDL.SDLModel.onDeactivateApp('call', SDL.SDLAppController.model.appID);
+ appID = SDL.SDLAppController.model.appID;
+ }
+
+
+ if (appID) {
+ SDL.SDLModel.onDeactivateApp('call', appID);
SDL.States.goToStates('phone.dialpad');
+
+ setTimeout(function () {
+ FFW.BasicCommunication.OnPhoneCall(false);
+ SDL.SDLController.getApplicationModel(appID).turnOnSDL(appID);
+ SDL.SDLModel.phoneCallActive = false;
+ }, 5000); //Magic number - 5 seconds timeout for emulating conversation call
+ } else {
+ setTimeout(function () {
+ FFW.BasicCommunication.OnPhoneCall(false);
+ SDL.SDLModel.phoneCallActive = false;
+ }, 5000); //Magic number - 5 seconds timeout for emulating conversation call
}
},
diff --git a/src/components/HMI/app/model/sdl/Model.js b/src/components/HMI/app/model/sdl/Model.js index 106e95c88d..a902e649ec 100644 --- a/src/components/HMI/app/model/sdl/Model.js +++ b/src/components/HMI/app/model/sdl/Model.js @@ -99,6 +99,11 @@ SDL.SDLModel = Em.Object.create({ stateLimited: null, /** + * Active state of phone call on HMI for Deactivate app to handle event + */ + phoneCallActive: false, + + /** * FLAG of any app in limited level exists */ limitedExist: false, @@ -1470,7 +1475,9 @@ SDL.SDLModel = Em.Object.create({ SDL.TurnByTurnView.deactivate(); - FFW.BasicCommunication.OnAppDeactivated(reason, appID); + if (!SDL.SDLModel.phoneCallActive) { + FFW.BasicCommunication.OnAppDeactivated(reason, appID); + } } } }); diff --git a/src/components/HMI/app/view/sdl/TTSPopUp.js b/src/components/HMI/app/view/sdl/TTSPopUp.js index 3b12b5266c..4fc0c7669c 100644 --- a/src/components/HMI/app/view/sdl/TTSPopUp.js +++ b/src/components/HMI/app/view/sdl/TTSPopUp.js @@ -58,7 +58,7 @@ SDL.TTSPopUp = Em.ContainerView.create( { appID: null, - timerSeconds: 10, + timerSeconds: 5, popUp: Ember.TextArea.extend( { diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js index 9614c125c4..4c541bf727 100644 --- a/src/components/HMI/ffw/BasicCommunicationRPC.js +++ b/src/components/HMI/ffw/BasicCommunicationRPC.js @@ -966,6 +966,27 @@ FFW.BasicCommunication = FFW.RPCObserver }, /** + * Sender: HMI->SDL. When: upon phone-call event started or ended + * + * @params {Boolean} + */ + OnPhoneCall: function(isActive) { + + Em.Logger.log("FFW.BasicCommunication.OnPhoneCall"); + + // send request + + var JSONMessage = { + "jsonrpc": "2.0", + "method": "BasicCommunication.OnPhoneCall", + "params": { + "isActive": isActive + } + }; + this.client.send(JSONMessage); + }, + + /** * Initiated by HMI user. In response optional list of found devices - * if not provided, not were found. */ diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 1a23890c0e..07d8de458e 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -4,9 +4,6 @@ set (AM_TEST_DIR ${AM_SOURCE_DIR}/test) set (AM_MOCK_DIR ${AM_TEST_DIR}/mock) -if (EXTENDED_POLICY_FLAG) - add_definitions(-DEXTENDED_POLICY) -endif() include_directories ( include/ @@ -40,14 +37,6 @@ ${AM_SOURCE_DIR}/src/policies/policy_handler.cc ${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc ) -if (EXTENDED_POLICY_FLAG) - include_directories( - ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct_ext - ) - list(APPEND POLICIES_MANAGER - ${AM_SOURCE_DIR}/src/policies/pt_exchange_handler_ext.cc - ) -else () include_directories( ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct ) @@ -55,7 +44,6 @@ else () ${AM_SOURCE_DIR}/src/policies/pt_exchange_handler_impl.cc ${AM_SOURCE_DIR}/src/policies/policy_retry_sequence.cc ) -endif () file (GLOB EVENT_ENGINE ${AM_SOURCE_DIR}/src/event_engine/* @@ -258,6 +246,7 @@ file (GLOB MOBILE_COMMANDS_SOURCES ${AM_SOURCE_DIR}/src/commands/hmi/get_urls_response.cc ${AM_SOURCE_DIR}/src/commands/hmi/on_device_state_changed_notification.cc ${AM_SOURCE_DIR}/src/commands/hmi/on_tts_reset_timeout_notification.cc + ${AM_SOURCE_DIR}/src/commands/hmi/on_phone_call_notification.cc ) set (HMI_COMMANDS_SOURCES_JSON diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 636b0aaa41..5f1f598851 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -393,7 +393,6 @@ class Application : public virtual InitialApplicationData, virtual bool MakeFullscreen() = 0; virtual bool IsAudible() const = 0; virtual void MakeNotAudible() = 0; - virtual bool allowed_support_navigation() const = 0; virtual void set_allowed_support_navigation(bool allow) = 0; virtual bool hmi_supports_navi_video_streaming() const = 0; @@ -401,6 +400,9 @@ class Application : public virtual InitialApplicationData, virtual bool hmi_supports_navi_audio_streaming() const = 0; virtual void set_hmi_supports_navi_audio_streaming(bool supports) = 0; + virtual bool is_voice_communication_supported() const = 0; + virtual void set_voice_communication_supported( + bool is_voice_communication_supported) = 0; virtual bool app_allowed() const = 0; virtual bool has_been_activated() const = 0; @@ -530,6 +532,13 @@ class Application : public virtual InitialApplicationData, */ virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0; + /** + * @brief Check's if it is media, voice communication or navigation application + * + * @return true if application is media, voice communication or navigation + */ + virtual bool IsAudioApplication() const = 0; + protected: // interfaces for NAVI retry sequence diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index 0a056df92b..dadfce0929 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -82,6 +82,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, bool hmi_supports_navi_audio_streaming() const; void set_hmi_supports_navi_audio_streaming(bool supports); + virtual bool is_voice_communication_supported() const; + virtual void set_voice_communication_supported( + bool is_voice_communication_supported); inline bool app_allowed() const; bool has_been_activated() const; @@ -166,6 +169,13 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, virtual void UnsubscribeFromSoftButtons(int32_t cmd_id); + /** + * @brief Check's if it is media, voice communication or navigation application + * + * @return true if application is media, voice communication or navigation + */ + virtual bool IsAudioApplication() const; + protected: /** @@ -220,6 +230,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, std::set<uint32_t> subscribed_vehicle_info_; UsageStatistics usage_report_; ProtocolVersion protocol_version_; + bool is_voice_communication_application_; // NAVI retry stream volatile bool is_video_stream_retry_active_; diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index b29bd10252..dacac9e010 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -203,6 +203,41 @@ class ApplicationManagerImpl : public ApplicationManager, std::vector<ApplicationSharedPtr> applications_with_navi(); /** + * @brief Returns media application with LIMITED HMI Level if exist. + * + * @return Shared pointer to application if application does not + * exist returns empty shared pointer. + */ + ApplicationSharedPtr get_limited_media_application() const; + + /** + * @brief Returns navigation application with LIMITED HMI Level if exist. + * + * @return Shared pointer to application if application does not + * exist returns empty shared pointer + */ + ApplicationSharedPtr get_limited_navi_application() const; + + /** + * @brief Returns voice communication application with LIMITED HMI Level if exist. + * + * @return Shared pointer to application if application does not + * exist returns empty shared pointer + */ + ApplicationSharedPtr get_limited_voice_application() const; + + /** + * @brief Check's if there are audio(media, voice communication or navi) applications + * exist in HMI_FULL or HMI_LIMITED level with same audible HMI type. + * Used for resumption. + * + * @param app Pointer to application to compare with + * + * @return true if exist otherwise false + */ + bool DoesAudioAppWithSameHMITypeExistInFullOrLimited(ApplicationSharedPtr app) const; + + /** * @brief Notifies all components interested in Vehicle Data update * i.e. new value of odometer etc and returns list of applications * subscribed for event. @@ -281,14 +316,6 @@ class ApplicationManagerImpl : public ApplicationManager, bool RemoveAppDataFromHMI(ApplicationSharedPtr app); bool LoadAppDataToHMI(ApplicationSharedPtr app); bool ActivateApplication(ApplicationSharedPtr app); - /** - * @brief Put application in Limited HMI Level if possible, - * otherwise put applicatuion other HMI level. - * do not send any notifications to mobile - * @param app, application, that need to be puted in Limeted - * @return seted HMI Level - */ - mobile_api::HMILevel::eType PutApplicationInLimited(ApplicationSharedPtr app); /** * @brief Put application in FULL HMI Level if possible, @@ -404,27 +431,27 @@ class ApplicationManagerImpl : public ApplicationManager, // if |final_message| parameter is set connection to mobile will be closed // after processing this message void SendMessageToMobile( - const utils::SharedPtr<smart_objects::SmartObject>& message, + const utils::SharedPtr<smart_objects::SmartObject> message, bool final_message = false); bool ManageMobileCommand( - const utils::SharedPtr<smart_objects::SmartObject>& message); + const utils::SharedPtr<smart_objects::SmartObject> message); void SendMessageToHMI( - const utils::SharedPtr<smart_objects::SmartObject>& message); + const utils::SharedPtr<smart_objects::SmartObject> message); bool ManageHMICommand( - const utils::SharedPtr<smart_objects::SmartObject>& message); + const utils::SharedPtr<smart_objects::SmartObject> message); ///////////////////////////////////////////////////////// /* * @brief Overriden ProtocolObserver method */ virtual void OnMessageReceived( - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); /* * @brief Overriden ProtocolObserver method */ virtual void OnMobileMessageSent( - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); void OnMessageReceived(hmi_message_handler::MessageSharedPointer message); void OnErrorSending(hmi_message_handler::MessageSharedPointer message); @@ -458,7 +485,7 @@ class ApplicationManagerImpl : public ApplicationManager, * * @param connection_key Connection key of application * @param mobile_correlation_id Correlation ID of the mobile request - * @param new_timeout_value New timeout to be set + * @param new_timeout_value New timeout in milliseconds to be set */ void updateRequestTimeout(uint32_t connection_key, uint32_t mobile_correlation_id, @@ -601,6 +628,20 @@ class ApplicationManagerImpl : public ApplicationManager, void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id); /** + * @brief method adds application in FULL and LIMITED state + * to on_phone_call_app_list_. + * Also OnHMIStateNotification with BACKGROUND state sent for these apps + */ + void CreatePhoneCallAppList(); + + /** + * @brief method removes application from on_phone_call_app_list_. + * + * Also OnHMIStateNotification with previous HMI state sent for these apps + */ + void ResetPhoneCallAppList(); + + /** * Function used only by HMI request/response/notification base classes * to change HMI app id to Mobile app id and vice versa. * Dot use it inside Core @@ -684,10 +725,10 @@ class ApplicationManagerImpl : public ApplicationManager, bool ConvertSOtoMessage(const smart_objects::SmartObject& message, Message& output); utils::SharedPtr<Message> ConvertRawMsgToMessage( - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); - void ProcessMessageFromMobile(const utils::SharedPtr<Message>& message); - void ProcessMessageFromHMI(const utils::SharedPtr<Message>& message); + void ProcessMessageFromMobile(const utils::SharedPtr<Message> message); + void ProcessMessageFromHMI(const utils::SharedPtr<Message> message); // threads::MessageLoopThread<*>::Handler implementations /* @@ -738,6 +779,27 @@ class ApplicationManagerImpl : public ApplicationManager, */ std::map<uint32_t, TimevalStruct> tts_global_properties_app_list_; + + struct AppState { + AppState(const mobile_apis::HMILevel::eType& level, + const mobile_apis::AudioStreamingState::eType& streaming_state, + const mobile_apis::SystemContext::eType& context) + : hmi_level(level), + audio_streaming_state(streaming_state), + system_context(context) { } + + mobile_apis::HMILevel::eType hmi_level; + mobile_apis::AudioStreamingState::eType audio_streaming_state; + mobile_apis::SystemContext::eType system_context; + }; + + /** + * @brief Map contains apps with HMI state before incoming call + * After incoming call ends previous HMI state must restore + * + */ + std::map<uint32_t, AppState> on_phone_call_app_list_; + bool audio_pass_thru_active_; sync_primitives::Lock audio_pass_thru_lock_; sync_primitives::Lock tts_global_properties_app_list_lock_; @@ -790,8 +852,7 @@ class ApplicationManagerImpl : public ApplicationManager, public: ApplicationListUpdateTimer(ApplicationManagerImpl* callee) : timer::TimerThread<ApplicationManagerImpl>("AM ListUpdater", - callee, &ApplicationManagerImpl::OnApplicationListUpdateTimer - ) { + callee, &ApplicationManagerImpl::OnApplicationListUpdateTimer) { } }; typedef utils::SharedPtr<ApplicationListUpdateTimer> ApplicationListUpdateTimerSptr; diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h index 28c77b6229..587c3d834c 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -90,6 +90,24 @@ class Command { * @brief Retrieves correlation ID */ virtual uint32_t correlation_id() const = 0; + + /* + * @brief Retrieves connection_key + */ + virtual uint32_t connection_key() const = 0; + + /* + * @brief Retrieves request ID + */ + virtual int32_t function_id() const = 0; + + /* + * @brief Function is called by RequestController when request execution time + * has exceed it's limit + * + */ + virtual void onTimeOut() = 0; + }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 06637d7d84..a34716bd62 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -101,6 +101,23 @@ class CommandImpl : public Command { */ virtual uint32_t correlation_id() const; + /* + * @brief Retrieves connection key + */ + virtual uint32_t connection_key() const; + + /* + * @brief Retrieves request ID + */ + virtual int32_t function_id() const; + + /* + * @brief Function is called by RequestController when request execution time + * has exceed it's limit + * + */ + virtual void onTimeOut(); + // members static const int32_t hmi_protocol_type_; static const int32_t mobile_protocol_type_; diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index fb14078961..1bbba5aa0b 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -81,16 +81,6 @@ class CommandRequestImpl : public CommandImpl, virtual void on_event(const event_engine::Event& event); /* - * @brief Retrieves request ID - */ - inline int32_t function_id() const; - - /* - * @brief Retrieves connection key - */ - inline uint32_t connection_key() const; - - /* * @brief Creates Mobile response * * @param success true if successful; false, if failed @@ -194,14 +184,6 @@ protected: void AddDisallowedParametersToInfo(smart_objects::SmartObject& response) const; }; -int32_t CommandRequestImpl::function_id() const { - return (*message_)[strings::params][strings::function_id].asInt(); -} - -uint32_t CommandRequestImpl::connection_key() const { - return (*message_)[strings::params][strings::connection_key].asUInt(); -} - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h new file mode 100644 index 0000000000..45d831eb03 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ + +#include "application_manager/commands/hmi/notification_from_hmi.h" + +namespace application_manager { + +namespace commands { + +namespace hmi { + + +/** + * @brief OnPhoneCallNotification command class + **/ +class OnPhoneCallNotification : public NotificationFromHMI { + public: + /** + * @brief OnPhoneCallNotification class constructor + * + * @param message Incoming SmartObject message + **/ + explicit OnPhoneCallNotification(const MessageSharedPtr& message); + + /** + * @brief OnPhoneCallNotification class destructor + **/ + virtual ~OnPhoneCallNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnPhoneCallNotification); +}; + +} // namespace hmi + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index e7a7631d69..69c7b7bba7 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2013, Ford Motor Company All rights reserved. @@ -92,7 +92,9 @@ class MessageHelper { * **/ static void SendOnAppRegisteredNotificationToHMI( - const Application& application_impl, bool resumption = false); + const Application& application_impl, + bool resumption = false, + bool need_restore_vr = false); /** * @brief Create mobile HashUpdateNotification diff --git a/src/components/application_manager/include/application_manager/mobile_message_handler.h b/src/components/application_manager/include/application_manager/mobile_message_handler.h index c84ba54212..67d51c0dab 100644 --- a/src/components/application_manager/include/application_manager/mobile_message_handler.h +++ b/src/components/application_manager/include/application_manager/mobile_message_handler.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -42,10 +42,10 @@ typedef utils::SharedPtr<application_manager::Message> MobileMessage; class MobileMessageHandler { public: static application_manager::Message* HandleIncomingMessageProtocolV1( - const RawMessagePtr message); + const protocol_handler::RawMessagePtr message); static application_manager::Message* HandleIncomingMessageProtocolV2( - const RawMessagePtr message); + const protocol_handler::RawMessagePtr message); //! ------------------------------------------------------------- diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 5bc23c106a..dfc29fe00a 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -303,6 +303,18 @@ class PolicyHandler : */ uint16_t HeartBeatTimeout(const std::string& app_id) const; +//TODO(AKutsan) REMOVE THIS UGLY HOTFIX + virtual void Increment(usage_statistics::GlobalCounterId type); + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type); + virtual void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value); + virtual void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds); + + protected: /** @@ -338,6 +350,33 @@ protected: const std::string ConvertUpdateStatus(policy::PolicyTableStatus status); private: + + class StatisticManagerImpl: public usage_statistics::StatisticsManager { + //TODO(AKutsan) REMOVE THIS UGLY HOTFIX + virtual void Increment(usage_statistics::GlobalCounterId type) { + return PolicyHandler::instance()->Increment(type); + } + + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) { + return PolicyHandler::instance()->Increment(app_id, type); + } + + virtual void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) { + return PolicyHandler::instance()->Set(app_id, type, value); + } + + virtual void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) { + return PolicyHandler::instance()->Add(app_id, type, timespan_seconds); + } + }; + //TODO(AKutsan) REMOVE THIS UGLY HOTFIX + + PolicyHandler(); static PolicyHandler* instance_; static const std::string kLibrary; @@ -365,6 +404,10 @@ private: */ std::map<std::string, std::string> app_to_device_link_; + + utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_; + + DISALLOW_COPY_AND_ASSIGN(PolicyHandler); FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER(PolicyHandler, utils::deleters::Deleter<PolicyHandler>); diff --git a/src/components/application_manager/include/application_manager/policies/pt_exchange_handler_impl.h b/src/components/application_manager/include/application_manager/policies/pt_exchange_handler_impl.h index e1e67b1505..29c74aa96e 100644 --- a/src/components/application_manager/include/application_manager/policies/pt_exchange_handler_impl.h +++ b/src/components/application_manager/include/application_manager/policies/pt_exchange_handler_impl.h @@ -50,7 +50,7 @@ class PTExchangeHandlerImpl : public PTExchangeHandler { protected: PolicyHandler* policy_handler_; - threads::Thread retry_sequence_; + threads::Thread* retry_sequence_; sync_primitives::Lock retry_sequence_lock_; friend class RetrySequence; diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h index b70608fbc2..2bc5f54666 100644 --- a/src/components/application_manager/include/application_manager/request_controller.h +++ b/src/components/application_manager/include/application_manager/request_controller.h @@ -131,7 +131,7 @@ class RequestController { * @return Result code * */ - TResult addHMIRequest(const RequestPtr& request); + TResult addHMIRequest(const RequestPtr request); /** * @ Add notification to collection @@ -182,7 +182,7 @@ class RequestController { * * @param app_id Connection key of application * @param mobile_correlation_id Correlation ID of the mobile request - * @param new_timeout_value New timeout to be set + * @param new_timeout_value New timeout to be set in milliseconds */ void updateRequestTimeout(const uint32_t& app_id, const uint32_t& mobile_correlation_id, @@ -196,7 +196,9 @@ class RequestController { * @param app_time_scale - time scale (seconds) * @param max_request_per_time_scale - maximum count of request that should be allowed for app_time_scale secconds */ - bool checkTimeScaleMaxRequest(const uint32_t& app_id, const uint32_t& app_time_scale, const uint32_t& max_request_per_time_scale); + bool checkTimeScaleMaxRequest(const uint32_t& app_id, + const uint32_t& app_time_scale, + const uint32_t& max_request_per_time_scale); /** * @brief Checs if this app as able to add new requests in current hmi_level, or limits was exceeded @@ -205,7 +207,10 @@ class RequestController { * @param app_time_scale - time scale (seconds) * @param max_request_per_time_scale - maximum count of request that should be allowed for app_time_scale secconds */ - bool checkHMILevelTimeScaleMaxRequest(const mobile_apis::HMILevel::eType& hmi_level, const uint32_t& app_id, const uint32_t& app_time_scale, const uint32_t& max_request_per_time_scale); + bool checkHMILevelTimeScaleMaxRequest(const mobile_apis::HMILevel::eType& hmi_level, + const uint32_t& app_id, + const uint32_t& app_time_scale, + const uint32_t& max_request_per_time_scale); void onTimer(); @@ -232,12 +237,7 @@ class RequestController { volatile bool stop_flag_; }; - /** - * @brief Typedef for thread shared pointer - */ - typedef utils::SharedPtr<Thread> ThreadSharedPtr; - - std::vector<ThreadSharedPtr> pool_; + std::vector<Thread*> pool_; volatile TPoolState pool_state_; uint32_t pool_size_; sync_primitives::ConditionalVariable cond_var_; diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h index 778e72c916..b1409488fd 100644 --- a/src/components/application_manager/include/application_manager/request_info.h +++ b/src/components/application_manager/include/application_manager/request_info.h @@ -1,4 +1,4 @@ -/** +/** * \file request_info.h * \brief request information structure header file. * @@ -55,26 +55,30 @@ namespace request_controller { typedef utils::SharedPtr<commands::CommandRequestImpl> MobileRequestPtr; struct RequestInfo { - RequestInfo(const uint64_t timeout_sec): - timeout_sec_(timeout_sec) { + RequestInfo(const uint64_t timeout_sec) + : timeout_sec_(timeout_sec) { start_time_ = date_time::DateTime::getCurrentTime(); updateEndTime(); } - RequestInfo(const TimevalStruct& start_time,const uint64_t timeout_sec): - start_time_(start_time), + RequestInfo(const TimevalStruct& start_time,const uint64_t timeout_sec) + : start_time_(start_time), timeout_sec_(timeout_sec) { updateEndTime(); - } + } - virtual ~RequestInfo(){} + virtual ~RequestInfo(){} - virtual uint32_t requestId() = 0; - virtual commands::Command* request() = 0; + virtual uint32_t requestId() = 0; + virtual commands::Command* request() = 0; void updateEndTime() { end_time_ = date_time::DateTime::getCurrentTime(); end_time_.tv_sec += timeout_sec_; + + // possible delay during IPC + const uint32_t hmi_delay_sec = 1; + end_time_.tv_sec += hmi_delay_sec; } void updateTimeOut(const uint64_t& timeout_sec) { @@ -89,9 +93,11 @@ namespace request_controller { } return true; } + TimevalStruct start_time() { return start_time_; } + uint64_t timeout_sec() { return timeout_sec_; } @@ -100,42 +106,62 @@ namespace request_controller { return end_time_; } + uint32_t app_id() { + return app_id_; + } + + mobile_apis::HMILevel::eType hmi_level() { + return hmi_level_; + } + protected: - TimevalStruct start_time_; - uint64_t timeout_sec_; - TimevalStruct end_time_; + TimevalStruct start_time_; + uint64_t timeout_sec_; + TimevalStruct end_time_; + uint32_t app_id_; + mobile_apis::HMILevel::eType hmi_level_; }; typedef utils::SharedPtr<RequestInfo> RequestInfoPtr; struct RequestInfoComparator { - bool operator() (const RequestInfoPtr lhs, const RequestInfoPtr rhs) const { - date_time::TimeCompare compare_result = date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time()); - return compare_result == date_time::LESS; + bool operator() (const RequestInfoPtr lhs, + const RequestInfoPtr rhs) const { + date_time::TimeCompare compare_result = + date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time()); + + return compare_result == date_time::LESS; } }; typedef std::set<RequestInfoPtr,RequestInfoComparator> RequestInfoSet; struct HMIRequestInfo: public RequestInfo { - HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec); - HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time,const uint64_t timeout_sec); + HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec); + HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time, + const uint64_t timeout_sec); + RequestPtr request_; uint32_t correlation_id_; + virtual uint32_t requestId() { return correlation_id_; } + virtual commands::Command* request() { return request_.get(); } }; struct MobileRequestInfo: public RequestInfo { - MobileRequestInfo(MobileRequestPtr request, const uint64_t timeout_sec); - MobileRequestInfo(MobileRequestPtr request, const TimevalStruct& start_time, const uint64_t timeout_sec); - MobileRequestPtr request_; - uint32_t app_id_; - mobile_apis::HMILevel::eType hmi_level_; + MobileRequestInfo(RequestPtr request, + const uint64_t timeout_sec); + + MobileRequestInfo(RequestPtr request, + const TimevalStruct& start_time, + const uint64_t timeout_sec); + + RequestPtr request_; uint32_t mobile_correlation_id_; virtual uint32_t requestId() { @@ -152,27 +178,26 @@ namespace request_controller { * during time scale */ struct TimeScale { - explicit TimeScale(const TimevalStruct& start, const TimevalStruct& end, - const int32_t& app_id) + TimeScale(const TimevalStruct& start, + const TimevalStruct& end, + const uint32_t& app_id) : start_(start), end_(end), app_id_(app_id) {} bool operator()(RequestInfoPtr setEntry) { - MobileRequestInfo* mobile_request_info = NULL; - RequestInfo* request = setEntry.get(); - mobile_request_info = dynamic_cast<MobileRequestInfo*>(request); - if (NULL == mobile_request_info) { + + if (!setEntry.valid()) { return false; } - if (mobile_request_info->app_id_ != app_id_) { + if (setEntry->app_id() != app_id_) { return false; } - if (date_time::DateTime::getmSecs(mobile_request_info->start_time()) + if (date_time::DateTime::getmSecs(setEntry->start_time()) < date_time::DateTime::getmSecs(start_) || - date_time::DateTime::getmSecs(mobile_request_info->start_time()) + date_time::DateTime::getmSecs(setEntry->start_time()) > date_time::DateTime::getmSecs(end_)) { return false; } @@ -181,9 +206,9 @@ namespace request_controller { } private: - TimevalStruct start_; - TimevalStruct end_; - uint32_t app_id_; + TimevalStruct start_; + TimevalStruct end_; + uint32_t app_id_; }; /** @@ -191,30 +216,31 @@ namespace request_controller { * during time scale for application in defined hmi level */ struct HMILevelTimeScale { - explicit HMILevelTimeScale( - const TimevalStruct& start, const TimevalStruct& end, - const uint32_t& app_id, const mobile_apis::HMILevel::eType& hmi_level) + HMILevelTimeScale(const TimevalStruct& start, + const TimevalStruct& end, + const uint32_t& app_id, + const mobile_apis::HMILevel::eType& hmi_level) : start_(start), end_(end), app_id_(app_id), hmi_level_(hmi_level) {} bool operator()(RequestInfoPtr setEntry) { - MobileRequestInfo* mobile_request_info = NULL; - mobile_request_info = dynamic_cast<MobileRequestInfo*>(setEntry.get()); - if (NULL == mobile_request_info) { + if (!setEntry.valid()) { return false; } - if (mobile_request_info->app_id_ != app_id_) { + + if (setEntry->app_id() != app_id_) { return false; } - if (mobile_request_info->hmi_level_ != hmi_level_) { + + if (setEntry->hmi_level() != hmi_level_) { return false; } - if (date_time::DateTime::getSecs(mobile_request_info->start_time()) + if (date_time::DateTime::getSecs(setEntry->start_time()) < date_time::DateTime::getSecs(start_) || - date_time::DateTime::getSecs(mobile_request_info->start_time()) + date_time::DateTime::getSecs(setEntry->start_time()) > date_time::DateTime::getSecs(end_)) { return false; } @@ -222,9 +248,9 @@ namespace request_controller { return true; } private: - TimevalStruct start_; - TimevalStruct end_; - uint32_t app_id_; + TimevalStruct start_; + TimevalStruct end_; + uint32_t app_id_; mobile_apis::HMILevel::eType hmi_level_; }; diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 1df8b21ad9..3d03989874 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -361,6 +361,7 @@ const char result[] = "result"; const char statistic_type[] = "statisticType"; const char error[] = "error"; const char policyfile[] = "policyfile"; +const char is_active[] = "isActive"; } // namespace hmi_notification diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 2812c17ffb..f52467f751 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -99,6 +99,7 @@ ApplicationImpl::ApplicationImpl(uint32_t application_id, device_(0), usage_report_(mobile_app_id, statistics_manager), protocol_version_(ProtocolVersion::kV3), + is_voice_communication_application_(false), is_video_stream_retry_active_(false), is_audio_stream_retry_active_(false), video_stream_retry_number_(0), @@ -176,6 +177,21 @@ void ApplicationImpl::set_allowed_support_navigation(bool allow) { allowed_support_navigation_ = allow; } +bool ApplicationImpl::is_voice_communication_supported() const { + return is_voice_communication_application_; +} + +void ApplicationImpl::set_voice_communication_supported( + bool is_voice_communication_supported) { + is_voice_communication_application_ = is_voice_communication_supported; +} + +bool ApplicationImpl::IsAudioApplication() const { + return is_media_ || + is_voice_communication_application_ || + allowed_support_navigation_; +} + const smart_objects::SmartObject* ApplicationImpl::active_message() const { return active_message_; } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index d6beb3c497..6d7fdeec61 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -190,6 +190,104 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const { return ApplicationSharedPtr(); } + +ApplicationSharedPtr +ApplicationManagerImpl::get_limited_media_application() const { + sync_primitives::AutoLock lock(applications_list_lock_); + + for (TAppListIt it = application_list_.begin(); + application_list_.end() != it; ++it) { + if ((*it)->is_media_application() && + (mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level())) { + return *it; + } + } + + return ApplicationSharedPtr(); +} + +ApplicationSharedPtr +ApplicationManagerImpl::get_limited_navi_application() const { + sync_primitives::AutoLock lock(applications_list_lock_); + + for (TAppListIt it = application_list_.begin(); + application_list_.end() != it; ++it) { + if ((*it)->allowed_support_navigation() && + (mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level())) { + return *it; + } + } + + return ApplicationSharedPtr(); +} + +ApplicationSharedPtr +ApplicationManagerImpl::get_limited_voice_application() const { + sync_primitives::AutoLock lock(applications_list_lock_); + + for (TAppListIt it = application_list_.begin(); + application_list_.end() != it; ++it) { + if ((*it)->is_voice_communication_supported() && + (mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level())) { + return *it; + } + } + + return ApplicationSharedPtr(); +} + +bool ApplicationManagerImpl::DoesAudioAppWithSameHMITypeExistInFullOrLimited( + ApplicationSharedPtr app) const { + bool voice_state = app->is_voice_communication_supported(); + bool media_state = app->is_media_application(); + bool navi_state = app->hmi_supports_navi_video_streaming(); + ApplicationSharedPtr active_app = active_application(); + // Check app in FULL level + if (active_app.valid()) { + // If checking app hmi level FULL, we return false + // because we couldn't have two applications with same HMIType in FULL and LIMITED HMI level + if (active_app->app_id() == app->app_id()) { + return false; + } + + if (voice_state && active_app->is_voice_communication_supported()) { + return true; + } + + if (media_state && active_app->is_media_application()) { + return true; + } + + if (navi_state && active_app->hmi_supports_navi_video_streaming()) { + return true; + } + } + + // Check LIMITED apps + if (voice_state) { + if (get_limited_voice_application().valid() && + (get_limited_voice_application()->app_id() != app->app_id())) { + return true; + } + } + + if (media_state) { + if (get_limited_media_application().valid() && + (get_limited_media_application()->app_id() != app->app_id())) { + return true; + } + } + + if (navi_state) { + if (get_limited_navi_application().valid() && + (get_limited_navi_application()->app_id() != app->app_id())) { + return true; + } + } + + return false; +} + std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button( uint32_t button) { std::vector<ApplicationSharedPtr> result; @@ -399,116 +497,90 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) { return false; } - bool is_new_app_media = app->is_media_application(); - if (app->IsFullscreen()) { LOG4CXX_WARN(logger_, "Application is already active."); return false; } - if (mobile_api::HMILevel::eType::HMI_LIMITED != - app->hmi_level()) { + + bool is_new_app_media = app->is_media_application(); + ApplicationSharedPtr current_active_app = active_application(); + + if (mobile_api::HMILevel::eType::HMI_LIMITED != app->hmi_level()) { if (app->has_been_activated()) { MessageHelper::SendAppDataToHMI(app); } } - app->MakeFullscreen(); - for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin(); - application_list_.end() != it; - ++it) { - ApplicationSharedPtr curr_app = *it; - if (app->app_id() == curr_app->app_id()) { - continue; + + if (current_active_app.valid()) { + if (is_new_app_media && current_active_app->is_media_application()) { + current_active_app->MakeNotAudible(); + } else if (!(current_active_app->IsAudioApplication())) { + current_active_app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); } else { - if (is_new_app_media) { - if (curr_app->IsAudible()) { - curr_app->MakeNotAudible(); - MessageHelper::SendHMIStatusNotification(*curr_app); - } - } - if (curr_app->IsFullscreen()) { - if (true == curr_app->is_media_application()) { - PutApplicationInLimited(app); - } else { - app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); - } - MessageHelper::SendHMIStatusNotification(*curr_app); - } + current_active_app->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED); } - } - return true; -} -mobile_apis::HMILevel::eType ApplicationManagerImpl::PutApplicationInLimited( - ApplicationSharedPtr app) { - DCHECK(app.get()) + MessageHelper::SendHMIStatusNotification(*current_active_app); + } - mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_LIMITED; + app->MakeFullscreen(); - for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin(); - application_list_.end() != it; - ++it) { - ApplicationSharedPtr curr_app = *it; - if (app->app_id() == curr_app->app_id()) { - continue; + if (is_new_app_media) { + ApplicationSharedPtr limited_app = get_limited_media_application(); + if (limited_app.valid()) { + limited_app->MakeNotAudible(); + MessageHelper::SendHMIStatusNotification(*limited_app); } + } - if (curr_app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) { - result = mobile_api::HMILevel::HMI_BACKGROUND; - break; - } - if (curr_app->hmi_level() == mobile_api::HMILevel::HMI_FULL) { - if (curr_app->is_media_application()) { - result = mobile_api::HMILevel::HMI_BACKGROUND; - break; - } else { - result = mobile_api::HMILevel::HMI_LIMITED; + if (app->is_voice_communication_supported()) { + ApplicationSharedPtr limited_app = get_limited_voice_application(); + if (limited_app.valid()) { + if (limited_app->is_media_application()) { + limited_app->set_audio_streaming_state( + mobile_api::AudioStreamingState::NOT_AUDIBLE); } + limited_app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); + MessageHelper::SendHMIStatusNotification(*limited_app); } + } + if (app->allowed_support_navigation()) { + ApplicationSharedPtr limited_app = get_limited_navi_application(); + if (limited_app.valid()) { + if (limited_app->is_media_application()) { + limited_app->set_audio_streaming_state( + mobile_api::AudioStreamingState::NOT_AUDIBLE); + } + limited_app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); + MessageHelper::SendHMIStatusNotification(*limited_app); + } } - app->set_hmi_level(result); - return result; + + return true; } mobile_api::HMILevel::eType ApplicationManagerImpl::PutApplicationInFull( ApplicationSharedPtr app) { DCHECK(app.get()) - bool is_new_app_media = app->is_media_application(); + bool is_audio_app = app->IsAudioApplication(); + bool does_audio_app_with_same_type_exist = + DoesAudioAppWithSameHMITypeExistInFullOrLimited(app); + mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_FULL; - std::set<ApplicationSharedPtr>::iterator it = application_list_.begin(); - for (; application_list_.end() != it; ++it) { - ApplicationSharedPtr curr_app = *it; - if (app->app_id() == curr_app->app_id()) { - continue; - } + bool is_active_app_exist = active_application().valid(); - if (is_new_app_media) { - if (curr_app->hmi_level() == mobile_api::HMILevel::HMI_FULL) { - if (curr_app->is_media_application()) { - result = mobile_api::HMILevel::HMI_BACKGROUND; - break; - } else { - result = mobile_api::HMILevel::HMI_LIMITED; - } - } - if (curr_app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) { - result = mobile_api::HMILevel::HMI_BACKGROUND; - break; - } - } else { - if (curr_app->hmi_level() == mobile_api::HMILevel::HMI_FULL) { - result = mobile_api::HMILevel::HMI_BACKGROUND; - break; - } - if (curr_app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) { - result = mobile_api::HMILevel::HMI_FULL; - } - } + if (is_audio_app && does_audio_app_with_same_type_exist) { + result = mobile_apis::HMILevel::HMI_BACKGROUND; + } else if (is_active_app_exist && is_audio_app) { + result = mobile_apis::HMILevel::HMI_LIMITED; + } else if (is_active_app_exist && (!is_audio_app)) { + result = mobile_apis::HMILevel::HMI_BACKGROUND; } - if (result == mobile_api::HMILevel::HMI_FULL) { + if (mobile_api::HMILevel::HMI_FULL == result) { app->set_hmi_level(result); MessageHelper::SendActivateAppToHMI(app->app_id()); } @@ -688,7 +760,7 @@ std::string ApplicationManagerImpl::GetDeviceName( } void ApplicationManagerImpl::OnMessageReceived( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnMessageReceived"); if (!message) { @@ -706,7 +778,7 @@ void ApplicationManagerImpl::OnMessageReceived( } void ApplicationManagerImpl::OnMobileMessageSent( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnMobileMessageSent"); } @@ -1041,7 +1113,7 @@ void ApplicationManagerImpl::StartDevicesDiscovery() { } void ApplicationManagerImpl::SendMessageToMobile( - const utils::SharedPtr<smart_objects::SmartObject>& message, + const utils::SharedPtr<smart_objects::SmartObject> message, bool final_message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::SendMessageToMobile"); @@ -1131,7 +1203,7 @@ void ApplicationManagerImpl::SendMessageToMobile( } bool ApplicationManagerImpl::ManageMobileCommand( - const utils::SharedPtr<smart_objects::SmartObject>& message) { + const utils::SharedPtr<smart_objects::SmartObject> message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ManageMobileCommand"); if (!message) { @@ -1288,7 +1360,7 @@ bool ApplicationManagerImpl::ManageMobileCommand( } void ApplicationManagerImpl::SendMessageToHMI( - const utils::SharedPtr<smart_objects::SmartObject>& message) { + const utils::SharedPtr<smart_objects::SmartObject> message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::SendMessageToHMI"); if (!message) { @@ -1330,7 +1402,7 @@ void ApplicationManagerImpl::SendMessageToHMI( } bool ApplicationManagerImpl::ManageHMICommand( - const utils::SharedPtr<smart_objects::SmartObject>& message) { + const utils::SharedPtr<smart_objects::SmartObject> message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ManageHMICommand"); if (!message) { @@ -1642,7 +1714,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( } utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { DCHECK(message); utils::SharedPtr<Message> outgoing_message; @@ -1678,7 +1750,7 @@ utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage( } void ApplicationManagerImpl::ProcessMessageFromMobile( - const utils::SharedPtr<Message>& message) { + const utils::SharedPtr<Message> message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ProcessMessageFromMobile()"); #ifdef TIME_TESTER AMMetricObserver::MessageMetricSharedPtr metric(new AMMetricObserver::MessageMetric()); @@ -1712,7 +1784,7 @@ void ApplicationManagerImpl::ProcessMessageFromMobile( } void ApplicationManagerImpl::ProcessMessageFromHMI( - const utils::SharedPtr<Message>& message) { + const utils::SharedPtr<Message> message) { LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ProcessMessageFromHMI()"); utils::SharedPtr<smart_objects::SmartObject> smart_object( new smart_objects::SmartObject); @@ -2335,4 +2407,55 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList( } } +void ApplicationManagerImpl::CreatePhoneCallAppList() { + LOG4CXX_TRACE_ENTER(logger_); + + ApplicationManagerImpl::ApplicationListAccessor accessor; + ApplicationManagerImpl::TAppList local_app_list = accessor.applications(); + + ApplicationManagerImpl::TAppListIt it = local_app_list.begin(); + ApplicationManagerImpl::TAppListIt itEnd = local_app_list.end(); + + for (; it != itEnd; ++it) { + if (mobile_api::HMILevel::HMI_FULL == (*it)->hmi_level() || + mobile_api::HMILevel::HMI_LIMITED == (*it)->hmi_level()) { + + // back up app state + on_phone_call_app_list_.insert(std::pair<uint32_t, AppState>( + (*it)->app_id(), AppState((*it)->hmi_level(), + (*it)->audio_streaming_state(), + (*it)->system_context()))); + + // app state during phone call + (*it)->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); + (*it)->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE); + (*it)->set_system_context(mobile_api::SystemContext::SYSCTXT_MAIN); + MessageHelper::SendHMIStatusNotification(*(*it)); + } + } +} + +void ApplicationManagerImpl::ResetPhoneCallAppList() { + LOG4CXX_TRACE_ENTER(logger_); + + ApplicationManagerImpl::ApplicationListAccessor accessor; + ApplicationManagerImpl::TAppList local_app_list = accessor.applications(); + + std::map<uint32_t, AppState>::iterator it = + on_phone_call_app_list_.begin(); + std::map<uint32_t, AppState>::iterator it_end = + on_phone_call_app_list_.end(); + for (; it != it_end; ++it) { + ApplicationSharedPtr app = application(it->first); + if (app) { + app->set_hmi_level(it->second.hmi_level); + app->set_audio_streaming_state(it->second.audio_streaming_state); + app->set_system_context(it->second.system_context); + MessageHelper::SendHMIStatusNotification(*app); + } + } + + on_phone_call_app_list_.clear(); +} + } // namespace application_manager diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index af666b22c4..86b764c46a 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -70,11 +70,21 @@ uint32_t CommandImpl::default_timeout() const { return default_timeout_; } - uint32_t CommandImpl::correlation_id() const { return (*message_)[strings::params][strings::correlation_id].asUInt(); } +int32_t CommandImpl::function_id() const { + return (*message_)[strings::params][strings::function_id].asInt(); +} + +uint32_t CommandImpl::connection_key() const { + return (*message_)[strings::params][strings::connection_key].asUInt(); +} + +void CommandImpl::onTimeOut() { + +} } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/src/commands/hmi/activate_app_request.cc index a1b17f5229..29d998640e 100644 --- a/src/components/application_manager/src/commands/hmi/activate_app_request.cc +++ b/src/components/application_manager/src/commands/hmi/activate_app_request.cc @@ -52,9 +52,14 @@ namespace application_manager { uint32_t app_id = RequestToHMI::application_id(); ApplicationManagerImpl::instance()->set_application_id(correlation_id(), app_id); #ifdef ENABLE_LOG - mobile_apis::HMILevel::eType requested_hmi_level = static_cast<mobile_apis::HMILevel::eType>( - (*message_)[strings::msg_params][strings::activate_app_hmi_level].asInt()); - LOG4CXX_TRACE(logger_, "requested_hmi_level = " << requested_hmi_level); + if ((*message_)[strings::msg_params].keyExists( + strings::activate_app_hmi_level)) { + mobile_apis::HMILevel::eType requested_hmi_level = + static_cast<mobile_apis::HMILevel::eType>( + (*message_)[strings::msg_params][strings::activate_app_hmi_level].asInt()); + LOG4CXX_TRACE(logger_, "requested_hmi_level = " + << requested_hmi_level); + } #endif SendRequest(); subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp, @@ -91,8 +96,9 @@ namespace application_manager { return; } if (mobile_apis::HMILevel::HMI_FULL == requested_hmi_level) { - ApplicationManagerImpl::instance()->ActivateApplication(application); - MessageHelper::SendHMIStatusNotification(*(application.get())); + if (ApplicationManagerImpl::instance()->ActivateApplication(application)) { + MessageHelper::SendHMIStatusNotification(*(application.get())); + } } } } // namespace commands diff --git a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc index 152546b24b..19dd91ab2a 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc @@ -116,12 +116,12 @@ void OnAppDeactivatedNotification::Run() { case hmi_apis::Common_DeactivateReason::PHONEMENU: case hmi_apis::Common_DeactivateReason::SYNCSETTINGS: case hmi_apis::Common_DeactivateReason::GENERAL: { - if (app->is_media_application()) { - if (mobile_api::HMILevel::HMI_FULL == app->hmi_level()) { - app->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED); - } - } else { + if ((!app->IsAudioApplication()) || + ApplicationManagerImpl::instance()-> + DoesAudioAppWithSameHMITypeExistInFullOrLimited(app)) { app->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND); + } else { + app->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED); } break; } diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc index 3d027ff1c6..b284c81f21 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc @@ -31,9 +31,14 @@ */ #include "application_manager/commands/hmi/on_exit_all_applications_notification.h" + +#include <sys/types.h> +#include <unistd.h> +#include <signal.h> + #include "application_manager/application_manager_impl.h" #include "interfaces/HMI_API.h" -#include "utils/signals.h" + namespace application_manager { @@ -89,7 +94,7 @@ void OnExitAllApplicationsNotification::Run() { app_manager->HeadUnitReset(mob_reason); } - threads::Thread::InterruptMainThread(); + kill(getpid(), SIGINT); } void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { diff --git a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc b/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc new file mode 100644 index 0000000000..9bd9099c75 --- /dev/null +++ b/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/hmi/on_phone_call_notification.h" +#include "application_manager/application_manager_impl.h" +#include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" + +namespace application_manager { + +namespace commands { + +namespace hmi { + +OnPhoneCallNotification::OnPhoneCallNotification( + const MessageSharedPtr& message) + : NotificationFromHMI(message) { +} + +OnPhoneCallNotification::~OnPhoneCallNotification() { +} + +void OnPhoneCallNotification::Run() { + LOG4CXX_INFO(logger_, "OnPhoneCallNotification::Run"); + + bool is_active = + (*message_)[strings::msg_params][hmi_notification::is_active].asBool(); + + if (is_active) { + ApplicationManagerImpl::instance()->CreatePhoneCallAppList(); + } else { + ApplicationManagerImpl::instance()->ResetPhoneCallAppList(); + } +} + +} // namespace hmi + +} // namespace commands + +} // namespace application_manager + diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index c5f269fc48..a730995f5d 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -67,7 +67,8 @@ void PerformAudioPassThruRequest::onTimeOut() { } bool PerformAudioPassThruRequest::Init() { - default_timeout_ += (((*message_)[str::msg_params][str::max_duration].asInt())/1000); + default_timeout_ += + (((*message_)[str::msg_params][str::max_duration].asUInt())); return true; } diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc index 8bb83888d6..1da7e08e47 100644 --- a/src/components/application_manager/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/src/commands/mobile/put_file_request.cc @@ -150,8 +150,14 @@ void PutFileRequest::Run() { file_path = profile::Profile::instance()->app_storage_folder(); file_path += "/" + application->folder_name(); - if (binary_data.size() > - ApplicationManagerImpl::instance()->GetAvailableSpaceForApp(application->name())) { + uint32_t space_available = ApplicationManagerImpl::instance()-> + GetAvailableSpaceForApp(application->folder_name()); + + if (binary_data.size() > space_available) { + + response_params[strings::space_available] = + static_cast<uint32_t>(space_available); + LOG4CXX_ERROR(logger_, "Out of memory"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY, "Out of memory", &response_params); @@ -169,9 +175,11 @@ void PutFileRequest::Run() { mobile_apis::Result::eType save_result = ApplicationManagerImpl::instance()->SaveBinary(binary_data, file_path, sync_file_name_, offset_); + if (!is_system_file) { - response_params[strings::space_available] = static_cast<int32_t>( - ApplicationManagerImpl::instance()->GetAvailableSpaceForApp(application->folder_name())); + response_params[strings::space_available] = static_cast<uint32_t>( + ApplicationManagerImpl::instance()->GetAvailableSpaceForApp( + application->folder_name())); } sync_file_name_ = file_path + "/" + sync_file_name_; diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index d33a99a0a9..a035e86f2d 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -152,12 +152,8 @@ void RegisterAppInterfaceRequest::Run() { } } - std::string mobile_app_id = (*message_)[strings::msg_params][strings::app_id] + const std::string mobile_app_id = (*message_)[strings::msg_params][strings::app_id] .asString(); - if (policy::PolicyHandler::instance()->IsApplicationRevoked(mobile_app_id)) { - SendResponse(false, mobile_apis::Result::DISALLOWED); - return; - } ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(connection_key()); @@ -167,6 +163,11 @@ void RegisterAppInterfaceRequest::Run() { return; } + if (IsApplicationWithSameAppIdRegistered()) { + SendResponse(false, mobile_apis::Result::DISALLOWED); + return; + } + mobile_apis::Result::eType policy_result = CheckWithPolicyData(); if (mobile_apis::Result::SUCCESS != policy_result && mobile_apis::Result::WARNINGS != policy_result) { @@ -188,11 +189,6 @@ void RegisterAppInterfaceRequest::Run() { return; } - if (IsApplicationWithSameAppIdRegistered()) { - SendResponse(false, mobile_apis::Result::DISALLOWED); - return; - } - mobile_apis::Result::eType restriction_result = CheckRestrictions(); if (mobile_apis::Result::SUCCESS != restriction_result) { LOG4CXX_ERROR_EXT(logger_, "Param names restrictions check failed."); @@ -250,15 +246,21 @@ void RegisterAppInterfaceRequest::Run() { if (msg_params.keyExists(strings::app_hmi_type)) { app->set_app_types(msg_params[strings::app_hmi_type]); - // check if app is NAVI - const int32_t is_navi_type = mobile_apis::AppHMIType::NAVIGATION; + // check app type const smart_objects::SmartObject& app_type = msg_params.getElement(strings::app_hmi_type); for (size_t i = 0; i < app_type.length(); ++i) { - if (is_navi_type == app_type.getElement(i).asInt()) { + if (mobile_apis::AppHMIType::NAVIGATION == + static_cast<mobile_apis::AppHMIType::eType>( + app_type.getElement(i).asUInt())) { app->set_allowed_support_navigation(true); } + if (mobile_apis::AppHMIType::COMMUNICATION == + static_cast<mobile_apis::AppHMIType::eType>( + app_type.getElement(i).asUInt())) { + app->set_voice_communication_supported(true); + } } } @@ -464,19 +466,20 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( uint32_t hash_id = 0; const char* add_info = ""; - bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id); + const bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id); + bool need_restore_vr = resumption; if (resumption) { hash_id = (*message_)[strings::msg_params][strings::hash_id].asUInt(); if (!resumer.CheckApplicationHash(application, hash_id)) { LOG4CXX_WARN(logger_, "Hash does not matches"); result = mobile_apis::Result::RESUME_FAILED; add_info = "Hash does not matches"; - resumption = false; + need_restore_vr = false; } else if (!resumer.CheckPersistenceFilesForResumption(application)) { LOG4CXX_WARN(logger_, "Persistent data is missed"); result = mobile_apis::Result::RESUME_FAILED; add_info = "Persistent data is missed"; - resumption = false; + need_restore_vr = false; } else { add_info = " Resume Succeed"; } @@ -485,7 +488,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( SendResponse(true, result, add_info, params); MessageHelper::SendOnAppRegisteredNotificationToHMI(*(application.get()), - resumption); + resumption, + need_restore_vr); MessageHelper::SendChangeRegistrationRequestToHMI(application); diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc index 4b78833057..4b06730752 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc @@ -84,7 +84,7 @@ void SetIconRequest::Run() { msg_params[strings::sync_file_name] = smart_objects::SmartObject( smart_objects::SmartType_Map); -// Requires unchanged path value without encoded special characters +// Panasonic requres unchanged path value without encoded special characters const std::string full_file_path_for_hmi = file_system::ConvertPathForURL( full_file_path); diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index bf200d72d3..52f3c7dee7 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -142,9 +142,7 @@ void SliderRequest::on_event(const event_engine::Event& event) { const bool is_response_success = (mobile_apis::Result::SUCCESS == response_code) || //Aborted has slider_position data - (mobile_apis::Result::ABORTED == response_code) || - //according with SDLAQ-CRS-2904 - (mobile_apis::Result::TIMED_OUT == response_code); + (mobile_apis::Result::ABORTED == response_code); SendResponse(is_response_success, mobile_apis::Result::eType(response_code), diff --git a/src/components/application_manager/src/hmi_capabilities.cc b/src/components/application_manager/src/hmi_capabilities.cc index 5c67492b48..5a3ce71ec6 100644 --- a/src/components/application_manager/src/hmi_capabilities.cc +++ b/src/components/application_manager/src/hmi_capabilities.cc @@ -49,8 +49,6 @@ namespace application_manager { namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters; -CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities") - std::map<std::string, hmi_apis::Common_Language::eType> languages_enum_values = { {"EN_US", hmi_apis::Common_Language::EN_US}, @@ -79,6 +77,8 @@ std::map<std::string, hmi_apis::Common_Language::eType> languages_enum_values = {"NO_NO", hmi_apis::Common_Language::NO_NO} }; +CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities") + std::map<std::string, hmi_apis::Common_VrCapabilities::eType> vr_enum_capabilities = { {"TEXT", hmi_apis::Common_VrCapabilities::VR_TEXT} @@ -577,11 +577,15 @@ bool HMICapabilities::load_capabilities_from_file() { } // UI if (check_existing_json_member(root_json, "UI")) { - Json::Value ui = root_json.get("UI", ""); + Json::Value ui = root_json.get("UI", Json::Value::null); if (check_existing_json_member(ui, "language")) { - set_active_ui_language( - languages_enum_values.find(ui.get("language", "").asString())->second); + std::string lang = ui.get("language", "EN_US").asString(); + std::map<std::string, hmi_apis::Common_Language::eType>::const_iterator + it = languages_enum_values.find(lang); + if (it != languages_enum_values.end()) { + set_active_ui_language(it->second); + } } if (check_existing_json_member(ui, "languages")) { diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc index 1416b6c0fa..c9d241a9a4 100644 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ b/src/components/application_manager/src/hmi_command_factory.cc @@ -259,6 +259,7 @@ #include "application_manager/commands/hmi/navi_send_location_request.h" #include "application_manager/commands/hmi/navi_send_location_response.h" #include "application_manager/commands/hmi/on_tts_reset_timeout_notification.h" +#include "application_manager/commands/hmi/on_phone_call_notification.h" namespace application_manager { @@ -275,8 +276,8 @@ CommandSharedPtr HMICommandFactory::CreateCommand( new application_manager::commands::CommandImpl(message)); bool is_response = false; - if ((*message)[strings::params][strings::message_type] - == static_cast<int>(application_manager::MessageType::kResponse)) { + const int msg_type = (*message)[strings::params][strings::message_type].asInt(); + if (msg_type == static_cast<int>(application_manager::MessageType::kResponse)) { is_response = true; LOG4CXX_INFO(logger_, "HMICommandFactory::CreateCommand response"); } else if ((*message)[strings::params][strings::message_type] @@ -2035,6 +2036,10 @@ CommandSharedPtr HMICommandFactory::CreateCommand( command.reset(new commands::hmi::OnTTSResetTimeoutNotification(message)); break; } + case hmi_apis::FunctionID::BasicCommunication_OnPhoneCall: { + command.reset(new commands::hmi::OnPhoneCallNotification(message)); + break; + } } return command; diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index b97b01c0d6..ffde928db6 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -288,7 +288,7 @@ void MessageHelper::SendHMIStatusNotification( } void MessageHelper::SendOnAppRegisteredNotificationToHMI( - const Application& application_impl, bool resumption) { + const Application& application_impl, bool resumption, bool need_restore_vr) { smart_objects::SmartObject* notification = new smart_objects::SmartObject; if (!notification) { // TODO(VS): please add logger. @@ -307,8 +307,10 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI( const smart_objects::SmartObject* ngn_media_screen_name = application_impl .ngn_media_screen_name(); + // Due to current requirements in case when we're in resumption mode + // we have to always send resumeVRGrammar field. if (resumption) { - message[strings::msg_params][strings::resume_vr_grammars] = true; + message[strings::msg_params][strings::resume_vr_grammars] = need_restore_vr; } if (ngn_media_screen_name) { @@ -1277,7 +1279,9 @@ void MessageHelper::SendActivateAppToHMI(uint32_t const app_id, (*message)[strings::msg_params]["priority"] = GetPriorityCode(priority); } - if (hmi_apis::Common_HMILevel::INVALID_ENUM != level) { + // We haven't send HMI level to HMI in case it FULL. + if (hmi_apis::Common_HMILevel::INVALID_ENUM != level && + hmi_apis::Common_HMILevel::FULL != level) { (*message)[strings::msg_params][strings::activate_app_hmi_level] = level; } diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index e2293e3816..22260e214e 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -56,7 +56,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "MobileMessageHandler") application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV1( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger_, "MobileMessageHandler HandleIncomingMessageProtocolV1()"); application_manager::Message* outgoing_message = @@ -86,7 +86,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV2( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger_, "MobileMessageHandler HandleIncomingMessageProtocolV2()"); diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index e7b259e6b5..488097761a 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -45,7 +45,7 @@ PolicyEventObserver::PolicyEventObserver(utils::SharedPtr<PolicyManager> policy_ } void PolicyEventObserver::on_event(const event_engine::Event& event) { - if (policy_manager_.valid()) { + if (!policy_manager_) { return; } const smart_objects::SmartObject& message = event.smart_object(); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index ea1045247a..0033743e75 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -50,6 +50,7 @@ #include "application_manager/usage_statistics.h" #include "policy/policy_types.h" #include "interfaces/MOBILE_API.h" +#include "utils/file_system.h" namespace policy { @@ -206,13 +207,15 @@ PolicyHandler* PolicyHandler::instance_ = NULL; const std::string PolicyHandler::kLibrary = "libPolicy.so"; PolicyHandler::PolicyHandler() + : dl_handle_(0), // EXTENDED_POLICY exchange_handler_(new PTExchangeHandlerImpl(this)), on_ignition_check_done_(false), last_activated_app_id_(0), registration_in_progress(false), - is_user_requested_policy_table_update_(false) { + is_user_requested_policy_table_update_(false), + statistic_manager_impl_(new StatisticManagerImpl()) { } PolicyHandler::~PolicyHandler() { @@ -266,7 +269,11 @@ bool PolicyHandler::InitPolicyTable() { hmi_apis::FunctionID::BasicCommunication_OnReady); std::string preloaded_file = profile::Profile::instance()->preloaded_pt_file(); - return policy_manager_->InitPT(preloaded_file); + if (file_system::FileExists(preloaded_file)) { + return policy_manager_->InitPT(preloaded_file); + } + LOG4CXX_WARN(logger_, "The file which contains preloaded PT is not exist"); + return false; } bool PolicyHandler::ResetPolicyTable() { @@ -274,7 +281,11 @@ bool PolicyHandler::ResetPolicyTable() { POLICY_LIB_CHECK(false); std::string preloaded_file = profile::Profile::instance()->preloaded_pt_file(); - return policy_manager_->ResetPT(preloaded_file); + if (file_system::FileExists(preloaded_file)) { + return policy_manager_->ResetPT(preloaded_file); + } + LOG4CXX_WARN(logger_, "The file which contains preloaded PT is not exist"); + return false; } bool PolicyHandler::ClearUserConsent() { @@ -677,15 +688,10 @@ void PolicyHandler::OnAppRevoked(const std::string& policy_app_id) { permissions.appRevoked = true; application_manager::MessageHelper::SendOnAppPermissionsChangedNotification( app->app_id(), permissions); - application_manager::MessageHelper:: - SendOnAppInterfaceUnregisteredNotificationToMobile( - app->app_id(), - mobile_apis::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED); - - application_manager::ApplicationManagerImpl::instance()-> - UnregisterRevokedApplication(app->app_id(), - mobile_apis::Result::INVALID_ENUM); app->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + application_manager::MessageHelper::SendActivateAppToHMI( + app->app_id(), hmi_apis::Common_HMILevel::NONE); + application_manager::MessageHelper::SendHMIStatusNotification(*app); policy_manager_->RemovePendingPermissionChanges(policy_app_id); return; } @@ -1203,8 +1209,7 @@ const std::vector<int> PolicyHandler::RetrySequenceDelaysSeconds() { utils::SharedPtr<usage_statistics::StatisticsManager> PolicyHandler::GetStatisticManager() { - return utils::SharedPtr<PolicyManager>:: - static_pointer_cast<usage_statistics::StatisticsManager>(policy_manager_); + return statistic_manager_impl_; } void PolicyHandler::AddStatisticsInfo(int type) { @@ -1315,5 +1320,29 @@ uint16_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const { return policy_manager_->HeartBeatTimeout(app_id); } +void PolicyHandler::Increment(usage_statistics::GlobalCounterId type) { + POLICY_LIB_CHECK(); + policy_manager_->Increment(type); +} + +void PolicyHandler::Increment(const std::string& app_id, usage_statistics::AppCounterId type) { + POLICY_LIB_CHECK(); + policy_manager_->Increment(app_id, type); +} + +void PolicyHandler::Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) { + POLICY_LIB_CHECK(); + policy_manager_->Set(app_id, type, value); +} + +void PolicyHandler::Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) { + POLICY_LIB_CHECK(); + policy_manager_->Add(app_id, type, timespan_seconds); +} + } // namespace policy diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc index e28455aa33..5a01e28d6d 100644 --- a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc +++ b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc @@ -35,6 +35,7 @@ #include "utils/logger.h" #include "application_manager/policies/policy_handler.h" #include "application_manager/policies/policy_retry_sequence.h" +#include "utils/threads/thread_manager.h" namespace policy { @@ -42,7 +43,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") PTExchangeHandlerImpl::PTExchangeHandlerImpl(PolicyHandler* handler) : policy_handler_(handler), - retry_sequence_("RetrySequence", new RetrySequence(handler)) { + retry_sequence_(threads::CreateThread("RetrySequence", new RetrySequence(handler))) { DCHECK(policy_handler_); LOG4CXX_INFO(logger_, "Exchan created"); } @@ -56,20 +57,20 @@ void PTExchangeHandlerImpl::Start() { sync_primitives::AutoLock locker(retry_sequence_lock_); LOG4CXX_INFO(logger_, "Exchan started"); - if (retry_sequence_.is_running()) { - retry_sequence_.stop(); - } + retry_sequence_->stop(); + threads::DeleteThread(retry_sequence_); + retry_sequence_ = threads::CreateThread("RetrySequence", new RetrySequence(policy_handler_)); if (policy_handler_) { policy_handler_->ResetRetrySequence(); } - retry_sequence_.start(); + retry_sequence_->start(); } void PTExchangeHandlerImpl::Stop() { sync_primitives::AutoLock locker(retry_sequence_lock_); - if (retry_sequence_.is_running()) { - retry_sequence_.stop(); + if (retry_sequence_->is_running()) { + retry_sequence_->stop(); } } diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index 48fee42920..5faabde458 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2014, Ford Motor Company * All rights reserved. * @@ -77,7 +77,7 @@ void RequestController::InitializeThreadpool() char name [50]; snprintf(name, sizeof(name)/sizeof(name[0]), "AM Pool %d", i); - pool_.push_back(ThreadSharedPtr(new Thread(name, new Worker(this)))); + pool_.push_back(threads::CreateThread(name, new Worker(this))); pool_[i]->start(); LOG4CXX_INFO(logger_, "Request thread initialized: " << name); } @@ -93,6 +93,7 @@ void RequestController::DestroyThreadpool() { } for (uint32_t i = 0; i < pool_size_; i++) { pool_[i]->stop(); + threads::DeleteThread(pool_[i]); } LOG4CXX_INFO(logger_, "Threads exited from the thread pool " << pool_size_); } @@ -128,8 +129,9 @@ RequestController::TResult RequestController::addMobileRequest( profile::Profile::instance()->pending_requests_amount(); if (!checkHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::HMI_NONE, - request_impl->connection_key(), app_hmi_level_none_time_scale, - app_hmi_level_none_max_request_per_time_scale)) { + request_impl->connection_key(), + app_hmi_level_none_time_scale, + app_hmi_level_none_max_request_per_time_scale)) { LOG4CXX_ERROR(logger_, "Too many application requests in hmi level NONE"); result = RequestController::NONE_HMI_LEVEL_MANY_REQUESTS; } else if (!checkTimeScaleMaxRequest( @@ -159,14 +161,17 @@ RequestController::TResult RequestController::addMobileRequest( } RequestController::TResult RequestController::addHMIRequest( - const RequestPtr& request) { + const RequestPtr request) { LOG4CXX_TRACE_ENTER(logger_); DCHECK(request.valid()); LOG4CXX_DEBUG(logger_, "addHMIRequest " << request->correlation_id()); - RequestInfoPtr request_info_ptr = new HMIRequestInfo(request, request->default_timeout()); + uint32_t timeout_in_seconds = request->default_timeout()/date_time::DateTime::MILLISECONDS_IN_SECOND; + RequestInfoPtr request_info_ptr = + new HMIRequestInfo(request, + timeout_in_seconds); - if (0 != request->default_timeout()) { + if (0 != timeout_in_seconds) { pending_request_set_lock_.Acquire(); pending_request_set_.insert(request_info_ptr); LOG4CXX_INFO(logger_, "pending_request_set_ size is " @@ -206,14 +211,15 @@ void RequestController::terminateMobileRequest( AutoLock auto_lock(pending_request_set_lock_); RequestInfoSet::iterator it = pending_request_set_.begin(); for (; pending_request_set_.end() != it; ++it) { - MobileRequestInfo* mobile_request_info = dynamic_cast<MobileRequestInfo*>(it->get()); + RequestInfo* mobile_request_info = it->get(); if (NULL == mobile_request_info) { continue; } - if (mobile_correlation_id == mobile_request_info->mobile_correlation_id_) { - mobile_request_info->request_->CleanUp(); + if (mobile_correlation_id == mobile_request_info->requestId()) { + mobile_request_info->request()->CleanUp(); pending_request_set_.erase(it); - LOG4CXX_INFO(logger_, "Mobile request terminated: " << mobile_correlation_id); + LOG4CXX_INFO(logger_, "Mobile request terminated: " << mobile_correlation_id << + " pending_request_set_ size : " << pending_request_set_.size()); UpdateTimer(); LOG4CXX_TRACE_EXIT(logger_); return; @@ -229,12 +235,12 @@ void RequestController::terminateHMIRequest(const uint32_t &correlation_id) { AutoLock auto_lock(pending_request_set_lock_); RequestInfoSet::iterator it = pending_request_set_.begin(); for (; pending_request_set_.end() != it; ++it) { - HMIRequestInfo* hmi_request_info = dynamic_cast<HMIRequestInfo*>(it->get()); + RequestInfo* hmi_request_info = it->get(); if (NULL == hmi_request_info) { continue; } if (correlation_id == hmi_request_info->requestId()) { - hmi_request_info->request_->CleanUp(); + hmi_request_info->request()->CleanUp(); pending_request_set_.erase(it); LOG4CXX_DEBUG(logger_, "HMI request terminated: " << correlation_id); UpdateTimer(); @@ -254,14 +260,14 @@ void RequestController::terminateAppRequests( AutoLock auto_lock(pending_request_set_lock_); RequestInfoSet::iterator it = pending_request_set_.begin(); while (pending_request_set_.end() != it) { - MobileRequestInfo* mobile_request_info = dynamic_cast<MobileRequestInfo*>(it->get()); + RequestInfo* mobile_request_info = it->get(); if (NULL == mobile_request_info) { ++it; continue; } - if (mobile_request_info->app_id_ == app_id) { - mobile_request_info->request_->CleanUp(); + if (mobile_request_info->app_id() == app_id) { + mobile_request_info->request()->CleanUp(); pending_request_set_.erase(it++); LOG4CXX_INFO(logger_, "terminated all app requests : " << app_id); } else { @@ -277,12 +283,12 @@ void RequestController::terminateAllHMIRequests() { AutoLock auto_lock(pending_request_set_lock_); RequestInfoSet::iterator it = pending_request_set_.begin(); while (pending_request_set_.end() != it) { - HMIRequestInfo* hmi_request_info = dynamic_cast<HMIRequestInfo*>(it->get()); + RequestInfo* hmi_request_info = it->get(); if (NULL == hmi_request_info) { ++it; continue; } - hmi_request_info->request_->CleanUp(); + hmi_request_info->request()->CleanUp(); pending_request_set_.erase(it++); LOG4CXX_INFO(logger_, "HMI request terminated: "); } @@ -298,7 +304,7 @@ void RequestController::updateRequestTimeout( AutoLock auto_lock(pending_request_set_lock_); RequestInfoSet::iterator it = pending_request_set_.begin(); - MobileRequestInfo* mobile_request_info = NULL; + RequestInfo* mobile_request_info = NULL; RequestInfoPtr request_info; for (; pending_request_set_.end() != it; ++it) { request_info = *it; @@ -306,12 +312,12 @@ void RequestController::updateRequestTimeout( LOG4CXX_ERROR(logger_, "Invalid request, can't update timeout"); continue; } - mobile_request_info = dynamic_cast<MobileRequestInfo*>(request_info.get()); + mobile_request_info = request_info.get(); if (NULL == mobile_request_info) { continue; } - if (app_id == mobile_request_info->app_id_ && - mobile_correlation_id == mobile_request_info->mobile_correlation_id_) { + if (app_id == mobile_request_info->app_id() && + mobile_correlation_id == mobile_request_info->requestId()) { break; } } @@ -320,7 +326,8 @@ void RequestController::updateRequestTimeout( DCHECK(mobile_request_info); DCHECK(request_info.valid()); - mobile_request_info->updateTimeOut(new_timeout); + uint32_t timeout_in_seconds = new_timeout/date_time::DateTime::MILLISECONDS_IN_SECOND; + mobile_request_info->updateTimeOut(timeout_in_seconds); pending_request_set_.erase(it); pending_request_set_.insert(request_info); // erase and insert need to update ordering of set @@ -330,7 +337,7 @@ void RequestController::updateRequestTimeout( << " mobile_correlation_id " << mobile_correlation_id << " new_timeout " << new_timeout); } else { - LOG4CXX_ERROR(logger_, "Cant find request with " + LOG4CXX_ERROR(logger_, "Can't find request with " << " app_id " << app_id << " mobile_correlation_id " << mobile_correlation_id ); } @@ -350,12 +357,7 @@ void RequestController::onTimer() { } if (request->isExpired()) { pending_request_set_.erase(probably_expired); - commands::CommandRequestImpl* mobile_expired_request = - dynamic_cast<commands::CommandRequestImpl*>(request->request()); - if (mobile_expired_request) { - - mobile_expired_request->onTimeOut(); - } + request->request()->onTimeOut(); request->request()->CleanUp(); LOG4CXX_INFO(logger_, "Timeout for request id " << request->requestId() << " expired"); probably_expired = pending_request_set_.begin(); @@ -399,14 +401,16 @@ void RequestController::Worker::threadMain() { request_controller_->mobile_request_list_.pop_front(); bool init_res = request->Init(); // to setup specific default timeout - RequestInfoPtr request_info_ptr(new MobileRequestInfo(request, request->default_timeout())); + + uint32_t timeout_in_seconds = request->default_timeout()/date_time::DateTime::MILLISECONDS_IN_SECOND; + RequestInfoPtr request_info_ptr(new MobileRequestInfo(request, + timeout_in_seconds)); request_controller_->pending_request_set_lock_.Acquire(); request_controller_->pending_request_set_.insert(request_info_ptr); - //pending_request_list_.Acquire(); - if (0 != request->default_timeout()) { + if (0 != timeout_in_seconds) { LOG4CXX_INFO(logger_, "Add Request " << request_info_ptr->requestId() << - "with timeout: " << request->default_timeout()); + " with timeout: " << timeout_in_seconds); request_controller_->UpdateTimer(); } else { LOG4CXX_INFO(logger_, "Default timeout was set to 0." @@ -427,6 +431,7 @@ bool RequestController::Worker::exitThreadMain() { stop_flag_ = true; sync_primitives::AutoLock auto_lock(thread_lock_); // setup stop flag and whit while threadMain will be finished correctly + // FIXME (dchmerev@luxoft.com): There is no wating return true; } diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 58b939f857..0b448c9e47 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -56,26 +56,22 @@ HMIRequestInfo::HMIRequestInfo( } MobileRequestInfo::MobileRequestInfo( - MobileRequestPtr request, + RequestPtr request, const uint64_t timeout_sec): RequestInfo(timeout_sec), request_(request) { - commands::CommandRequestImpl* request_from_mobile = - static_cast<commands::CommandRequestImpl*>(request_.get()); - mobile_correlation_id_ = request_from_mobile->correlation_id(); - app_id_ = request_from_mobile->connection_key(); + mobile_correlation_id_ = request_.get()->correlation_id(); + app_id_ = request_.get()->connection_key(); } MobileRequestInfo::MobileRequestInfo( - MobileRequestPtr request, + RequestPtr request, const TimevalStruct &start_time, const uint64_t timeout_sec): RequestInfo(start_time, timeout_sec), request_(request) { - commands::CommandRequestImpl* request_to_hmi = - static_cast<commands::CommandRequestImpl*>(request_.get()); - mobile_correlation_id_ = request_to_hmi->correlation_id(); - app_id_ = request_to_hmi->connection_key(); + mobile_correlation_id_ = request_.get()->correlation_id(); + app_id_ = request_.get()->connection_key(); } } // namespace request_controller diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp index dff90a6383..cdbd6dc1cf 100644 --- a/src/components/application_manager/src/resume_ctrl.cpp +++ b/src/components/application_manager/src/resume_ctrl.cpp @@ -171,9 +171,6 @@ bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application, LOG4CXX_ERROR(logger_, "SetupHMILevel() application pointer in invalid"); return false; } -#ifdef ENABLE_LOG - bool seted_up_hmi_level = hmi_level; -#endif const std::string device_id = MessageHelper::GetDeviceMacAddressForHandle(application->device()); @@ -195,53 +192,57 @@ bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application, return false; } - if (hmi_level == mobile_apis::HMILevel::HMI_FULL) { -#ifdef ENABLE_LOG - seted_up_hmi_level = app_mngr_->PutApplicationInFull(application); -#else - app_mngr_->PutApplicationInFull(application); -#endif - } else if (hmi_level == mobile_apis::HMILevel::HMI_LIMITED) { -#ifdef ENABLE_LOG - seted_up_hmi_level = app_mngr_->PutApplicationInLimited(application); -#else - app_mngr_->PutApplicationInLimited(application); -#endif - if (audio_streaming_state == mobile_apis::AudioStreamingState::AUDIBLE) { - //implemented SDLAQ-CRS-839 - //checking the existence of application with AudioStreamingState=AUDIBLE - //notification resumeAudioSource is sent if only resumed application has - //AudioStreamingState=AUDIBLE - bool application_exist_with_audible_state = false; - ApplicationManagerImpl::ApplicationListAccessor accessor; - const std::set<ApplicationSharedPtr> app_list = accessor.applications(); - std::set<ApplicationSharedPtr>::const_iterator app_list_it = app_list.begin(); - uint32_t app_id = application->app_id(); - for (; app_list.end() != app_list_it; ++app_list_it) { - if (((*app_list_it)->audio_streaming_state() == - mobile_apis::AudioStreamingState::AUDIBLE) && - ((*app_list_it))->app_id() != app_id) { - application_exist_with_audible_state = true; - break; + if (mobile_apis::HMILevel::HMI_FULL == hmi_level) { + hmi_level = app_mngr_->PutApplicationInFull(application); + + if ((mobile_apis::HMILevel::HMI_FULL == hmi_level || + mobile_apis::HMILevel::HMI_LIMITED == hmi_level) && + (mobile_apis::AudioStreamingState::AUDIBLE == audio_streaming_state)) { + application->set_audio_streaming_state(audio_streaming_state); + } + } else if (mobile_apis::HMILevel::HMI_LIMITED == hmi_level) { + if ((false == application->IsAudioApplication()) || + app_mngr_->DoesAudioAppWithSameHMITypeExistInFullOrLimited(application)) { + hmi_level = mobile_apis::HMILevel::HMI_BACKGROUND; + } else { + if (audio_streaming_state == mobile_apis::AudioStreamingState::AUDIBLE) { + //implemented SDLAQ-CRS-839 + //checking the existence of application with AudioStreamingState=AUDIBLE + //notification resumeAudioSource is sent if only resumed application has + //AudioStreamingState=AUDIBLE + bool application_exist_with_audible_state = false; + ApplicationManagerImpl::ApplicationListAccessor accessor; + const std::set<ApplicationSharedPtr> app_list = accessor.applications(); + std::set<ApplicationSharedPtr>::const_iterator app_list_it = app_list + .begin(); + uint32_t app_id = application->app_id(); + for (; app_list.end() != app_list_it; ++app_list_it) { + if ((mobile_apis::AudioStreamingState::AUDIBLE == + (*app_list_it)->audio_streaming_state()) + && ((*app_list_it))->app_id() != app_id) { + application_exist_with_audible_state = true; + break; + } } - } - if (application_exist_with_audible_state) { - application->set_audio_streaming_state( + if (application_exist_with_audible_state) { + application->set_audio_streaming_state( mobile_apis::AudioStreamingState::NOT_AUDIBLE); - } else { - MessageHelper::SendOnResumeAudioSourceToHMI(application->app_id()); + } else { + MessageHelper::SendOnResumeAudioSourceToHMI(application->app_id()); + } } } } - application->set_hmi_level(hmi_level); + if (hmi_level != mobile_apis::HMILevel::HMI_FULL) { - //APPLINK-7244 - MessageHelper::SendHMIStatusNotification(*(application.get())); + application->set_hmi_level(hmi_level); } + MessageHelper::SendHMIStatusNotification(*(application.get())); + LOG4CXX_INFO(logger_, "Set up application " << application->mobile_app_id()->asString() - << " to HMILevel " << seted_up_hmi_level); + << " to HMILevel " << hmi_level); return true; } diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index d3dee343d5..4d0e7a738f 100644 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -44,22 +44,13 @@ set (AM_SOURCES ${AM_SOURCE_DIR}/src/mobile_message_handler.cc ) -if (EXTENDED_POLICY_FLAG) include_directories( - ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct_ext - ) - list(APPEND AM_SOURCES - ${COMPONENTS_DIR}/src/policies/pt_exchange_handler_ext.cc - ) -else () - include_directories( - ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct + ${AM_SOURCE_DIR}/policy/src/policy/policy_table/table_struct ) list(APPEND AM_SOURCES ${COMPONENTS_DIR}/application_manager/src/policies/pt_exchange_handler_impl.cc ${COMPONENTS_DIR}/application_manager/src/policies/policy_retry_sequence.cc ) -endif () set(testLibraries gmock diff --git a/src/components/application_manager/test/mock/include/application_manager/application.h b/src/components/application_manager/test/mock/include/application_manager/application.h index 636b0aaa41..5f1f598851 100644 --- a/src/components/application_manager/test/mock/include/application_manager/application.h +++ b/src/components/application_manager/test/mock/include/application_manager/application.h @@ -393,7 +393,6 @@ class Application : public virtual InitialApplicationData, virtual bool MakeFullscreen() = 0; virtual bool IsAudible() const = 0; virtual void MakeNotAudible() = 0; - virtual bool allowed_support_navigation() const = 0; virtual void set_allowed_support_navigation(bool allow) = 0; virtual bool hmi_supports_navi_video_streaming() const = 0; @@ -401,6 +400,9 @@ class Application : public virtual InitialApplicationData, virtual bool hmi_supports_navi_audio_streaming() const = 0; virtual void set_hmi_supports_navi_audio_streaming(bool supports) = 0; + virtual bool is_voice_communication_supported() const = 0; + virtual void set_voice_communication_supported( + bool is_voice_communication_supported) = 0; virtual bool app_allowed() const = 0; virtual bool has_been_activated() const = 0; @@ -530,6 +532,13 @@ class Application : public virtual InitialApplicationData, */ virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0; + /** + * @brief Check's if it is media, voice communication or navigation application + * + * @return true if application is media, voice communication or navigation + */ + virtual bool IsAudioApplication() const = 0; + protected: // interfaces for NAVI retry sequence diff --git a/src/components/application_manager/test/mock/include/application_manager/application_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_impl.h index 0a056df92b..dadfce0929 100644 --- a/src/components/application_manager/test/mock/include/application_manager/application_impl.h +++ b/src/components/application_manager/test/mock/include/application_manager/application_impl.h @@ -82,6 +82,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, bool hmi_supports_navi_audio_streaming() const; void set_hmi_supports_navi_audio_streaming(bool supports); + virtual bool is_voice_communication_supported() const; + virtual void set_voice_communication_supported( + bool is_voice_communication_supported); inline bool app_allowed() const; bool has_been_activated() const; @@ -166,6 +169,13 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, virtual void UnsubscribeFromSoftButtons(int32_t cmd_id); + /** + * @brief Check's if it is media, voice communication or navigation application + * + * @return true if application is media, voice communication or navigation + */ + virtual bool IsAudioApplication() const; + protected: /** @@ -220,6 +230,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl, std::set<uint32_t> subscribed_vehicle_info_; UsageStatistics usage_report_; ProtocolVersion protocol_version_; + bool is_voice_communication_application_; // NAVI retry stream volatile bool is_video_stream_retry_active_; diff --git a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h index dbee738564..85048477a5 100644 --- a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h @@ -156,8 +156,8 @@ class ApplicationManagerImpl : public ApplicationManager, MOCK_METHOD0(Stop, bool()); MOCK_METHOD1(OnMessageReceived, void (utils::SharedPtr<application_manager::Message>)); MOCK_METHOD1(OnErrorSending, void (utils::SharedPtr<application_manager::Message>)); - MOCK_METHOD1(OnMessageReceived, void (const RawMessagePtr)); - MOCK_METHOD1(OnMobileMessageSent, void (const RawMessagePtr)); + MOCK_METHOD1(OnMessageReceived, void (const ::protocol_handler::RawMessagePtr)); + MOCK_METHOD1(OnMobileMessageSent, void (const ::protocol_handler::RawMessagePtr)); MOCK_METHOD1(OnDeviceListUpdated, void (const connection_handler::DeviceMap&)); MOCK_METHOD0(OnFindNewApplicationsRequest, void ()); MOCK_METHOD1(RemoveDevice, void (const connection_handler::DeviceHandle&)); @@ -196,7 +196,6 @@ class ApplicationManagerImpl : public ApplicationManager, MOCK_METHOD0(HeadUnitSuspend, void()); MOCK_METHOD1(LoadAppDataToHMI, bool(ApplicationSharedPtr)); MOCK_METHOD1(ActivateApplication, bool (ApplicationSharedPtr)); - MOCK_METHOD1(PutApplicationInLimited, mobile_api::HMILevel::eType (ApplicationSharedPtr)); MOCK_METHOD1(PutApplicationInFull, mobile_api::HMILevel::eType (ApplicationSharedPtr)); MOCK_METHOD2(UnregisterRevokedApplication, void(uint32_t, mobile_apis::Result::eType)); MOCK_METHOD1(SetUnregisterAllApplicationsReason, void(mobile_api::AppInterfaceUnregisteredReason::eType)); @@ -251,6 +250,8 @@ class ApplicationManagerImpl : public ApplicationManager, MOCK_METHOD0(GetNextHMICorrelationID, uint32_t ()); MOCK_CONST_METHOD0(IsHMICooperating, bool()); MOCK_METHOD0(OnTimerSendTTSGlobalProperties, void()); + MOCK_METHOD0(CreatePhoneCallAppList, void()); + MOCK_METHOD0(ResetPhoneCallAppList, void()); MOCK_METHOD1(AddAppToTTSGlobalPropertiesList, void(const uint32_t)); MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList, void(const uint32_t)); MOCK_METHOD1(application_by_hmi_app, ApplicationSharedPtr(uint32_t)); @@ -259,6 +260,10 @@ class ApplicationManagerImpl : public ApplicationManager, bool)); MOCK_METHOD4(UnregisterApplication, void(const uint32_t,mobile_apis::Result::eType, bool, bool)); + MOCK_CONST_METHOD0(get_limited_media_application, ApplicationSharedPtr()); + MOCK_CONST_METHOD0(get_limited_navi_application, ApplicationSharedPtr()); + MOCK_CONST_METHOD0(get_limited_voice_application, ApplicationSharedPtr()); + MOCK_CONST_METHOD1(DoesAudioAppWithSameHMITypeExistInFullOrLimited, bool(ApplicationSharedPtr)); MOCK_CONST_METHOD0(active_application, ApplicationSharedPtr ()); MOCK_METHOD0(OnApplicationListUpdateTimer, void()); diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command.h b/src/components/application_manager/test/mock/include/application_manager/commands/command.h index 28c77b6229..587c3d834c 100644 --- a/src/components/application_manager/test/mock/include/application_manager/commands/command.h +++ b/src/components/application_manager/test/mock/include/application_manager/commands/command.h @@ -90,6 +90,24 @@ class Command { * @brief Retrieves correlation ID */ virtual uint32_t correlation_id() const = 0; + + /* + * @brief Retrieves connection_key + */ + virtual uint32_t connection_key() const = 0; + + /* + * @brief Retrieves request ID + */ + virtual int32_t function_id() const = 0; + + /* + * @brief Function is called by RequestController when request execution time + * has exceed it's limit + * + */ + virtual void onTimeOut() = 0; + }; } // namespace commands diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h index 06637d7d84..a34716bd62 100644 --- a/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h @@ -101,6 +101,23 @@ class CommandImpl : public Command { */ virtual uint32_t correlation_id() const; + /* + * @brief Retrieves connection key + */ + virtual uint32_t connection_key() const; + + /* + * @brief Retrieves request ID + */ + virtual int32_t function_id() const; + + /* + * @brief Function is called by RequestController when request execution time + * has exceed it's limit + * + */ + virtual void onTimeOut(); + // members static const int32_t hmi_protocol_type_; static const int32_t mobile_protocol_type_; diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h index fb14078961..1bbba5aa0b 100644 --- a/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h @@ -81,16 +81,6 @@ class CommandRequestImpl : public CommandImpl, virtual void on_event(const event_engine::Event& event); /* - * @brief Retrieves request ID - */ - inline int32_t function_id() const; - - /* - * @brief Retrieves connection key - */ - inline uint32_t connection_key() const; - - /* * @brief Creates Mobile response * * @param success true if successful; false, if failed @@ -194,14 +184,6 @@ protected: void AddDisallowedParametersToInfo(smart_objects::SmartObject& response) const; }; -int32_t CommandRequestImpl::function_id() const { - return (*message_)[strings::params][strings::function_id].asInt(); -} - -uint32_t CommandRequestImpl::connection_key() const { - return (*message_)[strings::params][strings::connection_key].asUInt(); -} - } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h new file mode 100644 index 0000000000..45d831eb03 --- /dev/null +++ b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ + +#include "application_manager/commands/hmi/notification_from_hmi.h" + +namespace application_manager { + +namespace commands { + +namespace hmi { + + +/** + * @brief OnPhoneCallNotification command class + **/ +class OnPhoneCallNotification : public NotificationFromHMI { + public: + /** + * @brief OnPhoneCallNotification class constructor + * + * @param message Incoming SmartObject message + **/ + explicit OnPhoneCallNotification(const MessageSharedPtr& message); + + /** + * @brief OnPhoneCallNotification class destructor + **/ + virtual ~OnPhoneCallNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnPhoneCallNotification); +}; + +} // namespace hmi + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_ diff --git a/src/components/application_manager/test/mock/include/application_manager/message_helper.h b/src/components/application_manager/test/mock/include/application_manager/message_helper.h index e7a7631d69..69c7b7bba7 100644 --- a/src/components/application_manager/test/mock/include/application_manager/message_helper.h +++ b/src/components/application_manager/test/mock/include/application_manager/message_helper.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2013, Ford Motor Company All rights reserved. @@ -92,7 +92,9 @@ class MessageHelper { * **/ static void SendOnAppRegisteredNotificationToHMI( - const Application& application_impl, bool resumption = false); + const Application& application_impl, + bool resumption = false, + bool need_restore_vr = false); /** * @brief Create mobile HashUpdateNotification diff --git a/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h b/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h index c84ba54212..67d51c0dab 100644 --- a/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h +++ b/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -42,10 +42,10 @@ typedef utils::SharedPtr<application_manager::Message> MobileMessage; class MobileMessageHandler { public: static application_manager::Message* HandleIncomingMessageProtocolV1( - const RawMessagePtr message); + const protocol_handler::RawMessagePtr message); static application_manager::Message* HandleIncomingMessageProtocolV2( - const RawMessagePtr message); + const protocol_handler::RawMessagePtr message); //! ------------------------------------------------------------- diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h b/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h index 5bc23c106a..dfc29fe00a 100644 --- a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h @@ -303,6 +303,18 @@ class PolicyHandler : */ uint16_t HeartBeatTimeout(const std::string& app_id) const; +//TODO(AKutsan) REMOVE THIS UGLY HOTFIX + virtual void Increment(usage_statistics::GlobalCounterId type); + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type); + virtual void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value); + virtual void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds); + + protected: /** @@ -338,6 +350,33 @@ protected: const std::string ConvertUpdateStatus(policy::PolicyTableStatus status); private: + + class StatisticManagerImpl: public usage_statistics::StatisticsManager { + //TODO(AKutsan) REMOVE THIS UGLY HOTFIX + virtual void Increment(usage_statistics::GlobalCounterId type) { + return PolicyHandler::instance()->Increment(type); + } + + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) { + return PolicyHandler::instance()->Increment(app_id, type); + } + + virtual void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) { + return PolicyHandler::instance()->Set(app_id, type, value); + } + + virtual void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) { + return PolicyHandler::instance()->Add(app_id, type, timespan_seconds); + } + }; + //TODO(AKutsan) REMOVE THIS UGLY HOTFIX + + PolicyHandler(); static PolicyHandler* instance_; static const std::string kLibrary; @@ -365,6 +404,10 @@ private: */ std::map<std::string, std::string> app_to_device_link_; + + utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_; + + DISALLOW_COPY_AND_ASSIGN(PolicyHandler); FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER(PolicyHandler, utils::deleters::Deleter<PolicyHandler>); diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h index e1e67b1505..29c74aa96e 100644 --- a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h +++ b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h @@ -50,7 +50,7 @@ class PTExchangeHandlerImpl : public PTExchangeHandler { protected: PolicyHandler* policy_handler_; - threads::Thread retry_sequence_; + threads::Thread* retry_sequence_; sync_primitives::Lock retry_sequence_lock_; friend class RetrySequence; diff --git a/src/components/application_manager/test/mock/include/application_manager/request_controller.h b/src/components/application_manager/test/mock/include/application_manager/request_controller.h index b70608fbc2..2bc5f54666 100644 --- a/src/components/application_manager/test/mock/include/application_manager/request_controller.h +++ b/src/components/application_manager/test/mock/include/application_manager/request_controller.h @@ -131,7 +131,7 @@ class RequestController { * @return Result code * */ - TResult addHMIRequest(const RequestPtr& request); + TResult addHMIRequest(const RequestPtr request); /** * @ Add notification to collection @@ -182,7 +182,7 @@ class RequestController { * * @param app_id Connection key of application * @param mobile_correlation_id Correlation ID of the mobile request - * @param new_timeout_value New timeout to be set + * @param new_timeout_value New timeout to be set in milliseconds */ void updateRequestTimeout(const uint32_t& app_id, const uint32_t& mobile_correlation_id, @@ -196,7 +196,9 @@ class RequestController { * @param app_time_scale - time scale (seconds) * @param max_request_per_time_scale - maximum count of request that should be allowed for app_time_scale secconds */ - bool checkTimeScaleMaxRequest(const uint32_t& app_id, const uint32_t& app_time_scale, const uint32_t& max_request_per_time_scale); + bool checkTimeScaleMaxRequest(const uint32_t& app_id, + const uint32_t& app_time_scale, + const uint32_t& max_request_per_time_scale); /** * @brief Checs if this app as able to add new requests in current hmi_level, or limits was exceeded @@ -205,7 +207,10 @@ class RequestController { * @param app_time_scale - time scale (seconds) * @param max_request_per_time_scale - maximum count of request that should be allowed for app_time_scale secconds */ - bool checkHMILevelTimeScaleMaxRequest(const mobile_apis::HMILevel::eType& hmi_level, const uint32_t& app_id, const uint32_t& app_time_scale, const uint32_t& max_request_per_time_scale); + bool checkHMILevelTimeScaleMaxRequest(const mobile_apis::HMILevel::eType& hmi_level, + const uint32_t& app_id, + const uint32_t& app_time_scale, + const uint32_t& max_request_per_time_scale); void onTimer(); @@ -232,12 +237,7 @@ class RequestController { volatile bool stop_flag_; }; - /** - * @brief Typedef for thread shared pointer - */ - typedef utils::SharedPtr<Thread> ThreadSharedPtr; - - std::vector<ThreadSharedPtr> pool_; + std::vector<Thread*> pool_; volatile TPoolState pool_state_; uint32_t pool_size_; sync_primitives::ConditionalVariable cond_var_; diff --git a/src/components/application_manager/test/mock/include/application_manager/request_info.h b/src/components/application_manager/test/mock/include/application_manager/request_info.h index 778e72c916..b1409488fd 100644 --- a/src/components/application_manager/test/mock/include/application_manager/request_info.h +++ b/src/components/application_manager/test/mock/include/application_manager/request_info.h @@ -1,4 +1,4 @@ -/** +/** * \file request_info.h * \brief request information structure header file. * @@ -55,26 +55,30 @@ namespace request_controller { typedef utils::SharedPtr<commands::CommandRequestImpl> MobileRequestPtr; struct RequestInfo { - RequestInfo(const uint64_t timeout_sec): - timeout_sec_(timeout_sec) { + RequestInfo(const uint64_t timeout_sec) + : timeout_sec_(timeout_sec) { start_time_ = date_time::DateTime::getCurrentTime(); updateEndTime(); } - RequestInfo(const TimevalStruct& start_time,const uint64_t timeout_sec): - start_time_(start_time), + RequestInfo(const TimevalStruct& start_time,const uint64_t timeout_sec) + : start_time_(start_time), timeout_sec_(timeout_sec) { updateEndTime(); - } + } - virtual ~RequestInfo(){} + virtual ~RequestInfo(){} - virtual uint32_t requestId() = 0; - virtual commands::Command* request() = 0; + virtual uint32_t requestId() = 0; + virtual commands::Command* request() = 0; void updateEndTime() { end_time_ = date_time::DateTime::getCurrentTime(); end_time_.tv_sec += timeout_sec_; + + // possible delay during IPC + const uint32_t hmi_delay_sec = 1; + end_time_.tv_sec += hmi_delay_sec; } void updateTimeOut(const uint64_t& timeout_sec) { @@ -89,9 +93,11 @@ namespace request_controller { } return true; } + TimevalStruct start_time() { return start_time_; } + uint64_t timeout_sec() { return timeout_sec_; } @@ -100,42 +106,62 @@ namespace request_controller { return end_time_; } + uint32_t app_id() { + return app_id_; + } + + mobile_apis::HMILevel::eType hmi_level() { + return hmi_level_; + } + protected: - TimevalStruct start_time_; - uint64_t timeout_sec_; - TimevalStruct end_time_; + TimevalStruct start_time_; + uint64_t timeout_sec_; + TimevalStruct end_time_; + uint32_t app_id_; + mobile_apis::HMILevel::eType hmi_level_; }; typedef utils::SharedPtr<RequestInfo> RequestInfoPtr; struct RequestInfoComparator { - bool operator() (const RequestInfoPtr lhs, const RequestInfoPtr rhs) const { - date_time::TimeCompare compare_result = date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time()); - return compare_result == date_time::LESS; + bool operator() (const RequestInfoPtr lhs, + const RequestInfoPtr rhs) const { + date_time::TimeCompare compare_result = + date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time()); + + return compare_result == date_time::LESS; } }; typedef std::set<RequestInfoPtr,RequestInfoComparator> RequestInfoSet; struct HMIRequestInfo: public RequestInfo { - HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec); - HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time,const uint64_t timeout_sec); + HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec); + HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time, + const uint64_t timeout_sec); + RequestPtr request_; uint32_t correlation_id_; + virtual uint32_t requestId() { return correlation_id_; } + virtual commands::Command* request() { return request_.get(); } }; struct MobileRequestInfo: public RequestInfo { - MobileRequestInfo(MobileRequestPtr request, const uint64_t timeout_sec); - MobileRequestInfo(MobileRequestPtr request, const TimevalStruct& start_time, const uint64_t timeout_sec); - MobileRequestPtr request_; - uint32_t app_id_; - mobile_apis::HMILevel::eType hmi_level_; + MobileRequestInfo(RequestPtr request, + const uint64_t timeout_sec); + + MobileRequestInfo(RequestPtr request, + const TimevalStruct& start_time, + const uint64_t timeout_sec); + + RequestPtr request_; uint32_t mobile_correlation_id_; virtual uint32_t requestId() { @@ -152,27 +178,26 @@ namespace request_controller { * during time scale */ struct TimeScale { - explicit TimeScale(const TimevalStruct& start, const TimevalStruct& end, - const int32_t& app_id) + TimeScale(const TimevalStruct& start, + const TimevalStruct& end, + const uint32_t& app_id) : start_(start), end_(end), app_id_(app_id) {} bool operator()(RequestInfoPtr setEntry) { - MobileRequestInfo* mobile_request_info = NULL; - RequestInfo* request = setEntry.get(); - mobile_request_info = dynamic_cast<MobileRequestInfo*>(request); - if (NULL == mobile_request_info) { + + if (!setEntry.valid()) { return false; } - if (mobile_request_info->app_id_ != app_id_) { + if (setEntry->app_id() != app_id_) { return false; } - if (date_time::DateTime::getmSecs(mobile_request_info->start_time()) + if (date_time::DateTime::getmSecs(setEntry->start_time()) < date_time::DateTime::getmSecs(start_) || - date_time::DateTime::getmSecs(mobile_request_info->start_time()) + date_time::DateTime::getmSecs(setEntry->start_time()) > date_time::DateTime::getmSecs(end_)) { return false; } @@ -181,9 +206,9 @@ namespace request_controller { } private: - TimevalStruct start_; - TimevalStruct end_; - uint32_t app_id_; + TimevalStruct start_; + TimevalStruct end_; + uint32_t app_id_; }; /** @@ -191,30 +216,31 @@ namespace request_controller { * during time scale for application in defined hmi level */ struct HMILevelTimeScale { - explicit HMILevelTimeScale( - const TimevalStruct& start, const TimevalStruct& end, - const uint32_t& app_id, const mobile_apis::HMILevel::eType& hmi_level) + HMILevelTimeScale(const TimevalStruct& start, + const TimevalStruct& end, + const uint32_t& app_id, + const mobile_apis::HMILevel::eType& hmi_level) : start_(start), end_(end), app_id_(app_id), hmi_level_(hmi_level) {} bool operator()(RequestInfoPtr setEntry) { - MobileRequestInfo* mobile_request_info = NULL; - mobile_request_info = dynamic_cast<MobileRequestInfo*>(setEntry.get()); - if (NULL == mobile_request_info) { + if (!setEntry.valid()) { return false; } - if (mobile_request_info->app_id_ != app_id_) { + + if (setEntry->app_id() != app_id_) { return false; } - if (mobile_request_info->hmi_level_ != hmi_level_) { + + if (setEntry->hmi_level() != hmi_level_) { return false; } - if (date_time::DateTime::getSecs(mobile_request_info->start_time()) + if (date_time::DateTime::getSecs(setEntry->start_time()) < date_time::DateTime::getSecs(start_) || - date_time::DateTime::getSecs(mobile_request_info->start_time()) + date_time::DateTime::getSecs(setEntry->start_time()) > date_time::DateTime::getSecs(end_)) { return false; } @@ -222,9 +248,9 @@ namespace request_controller { return true; } private: - TimevalStruct start_; - TimevalStruct end_; - uint32_t app_id_; + TimevalStruct start_; + TimevalStruct end_; + uint32_t app_id_; mobile_apis::HMILevel::eType hmi_level_; }; diff --git a/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h b/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h index 1df8b21ad9..3d03989874 100644 --- a/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h @@ -361,6 +361,7 @@ const char result[] = "result"; const char statistic_type[] = "statisticType"; const char error[] = "error"; const char policyfile[] = "policyfile"; +const char is_active[] = "isActive"; } // namespace hmi_notification diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index bd8b478ba5..0b248e5e59 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -45,6 +45,8 @@ #include "security_manager/security_manager.h" #endif // ENABLE_SECURITY +#include "utils/threads/thread_manager.h" + /** * \namespace connection_handler * \brief SmartDeviceLink ConnectionHandler namespace. @@ -82,7 +84,7 @@ Connection::Connection(ConnectionHandle connection_handle, DCHECK(connection_handler_); heartbeat_monitor_ = new HeartBeatMonitor(heartbeat_timeout, this); - heart_beat_monitor_thread_ = new threads::Thread("HeartBeatMonitor", + heart_beat_monitor_thread_ = threads::CreateThread("HeartBeatMonitor", heartbeat_monitor_); heart_beat_monitor_thread_->start(); } @@ -90,7 +92,7 @@ Connection::Connection(ConnectionHandle connection_handle, Connection::~Connection() { LOG4CXX_TRACE_ENTER(logger_); heart_beat_monitor_thread_->stop(); - delete heart_beat_monitor_thread_; + threads::DeleteThread(heart_beat_monitor_thread_); sync_primitives::AutoLock lock(session_map_lock_); session_map_.clear(); LOG4CXX_TRACE_EXIT(logger_); diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h index 13314ba0da..df344c80fd 100644 --- a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h +++ b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h @@ -47,7 +47,7 @@ class MessageBrokerAdapter : public HMIMessageAdapter, public: MessageBrokerAdapter(HMIMessageHandler* handler_param, const std::string& server_address, uint16_t port); - ~MessageBrokerAdapter(); + ~MessageBrokerAdapter(); void SendMessageToHMI(MessageSharedPointer message); /*Methods from CMessageBrokerController*/ diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h index b0fb016622..9d78fefc69 100644 --- a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h +++ b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h @@ -55,7 +55,7 @@ class MqueueAdapter : public HMIMessageAdapter { private: mqd_t sdl_to_hmi_mqueue_; mqd_t hmi_to_sdl_mqueue_; - std::auto_ptr<threads::Thread> receiver_thread_; + threads::Thread* receiver_thread_; }; } // namespace hmi_message_handler diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc index 1842789b22..a79674df67 100644 --- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc +++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc @@ -118,6 +118,7 @@ void DBusMessageAdapter::SubscribeTo() { DBusMessageController::SubscribeTo("BasicCommunication", "OnIgnitionCycleOver"); DBusMessageController::SubscribeTo("BasicCommunication", "OnSystemRequest"); DBusMessageController::SubscribeTo("BasicCommunication", "OnSystemInfoChanged"); + DBusMessageController::SubscribeTo("BasicCommunication", "OnPhoneCall"); DBusMessageController::SubscribeTo("TTS", "Started"); DBusMessageController::SubscribeTo("TTS", "Stopped"); DBusMessageController::SubscribeTo("TTS", "OnLanguageChange"); diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index 52975b257b..8779d2ea6d 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -111,6 +111,7 @@ void MessageBrokerAdapter::SubscribeTo() { MessageBrokerController::subscribeTo("BasicCommunication.OnExitApplication"); MessageBrokerController::subscribeTo("BasicCommunication.OnExitAllApplications"); MessageBrokerController::subscribeTo("BasicCommunication.OnDeviceChosen"); + MessageBrokerController::subscribeTo("BasicCommunication.OnPhoneCall"); MessageBrokerController::subscribeTo("UI.OnLanguageChange"); MessageBrokerController::subscribeTo("VR.OnLanguageChange"); MessageBrokerController::subscribeTo("TTS.OnLanguageChange"); diff --git a/src/components/hmi_message_handler/src/mqueue_adapter.cc b/src/components/hmi_message_handler/src/mqueue_adapter.cc index 0164c3c85c..b1524b5f03 100644 --- a/src/components/hmi_message_handler/src/mqueue_adapter.cc +++ b/src/components/hmi_message_handler/src/mqueue_adapter.cc @@ -98,13 +98,16 @@ MqueueAdapter::MqueueAdapter(HMIMessageHandler* hmi_message_handler) } ReceiverThreadDelegate* receiver_thread_delegate = new ReceiverThreadDelegate(hmi_to_sdl_mqueue_, hmi_message_handler); - receiver_thread_.reset( - new threads::Thread("MqueueAdapter", receiver_thread_delegate)); + receiver_thread_ = + threads::CreateThread("MqueueAdapter", receiver_thread_delegate); receiver_thread_->start(); } MqueueAdapter::~MqueueAdapter() { - if (receiver_thread_.get()) receiver_thread_->stop(); + if (receiver_thread_) { + receiver_thread_->stop(); + threads::DeleteThread(receiver_thread_); + } if (-1 != hmi_to_sdl_mqueue_) mq_close(hmi_to_sdl_mqueue_); if (-1 != sdl_to_hmi_mqueue_) mq_close(sdl_to_hmi_mqueue_); mq_unlink(kHmiToSdlQueue); diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h index 7cbfad769c..f9fdd08fae 100644 --- a/src/components/include/protocol/common.h +++ b/src/components/include/protocol/common.h @@ -222,6 +222,5 @@ enum RESULT_CODE { RESULT_UNKNOWN = 255 }; } // namespace protocol_handler -typedef ::protocol_handler::RawMessage RawMessage; -typedef ::protocol_handler::RawMessagePtr RawMessagePtr; + #endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_COMMON_H_ diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h index eb4bb88f53..2edf173110 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -224,7 +224,7 @@ class TransportAdapter { **/ virtual Error SendData(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - const RawMessagePtr data) = 0; + const protocol_handler::RawMessagePtr data) = 0; /** * @brief Create container(vector) of device unique identifiers. diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h index d343ccc357..525a69fbb7 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h @@ -55,7 +55,7 @@ class TransportAdapterEvent { transport_adapter::TransportAdapter* adapter, const DeviceUID& device_handle, const ApplicationHandle& application_id, - RawMessagePtr data, BaseErrorPtr error) + ::protocol_handler::RawMessagePtr data, BaseErrorPtr error) : event_type(type), application_id(application_id), device_uid(device_handle), @@ -82,7 +82,7 @@ class TransportAdapterEvent { /** * @brief Smart pointer to the raw message */ - RawMessagePtr event_data; + ::protocol_handler::RawMessagePtr event_data; /** * @brief Pointer to the class that contain details of error. */ diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h index 149dede001..40790ac0ab 100644 --- a/src/components/include/transport_manager/transport_manager.h +++ b/src/components/include/transport_manager/transport_manager.h @@ -107,7 +107,7 @@ class TransportManager { * * @return Code error. **/ - virtual int SendMessageToDevice(const RawMessagePtr message) = 0; + virtual int SendMessageToDevice(const protocol_handler::RawMessagePtr message) = 0; /** * @brief Post event in the event queue. diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h index c36c0cb2f1..5033a95d17 100644 --- a/src/components/include/transport_manager/transport_manager_listener.h +++ b/src/components/include/transport_manager/transport_manager_listener.h @@ -145,7 +145,7 @@ class TransportManagerListener { * * @param message Recieved message **/ - virtual void OnTMMessageReceived(const RawMessagePtr message) = 0; + virtual void OnTMMessageReceived(const ::protocol_handler::RawMessagePtr message) = 0; /** * @brief Reaction to the event, when receiving of massage for transport manager is failed. @@ -159,7 +159,7 @@ class TransportManagerListener { /** * @brief Reaction to the event, when transport manager sent a massage. */ - virtual void OnTMMessageSend(const RawMessagePtr message) = 0; + virtual void OnTMMessageSend(const ::protocol_handler::RawMessagePtr message) = 0; /** * @brief Reaction to the event, when sending of massage by transport manager is failed. @@ -168,7 +168,7 @@ class TransportManagerListener { * @param message Smart pointer to the raw massage. */ virtual void OnTMMessageSendFailed(const DataSendError& error, - const RawMessagePtr message) = 0; + const ::protocol_handler::RawMessagePtr message) = 0; }; } // namespace transport_manager #endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_ diff --git a/src/components/include/transport_manager/transport_manager_listener_empty.h b/src/components/include/transport_manager/transport_manager_listener_empty.h index 2b3149bb54..f481f57ff5 100644 --- a/src/components/include/transport_manager/transport_manager_listener_empty.h +++ b/src/components/include/transport_manager/transport_manager_listener_empty.h @@ -155,7 +155,7 @@ class TransportManagerListenerEmpty : public TransportManagerListener { * @param message Smart pointer to the raw massage. * @param connection_id Connection unique identifier. */ - virtual void OnTMMessageReceived(const RawMessagePtr message) { + virtual void OnTMMessageReceived(const ::protocol_handler::RawMessagePtr message) { } /** @@ -171,7 +171,7 @@ class TransportManagerListenerEmpty : public TransportManagerListener { /** * @brief Reaction to the event, when transport manager sent a massage. */ - virtual void OnTMMessageSend(const RawMessagePtr message) { + virtual void OnTMMessageSend(const ::protocol_handler::RawMessagePtr message) { } /** @@ -181,7 +181,7 @@ class TransportManagerListenerEmpty : public TransportManagerListener { * @param message Smart pointer to the raw massage. */ virtual void OnTMMessageSendFailed(const DataSendError& error, - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { } }; } // namespace transport_manager diff --git a/src/components/include/utils/atomic.h b/src/components/include/utils/atomic.h index 6f6e98e0ec..bfbcff9dc9 100644 --- a/src/components/include/utils/atomic.h +++ b/src/components/include/utils/atomic.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -55,7 +55,7 @@ #define atomic_post_dec(ptr) (*(ptr))-- #endif -#if defined(_QNXNTO__) +#if defined(__QNXNTO__) // on QNX pointer assignment is believed to be atomic #define atomic_pointer_assign(dst, src) (dst) = (src) #elif defined(__GNUG__) @@ -66,4 +66,20 @@ #define atomic_pointer_assign(dst, src) (dst) = (src) #endif +#if defined(__QNXNTO__) +#define atomic_post_set(dst) atomic_set_value(dst, 1) +#elif defined(__GNUG__) +#define atomic_post_set(dst) __sync_val_compare_and_swap((dst), 0, 1) +#else +#error "atomic post set operation not defined" +#endif + +#if defined(__QNXNTO__) +#define atomic_post_clr(dst) atomic_clr_value(dst, 1) +#elif defined(__GNUG__) +#define atomic_post_clr(dst) __sync_val_compare_and_swap((dst), 1, 0) +#else +#error "atomic post clear operation not defined" +#endif + #endif // SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_H_ diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h index bc3b3e71c9..bf34b199b5 100644 --- a/src/components/include/utils/macro.h +++ b/src/components/include/utils/macro.h @@ -57,8 +57,7 @@ #define DCHECK(condition) \ if (!(condition)) { \ printf("\nDCHECK [%s:%d][%s]", __FILE__, __LINE__, __FUNCTION__); \ - printf("[Check failed: " #condition); \ - printf("]\n\n"); \ + printf("[Check failed: " #condition "]\n\n"); \ assert(false); \ } diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h index 2fea554886..9d998cc698 100644 --- a/src/components/include/utils/message_queue.h +++ b/src/components/include/utils/message_queue.h @@ -150,7 +150,6 @@ template<typename T, class Q> bool MessageQueue<T, Q>::empty() const { } template<typename T, class Q> bool MessageQueue<T, Q>::IsShuttingDown() const { - sync_primitives::AutoLock auto_lock(queue_lock_); return shutting_down_; } @@ -169,14 +168,10 @@ template<typename T, class Q> void MessageQueue<T, Q>::push(const T& element) { template<typename T, class Q> T MessageQueue<T, Q>::pop() { sync_primitives::AutoLock auto_lock(queue_lock_); - if (shutting_down_) { - CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOG4CXX_ERROR(logger_, "Runtime error, pop from queue" - " that is being shut down"); - } if (queue_.empty()) { CREATE_LOGGERPTR_LOCAL(logger_, "Utils") - LOG4CXX_ERROR(logger_, "Runtime error, popping out of empty que"); + LOG4CXX_ERROR(logger_, "Runtime error, popping out of empty queue"); + NOTREACHED(); } T result = queue_.front(); queue_.pop(); @@ -184,10 +179,8 @@ template<typename T, class Q> T MessageQueue<T, Q>::pop() { } template<typename T, class Q> void MessageQueue<T, Q>::Shutdown() { - { - sync_primitives::AutoLock auto_lock(queue_lock_); - shutting_down_ = true; - } + sync_primitives::AutoLock auto_lock(queue_lock_); + shutting_down_ = true; queue_new_items_.Broadcast(); } diff --git a/src/components/include/utils/shared_ptr.h b/src/components/include/utils/shared_ptr.h index dbca508bd7..604bee998b 100644 --- a/src/components/include/utils/shared_ptr.h +++ b/src/components/include/utils/shared_ptr.h @@ -314,7 +314,7 @@ utils::SharedPtr<ObjectType>::operator*() const { template<typename ObjectType> utils::SharedPtr<ObjectType>::operator bool() const { - return 0 != mObject; + return valid(); } template<typename ObjectType> void @@ -361,7 +361,10 @@ ObjectType* SharedPtr<ObjectType>::get() const { template<typename ObjectType> inline bool SharedPtr<ObjectType>::valid() const { - return (mObject != NULL); + if (mReferenceCounter && (0 < *mReferenceCounter)) { + return (mObject != NULL); + } + return false; } } // namespace utils diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h index bfe1c619f1..e051c48904 100644 --- a/src/components/include/utils/threads/message_loop_thread.h +++ b/src/components/include/utils/threads/message_loop_thread.h @@ -39,7 +39,7 @@ #include "utils/logger.h" #include "utils/macro.h" #include "utils/message_queue.h" -#include "utils/threads/thread.h" +#include "utils/threads/thread_manager.h" #include "utils/lock.h" namespace threads { @@ -64,7 +64,7 @@ class MessageLoopThread { * Method called by MessageLoopThread to process single message * from it's queue. After calling this method message is discarded. */ - virtual void Handle(const Message message) = 0; + virtual void Handle(const Message message) = 0; // TODO(dchmerev): Use reference? virtual ~Handler() {} }; @@ -103,17 +103,17 @@ class MessageLoopThread { }; private: MessageQueue<Message, Queue> message_queue_; - threads::Thread thread_; + threads::Thread* thread_; }; ///////// Implementation template<class Q> -MessageLoopThread<Q>::MessageLoopThread(const std::string& name, - Handler* handler, - const ThreadOptions& thread_opts) - : thread_(name.c_str(), new LoopThreadDelegate(&message_queue_, handler)) { - bool started = thread_.startWithOptions(thread_opts); +MessageLoopThread<Q>::MessageLoopThread(const std::string& name, + Handler* handler, + const ThreadOptions& thread_opts) + : thread_(threads::CreateThread(name.c_str(), new LoopThreadDelegate(&message_queue_, handler))) { + bool started = thread_->startWithOptions(thread_opts); if (!started) { CREATE_LOGGERPTR_LOCAL(logger_, "Utils") LOG4CXX_ERROR(logger_, "Failed to start thread " << name); @@ -122,8 +122,7 @@ MessageLoopThread<Q>::MessageLoopThread(const std::string& name, template<class Q> MessageLoopThread<Q>::~MessageLoopThread() { - // this will join us with the thread while it drains message queue - thread_.stop(); + thread_->stop(); } template <class Q> diff --git a/src/components/include/utils/threads/thread.h b/src/components/include/utils/threads/thread.h index 9ee2480e13..3b81cf3454 100644 --- a/src/components/include/utils/threads/thread.h +++ b/src/components/include/utils/threads/thread.h @@ -75,7 +75,13 @@ typedef pthread_t PlatformThreadHandle; * thread.join(); * printf("ok!\n"); */ +class Thread; +Thread* CreateThread(const char* name, ThreadDelegate* delegate); +void DeleteThread(Thread*); + class Thread { + friend Thread* CreateThread(const char*, ThreadDelegate*); + friend void DeleteThread(Thread*); public: /** * Class that represents unique in-process thread identifier @@ -89,6 +95,7 @@ class Thread { public: explicit Id(const impl::PlatformThreadHandle& id): id_(id) {} bool operator==(const Id& that) const; + impl::PlatformThreadHandle Handle() const { return id_; } private: impl::PlatformThreadHandle id_; friend class Thread; @@ -104,46 +111,13 @@ class Thread { static void SetNameForId(const Id& thread_id, const std::string& name); /** - * @brief Set current thread as main - */ - static void SetMainThread(); - - /** - * @brief Send SIGINT to main thread - * @return \a true on success and \a false otherwise - */ - static bool InterruptMainThread(); - - /** - * @brief Mask all POSIX signals for current thread - */ - static void MaskSignals(); - - /** - * @brief Unmask all POSIX signals for current thread - */ - static void UnmaskSignals(); - - /** - * Ctor. - * @param name - display string to identify the thread. - * @param delegate - thread procedure delegate. Look for - * 'threads/thread_delegate.h' for details. - * NOTE: delegate will be deleted by destructor. - */ - Thread(const char* name, ThreadDelegate* delegate); - - /** - * Dtor. - */ - virtual ~Thread(); - - /** * Starts the thread. * @return true if the thread was successfully started. */ bool start(); + ThreadDelegate* delegate() const; + /** * Starts the thread. Behaves exactly like Start in addition to * allow to override the default options. @@ -164,13 +138,6 @@ class Thread { void stop(); /** - * Joins with a thread created via the Create function. - * This function blocks the caller until the designated thread exits. - * This will invalidate |thread_handle|. - */ - void join(); - - /** * Get thread name. * @return thread name */ @@ -187,6 +154,10 @@ class Thread { return isThreadRunning_; } + void set_running(bool running) { + isThreadRunning_ = running; + } + /** * Is thread joinable? * @return - Returns true if the thread is joinable. @@ -237,10 +208,22 @@ class Thread { ThreadDelegate* delegate_; impl::PlatformThreadHandle thread_handle_; ThreadOptions thread_options_; - bool isThreadRunning_; + volatile unsigned int isThreadRunning_; private: + /** + * Ctor. + * @param name - display string to identify the thread. + * @param delegate - thread procedure delegate. Look for + * 'threads/thread_delegate.h' for details. + * NOTE: delegate will be deleted by destructor. + * This constructor made private to prevent + * Thread object to be created on stack + */ + Thread(const char* name, ThreadDelegate* delegate); + DISALLOW_COPY_AND_ASSIGN(Thread); + virtual ~Thread() { } }; inline bool operator!= (const Thread::Id& left, const Thread::Id& right) { diff --git a/src/components/include/utils/threads/thread_delegate.h b/src/components/include/utils/threads/thread_delegate.h index fec9b748b6..47e68f1e83 100644 --- a/src/components/include/utils/threads/thread_delegate.h +++ b/src/components/include/utils/threads/thread_delegate.h @@ -43,11 +43,6 @@ namespace threads { */ class ThreadDelegate { public: - /** - * Dtor. - */ - virtual ~ThreadDelegate() { - } /** * Thread procedure. @@ -63,6 +58,7 @@ class ThreadDelegate { virtual bool exitThreadMain() { return false; } + virtual ~ThreadDelegate() { } }; } // namespace threads diff --git a/src/components/include/utils/threads/thread_options.h b/src/components/include/utils/threads/thread_options.h index 394918f0bc..217f0815a9 100644 --- a/src/components/include/utils/threads/thread_options.h +++ b/src/components/include/utils/threads/thread_options.h @@ -96,6 +96,10 @@ class ThreadOptions { return is_joinable_; } + void is_joinable(bool val) { + is_joinable_ = val; + } + protected: size_t stack_size_; bool is_joinable_; diff --git a/src/components/include/utils/timer_thread.h b/src/components/include/utils/timer_thread.h index 89a6220b48..a3481e4b4b 100644 --- a/src/components/include/utils/timer_thread.h +++ b/src/components/include/utils/timer_thread.h @@ -48,7 +48,8 @@ namespace timer { // TODO(AKutsan): Remove this logger after bugfix -CREATE_LOGGERPTR_GLOBAL(logger_, "Timer") +CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") + class TimerDelegate; /* @@ -143,7 +144,7 @@ class TimerThread { * * @param timer_thread The Timer_thread pointer */ - TimerDelegate(const TimerThread* timer_thread); + TimerDelegate(TimerThread* timer_thread); /** * @brief Destructor @@ -167,7 +168,7 @@ class TimerThread { virtual void setTimeOut(const uint32_t timeout_seconds); protected: - const TimerThread* timer_thread_; + TimerThread* timer_thread_; uint32_t timeout_seconds_; sync_primitives::Lock state_lock_; sync_primitives::ConditionalVariable termination_condition_; @@ -192,7 +193,7 @@ class TimerThread { * @param timer_thread The Timer_thread pointer * @param timeout Timeout to be set */ - TimerLooperDelegate(const TimerThread* timer_thread); + TimerLooperDelegate(TimerThread* timer_thread); /** * @brief Thread main function. @@ -205,9 +206,9 @@ class TimerThread { T* callee_; TimerDelegate* delegate_; //threads::Thread* thread_; - mutable bool is_running_; - bool is_looper_; - + std::string name_; + mutable bool is_running_; + bool is_looper_; DISALLOW_COPY_AND_ASSIGN(TimerThread); }; @@ -220,35 +221,30 @@ TimerThread<T>::TimerThread(const char* name, T* callee, void (T::*f)(), bool is delegate_(NULL), is_running_(false), is_looper_(is_looper) { - if (is_looper) { - delegate_ = new TimerLooperDelegate(this); - } else { - delegate_ = new TimerDelegate(this); - } - thread_ = new threads::Thread("TimerThread", delegate_); } template <class T> TimerThread<T>::~TimerThread() { - if (is_running_) { - stop(); - } + LOG4CXX_INFO(logger_, "TimerThread is to destroy " << name_); + stop(); callback_ = NULL; callee_ = NULL; - delete thread_; - // delegate_ will be deleted by thread_ - thread_ = NULL; - delegate_ = NULL; } template <class T> void TimerThread<T>::start(uint32_t timeout_seconds) { LOG4CXX_TRACE(logger_, "Starting timer " << this); if (is_running_) { + LOG4CXX_INFO(logger_, "TimerThread start needs stop " << name_); stop(); } + delegate_ = is_looper_ ? + new TimerLooperDelegate(this) : + new TimerDelegate(this); delegate_->setTimeOut(timeout_seconds); + + thread_ = threads::CreateThread("TimerThread", delegate_); if (delegate_ && thread_) { is_running_ = true; thread_->start(); @@ -258,9 +254,12 @@ void TimerThread<T>::start(uint32_t timeout_seconds) { template <class T> void TimerThread<T>::stop() { LOG4CXX_TRACE(logger_, "Stopping timer " << this); - if (delegate_ && thread_) { + if (is_running_ && delegate_ && thread_) { + LOG4CXX_INFO(logger_, "TimerThread thread_ stop " << name_); thread_->stop(); is_running_ = false; + } else { + LOG4CXX_INFO(logger_, "TimerThread thread_ not stop " << name_); } } @@ -278,14 +277,16 @@ template <class T> void TimerThread<T>::onTimeOut() const { if (callee_ && callback_) { (callee_->*callback_)(); + /* if (!is_looper_) { - is_running_ = false; + stop(); } + */ } } template <class T> -TimerThread<T>::TimerDelegate::TimerDelegate(const TimerThread* timer_thread) +TimerThread<T>::TimerDelegate::TimerDelegate(TimerThread* timer_thread) : timer_thread_(timer_thread), timeout_seconds_(0), state_lock_(true), @@ -294,7 +295,7 @@ TimerThread<T>::TimerDelegate::TimerDelegate(const TimerThread* timer_thread) } template <class T> -TimerThread<T>::TimerLooperDelegate::TimerLooperDelegate(const TimerThread* timer_thread) +TimerThread<T>::TimerLooperDelegate::TimerLooperDelegate(TimerThread* timer_thread) : TimerDelegate(timer_thread) { } @@ -320,8 +321,8 @@ void TimerThread<T>::TimerDelegate::threadMain() { } if (!stop_flag_) { timer_thread_->onTimeOut(); + timer_thread_->stop(); } - stop_flag_ = false; } template <class T> @@ -346,13 +347,9 @@ void TimerThread<T>::TimerLooperDelegate::threadMain() { template <class T> bool TimerThread<T>::TimerDelegate::exitThreadMain() { - { - sync_primitives::AutoLock auto_lock(state_lock_); - stop_flag_ = true; - } + sync_primitives::AutoLock auto_lock(state_lock_); + stop_flag_ = true; termination_condition_.NotifyOne(); - // FIXME(AKutsan) - {sync_primitives::AutoLock wait_for_thread_main(state_lock_);} return true; } diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 557b931eb0..f9e98cbc7a 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1907,6 +1907,12 @@ <function name="OnUpdateDeviceList" messagetype="notification"> <description>Notification from HMI to SDL sent when HMI requires update of device list (i.e. when user clicks 'Change Device' button)</description> </function> + <function name="OnPhoneCall" messagetype="notification"> + <description>Sender: HMI->SDL. When: upon phone-call event started or ended</description> + <param name="isActive" type="Boolean" mandatory="true"> + <description>Must be 'true' - when the phone call is started on HMI. Must be 'false' when the phone call is ended on HMI</description> + </param> + </function> <function name="OnResumeAudioSource" messagetype="notification"> <description>This method must be invoked by SDL to update audio state.</description> <param name="appID" type="Integer" mandatory="true"> diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml index 08e0a60d0f..d6450b8346 100644 --- a/src/components/interfaces/QT_HMI_API.xml +++ b/src/components/interfaces/QT_HMI_API.xml @@ -1799,6 +1799,12 @@ <function name="OnUpdateDeviceList" messagetype="notification" provider="hmi"> <description>Notification from HMI to SDL sent when HMI requires update of device list (i.e. when user clicks 'Change Device' button)</description> </function> + <function name="OnPhoneCall" messagetype="notification"> + <description>Sender: HMI->SDL. When: upon phone-call event started or ended</description> + <param name="isActive" type="Boolean" mandatory="true"> + <description>Must be 'true' - when the phone call is started on HMI. Must be 'false' when the phone call is ended on HMI</description> + </param> + </function> <function name="OnResumeAudioSource" messagetype="notification" provider="sdl"> <description>This method must be invoked by SDL to update audio state.</description> <param name="appID" type="Integer" mandatory="true"> diff --git a/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h b/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h index 9eb63c2fe8..ae41e19e62 100644 --- a/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h +++ b/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h @@ -48,7 +48,7 @@ class A2DPSourcePlayerAdapter : public MediaAdapterImpl { A2DPSourcePlayerAdapter(); ~A2DPSourcePlayerAdapter(); void SendData(int32_t application_key, - const RawMessagePtr message) {} + const ::protocol_handler::RawMessagePtr message) {} void StartActivity(int32_t application_key); void StopActivity(int32_t application_key); bool is_app_performing_activity(int32_t application_key); diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h index d7d0434a49..7c5a0f2916 100644 --- a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h +++ b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -47,7 +47,7 @@ class FromMicRecorderAdapter : public MediaAdapterImpl { FromMicRecorderAdapter(); ~FromMicRecorderAdapter(); void SendData(int32_t application_key, - const RawMessagePtr message) {} + const ::protocol_handler::RawMessagePtr message) {} void StartActivity(int32_t application_key); void StopActivity(int32_t application_key); bool is_app_performing_activity(int32_t application_key); diff --git a/src/components/media_manager/include/media_manager/media_adapter.h b/src/components/media_manager/include/media_manager/media_adapter.h index 66f23df6bc..91a897de43 100644 --- a/src/components/media_manager/include/media_manager/media_adapter.h +++ b/src/components/media_manager/include/media_manager/media_adapter.h @@ -41,7 +41,7 @@ namespace media_manager { class MediaAdapter { public: virtual void SendData(int32_t application_key, - const RawMessagePtr message) = 0; + const ::protocol_handler::RawMessagePtr message) = 0; virtual void StartActivity(int32_t application_key) = 0; virtual void StopActivity(int32_t application_key) = 0; virtual bool is_app_performing_activity(int32_t application_key) = 0; diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h index 7f997bf8c3..94512a7ffe 100644 --- a/src/components/media_manager/include/media_manager/media_manager_impl.h +++ b/src/components/media_manager/include/media_manager/media_manager_impl.h @@ -62,9 +62,9 @@ class MediaManagerImpl : public MediaManager, virtual void StartAudioStreaming(int32_t application_key); virtual void StopAudioStreaming(int32_t application_key); virtual void OnMessageReceived( - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); virtual void OnMobileMessageSent( - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); virtual void FramesProcessed(int32_t application_key, int32_t frame_number); protected: diff --git a/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h b/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h index 9a33dd4744..108403a43c 100644 --- a/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h +++ b/src/components/media_manager/include/media_manager/pipe_streamer_adapter.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -46,7 +46,7 @@ class PipeStreamerAdapter : public MediaAdapterImpl { PipeStreamerAdapter(); virtual ~PipeStreamerAdapter(); virtual void SendData(int32_t application_key, - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); virtual void StartActivity(int32_t application_key); virtual void StopActivity(int32_t application_key); virtual bool is_app_performing_activity(int32_t application_key); @@ -104,7 +104,7 @@ class PipeStreamerAdapter : public MediaAdapterImpl { bool is_ready_; threads::Thread* thread_; - MessageQueue<RawMessagePtr> messages_; + MessageQueue<protocol_handler::RawMessagePtr> messages_; DISALLOW_COPY_AND_ASSIGN(PipeStreamerAdapter); }; diff --git a/src/components/media_manager/include/media_manager/socket_streamer_adapter.h b/src/components/media_manager/include/media_manager/socket_streamer_adapter.h index 87c705a20a..afd78068b8 100644 --- a/src/components/media_manager/include/media_manager/socket_streamer_adapter.h +++ b/src/components/media_manager/include/media_manager/socket_streamer_adapter.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -47,7 +47,7 @@ class SocketStreamerAdapter : public MediaAdapterImpl { SocketStreamerAdapter(); virtual ~SocketStreamerAdapter(); virtual void SendData(int32_t application_key, - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); virtual void StartActivity(int32_t application_key); virtual void StopActivity(int32_t application_key); virtual bool is_app_performing_activity(int32_t application_key); @@ -111,7 +111,7 @@ class SocketStreamerAdapter : public MediaAdapterImpl { * * @param block Pointer to the data */ - bool send(const RawMessagePtr msg); + bool send(const ::protocol_handler::RawMessagePtr msg); private: SocketStreamerAdapter* const server_; @@ -127,7 +127,7 @@ class SocketStreamerAdapter : public MediaAdapterImpl { bool is_ready_; threads::Thread* thread_; Streamer* streamer_; - MessageQueue<RawMessagePtr> messages_; + MessageQueue<protocol_handler::RawMessagePtr> messages_; DISALLOW_COPY_AND_ASSIGN(SocketStreamerAdapter); }; } // namespace media_manager diff --git a/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h b/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h index 819c4f5edb..4784014498 100644 --- a/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h +++ b/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -47,7 +47,7 @@ class VideoStreamToFileAdapter : public MediaAdapterImpl { explicit VideoStreamToFileAdapter(const std::string& file_name); virtual ~VideoStreamToFileAdapter(); virtual void SendData(int32_t application_key, - const RawMessagePtr message); + const ::protocol_handler::RawMessagePtr message); virtual void StartActivity(int32_t application_key); virtual void StopActivity(int32_t application_key); virtual bool is_app_performing_activity(int32_t application_key); @@ -104,7 +104,7 @@ class VideoStreamToFileAdapter : public MediaAdapterImpl { std::string file_name_; bool is_ready_; threads::Thread* thread_; - MessageQueue<RawMessagePtr> messages_; + MessageQueue<protocol_handler::RawMessagePtr> messages_; }; } // namespace media_manager diff --git a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc index 91604d22c9..f8b0d9599b 100644 --- a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc +++ b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc @@ -43,7 +43,9 @@ namespace media_manager { -CREATE_LOGGERPTR_GLOBAL(logger_, "A2DPSourcePlayerAdapter") +CREATE_LOGGERPTR_GLOBAL(logger_, "A2DPSourcePlayerAdapter"); + +const static size_t BUFSIZE = 32; class A2DPSourcePlayerAdapter::A2DPSourcePlayerThread : public threads::ThreadDelegate { @@ -60,7 +62,6 @@ class A2DPSourcePlayerAdapter::A2DPSourcePlayerThread pa_simple* s_in, *s_out; std::string device_; - const int32_t BUFSIZE_; bool should_be_stopped_; sync_primitives::Lock should_be_stopped_lock_; @@ -77,10 +78,8 @@ A2DPSourcePlayerAdapter::~A2DPSourcePlayerAdapter() { sources_.end() != it; ++it) { if (NULL != it->second) { - if (it->second->is_running()) { - it->second->stop(); - } - delete(it->second); + it->second->stop(); + threads::DeleteThread(it->second); } } sources_.clear(); @@ -92,41 +91,25 @@ void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) { if (application_key != current_application_) { current_application_ = application_key; - std::map<int32_t, threads::Thread*>::iterator it = - sources_.find(application_key); - if (sources_.end() != it) { - if (NULL != it->second && !it->second->is_running()) { - it->second->start(); - } else { - current_application_ = 0; - } - } else { - uint32_t device_id = 0; - connection_handler::ConnectionHandlerImpl::instance()-> - GetDataOnSessionKey(application_key, 0, NULL, &device_id); - std::string mac_adddress; - connection_handler::ConnectionHandlerImpl::instance()->GetDataOnDeviceID( - device_id, - NULL, - NULL, - &mac_adddress); - - // TODO(PK): Convert mac_adddress to the - // following format : "bluez_source.XX_XX_XX_XX_XX_XX" if needed - // before passing to the A2DPSourcePlayerThread constructor - - threads::Thread* new_activity = new threads::Thread( - mac_adddress.c_str(), - new A2DPSourcePlayerAdapter::A2DPSourcePlayerThread(mac_adddress)); - if (NULL != new_activity) { - sources_.insert(std::pair<int32_t, threads::Thread*>( - application_key, new_activity)); - - new_activity->start(); - } else { - current_application_ = 0; - } - } + uint32_t device_id = 0; + connection_handler::ConnectionHandlerImpl::instance()-> + GetDataOnSessionKey(application_key, 0, NULL, &device_id); + std::string mac_adddress; + connection_handler::ConnectionHandlerImpl::instance()->GetDataOnDeviceID( + device_id, + NULL, + NULL, + &mac_adddress); + + // TODO(PK): Convert mac_adddress to the + // following format : "bluez_source.XX_XX_XX_XX_XX_XX" if needed + // before passing to the A2DPSourcePlayerThread constructor + + threads::Thread* new_activity = threads::CreateThread( + mac_adddress.c_str(), + new A2DPSourcePlayerAdapter::A2DPSourcePlayerThread(mac_adddress)); + sources_[application_key] = new_activity; + new_activity->start(); } } @@ -146,6 +129,7 @@ void A2DPSourcePlayerAdapter::StopActivity(int32_t application_key) { // Sources thread was started - stop it LOG4CXX_DEBUG(logger_, "Sources thread was started - stop it"); (*it).second->stop(); + threads::DeleteThread(it->second); } } current_application_ = 0; @@ -167,8 +151,7 @@ sSampleFormat_ = { A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::A2DPSourcePlayerThread( const std::string& device) : threads::ThreadDelegate(), - device_(device), - BUFSIZE_(32) { + device_(device) { } void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::freeStreams() { @@ -222,7 +205,7 @@ void A2DPSourcePlayerAdapter::A2DPSourcePlayerThread::threadMain() { LOG4CXX_DEBUG(logger_, "Entering main loop"); for (;;) { - uint8_t buf[BUFSIZE_]; + uint8_t buf[BUFSIZE]; pa_usec_t latency; diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc index ba5e7ec54a..7559512a80 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc @@ -67,7 +67,7 @@ void FromMicRecorderAdapter::StartActivity(int32_t application_key) { FromMicToFileRecorderThread* thread_delegate = new FromMicToFileRecorderThread( output_file_, duration_); - recorder_thread_ = new threads::Thread("MicrophoneRec", + recorder_thread_ = threads::CreateThread("MicrophoneRec", thread_delegate); } @@ -88,7 +88,6 @@ void FromMicRecorderAdapter::StopActivity(int32_t application_key) { if (NULL != recorder_thread_) { recorder_thread_->stop(); - delete recorder_thread_; recorder_thread_ = NULL; } current_application_ = 0; diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc index cec85ca4e6..06dce2d4ea 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc @@ -48,7 +48,6 @@ FromMicRecorderListener::FromMicRecorderListener( FromMicRecorderListener::~FromMicRecorderListener() { if (reader_) { reader_->stop(); - delete reader_; reader_ = NULL; } } @@ -72,7 +71,7 @@ void FromMicRecorderListener::OnActivityStarted(int32_t application_key) { if (!reader_) { AudioStreamSenderThread* thread_delegate = new AudioStreamSenderThread(file_name_, application_key); - reader_ = new threads::Thread("RecorderSender", thread_delegate); + reader_ = threads::CreateThread("RecorderSender", thread_delegate); } if (reader_) { reader_->start(); @@ -90,7 +89,6 @@ void FromMicRecorderListener::OnActivityEnded(int32_t application_key) { } if (reader_) { reader_->stop(); - delete reader_; reader_ = NULL; } current_application_ = 0; diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc index 02ccd1f2b7..181c8c61b3 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc @@ -198,12 +198,8 @@ void FromMicToFileRecorderThread::threadMain() { timeout.pipeline = pipeline; timeout.duration = duration; - sleepThread_ = new threads::Thread("SleepThread" - , new SleepThreadDelegate(timeout)); - - if (NULL != sleepThread_) { - sleepThread_->start(); - } + sleepThread_ = threads::CreateThread("SleepThread", new SleepThreadDelegate(timeout)); + sleepThread_->start(); } loop = g_main_loop_new(NULL, FALSE); @@ -250,7 +246,7 @@ bool FromMicToFileRecorderThread::exitThreadMain() { if (NULL != sleepThread_) { LOG4CXX_TRACE(logger_, "Stop sleep thread\n"); sleepThread_->stop(); - delete sleepThread_; + threads::DeleteThread(sleepThread_); sleepThread_ = NULL; } diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index 72e0ba1779..e8156795b1 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -254,7 +254,7 @@ void MediaManagerImpl::StopAudioStreaming(int32_t application_key) { } void MediaManagerImpl::OnMessageReceived( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { if (message->service_type() == protocol_handler::kMobileNav) { if (!(application_manager::ApplicationManagerImpl::instance()-> @@ -277,7 +277,7 @@ void MediaManagerImpl::OnMessageReceived( } void MediaManagerImpl::OnMobileMessageSent( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { } void MediaManagerImpl::FramesProcessed(int32_t application_key, diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc index 4f2985c43d..43f0d71530 100644 --- a/src/components/media_manager/src/pipe_streamer_adapter.cc +++ b/src/components/media_manager/src/pipe_streamer_adapter.cc @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -58,12 +58,11 @@ PipeStreamerAdapter::~PipeStreamerAdapter() { } thread_->stop(); - delete thread_; } void PipeStreamerAdapter::SendData( int32_t application_key, - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger, "PipeStreamerAdapter::SendData"); if (application_key != current_application_) { @@ -122,7 +121,7 @@ bool PipeStreamerAdapter::is_app_performing_activity( void PipeStreamerAdapter::Init() { if (!thread_) { LOG4CXX_INFO(logger, "Create and start sending thread"); - thread_ = new threads::Thread("PipeStreamer", new Streamer(this)); + thread_ = threads::CreateThread("PipeStreamer", new Streamer(this)); const size_t kStackSize = 16384; thread_->startWithOptions(threads::ThreadOptions(kStackSize)); } @@ -146,7 +145,7 @@ void PipeStreamerAdapter::Streamer::threadMain() { while (!stop_flag_) { while (!server_->messages_.empty()) { - RawMessagePtr msg = server_->messages_.pop(); + ::protocol_handler::RawMessagePtr msg = server_->messages_.pop(); if (!msg) { LOG4CXX_ERROR(logger, "Null pointer message"); continue; diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc index 708b37dbe7..c6da8c7a75 100644 --- a/src/components/media_manager/src/socket_streamer_adapter.cc +++ b/src/components/media_manager/src/socket_streamer_adapter.cc @@ -59,7 +59,6 @@ SocketStreamerAdapter::SocketStreamerAdapter() SocketStreamerAdapter::~SocketStreamerAdapter() { thread_->stop(); streamer_ = NULL; - delete thread_; } void SocketStreamerAdapter::StartActivity(int32_t application_key) { @@ -114,7 +113,7 @@ void SocketStreamerAdapter::Init() { if (!thread_) { LOG4CXX_INFO(logger, "Create and start sending thread"); streamer_ = new Streamer(this); - thread_ = new threads::Thread("SocketStreamer", streamer_); + thread_ = threads::CreateThread("SocketStreamer", streamer_); const size_t kStackSize = 16384; thread_->startWithOptions(threads::ThreadOptions(kStackSize)); } else { @@ -124,7 +123,7 @@ void SocketStreamerAdapter::Init() { void SocketStreamerAdapter::SendData( int32_t application_key, - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger, "SendData(application_key = " << application_key << ")"); @@ -170,24 +169,24 @@ void SocketStreamerAdapter::Streamer::threadMain() { is_first_loop_ = true; while (is_client_connected_) { while (!server_->messages_.empty()) { - RawMessagePtr msg = server_->messages_.pop(); + ::protocol_handler::RawMessagePtr msg = server_->messages_.pop(); if (!msg) { LOG4CXX_ERROR(logger, "Null pointer message"); continue; } is_client_connected_ = send(msg); - static int32_t messsages_for_session = 0; - ++messsages_for_session; + static int32_t messages_for_session = 0; + ++messages_for_session; LOG4CXX_INFO(logger, "Handling map streaming message. This is " - << messsages_for_session << " the message for " + << messages_for_session << " the message for " << server_->current_application_); std::set<MediaListenerPtr>::iterator it = server_->media_listeners_ .begin(); for (; server_->media_listeners_.end() != it; ++it) { (*it)->OnDataReceived(server_->current_application_, - messsages_for_session); + messages_for_session); } } @@ -232,8 +231,7 @@ void SocketStreamerAdapter::Streamer::start() { return; } - struct sockaddr_in serv_addr_; - memset(&serv_addr_, 0, sizeof(serv_addr_)); + struct sockaddr_in serv_addr_ = { 0 }; serv_addr_.sin_addr.s_addr = inet_addr(server_->ip_.c_str()); serv_addr_.sin_family = AF_INET; serv_addr_.sin_port = htons(server_->port_); @@ -290,7 +288,7 @@ bool SocketStreamerAdapter::Streamer::is_ready() const { } bool SocketStreamerAdapter::Streamer::send( - const RawMessagePtr msg) { + const ::protocol_handler::RawMessagePtr msg) { if (!is_ready()) { LOG4CXX_ERROR_EXT(logger, " Socket is not ready"); return false; diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc index cf32b79b97..983f1278c9 100644 --- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc +++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -52,13 +52,12 @@ VideoStreamToFileAdapter::~VideoStreamToFileAdapter() { } thread_->stop(); - delete thread_; } void VideoStreamToFileAdapter::Init() { if (!thread_) { LOG4CXX_INFO(logger, "Create and start sending thread"); - thread_ = new threads::Thread("VideoStreamer", + thread_ = threads::CreateThread("VideoStreamer", new Streamer(this)); const size_t kStackSize = 16384; thread_->startWithOptions(threads::ThreadOptions(kStackSize)); @@ -67,7 +66,7 @@ void VideoStreamToFileAdapter::Init() { void VideoStreamToFileAdapter::SendData( int32_t application_key, - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_INFO(logger, "VideoStreamToFileAdapter::SendData " << application_key); @@ -143,7 +142,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() { while (!stop_flag_) { while (!server_->messages_.empty()) { - RawMessagePtr msg = server_->messages_.pop(); + ::protocol_handler::RawMessagePtr msg = server_->messages_.pop(); if (!msg) { LOG4CXX_ERROR(logger, "Null pointer message"); continue; diff --git a/src/components/media_manager/test/main.cc b/src/components/media_manager/test/main.cc index d8242c89a0..59fa20e8b5 100644 --- a/src/components/media_manager/test/main.cc +++ b/src/components/media_manager/test/main.cc @@ -1,7 +1,7 @@ -#include "gmock/gmock.h" - -int main(int argc, char** argv) { - testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} - +#include "gmock/gmock.h"
+
+int main(int argc, char** argv) {
+ testing::InitGoogleMock(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
diff --git a/src/components/policy/CMakeLists.txt b/src/components/policy/CMakeLists.txt new file mode 100644 index 0000000000..f32ef344d2 --- /dev/null +++ b/src/components/policy/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (c) 2013, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +# --- Policy +add_subdirectory(./src/policy) +#======================= Unit-Test section ======================= +if(BUILD_TESTS) + add_subdirectory(test) +endif() +#================================================================= + diff --git a/src/components/policy/doc/doxygen/components/AppMgr/index.txt b/src/components/policy/doc/doxygen/components/AppMgr/index.txt new file mode 100644 index 0000000000..17584b09e1 --- /dev/null +++ b/src/components/policy/doc/doxygen/components/AppMgr/index.txt @@ -0,0 +1,5 @@ +/*! \page components_appmgr App Manager + +Here will be information about App Manager component + +*/
\ No newline at end of file diff --git a/src/components/policy/doc/doxygen/components/HMI/index.txt b/src/components/policy/doc/doxygen/components/HMI/index.txt new file mode 100644 index 0000000000..361763118d --- /dev/null +++ b/src/components/policy/doc/doxygen/components/HMI/index.txt @@ -0,0 +1,5 @@ +/*! \page components_hmi HMI + +Here will be information about HMI component + +*/
\ No newline at end of file diff --git a/src/components/policy/doc/doxygen/components/JSONHandler/Formatters/index.txt b/src/components/policy/doc/doxygen/components/JSONHandler/Formatters/index.txt new file mode 100644 index 0000000000..9854b88d5f --- /dev/null +++ b/src/components/policy/doc/doxygen/components/JSONHandler/Formatters/index.txt @@ -0,0 +1,9 @@ +/*! \page components_jsonhandler_formatters Smart Objects Formatters + +In order to create JSON string representation from Smart Object or create Smart Object data structure from JSON string representation JSON Handler component has special classes called formatters. + +The interface of formatter is quite simple and defined by NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase class. Actually it has two methods - NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::objToJsonValue to convert JSON string to object and NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::jsonValueToObj to create JSON string from object. + +Current implementation has two different implementations of NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase class: NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonALRPCv1 for ALRPC.v1 and NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonALRPCv2 for ALRPC.v2. These implementations handle specifics of each format. + +*/ diff --git a/src/components/policy/doc/doxygen/components/JSONHandler/index.txt b/src/components/policy/doc/doxygen/components/JSONHandler/index.txt new file mode 100644 index 0000000000..a65c8ddc7d --- /dev/null +++ b/src/components/policy/doc/doxygen/components/JSONHandler/index.txt @@ -0,0 +1,8 @@ +/*! \page components_jsonhandler JSON Handler + +Here will be information about JSON Handler component + +Detailed information: + - \subpage components_jsonhandler_formatters "Smart Objects Formatters" + +*/ diff --git a/src/components/policy/doc/doxygen/components/ProtocolHandler/index.txt b/src/components/policy/doc/doxygen/components/ProtocolHandler/index.txt new file mode 100644 index 0000000000..c5b5ceb79c --- /dev/null +++ b/src/components/policy/doc/doxygen/components/ProtocolHandler/index.txt @@ -0,0 +1,5 @@ +/*! \page components_protocolhandler Protocol Handler + +Here will be information about Protocol Handler component + +*/
\ No newline at end of file diff --git a/src/components/policy/doc/doxygen/components/SmartObjects/index.txt b/src/components/policy/doc/doxygen/components/SmartObjects/index.txt new file mode 100644 index 0000000000..3844e1ab69 --- /dev/null +++ b/src/components/policy/doc/doxygen/components/SmartObjects/index.txt @@ -0,0 +1,11 @@ +/*! \page components_smartobjects Smart Objects + +Smart Object is building block for a custom dynamic data structures with virtually unlimited complexity. Client code can use Smart Objects to create containers for simple basic types such as bools, ints, doubles, chars, strings end enums as well as arrays and maps. + +Smart Objects solution also includes validation/normalization mechanism of schemas witch is similar to the XML schemas. This feature allows client to validate any data structure. + +More detailed information is described in following chapters: + - \subpage components_smartobjects_types "Smart Objects Types" + - \subpage components_smartobjects_usage "Use of Smart Objects" + - \subpage components_smartobjects_validation "Smart Objects validation" +*/ diff --git a/src/components/policy/doc/doxygen/components/TransportManager/index.txt b/src/components/policy/doc/doxygen/components/TransportManager/index.txt new file mode 100644 index 0000000000..73252c751c --- /dev/null +++ b/src/components/policy/doc/doxygen/components/TransportManager/index.txt @@ -0,0 +1,9 @@ +/*! \page components_transportmanager Transport Manager + +Transport Manager is a component of SmartDeviceLink application which is designed to provide transparent access to transport layer for other components. Current implementation provides unified access to connections via Bluetooth and TCP. Also this component allows run automatic device discovery and provides information about found devices which is able to connect to SmartDeviceLink. + +More detailed information is described in following chapters: + - \subpage components_transportmanager_client "Transport Manager Client Specification" + - \subpage components_transportmanager_internal_design "Component Internal Design" + - \subpage components_transportmanager_use_cases "High-Level Use Cases to Test Component" +*/ diff --git a/src/components/policy/doc/doxygen/components/index.txt b/src/components/policy/doc/doxygen/components/index.txt new file mode 100644 index 0000000000..186de88af0 --- /dev/null +++ b/src/components/policy/doc/doxygen/components/index.txt @@ -0,0 +1,10 @@ +/*! \page components Components + +Project contain following components: + - \subpage components_transportmanager "Transport Manager" + - \subpage components_protocolhandler "Protocol Handler" + - \subpage components_jsonhandler "JSON Handler" + - \subpage components_smartobjects "Smart Objects" + - \subpage components_appmgr "App Manager" + - \subpage components_hmi "HMI" +*/ diff --git a/src/components/policy/doc/doxygen/info.txt b/src/components/policy/doc/doxygen/info.txt new file mode 100644 index 0000000000..e8afe55c12 --- /dev/null +++ b/src/components/policy/doc/doxygen/info.txt @@ -0,0 +1,5 @@ +/*! \page info Project information + +Here will be general information about project + +*/
\ No newline at end of file diff --git a/src/components/policy/doc/doxygen/mainpage.txt b/src/components/policy/doc/doxygen/mainpage.txt new file mode 100644 index 0000000000..5cd05e2606 --- /dev/null +++ b/src/components/policy/doc/doxygen/mainpage.txt @@ -0,0 +1,9 @@ +/*! \mainpage Project SmartDeviceLink + +This is the entry point to the documentation about project. + +This manual is divided in the following sections: +- \subpage info "General project information" +- \subpage components "Project components" +- \subpage tools "Project specific tools" +*/ diff --git a/src/components/policy/doc/doxygen/tools/InterfaceGenerator/Arhitecture.txt b/src/components/policy/doc/doxygen/tools/InterfaceGenerator/Arhitecture.txt new file mode 100644 index 0000000000..4cf9e84d99 --- /dev/null +++ b/src/components/policy/doc/doxygen/tools/InterfaceGenerator/Arhitecture.txt @@ -0,0 +1,5 @@ +/*! \page tools_interfacegenerator_architecture InterfaceGenerator architecture + +InterfaceGenerator is designed as flexible and easily expendable tool that allows to implement both new parsers and generators independently. The core idea of InterfaceGenerator that it has middle-ware product - abstract model of interface that should be generated. This middle layer allows to separate collection of parsers from generators. Also it is possible to add any new validation / normalization component between them. So at the moment the root script creates actual parser and that parser produces model of interface (set of Python classes objects). After that interface model is passed to the desired generator and generator creates result source code files. + +*/ diff --git a/src/components/policy/doc/doxygen/tools/InterfaceGenerator/index.txt b/src/components/policy/doc/doxygen/tools/InterfaceGenerator/index.txt new file mode 100644 index 0000000000..21b437f6b7 --- /dev/null +++ b/src/components/policy/doc/doxygen/tools/InterfaceGenerator/index.txt @@ -0,0 +1,12 @@ +/*! \page tools_interfacegenerator InterfaceGenerator + +InterfaceGenerator is a special code generation tool that allows creating of C++ source code to work with interface described as XML file. +InterfaceGenerator is a bundle of Python scripts. Root script is a Generator.py. This script should be used by the client to run generator. +Currently InterfaceGenerator supports generation form ALRPC v.1 and ALRPC v.2 XML formats. + +For more details please review: + - \subpage tools_interfacegenerator_usage "How to use InterfaceGenerator" + - \subpage tools_interfacegenerator_output "Use of InterfaceGenerator output" + - \subpage tools_interfacegenerator_architecture "InterfaceGenerator architecture" + - \subpage tools_interfacegenerator_cmakeintegration "Integration with CMake" +*/ diff --git a/src/components/policy/doc/doxygen/tools/index.txt b/src/components/policy/doc/doxygen/tools/index.txt new file mode 100644 index 0000000000..4befa33e8d --- /dev/null +++ b/src/components/policy/doc/doxygen/tools/index.txt @@ -0,0 +1,5 @@ +/*! \page tools Tools + +Project uses following special tools: + - \subpage tools_interfacegenerator "InterfaceGenerator" +*/ diff --git a/src/components/policy/doc/grc/conf.smartDeviceLinkCore b/src/components/policy/doc/grc/conf.smartDeviceLinkCore new file mode 100644 index 0000000000..11c7643c68 --- /dev/null +++ b/src/components/policy/doc/grc/conf.smartDeviceLinkCore @@ -0,0 +1,34 @@ +# source filename +regexp=\w+\.(?:cpp|h) +colours=yellow +=== +regexp=^(ERROR|FATAL) +colours=red on_yellow +=== +regexp=^WARN +colours=red +=== +regexp=^INFO +colours=blue +=== +regexp=^TRACE +colours=magenta +=== +# component +regexp=(?<=\])\[[^]]+\] +colours=cyan +=== +# something invalid +regexp=(?i)invalid +colours=red +=== +# RPC message start +regexp=^\{$ +colours=bold +count=block +=== +# RPC message end +regexp=^\}$ +colours=bold +count=unblock + diff --git a/src/components/policy/doc/grc/grc.conf b/src/components/policy/doc/grc/grc.conf new file mode 100644 index 0000000000..dfd3d4cbef --- /dev/null +++ b/src/components/policy/doc/grc/grc.conf @@ -0,0 +1,3 @@ +# smartDeviceCore command +(^|[/\w\.]+/)smartDeviceLinkCore\s? +conf.smartDeviceLinkCore diff --git a/src/components/policy/doc/install.txt b/src/components/policy/doc/install.txt new file mode 100644 index 0000000000..8076f427bc --- /dev/null +++ b/src/components/policy/doc/install.txt @@ -0,0 +1,91 @@ +* Introduction + ================ + smartDeviceLinkCore is an application which manages the transport, connection and communication between a head unit and mobile device. + +* OS and Hardware + ========= + Ubuntu 12.04.01 LTS 32-bit OS on the PC with USB-dongle + Application has been tested using 2 types of USB-dongle: + D-Link DBT-122 + STLab B-121mini + +* External components + =================== + For build application we need: + libbluetooth3, the BlueZ library + libbluetooth-dev, the development files to link to the BluetZ library. + Install libraries: + sudo apt-get install libbluetooth3 + sudo apt-get install libbluetooth-dev + + We are using cmake to create build configurations. + Install cmake: + sudo apt-get install cmake + + Also, make sure the g++ compiler is installed: + sudo apt-get install g++ + + To start web-based HMI we need web-browser with web-socket RFC6455 support. + For example Google Chromium. Install it using: + sudo apt-get install chromium-browser + + To run InterfaceGenerator some python libraries are required and must be + installed with following command: + sudo pip install -r tools/InterfaceGenerator/requirements.txt + + For logging Apache log4cxx library is used. Install required packages with the following command: + sudo apt-get install liblog4cxx10 liblog4cxx10-dev + + For installing pulseaudio development files which neededfor audio management fetures run: + sudo apt-get install libpulse-dev + + For installing gstreamer development files which needed for audio management fetures: + First add gstreamer repositories to your apt source list (/etc/apt/sources.list): + deb http://ppa.launchpad.net/gstreamer-developers/ppa/ubuntu <distributive codename> main + deb-src http://ppa.launchpad.net/gstreamer-developers/ppa/ubuntu <distributive codename> main + use code name relevant to the Ubuntu version which you use instead of <distributive codename>. + Run: + sudo apt-get update + and: + sudo apt-get install gstreamer1.0* + +* Build application + ================= + We support "out of sources" concept for build from R3.0.0 + It means all generated by build tools files will be stored in separate folder. + Temporary build of application requires two steps. + 1. Enter src/thirdPartyLibs/logger + build logger: + + 1. Create directory outside of SmartDeviceLink project directory. + For example "build" folder in the same folder with SmartDeviceLink git repo folder which has a name "git_repo": + You will have folders structure like this: + /home/projects/smart_device_link + |--build + |--git_repo + |--doc + |--src + |--test + |--DoxyFile + \--CMakeLists.txt + Enter this folder: + cd build + + 2. Create build configuration using cmake: + 2.1 For Debug configuration + cmake ../git_repo + 2.2 For Release configuration, run: + cmake -DCMAKE_BUILD_TYPE=Release ../git_repo + 2.3 For Debug configuration with tests, run: + cmake -DBUILD_TESTS=On ../git_repo + + 3. Make project: + make + + Ready to use release application will be in build/src/appMain/smartDeviceLinkCore + + 4. If You built configuration with tests (see 2.3 above), then You can run all project tests and see overall result with: + make test + + 5. For creating the doxygen documentation run: + make doxygen diff --git a/src/components/policy/doc/qnx_build.txt b/src/components/policy/doc/qnx_build.txt new file mode 100644 index 0000000000..4f67d6eed3 --- /dev/null +++ b/src/components/policy/doc/qnx_build.txt @@ -0,0 +1,28 @@ +Building the project +cmake -DCMAKE_TOOLCHAIN_FILE=../applink/qnx_6.5.0_linux_x86.cmake ../applink +or for Momentics project: +cmake -DCMAKE_TOOLCHAIN_FILE=../applink/qnx_6.5.0_linux_x86.cmake -G "Eclipse CDT4 - Unix Makefiles" ../applink + +Building with support D-Bus and Qt 4.8 +Install D-Bus (see https://adc.luxoft.com/confluence/x/0AHJDw) +Install Qt 4.8 (see https://adc.luxoft.com/confluence/x/UwfJDw) +cmake -DHMI2=ON -DCMAKE_TOOLCHAIN_FILE=../applink/qnx_6.5.0_linux_x86.cmake ../applink +or for Momentics project: +cmake -DHMI2=ON -DCMAKE_TOOLCHAIN_FILE=../applink/qnx_6.5.0_linux_x86.cmake -G "Eclipse CDT4 - Unix Makefiles" ../applink + +make +make install + +Running project: +Change server IP in configuration file to QNX target IP. +Copy directory bin to QNX target. +You can copy it using scp. Example: +scp -r user_name@linux_pc_ip:/full_path/to/dir . + +For Web HMI set target IP in ini file and change target IP in src/components/HMI/ffw/RPCClient.js +! Currently we don't have any configuration file for HMI. + +Execute smartDeviceLinkCore on QNX qtarget. +Execute HMI on Linux PC (only Web HMI). + +Have fun! diff --git a/src/components/policy/doc/readme.txt b/src/components/policy/doc/readme.txt new file mode 100644 index 0000000000..86de7da08a --- /dev/null +++ b/src/components/policy/doc/readme.txt @@ -0,0 +1,67 @@ +* Introduction + ================ + smartDeviceCore is an application which manages the transport, connection and communication between a head unit and mobile device. + +* OS and Hardware + ========= + Ubuntu 12.04.1 LTS 32-bit OS on the PC with USB-dongle + Application has been tested using 2 types of USB-dongle: + D-Link DBT-122 + STLab B-121mini + + * External components + =================== + For start application we need: + libbluetooth3, the BlueZ library + Install library: + sudo apt-get install libbluetooth3 + To start web-based HMI we need web-browser with web-socket RFC6455 support. + For example Google Chromium. Install it using: + sudo apt-get install chromium-browser + In current implementation Chromium is required for autostart HMI feature. + For HMI autostart please create in the executable folder file named hmi_link. + This file should contain one string with full path to HMI index.html file. + For example: + /home/user/projects/smart_device_link/src/components/HMI/index.html + +* Running application + ==================== + Plug USB-dongle in. + Switch Bluetooth on a mobile device ON and make the device discoverable. + Pair mobile device with PC using Ubuntu tools. + Device should contain SmartDeviceLink compatible application installed. + Start application with command: + ./smartDeviceLinkCore + Application starts to search devices and starts HMI in cromium-browser. + In case HMI has not been started please start web-based HMI manually in browser opening src/components/HMI/index.html. + SmartDeviceLinkCore is searching Bluetooth devices with a correspondibg service. + Go to info menu in HMI and press App button. + Press change Devices button. + Select the device from a list. + Application opens all available ports on devices and starts communication. + Returning to the App menu all applications will be shown in a list. + +* Colorized logs + ============== + You can have colorized log output of smartDeviceLinkCore's messages in the terminal with the help of grc: + + 1. Make sure grc is installed: + sudo apt-get install grc + + 2. Copy the config files from the grc/ directory into ~/.grc/ directory: + mkdir ~/.grc + cp grc/* ~/.grc/ + + 3. Add an alias to your shell's config (usually, ~/.bashrc or ~/.zshrc): + alias grca='grc -es --colour=auto' + + Either restart the shell session or source the edited file: + source ~/.bashrc + or + source ~/.zshrc + + 4. Start the smartDeviceLink core with the following command: + grca ./smartDeviceLinkCore + + 5. PROFIT + diff --git a/src/components/policy/src/policy/CMakeLists.txt b/src/components/policy/src/policy/CMakeLists.txt new file mode 100644 index 0000000000..37a8d43608 --- /dev/null +++ b/src/components/policy/src/policy/CMakeLists.txt @@ -0,0 +1,101 @@ +# Copyright (c) 2013, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +set(target Policy) +set(install_destination bin) +set(copy_destination ${CMAKE_BINARY_DIR}/src/appMain) +set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + + +#Generation of policy table interface... +#include(${CMAKE_SOURCE_DIR}/tools/intergen/GenerateInterfaceLibrary.cmake) + +include_directories ( + ./include + ./usage_statistics/include + ${CMAKE_SOURCE_DIR}/src/components/rpc_base/include + ${JSONCPP_INCLUDE_DIRECTORY} + #${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/src/components/utils/include/ + ${CMAKE_SOURCE_DIR}/src/components/config_profile/include + ${LOG4CXX_INCLUDE_DIRECTORY} +) + +set(SOURCES + ./src/policy_manager_impl.cc + ./src/policy_helper.cc + ./src/policy_table.cc + ./src/sql_pt_queries.cc + ./src/sql_pt_representation.cc + ./src/update_status_manager.cc + ./src/cache_manager.cc + ${CMAKE_SOURCE_DIR}/src/components/rpc_base/src/rpc_base/rpc_base.cc +) + + +add_subdirectory(usage_statistics) + +include_directories(./policy_table/table_struct) +add_subdirectory(policy_table/table_struct) + +set(LIBRARIES ConfigProfile policy_struct dbms jsoncpp Utils) +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + # --- QDB Wrapper + include_directories (qdb_wrapper/include) + add_subdirectory(qdb_wrapper) +else () + # --- SQLite Wrapper + include_directories (sqlite_wrapper/include) + add_subdirectory(sqlite_wrapper) + list(APPEND LIBRARIES sqlite3) +endif () + +add_library(${target} SHARED ${SOURCES}) +target_link_libraries(${target} ${LIBRARIES} ) + +if(ENABLE_LOG) + target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) +endif() + +add_custom_target(copy_library_${target} ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${CMAKE_CURRENT_BINARY_DIR}/${library_name} + ${copy_destination} + DEPENDS ${target} + COMMENT "Copying library ${library_name}") + +install(TARGETS ${target} + DESTINATION ${install_destination} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE +) diff --git a/src/components/policy/src/policy/Readme.txt b/src/components/policy/src/policy/Readme.txt new file mode 100644 index 0000000000..370fab238a --- /dev/null +++ b/src/components/policy/src/policy/Readme.txt @@ -0,0 +1,3 @@ +To use SQLite and SQLite wrapper need to install libsqlite3-0 and libsqlite3-dev packages. +To use QDB and QDB wrapper on QNX need to install SDP QNX 6.5.0 and run qdb server. +To start qdb server need use script qdbserver.sh from directory qdb_wrapper. diff --git a/src/components/policy/src/policy/include/policy/cache_manager.h b/src/components/policy/src/policy/include/policy/cache_manager.h new file mode 100644 index 0000000000..4783a39791 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/cache_manager.h @@ -0,0 +1,595 @@ +/* +* Copyright (c) 2014, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_CACHE_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_CACHE_MANAGER_H_ + +#include <map> + +#include "utils/shared_ptr.h" +#include "policy/pt_representation.h" +#include "policy/pt_ext_representation.h" +#include "utils/lock.h" +#include "usage_statistics/statistics_manager.h" +#include "policy/cache_manager_interface.h" + +namespace policy { + +class CacheManager : public CacheManagerInterface { + public: + CacheManager(); + + /** + * @brief Check if specified RPC for specified application + * has permission to be executed in specified HMI Level + * and also its permitted params. + * @param app_id Id of application provided during registration + * @param hmi_level Current HMI Level of application + * @param rpc Name of RPC + * @return CheckPermissionResult containing flag if HMI Level is allowed + * and list of allowed params. + */ + virtual void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + CheckPermissionResult& result); + + /** + * @brief Returns true if Policy Table was not updated yet + * from preloaded pt file. + */ + virtual bool IsPTPreloaded(); + + /** + * Gets number of ignition cycles before next update policy table + * @return number of ignition cycles + */ + virtual int IgnitionCyclesBeforeExchange(); + + /** + * Gets value in kilometers before next update policy table + * @param current value in kilometers from the odometers + * @return value in kilometers + */ + virtual int KilometersBeforeExchange(int current); + + /** + * @brief Sets kilometers and days after epoch, that passed for recieved + * successful PT UPdate + */ + virtual bool SetCountersPassedForSuccessfulUpdate(int kilometers, + int days_after_epoch); + + /** + * Gets value in days before next update policy table + * @param current value in days after epoch + * @return value in days + */ + virtual int DaysBeforeExchange(int current); + + /** + * @brief Increment number of ignition cycles since last exchange by 1 + */ + virtual void IncrementIgnitionCycles(); + + /** + * @brief Reset number of ignition cycles since last exchange to 0 + */ + virtual void ResetIgnitionCycles(); + + /** + * @brief Returns timeout to wait for a response of PT update + * @return value in seconds + */ + virtual int TimeoutResponse(); + + /** + * @brief Returns number of seconds between each try of sending PTS + * @param seconds Return value: array of 5 elements + * @return bool Success of operation + */ + virtual bool SecondsBetweenRetries(std::vector<int> &seconds); + + /** + * @brief Get information about vehicle + */ + virtual VehicleData GetVehicleData(); + + /** + * @brief Allows to update 'vin' field in module_meta table. + * + * @param new 'vin' value. + * + * @return true in case when data has been successfully updated, + * false otherwise. + */ + bool SetVINValue(const std::string& value); + + /** + * @brief Get message text for displaying/pronouncing for user + * dependent on language and context. + * @param msg_codes Context of message (Driver distraction, Grant permission etc) + * @param language Language of the message + * @return Array of appropriate messages parameters + */ + std::vector<UserFriendlyMessage> GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, const std::string& language); + + /** + * @brief Get list of URL to send PTS to + * @param service_type If URLs for specific service are preset, + * return them otherwise default URLs. + */ + virtual EndpointUrls GetUpdateUrls(int service_type); + + /** + * @brief Get allowed number of notifications + * depending on application priority. + * @param priority Priority of application + */ + virtual int GetNotificationsNumber(const std::string& priority); + + /** + * @brief Get priority for given application + * @param policy_app_id Unique application id + * @param priority Priority for application or empty, if value was not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetPriority(const std::string& policy_app_id, + std::string& priority); + + /** + * @brief Initialized Policy Table (load) + * @return bool Success of operation + */ + bool Init(const std::string& file_name); + + /** + * @brief Get snapshot of Policy Table + * including app_policies, functional_groups, + * device_info, statistics, excluding user messages + * @return Generated structure for obtaining Json string. + */ + virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot(); + + /** + * Applies policy table to the current table + * @param update_pt policy table + * @return true if successfully + */ + bool ApplyUpdate(const policy_table::Table& update_pt); + + /** + * Gets flag updateRequired + * @return true if update is required + */ + bool UpdateRequired() const; + + /** + * @brief Saves flag updateRequired + * @param status update status if true then update required. + */ + void SaveUpdateRequired(bool status); + + /** + * @brief GetInitialAppData Retrieves data from app_policies + * about app on its registration + * @param app_id id of registered app. + * All outputs are filled in only if not null + * @param nicknames Synonyms for application + * @param app_hmi_types app_types Section on HMI where app can + * appear (Navigation, Phone etc) + * @return true in case initial application data was obtained successfuly. + */ + bool GetInitialAppData(const std::string& app_id, + StringArray& nicknames, + StringArray& app_hmi_types); + + /** + * Checks if the application is revoked + * @param app_id application id + * @return true if application is revoked + */ + bool IsApplicationRevoked(const std::string& app_id); + + /** + * @brief Get functional groupings from DB + * @param groups Known functional groupings + * @return true, if succeeded, otherwise - false + */ + bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups); + + /** + * Checks if the application is represented in policy table + * @param app_id application id + * @return true if application is represented in policy table + */ + bool IsApplicationRepresented(const std::string& app_id) const; + + /** + * Checks if the application has default policy + * @param app_id application id + * @return true if application has default policy + */ + bool IsDefaultPolicy(const std::string& app_id); + + /** + * @brief SetIsDefault Sets is_default flag for application + * @param app_id app specific application + * @param is_default true if default false otherwise. + * @return true in case opperation was done successfully. + */ + bool SetIsDefault(const std::string& app_id, bool is_default); + + /** + * Checks if the application has pre_data policy + * @param app_id application id + * @return true if application has pre_data policy + */ + bool IsPredataPolicy(const std::string& app_id); + + /** + * Sets default policy for application + * @param app_id application id + * @return true if success + */ + bool SetDefaultPolicy(const std::string& app_id); + + /** + * @brief Is application allowed to send notifications while in + * Backgound or limited mode. + * @param app_id Application id + * @return bool Allowed/disallowed. + */ + bool CanAppKeepContext(const std::string& app_id); + + /** + * @brief Is application allowed to move foreground at will? + * @param app_id Application id + * @return bool Allowed/disallowed. + */ + bool CanAppStealFocus(const std::string& app_id); + + /** + * @brief Get default_hmi for given application + * @param policy_app_id Unique application id + * @param default_hmi Default HMI level for application or empty, if value was + * not set + * @return true, if succedeed, otherwise - false + */ + bool GetDefaultHMI(const std::string& app_id, + std::string &default_hmi); + + /** + * @brief Reset user consent for device data and applications permissions + * @return + */ + bool ResetUserConsent(); + + /** + * @brief Get user permissions for device data usage + * @param device_id Generated or obtained id of device + * @param consented_groups Groups consented by user + * @param disallowed_groups Groups not consented by user + * @return true, if query was successfull, otherwise - false + */ + bool GetUserPermissionsForDevice(const std::string& device_id, + StringArray &consented_groups, + StringArray &disallowed_groups); + + /** + * @brief Gets list of groups permissions from policy table + * @param device_id Unique device id, which hosts specific application + * @param policy_app_id Unique application id + * @param group_types Group list sorted by permission status + * @return true, if query was successfull, otherwise - false + */ + bool GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType &group_types); + + /** + * @brief Get device groups and preconsented groups from policies section + * @param groups List of groups to be consented for device usage + * @param preconsented_groups List of preconsented groups for device usage + * @return true, if query was successful, otherwise - false + */ + bool GetDeviceGroupsFromPolicies( + rpc::policy_table_interface_base::Strings &groups, + rpc::policy_table_interface_base::Strings &preconsented_groups); + + /** + * @brief Record information about mobile device in Policy Table. + * @param device_id Generated or obtained id of device + * @return bool Success of operation + */ + bool SetDeviceData(const std::string& device_id, + const std::string& hardware = "", + const std::string& firmware = "", + const std::string& os = "", + const std::string& os_version = "", + const std::string& carrier = "", + const uint32_t number_of_ports = 0, + const std::string& connection_type = ""); + + /** + * @brief Sets user consent for particular mobile device, + * i.e. to use device for exchanging of Policy Table. + * @return bool Success of operation + */ + bool SetUserPermissionsForDevice( + const std::string& device_id, + const StringArray& consented_groups = StringArray(), + const StringArray& disallowed_groups = StringArray()); + + /** + * @brief Update Application Policies as reaction + * on User allowing/disallowing device this app is running on. + */ + bool ReactOnUserDevConsentForApp(const std::string& app_id, + bool is_device_allowed); + + /** + * @brief Set user consent on functional groups + * @param permissions User consent on functional group + * @return true, if operation succedeed, otherwise - false + */ + bool SetUserPermissionsForApp(const PermissionConsent& permissions); + + /** + * @brief Records information about head unit system to PT + * @return bool Success of operation + */ + bool SetMetaInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language); + + /** + * @brief Checks, if specific head unit is present in PT + * @return boot Suceess, if present, otherwise - false + */ + bool IsMetaInfoPresent() const; + + /** + * @brief Set current system language + * @param language System language + * @return true, if succedeed, otherwise - false + */ + bool SetSystemLanguage(const std::string& language); + + /** + * Increments global counter + * @param type type of counter + */ + void Increment(usage_statistics::GlobalCounterId type); + + /** + * Increments counter of application + * @param app_id id application + * @param type type of counter + */ + void Increment(const std::string& app_id, + usage_statistics::AppCounterId type); + + /** + * Sets value of application information + * @param app_id id application + * @param type type of information + * @param value value of information + */ + void Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value); + + /** + * Adds value to stopwatch of application + * @param app_id id application + * @param type type of stopwatch + * @param seconds value for adding in seconds + */ + void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int seconds); + + /** + * @brief CountUnconsentedGroups allows to obtain the count of unconsented + * groups for specific application. + * @param policy_app_id application id. + * @param device_id device id. + * @param result the count of unconsented groups + * @return true in case opperation has been done successfully. + */ + bool CountUnconsentedGroups(const std::string& policy_app_id, + const std::string& device_id, + int& result); + + /** + * @brief Gets functional group names and user_consent_prompts, if any + * @param Array to be filled with group ids, names and functional prompts + * @return true, if succeeded, otherwise - false + */ + bool GetFunctionalGroupNames(FunctionalGroupNames& names); + + /** + * @brief GetAllAppGroups allows to obtain all groups for certain application. + * @param app_id specific application id. + * @param all_group_ids parameter to fill. + */ + void GetAllAppGroups(const std::string& app_id, + FunctionalGroupIDs& all_group_ids); + /** + * @brief GetPreConsentedGroups allows to obtain all pre-consented groups for + * specific application. + * @param app_id specific application id. + * @param preconsented_groups parameter to fill. + */ + void GetPreConsentedGroups(const std::string &app_id, + FunctionalGroupIDs& preconsented_groups); + /** + * @brief GetConsentedGroups allows to obtain list of allowed and disallowed + * groups for specific application on certain device. + * @param device_id certain device + * @param app_id application id. + * @param allowed_groups list of allowed groups + * @param disallowed_groups list of disallowed groups + */ + void GetConsentedGroups(const std::string &device_id, + const std::string &app_id, + FunctionalGroupIDs& allowed_groups, + FunctionalGroupIDs& disallowed_groups); + + /** + * @brief GetUnconsentedGroups allows to obtain list of allowed and disallowed + * groups for specific application on certain device. + * @param device_id certain device + * @param policy_app_id application id. + * @param unconsented_groups list of unconsented groups. + */ + void GetUnconsentedGroups(const std::string& device_id, + const std::string& policy_app_id, + FunctionalGroupIDs& unconsented_groups); + + void RemoveAppConsentForGroup(const std::string& app_id, + const std::string& group_name); + + /** + * @brief Set app policy to pre_DataConsented policy + * @param app_id Policy ID of application to be changed + * @return true, if succeeded, otherwise - false + */ + bool SetPredataPolicy(const std::string& app_id); + + /** + * @brief Updates application policy to either pre_DataConsented or not + * @param app_id Policy Id of application to be checked + * @param is_pre_data True of False to setting app policy to be pre_DataConsented + * @return true, if succeeded, otherwise - false + */ + bool SetIsPredata(const std::string& app_id, bool is_pre_data); + + /** + * @brief Removes unpaired devices + * @return true if success + */ + bool CleanupUnpairedDevices(const DeviceIds& device_ids); + + /** + * Sets flag of unpaired device + * @param device_id + * @return true if success + */ + bool SetUnpairedDevice(const std::string& device_id); + + /** + * Gets list of unpaired devices + * @param device_ids output list + * @return true if success + */ + bool UnpairedDevicesList(DeviceIds& device_ids); + + /** + * Resets Policy Table + * @param file_name Path to preloaded PT file + * @return true if successfully + */ + bool ResetPT(const std::string& file_name); + + /** + * @brief LoadFromBackup allows to load policy into the cache from backup. + * @return true in case operation was successful. + */ + bool LoadFromBackup(); + + /** + * @brief LoadFromFile allows to load policy cache from preloaded table. + * @param file_name preloaded + * @return + */ + bool LoadFromFile(const std::string& file_name); + + /** + * @brief Backup allows to save cache onto hard drive. + */ + void Backup(); + + /** + * Returns heart beat timeout + * @param app_id application id + * @return if timeout was set then value in seconds greater zero + * otherwise heart beat for specific application isn't set + */ + uint16_t HeartBeatTimeout(const std::string& app_id) const; + + /** + * @brief Allows to generate hash from the specified string. + * The djb2 algorithm uses for hash generation. + * @param str_to_hash - the string from which hash should be generated. + * @return integer hash for the specified string. + */ + static int32_t GenerateHash(const std::string& str_to_hash); + +private: + std::string currentDateTime(); + struct AppHMITypeToString { + std::string operator()(rpc::Enum<policy_table::AppHMIType> value) { + return std::string( + policy_table::EnumToJsonString(value)); + } + }; + + void GetGroupNameByHashID(const int32_t group_id, std::string& group_name); + void FillDeviceSpecificData(); + void FillAppSpecificData(); + bool AppExists(const std::string& app_id) const; + void CopyInternalParams(const std::string &from, const std::string& to); + long ConvertSecondsToMinute(int seconds); + + /** + * @brief Checks snapshot initialization and initializes to default values, if + * necessary + */ + void CheckSnapshotInitialization(); + +private: + utils::SharedPtr<policy_table::Table> pt_; + utils::SharedPtr<policy_table::Table> snapshot_; + utils::SharedPtr<PTRepresentation> backup_; + utils::SharedPtr<PTExtRepresentation> ex_backup_; + bool update_required; + std::map<std::string, bool> is_predata_; + std::map<std::string, bool> is_unpaired_; + + sync_primitives::Lock cache_lock_; +}; +} // policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_CACHE_MANAGER_H_ diff --git a/src/components/policy/src/policy/include/policy/cache_manager_interface.h b/src/components/policy/src/policy/include/policy/cache_manager_interface.h new file mode 100644 index 0000000000..a88ae1a901 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/cache_manager_interface.h @@ -0,0 +1,555 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_SRC_POLICY_INCLUDE_POLICY_CACHE_MANAGER_INTERFACE_H_ +#define SRC_COMPONENTS_POLICY_SRC_POLICY_INCLUDE_POLICY_CACHE_MANAGER_INTERFACE_H_ + +#include <string> +#include <vector> + +#include "utils/shared_ptr.h" +#include "usage_statistics/counter.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { + +class CacheManagerInterface { + public: + virtual ~CacheManagerInterface() { + } + + /** + * @brief Check if specified RPC for specified application + * has permission to be executed in specified HMI Level + * and also its permitted params. + * @param app_id Id of application provided during registration + * @param hmi_level Current HMI Level of application + * @param rpc Name of RPC + * @return CheckPermissionResult containing flag if HMI Level is allowed + * and list of allowed params. + */ + virtual void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, const PTString& rpc, + CheckPermissionResult& result) = 0; + + /** + * @brief Returns true if Policy Table was not updated yet + * from preloaded pt file. + */ + virtual bool IsPTPreloaded() = 0; + + /** + * Gets number of ignition cycles before next update policy table + * @return number of ignition cycles + */ + virtual int IgnitionCyclesBeforeExchange() = 0; + + /** + * Gets value in kilometers before next update policy table + * @param current value in kilometers from the odometers + * @return value in kilometers + */ + virtual int KilometersBeforeExchange(int current) = 0; + + /** + * @brief Sets kilometers and days after epoch, that passed for recieved + * successful PT UPdate + */ + virtual bool SetCountersPassedForSuccessfulUpdate(int kilometers, + int days_after_epoch) = 0; + + /** + * Gets value in days before next update policy table + * @param current value in days after epoch + * @return value in days + */ + virtual int DaysBeforeExchange(int current) = 0; + + /** + * @brief Increment number of ignition cycles since last exchange by 1 + */ + virtual void IncrementIgnitionCycles() = 0; + + /** + * @brief Reset number of ignition cycles since last exchange to 0 + */ + virtual void ResetIgnitionCycles() = 0; + + /** + * @brief Returns timeout to wait for a response of PT update + * @return value in seconds + */ + virtual int TimeoutResponse() = 0; + + /** + * @brief Returns number of seconds between each try of sending PTS + * @param seconds Return value: array of 5 elements + * @return bool Success of operation + */ + virtual bool SecondsBetweenRetries(std::vector<int> &seconds) = 0; + + /** + * @brief Get information about vehicle + */ + virtual VehicleData GetVehicleData() = 0; + + /** + * @brief Allows to update 'vin' field in module_meta table. + * + * @param new 'vin' value. + * + * @return true in case when data has been successfully updated, + * false otherwise. + */ + virtual bool SetVINValue(const std::string& value) = 0; + + /** + * @brief Get message text for displaying/pronouncing for user + * dependent on language and context. + * @param msg_codes Context of message (Driver distraction, Grant permission etc) + * @param language Language of the message + * @return Array of appropriate messages parameters + */ + virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, + const std::string& language) = 0; + + /** + * @brief Get list of URL to send PTS to + * @param service_type If URLs for specific service are preset, + * return them otherwise default URLs. + */ + virtual EndpointUrls GetUpdateUrls(int service_type) = 0; + + /** + * @brief Get allowed number of notifications + * depending on application priority. + * @param priority Priority of application + */ + virtual int GetNotificationsNumber(const std::string& priority) = 0; + + /** + * @brief Get priority for given application + * @param policy_app_id Unique application id + * @param priority Priority for application or empty, if value was not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetPriority(const std::string& policy_app_id, + std::string& priority) = 0; + + /** + * @brief Initialized Policy Table (load) + * @return bool Success of operation + */ + virtual bool Init(const std::string& file_name) = 0; + + /** + * @brief Get snapshot of Policy Table + * including app_policies, functional_groups, + * device_info, statistics, excluding user messages + * @return Generated structure for obtaining Json string. + */ + virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0; + + /** + * Applies policy table to the current table + * @param update_pt policy table + * @return true if successfully + */ + virtual bool ApplyUpdate(const policy_table::Table& update_pt) = 0; + + /** + * Gets flag updateRequired + * @return true if update is required + */ + virtual bool UpdateRequired() const = 0; + + /** + * @brief Saves flag updateRequired + * @param status update status if true then update required. + */ + virtual void SaveUpdateRequired(bool status) = 0; + + /** + * @brief GetInitialAppData Retrieves data from app_policies + * about app on its registration + * @param app_id id of registered app. + * All outputs are filled in only if not null + * @param nicknames Synonyms for application + * @param app_hmi_types app_types Section on HMI where app can + * appear (Navigation, Phone etc) + * @return true in case initial application data was obtained successfuly. + */ + virtual bool GetInitialAppData(const std::string& app_id, + StringArray& nicknames, + StringArray& app_hmi_types) = 0; + + /** + * Checks if the application is revoked + * @param app_id application id + * @return true if application is revoked + */ + virtual bool IsApplicationRevoked(const std::string& app_id) = 0; + + /** + * @brief Get functional groupings from DB + * @param groups Known functional groupings + * @return true, if succeeded, otherwise - false + */ + virtual bool GetFunctionalGroupings( + policy_table::FunctionalGroupings& groups) = 0; + + /** + * Checks if the application is represented in policy table + * @param app_id application id + * @return true if application is represented in policy table + */ + virtual bool IsApplicationRepresented(const std::string& app_id) const = 0; + + /** + * Checks if the application has default policy + * @param app_id application id + * @return true if application has default policy + */ + virtual bool IsDefaultPolicy(const std::string& app_id) = 0; + + /** + * @brief SetIsDefault Sets is_default flag for application + * @param app_id app specific application + * @param is_default true if default false otherwise. + * @return true in case opperation was done successfully. + */ + virtual bool SetIsDefault(const std::string& app_id, bool is_default) = 0; + + /** + * Checks if the application has pre_data policy + * @param app_id application id + * @return true if application has pre_data policy + */ + virtual bool IsPredataPolicy(const std::string& app_id) = 0; + + /** + * Sets default policy for application + * @param app_id application id + * @return true if success + */ + virtual bool SetDefaultPolicy(const std::string& app_id) = 0; + + /** + * @brief Is application allowed to send notifications while in + * Backgound or limited mode. + * @param app_id Application id + * @return bool Allowed/disallowed. + */ + virtual bool CanAppKeepContext(const std::string& app_id) = 0; + + /** + * @brief Is application allowed to move foreground at will? + * @param app_id Application id + * @return bool Allowed/disallowed. + */ + virtual bool CanAppStealFocus(const std::string& app_id) = 0; + + /** + * @brief Get default_hmi for given application + * @param policy_app_id Unique application id + * @param default_hmi Default HMI level for application or empty, if value was + * not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetDefaultHMI(const std::string& app_id, + std::string &default_hmi) = 0; + + /** + * @brief Reset user consent for device data and applications permissions + * @return + */ + virtual bool ResetUserConsent() = 0; + + /** + * @brief Get user permissions for device data usage + * @param device_id Generated or obtained id of device + * @param consented_groups Groups consented by user + * @param disallowed_groups Groups not consented by user + * @return true, if query was successfull, otherwise - false + */ + virtual bool GetUserPermissionsForDevice(const std::string& device_id, + StringArray &consented_groups, + StringArray &disallowed_groups) = 0; + + /** + * @brief Gets list of groups permissions from policy table + * @param device_id Unique device id, which hosts specific application + * @param policy_app_id Unique application id + * @param group_types Group list sorted by permission status + * @return true, if query was successfull, otherwise - false + */ + virtual bool GetPermissionsForApp(const std::string& device_id, + const std::string& app_id, + FunctionalIdType &group_types) = 0; + + /** + * @brief Get device groups and preconsented groups from policies section + * @param groups List of groups to be consented for device usage + * @param preconsented_groups List of preconsented groups for device usage + * @return true, if query was successful, otherwise - false + */ + virtual bool GetDeviceGroupsFromPolicies( + rpc::policy_table_interface_base::Strings &groups, + rpc::policy_table_interface_base::Strings &preconsented_groups) = 0; + + /** + * @brief Record information about mobile device in Policy Table. + * @param device_id Generated or obtained id of device + * @return bool Success of operation + */ + virtual bool SetDeviceData(const std::string& device_id, + const std::string& hardware, + const std::string& firmware, const std::string& os, + const std::string& os_version, + const std::string& carrier, + const uint32_t number_of_ports, + const std::string& connection_type) = 0; + + /** + * @brief Sets user consent for particular mobile device, + * i.e. to use device for exchanging of Policy Table. + * @return bool Success of operation + */ + virtual bool SetUserPermissionsForDevice( + const std::string& device_id, const StringArray& consented_groups, + const StringArray& disallowed_groups) = 0; + + /** + * @brief Update Application Policies as reaction + * on User allowing/disallowing device this app is running on. + */ + virtual bool ReactOnUserDevConsentForApp(const std::string& app_id, + bool is_device_allowed) = 0; + + /** + * @brief Set user consent on functional groups + * @param permissions User consent on functional group + * @return true, if operation succedeed, otherwise - false + */ + virtual bool SetUserPermissionsForApp( + const PermissionConsent& permissions) = 0; + + /** + * @brief Records information about head unit system to PT + * @return bool Success of operation + */ + virtual bool SetMetaInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) = 0; + + /** + * @brief Checks, if specific head unit is present in PT + * @return boot Suceess, if present, otherwise - false + */ + virtual bool IsMetaInfoPresent() const = 0; + + /** + * @brief Set current system language + * @param language System language + * @return true, if succedeed, otherwise - false + */ + virtual bool SetSystemLanguage(const std::string& language) = 0; + + /** + * Increments global counter + * @param type type of counter + */ + virtual void Increment(usage_statistics::GlobalCounterId type) = 0; + + /** + * Increments counter of application + * @param app_id id application + * @param type type of counter + */ + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type) = 0; + + /** + * Sets value of application information + * @param app_id id application + * @param type type of information + * @param value value of information + */ + virtual void Set(const std::string& app_id, usage_statistics::AppInfoId type, + const std::string& value) = 0; + + /** + * Adds value to stopwatch of application + * @param app_id id application + * @param type type of stopwatch + * @param seconds value for adding in seconds + */ + virtual void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, int seconds) = 0; + + /** + * @brief CountUnconsentedGroups allows to obtain the count of unconsented + * groups for specific application. + * @param policy_app_id application id. + * @param device_id device id. + * @param result the count of unconsented groups + * @return true in case opperation has been done successfully. + */ + virtual bool CountUnconsentedGroups(const std::string& policy_app_id, + const std::string& device_id, + int& result) = 0; + + /** + * @brief Gets functional group names and user_consent_prompts, if any + * @param Array to be filled with group ids, names and functional prompts + * @return true, if succeeded, otherwise - false + */ + virtual bool GetFunctionalGroupNames(FunctionalGroupNames& names) = 0; + + /** + * @brief GetAllAppGroups allows to obtain all groups for certain application. + * @param app_id specific application id. + * @param all_group_ids parameter to fill. + */ + virtual void GetAllAppGroups(const std::string& app_id, + FunctionalGroupIDs& all_group_ids) = 0; + /** + * @brief GetPreConsentedGroups allows to obtain all pre-consented groups for + * specific application. + * @param app_id specific application id. + * @param preconsented_groups parameter to fill. + */ + virtual void GetPreConsentedGroups( + const std::string &app_id, FunctionalGroupIDs& preconsented_groups) = 0; + /** + * @brief GetConsentedGroups allows to obtain list of allowed and disallowed + * groups for specific application on certain device. + * @param device_id certain device + * @param app_id application id. + * @param allowed_groups list of allowed groups + * @param disallowed_groups list of disallowed groups + */ + virtual void GetConsentedGroups(const std::string &device_id, + const std::string &app_id, + FunctionalGroupIDs& allowed_groups, + FunctionalGroupIDs& disallowed_groups) = 0; + + /** + * @brief GetUnconsentedGroups allows to obtain list of allowed and disallowed + * groups for specific application on certain device. + * @param device_id certain device + * @param policy_app_id application id. + * @param unconsented_groups list of unconsented groups. + */ + virtual void GetUnconsentedGroups(const std::string& device_id, + const std::string& policy_app_id, + FunctionalGroupIDs& unconsented_groups) = 0; + + virtual void RemoveAppConsentForGroup(const std::string& app_id, + const std::string& group_name) = 0; + + /** + * @brief Set app policy to pre_DataConsented policy + * @param app_id Policy ID of application to be changed + * @return true, if succeeded, otherwise - false + */ + virtual bool SetPredataPolicy(const std::string& app_id) = 0; + + /** + * @brief Updates application policy to either pre_DataConsented or not + * @param app_id Policy Id of application to be checked + * @param is_pre_data True of False to setting app policy to be pre_DataConsented + * @return true, if succeeded, otherwise - false + */ + virtual bool SetIsPredata(const std::string& app_id, bool is_pre_data) = 0; + + /** + * @brief Removes unpaired devices + * @return true if success + */ + virtual bool CleanupUnpairedDevices(const DeviceIds& device_ids) = 0; + + /** + * Sets flag of unpaired device + * @param device_id + * @return true if success + */ + virtual bool SetUnpairedDevice(const std::string& device_id) = 0; + + /** + * Gets list of unpaired devices + * @param device_ids output list + * @return true if success + */ + virtual bool UnpairedDevicesList(DeviceIds& device_ids) = 0; + + /** + * Resets Policy Table + * @param file_name Path to preloaded PT file + * @return true if successfully + */ + virtual bool ResetPT(const std::string& file_name) = 0; + + /** + * @brief LoadFromBackup allows to load policy into the cache from backup. + * @return true in case operation was successful. + */ + virtual bool LoadFromBackup() = 0; + + /** + * @brief LoadFromFile allows to load policy cache from preloaded table. + * @param file_name preloaded + * @return + */ + virtual bool LoadFromFile(const std::string& file_name) = 0; + + /** + * @brief Backup allows to save cache onto hard drive. + */ + virtual void Backup() = 0; + + /** + * Returns heart beat timeout + * @param app_id application id + * @return if timeout was set then value in seconds greater zero + * otherwise heart beat for specific application isn't set + */ + virtual uint16_t HeartBeatTimeout(const std::string& app_id) const = 0; +}; + +typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_SRC_POLICY_INCLUDE_POLICY_CACHE_MANAGER_INTERFACE_H_ diff --git a/src/components/policy/src/policy/include/policy/policy_helper.h b/src/components/policy/src/policy/include/policy/policy_helper.h new file mode 100644 index 0000000000..5d5c8e7edc --- /dev/null +++ b/src/components/policy/src/policy/include/policy/policy_helper.h @@ -0,0 +1,218 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_HELPER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_HELPER_H_ + +#include "./functions.h" +#include "utils/shared_ptr.h" +#include "policy/policy_types.h" + +namespace policy { +class PolicyManagerImpl; + +const std::string kAllowedKey = "allowed"; +const std::string kUserDisallowedKey = "userDisallowed"; +const std::string kUndefinedKey = "undefined"; + +namespace policy_table = rpc::policy_table_interface_base; + +typedef policy_table::Strings::const_iterator StringsConstItr; +typedef policy_table::ApplicationPolicies::const_iterator AppPoliciesConstItr; +typedef policy_table::HmiLevels::const_iterator HMILevelsConstItr; +typedef policy_table::Parameters::const_iterator ParametersConstItr; +typedef policy_table::FunctionalGroupings::const_iterator FuncGroupConstItr; + +typedef policy_table::ApplicationPolicies::value_type AppPoliciesValueType; +typedef policy_table::Rpc::value_type RpcValueType; +typedef policy_table::Strings::value_type StringsValueType; + +/* + * @brief Helper struct to compare functional group names + */ +struct CompareGroupName { + explicit CompareGroupName(const StringsValueType& group_name); + bool operator()(const StringsValueType& group_name_to_compare) const; + private: + const StringsValueType& group_name_; +}; + +/* + * @brief Used for compare of policies parameters mapped with specific + * application ids + */ +bool operator!=(const policy_table::ApplicationParams& first, + const policy_table::ApplicationParams& second); + +/* + * @brief Helper struct for checking changes of application policies, which + * come with update along with current data snapshot + * In case of policies changed for some application, current data will be + * updated and notification will be sent to application + */ +struct CheckAppPolicy { + CheckAppPolicy(PolicyManagerImpl* pm, + const utils::SharedPtr<policy_table::Table> update, + const utils::SharedPtr<policy_table::Table> snapshot); + bool HasSameGroups(const AppPoliciesValueType& app_policy, + AppPermissions* perms) const; + bool IsNewAppication(const std::string& application_id) const; + void SendNotification(const AppPoliciesValueType& app_policy) const; + void SendOnPendingPermissions(const AppPoliciesValueType& app_policy, + AppPermissions permissions) const; + bool IsAppRevoked(const AppPoliciesValueType& app_policy) const; + bool NicknamesMatch(const std::string app_id, + const AppPoliciesValueType& app_policy) const; + bool operator()(const AppPoliciesValueType& app_policy); + private: + /** + * @brief Allows to check if appropriate group requires any consent. + * @param group_name the group for which consent will be checked. + * @return true if consent is required, false otherwise. + */ + bool IsConsentRequired(const std::string& group_name) const; + PolicyManagerImpl* pm_; + const utils::SharedPtr<policy_table::Table> update_; + const utils::SharedPtr<policy_table::Table> snapshot_; +}; + +/* + * @brief Fill permissions data with merged rpc permissions for hmi levels and + * parameters + */ +struct FillNotificationData { + FillNotificationData(Permissions& data, GroupConsent group_state, + GroupConsent undefined_group_consent); + bool operator()(const RpcValueType& rpc); + void UpdateHMILevels(const policy_table::HmiLevels& in_hmi, + std::set<HMILevel>& out_hmi); + void UpdateParameters(const policy_table::Parameters& in_parameters, + std::set<Parameter>& out_parameter); + private: + void ExcludeSame(); + void ExcludeSameHMILevels(std::set<HMILevel>& source, + const std::set<HMILevel>& target); + void ExcludeSameParameters(std::set<Parameter>& source, + const std::set<Parameter>& target); + void InitRpcKeys(const std::string& rpc_name); + std::string current_key_; + Permissions& data_; +}; + +/* + * @brief Checks for functional group presence and pass it to helper struct, + * which fills permissions data according to group consent + */ +struct ProcessFunctionalGroup { + ProcessFunctionalGroup( + const policy_table::FunctionalGroupings& fg, + const std::vector<FunctionalGroupPermission>& group_permissions, + Permissions& data, + GroupConsent undefined_group_consent = GroupConsent::kGroupDisallowed); + bool operator()(const StringsValueType& group_name); + private: + GroupConsent GetGroupState(const std::string& group_name); + const policy_table::FunctionalGroupings& fg_; + const std::vector<FunctionalGroupPermission>& group_permissions_; + Permissions& data_; + GroupConsent undefined_group_consent_; +}; + +struct FunctionalGroupInserter { + FunctionalGroupInserter(const policy_table::Strings& preconsented_groups, + PermissionsList& list); + void operator()(const StringsValueType& group_name); + private: + PermissionsList& list_; + const policy_table::Strings& preconsented_; +}; + +/** + * @brief Fills FunctionalGroupPermissions with provided params + * @param ids Functional group ids from DB + * @param names Group names and user_consent_prompt + * @param state User consent for group + * @param permissions Struct to be filled with provided params + */ +void FillFunctionalGroupPermissions( + FunctionalGroupIDs& ids, + FunctionalGroupNames& names, + GroupConsent state, + std::vector<FunctionalGroupPermission>& permissions); + +/** + * @brief Checks, if application is predefined, e.g. "default", i.e. which is + * must be present in policy table + * @param app Application struct + * @return true, if app is predefined, otherwise - false + */ +bool IsPredefinedApp(const AppPoliciesValueType& app); + +/** + * @brief Excludes same values + * @param from Source, which should be checked + * @param what Target, which should be excluded from source + * @return Values without excluded + */ +FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, + const FunctionalGroupIDs& what); + +/** + * @brief Merges all values without same values + * @param first First source of values + * @param second Second source of values + * @return Merged values w/o same values + */ +FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, + const FunctionalGroupIDs& second); + +/** + * @brief Finds same values + * @param first First source of values + * @param second Second source of values + * @return Same values set, if any found + */ +FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, + const FunctionalGroupIDs& second); + +/** + * @brief Unwrap application policies from predefined values to specific policy + * values, i.e. if application has "default", it will be assigned default + * policies + * @param app_policies Application policies to unwrap + * @return true, if succeded, otherwise - false + */ +bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies); + +} + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_HELPER_H_ diff --git a/src/components/policy/src/policy/include/policy/policy_listener.h b/src/components/policy/src/policy/include/policy/policy_listener.h new file mode 100644 index 0000000000..adfcddd93b --- /dev/null +++ b/src/components/policy/src/policy/include/policy/policy_listener.h @@ -0,0 +1,66 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_LISTENER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_LISTENER_H_ + +#include "policy/policy_types.h" + +namespace policy { +class PolicyListener { + public: + virtual ~PolicyListener() { + } + virtual void OnPTExchangeNeeded() = 0; + virtual void OnPermissionsUpdated(const std::string& policy_app_id, + const Permissions& permissions, + const policy::HMILevel& default_hmi) = 0; + virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0; + virtual void OnAppRevoked(const std::string& policy_app_id) = 0; + virtual void OnUpdateStatusChanged(policy::PolicyTableStatus status) = 0; + virtual std::string OnCurrentDeviceIdUpdateRequired( + const std::string& policy_app_id) = 0; + virtual void OnSystemInfoUpdateRequired() = 0; + virtual std::string GetAppName(const std::string& policy_app_id) = 0; + virtual void OnUserRequestedUpdateCheckRequired() = 0; + + /** + * @brief Make appropriate changes for related applications permissions and + * notify them, if it possible + * @param device_id Unique device id, which consent had been changed + * @param device_consent Device consent, which is done by user + */ + virtual void OnDeviceConsentChanged(const std::string& device_id, + bool is_allowed) = 0; +}; +} // namespace policy +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_LISTENER_H_ diff --git a/src/components/policy/src/policy/include/policy/policy_manager.h b/src/components/policy/src/policy/include/policy/policy_manager.h new file mode 100644 index 0000000000..0bc553b33a --- /dev/null +++ b/src/components/policy/src/policy/include/policy/policy_manager.h @@ -0,0 +1,420 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_H_ + +#include <vector> + +#include "policy/policy_types.h" +#include "policy/policy_listener.h" +#include "usage_statistics/statistics_manager.h" + +namespace policy { + +class PolicyManager : public usage_statistics::StatisticsManager { + public: + virtual ~PolicyManager() { + } + + virtual void set_listener(PolicyListener* listener) = 0; + + /** + * Inits Policy Table + * @param file_name Path to preloaded PT file + * @return true if successfully + */ + virtual bool InitPT(const std::string& file_name) = 0; + + /** + * @brief Updates Policy Table from binary message received from + * mobile device. Saves to Policy Table diff between Policy Table + * sent in snapshot and received Policy Table. + * @param file name of file with update policy table + * @param pt_content PTU as binary string + * @return bool Success of operation + */ + virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content) = 0; + + /** + * Resets Policy Table + * @param file_name Path to preloaded PT file + * @return true if successfully + */ + virtual bool ResetPT(const std::string& file_name) = 0; + + /** + * @brief Gets URL for sending PTS to from PT itself. + * @param service_type Service specifies user of URL + * @return string URL + */ + virtual std::string GetUpdateUrl(int service_type) = 0; + + /** + * @brief Gets all URLs for sending PTS to from PT itself. + * @param service_type Service specifies user of URL + * @return vector of urls + */ + virtual EndpointUrls GetUpdateUrls(int service_type) = 0; + + /** + * @brief PTU is needed, for this PTS has to be formed and sent. + * @return BinaryMessage* PTS. + */ + virtual BinaryMessageSptr RequestPTUpdate() = 0; + + /** + * @brief Check if specified RPC for specified application + * has permission to be executed in specified HMI Level + * and also its permitted params. + * @param app_id Id of application provided during registration + * @param hmi_level Current HMI Level of application + * @param rpc Name of RPC + * @param CheckPermissionResult containing flag if HMI Level is allowed + * and list of allowed params. + */ + virtual void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, + CheckPermissionResult& result) = 0; + + /** + * @brief Clear all record of user consents. Used during Factory Reset. + * @return bool Success of operation + */ + virtual bool ResetUserConsent() = 0; + + /** + * @brief Returns current status of policy table for HMI + * @return Current status of policy table + */ + virtual PolicyTableStatus GetPolicyTableStatus() = 0; + + /** + * Checks is PT exceeded IgnitionCycles + * @return true if exceeded + */ + virtual bool ExceededIgnitionCycles() = 0; + + /** + * Checks is PT exceeded days + * @param days current day after epoch + * @return true if exceeded + */ + virtual bool ExceededDays(int days) = 0; + + /** + * Checks is PT exceeded kilometers + * @param kilometers current kilometers at odometer + * @return true if exceeded + */ + virtual bool ExceededKilometers(int kilometers) = 0; + + /** + * Increments counter of ignition cycles + */ + virtual void IncrementIgnitionCycles() = 0; + + /** + * Resets retry sequence + */ + virtual void ResetRetrySequence() = 0; + + /** + * Gets timeout to wait before next retry updating PT + * If timeout is less or equal to zero then the retry sequence is not need. + * @return timeout in seconds + */ + virtual int NextRetryTimeout() = 0; + + /** + * Gets timeout to wait until receive response + * @return timeout in seconds + */ + virtual int TimeoutExchange() = 0; + + /** + * @brief List of timeouts in seconds between retries + * when attempt to update PT fails + * @return List of delays between attempts. + */ + virtual const std::vector<int> RetrySequenceDelaysSeconds() = 0; + + /** + * Handler of exceeding timeout of exchanging policy table + */ + virtual void OnExceededTimeout() = 0; + + /** + * @brief Handler of PTS sending out + */ + virtual void OnUpdateStarted() = 0; + + /** + * @brief Check user consent for mobile device data connection + * @param device_id Unique device identifier + * @return status of device consent + */ + virtual DeviceConsent GetUserConsentForDevice( + const std::string& device_id) = 0; + + /** + * @brief Get user consent for application + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of functional groups permissions + */ + virtual void GetUserConsentForApp( + const std::string& device_id, const std::string& policy_app_id, + std::vector<FunctionalGroupPermission>& permissions) = 0; + + /** + * @brief Set user consent for mobile device data connection + * @param device_id Unique device identifier + * @param is_allowed User consent for usage device data connection + */ + virtual void SetUserConsentForDevice(const std::string& device_id, + bool is_allowed) = 0; + + /** + * @brief Update Application Policies as reaction + * on User allowing/disallowing device this app is running on. + */ + virtual bool ReactOnUserDevConsentForApp(const std::string app_id, + bool is_device_allowed) = 0; + /** + * Sets number of kilometers and days after epoch, that passed for + * receiving PT UPdate. + */ + virtual void PTUpdatedAt(int kilometers, int days_after_epoch) = 0; + + /** + * @brief Retrieves data from app_policies about app on its registration: + * @param app_id - id of registered app + * @param app_types Section on HMI where app can appear (Navigation, Phone etc) + * @param nicknames Synonyms for application + */ + virtual bool GetInitialAppData(const std::string& application_id, + StringArray* nicknames = NULL, + StringArray* app_hmi_types = NULL) = 0; + /** + * @brief Stores device parameters received during application registration + * to policy table + * @param device_id Device mac address + * @param device_info Received device parameters + */ + virtual void SetDeviceInfo(const std::string& device_id, + const DeviceInfo& device_info) = 0; + + /** + * @brief Set user consent for application functional groups + * @param permissions User-defined application group pemissions. + * The permissions is not const reference because it may contains + * valid data as well as invalid. So we will remove all invalid data + * from this structure. + */ + virtual void SetUserConsentForApp(const PermissionConsent& permissions) = 0; + + /** + * @brief Get default HMI level for application + * @param policy_app_id Unique application id + * @param default_hmi Default HMI level for application or empty, if value + * was not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetDefaultHmi(const std::string& policy_app_id, + std::string* default_hmi) = 0; + + /** + * @brief Get priority for application + * @param policy_app_id Unique application id + * @param priority Priority for application or empty, if value was not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetPriority(const std::string& policy_app_id, + std::string* priority) = 0; + + /** + * @brief Get user friendly messages for given RPC messages and language + * @param message_codes RPC message codes + * @param language Language + * @return Array of structs with appropriate message parameters + */ + virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages( + const std::vector<std::string>& message_code, + const std::string& language) = 0; + + /** + * Checks if the application is revoked + * @param app_id application id + * @return true if application is revoked + */ + virtual bool IsApplicationRevoked(const std::string& app_id) const = 0; + + /** + * @brief Get resulting RPCs permissions for application which started on + * specific device + * @param device_id Device id + * @param policy_app_id Unique application id + * @param permissions Array of functional groups permissions + */ + virtual void GetPermissionsForApp( + const std::string& device_id, const std::string& policy_app_id, + std::vector<FunctionalGroupPermission>& permissions) = 0; + + /** + * @brief Gets specific application permissions changes since last policy + * table update + * @param device_id Id of device, which hosts application + * @param policy_app_id Unique application id + * @return Permissions changes + */ + virtual AppPermissions GetAppPermissionsChanges( + const std::string& device_id, const std::string& policy_app_id) = 0; + + virtual void RemovePendingPermissionChanges(const std::string& app_id) = 0; + + /** + * @brief Return device id, which hosts specific application + * @param Application id, which is required to update device id + */ + virtual std::string& GetCurrentDeviceId(const std::string& policy_app_id) = 0; + + /** + * @brief Set current system language + * @param language Language + */ + virtual void SetSystemLanguage(const std::string& language) = 0; + + /** + * @brief Set data from GetSystemInfo response to policy table + * @param ccpu_version CCPU version + * @param wers_country_code WERS country code + * @param language System language + */ + virtual void SetSystemInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) = 0; + + /** + * @brief Send OnPermissionsUpdated for choosen application + * @param application_id + */ + virtual void SendNotificationOnPermissionsUpdated( + const std::string& application_id) = 0; + + /** + * Marks device as upaired + * @param device_id id device + */ + virtual void MarkUnpairedDevice(const std::string& device_id) = 0; + + /** + * @brief Adds, application to the db or update existed one + * run PTU if policy update is necessary for application. + * @param Application id assigned by Ford to the application + */ + virtual void AddApplication(const std::string& application_id) = 0; + + /** + * @brief IsAppInUpdateList allows to check if specific application + * presents in update list. + * @param app_id id of the application that should be verified. + * @return true in case of application is in update list, false otherwise. + */ + virtual bool IsAppInUpdateList(const std::string& app_id) const = 0; + + /** + * @brief Removes unpaired device records and related records from DB + * @param device_ids List of device_id, which should be removed + * @return true, if succedeed, otherwise - false + */ + virtual bool CleanupUnpairedDevices() = 0; + + /** + * @brief Check if app can keep context. + */ + virtual bool CanAppKeepContext(const std::string& app_id) = 0; + + /** + * @brief Check if app can steal focus. + */ + virtual bool CanAppStealFocus(const std::string& app_id) = 0; + + /** + * @brief Runs necessary operations, which is depends on external system + * state, e.g. getting system-specific parameters which are need to be + * filled into policy table + */ + virtual void OnSystemReady() = 0; + + /** + * @brief GetNotificationNumber + * @param priority + * @return + */ + virtual uint32_t GetNotificationsNumber(const std::string& priority) = 0; + + /** + * @brief Provide info about device consent for application + * @return Amount of groups for which app is allowed + */ + virtual int IsConsentNeeded(const std::string& app_id) = 0; + + /** + * @brief Allows to update Vehicle Identification Number in policy table. + * @param new value for the parameter. + */ + virtual void SetVINValue(const std::string& value) = 0; + + /** + * @brief Checks, if application has policy assigned w/o data consent + * @param policy_app_id Unique application id + * @return true, if policy assigned w/o data consent, otherwise -false + */ + virtual bool IsPredataPolicy(const std::string& policy_app_id) = 0; + + /** + * Returns heart beat timeout + * @param app_id application id + * @return if timeout was set then value in seconds greater zero + * otherwise heart beat for specific application isn't set + */ + virtual uint16_t HeartBeatTimeout(const std::string& app_id) const = 0; +}; + +} // namespace policy + +extern "C" policy::PolicyManager* CreateManager(); + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_H_ diff --git a/src/components/policy/src/policy/include/policy/policy_manager_impl.h b/src/components/policy/src/policy/include/policy/policy_manager_impl.h new file mode 100644 index 0000000000..9afb58386f --- /dev/null +++ b/src/components/policy/src/policy/include/policy/policy_manager_impl.h @@ -0,0 +1,305 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_ + +#include <list> +#include "utils/shared_ptr.h" +#include "utils/lock.h" +#include "policy/policy_manager.h" +#include "policy/policy_table.h" +#include "policy/cache_manager_interface.h" +#include "policy/update_status_manager_interface.h" +#include "./functions.h" +#include "usage_statistics/statistics_manager.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { +struct CheckAppPolicy; + +class PolicyManagerImpl : public PolicyManager { + public: + PolicyManagerImpl(); + virtual ~PolicyManagerImpl(); + virtual void set_listener(PolicyListener* listener); + PolicyListener* listener() const { + return listener_; + } + virtual bool InitPT(const std::string& file_name); + virtual bool LoadPT(const std::string& file, const BinaryMessage& pt_content); + virtual bool ResetPT(const std::string& file_name); + virtual std::string GetUpdateUrl(int service_type); + virtual EndpointUrls GetUpdateUrls(int service_type); + virtual BinaryMessageSptr RequestPTUpdate(); + virtual void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, + CheckPermissionResult& result); + virtual bool ResetUserConsent(); + virtual bool ExceededIgnitionCycles(); + virtual bool ExceededDays(int days); + virtual bool ExceededKilometers(int kilometers); + virtual void IncrementIgnitionCycles(); + virtual PolicyTableStatus GetPolicyTableStatus(); + virtual void ResetRetrySequence(); + virtual int NextRetryTimeout(); + virtual int TimeoutExchange(); + virtual const std::vector<int> RetrySequenceDelaysSeconds(); + virtual void OnExceededTimeout(); + virtual void OnUpdateStarted(); + virtual void PTUpdatedAt(int kilometers, int days_after_epoch); + + /** + * Refresh data about retry sequence from policy table + */ + virtual void RefreshRetrySequence(); + virtual DeviceConsent GetUserConsentForDevice(const std::string& device_id); + virtual void GetUserConsentForApp( + const std::string& device_id, const std::string& policy_app_id, + std::vector<FunctionalGroupPermission>& permissions); + virtual void SetUserConsentForDevice(const std::string& device_id, + bool is_allowed); + virtual bool ReactOnUserDevConsentForApp(const std::string app_id, + bool is_device_allowed); + virtual bool GetInitialAppData(const std::string& application_id, + StringArray* nicknames = NULL, + StringArray* app_hmi_types = NULL); + + virtual void SetDeviceInfo(const std::string& device_id, + const DeviceInfo& device_info); + + virtual void SetUserConsentForApp(const PermissionConsent& permissions); + + virtual bool GetDefaultHmi(const std::string& policy_app_id, + std::string* default_hmi); + + virtual bool GetPriority(const std::string& policy_app_id, + std::string* priority); + + virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages( + const std::vector<std::string>& message_code, const std::string& language); + + virtual bool IsApplicationRevoked(const std::string& app_id) const; + + virtual void GetPermissionsForApp( + const std::string& device_id, const std::string& policy_app_id, + std::vector<FunctionalGroupPermission>& permissions); + + virtual std::string& GetCurrentDeviceId(const std::string& policy_app_id); + + virtual void SetSystemLanguage(const std::string& language); + + virtual void SetSystemInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language); + virtual void OnSystemReady(); + + virtual uint32_t GetNotificationsNumber(const std::string& priority); + + virtual int IsConsentNeeded(const std::string& app_id); + + virtual void SetVINValue(const std::string& value); + + // Interface StatisticsManager (begin) + virtual void Increment(usage_statistics::GlobalCounterId type); + virtual void Increment(const std::string& app_id, + usage_statistics::AppCounterId type); + virtual void Set(const std::string& app_id, usage_statistics::AppInfoId type, + const std::string& value); + virtual void Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds); + // Interface StatisticsManager (end) + + AppPermissions GetAppPermissionsChanges(const std::string& device_id, + const std::string& policy_app_id); + void RemovePendingPermissionChanges(const std::string& app_id); + + void SendNotificationOnPermissionsUpdated(const std::string& application_id); + + bool CleanupUnpairedDevices(); + + bool CanAppKeepContext(const std::string& app_id); + bool CanAppStealFocus(const std::string& app_id); + void MarkUnpairedDevice(const std::string& device_id); + + void AddApplication(const std::string& application_id); + + /** + * @brief IsAppinUpdateList + * @param app_id + * @return + */ + virtual bool IsAppInUpdateList(const std::string& app_id) const; + + virtual void RemoveAppConsentForGroup(const std::string& app_id, + const std::string& group_name); + + virtual uint16_t HeartBeatTimeout(const std::string& app_id) const; + + virtual bool IsPredataPolicy(const std::string& policy_app_id); + void set_cache_manager(CacheManagerInterface* cache_manager); + void set_update_status_manager( + UpdateStatusManagerInterface* update_manager); + + protected: + virtual utils::SharedPtr<policy_table::Table> Parse( + const BinaryMessage& pt_content); + + private: + /* + * @brief Checks policy table update along with current data for any changes + * in assigned functional group list of application + * + * @param Policy table update struct + */ + void CheckPermissionsChanges( + const utils::SharedPtr<policy_table::Table> update, + const utils::SharedPtr<policy_table::Table> snapshot); + + /** + * @brief Fill structure to be sent with OnPermissionsChanged notification + * + * @param Policy table struct, which contains rpc functional groups data + * @param List of rpc functional group names, which should be checked + * @param group_permission User permissions for functional groups + * @param Notification struct to be filled and sent + */ + void PrepareNotificationData( + const policy_table::FunctionalGroupings& groups, + const policy_table::Strings& group_names, + const std::vector<FunctionalGroupPermission>& group_permission, + Permissions& notification_data); + + /** + * @brief Add application id at the end of update permissions request list + * @param Application id + */ + void AddAppToUpdateList(const std::string& application_id); + + /** + * @brief Remove first application in the update permissions request list + */ + void RemoveAppFromUpdateList(); + + /** + * @brief Validate PermissionConsent structure according to currently + * assigned groups + * @param permissions PermissionConsent structure that should be validated. + * @return PermissonConsent struct, which contains no foreign groups + */ + PermissionConsent EnsureCorrectPermissionConsent( + const PermissionConsent& permissions_to_check); + + /** + * @brief Allows to process case when added application is not present in + * policy db. + * @param policy application id. + * @param cuuren consent for application's device. + */ + void AddNewApplication(const std::string& application_id, + DeviceConsent device_consent); + + /** + * @brief Allows to process case when added application is already + * in policy db. + * @param policy application id. + * @param cuuren consent for application's device. + */ + void PromoteExistedApplication(const std::string& application_id, + DeviceConsent device_consent); + + /** + * @brief Check if certain application already in policy db. + * @param policy application id. + * @return true if application presents false otherwise. + */ + bool IsNewApplication(const std::string& application_id) const; + + PolicyListener* listener_; + + UpdateStatusManagerInterfaceSPtr update_status_manager_; + CacheManagerInterfaceSPtr cache_; + sync_primitives::Lock update_request_list_lock_; + sync_primitives::Lock apps_registration_lock_; + std::map<std::string, AppPermissions> app_permissions_diff_; + + /** + * @brief List of application, which require update of permissions + */ + std::list<std::string> update_requests_list_; + + /** + * Timeout to wait response with UpdatePT + */ + int retry_sequence_timeout_; + + /** + * Seconds between retries to update PT + */ + std::vector<int> retry_sequence_seconds_; + + /** + * Current index trying of retry sequence + */ + uint32_t retry_sequence_index_; + + /** + * Lock for guarding retry sequence + */ + sync_primitives::Lock retry_sequence_lock_; + + /** + * Lock for guarding recording statistics + */ + sync_primitives::Lock statistics_lock_; + + /** + * @brief Device id, which is used during PTU handling for specific + * application + */ + std::string last_device_id_; + + /** + * @brief Holds device ids, which were unpaired + */ + DeviceIds unpaired_device_ids_; + + friend struct CheckAppPolicy; +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_ diff --git a/src/components/policy/src/policy/include/policy/policy_table.h b/src/components/policy/src/policy/include/policy/policy_table.h new file mode 100644 index 0000000000..fdd4c9c2fc --- /dev/null +++ b/src/components/policy/src/policy/include/policy/policy_table.h @@ -0,0 +1,62 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TABLE_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TABLE_H_ + +#include "utils/shared_ptr.h" +#include "policy/pt_representation.h" +#include "policy/pt_ext_representation.h" + +namespace policy { + +class PolicyTable { + public: + PolicyTable(); + explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data); + virtual ~PolicyTable(); + + /** + * @brief Returns current implementation of + * actual class storing policy table. + * @return PTRepresentation* Policy Table Content Handler + */ + utils::SharedPtr<PTRepresentation> pt_data() const { + return pt_data_; + } + + private: + utils::SharedPtr<PTRepresentation> pt_data_; +}; +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TABLE_H_ diff --git a/src/components/policy/src/policy/include/policy/policy_types.h b/src/components/policy/src/policy/include/policy/policy_types.h new file mode 100644 index 0000000000..ec3f660f26 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/policy_types.h @@ -0,0 +1,312 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_ + +#include <string> +#include <vector> +#include <map> +#include <set> +#include "utils/shared_ptr.h" + +namespace policy { + +// TODO(PV): specify errors +enum PolicyErrorEnum { +}; + +const std::string kDefaultDeviceMacAddress = "00:00:00:00:00:00"; +const std::string kDefaultDeviceName = "MyDevice"; +const std::string kDefaultDeviceConnectionType = "UNKNOWN"; + +/** + * @brief Constants for special ids in application policies section of + * policy table + */ +const std::string kPreDataConsentId = "pre_DataConsent"; +const std::string kDefaultId = "default"; +const std::string kDeviceId = "device"; + +/* + *@brief Policy Services specifies Users of Updates + * received from cloud through mobile device + */ +enum PolicyServiceTypes { + SERVICE_NONE = 0, + IVSU = 0x04, + POLICY = 0x07 +}; + +/* + * @brief Status of policy table update + */ +enum PolicyTableStatus { + StatusUpToDate = 0, + StatusUpdatePending, + StatusUpdateRequired, + StatusUnknown +}; + +// Code generator uses String class name, so this typedef was renamed to PTSring +typedef std::string PTString; +typedef std::vector<uint8_t> BinaryMessage; +typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; + +typedef std::string HMILevel; +typedef std::string Parameter; +typedef std::string RpcName; +typedef std::vector<std::string> RPCParams; + +typedef std::map<std::string, std::set<policy::HMILevel> > HMIPermissions; +typedef std::map<std::string, std::set<policy::Parameter> > ParameterPermissions; + +struct RpcPermissions { + HMIPermissions hmi_permissions; + ParameterPermissions parameter_permissions; +}; + +typedef std::map<RpcName, RpcPermissions> Permissions; + +/** + * @brief Typedef for use with AllowApp request/notification + */ +typedef std::vector<std::string> PermissionsList; + +/** + * @brief Typedef for getting initial application data, e.g. nickname list + */ +typedef std::vector<std::string> StringArray; + +enum PermitResult { + kRpcAllowed = 0, + kRpcDisallowed, + kRpcUserDisallowed +}; + +/** + * @struct Stores result of check: + * if HMI Level was allowed for RPC to work in + * and list of parameters allowed for RPC if specified in PT. + */ +struct CheckPermissionResult { + CheckPermissionResult() + : hmi_level_permitted(kRpcDisallowed) { + } + + PermitResult hmi_level_permitted; + std::vector<PTString> list_of_allowed_params; + std::vector<PTString> list_of_disallowed_params; + std::vector<PTString> list_of_undefined_params; +}; + +/** + @struct Holds Url string and optional policy app id. + */ +struct EndpointData { + explicit EndpointData(const std::string& url_string = "") + : app_id("default") { + if (false == url_string.empty()) { + url.push_back(url_string); + } + } + std::vector<std::string> url; + std::string app_id; +}; + +typedef std::vector<EndpointData> EndpointUrls; + +/** + * @brief Struct contains device data to be used for dialogs, generation of IDs + */ +struct DeviceParams { + DeviceParams() + : device_name(kDefaultDeviceName), + device_mac_address(kDefaultDeviceMacAddress), + device_connection_type(kDefaultDeviceConnectionType), + device_handle(0) { + } + + std::string device_name; + std::string device_mac_address; + std::string device_connection_type; + uint32_t device_handle; +}; + +/** + * @brief User consent for device data usage + */ +enum DeviceConsent { + kDeviceAllowed = 0, + kDeviceDisallowed, + kDeviceHasNoConsent +}; + +/** + * @brief Struct contains parameters, which can be received during application + * registration and should be stored in policy table + */ +struct DeviceInfo { + DeviceInfo() + : max_number_rfcom_ports(0) { + } + + std::string hardware; + std::string firmware_rev; + std::string os; + std::string os_ver; + std::string carrier; + uint32_t max_number_rfcom_ports; + std::string connection_type; +}; + +/** + * @brief User consent for functional group + */ +enum GroupConsent { + kGroupAllowed = 0, + kGroupDisallowed, + kGroupUndefined +}; + +/** + * @brief Contains user permission for RPC functional group with specific name + * and id from DB + */ +struct FunctionalGroupPermission { + FunctionalGroupPermission() + : group_id(0), + state(kGroupUndefined) { + } + + bool operator ==(const FunctionalGroupPermission& rhs) { + if (this->group_id == rhs.group_id && + this->group_alias == rhs.group_alias && + this->group_name == rhs.group_name) { + return true; + } + return false; + } + + std::string group_alias; + std::string group_name; + int32_t group_id; + GroupConsent state; +}; + +/** + * @brief Stores data to be sent to HMI on application permissions change + */ +struct AppPermissions { + + AppPermissions(const std::string& app_id) + : application_id(app_id), + isAppPermissionsRevoked(false), + appRevoked(false), + appPermissionsConsentNeeded(false), + appUnauthorized(false) { + } + + std::string application_id; + bool isAppPermissionsRevoked; + std::vector<policy::FunctionalGroupPermission> appRevokedPermissions; + bool appRevoked; + bool appPermissionsConsentNeeded; + bool appUnauthorized; + bool isSDLAllowed; + std::string priority; + DeviceParams deviceInfo; +}; + +/** + * @brief Contains parameters for user-defined consent for appication + * functional groups on given device + */ +struct PermissionConsent { + std::string device_id; + std::string policy_app_id; + std::vector<FunctionalGroupPermission> group_permissions; + std::string consent_source; +}; + +/** + * @brief Contain data for GetUserFriendyMessage response + */ +struct UserFriendlyMessage { + std::string message_code; + std::string tts; + std::string label; + std::string line1; + std::string line2; + std::string text_body; +}; + +/** + * @brief Types of functional groups in policy table + */ +enum GroupType { + kTypeDefault = 0, // groups assigned to 'default' permissions section + kTypeAllowed, // groups allowed by user for specific application + kTypeDisallowed, // groups disallowed by user for specific application + kTypeUnconsented, // groups disallowed by default but consent may be changed by user + kTypePreconsented, // groups allowed for specific application without + // user consent by default (could be changed by user) + kTypeGeneral, // groups assigned to specific application + kTypePreDataConsented, // groups assigned to 'pre_DataConsent' permissions + // section + kTypeDevice // groups assigned to 'device' permissions section +}; + +/** + * @brief Array of functional group id from DB + */ +typedef std::vector<int32_t> FunctionalGroupIDs; + +/** + * @brief Array of functional group ids sorted by types + */ +typedef std::map<GroupType, FunctionalGroupIDs> FunctionalIdType; + +/** + * @brief Array of functional group ids binded to user_consent_prompt (e.g. + * VehicleData) and group name (e.g. VehicleData-4) + */ +typedef std::map<uint32_t, std::pair<std::string, std::string> > FunctionalGroupNames; + +/** + * @brief Array of device ids, which are an identifiers in policy table + */ +typedef std::vector<std::string> DeviceIds; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_ diff --git a/src/components/policy/src/policy/include/policy/pt_ext_representation.h b/src/components/policy/src/policy/include/policy/pt_ext_representation.h new file mode 100644 index 0000000000..2ed5ef8c49 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/pt_ext_representation.h @@ -0,0 +1,334 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_ + +#include "policy/pt_representation.h" + +namespace policy { + +enum StatisticsType { + S_NONE = 0, + S_IAP_BUFFER_FULL, + S_SYNC_OUT_OF_MEMORY, + S_SYNC_REBOOTS, + S_MINS_HMI_FULL, + S_MINS_HMI_LIMITED, + S_MINS_HMI_BACKGROUND, + S_MINS_HMI_NONE, + S_RFCOM_LIMIT_REACHED, + S_USER_SELECTIONS, + S_REJECTIONS_SYNC_OUT_OF_MEMORY, + S_REJECTIONS_NICKNAME_MISMATCH, + S_REJECTIONS_DUPLICATE_NAME, + S_REJECTED_RPC_CALLS, + S_RPCS_IN_HMI_NONE, + S_REMOVALS_MISBEHAVED, + S_RUN_ATTEMPTS_WHILE_REVOKED +}; + +enum LanguageType { + L_NONE = 0, + L_GUI, + L_VUI +}; + +class PTExtRepresentation : public virtual PTRepresentation { + public: + virtual ~PTExtRepresentation() { + } + + /** + * @brief Is application allowed to send notifications while in + * Backgound or limited mode. + * @param app_id Application id + * @return bool Allowed/disallowed. + */ + virtual bool CanAppKeepContext(const std::string& app_id) = 0; + + /** + * @brief Is application allowed to move foreground at will? + * @param app_id Application id + * @return bool Allowed/disallowed. + */ + virtual bool CanAppStealFocus(const std::string& app_id) = 0; + + /** + * @brief Get default_hmi for given application + * @param policy_app_id Unique application id + * @param default_hmi Default HMI level for application or empty, if value was + * not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetDefaultHMI(const std::string& policy_app_id, + std::string* default_hmi) = 0; + + /** + * @brief Reset user consent for device data and applications permissions + * @return + */ + virtual bool ResetUserConsent() = 0; + + /** + * @brief Reset user consent for device data + * @return + */ + virtual bool ResetDeviceConsents() = 0; + + /** + * @brief Reset user consent for applications permissions + * @return + */ + virtual bool ResetAppConsents() = 0; + + /** + * @brief Get user permissions for device data usage + * @param device_id Generated or obtained id of device + * @param consented_groups Groups consented by user + * @param disallowed_groups Groups not consented by user + * @return true, if query was successfull, otherwise - false + */ + virtual bool GetUserPermissionsForDevice( + const std::string& device_id, StringArray* consented_groups = NULL, + StringArray* disallowed_groups = NULL) = 0; + + /** + * @brief Gets list of groups permissions from policy table + * @param device_id Unique device id, which hosts specific application + * @param policy_app_id Unique application id + * @param group_types Group list sorted by permission status + * @return true, if query was successfull, otherwise - false + */ + virtual bool GetPermissionsForApp( + const std::string& device_id, + const std::string& policy_app_id, + FunctionalIdType* group_types) = 0; + + /** + * @brief Get device groups and preconsented groups from policies section + * @param groups List of groups to be consented for device usage + * @param preconsented_groups List of preconsented groups for device usage + * @return true, if query was successful, otherwise - false + */ + virtual bool GetDeviceGroupsFromPolicies( + policy_table::Strings* groups = NULL, + policy_table::Strings* preconsented_groups = NULL) = 0; + + /** + * @brief Record information about mobile device in Policy Table. + * @param device_id Generated or obtained id of device + * @return bool Success of operation + */ + virtual bool SetDeviceData(const std::string& device_id, + const std::string& hardware = "", + const std::string& firmware = "", + const std::string& os = "", + const std::string& os_version = "", + const std::string& carrier = "", + const uint32_t number_of_ports = 0, + const std::string& connection_type = "") = 0; + + /** + * @brief Sets user consent for particular mobile device, + * i.e. to use device for exchanging of Policy Table. + * @return bool Success of operation + */ + virtual bool SetUserPermissionsForDevice( + const std::string& device_id, const StringArray& consented_groups = + StringArray(), + const StringArray& disallowed_gropus = StringArray()) = 0; + + /** + * @brief Update Application Policies as reaction + * on User allowing/disallowing device this app is running on. + */ + virtual bool ReactOnUserDevConsentForApp( + const std::string& app_id, + bool is_device_allowed) = 0; + + /** + * @brief Set user consent on functional groups + * @param permissions User consent on functional group + * @return true, if operation succedeed, otherwise - false + */ + virtual bool SetUserPermissionsForApp( + const PermissionConsent& permissions) = 0; + + /** + * @brief Counter for statistics information: adds 1 to existing number. + * @param type Type of statistics (errors, mins in mode etc) + * @return bool Success of operation + */ + virtual bool IncreaseStatisticsData(StatisticsType type) = 0; + + /** + * @brief Records information about what language + * application tried to register with. + * @param app_id Id of application + * @param type - language for UI/VR + * @param language Language + * @return bool Success of operation + */ + virtual bool SetAppRegistrationLanguage(const std::string& app_id, + LanguageType type, + const std::string& language) = 0; + + /** + * @brief Records information about head unit system to PT + * @return bool Success of operation + */ + virtual bool SetMetaInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) = 0; + + /** + * @brief Checks, if specific head unit is present in PT + * @return boot Suceess, if present, otherwise - false + */ + virtual bool IsMetaInfoPresent() = 0; + + /** + * @brief Kms pass since last successfull PT update + */ + virtual int GetKmFromSuccessfulExchange() = 0; + + /** + * @brief Days pass since last successfull PT update + */ + virtual int GetDayFromScsExchange() = 0; + + /** + * @brief Ignition cycles pass since last successfull PT update + */ + virtual int GetIgnitionsFromScsExchange() = 0; + + /** + * @brief Set current system language + * @param language System language + * @return true, if succedeed, otherwise - false + */ + virtual bool SetSystemLanguage(const std::string& language) = 0; + + /** + * Increments global counter + * @param type type of counter + */ + virtual void Increment(const std::string& type) const = 0; + + /** + * Increments counter of application + * @param app_id id application + * @param type type of counter + */ + virtual void Increment(const std::string& app_id, + const std::string& type) const = 0; + + /** + * Sets value of application information + * @param app_id id application + * @param type type of information + * @param value value of information + */ + virtual void Set(const std::string& app_id, const std::string& type, + const std::string& value) const = 0; + + /** + * Adds value to stopwatch of application + * @param app_id id application + * @param type type of stopwatch + * @param seconds value for adding in seconds + */ + virtual void Add(const std::string& app_id, const std::string& type, + int seconds) const = 0; + + virtual bool CountUnconsentedGroups(const std::string& policy_app_id, + const std::string& device_id, + int* result) const = 0; + + /** + * @brief Gets functional group names and user_consent_prompts, if any + * @param Array to be filled with group ids, names and functional prompts + * @return true, if succeeded, otherwise - false + */ + // TODO(AOleynik): Possibly, we can get rid of this method. Check this. + virtual bool GetFunctionalGroupNames(policy::FunctionalGroupNames& names) = 0; + + /** + * @brief Set app policy to pre_DataConsented policy + * @param app_id Policy ID of application to be changed + * @return true, if succeeded, otherwise - false + */ + virtual bool SetPredataPolicy(const std::string& app_id) = 0; + + /** + * @brief Updates application policy to either pre_DataConsented or not + * @param app_id Policy Id of application to be checked + * @param is_pre_data True of False to setting app policy to be pre_DataConsented + * @return true, if succeeded, otherwise - false + */ + virtual bool SetIsPredata(const std::string& app_id, bool is_pre_data) = 0; + + /** + * @brief Removes unpaired devices + * @return true if success + */ + virtual bool CleanupUnpairedDevices(const DeviceIds& device_ids) const = 0; + + /** + * Sets flag of unpaired device + * @param device_id + * @return true if success + */ + virtual bool SetUnpairedDevice(const std::string& device_id) const = 0; + + /** + * Gets list of unpaired devices + * @param device_ids output list + * @return true if success + */ + virtual bool UnpairedDevicesList(DeviceIds* device_ids) const = 0; + + /** + * @brief Remove application consent for particular group + * @param policy_app_id Unique application id + * @param functional_group_name Functional group name, which consents should + * be removed + * @return true, in case of success, otherwise - false + */ + virtual bool RemoveAppConsentForGroup( + const std::string& policy_app_id, + const std::string& functional_group_name) const = 0; +}; +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_ diff --git a/src/components/policy/src/policy/include/policy/pt_representation.h b/src/components/policy/src/policy/include/policy/pt_representation.h new file mode 100644 index 0000000000..f33c3a0811 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/pt_representation.h @@ -0,0 +1,300 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_PT_REPRESENTATION_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_PT_REPRESENTATION_H_ + +#include <vector> +#include <string> +#include "policy/policy_types.h" +#include "./types.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { + +/** + * @struct Data about vehicle + */ +struct VehicleData { + const std::string vehicle_make; + const std::string vehicle_model; + int vehicle_year; +}; + +enum InitResult { + NONE = 0, + EXISTS, + SUCCESS, + FAIL +}; + +class PTRepresentation { + public: + virtual ~PTRepresentation() { + } + + /** + * @brief Check if specified RPC for specified application + * has permission to be executed in specified HMI Level + * and also its permitted params. + * @param app_id Id of application provided during registration + * @param hmi_level Current HMI Level of application + * @param rpc Name of RPC + * @params CheckPermissionResult containing flag if HMI Level is allowed + * and list of allowed params. + */ + virtual void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + CheckPermissionResult& result) = 0; + + /** + * @brief Returns true if Policy Table was not updated yet + * from preloaded pt file. + */ + virtual bool IsPTPreloaded() = 0; + + /** + * Gets number of ignition cycles before next update policy table + * @return number of ignition cycles + */ + virtual int IgnitionCyclesBeforeExchange() = 0; + + /** + * Gets value in kilometers before next update policy table + * @param current value in kilometers from the odometers + * @return value in kilometers + */ + virtual int KilometersBeforeExchange(int current) = 0; + + /** + * @brief Sets kilometers and days after epoch, that passed for recieved + * successful PT UPdate + */ + virtual bool SetCountersPassedForSuccessfulUpdate(int kilometers, + int days_after_epoch) = 0; + + /** + * Gets value in days before next update policy table + * @param current value in days after epoch + * @return value in days + */ + virtual int DaysBeforeExchange(int current) = 0; + + /** + * @brief Increment number of ignition cycles since last exchange by 1 + */ + virtual void IncrementIgnitionCycles() = 0; + + /** + * @brief Reset number of ignition cycles since last exchange to 0 + */ + virtual void ResetIgnitionCycles() = 0; + + /** + * @brief Returns timeout to wait for a response of PT update + * @return value in seconds + */ + virtual int TimeoutResponse() = 0; + + /** + * @brief Returns number of seconds between each try of sending PTS + * @param seconds Return value: array of 5 elements + * @return bool Success of operation + */ + virtual bool SecondsBetweenRetries(std::vector<int>* seconds) = 0; + + /** + * @brief Get information about vehicle + */ + virtual VehicleData GetVehicleData() = 0; + + /** + * @brief Allows to update 'vin' field in module_meta table. + * + * @param new 'vin' value. + * + * @return true in case when data has been successfully updated, + * false otherwise. + */ + virtual bool SetVINValue(const std::string& value) = 0; + + /** + * @brief Get message text for displaying/pronouncing for user + * dependent on language and context. + * @param msg_codes Context of message (Driver distraction, Grant permission etc) + * @param language Language of the message + * @return Array of appropriate messages parameters + */ + virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, const std::string& language) = 0; + + /** + * @brief Get list of URL to send PTS to + * @param service_type If URLs for specific service are preset, + * return them otherwise default URLs. + */ + virtual EndpointUrls GetUpdateUrls(int service_type) = 0; + + /** + * @brief Get allowed number of notifications + * depending on application priority. + * @param priority Priority of application + */ + virtual int GetNotificationsNumber(const std::string& priority) = 0; + + /** + * @brief Get priority for given application + * @param policy_app_id Unique application id + * @param priority Priority for application or empty, if value was not set + * @return true, if succedeed, otherwise - false + */ + virtual bool GetPriority(const std::string& policy_app_id, + std::string* priority) = 0; + + + /** + * @brief Initialized Policy Table (load) + * @return bool Success of operation + */ + virtual InitResult Init() = 0; + + /** + * @brief Close policy table + * @return bool Success of operation + */ + virtual bool Close() = 0; + + /** + * @brief Removes policy table content. + * @return bool Success of operation + */ + virtual bool Clear() = 0; + + /** + * Drops policy table (schema and content) + * @return true if successfully + */ + virtual bool Drop() = 0; + + /** + * @brief Get snapshot of Policy Table + * including app_policies, functional_groups, + * device_info, statistics, excluding user messages + * @return Generated structure for obtaining Json string. + */ + virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0; + + + virtual bool Save(const policy_table::Table& table) = 0; + + /** + * Gets flag updateRequired + * @return true if update is required + */ + virtual bool UpdateRequired() const = 0; + + /** + * Saves flag updateRequired + */ + virtual void SaveUpdateRequired(bool value) = 0; + + /* + Retrieves data from app_policies about app on its registration: + app_id - id of registered app; all outputs are filled in only if not null + output: nicknames Synonyms for application + output: app_types Section on HMI where app can appear (Navigation, Phone etc) + */ + virtual bool GetInitialAppData(const std::string& app_id, + StringArray* nicknames = NULL, + StringArray* app_types = NULL) = 0; + + /** + * Checks if the application is revoked + * @param app_id application id + * @return true if application is revoked + */ + virtual bool IsApplicationRevoked(const std::string& app_id) const = 0; + + /** + * @brief Get functional groupings from DB + * @param groups Known functional groupings + * @return true, if succeeded, otherwise - false + */ + virtual bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups) = 0; + + /** + * Checks if the application is represented in policy table + * @param app_id application id + * @return true if application is represented in policy table + */ + virtual bool IsApplicationRepresented(const std::string& app_id) const = 0; + + /** + * Checks if the application has default policy + * @param app_id application id + * @return true if application has default policy + */ + virtual bool IsDefaultPolicy(const std::string& app_id) const = 0; + + /** + * Checks if the application has pre_data policy + * @param app_id application id + * @return true if application has pre_data policy + */ + virtual bool IsPredataPolicy(const std::string& app_id) const = 0; + + /** + * Sets default policy for application + * @param app_id application id + * @return true if success + */ + virtual bool SetDefaultPolicy(const std::string& app_id) = 0; + + /** + * @brief SaveApplicationCustomData allows to save specific data to database. + * This data is only for internal use. + * @param app_id the application id for which the data will be saved. + * @param is_revoked parameter to save. + * @param is_default parameter to save. + * @param is_predata parameter to save. + */ + virtual bool SaveApplicationCustomData(const std::string& app_id, + bool is_revoked, + bool is_default, + bool is_predata) = 0; +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_PT_REPRESENTATION_H_ diff --git a/src/components/policy/src/policy/include/policy/sql_pt_ext_queries.h b/src/components/policy/src/policy/include/policy/sql_pt_ext_queries.h new file mode 100644 index 0000000000..6db8425b7f --- /dev/null +++ b/src/components/policy/src/policy/include/policy/sql_pt_ext_queries.h @@ -0,0 +1,94 @@ +/* + Copyright (c) 2013, " Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, " with or without + modification, " are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, " this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, " + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR + CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN + CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_ + +#include <string> + +namespace policy { +namespace sql_pt_ext { + +extern const std::string kSelectKeepContext; +extern const std::string kSelectStealFocus; +extern const std::string kResetDeviceConsents; +extern const std::string kResetAppConsents; +extern const std::string kCountDeviceConsentGroup; +extern const std::string kCountDevice; +extern const std::string kSelectDeviceConsentedGroup; +extern const std::string kUpdateDeviceConsentedGroup; +extern const std::string kUpdateDevice; +extern const std::string kInsertDeviceConsentedGroup; +extern const std::string kInsertDevice; +extern const std::string kSelectDeviceData; +extern const std::string kSelectConsentGroup; +extern const std::string kInsertPreconsentedGroups; +extern const std::string kSelectPreconsentedGroups; +extern const std::string kDeletePreconsentedGroups; +extern const std::string kSelectUsageAndErrorCount; +extern const std::string kSelectAppLevels; +extern const std::string kInsertDeviceData; +extern const std::string kInsertConsentGroups; +extern const std::string kDeleteAppConsent; +extern const std::string kCountUnconsentedGroups; +extern const std::string kSelectModuleMeta; +extern const std::string kUpdateMetaParams; +extern const std::string kUpdateModuleMetaVinParam; +extern const std::string kSelectMetaParams; +extern const std::string kCountAppLevel; +extern const std::string kUpdateGroupPermissions; +extern const std::string kSelectDefaultHmi; +extern const std::string kInsertApplication; +extern const std::string kSelectFriendlyMsg; +extern const std::string kCollectFriendlyMsg; +extern const std::string kSelectAppGroupsId; +extern const std::string kSelectConsentedGroupsId; +extern const std::string kCountAppConsents; +extern const std::string kSelectPreconsentedGroupsId; +extern const std::string kSelectFunctionalGroupNames; +extern const std::string kSelectAppPolicies; +extern const std::string kUpdateMetaLanguage; +extern const std::string kDeleteDeviceConsent; +extern const std::string kDeleteAppGroupConsent; +extern const std::string kSelectGroupId; +extern const std::string kSelectApplicationIsPreData; +extern const std::string kUpdateIsPredata; +extern const std::string kHasAppPreloadedGroups; +extern const std::string kUpdateUnpairedDevice; +extern const std::string kSelectUnpairedDevices; +extern const std::string kHasMsgLanguageCode; +extern const std::string kDeletePreconsentedGroupsByApplicationId; + +} // namespace sql_pt_ext +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_ diff --git a/src/components/policy/src/policy/include/policy/sql_pt_ext_representation.h b/src/components/policy/src/policy/include/policy/sql_pt_ext_representation.h new file mode 100644 index 0000000000..9f784a3951 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/sql_pt_ext_representation.h @@ -0,0 +1,193 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_ + +#include <string> +#include "policy/sql_pt_representation.h" +#include "policy/pt_ext_representation.h" + +namespace policy { + +class SQLPTExtRepresentation : public SQLPTRepresentation, + public PTExtRepresentation { + public: + bool CanAppKeepContext(const std::string& app_id); + bool CanAppStealFocus(const std::string& app_id); + bool GetDefaultHMI(const std::string& policy_app_id, + std::string* default_hmi); + bool ResetUserConsent(); + bool ResetDeviceConsents(); + bool ResetAppConsents(); + bool GetUserPermissionsForDevice(const std::string& device_id, + StringArray* consented_groups = NULL, + StringArray* disallowed_groups = NULL); + + bool GetPermissionsForApp( + const std::string& device_id, const std::string& policy_app_id, + FunctionalIdType* group_types); + + bool GetDeviceGroupsFromPolicies(policy_table::Strings* groups = NULL, + policy_table::Strings* preconsented_groups = + NULL); + bool SetDeviceData(const std::string& device_id, + const std::string& hardware = "", + const std::string& firmware = "", + const std::string& os = "", + const std::string& os_version = "", + const std::string& carrier = "", + const uint32_t number_of_ports = 0, + const std::string& connection_type = ""); + bool SetUserPermissionsForDevice(const std::string& device_id, + const StringArray& consented_groups = + StringArray(), + const StringArray& disallowed_groups = + StringArray()); + + bool ReactOnUserDevConsentForApp(const std::string& app_id, + bool is_device_allowed); + + bool SetUserPermissionsForApp(const PermissionConsent& permissions); + + std::vector<UserFriendlyMessage> GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, const std::string& language); + + bool IncreaseStatisticsData(StatisticsType type) { + return true; + } + bool SetAppRegistrationLanguage(const std::string& app_id, LanguageType type, + const std::string& language) { + return true; + } + + bool SetMetaInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language); + + bool IsMetaInfoPresent(); + + bool SetSystemLanguage(const std::string& language); + + int GetKmFromSuccessfulExchange() { + return true; + } + int GetDayFromScsExchange() { + return true; + } + int GetIgnitionsFromScsExchange() { + return true; + } + + bool GetFunctionalGroupNames(FunctionalGroupNames& names); + bool CleanupUnpairedDevices(const DeviceIds& device_ids) const; + + void Increment(const std::string& type) const; + void Increment(const std::string& app_id, const std::string& type) const; + void Set(const std::string& app_id, const std::string& type, + const std::string& value) const; + void Add(const std::string& app_id, const std::string& type, + int seconds) const; + bool SetDefaultPolicy(const std::string& app_id); + bool SetPredataPolicy(const std::string& app_id); + bool SetIsPredata(const std::string& app_id, bool is_pre_data); + bool IsPredataPolicy(const std::string& app_id) const; + bool SetUnpairedDevice(const std::string& device_id) const; + bool UnpairedDevicesList(DeviceIds* device_ids) const; + bool RemoveAppConsentForGroup( + const std::string& policy_app_id, + const std::string& functional_group_name) const; + + virtual bool SetVINValue(const std::string& value); + + private: + void GatherModuleMeta(policy_table::ModuleMeta* meta) const; + void GatherPreconsentedGroup(const std::string& app_id, + policy_table::Strings* groups) const; + bool GatherUsageAndErrorCounts( + policy_table::UsageAndErrorCounts* counts) const; + bool GatherAppLevels(policy_table::AppLevels* apps) const; + void GatherDeviceData(policy_table::DeviceData* data) const; + void GatherConsentGroup(const std::string& device_id, + policy_table::UserConsentRecords* records) const; + bool GatherApplicationPolicies(policy_table::ApplicationPolicies* apps) const; + bool SaveDeviceData(const policy_table::DeviceData& devices); + bool GatherConsumerFriendlyMessages( + policy_table::ConsumerFriendlyMessages* messages) const; + bool SaveConsentGroup(const std::string& device_id, + const policy_table::UserConsentRecords& records); + bool SaveApplicationPolicies(const policy_table::ApplicationPolicies& apps); + bool SaveSpecificAppPolicy( + const policy_table::ApplicationPolicies::value_type& app); + bool SavePreconsentedGroup(const std::string& app_id, + const policy_table::Strings& groups); + bool SaveMessageString(const std::string& type, const std::string& lang, + const policy_table::MessageString& strings); + + virtual bool SaveUsageAndErrorCounts( + const policy_table::UsageAndErrorCounts& counts); + + bool IsExistAppLevel(const std::string& app_id) const; + + bool GetAllAppGroups(const std::string& policy_app_id, + FunctionalGroupIDs& all_groups); + + bool GetConsentedGroups(const std::string& policy_app_id, + const std::string& device_id, + FunctionalGroupIDs& allowed_groups, + FunctionalGroupIDs& disallowed_groups); + + bool GetPreconsentedGroups(const std::string& policy_app_id, + FunctionalGroupIDs& preconsented_groups); + + void FillFunctionalGroupPermissions( + FunctionalGroupIDs& ids, FunctionalGroupNames& names, + GroupConsent state, + std::vector<FunctionalGroupPermission>& permissions); + bool CountUnconsentedGroups(const std::string& policy_app_id, + const std::string& device_id, + int* result) const; + + /** + * @brief Checks, if there is message present with requested language in PT + * @param message Message name + * @param language Required message language + * @return True, if message with requested language is present, otherwise - + * false + */ + bool IsMsgLanguagePresent(const std::string& message, + const std::string& language); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_ diff --git a/src/components/policy/src/policy/include/policy/sql_pt_queries.h b/src/components/policy/src/policy/include/policy/sql_pt_queries.h new file mode 100644 index 0000000000..a8a3affd0b --- /dev/null +++ b/src/components/policy/src/policy/include/policy/sql_pt_queries.h @@ -0,0 +1,116 @@ +/* + Copyright (c) 2013, " Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, " with or without + modification, " are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, " this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, " + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR + CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN + CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_QUERIES_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_QUERIES_H_ + +#include <string> + +namespace policy { +namespace sql_pt { + +extern const std::string kSelectPriority; +extern const std::string kCreateSchema; +extern const std::string kDropSchema; +extern const std::string kDeleteData; +extern const std::string kCheckPgNumber; +extern const std::string kCheckDBIntegrity; +extern const std::string kSelectRpc; +extern const std::string kSelectPreloaded; +extern const std::string kIsFirstRun; +extern const std::string kSetNotFirstRun; +extern const std::string kSelectEndpoint; +extern const std::string kSelectModuleConfig; +extern const std::string kSelectEndpoints; +extern const std::string kSelectNotificationsPerMin; +extern const std::string kSelectNotificationsPerPriority; +extern const std::string kSelectAppLevels; +extern const std::string kSelectDeviceData; +extern const std::string kSelectFunctionalGroups; +extern const std::string kSelectAllRpcs; +extern const std::string kSelectUserMsgsVersion; +extern const std::string kSelectAppPolicies; +extern const std::string kSelectAppGroups; +extern const std::string kSelectNicknames; +extern const std::string kSelectAppTypes; +extern const std::string kSelectSecondsBetweenRetries; +extern const std::string kSelectIgnitionCycles; +extern const std::string kSelectKilometers; +extern const std::string kSelectDays; +extern const std::string kSelectTimeoutResponse; +extern const std::string kInsertFunctionalGroup; +extern const std::string kInsertRpc; +extern const std::string kInsertRpcWithParameter; +extern const std::string kInsertApplication; +extern const std::string kInsertAppGroup; +extern const std::string kInsertNickname; +extern const std::string kInsertAppType; +extern const std::string kInsertMessageType; +extern const std::string kInsertLanguage; +extern const std::string kInsertMessageString; +extern const std::string kUpdateVersion; +extern const std::string kUpdateModuleConfig; +extern const std::string kInsertEndpoint; +extern const std::string kInsertSecondsBetweenRetry; +extern const std::string kInsertNotificationsByPriority; +extern const std::string kInsertDeviceData; +extern const std::string kInsertAppLevel; +extern const std::string kDeleteSecondsBetweenRetries; +extern const std::string kDeleteEndpoint; +extern const std::string kDeleteAppLevel; +extern const std::string kDeleteMessageString; +extern const std::string kDeleteFunctionalGroup; +extern const std::string kDeleteRpc; +extern const std::string kDeleteAppGroup; +extern const std::string kDeleteApplication; +extern const std::string kDeleteDevice; +extern const std::string kIncrementIgnitionCycles; +extern const std::string kResetIgnitionCycles; +extern const std::string kUpdateFlagUpdateRequired; +extern const std::string kSelectFlagUpdateRequired; +extern const std::string kUpdateCountersSuccessfulUpdate; +extern const std::string kSelectApplicationRevoked; +extern const std::string kUpdateApplicationCustomData; +extern const std::string kSelectApplicationRepresented; +extern const std::string kSelectApplicationIsDefault; +extern const std::string kUpdateIsDefault; +extern const std::string kInsertInitData; +extern const std::string kDeleteAppGroupByApplicationId; +extern const std::string kInsertApplicationFull; +extern const std::string kDeletePreconsentedGroupsByApplicationId; +extern const std::string kSelectApplicationFull; +extern const std::string kUpdatePreloaded; + +} // namespace sql_pt +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_QUERIES_H_ diff --git a/src/components/policy/src/policy/include/policy/sql_pt_representation.h b/src/components/policy/src/policy/include/policy/sql_pt_representation.h new file mode 100644 index 0000000000..ce4e4532ab --- /dev/null +++ b/src/components/policy/src/policy/include/policy/sql_pt_representation.h @@ -0,0 +1,175 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_REPRESENTATION_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_REPRESENTATION_H_ + +#include <string> +#include <vector> +#include "policy/pt_representation.h" +#include "rpc_base/rpc_base.h" +#include "./types.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { + +namespace dbms { +class SQLDatabase; +} // namespace dbms + +class SQLPTRepresentation : public virtual PTRepresentation { + public: + SQLPTRepresentation(); + ~SQLPTRepresentation(); + virtual void CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + CheckPermissionResult& result); + + virtual bool IsPTPreloaded(); + virtual int IgnitionCyclesBeforeExchange(); + virtual int KilometersBeforeExchange(int current); + virtual bool SetCountersPassedForSuccessfulUpdate(int kilometers, + int days_after_epoch); + virtual int DaysBeforeExchange(int current); + virtual void IncrementIgnitionCycles(); + virtual void ResetIgnitionCycles(); + virtual int TimeoutResponse(); + virtual bool SecondsBetweenRetries(std::vector<int>* seconds); + + virtual VehicleData GetVehicleData(); + + virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, const std::string& language); + + virtual EndpointUrls GetUpdateUrls(int service_type); + + virtual int GetNotificationsNumber(const std::string& priority); + virtual bool GetPriority(const std::string& policy_app_id, + std::string* priority); + InitResult Init(); + bool Close(); + bool Clear(); + bool Drop(); + virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const; + virtual bool Save(const policy_table::Table& table); + bool GetInitialAppData(const std::string& app_id, StringArray* nicknames = + NULL, + StringArray* app_hmi_types = NULL); + bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups); + + protected: + virtual void GatherModuleMeta(policy_table::ModuleMeta* meta) const; + virtual void GatherModuleConfig(policy_table::ModuleConfig* config) const; + virtual bool GatherUsageAndErrorCounts( + policy_table::UsageAndErrorCounts* counts) const; + virtual void GatherDeviceData(policy_table::DeviceData* data) const; + virtual bool GatherFunctionalGroupings( + policy_table::FunctionalGroupings* groups) const; + virtual bool GatherConsumerFriendlyMessages( + policy_table::ConsumerFriendlyMessages* messages) const; + virtual bool GatherApplicationPolicies( + policy_table::ApplicationPolicies* apps) const; + + bool GatherAppGroup(const std::string& app_id, + policy_table::Strings* app_groups) const; + bool GatherAppType(const std::string& app_id, + policy_table::AppHMITypes* app_types) const; + bool GatherNickName(const std::string& app_id, + policy_table::Strings* nicknames) const; + + virtual bool SaveApplicationCustomData(const std::string& app_id, + bool is_revoked, + bool is_default, + bool is_predata); + + virtual bool SaveModuleMeta(const policy_table::ModuleMeta& meta); + virtual bool SaveModuleConfig(const policy_table::ModuleConfig& config); + virtual bool SaveUsageAndErrorCounts( + const policy_table::UsageAndErrorCounts& counts); + virtual bool SaveDeviceData(const policy_table::DeviceData& devices); + virtual bool SaveFunctionalGroupings( + const policy_table::FunctionalGroupings& groups); + virtual bool SaveConsumerFriendlyMessages( + const policy_table::ConsumerFriendlyMessages& messages); + virtual bool SaveApplicationPolicies( + const policy_table::ApplicationPolicies& apps); + virtual bool SaveSpecificAppPolicy( + const policy_table::ApplicationPolicies::value_type& app); + + virtual bool SaveMessageString(const std::string& type, + const std::string& lang, + const policy_table::MessageString& strings); + + bool SaveAppGroup(const std::string& app_id, + const policy_table::Strings& app_groups); + bool SaveNickname(const std::string& app_id, + const policy_table::Strings& nicknames); + bool SaveAppType(const std::string& app_id, + const policy_table::AppHMITypes& types); + + public: + bool UpdateRequired() const; + void SaveUpdateRequired(bool value); + + bool IsApplicationRepresented(const std::string& app_id) const; + bool CopyApplication(const std::string& source, + const std::string& destination); + + bool IsApplicationRevoked(const std::string& app_id) const; + virtual bool IsDefaultPolicy(const std::string& app_id) const; + virtual bool IsPredataPolicy(const std::string& app_id) const; + virtual bool SetDefaultPolicy(const std::string& app_id); + virtual void SetPreloaded(bool value); + + virtual bool SetVINValue(const std::string& value); + + dbms::SQLDatabase* db() const; + virtual bool SetIsDefault(const std::string& app_id, bool is_default) const; + + private: + static const std::string kDatabaseName; + dbms::SQLDatabase* db_; + + bool SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs); + bool SaveServiceEndpoints(const policy_table::ServiceEndpoints& endpoints); + bool SaveSecondsBetweenRetries( + const policy_table::SecondsBetweenRetries& seconds); + bool SaveNumberOfNotificationsPerMinute( + const policy_table::NumberOfNotificationsPerMinute& notifications); + bool SaveMessageType(const std::string& type); + bool SaveLanguage(const std::string& code); +}; +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_PT_REPRESENTATION_H_ diff --git a/src/components/policy/src/policy/include/policy/sql_wrapper.h b/src/components/policy/src/policy/include/policy/sql_wrapper.h new file mode 100644 index 0000000000..29dbdd481d --- /dev/null +++ b/src/components/policy/src/policy/include/policy/sql_wrapper.h @@ -0,0 +1,44 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_WRAPPER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_WRAPPER_H_ + +#if __QNX__ +# include "qdb_wrapper/sql_database.h" +# include "qdb_wrapper/sql_query.h" +#else // __QNX__ +# include "sqlite_wrapper/sql_database.h" +# include "sqlite_wrapper/sql_query.h" +#endif // __QNX__ + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_SQL_WRAPPER_H_ diff --git a/src/components/policy/src/policy/include/policy/update_status_manager.h b/src/components/policy/src/policy/include/policy/update_status_manager.h new file mode 100644 index 0000000000..43d40d0c19 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/update_status_manager.h @@ -0,0 +1,136 @@ +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H + +#include "policy/update_status_manager_interface.h" +#include "policy/policy_types.h" +#include "utils/lock.h" +#include "utils/timer_thread.h" + +namespace policy { + +class PolicyListener; + +class UpdateStatusManager : public UpdateStatusManagerInterface { + public: + /** + * @brief Constructor + */ + UpdateStatusManager(); + + ~UpdateStatusManager(); + + /** + * @brief Sets listener pointer + * @param listener Pointer to policy listener implementation + */ + void set_listener(PolicyListener* listener); + + /** + * @brief Update status hanlder for PTS sending out + * @param update_timeout Timeout for waiting of incoming PTU + */ + void OnUpdateSentOut(uint32_t update_timeout); + + /** + * @brief Update status handler for PTU waiting timeout + */ + void OnUpdateTimeoutOccurs(); + + /** + * @brief Update status handler for valid PTU receiving + */ + void OnValidUpdateReceived(); + + /** + * @brief Update status handler for wrong PTU receiving + */ + void OnWrongUpdateReceived(); + + /** + * @brief Update status handler for reset PT to default state + * @param is_update_required Update necessity flag + */ + void OnResetDefaultPT(bool is_update_required); + + /** + * @brief Update status handler for restarting retry sequence + */ + void OnResetRetrySequence(); + + /** + * @brief Update status handler on new application registering + */ + void OnNewApplicationAdded(); + + /** + * @brief Update status handler for policy initialization + * @param is_update_required Update necessity flag + */ + void OnPolicyInit(bool is_update_required); + + /** + * @brief Returns current policy update status + * @return + */ + PolicyTableStatus GetUpdateStatus(); + +private: + /* + * @brief Sets flag for update progress + * + * @param value + */ + void set_exchange_in_progress(bool value); + + /* + * @brief Sets flag for pending update + * + * @param value + */ + void set_exchange_pending(bool value); + + /* + * @brief Sets flag for update necessity + * + * @param value + */ + void set_update_required(bool value); + + /** + * @brief Check update status and notify HMI on changes + */ + void CheckUpdateStatus(); + +private: + PolicyListener* listener_; + bool exchange_in_progress_; + bool update_required_; + bool exchange_pending_; + sync_primitives::Lock exchange_in_progress_lock_; + sync_primitives::Lock update_required_lock_; + sync_primitives::Lock exchange_pending_lock_; + /** + * @brief Last status of policy table update + */ + PolicyTableStatus last_update_status_; + + + /** + * @brief The Policy update response timer class + */ + class UpdateResponseTimer : public timer::TimerThread<UpdateStatusManager> { + public: + UpdateResponseTimer(UpdateStatusManager* callee) : + timer::TimerThread<UpdateStatusManager>( + "Policy UpdResponse", + callee, + &UpdateStatusManager::OnUpdateTimeoutOccurs) { + } + ~UpdateResponseTimer(); + }; + UpdateResponseTimer update_response_timer_; +}; + +} + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H diff --git a/src/components/policy/src/policy/include/policy/update_status_manager_interface.h b/src/components/policy/src/policy/include/policy/update_status_manager_interface.h new file mode 100644 index 0000000000..f059958477 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/update_status_manager_interface.h @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_SRC_POLICY_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ +#define SRC_COMPONENTS_POLICY_SRC_POLICY_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ + +#include "utils/shared_ptr.h" +#include "policy/policy_types.h" + +namespace policy { + +class PolicyListener; + +class UpdateStatusManagerInterface { + public: + virtual ~UpdateStatusManagerInterface() { + } + /** + * @brief Sets listener pointer + * @param listener Pointer to policy listener implementation + */ + virtual void set_listener(PolicyListener* listener) = 0; + + /** + * @brief Update status hanlder for PTS sending out + * @param update_timeout Timeout for waiting of incoming PTU + */ + virtual void OnUpdateSentOut(uint32_t update_timeout) = 0; + + /** + * @brief Update status handler for PTU waiting timeout + */ + virtual void OnUpdateTimeoutOccurs() = 0; + + /** + * @brief Update status handler for valid PTU receiving + */ + virtual void OnValidUpdateReceived() = 0; + + /** + * @brief Update status handler for wrong PTU receiving + */ + virtual void OnWrongUpdateReceived() = 0; + + /** + * @brief Update status handler for reset PT to default state + * @param is_update_required Update necessity flag + */ + virtual void OnResetDefaultPT(bool is_update_required) = 0; + + /** + * @brief Update status handler for restarting retry sequence + */ + virtual void OnResetRetrySequence() = 0; + + /** + * @brief Update status handler on new application registering + */ + virtual void OnNewApplicationAdded() = 0; + + /** + * @brief Update status handler for policy initialization + * @param is_update_required Update necessity flag + */ + virtual void OnPolicyInit(bool is_update_required) = 0; + + /** + * @brief Returns current policy update status + * @return + */ + virtual PolicyTableStatus GetUpdateStatus() = 0; +}; + +typedef utils::SharedPtr<UpdateStatusManagerInterface> UpdateStatusManagerInterfaceSPtr; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_SRC_POLICY_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ diff --git a/src/components/policy/src/policy/include/policy/user_consent_manager.h b/src/components/policy/src/policy/include/policy/user_consent_manager.h new file mode 100644 index 0000000000..4bf80afb13 --- /dev/null +++ b/src/components/policy/src/policy/include/policy/user_consent_manager.h @@ -0,0 +1,44 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USER_CONSENT_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USER_CONSENT_MANAGER_H_ + +namespace policy { +class UserConsentManager { + public: + UserConsentManager() {} + ~UserConsentManager() {} +}; +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USER_CONSENT_MANAGER_H_ diff --git a/src/components/policy/src/policy/policy_table/table_struct/CMakeLists.txt b/src/components/policy/src/policy/policy_table/table_struct/CMakeLists.txt new file mode 100644 index 0000000000..6d67c71d8b --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright (c) 2013, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +set(target policy_struct) + +include_directories(.) + +set(SOURCES + ./enums.cc + ./types.cc + ./validation.cc +) + +add_library(${target} ${SOURCES}) +target_link_libraries(${target} Utils) diff --git a/src/components/policy/src/policy/policy_table/table_struct/enums.cc b/src/components/policy/src/policy/policy_table/table_struct/enums.cc new file mode 100644 index 0000000000..a0203b7f42 --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/enums.cc @@ -0,0 +1,301 @@ +// This file is generated, do not edit +#include "./enums.h" + +namespace rpc { +namespace policy_table_interface_base { +bool IsValidEnum(Priority val) { + switch (val) { + case P_EMERGENCY: return true; + case P_NAVIGATION: return true; + case P_VOICECOM: return true; + case P_COMMUNICATION: return true; + case P_NORMAL: return true; + case P_NONE: return true; + default: return false; + } +} +const char* EnumToJsonString(Priority val) { + switch (val) { + case P_EMERGENCY: return "EMERGENCY"; + case P_NAVIGATION: return "NAVIGATION"; + case P_VOICECOM: return "VOICECOM"; + case P_COMMUNICATION: return "COMMUNICATION"; + case P_NORMAL: return "NORMAL"; + case P_NONE: return "NONE"; + default: return ""; + } +} +bool EnumFromJsonString(const std::string& literal, Priority* result) { + if ("EMERGENCY" == literal) { + *result = P_EMERGENCY; + return true; + } else if ("NAVIGATION" == literal) { + *result = P_NAVIGATION; + return true; + } else if ("VOICECOM" == literal) { + *result = P_VOICECOM; + return true; + } else if ("COMMUNICATION" == literal) { + *result = P_COMMUNICATION; + return true; + } else if ("NORMAL" == literal) { + *result = P_NORMAL; + return true; + } else if ("NONE" == literal) { + *result = P_NONE; + return true; + } else { + return false; + } +} + +bool IsValidEnum(HmiLevel val) { + switch (val) { + case HL_BACKGROUND: return true; + case HL_FULL: return true; + case HL_LIMITED: return true; + case HL_NONE: return true; + default: return false; + } +} +const char* EnumToJsonString(HmiLevel val) { + switch (val) { + case HL_BACKGROUND: return "BACKGROUND"; + case HL_FULL: return "FULL"; + case HL_LIMITED: return "LIMITED"; + case HL_NONE: return "NONE"; + default: return ""; + } +} +bool EnumFromJsonString(const std::string& literal, HmiLevel* result) { + if ("BACKGROUND" == literal) { + *result = HL_BACKGROUND; + return true; + } else if ("FULL" == literal) { + *result = HL_FULL; + return true; + } else if ("LIMITED" == literal) { + *result = HL_LIMITED; + return true; + } else if ("NONE" == literal) { + *result = HL_NONE; + return true; + } else { + return false; + } +} + +bool IsValidEnum(Parameter val) { + switch (val) { + case P_GPS: return true; + case P_SPEED: return true; + case P_ENGINETORQUE: return true; + case P_EXTERNALTEMPERATURE: return true; + case P_FUELLEVEL: return true; + case P_FUELLEVEL_STATE: return true; + case P_HEADLAMPSTATUS: return true; + case P_INSTANTFUELCONSUMPTION: return true; + case P_ODOMETER: return true; + case P_TIREPRESSURE: return true; + case P_WIPERSTATUS: return true; + case P_VIN: return true; + case P_ACCPEDALPOSITION: return true; + case P_BELTSTATUS: return true; + case P_DRIVERBRAKING: return true; + case P_PRNDL: return true; + case P_RPM: return true; + case P_STEERINGWHEELANGLE: return true; + case P_MYKEY: return true; + case P_AIRBAGSTATUS: return true; + case P_BODYINFORMATION: return true; + case P_CLUSTERMODESTATUS: return true; + case P_DEVICESTATUS: return true; + case P_EMERGENCYEVENT: return true; + case P_ECALLINFO: return true; + default: return false; + } +} +const char* EnumToJsonString(Parameter val) { + switch (val) { + case P_GPS: return "gps"; + case P_SPEED: return "speed"; + case P_ENGINETORQUE: return "engineTorque"; + case P_EXTERNALTEMPERATURE: return "externalTemperature"; + case P_FUELLEVEL: return "fuelLevel"; + case P_FUELLEVEL_STATE: return "fuelLevel_State"; + case P_HEADLAMPSTATUS: return "headLampStatus"; + case P_INSTANTFUELCONSUMPTION: return "instantFuelConsumption"; + case P_ODOMETER: return "odometer"; + case P_TIREPRESSURE: return "tirePressure"; + case P_WIPERSTATUS: return "wiperStatus"; + case P_VIN: return "vin"; + case P_ACCPEDALPOSITION: return "accPedalPosition"; + case P_BELTSTATUS: return "beltStatus"; + case P_DRIVERBRAKING: return "driverBraking"; + case P_PRNDL: return "prndl"; + case P_RPM: return "rpm"; + case P_STEERINGWHEELANGLE: return "steeringWheelAngle"; + case P_MYKEY: return "myKey"; + case P_AIRBAGSTATUS: return "airbagStatus"; + case P_BODYINFORMATION: return "bodyInformation"; + case P_CLUSTERMODESTATUS: return "clusterModeStatus"; + case P_DEVICESTATUS: return "deviceStatus"; + case P_EMERGENCYEVENT: return "emergencyEvent"; + case P_ECALLINFO: return "eCallInfo"; + default: return ""; + } +} +bool EnumFromJsonString(const std::string& literal, Parameter* result) { + if ("gps" == literal) { + *result = P_GPS; + return true; + } else if ("speed" == literal) { + *result = P_SPEED; + return true; + } else if ("engineTorque" == literal) { + *result = P_ENGINETORQUE; + return true; + } else if ("externalTemperature" == literal) { + *result = P_EXTERNALTEMPERATURE; + return true; + } else if ("fuelLevel" == literal) { + *result = P_FUELLEVEL; + return true; + } else if ("fuelLevel_State" == literal) { + *result = P_FUELLEVEL_STATE; + return true; + } else if ("headLampStatus" == literal) { + *result = P_HEADLAMPSTATUS; + return true; + } else if ("instantFuelConsumption" == literal) { + *result = P_INSTANTFUELCONSUMPTION; + return true; + } else if ("odometer" == literal) { + *result = P_ODOMETER; + return true; + } else if ("tirePressure" == literal) { + *result = P_TIREPRESSURE; + return true; + } else if ("wiperStatus" == literal) { + *result = P_WIPERSTATUS; + return true; + } else if ("vin" == literal) { + *result = P_VIN; + return true; + } else if ("accPedalPosition" == literal) { + *result = P_ACCPEDALPOSITION; + return true; + } else if ("beltStatus" == literal) { + *result = P_BELTSTATUS; + return true; + } else if ("driverBraking" == literal) { + *result = P_DRIVERBRAKING; + return true; + } else if ("prndl" == literal) { + *result = P_PRNDL; + return true; + } else if ("rpm" == literal) { + *result = P_RPM; + return true; + } else if ("steeringWheelAngle" == literal) { + *result = P_STEERINGWHEELANGLE; + return true; + } else if ("myKey" == literal) { + *result = P_MYKEY; + return true; + } else if ("airbagStatus" == literal) { + *result = P_AIRBAGSTATUS; + return true; + } else if ("bodyInformation" == literal) { + *result = P_BODYINFORMATION; + return true; + } else if ("clusterModeStatus" == literal) { + *result = P_CLUSTERMODESTATUS; + return true; + } else if ("deviceStatus" == literal) { + *result = P_DEVICESTATUS; + return true; + } else if ("emergencyEvent" == literal) { + *result = P_EMERGENCYEVENT; + return true; + } else if ("eCallInfo" == literal) { + *result = P_ECALLINFO; + return true; + } else { + return false; + } +} + +bool IsValidEnum(AppHMIType val) { + switch (val) { + case AHT_DEFAULT: return true; + case AHT_COMMUNICATION: return true; + case AHT_MEDIA: return true; + case AHT_MESSAGING: return true; + case AHT_NAVIGATION: return true; + case AHT_INFORMATION: return true; + case AHT_SOCIAL: return true; + case AHT_BACKGROUND_PROCESS: return true; + case AHT_TESTING: return true; + case AHT_SYSTEM: return true; + default: return false; + } +} +const char* EnumToJsonString(AppHMIType val) { + switch (val) { + case AHT_DEFAULT: return "DEFAULT"; + case AHT_COMMUNICATION: return "COMMUNICATION"; + case AHT_MEDIA: return "MEDIA"; + case AHT_MESSAGING: return "MESSAGING"; + case AHT_NAVIGATION: return "NAVIGATION"; + case AHT_INFORMATION: return "INFORMATION"; + case AHT_SOCIAL: return "SOCIAL"; + case AHT_BACKGROUND_PROCESS: return "BACKGROUND_PROCESS"; + case AHT_TESTING: return "TESTING"; + case AHT_SYSTEM: return "SYSTEM"; + default: return ""; + } +} +bool EnumFromJsonString(const std::string& literal, AppHMIType* result) { + if ("DEFAULT" == literal) { + *result = AHT_DEFAULT; + return true; + } else if ("COMMUNICATION" == literal) { + *result = AHT_COMMUNICATION; + return true; + } else if ("MEDIA" == literal) { + *result = AHT_MEDIA; + return true; + } else if ("MESSAGING" == literal) { + *result = AHT_MESSAGING; + return true; + } else if ("NAVIGATION" == literal) { + *result = AHT_NAVIGATION; + return true; + } else if ("INFORMATION" == literal) { + *result = AHT_INFORMATION; + return true; + } else if ("SOCIAL" == literal) { + *result = AHT_SOCIAL; + return true; + } else if ("BACKGROUND_PROCESS" == literal) { + *result = AHT_BACKGROUND_PROCESS; + return true; + } else if ("TESTING" == literal) { + *result = AHT_TESTING; + return true; + } else if ("SYSTEM" == literal) { + *result = AHT_SYSTEM; + return true; + } else { + return false; + } +} + +const std::string kDefaultApp = "default"; +const std::string kPreDataConsentApp = "pre_DataConsent"; +const std::string kDeviceApp = "device"; + +} // namespace policy_table_interface_base +} // namespace rpc + diff --git a/src/components/policy/src/policy/policy_table/table_struct/enums.h b/src/components/policy/src/policy/policy_table/table_struct/enums.h new file mode 100644 index 0000000000..e437860c60 --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/enums.h @@ -0,0 +1,89 @@ +// This file is generated, do not edit +#ifndef POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_ENUMS_H_ +#define POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_ENUMS_H_ +#include <string> + +namespace rpc { +namespace policy_table_interface_base { + +enum Priority { + P_EMERGENCY, + P_NAVIGATION, + P_VOICECOM, + P_COMMUNICATION, + P_NORMAL, + P_NONE, +}; + +bool IsValidEnum(Priority val); +const char* EnumToJsonString(Priority val); +bool EnumFromJsonString(const std::string& literal, Priority* result); + + +enum HmiLevel { + HL_BACKGROUND, + HL_FULL, + HL_LIMITED, + HL_NONE, +}; +bool IsValidEnum(HmiLevel val); +const char* EnumToJsonString(HmiLevel val); +bool EnumFromJsonString(const std::string& literal, HmiLevel* result); + + +enum Parameter { + P_GPS, + P_SPEED, + P_ENGINETORQUE, + P_EXTERNALTEMPERATURE, + P_FUELLEVEL, + P_FUELLEVEL_STATE, + P_HEADLAMPSTATUS, + P_INSTANTFUELCONSUMPTION, + P_ODOMETER, + P_TIREPRESSURE, + P_WIPERSTATUS, + P_VIN, + P_ACCPEDALPOSITION, + P_BELTSTATUS, + P_DRIVERBRAKING, + P_PRNDL, + P_RPM, + P_STEERINGWHEELANGLE, + P_MYKEY, + P_AIRBAGSTATUS, + P_BODYINFORMATION, + P_CLUSTERMODESTATUS, + P_DEVICESTATUS, + P_EMERGENCYEVENT, + P_ECALLINFO, +}; +bool IsValidEnum(Parameter val); +const char* EnumToJsonString(Parameter val); +bool EnumFromJsonString(const std::string& literal, Parameter* result); + + +enum AppHMIType { + AHT_DEFAULT, + AHT_COMMUNICATION, + AHT_MEDIA, + AHT_MESSAGING, + AHT_NAVIGATION, + AHT_INFORMATION, + AHT_SOCIAL, + AHT_BACKGROUND_PROCESS, + AHT_TESTING, + AHT_SYSTEM, +}; +bool IsValidEnum(AppHMIType val); +const char* EnumToJsonString(AppHMIType val); +bool EnumFromJsonString(const std::string& literal, AppHMIType* result); + +extern const std::string kDefaultApp; +extern const std::string kPreDataConsentApp; +extern const std::string kDeviceApp; + +} // namespace policy_table_interface_base +} // namespace rpc + +#endif // POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_ENUMS_H_ diff --git a/src/components/policy/src/policy/policy_table/table_struct/functions.h b/src/components/policy/src/policy/policy_table/table_struct/functions.h new file mode 100644 index 0000000000..ee4b16b649 --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/functions.h @@ -0,0 +1,7 @@ +// This file is generated, do not edit +#ifndef POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_FUNCTIONS_H_ +#define POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_FUNCTIONS_H_ +#include "./enums.h" +#include "./types.h" + +#endif // POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_FUNCTIONS_H_ diff --git a/src/components/policy/src/policy/policy_table/table_struct/types.cc b/src/components/policy/src/policy/policy_table/table_struct/types.cc new file mode 100644 index 0000000000..92172e42a0 --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/types.cc @@ -0,0 +1,1037 @@ +// This file is generated, do not edit +#include "./types.h" +#include "rpc_base/rpc_base_json_inl.h" + +namespace rpc { +namespace policy_table_interface_base { + + std::string PolicyTableTypeToString(const PolicyTableType pt_type) { + switch (pt_type) { + case PT_PRELOADED: { + return "PT_PRELOADED"; + } + case PT_UPDATE: { + return "PT_UPDATE"; + } + case PT_SNAPSHOT: { + return "PT_SNAPSHOT"; + } + default :{ + return "INVALID_PT_TYPE"; + } + } + } + +// ApplicationParams methods +ApplicationParams::ApplicationParams() + : CompositeType(kUninitialized) { +} +ApplicationParams::ApplicationParams(const Strings& groups) + : CompositeType(kUninitialized), + groups(groups) { +} +ApplicationParams::~ApplicationParams() { +} +ApplicationParams::ApplicationParams(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + groups(impl::ValueMember(value__, "groups")), + nicknames(impl::ValueMember(value__, "nicknames")), + AppHMIType(impl::ValueMember(value__, "AppHMIType")), + priority(impl::ValueMember(value__, "priority")), + memory_kb(impl::ValueMember(value__, "memory_kb")), + heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")), + certificate(impl::ValueMember(value__, "certificate")) { +} +Json::Value ApplicationParams::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("groups", groups, &result__); + impl::WriteJsonField("nicknames", nicknames, &result__); + impl::WriteJsonField("AppHMIType", AppHMIType, &result__); + impl::WriteJsonField("priority", priority, &result__); + impl::WriteJsonField("memory_kb", memory_kb, &result__); + impl::WriteJsonField("heart_beat_timeout_ms", heart_beat_timeout_ms, &result__); + impl::WriteJsonField("certificate", certificate, &result__); + return result__; +} +bool ApplicationParams::is_valid() const { + if (!groups.is_valid()) { + return false; + } + if (!nicknames.is_valid()) { + return false; + } + if (!AppHMIType.is_valid()) { + return false; + } + if (! priority.is_valid()) { + return false; + } + if (!memory_kb.is_valid()) { + return false; + } + if (!heart_beat_timeout_ms.is_valid()) { + return false; + } + if (!certificate.is_valid()) { + return false; + } + return Validate(); +} +bool ApplicationParams::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool ApplicationParams::struct_empty() const { + if (groups.is_initialized()) { + return false; + } + if (nicknames.is_initialized()) { + return false; + } + + if (AppHMIType.is_initialized()) { + return false; + } + if (priority.is_initialized()) { + return false; + } + if (memory_kb.is_initialized()) { + return false; + } + + if (heart_beat_timeout_ms.is_initialized()) { + return false; + } + if (certificate.is_initialized()) { + return false; + } + + return true; +} +void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!groups.is_valid()) { + groups.ReportErrors(&report__->ReportSubobject("groups")); + } + if (!nicknames.is_valid()) { + nicknames.ReportErrors(&report__->ReportSubobject("nicknames")); + } + if (!AppHMIType.is_valid()) { + AppHMIType.ReportErrors(&report__->ReportSubobject("AppHMIType")); + } + if (!priority.is_valid()) { + priority.ReportErrors(&report__->ReportSubobject("priority")); + } + if (!memory_kb.is_valid()) { + memory_kb.ReportErrors(&report__->ReportSubobject("memory_kb")); + } + if (!heart_beat_timeout_ms.is_valid()) { + heart_beat_timeout_ms.ReportErrors(&report__->ReportSubobject("heart_beat_timeout_ms")); + } + if (!certificate.is_valid()) { + certificate.ReportErrors(&report__->ReportSubobject("certificate")); + } +} + +void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + AppHMIType.SetPolicyTableType(pt_type); + groups.SetPolicyTableType(pt_type); + priority.SetPolicyTableType(pt_type); + memory_kb.SetPolicyTableType(pt_type); + heart_beat_timeout_ms.SetPolicyTableType(pt_type); + certificate.SetPolicyTableType(pt_type); +} + +// RpcParameters methods +RpcParameters::RpcParameters() + : CompositeType(kUninitialized) { +} +RpcParameters::RpcParameters(const HmiLevels& hmi_levels) + : CompositeType(kUninitialized), + hmi_levels(hmi_levels) { +} +RpcParameters::~RpcParameters() { +} +RpcParameters::RpcParameters(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + hmi_levels(impl::ValueMember(value__, "hmi_levels")), + parameters(impl::ValueMember(value__, "parameters")) { +} +Json::Value RpcParameters::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("hmi_levels", hmi_levels, &result__); + impl::WriteJsonField("parameters", parameters, &result__); + return result__; +} +bool RpcParameters::is_valid() const { + if (!hmi_levels.is_valid()) { + return false; + } + if (!parameters.is_valid()) { + return false; + } + return Validate(); +} +bool RpcParameters::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool RpcParameters::struct_empty() const { + if (hmi_levels.is_initialized()) { + return false; + } + if (parameters.is_initialized()) { + return false; + } + + return true; +} +void RpcParameters::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!hmi_levels.is_valid()) { + hmi_levels.ReportErrors(&report__->ReportSubobject("hmi_levels")); + } + if (!parameters.is_valid()) { + parameters.ReportErrors(&report__->ReportSubobject("parameters")); + } +} + +void RpcParameters::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + hmi_levels.SetPolicyTableType(pt_type); + parameters.SetPolicyTableType(pt_type); +} + +// Rpcs methods +Rpcs::Rpcs() + : CompositeType(kUninitialized) { +} +Rpcs::Rpcs(const Rpc& rpcs) + : CompositeType(kUninitialized), + rpcs(rpcs) { +} +Rpcs::~Rpcs() { +} +Rpcs::Rpcs(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + user_consent_prompt(impl::ValueMember(value__, "user_consent_prompt")), + rpcs(impl::ValueMember(value__, "rpcs")) { +} +Json::Value Rpcs::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("user_consent_prompt", user_consent_prompt, &result__); + impl::WriteJsonField("rpcs", rpcs, &result__); + return result__; +} +bool Rpcs::is_valid() const { + if (!user_consent_prompt.is_valid()) { + return false; + } + if (!rpcs.is_valid()) { + return false; + } + return Validate(); +} +bool Rpcs::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool Rpcs::struct_empty() const { + if (user_consent_prompt.is_initialized()) { + return false; + } + if (rpcs.is_initialized()) { + return false; + } + + return true; +} +void Rpcs::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!user_consent_prompt.is_valid()) { + user_consent_prompt.ReportErrors(&report__->ReportSubobject("user_consent_prompt")); + } + if (!rpcs.is_valid()) { + rpcs.ReportErrors(&report__->ReportSubobject("rpcs")); + } +} + +void Rpcs::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + user_consent_prompt.SetPolicyTableType(pt_type); + rpcs.SetPolicyTableType(pt_type); +} + +// ModuleConfig methods +ModuleConfig::ModuleConfig() + : CompositeType(kUninitialized) { +} +ModuleConfig::ModuleConfig(uint8_t exchange_after_x_ignition_cycles, int64_t exchange_after_x_kilometers, uint8_t exchange_after_x_days, uint16_t timeout_after_x_seconds, const SecondsBetweenRetries& seconds_between_retries, const ServiceEndpoints& endpoints, const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority) + : CompositeType(kUninitialized), + exchange_after_x_ignition_cycles(exchange_after_x_ignition_cycles), + exchange_after_x_kilometers(exchange_after_x_kilometers), + exchange_after_x_days(exchange_after_x_days), + timeout_after_x_seconds(timeout_after_x_seconds), + seconds_between_retries(seconds_between_retries), + endpoints(endpoints), + notifications_per_minute_by_priority(notifications_per_minute_by_priority) { +} +ModuleConfig::~ModuleConfig() { +} +ModuleConfig::ModuleConfig(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + device_certificates(impl::ValueMember(value__, "device_certificates")), + preloaded_pt(impl::ValueMember(value__, "preloaded_pt")), + exchange_after_x_ignition_cycles(impl::ValueMember(value__, "exchange_after_x_ignition_cycles")), + exchange_after_x_kilometers(impl::ValueMember(value__, "exchange_after_x_kilometers")), + exchange_after_x_days(impl::ValueMember(value__, "exchange_after_x_days")), + timeout_after_x_seconds(impl::ValueMember(value__, "timeout_after_x_seconds")), + seconds_between_retries(impl::ValueMember(value__, "seconds_between_retries")), + endpoints(impl::ValueMember(value__, "endpoints")), + notifications_per_minute_by_priority(impl::ValueMember(value__, "notifications_per_minute_by_priority")), + vehicle_make(impl::ValueMember(value__, "vehicle_make")), + vehicle_model(impl::ValueMember(value__, "vehicle_model")), + vehicle_year(impl::ValueMember(value__, "vehicle_year")) { +} +Json::Value ModuleConfig::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("device_certificates", device_certificates, &result__); + impl::WriteJsonField("preloaded_pt", preloaded_pt, &result__); + impl::WriteJsonField("exchange_after_x_ignition_cycles", exchange_after_x_ignition_cycles, &result__); + impl::WriteJsonField("exchange_after_x_kilometers", exchange_after_x_kilometers, &result__); + impl::WriteJsonField("exchange_after_x_days", exchange_after_x_days, &result__); + impl::WriteJsonField("timeout_after_x_seconds", timeout_after_x_seconds, &result__); + impl::WriteJsonField("seconds_between_retries", seconds_between_retries, &result__); + impl::WriteJsonField("endpoints", endpoints, &result__); + impl::WriteJsonField("notifications_per_minute_by_priority", notifications_per_minute_by_priority, &result__); + impl::WriteJsonField("vehicle_make", vehicle_make, &result__); + impl::WriteJsonField("vehicle_model", vehicle_model, &result__); + impl::WriteJsonField("vehicle_year", vehicle_year, &result__); + return result__; +} +bool ModuleConfig::is_valid() const { + if (!device_certificates.is_valid()) { + return false; + } + if (!preloaded_pt.is_valid()) { + return false; + } + if (!exchange_after_x_ignition_cycles.is_valid()) { + return false; + } + if (!exchange_after_x_kilometers.is_valid()) { + return false; + } + if (!exchange_after_x_days.is_valid()) { + return false; + } + if (!timeout_after_x_seconds.is_valid()) { + return false; + } + if (!seconds_between_retries.is_valid()) { + return false; + } + if (!endpoints.is_valid()) { + return false; + } + if (!notifications_per_minute_by_priority.is_valid()) { + return false; + } + if (!vehicle_make.is_valid()) { + return false; + } + if (!vehicle_model.is_valid()) { + return false; + } + if (!vehicle_year.is_valid()) { + return false; + } + return Validate(); +} +bool ModuleConfig::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool ModuleConfig::struct_empty() const { + if (device_certificates.is_initialized()) { + return false; + } + if (preloaded_pt.is_initialized()) { + return false; + } + + if (exchange_after_x_ignition_cycles.is_initialized()) { + return false; + } + if (exchange_after_x_kilometers.is_initialized()) { + return false; + } + + if (exchange_after_x_days.is_initialized()) { + return false; + } + if (timeout_after_x_seconds.is_initialized()) { + return false; + } + + if (seconds_between_retries.is_initialized()) { + return false; + } + if (endpoints.is_initialized()) { + return false; + } + + if (notifications_per_minute_by_priority.is_initialized()) { + return false; + } + if (vehicle_make.is_initialized()) { + return false; + } + + if (vehicle_model.is_initialized()) { + return false; + } + if (vehicle_year.is_initialized()) { + return false; + } + + return true; +} +void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!device_certificates.is_valid()) { + device_certificates.ReportErrors(&report__->ReportSubobject("device_certificates")); + } + if (!preloaded_pt.is_valid()) { + preloaded_pt.ReportErrors(&report__->ReportSubobject("preloaded_pt")); + } + if (!exchange_after_x_ignition_cycles.is_valid()) { + exchange_after_x_ignition_cycles.ReportErrors(&report__->ReportSubobject("exchange_after_x_ignition_cycles")); + } + if (!exchange_after_x_kilometers.is_valid()) { + exchange_after_x_kilometers.ReportErrors(&report__->ReportSubobject("exchange_after_x_kilometers")); + } + if (!exchange_after_x_days.is_valid()) { + exchange_after_x_days.ReportErrors(&report__->ReportSubobject("exchange_after_x_days")); + } + if (!timeout_after_x_seconds.is_valid()) { + timeout_after_x_seconds.ReportErrors(&report__->ReportSubobject("timeout_after_x_seconds")); + } + if (!seconds_between_retries.is_valid()) { + seconds_between_retries.ReportErrors(&report__->ReportSubobject("seconds_between_retries")); + } + if (!endpoints.is_valid()) { + endpoints.ReportErrors(&report__->ReportSubobject("endpoints")); + } + if (!notifications_per_minute_by_priority.is_valid()) { + notifications_per_minute_by_priority.ReportErrors(&report__->ReportSubobject("notifications_per_minute_by_priority")); + } + if (!vehicle_make.is_valid()) { + vehicle_make.ReportErrors(&report__->ReportSubobject("vehicle_make")); + } + if (!vehicle_model.is_valid()) { + vehicle_model.ReportErrors(&report__->ReportSubobject("vehicle_model")); + } + if (!vehicle_year.is_valid()) { + vehicle_year.ReportErrors(&report__->ReportSubobject("vehicle_year")); + } + if (PT_PRELOADED == GetPolicyTableType()) { + std::string validation_info = ommited_validation_info + + PolicyTableTypeToString(GetPolicyTableType()); + rpc::ValidationReport* ommited_field_report; + if (vehicle_make.is_initialized()) { + ommited_field_report = &report__->ReportSubobject("vehicle_make"); + ommited_field_report->set_validation_info(validation_info); + } + if (vehicle_year.is_initialized()) { + ommited_field_report = &report__->ReportSubobject("vehicle_year"); + ommited_field_report->set_validation_info(validation_info); + } + if (vehicle_model.is_initialized()) { + ommited_field_report = &report__->ReportSubobject("vehicle_model"); + ommited_field_report->set_validation_info(validation_info); + } + } +} + +void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + device_certificates.SetPolicyTableType(pt_type); + preloaded_pt.SetPolicyTableType(pt_type); + exchange_after_x_ignition_cycles.SetPolicyTableType(pt_type); + exchange_after_x_kilometers.SetPolicyTableType(pt_type); + exchange_after_x_days.SetPolicyTableType(pt_type); + timeout_after_x_seconds.SetPolicyTableType(pt_type); + seconds_between_retries.SetPolicyTableType(pt_type); + endpoints.SetPolicyTableType(pt_type); + notifications_per_minute_by_priority.SetPolicyTableType(pt_type); + vehicle_make.SetPolicyTableType(pt_type); + vehicle_model.SetPolicyTableType(pt_type); + vehicle_year.SetPolicyTableType(pt_type); +} + +// MessageString methods +MessageString::MessageString() + : CompositeType(kUninitialized) { +} +MessageString::~MessageString() { +} +MessageString::MessageString(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + line1(impl::ValueMember(value__, "line1")), + line2(impl::ValueMember(value__, "line2")), + tts(impl::ValueMember(value__, "tts")), + label(impl::ValueMember(value__, "label")), + textBody(impl::ValueMember(value__, "textBody")) { +} +Json::Value MessageString::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("line1", line1, &result__); + impl::WriteJsonField("line2", line2, &result__); + impl::WriteJsonField("tts", tts, &result__); + impl::WriteJsonField("label", label, &result__); + impl::WriteJsonField("textBody", textBody, &result__); + return result__; +} +bool MessageString::is_valid() const { + if (struct_empty()) { + return initialization_state__ == kInitialized && Validate(); + } + if (!line1.is_valid()) { + return false; + } + if (!line2.is_valid()) { + return false; + } + if (!tts.is_valid()) { + return false; + } + if (!label.is_valid()) { + return false; + } + if (!textBody.is_valid()) { + return false; + } + return Validate(); +} +bool MessageString::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool MessageString::struct_empty() const { + if (line1.is_initialized()) { + return false; + } + if (line2.is_initialized()) { + return false; + } + + if (tts.is_initialized()) { + return false; + } + if (label.is_initialized()) { + return false; + } + + if (textBody.is_initialized()) { + return false; + } + return true; +} +void MessageString::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!line1.is_valid()) { + line1.ReportErrors(&report__->ReportSubobject("line1")); + } + if (!line2.is_valid()) { + line2.ReportErrors(&report__->ReportSubobject("line2")); + } + if (!tts.is_valid()) { + tts.ReportErrors(&report__->ReportSubobject("tts")); + } + if (!label.is_valid()) { + label.ReportErrors(&report__->ReportSubobject("label")); + } + if (!textBody.is_valid()) { + textBody.ReportErrors(&report__->ReportSubobject("textBody")); + } +} + +void MessageString::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + line1.SetPolicyTableType(pt_type); + line2.SetPolicyTableType(pt_type); + tts.SetPolicyTableType(pt_type); + label.SetPolicyTableType(pt_type); + textBody.SetPolicyTableType(pt_type); +} + +// MessageLanguages methods +MessageLanguages::MessageLanguages() + : CompositeType(kUninitialized) { +} +MessageLanguages::MessageLanguages(const Languages& languages) + : CompositeType(kUninitialized), + languages(languages) { +} +MessageLanguages::~MessageLanguages() { +} +MessageLanguages::MessageLanguages(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + languages(impl::ValueMember(value__, "languages")) { +} +Json::Value MessageLanguages::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("languages", languages, &result__); + return result__; +} +bool MessageLanguages::is_valid() const { + if (!languages.is_valid()) { + return false; + } + return Validate(); +} +bool MessageLanguages::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool MessageLanguages::struct_empty() const { + if (languages.is_initialized()) { + return false; + } + return true; +} + +void MessageLanguages::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (PT_SNAPSHOT == GetPolicyTableType()) { + if (languages.is_initialized()) { + std::string validation_info = ommited_validation_info + + PolicyTableTypeToString(GetPolicyTableType()); + report__->ReportSubobject("languages").set_validation_info(validation_info); + } + } + if (!languages.is_valid()) { + languages.ReportErrors(&report__->ReportSubobject("languages")); + } +} + +void MessageLanguages::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + languages.SetPolicyTableType(pt_type); +} + +// ConsumerFriendlyMessages methods +ConsumerFriendlyMessages::ConsumerFriendlyMessages() + : CompositeType(kUninitialized) { +} +ConsumerFriendlyMessages::ConsumerFriendlyMessages(const std::string& version) + : CompositeType(kUninitialized), + version(version) { +} +ConsumerFriendlyMessages::~ConsumerFriendlyMessages() { +} +ConsumerFriendlyMessages::ConsumerFriendlyMessages(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + version(impl::ValueMember(value__, "version")), + messages(impl::ValueMember(value__, "messages")) { +} +Json::Value ConsumerFriendlyMessages::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("version", version, &result__); + impl::WriteJsonField("messages", messages, &result__); + return result__; +} +bool ConsumerFriendlyMessages::is_valid() const { + if (!version.is_valid()) { + return false; + } + if (!messages.is_valid()) { + return false; + } + return Validate(); +} +bool ConsumerFriendlyMessages::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool ConsumerFriendlyMessages::struct_empty() const { + if (version.is_initialized()) { + return false; + } + if (messages.is_initialized()) { + return false; + } + + return true; +} +void ConsumerFriendlyMessages::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!version.is_valid()) { + version.ReportErrors(&report__->ReportSubobject("version")); + } + if (PT_SNAPSHOT == GetPolicyTableType()) { + if (messages.is_initialized()) { + std::string validation_info = ommited_validation_info + + PolicyTableTypeToString(GetPolicyTableType()); + report__->ReportSubobject("messages").set_validation_info(validation_info); + } + } + if (!messages.is_valid()) { + messages.ReportErrors(&report__->ReportSubobject("messages")); + } +} + +void ConsumerFriendlyMessages::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + version.SetPolicyTableType(pt_type); + messages.SetPolicyTableType(pt_type); +} + +// ModuleMeta methods +ModuleMeta::ModuleMeta() + : CompositeType(kUninitialized) { +} +ModuleMeta::~ModuleMeta() { +} +ModuleMeta::ModuleMeta(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)) { +} +Json::Value ModuleMeta::ToJsonValue() const { + Json::Value result__(Json::objectValue); + return result__; +} +bool ModuleMeta::is_valid() const { + if (struct_empty()) { + return initialization_state__ == kInitialized && Validate(); + } + return Validate(); +} +bool ModuleMeta::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool ModuleMeta::struct_empty() const { + return true; +} +void ModuleMeta::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } +} + +// AppLevel methods +AppLevel::AppLevel() + : CompositeType(kUninitialized) { +} +AppLevel::~AppLevel() { +} +AppLevel::AppLevel(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)) { +} +Json::Value AppLevel::ToJsonValue() const { + Json::Value result__(Json::objectValue); + return result__; +} +bool AppLevel::is_valid() const { + if (struct_empty()) { + return initialization_state__ == kInitialized && Validate(); + } + return Validate(); +} +bool AppLevel::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool AppLevel::struct_empty() const { + return true; +} +void AppLevel::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (PT_PRELOADED == GetPolicyTableType() || + PT_UPDATE == GetPolicyTableType()) { + std::string validation_info = ommited_validation_info + + PolicyTableTypeToString(GetPolicyTableType()); + report__->set_validation_info(validation_info); + } +} + +// UsageAndErrorCounts methods +UsageAndErrorCounts::UsageAndErrorCounts() + : CompositeType(kUninitialized) { +} + +UsageAndErrorCounts::~UsageAndErrorCounts() { +} +UsageAndErrorCounts::UsageAndErrorCounts(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + app_level(impl::ValueMember(value__, "app_level")) { +} +Json::Value UsageAndErrorCounts::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("app_level", app_level, &result__); + return result__; +} +bool UsageAndErrorCounts::is_valid() const { + if (struct_empty()) { + return initialization_state__ == kInitialized && Validate(); + } + if (!app_level.is_valid()) { + return false; + } + return Validate(); +} +bool UsageAndErrorCounts::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool UsageAndErrorCounts::struct_empty() const { + if (app_level.is_initialized()) { + return false; + } + return true; +} +void UsageAndErrorCounts::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (PT_PRELOADED == GetPolicyTableType() || + PT_UPDATE == GetPolicyTableType()) { + std::string validation_info = ommited_validation_info + + PolicyTableTypeToString(GetPolicyTableType()); + report__->set_validation_info(validation_info); + } + if (!app_level.is_valid()) { + app_level.ReportErrors(&report__->ReportSubobject("app_level")); + } +} + +void UsageAndErrorCounts::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + app_level.SetPolicyTableType(pt_type); +} + +// DeviceParams methods +DeviceParams::DeviceParams() + : CompositeType(kUninitialized) { +} +DeviceParams::~DeviceParams() { +} +DeviceParams::DeviceParams(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)) { +} +Json::Value DeviceParams::ToJsonValue() const { + Json::Value result__(Json::objectValue); + return result__; +} +bool DeviceParams::is_valid() const { + if (struct_empty()) { + return initialization_state__ == kInitialized && Validate(); + } + return Validate(); +} +bool DeviceParams::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool DeviceParams::struct_empty() const { + return true; +} +void DeviceParams::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } +} + +// PolicyTable methods +PolicyTable::PolicyTable() + : CompositeType(kUninitialized) { +} +PolicyTable::PolicyTable(const ApplicationPolicies& app_policies, const FunctionalGroupings& functional_groupings, const ConsumerFriendlyMessages& consumer_friendly_messages, const ModuleConfig& module_config) + : CompositeType(kUninitialized), + app_policies(app_policies), + functional_groupings(functional_groupings), + consumer_friendly_messages(consumer_friendly_messages), + module_config(module_config) { +} +PolicyTable::~PolicyTable() { +} +PolicyTable::PolicyTable(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + app_policies(impl::ValueMember(value__, "app_policies")), + functional_groupings(impl::ValueMember(value__, "functional_groupings")), + consumer_friendly_messages(impl::ValueMember(value__, "consumer_friendly_messages")), + module_config(impl::ValueMember(value__, "module_config")), + module_meta(impl::ValueMember(value__, "module_meta")), + usage_and_error_counts(impl::ValueMember(value__, "usage_and_error_counts")), + device_data(impl::ValueMember(value__, "device_data")) { +} +Json::Value PolicyTable::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("app_policies", app_policies, &result__); + impl::WriteJsonField("functional_groupings", functional_groupings, &result__); + impl::WriteJsonField("consumer_friendly_messages", consumer_friendly_messages, &result__); + impl::WriteJsonField("module_config", module_config, &result__); + impl::WriteJsonField("module_meta", module_meta, &result__); + impl::WriteJsonField("usage_and_error_counts", usage_and_error_counts, &result__); + impl::WriteJsonField("device_data", device_data, &result__); + return result__; +} +bool PolicyTable::is_valid() const { + if (!app_policies.is_valid()) { + return false; + } + if (!functional_groupings.is_valid()) { + return false; + } + if (!consumer_friendly_messages.is_valid()) { + return false; + } + if (!module_config.is_valid()) { + return false; + } + if (!module_meta.is_valid()) { + return false; + } + if (!usage_and_error_counts.is_valid()) { + return false; + } + if (!device_data.is_valid()) { + return false; + } + return Validate(); +} +bool PolicyTable::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool PolicyTable::struct_empty() const { + if (app_policies.is_initialized()) { + return false; + } + if (functional_groupings.is_initialized()) { + return false; + } + + if (consumer_friendly_messages.is_initialized()) { + return false; + } + if (module_config.is_initialized()) { + return false; + } + + if (module_meta.is_initialized()) { + return false; + } + if (usage_and_error_counts.is_initialized()) { + return false; + } + + if (device_data.is_initialized()) { + return false; + } + return true; +} +void PolicyTable::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (PT_PRELOADED == GetPolicyTableType() || + PT_UPDATE == GetPolicyTableType()) { + std::string validation_info = ommited_validation_info + + PolicyTableTypeToString(GetPolicyTableType()); + + if (device_data.is_initialized()) { + report__->ReportSubobject("device_data").set_validation_info(validation_info); + } + } + if (!app_policies.is_valid()) { + app_policies.ReportErrors(&report__->ReportSubobject("app_policies")); + } + if (!functional_groupings.is_valid()) { + functional_groupings.ReportErrors(&report__->ReportSubobject("functional_groupings")); + } + if (!consumer_friendly_messages.is_valid()) { + consumer_friendly_messages.ReportErrors(&report__->ReportSubobject("consumer_friendly_messages")); + } + if (!module_config.is_valid()) { + module_config.ReportErrors(&report__->ReportSubobject("module_config")); + } + if (!module_meta.is_valid()) { + module_meta.ReportErrors(&report__->ReportSubobject("module_meta")); + } + if (!usage_and_error_counts.is_valid()) { + usage_and_error_counts.ReportErrors(&report__->ReportSubobject("usage_and_error_counts")); + } + if (!device_data.is_valid()) { + device_data.ReportErrors(&report__->ReportSubobject("device_data")); + } +} + +void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + app_policies.SetPolicyTableType(pt_type); + functional_groupings.SetPolicyTableType(pt_type); + consumer_friendly_messages.SetPolicyTableType(pt_type); + module_config.SetPolicyTableType(pt_type); + module_meta.SetPolicyTableType(pt_type); + usage_and_error_counts.SetPolicyTableType(pt_type); + device_data.SetPolicyTableType(pt_type); +} + +// Table methods +Table::Table() + : CompositeType(kUninitialized) { +} +Table::Table(const PolicyTable& policy_table) + : CompositeType(kUninitialized), + policy_table(policy_table) { +} +Table::~Table() { +} +Table::Table(const Json::Value* value__) + : CompositeType(InitHelper(value__, &Json::Value::isObject)), + policy_table(impl::ValueMember(value__, "policy_table")) { +} +Json::Value Table::ToJsonValue() const { + Json::Value result__(Json::objectValue); + impl::WriteJsonField("policy_table", policy_table, &result__); + return result__; +} +bool Table::is_valid() const { + if (!policy_table.is_valid()) { + return false; + } + return Validate(); +} +bool Table::is_initialized() const { + return (initialization_state__ != kUninitialized) || (!struct_empty()); +} +bool Table::struct_empty() const { + if (policy_table.is_initialized()) { + return false; + } + return true; +} +void Table::ReportErrors(rpc::ValidationReport* report__) const { + if (struct_empty()) { + rpc::CompositeType::ReportErrors(report__); + } + if (!policy_table.is_valid()) { + policy_table.ReportErrors(&report__->ReportSubobject("policy_table")); + } +} + +void Table::SetPolicyTableType(PolicyTableType pt_type) { + CompositeType::SetPolicyTableType(pt_type); + policy_table.SetPolicyTableType(pt_type); +} + +} // namespace policy_table_interface_base +} // namespace rpc + diff --git a/src/components/policy/src/policy/policy_table/table_struct/types.h b/src/components/policy/src/policy/policy_table/table_struct/types.h new file mode 100644 index 0000000000..5171d9fc75 --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/types.h @@ -0,0 +1,312 @@ +// This file is generated, do not edit +#ifndef POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_ +#define POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_ +#include "./enums.h" +#include "rpc_base/rpc_message.h" +namespace Json { +class Value; +} // namespace Json +namespace rpc { +namespace policy_table_interface_base { +struct AppLevel; +struct ApplicationParams; +struct DeviceParams; +struct MessageLanguages; +struct MessageString; +struct RpcParameters; +struct Rpcs; +} // namespace policy_table_interface_base +} // namespace rpc + + +namespace rpc { +namespace policy_table_interface_base { + +typedef Array< String<1, 255>, 0, 255 > Strings; + +typedef Array< Enum<AppHMIType>, 0, 255 > AppHMITypes; + +typedef Array< Enum<HmiLevel>, 0, 4 > HmiLevels; + +typedef Array< Enum<Parameter>, 0, 24 > Parameters; + +typedef Map< RpcParameters, 0, 50 > Rpc; + +typedef Array< String<10, 255>, 1, 255 > URL; + +typedef Map< URL, 1, 255 > URLList; + +typedef Map< URLList, 1, 255 > ServiceEndpoints; + +typedef Map< Integer<uint8_t, 0, 255>, 0, 6 > NumberOfNotificationsPerMinute; + +typedef Array< Integer<uint16_t, 1, 1000>, 0, 10 > SecondsBetweenRetries; + +typedef Map< MessageString, 0, 500 > Languages; + +typedef Map< MessageLanguages, 0, 255 > Messages; + +typedef Map< AppLevel, 0, 255 > AppLevels; + +typedef Map< Stringifyable < Nullable< ApplicationParams > >, 1, 1000 > ApplicationPolicies; + +typedef Map< Rpcs, 1, 255 > FunctionalGroupings; + +typedef Map< DeviceParams, 0, 255 > DeviceData; + +struct ApplicationParams : CompositeType { + public: + Strings groups; + Optional< Strings > nicknames; + Optional< AppHMITypes > AppHMIType; + Enum<Priority> priority; + Optional< Integer<uint16_t, 1, 65225> > memory_kb; + Optional< Integer<uint16_t, 1, 65225> > heart_beat_timeout_ms; + Optional< String<0, 255> > certificate; + public: + ApplicationParams(); + explicit ApplicationParams(const Strings& groups); + ~ApplicationParams(); + explicit ApplicationParams(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct RpcParameters : CompositeType { + public: + HmiLevels hmi_levels; + Optional< Parameters > parameters; + public: + RpcParameters(); + explicit RpcParameters(const HmiLevels& hmi_levels); + ~RpcParameters(); + explicit RpcParameters(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct Rpcs : CompositeType { + public: + Optional< String<1, 255> > user_consent_prompt; + Nullable< Rpc > rpcs; + public: + Rpcs(); + explicit Rpcs(const Rpc& rpcs); + ~Rpcs(); + explicit Rpcs(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct ModuleConfig : CompositeType { + public: + Optional< Map< String<0, 100>, 0, 255 > > device_certificates; + Optional< Boolean > preloaded_pt; + Integer<uint8_t, 0, 255> exchange_after_x_ignition_cycles; + Integer<int64_t, 0, 4294967296ll> exchange_after_x_kilometers; + Integer<uint8_t, 0, 255> exchange_after_x_days; + Integer<uint16_t, 0, 65535> timeout_after_x_seconds; + SecondsBetweenRetries seconds_between_retries; + ServiceEndpoints endpoints; + NumberOfNotificationsPerMinute notifications_per_minute_by_priority; + Optional< String<1, 100> > vehicle_make; + Optional< String<1, 100> > vehicle_model; + Optional< String<4, 4> > vehicle_year; + public: + ModuleConfig(); + ModuleConfig(uint8_t exchange_after_x_ignition_cycles, int64_t exchange_after_x_kilometers, uint8_t exchange_after_x_days, uint16_t timeout_after_x_seconds, const SecondsBetweenRetries& seconds_between_retries, const ServiceEndpoints& endpoints, const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority); + ~ModuleConfig(); + explicit ModuleConfig(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct MessageString : CompositeType { + public: + Optional< String<1, 65535> > line1; + Optional< String<1, 65535> > line2; + Optional< String<1, 65535> > tts; + Optional< String<1, 65535> > label; + Optional< String<1, 65535> > textBody; + public: + MessageString(); + ~MessageString(); + explicit MessageString(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct MessageLanguages : CompositeType { + public: + Languages languages; + public: + MessageLanguages(); + explicit MessageLanguages(const Languages& languages); + ~MessageLanguages(); + explicit MessageLanguages(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct ConsumerFriendlyMessages : CompositeType { + public: + String<1, 100> version; + Optional< Messages > messages; + public: + ConsumerFriendlyMessages(); + explicit ConsumerFriendlyMessages(const std::string& version); + ~ConsumerFriendlyMessages(); + explicit ConsumerFriendlyMessages(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct ModuleMeta : CompositeType { + public: + public: + ModuleMeta(); + ~ModuleMeta(); + explicit ModuleMeta(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + private: + bool Validate() const; +}; + +struct AppLevel : CompositeType { + public: + public: + AppLevel(); + ~AppLevel(); + explicit AppLevel(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + private: + bool Validate() const; +}; + +struct UsageAndErrorCounts : CompositeType { + public: + Optional< AppLevels > app_level; + public: + UsageAndErrorCounts(); + ~UsageAndErrorCounts(); + explicit UsageAndErrorCounts(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct DeviceParams : CompositeType { + public: + public: + DeviceParams(); + ~DeviceParams(); + explicit DeviceParams(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + private: + bool Validate() const; +}; + +struct PolicyTable : CompositeType { + public: + ApplicationPolicies app_policies; + FunctionalGroupings functional_groupings; + Optional < ConsumerFriendlyMessages > consumer_friendly_messages; + ModuleConfig module_config; + Optional< ModuleMeta > module_meta; + Optional< UsageAndErrorCounts > usage_and_error_counts; + Optional< DeviceData > device_data; + public: + PolicyTable(); + PolicyTable(const ApplicationPolicies& app_policies, const FunctionalGroupings& functional_groupings, const ConsumerFriendlyMessages& consumer_friendly_messages, const ModuleConfig& module_config); + ~PolicyTable(); + explicit PolicyTable(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; + +struct Table : CompositeType { + public: + PolicyTable policy_table; + public: + Table(); + explicit Table(const PolicyTable& policy_table); + ~Table(); + explicit Table(const Json::Value* value__); + Json::Value ToJsonValue() const; + bool is_valid() const; + bool is_initialized() const; + bool struct_empty() const; + void ReportErrors(rpc::ValidationReport* report__) const; + virtual void SetPolicyTableType(PolicyTableType pt_type); + private: + bool Validate() const; +}; +} // namespace policy_table_interface_base +} // namespace rpc + +#endif // POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_ diff --git a/src/components/policy/src/policy/policy_table/table_struct/validation.cc b/src/components/policy/src/policy/policy_table/table_struct/validation.cc new file mode 100644 index 0000000000..65fc231dee --- /dev/null +++ b/src/components/policy/src/policy/policy_table/table_struct/validation.cc @@ -0,0 +1,97 @@ +// This file is generated, do not edit +#include "./types.h" + +namespace rpc { +namespace policy_table_interface_base { +bool ApplicationParams::Validate() const { + return true; +} +bool RpcParameters::Validate() const { + return true; +} +bool Rpcs::Validate() const { + return true; +} + +bool ModuleConfig::Validate() const { + + if (PT_PRELOADED == GetPolicyTableType()) { + + if (vehicle_make.is_initialized()) { + return false; + } + if (vehicle_year.is_initialized()) { + return false; + } + if (vehicle_model.is_initialized()) { + return false; + } + } + return true; +} + +bool MessageString::Validate() const { + return true; +} + +bool MessageLanguages::Validate() const { + if (PT_SNAPSHOT == GetPolicyTableType()) { + return false; + } + return true; +} + +bool ConsumerFriendlyMessages::Validate() const { + if (PT_SNAPSHOT == GetPolicyTableType()) { + return false; + } + return true; +} + +bool ModuleMeta::Validate() const { + return true; +} + +bool AppLevel::Validate() const { + if (PT_PRELOADED == GetPolicyTableType() || + PT_UPDATE == GetPolicyTableType()) { + return false; + } + return true; +} + +bool UsageAndErrorCounts::Validate() const { + if (PT_PRELOADED == GetPolicyTableType() || + PT_UPDATE == GetPolicyTableType()) { + return false; + } + return true; +} +bool DeviceParams::Validate() const { + return true; +} +bool PolicyTable::Validate() const { + for (ApplicationPolicies::const_iterator it = app_policies.begin(); + app_policies.end() != it; ++it) { + if (kDeviceApp == it->first) { + if (it->second.nicknames.is_initialized()) { + initialization_state__ = kUninitialized; + return false; + } + continue; + } + } + if (PT_PRELOADED == GetPolicyTableType() || + PT_UPDATE == GetPolicyTableType()) { + if (device_data.is_initialized()) { + return false; + } + } + return true; +} +bool Table::Validate() const { + return true; +} +} // namespace policy_table_interface_base +} // namespace rpc + diff --git a/src/components/policy/src/policy/policy_table_interface.xml b/src/components/policy/src/policy/policy_table_interface.xml new file mode 100644 index 0000000000..6b671226ae --- /dev/null +++ b/src/components/policy/src/policy/policy_table_interface.xml @@ -0,0 +1,225 @@ +<?xml version="1.0" standalone="no"?> +<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?> + +<interface name="policy table interface base" version="0.0" + date="2014-01-23"> + + <!-- Common parameters start --> + <enum name="Priority"> + <element name="EMERGENCY" /> + <element name="NAVIGATION" /> + <element name="VOICECOM" /> + <element name="COMMUNICATION" /> + <element name="NORMAL" /> + <element name="NONE" /> + </enum> + + <enum name="HmiLevel"> + <element name="BACKGROUND" /> + <element name="FULL" /> + <element name="LIMITED" /> + <element name="NONE" /> + </enum> + + <enum name="Parameter"> + <element name="gps" /> + <element name="speed" /> + <element name="engineTorque" /> + <element name="externalTemperature" /> + <element name="fuelLevel" /> + <element name="fuelLevel_State" /> + <element name="headLampStatus" /> + <element name="instantFuelConsumption" /> + <element name="odometer" /> + <element name="tirePressure" /> + <element name="wiperStatus" /> + <element name="vin" /> + <element name="accPedalPosition" /> + <element name="beltStatus" /> + <element name="driverBraking" /> + <element name="prndl" /> + <element name="rpm" /> + <element name="steeringWheelAngle" /> + <element name="myKey" /> + <element name="airbagStatus" /> + <element name="bodyInformation" /> + <element name="clusterModeStatus" /> + <element name="deviceStatus" /> + <element name="emergencyEvent" /> + <element name="eCallInfo" /> + </enum> + + <enum name="AppHMIType"> + <element name="DEFAULT" /> + <element name="COMMUNICATION" /> + <element name="MEDIA" /> + <element name="MESSAGING" /> + <element name="NAVIGATION" /> + <element name="INFORMATION" /> + <element name="SOCIAL" /> + <element name="BACKGROUND_PROCESS" /> + <element name="TESTING" /> + <element name="SYSTEM" /> + </enum> + <!-- Common parameters end --> + + <!-- app_policies section start --> + + <typedef name="Strings" type="String" maxlength="255" array="true" + maxsize="255" /> + + <typedef name="AppHMITypes" type="AppHMIType" array="true" + maxsize="255" /> + + <struct name="ApplicationParams"> + <param name="groups" type="Strings" /> + <param name="nicknames" type="Strings" mandatory="false" /> + <param name="AppHMIType" type="AppHMITypes" mandatory="false" /> + <param name="memory_kb" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/> + <param name="watchdog_timer_ms" type="Integer" minvalue="1" + maxvalue="65225" mandatory="false"/> + <param name="certificate" type="String" minlength="0" maxlength="255" + mandatory="false" /> + </struct> + + <typedef name="HmiLevels" type="HmiLevel" array="true" + maxsize="4" /> + <typedef name="Parameters" type="Parameter" array="true" + maxsize="24" /> + + <struct name="RpcParameters"> + <!-- maxsizes are equal to number of currently known elements of + given type --> + <param name="hmi_levels" type="HmiLevels" /> + <param name="parameters" type="Parameters" mandatory="false" /> + </struct> + + <!-- maxsizes are equal to number of currently known elements of given + type --> + <typedef name="Rpc" type="RpcParameters" map="true" maxsize="50" /> + + <struct name="Rpcs"> + <param name="user_consent_prompt" type="String" minlegth="1" + maxlength="255" mandatory="false"/> + <param name="rpcs" type="Rpc" null_values_allowed="true"/> + </struct> + <!-- app_policies section end --> + + <!-- module_config section start --> + <!-- minlenght="10" since minimum expected is "http://a.b" --> + <typedef name="URL" type="String" minlength="10" maxlength="255" + array="true" minsize="1" maxsize="255" /> + + <typedef name="URLList" type="URL" map="true" minsize="1" + maxsize="255" /> + + <!-- max number of services is limited to 255 according to protocol specification --> + <typedef name="ServiceEndpoints" type="URLList" map="true" + minsize="1" maxsize="255" /> + + <typedef name="NumberOfNotificationsPerMinute" type="Integer" + map="true" maxsize="6" minvalue="0" maxvalue="255" /> + + <typedef name="SecondsBetweenRetries" type="Integer" array="true" + maxsize="10" minvalue="1" maxvalue="1000" /> + + <struct name="ModuleConfig"> + <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" /> + <param name="preloaded_pt" type="Boolean" mandatory="false" /> + <param name="exchange_after_x_ignition_cycles" type="Integer" + maxvalue="255" /> + <param name="exchange_after_x_kilometers" type="Integer" + maxvalue="4294967296" /> + <param name="exchange_after_x_days" type="Integer" + maxvalue="255" /> + <param name="timeout_after_x_seconds" type="Integer" + maxvalue="65535" /> + <param name="seconds_between_retries" type="SecondsBetweenRetries" /> + <param name="endpoints" type="ServiceEndpoints" /> + <param name="notifications_per_minute_by_priority" type="NumberOfNotificationsPerMinute" /> + <param name="vehicle_make" type="String" maxlength="100" + mandatory="false" /> + <param name="vehicle_model" type="String" maxlength="100" + mandatory="false" /> + <param name="vehicle_year" type="String" minlength="4" maxlength="4" + mandatory="false" /> + </struct> + <!-- module_config section end --> + + <!-- consumer_friendly_messages section start --> + <struct name="MessageString"> + <param name="line1" type="String" maxlength="255" + mandatory="false" /> + <param name="line2" type="String" maxlength="255" + mandatory="false" /> + <param name="tts" type="String" maxlength="65535" mandatory="false" /> + <param name="label" type="String" maxlength="255" + mandatory="false" /> + <param name="textBody" type="String" maxlength="500" + mandatory="false" /> + </struct> + + <typedef name="Languages" map="true" type="MessageString" + maxsize="500" mandatory="false" /> + + <struct name="MessageLanguages"> + <param name="languages" type="Languages" /> + </struct> + + <typedef name="Messages" map="true" type="MessageLanguages" + maxsize="255" /> + + <struct name="ConsumerFriendlyMessages"> + <param name="version" type="String" maxlength="100" /> + <param name="messages" type="Messages" mandatory="false" /> + </struct> + <!-- consumer_friendly_messages section end --> + + <!-- module_meta section start --> + <struct name="ModuleMeta"> + </struct> + <!-- module_meta section end --> + + <!-- usage_and_error_counts section start --> + <struct name="AppLevel"> + </struct> + + <typedef name="AppLevels" type="AppLevel" map="true" maxsize="255" /> + + <struct name="UsageAndErrorCounts"> + <param name="app_level" type="AppLevels" mandatory="false" /> + </struct> + <!-- usage_and_error_counts section end --> + + <!-- device_data section start --> + <struct name="DeviceParams"> + </struct> + <!-- device_data section end --> + + <!-- policy_table section start --> + <typedef name="ApplicationPolicies" map="true" type="ApplicationParams" null_values_allowed="true" minsize="1" maxsize="1000" /> + + <typedef name="FunctionalGroupings" map="true" type="Rpcs" + minsize="1" maxsize="255" /> + + <typedef name="DeviceData" map="true" type="DeviceParams" + maxsize="255" /> + + <struct name="PolicyTable"> + <!-- maxsize for app_policies can be changed, if necessary --> + <param name="app_policies" type="ApplicationPolicies" /> + <param name="functional_groupings" type="FunctionalGroupings" /> + <param name="consumer_friendly_messages" type="ConsumerFriendlyMessages" /> + <param name="module_config" type="ModuleConfig" /> + <param name="module_meta" type="ModuleMeta" mandatory="false"/> + <param name="usage_and_error_counts" type="UsageAndErrorCounts" mandatory="false" /> + <param name="device_data" type="DeviceData" mandatory="false" /> + </struct> + <!-- policy_table section end --> + + <!-- Root element --> + <struct name="Table"> + <param name="policy_table" type="PolicyTable" /> + </struct> + +</interface> diff --git a/src/components/policy/src/policy/policy_table_interface_ext.xml b/src/components/policy/src/policy/policy_table_interface_ext.xml new file mode 100644 index 0000000000..468eec2b0b --- /dev/null +++ b/src/components/policy/src/policy/policy_table_interface_ext.xml @@ -0,0 +1,279 @@ +<?xml version="1.0" standalone="no"?> +<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?> + +<interface name="policy table interface base" version="0.0" + date="2014-01-23"> + + <!-- Common parameters start --> + <enum name="Priority"> + <element name="EMERGENCY" /> + <element name="NAVIGATION" /> + <element name="VOICECOM" /> + <element name="COMMUNICATION" /> + <element name="NORMAL" /> + <element name="NONE" /> + </enum> + + <enum name="HmiLevel"> + <element name="BACKGROUND" /> + <element name="FULL" /> + <element name="LIMITED" /> + <element name="NONE" /> + </enum> + + <enum name="Parameter"> + <element name="gps" /> + <element name="speed" /> + <element name="engineTorque" /> + <element name="externalTemperature" /> + <element name="fuelLevel" /> + <element name="fuelLevel_State" /> + <element name="headLampStatus" /> + <element name="instantFuelConsumption" /> + <element name="odometer" /> + <element name="tirePressure" /> + <element name="wiperStatus" /> + <element name="vin" /> + <element name="accPedalPosition" /> + <element name="beltStatus" /> + <element name="driverBraking" /> + <element name="prndl" /> + <element name="rpm" /> + <element name="steeringWheelAngle" /> + <element name="myKey" /> + <element name="airbagStatus" /> + <element name="bodyInformation" /> + <element name="clusterModeStatus" /> + <element name="deviceStatus" /> + <element name="emergencyEvent" /> + <element name="eCallInfo" /> + </enum> + + <enum name="AppHMIType"> + <element name="DEFAULT" /> + <element name="COMMUNICATION" /> + <element name="MEDIA" /> + <element name="MESSAGING" /> + <element name="NAVIGATION" /> + <element name="INFORMATION" /> + <element name="SOCIAL" /> + <element name="BACKGROUND_PROCESS" /> + <element name="TESTING" /> + <element name="SYSTEM" /> + </enum> + <!-- Common parameters end --> + + <!-- app_policies section start --> + + <typedef name="Strings" type="String" maxlength="255" array="true" + maxsize="255" /> + + <typedef name="AppHMITypes" type="AppHMIType" array="true" + maxsize="255" /> + + <struct name="ApplicationParams"> + <param name="groups" type="Strings" /> + <param name="nicknames" type="Strings" mandatory="false" /> + <param name="preconsented_groups" type="Strings" mandatory="false" /> + <param name="AppHMIType" type="AppHMITypes" mandatory="false" /> + <param name="priority" type="Priority" /> + <param name="default_hmi" type="HmiLevel" /> + <param name="keep_context" type="Boolean" /> + <param name="steal_focus" type="Boolean" /> + <param name="memory_kb" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/> + <param name="watchdog_timer_ms" type="Integer" minvalue="1" + maxvalue="65225" mandatory="false"/> + <param name="certificate" type="String" minlength="0" maxlength="255" + mandatory="false" /> + </struct> + + <typedef name="HmiLevels" type="HmiLevel" array="true" + maxsize="4" /> + <typedef name="Parameters" type="Parameter" array="true" + maxsize="24" /> + + <struct name="RpcParameters"> + <!-- maxsizes are equal to number of currently known elements of + given type --> + <param name="hmi_levels" type="HmiLevels" /> + <param name="parameters" type="Parameters" mandatory="false" /> + </struct> + + <!-- maxsizes are equal to number of currently known elements of given + type --> + <typedef name="Rpc" type="RpcParameters" map="true" maxsize="50" null_values_allowed="true" /> + + <struct name="Rpcs"> + <param name="user_consent_prompt" type="String" minlegth="1" + maxlength="255" mandatory="false"/> + <param name="rpcs" type="Rpc" null_values_allowed="true"/> + </struct> + <!-- app_policies section end --> + + <!-- module_config section start --> + <!-- minlenght="10" since minimum expected is "http://a.b" --> + <typedef name="URL" type="String" minlength="10" maxlength="255" + array="true" minsize="1" maxsize="255" /> + + <typedef name="URLList" type="URL" map="true" minsize="1" + maxsize="255" /> + + <!-- max number of services is limited to 255 according to protocol specification --> + <typedef name="ServiceEndpoints" type="URLList" map="true" + minsize="1" maxsize="255" /> + + <typedef name="NumberOfNotificationsPerMinute" type="Integer" + map="true" maxsize="6" minvalue="0" maxvalue="255" /> + + <typedef name="SecondsBetweenRetries" type="Integer" array="true" + maxsize="10" minvalue="1" maxvalue="1000" /> + + <struct name="ModuleConfig"> + <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" /> + <param name="preloaded_pt" type="Boolean" mandatory="false" /> + <param name="exchange_after_x_ignition_cycles" type="Integer" + maxvalue="255" /> + <param name="exchange_after_x_kilometers" type="Integer" + maxvalue="4294967296" /> + <param name="exchange_after_x_days" type="Integer" + maxvalue="255" /> + <param name="timeout_after_x_seconds" type="Integer" + maxvalue="65535" /> + <param name="seconds_between_retries" type="SecondsBetweenRetries" /> + <param name="endpoints" type="ServiceEndpoints" /> + <param name="notifications_per_minute_by_priority" type="NumberOfNotificationsPerMinute" /> + <param name="vehicle_make" type="String" maxlength="100" + mandatory="false" /> + <param name="vehicle_model" type="String" maxlength="100" + mandatory="false" /> + <param name="vehicle_year" type="String" minlength="4" maxlength="4" + mandatory="false" /> + </struct> + <!-- module_config section end --> + + <!-- consumer_friendly_messages section start --> + <struct name="MessageString"> + <param name="line1" type="String" maxlength="255" + mandatory="false" /> + <param name="line2" type="String" maxlength="255" + mandatory="false" /> + <param name="tts" type="String" maxlength="65535" mandatory="false" /> + <param name="label" type="String" maxlength="255" + mandatory="false" /> + <param name="textBody" type="String" maxlength="500" + mandatory="false" /> + </struct> + + <typedef name="Languages" map="true" type="MessageString" + maxsize="500" mandatory="false" /> + + <struct name="MessageLanguages"> + <param name="languages" type="Languages" /> + </struct> + + <typedef name="Messages" map="true" type="MessageLanguages" + maxsize="255" /> + + <struct name="ConsumerFriendlyMessages"> + <param name="version" type="String" maxlength="100" /> + <param name="messages" type="Messages" mandatory="false" /> + </struct> + <!-- consumer_friendly_messages section end --> + + <!-- module_meta section start --> + <struct name="ModuleMeta"> + <param name="ccpu_version" type="String" maxlength="250" mandatory="false"/> + <param name="language" type="String" maxlength="250" mandatory="false"/> + <param name="wers_country_code" type="String" maxlength="250" mandatory="false"/> + <param name="pt_exchanged_at_odometer_x" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/> + <param name="pt_exchanged_x_days_after_epoch" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/> + <param name="ignition_cycles_since_last_exchange" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/> + <param name="vin" type="String" maxlength="250" mandatory="false"/> + </struct> + <!-- module_meta section end --> + + <!-- usage_and_error_counts section start --> + <struct name="AppLevel"> + <param name="minutes_in_hmi_full" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="app_registration_language_gui" type="String" minlength="1" maxlength="10" /> + <param name="app_registration_language_vui" type="String" minlength="1" maxlength="10" /> + <param name="count_of_rfcom_limit_reached" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="minutes_in_hmi_limited" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="minutes_in_hmi_background" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="minutes_in_hmi_none" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_user_selections" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_rejections_sync_out_of_memory" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_rejections_nickname_mismatch" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_rejections_duplicate_name" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_rejected_rpc_calls" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_rpcs_sent_in_hmi_none" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_removals_for_bad_behavior" type="Integer" minvalue="0" maxvalue="65535" /> + <param name="count_of_run_attempts_while_revoked" type="Integer" minvalue="0" maxvalue="65535" /> + </struct> + + <typedef name="AppLevels" type="AppLevel" map="true" + maxsize="255" /> + + <struct name="UsageAndErrorCounts"> + <param name="count_of_iap_buffer_full" type="Integer" minvalue="0" maxvalue="65535" mandatory="false" /> + <param name="count_sync_out_of_memory" type="Integer" minvalue="0" maxvalue="65535" mandatory="false" /> + <param name="count_of_sync_reboots" type="Integer" minvalue="0" maxvalue="65535" mandatory="false" /> + <param name="app_level" type="AppLevels" mandatory="false" /> + </struct> + <!-- usage_and_error_counts section end --> + + <!-- device_data section start --> + <enum name="Input" scope="internal"> + <element name="GUI" /> + <element name="VUI" /> + </enum> + + <typedef name="ConsentGroups" scope="internal" type="Boolean" map="true" maxsize="255" mandatory="false"/> + + <struct name="ConsentRecords" scope="internal"> + <param name="consent_groups" type="ConsentGroups" mandatory="false"/> + <param name="input" type="Input" mandatory="false" /> + <param name="time_stamp" type="String" maxlength="255" mandatory="false" /> + </struct> + + <typedef name="UserConsentRecords" scope="internal" map="true" type="ConsentRecords" minsize="0" maxsize="1000"/> + + <struct name="DeviceParams" scope="internal"> + <param name="hardware" type="String" maxlength="255" mandatory="false"/> + <param name="firmware_rev" type="String" maxlength="255" nullable="true" mandatory="false"/> + <param name="os" type="String" maxlength="255" mandatory="false"/> + <param name="os_version" type="String" maxlength="255" mandatory="false"/> + <param name="carrier" type="String" maxlength="255" nullable="true" mandatory="false"/> + <param name="user_consent_records" type="UserConsentRecords" mandatory="false"/> + <param name="max_number_rfcom_ports" type="Integer" maxvalue="255" mandatory="false"/> + </struct> + <!-- device_data section end --> + + <!-- policy_table section start --> + <typedef name="ApplicationPolicies" map="true" type="ApplicationParams" + null_values_allowed="true" minsize="1" maxsize="1000" /> + + <typedef name="FunctionalGroupings" map="true" type="Rpcs" + minsize="1" maxsize="255" /> + + <typedef name="DeviceData" map="true" type="DeviceParams" + maxsize="255" /> + + <struct name="PolicyTable"> + <!-- maxsize for app_policies can be changed, if necessary --> + <param name="app_policies" type="ApplicationPolicies" /> + <param name="functional_groupings" type="FunctionalGroupings" /> + <param name="consumer_friendly_messages" type="ConsumerFriendlyMessages" /> + <param name="module_config" type="ModuleConfig" /> + <param name="module_meta" type="ModuleMeta" mandatory="false"/> + <param name="usage_and_error_counts" type="UsageAndErrorCounts" mandatory="false" /> + <param name="device_data" type="DeviceData" mandatory="false" /> + </struct> + <!-- policy_table section end --> + + <!-- Root element --> + <struct name="Table"> + <param name="policy_table" type="PolicyTable" /> + </struct> + +</interface> diff --git a/src/components/policy/src/policy/qdb_wrapper/CMakeLists.txt b/src/components/policy/src/policy/qdb_wrapper/CMakeLists.txt new file mode 100644 index 0000000000..8b06351e21 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (c) 2013, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +set(target dbms) + +include_directories(include) + +set(SOURCES + src/sql_database.cc + src/sql_query.cc + src/sql_error.cc +) + +add_library(${target} ${SOURCES}) +target_link_libraries(${target} qdb Utils) + +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/policy.ini DESTINATION ${CMAKE_BINARY_DIR}/src/appMain) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/qdbserver.sh DESTINATION ${CMAKE_BINARY_DIR}/src/appMain) +endif () + +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + install(FILES policy.ini DESTINATION bin) + install(FILES qdbserver.sh DESTINATION bin + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +endif ()
\ No newline at end of file diff --git a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_database.h b/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_database.h new file mode 100644 index 0000000000..f99dc5a146 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_database.h @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_DATABASE_H_ +#define SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_DATABASE_H_ + +#include <qdb/qdb.h> +#include <string> +#include "qdb_wrapper/sql_error.h" +#include "utils/lock.h" + +namespace policy { +namespace dbms { + +class SQLQuery; + +/** + * Represents a connection to a database. + */ +class SQLDatabase { + public: + explicit SQLDatabase(const std::string& db_name); + ~SQLDatabase(); + + /** + * Opens connection to the temporary in-memory database + * @return true if successfully + */ + bool Open(); + + /** + * Closes connection to the database + */ + void Close(); + + /** + * Begins a transaction on the database + * @return true if successfully + */ + bool BeginTransaction(); + + /** + * Commits a transaction to the database + * @return true if successfully + */ + bool CommitTransaction(); + + /** + * Rolls back a transaction on the database + * @return true if successfully + */ + bool RollbackTransaction(); + + /** + * Gets information about the last error that occurred on the database + * @return last error + */ + SQLError LastError() const; + + /** + * Call backup for opened DB + */ + bool Backup(); + protected: + /** + * Gets connection to the SQLite database + * @return pointer to connection + */ + qdb_hdl_t* conn() const; + + private: + /** + * The connection to the SQLite database + */ + qdb_hdl_t* conn_; + + /** + * Lock for guarding connection to database + */ + sync_primitives::Lock conn_lock_; + + /** + * The database name + */ + std::string db_name_; + + /** + * The last error that occurred on the database + */ + Error error_; + + /** + * Execs query for internal using in this class + * @param query sql query without return results + * @return true if query was executed successfully + */ + inline bool Exec(const std::string& query); + + friend class SQLQuery; +}; + +} // namespace dbms +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_DATABASE_H_ diff --git a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_error.h b/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_error.h new file mode 100644 index 0000000000..0f5bd36b4c --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_error.h @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_ERROR_H_ +#define SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_ERROR_H_ + +#include <string> + +namespace policy { +namespace dbms { + +typedef enum Error { + OK = 0, /* Successful result */ + ERROR /* Error */ +} Error; + +/** + * Provides SQL database error information + */ +class SQLError { + public: + SQLError(Error number, const std::string& text = ""); + + /** + * Gets number of error + * @return error number + */ + Error number() const; + + /** + * Gets text description of the error + * @return text + */ + std::string text() const; + + private: + /** + * Number of the error + */ + Error number_; + + /** + * Description of the error + */ + mutable std::string text_; +}; + +} // namespace dbms +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_ERROR_H_ diff --git a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_query.h b/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_query.h new file mode 100644 index 0000000000..1f81831c59 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_query.h @@ -0,0 +1,251 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_QUERY_H_ +#define SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_QUERY_H_ + +#include <stdint.h> +#include <qdb/qdb.h> +#include <string> +#include <vector> +#include <utility> +#include "qdb_wrapper/sql_error.h" +#include "utils/lock.h" + +namespace policy { +namespace dbms { + +class SQLDatabase; + +/** + * Provides a means of executing and manipulating SQL statements + */ +class SQLQuery { + public: + explicit SQLQuery(SQLDatabase* db); + ~SQLQuery(); + + /** + * Prepares the SQL query for executing + * @param query the utf-8 string of SQL query + * @return true if successfully + */ + bool Prepare(const std::string& query); + + /** + * Resets the binds of query for re-executing + * @return true if successfully + */ + bool Reset(); + + /** + * Deletes prepared SQL query + */ + void Finalize(); + + /** + * Executes SQL query without make binds + * @param query the utf-8 string of SQL query + * @return true if successfull + */ + bool Exec(const std::string& query); + + /** + * Executes prepared SQL query and positions the query on the first record + * @return true if successfull + */ + bool Exec(); + + /** + * Retrieves the next record in the result, if available, + * and positions the query on the retrieved record + * @return true if record was retrieved successfully, false if a error was + * or the result is empty or was retrieves last record + */ + bool Next(); + + /** + * Binds null in the prepared query + * @param pos position of param in the query + */ + void Bind(int pos); + + /** + * Binds int value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, int value); + + /** + * Binds int64_t value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, int64_t value); + + /** + * Binds double value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, double value); + + /** + * Binds bool value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, bool value); + + /** + * Binds string in the prepared query. + * @param pos position of param in the query + * @param value utf-8 string + */ + void Bind(int pos, const std::string& value); + + /** + * Gets value in the result record + * @param pos position of value + * @return boolean value + */ + bool GetBoolean(int pos) const; + + /** + * Gets value in the result record + * @param pos position of value + * @return integer value + */ + int GetInteger(int pos) const; + + /** + * Gets value in the result record + * @param pos position of value + * @return double value + */ + double GetDouble(int pos) const; + + /** + * Gets value in the result record + * @param pos position of value + * @return string value + */ + std::string GetString(int pos) const; + + /** + * Checks if value is null + * @param pos position of value + * @return true if value is null + */ + bool IsNull(int pos) const; + + /** + * Gets last id of insert row + * @return id of insert row + */ + int64_t LastInsertId() const; + + /** + * Gets string of the query + * @return string of the query + */ + const std::string& query() const; + + /** + * Gets information about the last error that occurred on the database + * @return last error + */ + SQLError LastError() const; + + private: + /** + * The instantiation of database + */ + SQLDatabase* db_; + + /** + * The string of query + */ + std::string query_; + + /** + * The id of SQL statement in QDB + */ + int statement_; + + /** + * Containers for keeping bind data + */ + std::vector<std::pair<int, int64_t> > int_binds_; + std::vector<std::pair<int, double> > double_binds_; + std::vector<std::pair<int, std::string> > string_binds_; + std::vector<int> null_binds_; + + /** + * The array for binging data to the prepare query + */ + qdb_binding_t* bindings_; + + /** + * Lock for guarding bindings + */ + sync_primitives::Lock bindings_lock_; + + /** + * The result of query + */ + qdb_result_t *result_; + + /** + * The current row in result for select + */ + int current_row_; + + /** + * The number of rows in a result + */ + int rows_; + + /** + * The last error that occurred with this query + */ + Error error_; + + uint8_t SetBinds(); + bool Result(); +}; + +} // namespace dbms +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_QUERY_H_ diff --git a/src/components/policy/src/policy/qdb_wrapper/policy.ini b/src/components/policy/src/policy/qdb_wrapper/policy.ini new file mode 100644 index 0000000000..e22a07e815 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/policy.ini @@ -0,0 +1,4 @@ +# This config file for QDB +# Format see in manual of QNX +[policy] +Filename=policy.sqlite
\ No newline at end of file diff --git a/src/components/policy/src/policy/qdb_wrapper/qdbserver.sh b/src/components/policy/src/policy/qdb_wrapper/qdbserver.sh new file mode 100755 index 0000000000..40ecbea518 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/qdbserver.sh @@ -0,0 +1,6 @@ +# This script star QDB server for SDL +# Need superuser to start qdb + +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/qnx650/target/qnx6/x86/usr/lib +export LD_LIBRARY_PATH +/usr/sbin/qdb -c policy.ini diff --git a/src/components/policy/src/policy/qdb_wrapper/src/sql_database.cc b/src/components/policy/src/policy/qdb_wrapper/src/sql_database.cc new file mode 100644 index 0000000000..cb22c9dbda --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/src/sql_database.cc @@ -0,0 +1,114 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <cstring> +#include "qdb_wrapper/sql_database.h" +#include "utils/logger.h" + +namespace policy { +namespace dbms { + +CREATE_LOGGERPTR_GLOBAL(logger_, "SQLDatabase") + +SQLDatabase::SQLDatabase(const std::string& db_name) + : conn_(NULL), + db_name_(db_name), + error_(Error::OK) { +} + +SQLDatabase::~SQLDatabase() { + Close(); +} + +bool SQLDatabase::Open() { + sync_primitives::AutoLock auto_lock(conn_lock_); + if (conn_) return true; + conn_ = qdb_connect(db_name_.c_str(), 0); + if (conn_ == NULL) { + error_ = Error::ERROR; + return false; + } + return true; +} + +void SQLDatabase::Close() { + sync_primitives::AutoLock auto_lock(conn_lock_); + if (conn_) { + if (qdb_disconnect(conn_) != -1) { + conn_ = NULL; + } else { + error_ = Error::ERROR; + } + } +} + +bool SQLDatabase::BeginTransaction() { + return Exec("BEGIN TRANSACTION"); +} + +bool SQLDatabase::CommitTransaction() { + return Exec("COMMIT TRANSACTION"); +} + +bool SQLDatabase::RollbackTransaction() { + return Exec("ROLLBACK TRANSACTION"); +} + +bool SQLDatabase::Exec(const std::string& query) { + sync_primitives::AutoLock auto_lock(conn_lock_); + if (qdb_statement(conn_, query.c_str()) == -1) { + error_ = Error::ERROR; + return false; + } + return true; +} + +SQLError SQLDatabase::LastError() const { + return SQLError(error_, qdb_geterrmsg(conn_)); +} + +qdb_hdl_t* SQLDatabase::conn() const { + return conn_; +} + +bool SQLDatabase::Backup() { + if (qdb_backup(conn_, QDB_ATTACH_DEFAULT) == -1) { + error_ = Error::ERROR; + LOG4CXX_ERROR(logger_, "Backup returned error: " << std::strerror(errno)); + return false; + } + LOG4CXX_INFO(logger_, "Backup was successful."); + return true; +} + +} // namespace dbms +} // namespace policy diff --git a/src/components/policy/src/policy/qdb_wrapper/src/sql_error.cc b/src/components/policy/src/policy/qdb_wrapper/src/sql_error.cc new file mode 100644 index 0000000000..7dc31c2c25 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/src/sql_error.cc @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "qdb_wrapper/sql_error.h" + +namespace policy { +namespace dbms { + +SQLError::SQLError(Error number, const std::string& text) + : number_(number), + text_(text) { +} + +Error SQLError::number() const { + return number_; +} + +std::string SQLError::text() const { + if (!text_.empty()) { + return text_; + } + switch (number_) { + case OK: + text_ = "Successful result"; + break; + case ERROR: + text_ = "Error"; + break; + default: + text_ = "Unknown error"; + } + return text_; +} + +} // namespace dbms +} // namespace policy + diff --git a/src/components/policy/src/policy/qdb_wrapper/src/sql_query.cc b/src/components/policy/src/policy/qdb_wrapper/src/sql_query.cc new file mode 100644 index 0000000000..355c25ca93 --- /dev/null +++ b/src/components/policy/src/policy/qdb_wrapper/src/sql_query.cc @@ -0,0 +1,278 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "qdb_wrapper/sql_query.h" +#include <string.h> +#include <cassert> +#include <algorithm> +#include "qdb_wrapper/sql_database.h" + +namespace policy { +namespace dbms { + +class SetBindInteger { + public: + explicit SetBindInteger(qdb_binding_t* array) + : array_(array) { + } + void operator()(const std::pair<int, int64_t>& x) { + // In QDB the number of position for binding starts since 1. + QDB_SETARRAYBIND_INT(array_, x.first + 1, x.second); + } + private: + qdb_binding_t* array_; +}; + +class SetBindReal { + public: + explicit SetBindReal(qdb_binding_t* array) + : array_(array) { + } + void operator()(const std::pair<int, double>& x) { + // In QDB the number of position for binding starts since 1. + QDB_SETARRAYBIND_REAL(array_, x.first + 1, x.second); + } + private: + qdb_binding_t* array_; +}; + +class SetBindText { + public: + explicit SetBindText(qdb_binding_t* array) + : array_(array) { + } + void operator()(const std::pair<int, std::string>& x) { + // In QDB the number of position for binding starts since 1. + QDB_SETARRAYBIND_TEXT(array_, x.first + 1, x.second.c_str()); + } + private: + qdb_binding_t* array_; +}; + +class SetBindNull { + public: + explicit SetBindNull(qdb_binding_t* array) + : array_(array) { + } + void operator()(int x) { + // In QDB the number of position for binding starts since 1. + QDB_SETARRAYBIND_NULL(array_, x + 1); + } + private: + qdb_binding_t* array_; +}; + +SQLQuery::SQLQuery(SQLDatabase* db) + : db_(db), + query_(""), + statement_(-1), + bindings_(NULL), + result_(NULL), + current_row_(0), + rows_(0), + error_(Error::OK) { +} + +SQLQuery::~SQLQuery() { + Finalize(); + db_->Close(); + delete db_; +} + +bool SQLQuery::Prepare(const std::string& query) { + query_ = query; + statement_ = qdb_stmt_init(db_->conn(), query.c_str(), query.length() + 1); + if (statement_ == -1) { + error_ = Error::ERROR; + return false; + } + return true; +} + +uint8_t SQLQuery::SetBinds() { + uint8_t binding_count = int_binds_.size() + double_binds_.size() + + string_binds_.size() + null_binds_.size(); + + bindings_ = new qdb_binding_t[binding_count]; + + std::for_each(int_binds_.begin(), int_binds_.end(), + SetBindInteger(bindings_)); + std::for_each(double_binds_.begin(), double_binds_.end(), + SetBindReal(bindings_)); + std::for_each(string_binds_.begin(), string_binds_.end(), + SetBindText(bindings_)); + std::for_each(null_binds_.begin(), null_binds_.end(), SetBindNull(bindings_)); + + return binding_count; +} + +bool SQLQuery::Result() { + result_ = qdb_getresult(db_->conn()); + if (!result_) { + error_ = Error::ERROR; + return false; + } + rows_ = qdb_rows(result_); + if (rows_ == -1) { + rows_ = 0; + error_ = Error::ERROR; + return false; + } + return true; +} + +bool SQLQuery::Exec() { + sync_primitives::AutoLock auto_lock(bindings_lock_); + if (result_) + return true; + + current_row_ = 0; + uint8_t binding_count = SetBinds(); + if (qdb_stmt_exec(db_->conn(), statement_, bindings_, binding_count) == -1) { + error_ = Error::ERROR; + return false; + } + return Result(); +} + +bool SQLQuery::Next() { + ++current_row_; + return Exec() && current_row_ < rows_; +} + +bool SQLQuery::Reset() { + sync_primitives::AutoLock auto_lock(bindings_lock_); + int_binds_.clear(); + double_binds_.clear(); + string_binds_.clear(); + null_binds_.clear(); + delete[] bindings_; + bindings_ = NULL; + rows_ = 0; + current_row_ = 0; + if (result_ && qdb_freeresult(result_) == -1) { + error_ = Error::ERROR; + return false; + } + result_ = NULL; + return true; +} + +void SQLQuery::Finalize() { + if (Reset() && qdb_stmt_free(db_->conn(), statement_) != -1) { + statement_ = 0; + } else { + error_ = Error::ERROR; + } +} + +bool SQLQuery::Exec(const std::string& query) { + query_ = query; + if (qdb_statement(db_->conn(), query.c_str()) == -1) { + error_ = Error::ERROR; + return false; + } + return true; +} + +void SQLQuery::Bind(int pos, int value) { + int_binds_.push_back(std::make_pair(pos, value)); +} + +void SQLQuery::Bind(int pos, int64_t value) { + int_binds_.push_back(std::make_pair(pos, value)); +} + +void SQLQuery::Bind(int pos, double value) { + double_binds_.push_back(std::make_pair(pos, value)); +} + +void SQLQuery::Bind(int pos, bool value) { + Bind(pos, static_cast<int>(value)); +} + +void SQLQuery::Bind(int pos, const std::string& value) { + string_binds_.push_back(std::make_pair(pos, value)); +} + +void SQLQuery::Bind(int pos) { + null_binds_.push_back(pos); +} + +bool SQLQuery::GetBoolean(int pos) const { + return static_cast<bool>(GetInteger(pos)); +} + +int SQLQuery::GetInteger(int pos) const { + void* ret = qdb_cell(result_, current_row_, pos); + if (rows_ !=0 && ret) { + return *static_cast<int*>(ret); + } + return 0; +} + +double SQLQuery::GetDouble(int pos) const { + void* ret = qdb_cell(result_, current_row_, pos); + if (rows_ !=0 && ret) { + return *static_cast<double*>(ret); + } + return 0; +} + +std::string SQLQuery::GetString(int pos) const { + void* ret = qdb_cell(result_, current_row_, pos); + if (rows_ != 0 && ret) { + return static_cast<const char*>(ret); + } + return ""; +} + +bool SQLQuery::IsNull(int pos) const { + return rows_ == 0 || qdb_cell_type(result_, current_row_, pos) == QDB_NULL; +} + +const std::string& SQLQuery::query() const { + // TODO(KKolodiy): may return string query with value of arguments + return query_; +} + +SQLError SQLQuery::LastError() const { + return SQLError(error_, qdb_geterrmsg(db_->conn())); +} + +int64_t SQLQuery::LastInsertId() const { + return qdb_last_insert_rowid(db_->conn(), result_); +} + +} // namespace dbms +} // namespace policy + diff --git a/src/components/policy/src/policy/specification.txt b/src/components/policy/src/policy/specification.txt new file mode 100644 index 0000000000..b00a2932e0 --- /dev/null +++ b/src/components/policy/src/policy/specification.txt @@ -0,0 +1 @@ +https://adc.luxoft.com/confluence/display/APPLINK/Policy+Manager+Specification diff --git a/src/components/policy/src/policy/sqlite_wrapper/CMakeLists.txt b/src/components/policy/src/policy/sqlite_wrapper/CMakeLists.txt new file mode 100644 index 0000000000..9007f84745 --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/CMakeLists.txt @@ -0,0 +1,44 @@ +# Copyright (c) 2013, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +set(target dbms) + +find_package(Sqlite3 REQUIRED) + +include_directories(include) + +set(SOURCES + src/sql_database.cc + src/sql_query.cc + src/sql_error.cc +) + +add_library(${target} ${SOURCES}) +target_link_libraries(${target} Utils) diff --git a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_database.h b/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_database.h new file mode 100644 index 0000000000..b7608e41f0 --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_database.h @@ -0,0 +1,154 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_DATABASE_H_ +#define SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_DATABASE_H_ + +#include <string> +#include "sqlite_wrapper/sql_error.h" +#include "utils/lock.h" + +struct sqlite3; + +namespace policy { +namespace dbms { + +class SQLQuery; + +/** + * Represents a connection to a database. + */ +class SQLDatabase { + public: + SQLDatabase(); + explicit SQLDatabase(const std::string& filename); + ~SQLDatabase(); + + /** + * Opens connection to the temporary in-memory database + * @return true if successfully + */ + bool Open(); + + /** + * Closes connection to the database + */ + void Close(); + + /** + * Begins a transaction on the database + * @return true if successfully + */ + bool BeginTransaction(); + + /** + * Commits a transaction to the database + * @return true if successfully + */ + bool CommitTransaction(); + + /** + * Rolls back a transaction on the database + * @return true if successfully + */ + bool RollbackTransaction(); + + /** + * Gets information about the last error that occurred on the database + * @return last error + */ + SQLError LastError() const; + + /** + * Sets path to database + * If the database is already opened then need reopen it + */ + void set_path(const std::string& path); + + /** + * Call backup for opened DB + */ + bool Backup(); + + protected: + /** + * Gets connection to the SQLite database + * @return pointer to connection + */ + sqlite3* conn() const; + + private: + /** + * The connection to the SQLite database + */ + sqlite3* conn_; + + /** + * Lock for guarding connection to database + */ + sync_primitives::Lock conn_lock_; + + /** + * The filename of database + */ + std::string databasename_; + + /** + * The last error that occurred on the database + */ + int error_; + + /** + * The temporary in-memory database + * @see SQLite manual + */ + static const std::string kInMemory; + + /** + * The extension of filename of database + */ + static const std::string kExtension; + + /** + * Execs query for internal using in this class + * @param query sql query without return results + * @return true if query was executed successfully + */ + inline bool Exec(const std::string& query); + + friend class SQLQuery; +}; + +} // namespace dbms +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_DATABASE_H_ diff --git a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_error.h b/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_error.h new file mode 100644 index 0000000000..3b5fff3c11 --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_error.h @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_ERROR_H_ +#define SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_ERROR_H_ + +#include <string> + +namespace policy { +namespace dbms { + +typedef enum Error { + OK = 0, /* Successful result */ + ERROR, /* SQL error or missing database */ + INTERNAL, /* Internal logic error in SQLite */ + PERM, /* Access permission denied */ + ABORT, /* Callback routine requested an abort */ + BUSY, /* The database file is locked */ + LOCKED, /* A table in the database is locked */ + NOMEM, /* A malloc() failed */ + READONLY, /* Attempt to write a readonly database */ + INTERRUPT, /* Operation terminated by sqlite3_interrupt()*/ + IOERR, /* Some kind of disk I/O error occurred */ + CORRUPT, /* The database disk image is malformed */ + NOTFOUND, /* Unknown opcode in sqlite3_file_control() */ + FULL, /* Insertion failed because database is full */ + CANTOPEN, /* Unable to open the database file */ + PROTOCOL, /* Database lock protocol error */ + EMPTY, /* Database is empty */ + SCHEMA, /* The database schema changed */ + TOOBIG, /* String or BLOB exceeds size limit */ + CONSTRAINT, /* Abort due to constraint violation */ + MISMATCH, /* Data type mismatch */ + MISUSE, /* Library used incorrectly */ + NOLFS, /* Uses OS features not supported on host */ + AUTH, /* Authorization denied */ + FORMAT, /* Auxiliary database format error */ + RANGE, /* 2nd parameter to sqlite3_bind out of range */ + NOTADB, /* File opened that is not a database file */ + NOTICE, /* Notifications from sqlite3_log() */ + WARNING, /* Warnings from sqlite3_log() */ + ROW = 100, /* sqlite3_step() has another row ready */ + DONE = 101 /* sqlite3_step() has finished executing */ +} Error; + +/** + * Provides SQL database error information + */ +class SQLError { + public: + SQLError(Error number, const std::string& text = ""); + + /** + * Gets number of error + * @return error number + */ + Error number() const; + + /** + * Gets text description of the error + * @return text + */ + std::string text() const; + + private: + /** + * Number of the error + */ + Error number_; + + /** + * Description of the error + */ + mutable std::string text_; +}; + +} // namespace dbms +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_ERROR_H_ diff --git a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_query.h b/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_query.h new file mode 100644 index 0000000000..939cd1341a --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_query.h @@ -0,0 +1,219 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_QUERY_H_ +#define SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_QUERY_H_ + +#include <stdint.h> +#include <string> +#include "sqlite_wrapper/sql_error.h" +#include "utils/lock.h" + +struct sqlite3_stmt; + +namespace policy { +namespace dbms { + +class SQLDatabase; + +/** + * Provides a means of executing and manipulating SQL statements + */ +class SQLQuery { + public: + explicit SQLQuery(SQLDatabase* db); + ~SQLQuery(); + + /** + * Prepares the SQL query for executing + * @param query the utf-8 string of SQL query + * @return true if successfully + */ + bool Prepare(const std::string& query); + + /** + * Resets the binds of query for re-executing + * @return true if successfully + */ + bool Reset(); + + /** + * Deletes prepared SQL query + */ + void Finalize(); + + /** + * Executes SQL query without make binds + * @param query the utf-8 string of SQL query + * @return true if successfull + */ + bool Exec(const std::string& query); + + /** + * Executes prepared SQL query and positions the query on the first record + * @return true if successfull + */ + bool Exec(); + + /** + * Retrieves the next record in the result, if available, + * and positions the query on the retrieved record + * @return true if record was retrieved successfully, false if a error was + * or the result is empty or was retrieves last record + */ + bool Next(); + + /** + * Binds null in the prepared query + * @param pos position of param in the query + */ + void Bind(int pos); + + /** + * Binds int value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, int value); + + /** + * Binds int64_t value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, int64_t value); + + /** + * Binds double value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, double value); + + /** + * Binds bool value in the prepared query. + * @param pos position of param in the query + * @param value value of param + */ + void Bind(int pos, bool value); + + /** + * Binds string in the prepared query. + * @param pos position of param in the query + * @param value utf-8 string + */ + void Bind(int pos, const std::string& value); + + /** + * Gets value in the result record + * @param pos position of value + * @return boolean value + */ + bool GetBoolean(int pos) const; + + /** + * Gets value in the result record + * @param pos position of value + * @return integer value + */ + int GetInteger(int pos) const; + + /** + * Gets value in the result record + * @param pos position of value + * @return double value + */ + double GetDouble(int pos) const; + + /** + * Gets value in the result record + * @param pos position of value + * @return string value + */ + std::string GetString(int pos) const; + + /** + * Checks if value is null + * @param pos position of value + * @return true if value is null + */ + bool IsNull(int pos) const; + + /** + * Gets last id of insert row + * @return id of insert row + */ + int64_t LastInsertId() const; + + /** + * Gets string of the query + * @return string of the query + */ + const std::string& query() const; + + /** + * Gets information about the last error that occurred on the database + * @return last error + */ + SQLError LastError() const; + + private: + /** + * The instantiation of database + */ + SQLDatabase& db_; + + /** + * The string of query + */ + std::string query_; + + /** + * The SQL statement in SQLite + */ + sqlite3_stmt* statement_; + + /** + * Lock for guarding statement + */ + sync_primitives::Lock statement_lock_; + + /** + * The last error that occurred with this query + */ + int error_; +}; + +} // namespace dbms +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_QUERY_H_ diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc b/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc new file mode 100644 index 0000000000..423d266b47 --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sqlite_wrapper/sql_database.h" +#include <sqlite3.h> + +namespace policy { +namespace dbms { + +const std::string SQLDatabase::kInMemory = ":memory:"; +const std::string SQLDatabase::kExtension = ".sqlite"; + +SQLDatabase::SQLDatabase() + : conn_(NULL), + databasename_(kInMemory), + error_(SQLITE_OK) {} + +SQLDatabase::SQLDatabase(const std::string& db_name) + : conn_(NULL), + databasename_(db_name + kExtension), + error_(SQLITE_OK) {} + +SQLDatabase::~SQLDatabase() { + Close(); +} + +bool SQLDatabase::Open() { + sync_primitives::AutoLock auto_lock(conn_lock_); + if (conn_) return true; + error_ = sqlite3_open(databasename_.c_str(), &conn_); + return error_ == SQLITE_OK; +} + +void SQLDatabase::Close() { + sync_primitives::AutoLock auto_lock(conn_lock_); + error_ = sqlite3_close(conn_); + if (error_ == SQLITE_OK) { + conn_ = NULL; + } +} + +bool SQLDatabase::BeginTransaction() { + return Exec("BEGIN TRANSACTION"); +} + +bool SQLDatabase::CommitTransaction() { + return Exec("COMMIT TRANSACTION"); +} + +bool SQLDatabase::RollbackTransaction() { + return Exec("ROLLBACK TRANSACTION"); +} + +bool SQLDatabase::Exec(const std::string& query) { + sync_primitives::AutoLock auto_lock(conn_lock_); + error_ = sqlite3_exec(conn_, query.c_str(), NULL, NULL, NULL); + return error_ == SQLITE_OK; +} + +SQLError SQLDatabase::LastError() const { + return SQLError(Error(error_)); +} + +sqlite3* SQLDatabase::conn() const { + return conn_; +} + +void SQLDatabase::set_path(const std::string& path) { + databasename_ = path + databasename_; +} + +bool SQLDatabase::Backup() { + return true; +} +} // namespace dbms +} // namespace policy diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_error.cc b/src/components/policy/src/policy/sqlite_wrapper/src/sql_error.cc new file mode 100644 index 0000000000..0f87ef2cc6 --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/src/sql_error.cc @@ -0,0 +1,153 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sqlite_wrapper/sql_error.h" + +namespace policy { +namespace dbms { + +SQLError::SQLError(Error number, const std::string& text) + : number_(number), + text_(text) { +} + +Error SQLError::number() const { + return number_; +} + +std::string SQLError::text() const { + if (!text_.empty()) { + return text_; + } + switch (number_) { + case OK: + text_ = "Successful result"; + break; + case ERROR: + text_ = "SQL error or missing database"; + break; + case INTERNAL: + text_ = "Internal logic error in SQLite"; + break; + case PERM: + text_ = "Access permission denied"; + break; + case ABORT: + text_ = "Callback routine requested an abort"; + break; + case BUSY: + text_ = "The database file is locked"; + break; + case LOCKED: + text_ = "A table in the database is locked"; + break; + case NOMEM: + text_ = "A malloc() failed"; + break; + case READONLY: + text_ = "Attempt to write a readonly database"; + break; + case INTERRUPT: + text_ = "Operation terminated by sqlite3_interrupt()"; + break; + case IOERR: + text_ = "Some kind of disk I/O error occurred"; + break; + case CORRUPT: + text_ = "The database disk image is malformed"; + break; + case NOTFOUND: + text_ = "Unknown opcode in sqlite3_file_control()"; + break; + case FULL: + text_ = "Insertion failed because database is full"; + break; + case CANTOPEN: + text_ = "Unable to open the database file"; + break; + case PROTOCOL: + text_ = "Database lock protocol error"; + break; + case EMPTY: + text_ = "Database is empty"; + break; + case SCHEMA: + text_ = "The database schema changed"; + break; + case TOOBIG: + text_ = "String or BLOB exceeds size limit"; + break; + case CONSTRAINT: + text_ = "Abort due to constraint violation"; + break; + case MISMATCH: + text_ = "Data type mismatch"; + break; + case MISUSE: + text_ = "Library used incorrectly"; + break; + case NOLFS: + text_ = "Uses OS features not supported on host"; + break; + case AUTH: + text_ = "Authorization denied"; + break; + case FORMAT: + text_ = "Auxiliary database format error"; + break; + case RANGE: + text_ = "2nd parameter to sqlite3_bind out of range"; + break; + case NOTADB: + text_ = "File opened that is not a database file"; + break; + case NOTICE: + text_ = "Notifications from sqlite3_log()"; + break; + case WARNING: + text_ = "Warnings from sqlite3_log()"; + break; + case ROW: + text_ = "sqlite3_step() has another row ready"; + break; + case DONE: + text_ = "sqlite3_step() has finished executing"; + break; + default: + text_ = "Unknown error"; + } + return text_; +} + +} // namespace dbms +} // namespace policy + diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_query.cc b/src/components/policy/src/policy/sqlite_wrapper/src/sql_query.cc new file mode 100644 index 0000000000..c8afdfcdb3 --- /dev/null +++ b/src/components/policy/src/policy/sqlite_wrapper/src/sql_query.cc @@ -0,0 +1,157 @@ +/** + * Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sqlite_wrapper/sql_query.h" +#include <sqlite3.h> +#include <cassert> +#include "sqlite_wrapper/sql_database.h" + +namespace policy { +namespace dbms { + +SQLQuery::SQLQuery(SQLDatabase* db) + : db_(*db), + query_(""), + statement_(NULL), + error_(SQLITE_OK) { +} + +SQLQuery::~SQLQuery() { + Finalize(); +} + +bool SQLQuery::Prepare(const std::string& query) { + Finalize(); + sync_primitives::AutoLock auto_lock(statement_lock_); + if (statement_) return false; + error_ = sqlite3_prepare(db_.conn(), query.c_str(), query.length(), + &statement_, NULL); + query_ = query; + return error_ == SQLITE_OK; +} + +bool SQLQuery::Exec() { + error_ = sqlite3_step(statement_); + return error_ == SQLITE_ROW || error_ == SQLITE_DONE; +} + +bool SQLQuery::Next() { + error_ = sqlite3_step(statement_); + return error_ == SQLITE_ROW; +} + +bool SQLQuery::Reset() { + error_ = sqlite3_reset(statement_); + return error_ == SQLITE_OK; +} + +void SQLQuery::Finalize() { + sync_primitives::AutoLock auto_lock(statement_lock_); + error_ = sqlite3_finalize(statement_); + if (error_ == SQLITE_OK) { + statement_ = NULL; + } +} + +bool SQLQuery::Exec(const std::string& query) { + query_ = query; + error_ = sqlite3_exec(db_.conn(), query.c_str(), NULL, NULL, NULL); + return error_ == SQLITE_OK; +} + +void SQLQuery::Bind(int pos, int value) { + // In SQLite the number of position for binding starts since 1. + error_ = sqlite3_bind_int(statement_, pos + 1, value); +} + +void SQLQuery::Bind(int pos, int64_t value) { + // In SQLite the number of position for binding starts since 1. + error_ = sqlite3_bind_int64(statement_, pos + 1, value); +} + +void SQLQuery::Bind(int pos, double value) { + // In SQLite the number of position for binding starts since 1. + error_ = sqlite3_bind_double(statement_, pos + 1, value); +} + +void SQLQuery::Bind(int pos, bool value) { + Bind(pos, static_cast<int>(value)); +} + +void SQLQuery::Bind(int pos, const std::string& value) { + // In SQLite the number of position for binding starts since 1. + error_ = sqlite3_bind_text(statement_, pos + 1, value.c_str(), value.length(), + SQLITE_TRANSIENT); +} + +bool SQLQuery::GetBoolean(int pos) const { + return static_cast<bool>(GetInteger(pos)); +} + +int SQLQuery::GetInteger(int pos) const { + return sqlite3_column_int(statement_, pos); +} + +double SQLQuery::GetDouble(int pos) const { + return sqlite3_column_double(statement_, pos); +} + +std::string SQLQuery::GetString(int pos) const { + const unsigned char* str = sqlite3_column_text(statement_, pos); + return str ? reinterpret_cast<const char*>(str) : ""; +} + +const std::string& SQLQuery::query() const { + // TODO(KKolodiy): may return string query with value of arguments + return query_; +} + +bool SQLQuery::IsNull(int pos) const { + return sqlite3_column_type(statement_, pos) == SQLITE_NULL; +} + +void SQLQuery::Bind(int pos) { + // In SQLite the number of position for binding starts since 1. + error_ = sqlite3_bind_null(statement_, pos + 1); +} + +SQLError SQLQuery::LastError() const { + return SQLError(Error(error_)); +} + +int64_t SQLQuery::LastInsertId() const { + return sqlite3_last_insert_rowid(db_.conn()); +} + +} // namespace dbms +} // namespace policy + diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc new file mode 100644 index 0000000000..62e96ae0ec --- /dev/null +++ b/src/components/policy/src/policy/src/cache_manager.cc @@ -0,0 +1,927 @@ +/* +* Copyright (c) 2014, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "policy/cache_manager.h" + +#include <algorithm> +#include <functional> +#include <ctime> +#include <cmath> + +#include "utils/file_system.h" +#include "json/reader.h" +#include "json/features.h" +#include "utils/logger.h" + +// EXTENDED_POLICY +# include "policy/sql_pt_representation.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { + +CREATE_LOGGERPTR_GLOBAL(logger_, "CacheManager") + +#define CACHE_MANAGER_CHECK(return_value) {\ + if (!pt_) {\ + LOG4CXX_WARN(logger_, "The cache manager is not initialized");\ + return return_value;\ + }\ +} + +#define CACHE_MANAGER_CHECK_VOID() {\ + if (!pt_) {\ + LOG4CXX_WARN(logger_, "The cache manager is not initialized");\ + return;\ + }\ +} + + +CacheManager::CacheManager() + : CacheManagerInterface(), + backup_( +// EXTENDED_POLICY + new SQLPTRepresentation() + ), + update_required(false) { + +} + +bool CacheManager::CanAppKeepContext(const std::string &app_id) { + CACHE_MANAGER_CHECK(false); + bool result = true; + return result; +} + +uint16_t CacheManager::HeartBeatTimeout(const std::string &app_id) const { + CACHE_MANAGER_CHECK(0); + uint16_t result = 0; + if (AppExists(app_id)) { + if (pt_->policy_table.app_policies[app_id].heart_beat_timeout_ms + .is_initialized()) { + result = *(pt_->policy_table.app_policies[app_id].heart_beat_timeout_ms); + } + } + return result; +} + +bool CacheManager::CanAppStealFocus(const std::string &app_id) { + CACHE_MANAGER_CHECK(false); + bool result = true; + return result; +} + +bool CacheManager::GetDefaultHMI(const std::string &app_id, + std::string& default_hmi) { + CACHE_MANAGER_CHECK(false); + bool result = true; + + return result; +} + +bool CacheManager::ResetUserConsent() { + CACHE_MANAGER_CHECK(false); + return true; +} + + +bool CacheManager::GetUserPermissionsForDevice(const std::string &device_id, + StringArray& consented_groups, + StringArray& disallowed_groups) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +void CacheManager::GetAllAppGroups(const std::string& app_id, + FunctionalGroupIDs& all_group_ids) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK_VOID(); + policy_table::ApplicationPolicies::const_iterator app_params_iter = + pt_->policy_table.app_policies.find(app_id); + + if (pt_->policy_table.app_policies.end() != app_params_iter) { + policy_table::Strings::const_iterator iter = + (*app_params_iter).second.groups.begin(); + policy_table::Strings::const_iterator iter_end = + (*app_params_iter).second.groups.end(); + + for (; iter != iter_end; ++iter) { + const uint32_t group_id = + static_cast<uint32_t> ((GenerateHash(*iter))); + all_group_ids.push_back(group_id); + } + } + LOG4CXX_TRACE_EXIT(logger_); +} + +void CacheManager::GetPreConsentedGroups(const std::string &app_id, + FunctionalGroupIDs& preconsented_groups) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK_VOID(); + LOG4CXX_TRACE_EXIT(logger_); +} + +void CacheManager::GetConsentedGroups(const std::string &device_id, + const std::string &app_id, + FunctionalGroupIDs& allowed_groups, + FunctionalGroupIDs& disallowed_groups) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK_VOID(); + LOG4CXX_TRACE_EXIT(logger_); +} + +void CacheManager::GetUnconsentedGroups(const std::string& device_id, + const std::string& policy_app_id, + FunctionalGroupIDs& unconsented_groups) { + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK_VOID(); + LOG4CXX_TRACE_EXIT(logger_); +} + +void CacheManager::RemoveAppConsentForGroup(const std::string& app_id, + const std::string& group_name) { + CACHE_MANAGER_CHECK_VOID(); +} + +bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + pt_->policy_table.functional_groupings = + update_pt.policy_table.functional_groupings; + + policy_table::ApplicationPolicies::const_iterator iter = + update_pt.policy_table.app_policies.begin(); + policy_table::ApplicationPolicies::const_iterator iter_end = + update_pt.policy_table.app_policies.end(); + + for (;iter != iter_end; ++iter) { + pt_->policy_table.app_policies[iter->first] = iter->second; + } + + pt_->policy_table.module_config = update_pt.policy_table.module_config; + + if (update_pt.policy_table.consumer_friendly_messages.is_initialized()) { + pt_->policy_table.consumer_friendly_messages = + update_pt.policy_table.consumer_friendly_messages; + } + + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +void CacheManager::Backup() { + CACHE_MANAGER_CHECK_VOID(); + sync_primitives::AutoLock auto_lock(cache_lock_); + if (backup_.valid()) { + if (pt_.valid()) { + backup_->Save(*pt_); + backup_->SaveUpdateRequired(update_required); + + + policy_table::ApplicationPolicies::const_iterator app_policy_iter = + pt_->policy_table.app_policies.begin(); + policy_table::ApplicationPolicies::const_iterator app_policy_iter_end = + pt_->policy_table.app_policies.end(); + + for (; app_policy_iter != app_policy_iter_end; ++app_policy_iter) { + + const std::string app_id = (*app_policy_iter).first; + backup_->SaveApplicationCustomData(app_id, + IsApplicationRevoked(app_id), + IsDefaultPolicy(app_id), + is_predata_[app_id]); + } + + // In case of extended policy the meta info should be backuped as well. + } + } +} + +std::string CacheManager::currentDateTime() { + time_t now = time(0); + struct tm tstruct; + char buf[80]; + tstruct = *localtime(&now); + strftime(buf, sizeof(buf), "%Y-%m-%d.%X", &tstruct); + return buf; +} + +bool CacheManager::GetPermissionsForApp(const std::string &device_id, + const std::string &app_id, + FunctionalIdType& group_types) { + + LOG4CXX_TRACE_ENTER(logger_); + GetAllAppGroups(app_id, group_types[kTypeGeneral]); + GetAllAppGroups(kDefaultId, group_types[kTypeDefault]); + GetAllAppGroups(kPreDataConsentId, group_types[kTypePreDataConsented]); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::GetDeviceGroupsFromPolicies( + policy_table::Strings& groups, + policy_table::Strings& preconsented_groups) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::SetDeviceData(const std::string &device_id, + const std::string &hardware, + const std::string &firmware, + const std::string &os, + const std::string &os_version, + const std::string &carrier, + const uint32_t number_of_ports, + const std::string &connection_type) { + + sync_primitives::AutoLock auto_lock(cache_lock_); + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::SetUserPermissionsForDevice( + const std::string &device_id, + const StringArray &consented_groups, + const StringArray &disallowed_groups) { + sync_primitives::AutoLock auto_lock(cache_lock_); + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::ReactOnUserDevConsentForApp(const std::string &app_id, + bool is_device_allowed) { + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + bool result = true; + LOG4CXX_TRACE_EXIT(logger_); + return result; +} + +void CacheManager::GetGroupNameByHashID(const int32_t group_id, + std::string& group_name) { + + CACHE_MANAGER_CHECK_VOID(); + policy_table::FunctionalGroupings::const_iterator fg_iter = + pt_->policy_table.functional_groupings.begin(); + policy_table::FunctionalGroupings::const_iterator fg_iter_end = + pt_->policy_table.functional_groupings.end(); + + for (; fg_iter != fg_iter_end; ++fg_iter) { + const int32_t id = GenerateHash((*fg_iter).first); + if (group_id == id) { + group_name = (*fg_iter).first; + } + } +} + +bool CacheManager::SetUserPermissionsForApp( + const PermissionConsent &permissions) { + sync_primitives::AutoLock auto_lock(cache_lock_); + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::UpdateRequired() const { + return update_required; +} + +void CacheManager::SaveUpdateRequired(bool status) { + + update_required = status; +} + +bool CacheManager::IsApplicationRevoked(const std::string& app_id) { + CACHE_MANAGER_CHECK(false); + bool is_revoked = false; + if (pt_->policy_table.app_policies.end() != + pt_->policy_table.app_policies.find(app_id)) { + is_revoked = pt_->policy_table.app_policies[app_id].is_null(); + } + + return is_revoked; +} + +void CacheManager::CheckPermissions(const PTString &app_id, + const PTString &hmi_level, + const PTString &rpc, + CheckPermissionResult &result) { + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK_VOID(); + + if (pt_->policy_table.app_policies.end() == + pt_->policy_table.app_policies.find(app_id)) { + LOG4CXX_ERROR(logger_, "Application id " << app_id + << " was not found in policy DB."); + return; + } + + policy_table::Strings::const_iterator app_groups_iter = + pt_->policy_table.app_policies[app_id].groups.begin(); + + policy_table::Strings::const_iterator app_groups_iter_end = + pt_->policy_table.app_policies[app_id].groups.end(); + + policy_table::FunctionalGroupings::const_iterator concrete_group; + + for (; app_groups_iter != app_groups_iter_end; ++app_groups_iter) { + concrete_group = pt_->policy_table.functional_groupings.find(*app_groups_iter); + if (pt_->policy_table.functional_groupings.end() != concrete_group) { + const policy_table::Rpcs& rpcs = concrete_group->second; + + policy_table::Rpc::const_iterator rpc_iter = rpcs.rpcs.find(rpc); + if (rpcs.rpcs.end() != rpc_iter) { + policy_table::RpcParameters rpc_param = rpc_iter->second; + + policy_table::HmiLevel hmi_level_e; + policy_table::EnumFromJsonString(hmi_level, &hmi_level_e); + + policy_table::HmiLevels::const_iterator hmi_iter = + std::find(rpc_param.hmi_levels.begin(), rpc_param.hmi_levels.end(), + hmi_level_e); + + if (rpc_param.hmi_levels.end() != hmi_iter) { + result.hmi_level_permitted = PermitResult::kRpcAllowed; + + policy_table::Parameters::const_iterator params_iter = + rpc_param.parameters->begin(); + policy_table::Parameters::const_iterator params_iter_end = + rpc_param.parameters->end(); + + for (;params_iter != params_iter_end; ++params_iter) { + result.list_of_allowed_params.push_back( + policy_table::EnumToJsonString(*params_iter)); + } + } + } + } + } + LOG4CXX_TRACE_EXIT(logger_); +} + +bool CacheManager::IsPTPreloaded() { + CACHE_MANAGER_CHECK(false); + return *pt_->policy_table.module_config.preloaded_pt; +} + +int CacheManager::IgnitionCyclesBeforeExchange() { + CACHE_MANAGER_CHECK(0); + const uint8_t limit = std::max( + static_cast<int>( + pt_->policy_table.module_config.exchange_after_x_ignition_cycles), 0); + + uint8_t current = 0; + + + return std::max(limit - current, 0); +} + +int CacheManager::KilometersBeforeExchange(int current) { + CACHE_MANAGER_CHECK(0); + const uint8_t limit = std::max( + static_cast<int>( + pt_->policy_table.module_config.exchange_after_x_kilometers), 0); + uint8_t last = 0; + + + const uint8_t actual = std::max((current - last), 0); + return std::max(limit - actual, 0); +} + +bool CacheManager::SetCountersPassedForSuccessfulUpdate(int kilometers, + int days_after_epoch) { + CACHE_MANAGER_CHECK(false); + return true; +} + +int CacheManager::DaysBeforeExchange(int current) { + CACHE_MANAGER_CHECK(0); + const uint8_t limit = std::max( + static_cast<int>( + pt_->policy_table.module_config.exchange_after_x_days), 0); + uint8_t last = 0; + + + const uint8_t actaul = std::max((current - last), 0); + return std::max(limit - actaul, 0); +} + +void CacheManager::IncrementIgnitionCycles() { + CACHE_MANAGER_CHECK_VOID(); +} + +void CacheManager::ResetIgnitionCycles() { + CACHE_MANAGER_CHECK_VOID(); +} + +int CacheManager::TimeoutResponse() { + CACHE_MANAGER_CHECK(0); + return pt_->policy_table.module_config.timeout_after_x_seconds; +} + +bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) { + CACHE_MANAGER_CHECK(false); + rpc::policy_table_interface_base::SecondsBetweenRetries::iterator iter = + pt_->policy_table.module_config.seconds_between_retries.begin(); + rpc::policy_table_interface_base::SecondsBetweenRetries::iterator iter_end = + pt_->policy_table.module_config.seconds_between_retries.end(); + + const std::size_t size = + pt_->policy_table.module_config.seconds_between_retries.size(); + seconds.reserve(size); + for (;iter != iter_end; ++iter) { + seconds.push_back(*iter); + } + return true; +} + +VehicleData CacheManager::GetVehicleData() { + // TODO(AGaliuzov): maybe should be removed. + return VehicleData(); +} + +std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg( + const std::vector<std::string> &msg_codes, const std::string &language) { + + LOG4CXX_TRACE_ENTER(logger_); + std::vector<UserFriendlyMessage> result; + CACHE_MANAGER_CHECK(result); + + const std::string fallback_language = "en-us"; + std::vector<std::string>::const_iterator it = msg_codes.begin(); + std::vector<std::string>::const_iterator it_end = msg_codes.end(); + for (; it != it_end; ++it) { + + UserFriendlyMessage msg; + msg.message_code = *it; + result.push_back(msg); + } + LOG4CXX_TRACE_EXIT(logger_); + return result; +} + +EndpointUrls CacheManager::GetUpdateUrls(int service_type) { + LOG4CXX_TRACE_ENTER(logger_); + + EndpointUrls result; + CACHE_MANAGER_CHECK(result); + char buff[32]; + sprintf(buff, "%x", service_type); + + std::string serv_type(buff); + // TODO: remove this workaround + if (service_type <= 0x9) { + serv_type.insert(0,"0x0", 3); + } else { + serv_type.insert(0,"0x", 2); + } + + policy_table::ServiceEndpoints::const_iterator iter = + pt_->policy_table.module_config.endpoints.find(serv_type); + + if (pt_->policy_table.module_config.endpoints.end() != iter) { + policy_table::URLList::const_iterator url_list_iter = (*iter).second.begin(); + policy_table::URLList::const_iterator url_list_iter_end = (*iter).second.end(); + for (; url_list_iter != url_list_iter_end; ++url_list_iter) { + EndpointData data; + data.app_id = (*url_list_iter).first; + std::copy((*url_list_iter).second.begin(), (*url_list_iter).second.end(), + std::back_inserter(data.url)); + + result.push_back(data); + } + } + LOG4CXX_TRACE_EXIT(logger_); + return result; +} + +int CacheManager::GetNotificationsNumber(const std::string &priority) { + CACHE_MANAGER_CHECK(0); + typedef rpc::policy_table_interface_base::NumberOfNotificationsPerMinute NNPM; + + const NNPM& nnpm = + pt_->policy_table.module_config.notifications_per_minute_by_priority; + + NNPM::const_iterator priority_iter = nnpm.find(priority); + + const int result = (nnpm.end() != priority_iter ? (*priority_iter).second : 0); + return result; +} + +bool CacheManager::GetPriority(const std::string &policy_app_id, + std::string &priority) { + CACHE_MANAGER_CHECK(false); + const policy_table::ApplicationPolicies& policies = + pt_->policy_table.app_policies; + + policy_table::ApplicationPolicies::const_iterator policy_iter = policies.find(policy_app_id); + const bool app_id_exists = policies.end() != policy_iter; + if (app_id_exists) { + priority = EnumToJsonString((*policy_iter).second.priority); + } + + return app_id_exists; +} + +void CacheManager::CheckSnapshotInitialization() { + CACHE_MANAGER_CHECK_VOID(); + if (!snapshot_) { + LOG4CXX_ERROR(logger_, "Snapshot pointer is not initialized"); + return; + } + + *(snapshot_->policy_table.module_config.preloaded_pt) = false; +} + +utils::SharedPtr<policy_table::Table> +CacheManager::GenerateSnapshot() { + CACHE_MANAGER_CHECK(snapshot_); + snapshot_ = utils::SharedPtr<policy_table::Table>(new policy_table::Table(pt_->policy_table)); + CheckSnapshotInitialization(); + return snapshot_; +} + +bool CacheManager::GetInitialAppData(const std::string& app_id, + StringArray& nicknames, + StringArray& app_hmi_types) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + policy_table::ApplicationPolicies::const_iterator policy_iter = + pt_->policy_table.app_policies.find(app_id); + + if (pt_->policy_table.app_policies.end() != policy_iter) { + const policy_table::ApplicationParams& app_params = (*policy_iter).second; + + std::copy(app_params.nicknames->begin(), app_params.nicknames->end(), + std::back_inserter(nicknames)); + + std::transform(app_params.AppHMIType->begin(), app_params.AppHMIType->end(), + std::back_inserter(nicknames), AppHMITypeToString()); + } + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::GetFunctionalGroupings( + policy_table::FunctionalGroupings& groups) { + + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + const policy_table::FunctionalGroupings& f_groupings = + pt_->policy_table.functional_groupings; + + groups.insert(f_groupings.begin(), f_groupings.end()); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::CountUnconsentedGroups(const std::string& policy_app_id, + const std::string& device_id, + int& result) { + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::SetMetaInfo(const std::string &ccpu_version, + const std::string &wers_country_code, + const std::string &language) { + CACHE_MANAGER_CHECK(false); + return true; +} + +bool CacheManager::IsMetaInfoPresent() const { + CACHE_MANAGER_CHECK(false); + bool result = true; + return result; +} + +bool CacheManager::SetSystemLanguage(const std::string &language) { + CACHE_MANAGER_CHECK(false); + return true; +} + +bool CacheManager::GetFunctionalGroupNames(FunctionalGroupNames &names) { + LOG4CXX_TRACE_ENTER(logger_); + CACHE_MANAGER_CHECK(false); + rpc::policy_table_interface_base::FunctionalGroupings::iterator iter = + pt_->policy_table.functional_groupings.begin(); + rpc::policy_table_interface_base::FunctionalGroupings::iterator iter_end = + pt_->policy_table.functional_groupings.end(); + + for (; iter != iter_end; ++iter) { + const int32_t id = GenerateHash((*iter).first); + std::pair<std::string, std::string> value = + std::make_pair( *(*iter).second.user_consent_prompt, (*iter).first); + + names.insert(std::pair<uint32_t, std::pair<std::string, std::string> >(id, value)); + } + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool CacheManager::CleanupUnpairedDevices(const DeviceIds &device_ids) { + CACHE_MANAGER_CHECK(false); + return true; +} + +void CacheManager::Increment(usage_statistics::GlobalCounterId type) { + CACHE_MANAGER_CHECK_VOID(); +} + +void CacheManager::Increment(const std::string &app_id, + usage_statistics::AppCounterId type) { + CACHE_MANAGER_CHECK_VOID(); +} + +void CacheManager::Set(const std::string &app_id, + usage_statistics::AppInfoId type, + const std::string &value) { + CACHE_MANAGER_CHECK_VOID(); +} + +void CacheManager::Add(const std::string &app_id, + usage_statistics::AppStopwatchId type, + int seconds) { + CACHE_MANAGER_CHECK_VOID(); +} + +void CacheManager::CopyInternalParams(const std::string &from, + const std::string& to) { + is_predata_[to] = is_predata_[from]; +} + +long CacheManager::ConvertSecondsToMinute(int seconds) { + const float seconds_in_minute = 60.0; + return std::round(seconds / seconds_in_minute); +} + +bool CacheManager::SetDefaultPolicy(const std::string &app_id) { + CACHE_MANAGER_CHECK(false); + policy_table::ApplicationPolicies::const_iterator iter = + pt_->policy_table.app_policies.find(kDefaultId); + if (pt_->policy_table.app_policies.end() != iter) { + pt_->policy_table.app_policies[app_id] = + pt_->policy_table.app_policies[kDefaultId]; + + CopyInternalParams(kDefaultId, app_id); + SetIsDefault(app_id, true); + SetIsPredata(app_id, false); + + pt_->policy_table.app_policies[app_id].set_to_string(kDefaultId); + } + return true; +} + +bool CacheManager::IsDefaultPolicy(const std::string& app_id) { + CACHE_MANAGER_CHECK(false); + const bool result = + pt_->policy_table.app_policies.end() != + pt_->policy_table.app_policies.find(app_id) && + !pt_->policy_table.app_policies[app_id].get_string().empty(); + + return result; +} + +bool CacheManager::SetIsDefault(const std::string& app_id, + bool is_default) { + CACHE_MANAGER_CHECK(false); + policy_table::ApplicationPolicies::const_iterator iter = + pt_->policy_table.app_policies.find(app_id); + if (pt_->policy_table.app_policies.end() != iter) { + if (is_default) { + pt_->policy_table.app_policies[app_id].set_to_string("default"); + } else { + pt_->policy_table.app_policies[app_id].set_to_string(""); + } + } + return true; +} + +bool CacheManager::SetPredataPolicy(const std::string &app_id) { + CACHE_MANAGER_CHECK(false); + policy_table::ApplicationPolicies::const_iterator iter = + pt_->policy_table.app_policies.find(kPreDataConsentId); + + if (pt_->policy_table.app_policies.end() != iter) { + pt_->policy_table.app_policies[app_id] = + pt_->policy_table.app_policies[kPreDataConsentId]; + + CopyInternalParams(kPreDataConsentId, app_id); + + SetIsPredata(app_id, true); + SetIsDefault(app_id, false); + } + return true; +} + +bool CacheManager::SetIsPredata(const std::string &app_id, bool is_pre_data) { + is_predata_[app_id] = is_pre_data; + return true; +} + +bool CacheManager::IsPredataPolicy(const std::string &app_id) { + const bool result = + (is_predata_.end() != is_predata_.find(app_id)) && is_predata_[app_id]; + return result; +} + +bool CacheManager::SetUnpairedDevice(const std::string &device_id) { + + const bool result = is_unpaired_.end() != is_unpaired_.find(device_id); + if (result) { + is_unpaired_[device_id] = true; + } + return result; +} + +bool CacheManager::UnpairedDevicesList(DeviceIds& device_ids) { + + std::map<std::string, bool>::const_iterator iter = is_unpaired_.begin(); + std::map<std::string, bool>::const_iterator iter_end = is_unpaired_.end(); + + for (; iter != iter_end; ++iter) { + if ((*iter).second) { + device_ids.push_back((*iter).first); + } + } + return true; +} + +bool CacheManager::SetVINValue(const std::string& value) { + CACHE_MANAGER_CHECK(false); + return true; +} + +bool CacheManager::IsApplicationRepresented(const std::string& app_id) const { + CACHE_MANAGER_CHECK(false); + policy_table::ApplicationPolicies::const_iterator iter = + pt_->policy_table.app_policies.find(app_id); + return pt_->policy_table.app_policies.end() != iter; +} + +bool CacheManager::Init(const std::string& file_name) { + LOG4CXX_INFO(logger_, "CacheManager::Init"); + + InitResult init_result = backup_->Init(); + + bool result = true; + switch (init_result) { + case InitResult::EXISTS: { + LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly."); + result = LoadFromBackup(); + } break; + case InitResult::SUCCESS: { + LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); + result = LoadFromFile(file_name); + } break; + default: { + result = false; + LOG4CXX_ERROR(logger_, "Failed to init policy table."); + } break; + } + + return result; +} + +void CacheManager::FillAppSpecificData() { + CACHE_MANAGER_CHECK_VOID(); + policy_table::ApplicationPolicies::const_iterator iter = + pt_->policy_table.app_policies.begin(); + policy_table::ApplicationPolicies::const_iterator iter_end = + pt_->policy_table.app_policies.begin(); + + for (; iter != iter_end; ++iter) { + const std::string& app_name = (*iter).first; + + is_predata_.insert(std::make_pair(app_name, backup_->IsPredataPolicy(app_name))); + } +} + +void CacheManager::FillDeviceSpecificData() { +} + +bool CacheManager::LoadFromBackup() { + pt_ = backup_->GenerateSnapshot(); + update_required = backup_->UpdateRequired(); + + FillAppSpecificData(); + FillDeviceSpecificData(); + + return true; +} + +bool CacheManager::LoadFromFile(const std::string& file_name) { + + LOG4CXX_INFO(logger_, "CacheManager::LoadFromFile"); + BinaryMessage json_string; + bool final_result = false; + final_result = file_system::ReadBinaryFile(file_name, json_string); + if (!final_result) { + LOG4CXX_WARN(logger_, "Failed to read pt file."); + return final_result; + } + + Json::Value value; + Json::Reader reader(Json::Features::strictMode()); + std::string json(json_string.begin(), json_string.end()); + bool ok = reader.parse(json.c_str(), value); + if (ok) { + pt_ = new policy_table::Table(&value); + } else { + LOG4CXX_WARN(logger_, reader.getFormattedErrorMessages()); + } + + if (!pt_) { + LOG4CXX_WARN(logger_, "Failed to parse policy table"); + return false; + } + + if (!pt_->is_valid()) { + rpc::ValidationReport report("policy_table"); + pt_->ReportErrors(&report); + LOG4CXX_WARN(logger_, "Parsed table is not valid " << + rpc::PrettyFormat(report)); + } + + final_result = backup_->Save(*pt_); + LOG4CXX_INFO( + logger_, + "Loading from file was " << (final_result ? "successful" : "unsuccessful")); + return final_result; +} + +bool CacheManager::ResetPT(const std::string& file_name) { + bool result = true; + return result; +} + +bool CacheManager::AppExists(const std::string &app_id) const { + CACHE_MANAGER_CHECK(false); + policy_table::ApplicationPolicies::iterator policy_iter = + pt_->policy_table.app_policies.find(app_id); + return pt_->policy_table.app_policies.end() != policy_iter; +} + +int32_t CacheManager::GenerateHash(const std::string& str_to_hash) { + + uint32_t hash = 5381U; + std::string::const_iterator it = str_to_hash.begin(); + std::string::const_iterator it_end = str_to_hash.end(); + + for (;it != it_end; ++it) { + hash = ((hash << 5) + hash) + (*it); + } + + // Reset sign bit in case it has been set. + // This is needed to avoid overflow for signed int. + const int32_t result = hash & 0x7FFFFFFF; + return result; +} + +} diff --git a/src/components/policy/src/policy/src/policy_helper.cc b/src/components/policy/src/policy/src/policy_helper.cc new file mode 100644 index 0000000000..71f91aea60 --- /dev/null +++ b/src/components/policy/src/policy/src/policy_helper.cc @@ -0,0 +1,674 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include <algorithm> +#include <sstream> +#include <string.h> +#include "utils/logger.h" +#include "policy/policy_helper.h" +#include "policy/policy_manager_impl.h" + +namespace policy { + +namespace { + +CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") + +bool Match(const StringsValueType& first_name, + const StringsValueType& second_name) { + const std::string& first = first_name; + const std::string& second = second_name; + return (strcasecmp(first.c_str(), second.c_str()) == 0); +} + +bool Compare(const StringsValueType& first, const StringsValueType& second) { + const std::string& first_str = first; + const std::string& second_str = second; + return (strcasecmp(first_str.c_str(), second_str.c_str()) < 0); +} + +} + +CompareGroupName::CompareGroupName(const StringsValueType& group_name) + : group_name_(group_name) { +} + +bool CompareGroupName::operator()( + const StringsValueType& group_name_to_compare) const { + const std::string gn_ = group_name_; + const std::string gn_compare = group_name_to_compare; + return !(strcasecmp(gn_.c_str(), gn_compare.c_str())); +} + +bool operator!=(const policy_table::ApplicationParams& first, + const policy_table::ApplicationParams& second) { + // TODO(AOleynik): Add comparing of Ford-specific and other parameters + if (first.groups.size() != second.groups.size()) { + return true; + } + StringsConstItr it_first = first.groups.begin(); + StringsConstItr it_first_end = first.groups.end(); + StringsConstItr it_second = second.groups.begin(); + StringsConstItr it_second_end = second.groups.end(); + for (; it_first != it_first_end; ++it_first) { + CompareGroupName gp(*it_first); + StringsConstItr it = std::find_if(it_second, it_second_end, gp); + if (it_first_end == it) { + return true; + } + } + return false; +} + +CheckAppPolicy::CheckAppPolicy( + PolicyManagerImpl* pm, + const utils::SharedPtr<policy_table::Table> update, + const utils::SharedPtr<policy_table::Table> snapshot) + : pm_(pm), + update_(update), + snapshot_(snapshot) { +} + +bool CheckAppPolicy::HasSameGroups(const AppPoliciesValueType& app_policy, + AppPermissions* perms) const { + const std::string app_id = app_policy.first; + AppPoliciesConstItr it = snapshot_->policy_table.app_policies.find(app_id); + + if (app_policy.second.is_string()) { + return (it->second.is_string() && + app_policy.second.get_string().compare(it->second.get_string()) + == 0); + } + + policy_table::Strings groups_new = app_policy.second.groups; + std::sort(groups_new.begin(), groups_new.end(), Compare); + + policy_table::Strings groups_curr = (*it).second.groups; + std::sort(groups_curr.begin(), groups_curr.end(), Compare); + + StringsConstItr it_groups_new = groups_new.begin(); + StringsConstItr it_groups_new_end = groups_new.end(); + + StringsConstItr it_groups_curr = groups_curr.begin(); + StringsConstItr it_groups_curr_end = groups_curr.end(); + + StringsConstItr new_it = it_groups_new; + StringsConstItr old_it = it_groups_curr; + + std::pair<StringsConstItr, StringsConstItr> diff; + + while (it_groups_new_end != new_it && it_groups_curr_end != old_it) { + size_t size = ((it_groups_new_end - new_it) > (it_groups_curr_end - old_it)) + ? it_groups_curr_end - old_it : it_groups_new_end - new_it; + diff = std::mismatch(old_it, old_it + size, new_it, Match); + if (it_groups_curr_end == diff.first || it_groups_new_end == diff.second) { + new_it = diff.second; + old_it = diff.first; + break; + } + if (Compare(*diff.first, *diff.second) && + IsConsentRequired(*(diff.first))) { + perms->isAppPermissionsRevoked = true; + FunctionalGroupPermission group; + group.group_name = *(diff.first); + perms->appRevokedPermissions.push_back(group); + old_it = ++diff.first; + new_it = diff.second; + } else { + // according to the SDLAQ-CRS-2757 we have to set + // appPermissionsConsentNeeded should not be set to true + // in case if this group is auto-allowed + perms->appPermissionsConsentNeeded = IsConsentRequired(*new_it); + old_it = diff.first; + new_it = ++diff.second; + } + } + + for (StringsConstItr it = old_it; it != it_groups_curr_end; ++it) { + if (!IsConsentRequired(*it)) { + continue; + } + perms->isAppPermissionsRevoked = true; + FunctionalGroupPermission group; + group.group_name = *it; + perms->appRevokedPermissions.push_back(group); + } + + if (it_groups_new_end != new_it) { + perms->appPermissionsConsentNeeded = true; + } + + if (perms->isAppPermissionsRevoked) { + + std::vector<policy::FunctionalGroupPermission>::const_iterator it = + perms->appRevokedPermissions.begin(); + std::vector<policy::FunctionalGroupPermission>::const_iterator it_end = + perms->appRevokedPermissions.end(); + for (;it != it_end; ++it) { + pm_->RemoveAppConsentForGroup(perms->application_id, it->group_name); + } + } + + + return !(perms->appRevokedPermissions.size() > 0 + || perms->appPermissionsConsentNeeded); +} + +bool CheckAppPolicy::IsNewAppication(const std::string& application_id) const { + const policy_table::ApplicationPolicies& current_policies = + snapshot_->policy_table.app_policies; + AppPoliciesConstItr it_app_policies_curr = current_policies.begin(); + AppPoliciesConstItr it_app_policies_curr_end = current_policies.end(); + + for (; it_app_policies_curr != it_app_policies_curr_end; + ++it_app_policies_curr) { + + // Find necessary application in current snapshot + const std::string application_id_curr = (*it_app_policies_curr).first; + if (application_id == application_id_curr) { + return false; + } + } + return true; +} + +void CheckAppPolicy::SendNotification( + const AppPoliciesValueType& app_policy) const { + // Collecting all available rpcs and their parameters from updated + // policies and fill notification data struct + Permissions notification_data; + + // Get current user permissions for groups from DB + std::vector<FunctionalGroupPermission> group_permissons; + // Get current device_id from application id + const std::string device_id = pm_->GetCurrentDeviceId(app_policy.first); + if (device_id.empty()) { + LOG4CXX_WARN(logger_, "Couldn't find device info for application id " + "'" << app_policy.first << "'"); + return; + } + pm_->GetPermissionsForApp(device_id, app_policy.first, group_permissons); + + pm_->PrepareNotificationData(update_->policy_table.functional_groupings, + app_policy.second.groups, + group_permissons, notification_data); + + const std::string app_id = app_policy.first; + LOG4CXX_INFO(logger_, "Send notification for application_id:" << app_id); + // Default_hmi is Ford-specific and should not be used with basic policy + const std::string default_hmi; + pm_->listener()->OnPermissionsUpdated(app_id, notification_data, default_hmi); +} + +void CheckAppPolicy::SendOnPendingPermissions( + const AppPoliciesValueType& app_policy, AppPermissions permissions) const { + // TODO(AOleynik): Exclude default group(s) + if (permissions.appPermissionsConsentNeeded) { + } + // TODO(AOleynik): Seems, it is unused part? + if (permissions.isAppPermissionsRevoked) { + pm_->app_permissions_diff_.insert( + std::make_pair(app_policy.first, permissions)); + pm_->listener()->OnPendingPermissionChange(app_policy.first); + } +} + +bool CheckAppPolicy::IsAppRevoked( + const AppPoliciesValueType& app_policy) const { + // Application params are not initialized = application revoked + // i.e. "123":null + return app_policy.second.is_null(); +} + +bool CheckAppPolicy::NicknamesMatch( + const std::string app_id, + const AppPoliciesValueType& app_policy) const { + std::string app_name = pm_->listener()->GetAppName(app_id); + if (!app_name.empty() && + app_policy.second.nicknames && + !app_policy.second.nicknames->empty()) { + for (policy_table::Strings::const_iterator it = + app_policy.second.nicknames->begin(); + app_policy.second.nicknames->end() != it; ++it) { + std::string temp = *it; + if (temp.compare(app_name) == 0) { + return true; + } + } + return false; + } + return true; +} + +bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { + policy_table::ApplicationPolicies& current_policies = + snapshot_->policy_table.app_policies; + + const std::string app_id = app_policy.first; + + AppPermissions permissions_diff(app_id); + permissions_diff.priority = policy_table::EnumToJsonString( + app_policy.second.priority); + + // Check revocation + if (!IsPredefinedApp(app_policy) && IsAppRevoked(app_policy)) { + permissions_diff.appRevoked = true; + pm_->app_permissions_diff_.insert(std::make_pair(app_id, permissions_diff)); + pm_->listener()->OnAppRevoked(app_id); + policy_table::ApplicationPolicies::iterator it = current_policies.find( + app_id); + // Update snapshot with new policies for application + if (it != current_policies.end()) { + // Update + (*it).second = app_policy.second; + it->second.set_to_null(); + } else { + // Add + current_policies[app_policy.first] = app_policy.second; + } + return true; + } + + // TODO(PV): do we really need this check? + if (IsNewAppication(app_id)) { + // Update snapshot with policies for new application + current_policies[app_id] = app_policy.second; + SendNotification(app_policy); + SendOnPendingPermissions(app_policy, permissions_diff); + return true; + } + + if (!IsPredefinedApp(app_policy) && !NicknamesMatch(app_id, app_policy)) { + permissions_diff.appUnauthorized = true; + pm_->app_permissions_diff_.insert(std::make_pair(app_id, permissions_diff)); + pm_->listener()->OnPendingPermissionChange(app_policy.first); + policy_table::ApplicationPolicies::iterator it = current_policies.find( + app_id); + // Update snapshot with new policies for application + if (it != current_policies.end()) { + (*it).second = app_policy.second; + it->second.set_to_null(); + } + return true; + } + + if (HasSameGroups(app_policy, &permissions_diff)) { + LOG4CXX_INFO(logger_, "Permissions for application:" << app_id << + " wasn't changed."); + return true; + } + + LOG4CXX_INFO(logger_, "Permissions for application:" << app_id << + " have been changed."); + + policy_table::ApplicationPolicies::iterator it = current_policies.find( + app_id); + // Update snapshot with new policies for application + (*it).second = app_policy.second; + + // Don't sent notification for predefined apps (e.g. default, device etc.) + if (!IsPredefinedApp(app_policy)) { + SendNotification(app_policy); + SendOnPendingPermissions(app_policy, permissions_diff); + } + return true; +} + +bool CheckAppPolicy::IsConsentRequired(const std::string& group_name) const { + const policy_table::FunctionalGroupings& functional_groupings = + snapshot_->policy_table.functional_groupings; + FuncGroupConstItr it = functional_groupings.find(group_name); + if (functional_groupings.end() == it) { + return false; + } + + return it->second.user_consent_prompt.is_initialized(); +} + +FillNotificationData::FillNotificationData(Permissions& data, + GroupConsent group_state, GroupConsent undefined_group_consent) + : data_(data) { + switch (group_state) { + case kGroupAllowed: + current_key_ = kAllowedKey; + break; + case kGroupUndefined: + if (kGroupUndefined == undefined_group_consent) { + current_key_ = kUndefinedKey; + break; + } + current_key_ = kGroupAllowed == undefined_group_consent? + kAllowedKey: + kUserDisallowedKey; + break; + default: + current_key_ = kUserDisallowedKey; + break; + } +} + +bool FillNotificationData::operator()(const RpcValueType& rpc) { + Permissions::iterator it = data_.find(rpc.first); + // If rpc is present already - update its permissions + if (data_.end() != it) { + UpdateHMILevels(rpc.second.hmi_levels, + (*it).second.hmi_permissions[current_key_]); + // TODO(IKozyrenko): Check logic if optional container is missing + UpdateParameters(*rpc.second.parameters, + (*it).second.parameter_permissions[current_key_]); + ExcludeSame(); + } else { + // Init mandatory keys, since they should be present irrespectively of + // values presence + InitRpcKeys(rpc.first); + // If rpc is not present - add its permissions + UpdateHMILevels(rpc.second.hmi_levels, + data_[rpc.first].hmi_permissions[current_key_]); + // TODO(IKozyrenko): Check logic if optional container is missing + UpdateParameters(*rpc.second.parameters, + data_[rpc.first].parameter_permissions[current_key_]); + ExcludeSame(); + } + return true; +} + +void FillNotificationData::UpdateHMILevels( + const policy_table::HmiLevels& in_hmi, std::set<HMILevel>& out_hmi) { + HMILevelsConstItr it_hmi_levels = in_hmi.begin(); + HMILevelsConstItr it_hmi_levels_end = in_hmi.end(); + + for (; it_hmi_levels != it_hmi_levels_end; ++it_hmi_levels) { + out_hmi.insert(policy_table::EnumToJsonString(*it_hmi_levels)); + } +} + +void FillNotificationData::UpdateParameters( + const policy_table::Parameters& in_parameters, + std::set<Parameter>& out_parameter) { + ParametersConstItr it_parameters = in_parameters.begin(); + ParametersConstItr it_parameters_end = in_parameters.end(); + + for (; it_parameters != it_parameters_end; ++it_parameters) { + out_parameter.insert(policy_table::EnumToJsonString(*it_parameters)); + } +} + +void FillNotificationData::ExcludeSame() { + Permissions::iterator it = data_.begin(); + Permissions::const_iterator it_end = data_.end(); + // Groups + for (; it != it_end; ++it) { + HMIPermissions& rpc_hmi_permissions = (*it).second.hmi_permissions; + HMIPermissions::const_iterator it_hmi_allowed = + (*it).second.hmi_permissions.find(kAllowedKey); + HMIPermissions::const_iterator it_hmi_undefined = + (*it).second.hmi_permissions.find(kUndefinedKey); + HMIPermissions::const_iterator it_hmi_user_disallowed = + (*it).second.hmi_permissions.find(kUserDisallowedKey); + + ParameterPermissions& rpc_parameter_permissions = + (*it).second.parameter_permissions; + ParameterPermissions::const_iterator it_parameter_allowed = + (*it).second.parameter_permissions.find(kAllowedKey); + ParameterPermissions::const_iterator it_parameter_undefined = + (*it).second.parameter_permissions.find(kUndefinedKey); + ParameterPermissions::const_iterator it_parameter_user_disallowed = + (*it).second.parameter_permissions.find(kUserDisallowedKey); + + // First, remove disallowed from other types + if (rpc_hmi_permissions.end() != it_hmi_user_disallowed) { + if (rpc_hmi_permissions.end() != it_hmi_allowed) { + ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey], + rpc_hmi_permissions[kUserDisallowedKey]); + } + if (rpc_hmi_permissions.end() != it_hmi_undefined) { + ExcludeSameHMILevels(rpc_hmi_permissions[kUndefinedKey], + rpc_hmi_permissions[kUserDisallowedKey]); + } + } + + if (rpc_parameter_permissions.end() != it_parameter_user_disallowed) { + if (rpc_parameter_permissions.end() != it_parameter_allowed) { + ExcludeSameParameters(rpc_parameter_permissions[kAllowedKey], + rpc_parameter_permissions[kUserDisallowedKey]); + } + if (rpc_parameter_permissions.end() != it_parameter_undefined) { + ExcludeSameParameters(rpc_parameter_permissions[kUndefinedKey], + rpc_parameter_permissions[kUserDisallowedKey]); + } + } + + // Then, remove undefined from allowed + if (rpc_hmi_permissions.end() != it_hmi_undefined) { + if (rpc_hmi_permissions.end() != it_hmi_allowed) { + ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey], + rpc_hmi_permissions[kUndefinedKey]); + } + } + + if (rpc_parameter_permissions.end() != it_parameter_undefined) { + if (rpc_parameter_permissions.end() != it_parameter_allowed) { + ExcludeSameParameters(rpc_parameter_permissions[kAllowedKey], + rpc_parameter_permissions[kUndefinedKey]); + } + } + } +} + +void FillNotificationData::ExcludeSameHMILevels( + std::set<HMILevel>& source, + const std::set<HMILevel>& target) { + std::set<HMILevel> diff_hmi; + + std::set_difference(source.begin(), source.end(), + target.begin(), target.end(), + std::inserter(diff_hmi, diff_hmi.begin())); + + source = diff_hmi; +} + +void FillNotificationData::ExcludeSameParameters( + std::set<Parameter>& source, + const std::set<Parameter>& target) { + std::set<Parameter> diff_parameter; + + std::set_difference(source.begin(), source.end(), + target.begin(), target.end(), + std::inserter(diff_parameter, diff_parameter.begin())); + + source = diff_parameter; +} + +void FillNotificationData::InitRpcKeys(const std::string& rpc_name) { + data_[rpc_name].hmi_permissions[kAllowedKey]; + data_[rpc_name].hmi_permissions[kUserDisallowedKey]; + data_[rpc_name].parameter_permissions[kAllowedKey]; + data_[rpc_name].parameter_permissions[kUserDisallowedKey]; +} + +ProcessFunctionalGroup::ProcessFunctionalGroup( + const policy_table::FunctionalGroupings& fg, + const std::vector<FunctionalGroupPermission>& group_permissions, + Permissions& data, + GroupConsent undefined_group_consent) + : fg_(fg), + group_permissions_(group_permissions), + data_(data), + undefined_group_consent_(undefined_group_consent) { +} + +bool ProcessFunctionalGroup::operator()(const StringsValueType& group_name) { + const std::string group_name_str = group_name; + FuncGroupConstItr it = fg_.find(group_name_str); + + if (fg_.end() != it) { + const policy_table::Rpc& rpcs = (*it).second.rpcs; + FillNotificationData filler(data_, GetGroupState(group_name_str), + undefined_group_consent_); + std::for_each(rpcs.begin(), rpcs.end(), filler); + } + return true; +} + +GroupConsent ProcessFunctionalGroup::GetGroupState( + const std::string& group_name) { + std::vector<FunctionalGroupPermission>::const_iterator it = + group_permissions_.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_end = + group_permissions_.end(); + for (; it != it_end; ++it) { + if (group_name == (*it).group_name) { + return (*it).state; + } + } + return kGroupUndefined; +} + +FunctionalGroupInserter::FunctionalGroupInserter( + const policy_table::Strings& preconsented_groups, PermissionsList& list) + : list_(list), + preconsented_(preconsented_groups) { +} + +void FunctionalGroupInserter::operator()(const StringsValueType& group_name) { + CompareGroupName name(group_name); + if (std::find_if(preconsented_.begin(), preconsented_.end(), name) + == preconsented_.end()) { + list_.push_back(group_name); + } +} + +void FillFunctionalGroupPermissions( + FunctionalGroupIDs& ids, + FunctionalGroupNames& names, + GroupConsent state, + std::vector<FunctionalGroupPermission>& permissions) { + LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions" ); + FunctionalGroupIDs::const_iterator it = ids.begin(); + FunctionalGroupIDs::const_iterator it_end = ids.end(); + for (; it != it_end; ++it) { + FunctionalGroupPermission current_group; + current_group.group_id = *it; + current_group.group_alias = names[*it].first; + current_group.group_name = names[*it].second; + current_group.state = state; + permissions.push_back(current_group); + } +} + +bool IsPredefinedApp(const AppPoliciesValueType& app) { + return app.first == kDefaultId || app.first == kPreDataConsentId || + app.first == kDeviceId; +} + +FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from, + const FunctionalGroupIDs& what) { + LOG4CXX_INFO(logger_, "Exclude same groups" ); + FunctionalGroupIDs from_copy(from); + FunctionalGroupIDs what_copy(what); + + std::sort(from_copy.begin(), from_copy.end()); + std::sort(what_copy.begin(), what_copy.end()); + + FunctionalGroupIDs no_same; + std::set_difference(from_copy.begin(), from_copy.end(), + what_copy.begin(),what_copy.end(), + std::back_inserter(no_same)); + + no_same.resize(std::distance(no_same.begin(), + std::unique(no_same.begin(), no_same.end()))); + + return no_same; +} + +FunctionalGroupIDs Merge(const FunctionalGroupIDs& first, + const FunctionalGroupIDs& second) { + LOG4CXX_INFO(logger_, "Merge groups" ); + FunctionalGroupIDs first_copy(first); + FunctionalGroupIDs second_copy(second); + + std::sort(first_copy.begin(), first_copy.end()); + std::sort(second_copy.begin(), second_copy.end()); + + FunctionalGroupIDs merged; + std::set_union(first_copy.begin(), first_copy.end(), + second_copy.begin(), second_copy.end(), + std::back_inserter(merged)); + + merged.resize(std::distance(merged.begin(), + std::unique(merged.begin(), merged.end()))); + + return merged; +} + +FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first, + const FunctionalGroupIDs& second) { + LOG4CXX_INFO(logger_, "Find same groups"); + FunctionalGroupIDs first_copy(first); + FunctionalGroupIDs second_copy(second); + + std::sort(first_copy.begin(), first_copy.end()); + std::sort(second_copy.begin(), second_copy.end()); + + FunctionalGroupIDs same; + std::set_intersection(first_copy.begin(), first_copy.end(), + second_copy.begin(), second_copy.end(), + std::back_inserter(same)); + + same.resize(std::distance(same.begin(), + std::unique(same.begin(), same.end()))); + + return same; +} + +bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) { + policy_table::ApplicationPolicies::iterator it = app_policies.begin(); + policy_table::ApplicationPolicies::iterator it_default = app_policies. + find(kDefaultId); + for (; app_policies.end() != it; ++it) { + // Set default policies for app, if there is record like "123":"default" + if (kDefaultId.compare((*it).second.get_string()) == 0) { + if (it != app_policies.end()) { + (*it).second = (*it_default).second; + it->second.set_to_string(kDefaultId); + } else { + LOG4CXX_ERROR(logger_, "There is no default application policy was " + "found in PTU."); + return false; + } + } + } + + return true; +} + +} diff --git a/src/components/policy/src/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy/src/policy_manager_impl.cc new file mode 100644 index 0000000000..a712019c7c --- /dev/null +++ b/src/components/policy/src/policy/src/policy_manager_impl.cc @@ -0,0 +1,839 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +#include "policy/policy_manager_impl.h" + +#include <algorithm> +#include <set> +#include <iterator> +#include "json/reader.h" +#include "json/writer.h" +#include "policy/policy_table.h" +#include "policy/pt_representation.h" +#include "policy/policy_helper.h" +#include "utils/file_system.h" +#include "utils/logger.h" +#include "policy/cache_manager.h" +#include "policy/update_status_manager.h" + +policy::PolicyManager* CreateManager() { + return new policy::PolicyManagerImpl(); +} + +namespace { + +struct CheckGroupName { + CheckGroupName(const std::string& name) + : name_(name) { + } + + bool operator()(const policy::FunctionalGroupPermission& value) { + return value.group_name == name_; + } + +private: + const std::string& name_; +}; + +struct CopyPermissions{ + CopyPermissions(const std::vector<policy::FunctionalGroupPermission>& groups) + : groups_(groups) { + } + +bool operator()(policy::FunctionalGroupPermission& value) { + CheckGroupName checker(value.group_name); + std::vector<policy::FunctionalGroupPermission>::const_iterator it = + std::find_if(groups_.begin(), groups_.end(), checker); + if (groups_.end() == it) { + return false; + } + value.group_alias = it->group_alias; + value.group_id = it->group_id; + value.state = it->state; + return true; +} + +private: + const std::vector<policy::FunctionalGroupPermission>& groups_; +}; + +} + +namespace policy { + +CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl") + +PolicyManagerImpl::PolicyManagerImpl() + : PolicyManager(), + listener_(NULL), + update_status_manager_(new UpdateStatusManager), + cache_(new CacheManager), + retry_sequence_timeout_(60), + retry_sequence_index_(0) { +} + +void PolicyManagerImpl::set_listener(PolicyListener* listener) { + listener_ = listener; + update_status_manager_->set_listener(listener); +} + +PolicyManagerImpl::~PolicyManagerImpl() { + LOG4CXX_INFO(logger_, "Destroying policy manager."); + const bool update_required = + policy::StatusUpToDate != update_status_manager_->GetUpdateStatus() + ? true : false; + cache_->SaveUpdateRequired(update_required); + cache_->Backup(); +} + +utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( + const BinaryMessage& pt_content) { + std::string json(pt_content.begin(), pt_content.end()); + Json::Value value; + Json::Reader reader; + if (reader.parse(json.c_str(), value)) { + return new policy_table::Table(&value); + } else { + return utils::SharedPtr<policy_table::Table>(); + } +} + +bool PolicyManagerImpl::LoadPT(const std::string& file, + const BinaryMessage& pt_content) { + LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size()); + + // Parse message into table struct + utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + if (!pt_update) { + LOG4CXX_WARN(logger_, "Parsed table pointer is 0."); + update_status_manager_->OnWrongUpdateReceived(); + return false; + } + pt_update->SetPolicyTableType(policy_table::PT_UPDATE); + + + if (!pt_update->is_valid()) { + rpc::ValidationReport report("policy_table"); + pt_update->ReportErrors(&report); + LOG4CXX_WARN(logger_, "Parsed table is not valid " << + rpc::PrettyFormat(report)); + + update_status_manager_->OnWrongUpdateReceived(); + return false; + } + + update_status_manager_->OnValidUpdateReceived(); + + sync_primitives::AutoLock lock(apps_registration_lock_); + + // Get current DB data, since it could be updated during awaiting of PTU + utils::SharedPtr<policy_table::Table> policy_table_snapshot = + cache_->GenerateSnapshot(); + if (!policy_table_snapshot) { + LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); + return false; + } + + // Replace predefined policies with its actual setting, e.g. "123":"default" + // to actual values of default section + UnwrapAppPolicies(pt_update->policy_table.app_policies); + + // Check and update permissions for applications, send notifications + CheckPermissionsChanges(pt_update, policy_table_snapshot); + + // Replace current data with updated + + + if (!cache_->ApplyUpdate(*pt_update)) { + LOG4CXX_WARN(logger_, "Unsuccessful save of updated policy table."); + return false; + } + // Removing last app request from update requests + RemoveAppFromUpdateList(); + + // If there was a user request for policy table update, it should be started + // right after current update is finished + if(listener_) { + RefreshRetrySequence(); + listener_->OnUserRequestedUpdateCheckRequired(); + return true; + } + + + // TODO(AOleynik): Check, if there is updated info present for apps in list + // and skip update in this case for given app + if (!update_requests_list_.empty()) { + if (listener_) { + listener_->OnPTExchangeNeeded(); + } + } else { + LOG4CXX_INFO(logger_, "Update request queue is empty."); + } + + RefreshRetrySequence(); + + return true; +} + +void PolicyManagerImpl::CheckPermissionsChanges( + const utils::SharedPtr<policy_table::Table> pt_update, + const utils::SharedPtr<policy_table::Table> snapshot) { + LOG4CXX_INFO(logger_, "Checking incoming permissions."); + + std::for_each(pt_update->policy_table.app_policies.begin(), + pt_update->policy_table.app_policies.end(), + CheckAppPolicy(this, pt_update, snapshot)); +} + +void PolicyManagerImpl::PrepareNotificationData( + const policy_table::FunctionalGroupings& groups, + const policy_table::Strings& group_names, + const std::vector<FunctionalGroupPermission>& group_permission, + Permissions& notification_data) { + + LOG4CXX_INFO(logger_, "Preparing data for notification."); + ProcessFunctionalGroup processor(groups, group_permission, notification_data); + std::for_each(group_names.begin(), group_names.end(), processor); +} + +void PolicyManagerImpl::AddAppToUpdateList(const std::string& application_id) { + sync_primitives::AutoLock lock(update_request_list_lock_); + LOG4CXX_INFO(logger_, + "Adding application " << application_id << " to update list"); + // Add application id only once + std::list<std::string>::const_iterator it = std::find( + update_requests_list_.begin(), update_requests_list_.end(), + application_id); + if (it == update_requests_list_.end()) { + update_requests_list_.push_back(application_id); + } +} + +void PolicyManagerImpl::RemoveAppFromUpdateList() { + sync_primitives::AutoLock lock(update_request_list_lock_); + if (update_requests_list_.empty()) { + return; + } + LOG4CXX_INFO( + logger_, + "Removing application " << update_requests_list_.front() << " from update list"); + update_requests_list_.pop_front(); +} + +std::string PolicyManagerImpl::GetUpdateUrl(int service_type) { + LOG4CXX_INFO(logger_, "PolicyManagerImpl::GetUpdateUrl"); + EndpointUrls urls = cache_->GetUpdateUrls(service_type); + + static uint32_t index = 0; + std::string url; + + if (!urls.empty() && index >= urls.size()) { + index = 0; + } + url = urls[index].url.empty() ? "" :urls[index].url[0]; + + ++index; + return url; +} + +EndpointUrls PolicyManagerImpl::GetUpdateUrls(int service_type) { + LOG4CXX_INFO(logger_, "PolicyManagerImpl::GetUpdateUrls"); + return cache_->GetUpdateUrls(service_type); +} + +BinaryMessageSptr PolicyManagerImpl::RequestPTUpdate() { + LOG4CXX_INFO(logger_, "Creating PT Snapshot"); + utils::SharedPtr<policy_table::Table> policy_table_snapshot = + cache_->GenerateSnapshot(); + if (!policy_table_snapshot) { + LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); + return NULL; + } + + policy_table_snapshot->SetPolicyTableType(policy_table::PT_SNAPSHOT); + if (false == policy_table_snapshot->is_valid()) { + LOG4CXX_INFO( + logger_, "Policy snappshot is not valid"); + rpc::ValidationReport report("policy_table"); + policy_table_snapshot->ReportErrors(&report); + LOG4CXX_INFO(logger_, + "Errors: " << rpc::PrettyFormat(report)); + } + + Json::Value value = policy_table_snapshot->ToJsonValue(); + Json::FastWriter writer; + std::string message_string = writer.write(value); + return new BinaryMessage(message_string.begin(), message_string.end()); +} + +void PolicyManagerImpl::CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + const RPCParams& rpc_params, + CheckPermissionResult& result) { + LOG4CXX_INFO( + logger_, + "CheckPermissions for " << app_id << " and rpc " << rpc << " for " + << hmi_level << " level."); + + cache_->CheckPermissions(app_id, hmi_level, rpc, result); +} + +bool PolicyManagerImpl::ResetUserConsent() { + bool result = true; + + return result; +} + +void PolicyManagerImpl::SendNotificationOnPermissionsUpdated( + const std::string& application_id) { + const std::string device_id = GetCurrentDeviceId(application_id); + if (device_id.empty()) { + LOG4CXX_WARN(logger_, "Couldn't find device info for application id " + "'" << application_id << "'"); + return; + } + + std::vector<FunctionalGroupPermission> app_group_permissions; + GetPermissionsForApp(device_id, application_id, app_group_permissions); + + policy_table::FunctionalGroupings functional_groupings; + cache_->GetFunctionalGroupings(functional_groupings); + + policy_table::Strings app_groups; + std::vector<FunctionalGroupPermission>::const_iterator it = + app_group_permissions.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_end = + app_group_permissions.end(); + for (; it != it_end; ++it) { + app_groups.push_back((*it).group_name); + } + + Permissions notification_data; + PrepareNotificationData(functional_groupings, app_groups, app_group_permissions, + notification_data); + + LOG4CXX_INFO(logger_, "Send notification for application_id:" << application_id); + std::string default_hmi; + default_hmi = "NONE"; + listener()->OnPermissionsUpdated(application_id, notification_data, + default_hmi); +} + +bool PolicyManagerImpl::CleanupUnpairedDevices() { + LOG4CXX_INFO(logger_, "CleanupUnpairedDevices"); +// EXTENDED_POLICY + // For SDL-specific it doesn't matter + return true; +} + +DeviceConsent PolicyManagerImpl::GetUserConsentForDevice( + const std::string& device_id) { + LOG4CXX_INFO(logger_, "GetUserConsentForDevice"); + return kDeviceAllowed; +} + +void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id, + bool is_allowed) { + LOG4CXX_INFO(logger_, "SetUserConsentForDevice"); + DeviceConsent current_consent = GetUserConsentForDevice(device_id); + bool is_current_device_allowed = + DeviceConsent::kDeviceAllowed == current_consent ? true : false; + if (DeviceConsent::kDeviceHasNoConsent != current_consent && + is_current_device_allowed == is_allowed) { + const std::string consent = is_allowed ? "allowed" : "disallowed"; + LOG4CXX_INFO(logger_, "Device is already " << consent << "."); + return; + } +} + +bool PolicyManagerImpl::ReactOnUserDevConsentForApp(const std::string app_id, + bool is_device_allowed) { + return true; +} + +bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id, + StringArray* nicknames, + StringArray* app_hmi_types) { + LOG4CXX_INFO(logger_, "GetInitialAppData"); + const bool result = nicknames && app_hmi_types; + if (result) { + cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types); + } + return result; +} + +void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id, + const DeviceInfo& device_info) { + LOG4CXX_INFO(logger_, "SetDeviceInfo"); +} + +PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent( + const PermissionConsent& permissions_to_check) { + std::vector<FunctionalGroupPermission> current_user_consents; + GetUserConsentForApp(permissions_to_check.device_id, + permissions_to_check.policy_app_id, + current_user_consents); + + PermissionConsent permissions_to_set; + permissions_to_set.device_id = permissions_to_check.device_id; + permissions_to_set.policy_app_id = permissions_to_check.policy_app_id; + permissions_to_set.consent_source = permissions_to_check.consent_source; + + std::vector<FunctionalGroupPermission>::const_iterator it = + permissions_to_check.group_permissions.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_end = + permissions_to_check.group_permissions.end(); + + for (;it != it_end; ++it) { + std::vector<FunctionalGroupPermission>::const_iterator it_curr = + current_user_consents.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_curr_end = + current_user_consents.end(); + + for (; it_curr != it_curr_end; ++it_curr) { + if (it->group_alias == it_curr->group_alias && + it->group_id == it_curr->group_id) { + permissions_to_set.group_permissions.push_back(*it); + } + } + } + + return permissions_to_set; +} + +void PolicyManagerImpl::SetUserConsentForApp( + const PermissionConsent& permissions) { + LOG4CXX_INFO(logger_, "SetUserConsentForApp"); +} + +bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id, + std::string* default_hmi) { + LOG4CXX_INFO(logger_, "GetDefaultHmi"); + return false; +} + +bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id, + std::string* priority) { + LOG4CXX_INFO(logger_, "GetPriority"); + if (!priority) { + LOG4CXX_WARN(logger_, "Input priority parameter is null."); + return false; + } + + return cache_->GetPriority(policy_app_id, *priority); +} + +std::vector<UserFriendlyMessage> PolicyManagerImpl::GetUserFriendlyMessages( + const std::vector<std::string>& message_code, const std::string& language) { + return cache_->GetUserFriendlyMsg(message_code, language); +} + +void PolicyManagerImpl::GetUserConsentForApp( + const std::string& device_id, const std::string& policy_app_id, + std::vector<FunctionalGroupPermission>& permissions) { + LOG4CXX_INFO(logger_, "GetUserConsentForApp"); + + FunctionalIdType group_types; + if (!cache_->GetPermissionsForApp(device_id, policy_app_id, + group_types)) { + LOG4CXX_WARN(logger_, "Can't get user permissions for app " + << policy_app_id); + return; + } + + // Functional groups w/o alias ("user_consent_prompt") considered as + // automatically allowed and it could not be changed by user + FunctionalGroupNames group_names; + if (!cache_->GetFunctionalGroupNames(group_names)) { + LOG4CXX_WARN(logger_, "Can't get functional group names"); + return; + } + + FunctionalGroupNames::const_iterator it = group_names.begin(); + FunctionalGroupNames::const_iterator it_end = group_names.end(); + FunctionalGroupIDs auto_allowed_groups; + for (;it != it_end; ++it) { + if (it->second.first.empty()) { + auto_allowed_groups.push_back(it->first); + } + } + + // For basic policy + FunctionalGroupIDs all_groups = group_types[kTypeGeneral]; + FunctionalGroupIDs default_groups = group_types[kTypeDefault]; + FunctionalGroupIDs predataconsented_groups = + group_types[kTypePreDataConsented]; + + FunctionalGroupIDs allowed_groups; + FunctionalGroupIDs no_auto = ExcludeSame(all_groups, auto_allowed_groups); + + if (cache_->IsDefaultPolicy(policy_app_id)) { + allowed_groups = ExcludeSame(no_auto, default_groups); + } else if (cache_->IsPredataPolicy(policy_app_id)) { + allowed_groups = ExcludeSame(no_auto, predataconsented_groups); + } + FillFunctionalGroupPermissions(allowed_groups, group_names, + kGroupAllowed, permissions); +} + +void PolicyManagerImpl::GetPermissionsForApp( + const std::string& device_id, const std::string& policy_app_id, + std::vector<FunctionalGroupPermission>& permissions) { + LOG4CXX_INFO(logger_, "GetPermissionsForApp"); + std::string app_id_to_check = policy_app_id; + + bool allowed_by_default = false; + if (cache_->IsDefaultPolicy(policy_app_id)) { + app_id_to_check = kDefaultId; + allowed_by_default = true; + } else if (cache_->IsPredataPolicy(policy_app_id)) { + app_id_to_check = kPreDataConsentId; + allowed_by_default = true; + } + + FunctionalIdType group_types; + if (!cache_->GetPermissionsForApp(device_id, app_id_to_check, + group_types)) { + LOG4CXX_WARN(logger_, "Can't get user permissions for app " + << policy_app_id); + return; + } + + // Functional groups w/o alias ("user_consent_prompt") considered as + // automatically allowed and it could not be changed by user + FunctionalGroupNames group_names; + if (!cache_->GetFunctionalGroupNames(group_names)) { + LOG4CXX_WARN(logger_, "Can't get functional group names"); + return; + } + + // The "default" and "pre_DataConsent" are auto-allowed groups + // So, check if application in the one of these mode. + if (allowed_by_default) { + LOG4CXX_INFO(logger_, "Get auto allowe groups"); + GroupType type = (kDefaultId == app_id_to_check ? + kTypeDefault : kTypePreDataConsented); + + FillFunctionalGroupPermissions(group_types[type], group_names, + kGroupAllowed, permissions); + } else { + + // The code bellow allows to process application which + // has specific permissions(not default and pre_DataConsent). + + // All groups for specific application + FunctionalGroupIDs all_groups = group_types[kTypeGeneral]; + + // In case of GENIVI all groups are allowed + FunctionalGroupIDs common_allowed = all_groups; + FillFunctionalGroupPermissions(common_allowed, group_names, + kGroupAllowed, permissions); + } + return; +} + +std::string& PolicyManagerImpl::GetCurrentDeviceId( + const std::string& policy_app_id) { + LOG4CXX_INFO(logger_, "GetDeviceInfo"); + last_device_id_ = + listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id); + return last_device_id_; +} + +void PolicyManagerImpl::SetSystemLanguage(const std::string& language) { +} + +void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) { + LOG4CXX_INFO(logger_, "SetSystemInfo"); +} + +void PolicyManagerImpl::OnSystemReady() { + // Update policy table for the first time with system information + if (cache_->IsPTPreloaded()) { + listener()->OnSystemInfoUpdateRequired(); + return; + } +} + +uint32_t PolicyManagerImpl::GetNotificationsNumber( + const std::string& priority) { + LOG4CXX_INFO(logger_, "GetNotificationsNumber"); + return cache_->GetNotificationsNumber(priority); +} + +bool PolicyManagerImpl::ExceededIgnitionCycles() { + return 0 == cache_->IgnitionCyclesBeforeExchange(); +} + +bool PolicyManagerImpl::ExceededDays(int days) { + return 0 == cache_->DaysBeforeExchange(days); +} + +bool PolicyManagerImpl::ExceededKilometers(int kilometers) { + return 0 == cache_->KilometersBeforeExchange(kilometers); +} + +void PolicyManagerImpl::IncrementIgnitionCycles() { + cache_->IncrementIgnitionCycles(); +} + +PolicyTableStatus PolicyManagerImpl::GetPolicyTableStatus() { + return update_status_manager_->GetUpdateStatus(); +} + +int PolicyManagerImpl::NextRetryTimeout() { + sync_primitives::AutoLock auto_lock(retry_sequence_lock_); + LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_); + int next = 0; + if (!retry_sequence_seconds_.empty() + && retry_sequence_index_ < retry_sequence_seconds_.size()) { + next = retry_sequence_seconds_[retry_sequence_index_]; + ++retry_sequence_index_; + } + return next; +} + +void PolicyManagerImpl::RefreshRetrySequence() { + sync_primitives::AutoLock auto_lock(retry_sequence_lock_); + retry_sequence_timeout_ = cache_->TimeoutResponse(); + retry_sequence_seconds_.clear(); + cache_->SecondsBetweenRetries(retry_sequence_seconds_); +} + +void PolicyManagerImpl::ResetRetrySequence() { + sync_primitives::AutoLock auto_lock(retry_sequence_lock_); + retry_sequence_index_ = 0; + update_status_manager_->OnResetRetrySequence(); +} + +int PolicyManagerImpl::TimeoutExchange() { + return retry_sequence_timeout_; +} + +const std::vector<int> PolicyManagerImpl::RetrySequenceDelaysSeconds() { + sync_primitives::AutoLock auto_lock(retry_sequence_lock_); + return retry_sequence_seconds_; +} + +void PolicyManagerImpl::OnExceededTimeout() { + update_status_manager_->OnUpdateTimeoutOccurs(); +} + +void PolicyManagerImpl::OnUpdateStarted() { + int update_timeout = TimeoutExchange(); + LOG4CXX_INFO(logger_, "Update timeout will be set to: " << update_timeout); + update_status_manager_->OnUpdateSentOut(update_timeout); +} + +void PolicyManagerImpl::PTUpdatedAt(int kilometers, int days_after_epoch) { + LOG4CXX_INFO(logger_, "PTUpdatedAt"); + LOG4CXX_INFO(logger_, + "Kilometers: " << kilometers << " Days: " << days_after_epoch); + cache_->SetCountersPassedForSuccessfulUpdate( + kilometers, days_after_epoch); + cache_->ResetIgnitionCycles(); +} + +void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) { + LOG4CXX_INFO(logger_, "Increment without app id" ); + sync_primitives::AutoLock locker(statistics_lock_); +} + +void PolicyManagerImpl::Increment(const std::string& app_id, + usage_statistics::AppCounterId type){ + LOG4CXX_INFO(logger_, "Increment " << app_id); + sync_primitives::AutoLock locker(statistics_lock_); +} + +void PolicyManagerImpl::Set(const std::string& app_id, + usage_statistics::AppInfoId type, + const std::string& value) { + LOG4CXX_INFO(logger_, "Set " << app_id); + sync_primitives::AutoLock locker(statistics_lock_); +} + +void PolicyManagerImpl::Add(const std::string& app_id, + usage_statistics::AppStopwatchId type, + int32_t timespan_seconds) { + LOG4CXX_INFO(logger_, "Add " << app_id); + sync_primitives::AutoLock locker(statistics_lock_); +} + +bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const { + return const_cast<PolicyManagerImpl*>(this)->cache_->IsApplicationRevoked(app_id); +} + +int PolicyManagerImpl::IsConsentNeeded(const std::string& app_id) { + return 0; +} + +void PolicyManagerImpl::SetVINValue(const std::string& value) { +} + +AppPermissions PolicyManagerImpl::GetAppPermissionsChanges( + const std::string& device_id, + const std::string& policy_app_id) { + typedef std::map<std::string, AppPermissions>::iterator PermissionsIt; + PermissionsIt app_id_diff = app_permissions_diff_.find(policy_app_id); + AppPermissions permissions(policy_app_id); + if (app_permissions_diff_.end() != app_id_diff) { + // At this point we're able to know the device id for which user consents + // could be evaluated + std::vector<FunctionalGroupPermission> groups; + GetUserConsentForApp(device_id, policy_app_id, groups); + CopyPermissions copier(groups); + std::for_each(app_id_diff->second.appRevokedPermissions.begin(), + app_id_diff->second.appRevokedPermissions.end(), + copier); + permissions = app_id_diff->second; + } else { + permissions.appPermissionsConsentNeeded = IsConsentNeeded(policy_app_id); + permissions.appRevoked = IsApplicationRevoked(policy_app_id); + GetPriority(permissions.application_id, &permissions.priority); + } + return permissions; +} + +void PolicyManagerImpl::RemovePendingPermissionChanges( + const std::string& app_id) { + app_permissions_diff_.erase(app_id); +} + +bool PolicyManagerImpl::CanAppKeepContext(const std::string& app_id) { + return cache_->CanAppKeepContext(app_id); +} + +bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) { + return cache_->CanAppStealFocus(app_id); +} + +void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) { +} + +void PolicyManagerImpl::AddApplication(const std::string& application_id) { + LOG4CXX_INFO(logger_, "AddApplication"); + const std::string device_id = GetCurrentDeviceId(application_id); + DeviceConsent device_consent = GetUserConsentForDevice(device_id); + sync_primitives::AutoLock lock(apps_registration_lock_); + + if (IsNewApplication(application_id)) { + AddNewApplication(application_id, device_consent); + AddAppToUpdateList(application_id); + if (PolicyTableStatus::StatusUpToDate == GetPolicyTableStatus()) { + update_status_manager_->OnNewApplicationAdded(); + } + } else { + PromoteExistedApplication(application_id, device_consent); + } + SendNotificationOnPermissionsUpdated(application_id); +} + +bool PolicyManagerImpl::IsAppInUpdateList(const std::string& app_id) const { + return update_requests_list_.end() != + std::find(update_requests_list_.begin(), + update_requests_list_.end(), + app_id); +} + +void PolicyManagerImpl::RemoveAppConsentForGroup(const std::string& app_id, + const std::string& group_name) { + cache_->RemoveAppConsentForGroup(app_id, group_name); +} + +bool PolicyManagerImpl::IsPredataPolicy(const std::string &policy_app_id) { + LOG4CXX_INFO(logger_, "IsPredataApp"); + return cache_->IsPredataPolicy(policy_app_id); +} + +void PolicyManagerImpl::AddNewApplication(const std::string& application_id, + DeviceConsent device_consent) { + LOG4CXX_INFO(logger_, "PolicyManagerImpl::AddNewApplication"); + + LOG4CXX_INFO( + logger_, + "Setting default permissions for application id: " << application_id); + cache_->SetDefaultPolicy(application_id); +} + +void PolicyManagerImpl::PromoteExistedApplication( + const std::string& application_id, DeviceConsent device_consent) { + + if (kDeviceHasNoConsent != device_consent + && cache_->IsPredataPolicy(application_id)) { + // If device consent changed to allowed during application being + // disconnected, app permissions should be changed also + if (kDeviceAllowed == device_consent) { + cache_->SetDefaultPolicy(application_id); + } + } +} + +bool PolicyManagerImpl::IsNewApplication( + const std::string& application_id) const { + return false == cache_->IsApplicationRepresented(application_id); +} + +bool PolicyManagerImpl::ResetPT(const std::string& file_name) { + const bool result = cache_->ResetPT(file_name); + if (result) { + RefreshRetrySequence(); + } + return result; +} + +bool PolicyManagerImpl::InitPT(const std::string& file_name) { + const bool ret = cache_->Init(file_name); + if (ret) { + RefreshRetrySequence(); + update_status_manager_->OnPolicyInit(cache_->UpdateRequired()); + } + return ret; +} + +uint16_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const { + return cache_->HeartBeatTimeout(app_id); +} + +void PolicyManagerImpl::set_cache_manager( + CacheManagerInterface* cache_manager) { + cache_ = cache_manager; +} + +void PolicyManagerImpl::set_update_status_manager( + UpdateStatusManagerInterface* update_manager) { + update_status_manager_ = update_manager; +} + +} // namespace policy + diff --git a/src/components/policy/src/policy/src/policy_table.cc b/src/components/policy/src/policy/src/policy_table.cc new file mode 100644 index 0000000000..c0ac3c99ff --- /dev/null +++ b/src/components/policy/src/policy/src/policy_table.cc @@ -0,0 +1,59 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "policy/policy_table.h" + +// EXTENDED_POLICY +# include "policy/sql_pt_representation.h" + +#include "utils/logger.h" + +namespace policy { + +CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyTable") + +PolicyTable::PolicyTable() + : pt_data_( +// EXTENDED_POLICY + new SQLPTRepresentation() + ) { +} + +PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) + : pt_data_(pt_data) { +} + +PolicyTable::~PolicyTable() { + LOG4CXX_INFO(logger_, "Destroying policy table."); +} + +} // namespace policy diff --git a/src/components/policy/src/policy/src/sql_pt_ext_queries.cc b/src/components/policy/src/policy/src/sql_pt_ext_queries.cc new file mode 100644 index 0000000000..ae6666461b --- /dev/null +++ b/src/components/policy/src/policy/src/sql_pt_ext_queries.cc @@ -0,0 +1,235 @@ +/* + Copyright (c) 2013, " Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, " with or without + modification, " are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, " this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, " + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR + CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN + CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "policy/sql_pt_ext_queries.h" + +namespace policy { +namespace sql_pt_ext { + +const std::string kSelectKeepContext = + "SELECT `keep_context` FROM `application` WHERE `id` = ? LIMIT 1"; + +const std::string kSelectStealFocus = + "SELECT `steal_focus` FROM `application` WHERE `id` = ? LIMIT 1"; + +const std::string kSelectDefaultHmi = + "SELECT `default_hmi` FROM `application` WHERE `id` = ? LIMIT 1"; + +const std::string kResetDeviceConsents = "DELETE FROM `device_consent_group`"; + +const std::string kResetAppConsents = "DELETE FROM `consent_group`"; + +const std::string kCountDeviceConsentGroup = "SELECT COUNT (`device_id`) " + "FROM `device_consent_group` WHERE `device_id` = ?"; + +const std::string kCountDevice = "SELECT COUNT (`id`) " + "FROM `device` WHERE `id` = ?"; + +const std::string kSelectDeviceConsentedGroup = + "SELECT * FROM `device_consent_group` WHERE `device_id` = ?"; + +const std::string kUpdateDeviceConsentedGroup = + "UPDATE `device_consent_group` SET `is_consented` = ?, `input` = ? WHERE " + "(`device_id` = ? AND `functional_group_id` = ?)"; + +const std::string kUpdateDevice = + "UPDATE `device` SET `hardware` = ?, `firmware_rev` = ?, `os` = ?, " + "`os_version` = ?, `carrier` = ?, `max_number_rfcom_ports` = ?, " + " `connection_type` = ? WHERE `id` = ? "; + +const std::string kInsertDeviceConsentedGroup = + "INSERT OR IGNORE INTO `device_consent_group` " + "(`device_id`, `functional_group_id`, `is_consented`, `input`) " + "VALUES (?,?,?,?)"; + +const std::string kInsertDevice = + "INSERT OR IGNORE INTO `device` " + "(`id`, `hardware`, `firmware_rev`, `os`, `os_version`, `carrier`," + "`max_number_rfcom_ports`, `connection_type`) " + "VALUES (?,?,?,?,?,?,?,?)"; + +const std::string kSelectDeviceData = "SELECT * FROM `device`"; + +const std::string kSelectConsentGroup = + "SELECT * FROM `consent_group` WHERE `device_id` = ? "; + +const std::string kInsertPreconsentedGroups = + "INSERT INTO `preconsented_group` (`application_id`, `functional_group_id`)" + " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1"; + +const std::string kSelectPreconsentedGroups = + "SELECT `f`.`name` FROM `preconsented_group` AS `p`" + " LEFT JOIN `functional_group` AS `f` " + " ON (`f`.`id` = `p`.`functional_group_id`)" + " WHERE `p`.`application_id` = ?"; + +const std::string kDeletePreconsentedGroups = "DELETE FROM `preconsented_group`"; + +const std::string kSelectUsageAndErrorCount = + "SELECT `count_of_iap_buffer_full`, `count_sync_out_of_memory`, " + " `count_of_sync_reboots` " + "FROM `usage_and_error_count` LIMIT 1"; + +const std::string kSelectAppLevels = + "SELECT `application_id`, `minutes_in_hmi_full`, `minutes_in_hmi_limited`, " + " `minutes_in_hmi_background`, `minutes_in_hmi_none`, " + " `count_of_user_selections`, " + " `count_of_rejections_sync_out_of_memory`, " + " `count_of_rejections_nickname_mismatch`, " + " `count_of_rejections_duplicate_name`, " + " `count_of_rejected_rpcs_calls`, " + " `count_of_rpcs_sent_in_hmi_none`, " + " `count_of_removals_for_bad_behavior`, " + " `count_of_run_attempts_while_revoked`, " + " `app_registration_language_gui`, " + " `app_registration_language_vui` " + "FROM `app_level`"; +const std::string kInsertDeviceData = + "INSERT OR IGNORE INTO `device` " + "(`id`, `hardware`, `firmware_rev`, `os`, `os_version`, `carrier`, " + "`max_number_rfcom_ports`,`connection_type`) VALUES (?,?,?,?,?,?,?,?) "; + +const std::string kInsertConsentGroups = + "INSERT OR IGNORE INTO `consent_group` " + "(`device_id`, `application_id`, `functional_group_id`, `is_consented`, `input`) " + "VALUES (?,?,?,?,?)"; + +const std::string kDeleteAppGroupConsent = "DELETE FROM `consent_group` WHERE " + "`application_id` = ? AND `functional_group_id` = ? "; + + const std::string kSelectGroupId = + "SELECT `id` FROM `functional_group` WHERE `name` = ? "; + +const std::string kCountUnconsentedGroups = + "SELECT COUNT(`a`.`functional_group_id`) FROM `app_group` AS `a` " + " WHERE `a`.`application_id` = ? AND NOT EXISTS " + " (SELECT NULL FROM `preconsented_group` AS `p` WHERE " + " (`p`.`functional_group_id` = `a`.`functional_group_id` AND " + " `p`.`application_id` = `a`.`application_id`)) " + " AND NOT EXISTS (SELECT NULL FROM `consent_group` AS `c` " + " WHERE (`c`.`application_id` = `a`.`application_id` " + " AND `c`.`functional_group_id` = `a`.`functional_group_id` " + " AND `c`.`device_id` = ?)) AND NOT EXISTS " + " (SELECT NULL FROM `app_group` AS `def` WHERE " + " (`def`.`application_id` = ? OR " + " `def`.`application_id` = ?) " + " AND `def`.`functional_group_id` = `a`.`functional_group_id`)" + " AND NOT EXISTS (SELECT NULL FROM `functional_group` AS `f` " + " WHERE (`a`.`functional_group_id` = `f`.`id`" + " AND`f`.`user_consent_prompt` IS NULL))"; + +const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`"; + +const std::string kUpdateMetaParams = "UPDATE `module_meta` SET " + "`ccpu_version` = ?, `wers_country_code` = ?, `language` = ? "; + +const std::string kUpdateModuleMetaVinParam = + "UPDATE `module_meta` SET `vin` = ? "; + +const std::string kSelectMetaParams = "SELECT `ccpu_version`, " + "`wers_country_code`, `language` from `module_meta`"; + +const std::string kUpdateMetaLanguage = "UPDATE `module_meta` SET `language` = ? "; + +const std::string kCountAppLevel = + "SELECT COUNT(`application_id`) FROM `app_level`" + " WHERE `application_id` = ? "; + +const std::string kUpdateGroupPermissions = + "UPDATE `consent_group` " + "SET `is_consented` = ?, `input` = ? " + "WHERE(`application_id` = ? AND `functional_group_id` = ? AND `device_id` = ?) "; + +const std::string kInsertApplication = + "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, `steal_focus`, " + " `default_hmi`, `priority_value`, `is_revoked`, `memory_kb`, " + " `heart_beat_timeout_ms`, `certificate`) VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?) "; + +const std::string kCollectFriendlyMsg = "SELECT * FROM `message`"; + +const std::string kSelectFriendlyMsg = + "SELECT `tts`, `label`, `line1`, `line2`, `textBody` FROM `message` " + "WHERE `message_type_name` = ? AND `language_code` = ? LIMIT 1"; + +const std::string kSelectAppGroupsId = "SELECT `functional_group_id` " + "FROM `app_group` WHERE `application_id` = ? "; + +const std::string kSelectConsentedGroupsId = + "SELECT `functional_group_id`, `is_consented` " + "FROM `consent_group` WHERE(`application_id` = ? AND `device_id` = ?) "; + +const std::string kCountAppConsents = "SELECT COUNT(*) from `consent_group`" + "WHERE(`device_id` = ? AND `application_id` = ? AND " + "`functional_group_id` = ?) "; + +const std::string kSelectPreconsentedGroupsId = "SELECT `functional_group_id` " + "FROM `preconsented_group` WHERE `application_id` = ? "; + +const std::string kSelectAppPolicies = + "SELECT `id`, `priority_value`, `default_hmi`, `keep_context`, `steal_focus`, " + " `memory_kb`, `heart_beat_timeout_ms`, `certificate` FROM `application`"; + +const std::string kSelectFunctionalGroupNames = "SELECT `id`, `user_consent_prompt`, `name`" + " FROM `functional_group`"; + +const std::string kDeleteDeviceConsent = "DELETE FROM `device_consent_group` " + "WHERE `device_id` = ? "; + +const std::string kDeleteAppConsent = "DELETE FROM `consent_group` " + "WHERE `device_id` = ? "; + +const std::string kSelectApplicationIsPreData = + "SELECT `is_predata` FROM `application` WHERE `id` = ? "; + +const std::string kUpdateIsPredata = + "UPDATE `application` SET `is_predata` = ? WHERE `id` = ? "; + +const std::string kHasAppPreloadedGroups = + "SELECT COUNT(`a1`.`functional_group_id`) FROM `app_group` " + " AS `a1` JOIN `app_group` AS `a2` " + " ON `a1`.`functional_group_id` = `a2`.`functional_group_id` " + " WHERE `a1`.`application_id` = ? AND `a2`.`application_id` = ? "; + +const std::string kUpdateUnpairedDevice = + "UPDATE `device` SET `unpaired` = ? WHERE `id` = ? "; + +const std::string kSelectUnpairedDevices = + "SELECT `id` FROM `device` WHERE `unpaired` = 1"; + +const std::string kHasMsgLanguageCode = "SELECT COUNT (`id`) FROM message " + "WHERE `message_type_name` = ? AND `language_code` = ? "; + +const std::string kDeletePreconsentedGroupsByApplicationId = + "DELETE FROM `preconsented_group` WHERE `application_id` = ?"; + +} // namespace sql_pt_ext +} // namespace policy diff --git a/src/components/policy/src/policy/src/sql_pt_ext_representation.cc b/src/components/policy/src/policy/src/sql_pt_ext_representation.cc new file mode 100644 index 0000000000..b6d4d84c09 --- /dev/null +++ b/src/components/policy/src/policy/src/sql_pt_ext_representation.cc @@ -0,0 +1,1627 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +#include <algorithm> +#include <utility> +#include "utils/logger.h" +#include "policy/sql_pt_ext_representation.h" +#include "policy/sql_wrapper.h" +#include "policy/sql_pt_queries.h" +#include "policy/sql_pt_ext_queries.h" +#include "policy/policy_helper.h" +#include "policy/cache_manager.h" + +namespace policy { + +CREATE_LOGGERPTR_GLOBAL(logger_, "SQLPTRepresentation") + +bool SQLPTExtRepresentation::CanAppKeepContext(const std::string& app_id) { + dbms::SQLQuery query(db()); + if (query.Prepare(sql_pt_ext::kSelectKeepContext)) { + query.Bind(0, app_id); + if (query.Exec()) { + return query.GetBoolean(0); + } + } + return false; +} + +bool SQLPTExtRepresentation::CanAppStealFocus(const std::string& app_id) { + dbms::SQLQuery query(db()); + if (query.Prepare(sql_pt_ext::kSelectStealFocus)) { + query.Bind(0, app_id); + if (query.Exec()) { + return query.GetBoolean(0); + } + } + return false; +} + +bool SQLPTExtRepresentation::ResetUserConsent() { + return ResetDeviceConsents() && ResetAppConsents(); +} + +bool SQLPTExtRepresentation::ResetDeviceConsents() { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) { + LOG4CXX_WARN(logger_, "Incorrect delete statement from device_consents."); + return false; + } + return query.Exec(); +} + +bool SQLPTExtRepresentation::ResetAppConsents() { + return dbms::SQLQuery(db()).Exec(sql_pt_ext::kResetAppConsents); +} + +bool SQLPTExtRepresentation::GetUserPermissionsForDevice( + const std::string& device_id, StringArray* consented_groups, + StringArray* disallowed_groups) { + LOG4CXX_INFO(logger_, "GetUserPermissionsForDevice"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { + LOG4CXX_WARN(logger_, "Incorrect select from device consented groups"); + return false; + } + query.Bind(0, device_id); + while (query.Next()) { + if (query.GetBoolean(2)) { + if (!consented_groups) { + continue; + } + consented_groups->push_back(query.GetString(1)); + } else { + if (!disallowed_groups) { + continue; + } + disallowed_groups->push_back(query.GetString(1)); + } + } + + return true; +} + +bool SQLPTExtRepresentation::GetPermissionsForApp( + const std::string& device_id, const std::string& policy_app_id, + FunctionalIdType* group_types) { + LOG4CXX_INFO(logger_, "GetPermissionsForApp"); + if (!group_types) { + LOG4CXX_WARN(logger_, "Input parameter for group types is null."); + return false; + } + // Get all app groups for specified device and application + FunctionalGroupIDs all_groups; + if (!GetAllAppGroups(policy_app_id, all_groups)) { + return false; + } + // Get preconsented group + FunctionalGroupIDs preconsented_groups; + if (!GetPreconsentedGroups(policy_app_id, preconsented_groups)) { + return false; + } + // Get consented (allowed/disallowed) groups + FunctionalGroupIDs allowed_groups; + FunctionalGroupIDs disallowed_groups; + if (!GetConsentedGroups(policy_app_id, device_id, + allowed_groups, disallowed_groups)) { + return false; + } + // Get all default groups + FunctionalGroupIDs default_groups; + if (!GetAllAppGroups(kDefaultId, default_groups)) { + return false; + } + + // Get all pre_DataConsent groups + FunctionalGroupIDs predataconsented_groups; + if (!GetAllAppGroups(kPreDataConsentId, predataconsented_groups)) { + return false; + } + + // Get all device groups + FunctionalGroupIDs device_groups; + if (!GetAllAppGroups(kDeviceId, device_groups)) { + return false; + } + + (*group_types)[kTypeDefault] = default_groups; + (*group_types)[kTypeAllowed] = allowed_groups; + (*group_types)[kTypeDisallowed] = disallowed_groups; + (*group_types)[kTypePreconsented] = preconsented_groups; + (*group_types)[kTypeGeneral] = all_groups; + (*group_types)[kTypePreDataConsented] = predataconsented_groups; + (*group_types)[kTypeDevice] = device_groups; + + return true; +} + +bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies( + policy_table::Strings* groups, policy_table::Strings* preconsented_groups) { + LOG4CXX_INFO(logger_, "GetDeviceGroupsFromPolicies"); + if (groups) { + GatherAppGroup(kDeviceId, groups); + } + if (preconsented_groups) { + GatherPreconsentedGroup(kDeviceId, preconsented_groups); + } + return true; +} + +bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id, + const std::string& hardware, + const std::string& firmware, + const std::string& os, + const std::string& os_version, + const std::string& carrier, + const uint32_t number_of_ports, + const std::string& connection_type) { + LOG4CXX_INFO(logger_, "SetDeviceData"); + dbms::SQLQuery count_query(db()); + if (!count_query.Prepare(sql_pt_ext::kCountDevice)) { + LOG4CXX_WARN(logger_, "Incorrect statement for count of device."); + return false; + } + + count_query.Bind(0, device_id); + + if (!count_query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect count of device."); + return false; + } + + bool update = count_query.GetInteger(0); + + // Update old value + if (update) { + dbms::SQLQuery update_query(db()); + if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) { + LOG4CXX_WARN(logger_, "Incorrect statement for udpate device."); + return false; + } + + update_query.Bind(0, hardware); + update_query.Bind(1, firmware); + update_query.Bind(2, os); + update_query.Bind(3, os_version); + update_query.Bind(4, carrier); + update_query.Bind(5, static_cast<int>(number_of_ports)); + update_query.Bind(6, device_id); + update_query.Bind(7, connection_type); + + if (!update_query.Exec() || !update_query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect update for device."); + return false; + } + + return true; + } + + // Insert new data + dbms::SQLQuery insert_query(db()); + if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for device."); + return false; + } + + insert_query.Bind(0, device_id); + insert_query.Bind(1, hardware); + insert_query.Bind(2, firmware); + insert_query.Bind(3, os); + insert_query.Bind(4, os_version); + insert_query.Bind(5, carrier); + insert_query.Bind(6, static_cast<int>(number_of_ports)); + insert_query.Bind(7, connection_type); + + if (!insert_query.Exec() || !insert_query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert to device."); + return false; + } + + SetPreloaded(false); + + return true; +} + +bool SQLPTExtRepresentation::SetUserPermissionsForDevice( + const std::string& device_id, const StringArray& consented_groups, + const StringArray& disallowed_groups) { + LOG4CXX_TRACE(logger_, "SetUserPermissionsForDevice"); + dbms::SQLQuery count_query(db()); + if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) { + LOG4CXX_WARN(logger_, "Incorrect count of device consented groups"); + return false; + } + + count_query.Bind(0, device_id); + + if (!count_query.Exec()) { + LOG4CXX_WARN(logger_, "Failed count of device consented groups"); + return false; + } + + bool update = count_query.GetInteger(0); + + // TODO(AOleynik): Split to several methods? + dbms::SQLQuery query(db()); + // Update old values + if (update) { + if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) { + LOG4CXX_WARN(logger_, "Incorrect statement for updating consented groups on device"); + return false; + } + + StringArray::const_iterator it_consented_groups = consented_groups.begin(); + StringArray::const_iterator it_consented_groups_end = + consented_groups.end(); + for (; it_consented_groups != it_consented_groups_end; + ++it_consented_groups) { + query.Bind(0, true); + query.Bind(1, std::string("GUI")); + query.Bind(2, device_id); + query.Bind(3, *it_consented_groups); + // TODO(AOleynik): Get this info from external data + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Failed update of device allowed consented groups."); + return false; + } + } + + StringArray::const_iterator it_disallowed_groups = + disallowed_groups.begin(); + StringArray::const_iterator it_disallowed_groups_end = + disallowed_groups.end(); + for (; it_disallowed_groups != it_disallowed_groups_end; + ++it_disallowed_groups) { + query.Bind(0, false); + query.Bind(1); + query.Bind(2, device_id); + query.Bind(3, *it_disallowed_groups); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Failed update of device disallowed consented groups."); + return false; + } + } + + return true; + } + + // Insert new values + if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { + LOG4CXX_WARN(logger_, "Incorrect statement of inserting to device consented groups"); + return false; + } + + StringArray::const_iterator it_consented_groups = consented_groups.begin(); + StringArray::const_iterator it_consented_groups_end = consented_groups.end(); + for (; it_consented_groups != it_consented_groups_end; + ++it_consented_groups) { + query.Bind(0, device_id); + query.Bind(1, *it_consented_groups); + query.Bind(2, true); + // TODO(AOleynik): Get this info from external data + query.Bind(3, std::string("GUI")); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Failed insert to device allowed consented groups."); + return false; + } + } + + StringArray::const_iterator it_disallowed_groups = disallowed_groups.begin(); + StringArray::const_iterator it_disallowed_groups_end = + disallowed_groups.end(); + for (; it_disallowed_groups != it_disallowed_groups_end; + ++it_disallowed_groups) { + query.Bind(0, device_id); + query.Bind(1, *it_disallowed_groups); + query.Bind(2, false); + query.Bind(3); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Failed insert to device disallowed consented groups."); + return false; + } + } + + return true; +} + +bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp( + const std::string& app_id, + bool is_device_allowed) { + bool result = true; + if (is_device_allowed) { + // If app has pre_DataConsented groups it should be 'promoted' to default + // If app has only pre_DataConsented flag it should be only set to false and + // all groups get restored automatically + if (IsPredataPolicy(app_id)) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) { + LOG4CXX_WARN(logger_, "Incorrect statement for has app preloaded groups"); + return false; + } + query.Bind(0, app_id); + query.Bind(1, kPreDataConsentId); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect select for app has predataconsted groups"); + return false; + } + if (query.GetInteger(0) > 0) { + result = result && SetDefaultPolicy(app_id); + } else { + result = result && SetIsPredata(app_id, false); + } + } + } else { + // If app has default groups change them to pre_DataConsented + // If app has 'normal' groups leave them as is and set + // pre_DataConsented flag to true. + if (IsDefaultPolicy(app_id)) { + result = result && SetPredataPolicy(app_id); + } else { + result = result && SetIsPredata(app_id, true); + } + } + return result; +} + +bool SQLPTExtRepresentation::SetUserPermissionsForApp( + const PermissionConsent& permissions) { + LOG4CXX_INFO(logger_, "SetUserPermissionsForApp"); + // TODO(AOleynik): Handle situation, when no application was specified, i.e. + // general permissions were set + std::vector<FunctionalGroupPermission>::const_iterator it = permissions + .group_permissions.begin(); + std::vector<FunctionalGroupPermission>::const_iterator it_end = permissions + .group_permissions.end(); + + dbms::SQLQuery query(db()); + for (; it != it_end; ++it) { + dbms::SQLQuery counter(db()); + if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) { + LOG4CXX_WARN(logger_, "Incorrect statement for consent group count."); + return false; + } + + counter.Bind(0, permissions.device_id); + counter.Bind(1, permissions.policy_app_id); + counter.Bind(2, static_cast<int>((*it).group_id)); + if (!counter.Exec()) { + LOG4CXX_WARN(logger_, "Incorrent count on consent groups."); + return false; + } + + bool update_required = counter.GetInteger(0); + + // Update already present consent record + if (update_required) { + if (!query.Prepare(sql_pt_ext::kUpdateGroupPermissions)) { + LOG4CXX_WARN(logger_, "Incorrect statement for update consent groups."); + return false; + } + + // Skip consent saving, if user didn't choose any state + if (policy::kGroupUndefined == (*it).state) { + continue; + } + query.Bind(0, (*it).state == kGroupAllowed ? 1 : 0); + query.Bind(1, permissions.consent_source); + query.Bind(2, permissions.policy_app_id); + query.Bind(3, static_cast<int>((*it).group_id)); + query.Bind(4, permissions.device_id); + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect update on user defined permissions " + "for app groups."); + return false; + } + continue; + } + + // Insert new consent record + if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { + LOG4CXX_WARN(logger_, + "Incorrect statement for update app group permissions."); + return false; + } + + // Skip consent saving, if user didn't choose any state + if (policy::kGroupUndefined == (*it).state) { + continue; + } + query.Bind(0, permissions.device_id); + query.Bind(1, permissions.policy_app_id); + query.Bind(2, static_cast<int>((*it).group_id)); + query.Bind(3, (*it).state == kGroupAllowed ? 1 : 0); + query.Bind(4, permissions.consent_source); + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert to user defined permissions " + "for app groups."); + return false; + } + continue; + } + return true; +} + +std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, const std::string& language) { + dbms::SQLQuery query(db()); + std::vector<UserFriendlyMessage> result; + if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) { + LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + return result; + } + + const std::string fallback_language = "en-us"; + std::vector<std::string>::const_iterator it = msg_codes.begin(); + std::vector<std::string>::const_iterator it_end = msg_codes.end(); + for (; it != it_end; ++it) { + std::string msg_language = language; + // If message has no records with required language, fallback language + // should be used instead. + if (!IsMsgLanguagePresent((*it), language)) { + msg_language = fallback_language; + } + query.Bind(0, *it); + query.Bind(1, msg_language); + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect select from friendly messages."); + return result; + } + + UserFriendlyMessage msg; + + msg.message_code = *it; + msg.tts = query.GetString(0); + msg.label = query.GetString(1); + msg.line1 = query.GetString(2); + msg.line2 = query.GetString(3); + msg.text_body = query.GetString(4); + + result.push_back(msg); + + if (!query.Reset()) { + LOG4CXX_WARN(logger_, "Failed reset statement for selecting friendly " + "messages."); + return result; + } + } + + return result; +} + +bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages( + policy_table::ConsumerFriendlyMessages* messages) const { + if (NULL == messages) { + LOG4CXX_ERROR(logger_, "NULL pointer has been passed to fill"); + return false; + } + + if (!SQLPTRepresentation::GatherConsumerFriendlyMessages(messages)) { + return false; + } + + dbms::SQLQuery query(db()); + bool result = query.Prepare(sql_pt_ext::kCollectFriendlyMsg); + + if (result) { + while (query.Next()) { + + UserFriendlyMessage msg; + + msg.tts = query.GetString(1); + msg.label = query.GetString(2); + msg.line1 = query.GetString(3); + msg.line2 = query.GetString(4); + msg.text_body = query.GetString(5); + msg.message_code = query.GetString(7); + + std::string language = query.GetString(6); + + *(*messages->messages)[msg.message_code].languages[language].tts = msg.tts; + *(*messages->messages)[msg.message_code].languages[language].label = msg.label; + *(*messages->messages)[msg.message_code].languages[language].line1 = msg.line1; + *(*messages->messages)[msg.message_code].languages[language].line2 = msg.line2; + *(*messages->messages)[msg.message_code].languages[language].textBody = msg.text_body; + } + } else { + LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages."); + } + return result; +} + +bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version, + const std::string& wers_country_code, + const std::string& language) { + LOG4CXX_TRACE_ENTER(logger_); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) { + LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta."); + return false; + } + + query.Bind(0, ccpu_version); + query.Bind(1, wers_country_code); + query.Bind(2, language); + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert to module meta."); + return false; + } + LOG4CXX_TRACE_EXIT(logger_); + return true; +} + +bool SQLPTExtRepresentation::IsMetaInfoPresent() { + LOG4CXX_INFO(logger_, "IsMetaInfoPresent"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) { + LOG4CXX_WARN(logger_, "Incorrect statement for selecting meta info."); + return false; + } + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect select from module meta."); + return false; + } + + return !query.IsNull(0) && !query.IsNull(1) && !query.IsNull(2); +} + +bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) { + LOG4CXX_INFO(logger_, "SetSystemLanguage"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) { + LOG4CXX_WARN(logger_, "Incorrect statement for update meta language."); + return false; + } + + query.Bind(0, language); + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect update for meta language."); + return false; + } + + return true; +} + +bool SQLPTExtRepresentation::SaveApplicationPolicies( + const policy_table::ApplicationPolicies& apps) { + LOG4CXX_INFO(logger_, "SaveApplicationPolicies ext"); + dbms::SQLQuery query_delete(db()); + if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { + LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + return false; + } + + dbms::SQLQuery query_delete_preconsented(db()); + if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) { + LOG4CXX_WARN(logger_, "Incorrect delete from preconsented_group."); + return false; + } + + if (!query_delete.Exec(sql_pt::kDeleteApplication)) { + LOG4CXX_WARN(logger_, "Incorrect delete from application."); + return false; + } + + // First, all predefined apps (e.g. default, pre_DataConsent) should be saved, + // otherwise another app with the predefined permissions can get incorrect + // permissions + policy_table::ApplicationPolicies::const_iterator it_default = + apps.find(kDefaultId); + if (apps.end() != it_default) { + if (!SaveSpecificAppPolicy(*it_default)) { + return false; + } + } + policy_table::ApplicationPolicies::const_iterator it_pre_data_consent = + apps.find(kPreDataConsentId); + if (apps.end() != it_pre_data_consent) { + if (!SaveSpecificAppPolicy(*it_pre_data_consent)) { + return false; + } + } + policy_table::ApplicationPolicies::const_iterator it_device = + apps.find(kDeviceId); + if (apps.end() != it_device) { + if (!SaveSpecificAppPolicy(*it_device)) { + return false; + } + } + + policy_table::ApplicationPolicies::const_iterator it; + for (it = apps.begin(); it != apps.end(); ++it) { + // Skip saving of predefined app, since they should be saved before + if (IsPredefinedApp(*it)) { + continue; + } + if (!SaveSpecificAppPolicy(*it)) { + return false; + } + } + + return true; +} + +bool SQLPTExtRepresentation::SaveSpecificAppPolicy( + const policy_table::ApplicationPolicies::value_type& app) { + if (app.second.is_string()) { + if (kDefaultId.compare(app.second.get_string()) == 0) { + if (!SetDefaultPolicy(app.first)) { + return false; + } + } else if (kPreDataConsentId.compare(app.second.get_string()) == 0) { + if (!SetPredataPolicy(app.first)) { + return false; + } + } + + // Stop saving other params, since predefined permissions already set + return true; + } + + dbms::SQLQuery app_query(db()); + if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + return false; + } + + app_query.Bind(0, app.first); + app_query.Bind(1, app.second.keep_context); + app_query.Bind(2, app.second.steal_focus); + app_query.Bind( + 3, std::string(policy_table::EnumToJsonString(app.second.default_hmi))); + app_query.Bind( + 4, std::string(policy_table::EnumToJsonString(app.second.priority))); + app_query.Bind( + 5, app.second.is_null()); + app_query.Bind(6, *app.second.memory_kb); + app_query.Bind(7, *app.second.heart_beat_timeout_ms); + app.second.certificate.is_initialized() ? + app_query.Bind(8, *app.second.certificate) : app_query.Bind(8, std::string()); + + if (!app_query.Exec() || !app_query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into application."); + return false; + } + + if (!SaveAppGroup(app.first, app.second.groups)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!SaveNickname(app.first, *app.second.nicknames)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!SaveAppType(app.first, *app.second.AppHMIType)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!SavePreconsentedGroup(app.first, *app.second.preconsented_groups)) { + return false; + } + + return true; +} + +bool SQLPTExtRepresentation::GatherApplicationPolicies( + policy_table::ApplicationPolicies* apps) const { + LOG4CXX_INFO(logger_, "Gather applications policies"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) { + LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + return false; + } + + while (query.Next()) { + rpc::Nullable<policy_table::ApplicationParams> params; + const std::string& app_id = query.GetString(0); + if (IsApplicationRevoked(app_id)) { + params.set_to_null(); + (*apps)[app_id] = params; + continue; + } + if (IsDefaultPolicy(app_id)) { + (*apps)[app_id].set_to_string(kDefaultId); + } + if (IsPredataPolicy(app_id)) { + (*apps)[app_id].set_to_string(kPreDataConsentId); + } + policy_table::Priority priority; + policy_table::EnumFromJsonString(query.GetString(1), &priority); + params.priority = priority; + policy_table::HmiLevel hmi; + policy_table::EnumFromJsonString(query.GetString(2), &hmi); + params.default_hmi = hmi; + params.keep_context = query.GetBoolean(3); + params.steal_focus = query.GetBoolean(4); + *params.memory_kb = query.GetInteger(5); + *params.heart_beat_timeout_ms = query.GetInteger(6); + if (!query.IsNull(7)) { + *params.certificate = query.GetString(7); + } + if (!GatherAppGroup(app_id, ¶ms.groups)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!GatherNickName(app_id, &*params.nicknames)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!GatherAppType(app_id, &*params.AppHMIType)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + GatherPreconsentedGroup(app_id, &*params.preconsented_groups); + (*apps)[app_id] = params; + } + return true; +} + +void SQLPTExtRepresentation::GatherPreconsentedGroup( + const std::string& app_id, policy_table::Strings* groups) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) { + LOG4CXX_WARN(logger_, "Incorrect select from preconsented group"); + return; + } + + query.Bind(0, app_id); + while (query.Next()) { + groups->push_back(query.GetString(0)); + } +} + +bool SQLPTExtRepresentation::GatherUsageAndErrorCounts( + policy_table::UsageAndErrorCounts* counts) const { + LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) { + LOG4CXX_INFO(logger_, "Failed select from user_and_error_count"); + return false; + } + + *counts->count_of_iap_buffer_full = query.GetInteger(0); + *counts->count_sync_out_of_memory = query.GetInteger(1); + *counts->count_of_sync_reboots = query.GetInteger(2); + + return GatherAppLevels(&*counts->app_level); +} + +bool SQLPTExtRepresentation::GatherAppLevels( + policy_table::AppLevels* apps) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) { + LOG4CXX_INFO(logger_, "Failed select from app_level. SQLError = " + << query.LastError().text()); + return false; + } + while (query.Next()) { + policy_table::AppLevel level; + // value of time fields database is seconds + level.minutes_in_hmi_full = query.GetInteger(1); + level.minutes_in_hmi_limited = query.GetInteger(2); + level.minutes_in_hmi_background = query.GetInteger(3); + level.minutes_in_hmi_none = query.GetInteger(4); + level.count_of_user_selections = query.GetInteger(5); + level.count_of_rejections_sync_out_of_memory = query.GetInteger(6); + level.count_of_rejections_nickname_mismatch = query.GetInteger(7); + level.count_of_rejections_duplicate_name = query.GetInteger(8); + level.count_of_rejected_rpc_calls = query.GetInteger(9); + level.count_of_rpcs_sent_in_hmi_none = query.GetInteger(10); + level.count_of_removals_for_bad_behavior = query.GetInteger(11); + level.count_of_run_attempts_while_revoked = query.GetInteger(12); + level.app_registration_language_gui = query.GetString(13); + level.app_registration_language_vui = query.GetString(14); + (*apps)[query.GetString(0)] = level; + } + + return true; +} + +void SQLPTExtRepresentation::GatherDeviceData( + policy_table::DeviceData* data) const { + LOG4CXX_INFO(logger_, "Gather device data."); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) { + LOG4CXX_WARN(logger_, "Incorrect select statement for device data."); + return; + } + data->mark_initialized(); + while (query.Next()) { + policy_table::DeviceParams* specific_device = &(*data)[query.GetString(0)]; + *specific_device->hardware = query.GetString(1); + *specific_device->firmware_rev = query.GetString(2); + *specific_device->os = query.GetString(3); + *specific_device->os_version = query.GetString(4); + *specific_device->carrier = query.GetString(5); + *specific_device->max_number_rfcom_ports = query.GetInteger(6); + + // TODO(IKozyrenko): Check logic if optional container is missing + GatherConsentGroup(query.GetString(0), + &(*specific_device->user_consent_records)); + } +} + +void SQLPTExtRepresentation::GatherConsentGroup( + const std::string& device_id, + policy_table::UserConsentRecords* records) const { + LOG4CXX_INFO(logger_, "Gather consent records."); + dbms::SQLQuery query(db()); + // Fill data for device + if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) { + LOG4CXX_WARN(logger_, + "Incorrect select statement for device consented groups."); + return; + } + + query.Bind(0, device_id); + + // Fill device_data -> user_consent_records -> "device" + while (query.Next()) { + policy_table::ConsentRecords* device_consent_records = &(*records)[kDeviceId]; + // TODO(IKozyrenko): Check logic if optional container is missing + policy_table::ConsentGroups& consent_groups = *device_consent_records->consent_groups; + consent_groups[query.GetString(1)] = query.GetBoolean(2); + policy_table::Input input; + policy_table::EnumFromJsonString(query.GetString(3), &input); + *device_consent_records->input = input; + *device_consent_records->time_stamp = query.GetString(4); + } + + if (!query.Reset()) { + return; + } + + // Fill data for applications + if (!query.Prepare(sql_pt_ext::kSelectConsentGroup)) { + LOG4CXX_WARN(logger_, + "Incorrect select statement for app consented groups."); + return; + } + + query.Bind(0, device_id); + + // Fill device_data -> user_consent_records -> <app_id> + while (query.Next()) { + policy_table::ConsentRecords* app_consent_records = &(*records)[query + .GetString(1)]; + // TODO(IKozyrenko): Check logic if optional container is missing + policy_table::ConsentGroups& consent_groups = *app_consent_records->consent_groups; + + consent_groups[query.GetString(2)] = query.GetBoolean(3); + policy_table::Input input; + policy_table::EnumFromJsonString(query.GetString(4), &input); + *app_consent_records->input = input; + *app_consent_records->time_stamp = query.GetString(5); + } +} + +bool SQLPTExtRepresentation::SaveDeviceData( + const policy_table::DeviceData& devices) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + return false; + } + + policy_table::DeviceData::const_iterator it = devices.begin(); + policy_table::DeviceData::const_iterator it_end = devices.end(); + for (; it != it_end; ++it) { + query.Bind(0, it->first); + query.Bind(1, *(it->second.hardware)); + query.Bind(2, *(it->second.firmware_rev)); + query.Bind(3, *(it->second.os)); + query.Bind(4, *(it->second.os_version)); + query.Bind(5, *(it->second.carrier)); + query.Bind(6, *(it->second.max_number_rfcom_ports)); + query.Bind(7, *(it->second.connection_type)); + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + return false; + } + + // TODO(IKozyrenko): Check logic if optional container is missing + if (!SaveConsentGroup(it->first, *it->second.user_consent_records)) { + return false; + } + } + + return true; +} + +bool SQLPTExtRepresentation::SaveConsentGroup( + const std::string& device_id, + const policy_table::UserConsentRecords& records) { + LOG4CXX_INFO(logger_, "SaveConsentGroup"); + dbms::SQLQuery query(db()); + + policy_table::UserConsentRecords::const_iterator it = records.begin(); + policy_table::UserConsentRecords::const_iterator it_end = records.end(); + for (; it != it_end; ++it) { + // TODO(IKozyrenko): Check logic if optional container is missing + policy_table::ConsentGroups::const_iterator it_groups = it->second + .consent_groups->begin(); + policy_table::ConsentGroups::const_iterator it_groups_end = it->second + .consent_groups->end(); + for (; it_groups != it_groups_end; ++it_groups) { + if (kDeviceId == it->first) { + if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) { + LOG4CXX_WARN(logger_, + "Incorrect insert statement for device consent group."); + return false; + } + query.Bind(0, device_id); + query.Bind(1, it_groups->first); + query.Bind(2, it_groups->second); + query.Bind( + 3, + std::string(policy_table::EnumToJsonString(*(it->second.input)))); + } else { + if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) { + LOG4CXX_WARN(logger_, + "Incorrect insert statement for consent group."); + return false; + } + query.Bind(0, device_id); + query.Bind(1, it->first); + query.Bind(2, it_groups->first); + query.Bind(3, it_groups->second); + query.Bind( + 4, + std::string(policy_table::EnumToJsonString(*(it->second.input)))); + } + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into consent group."); + return false; + } + } + } + + return true; +} + +bool SQLPTExtRepresentation::SavePreconsentedGroup( + const std::string& app_id, const policy_table::Strings& groups) { + LOG4CXX_INFO(logger_, "SavePreconsentedGroup"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) { + LOG4CXX_WARN(logger_, + "Incorrect insert statement for preconsented groups"); + return false; + } + + policy_table::Strings::const_iterator it; + for (it = groups.begin(); it != groups.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, *it); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into preconsented groups."); + return false; + } + } + + return true; +} + +void SQLPTExtRepresentation::GatherModuleMeta( + policy_table::ModuleMeta* meta) const { + LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + dbms::SQLQuery query(db()); + if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) { + *meta->ccpu_version = query.GetString(0); + *meta->language = query.GetString(1); + *meta->wers_country_code = query.GetString(2); + *meta->pt_exchanged_at_odometer_x = query.GetInteger(3); + *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(4); + *meta->ignition_cycles_since_last_exchange = query.GetInteger(5); + *meta->vin = query.GetString(6); + } +} + +void SQLPTExtRepresentation::Increment(const std::string& type) const { + dbms::SQLQuery query(db()); + std::string update_counter = "UPDATE `usage_and_error_count` SET `" + type + + "` = `" + type + "` + 1"; + if (!query.Exec(update_counter)) { + LOG4CXX_INFO(logger_, "Failed updating global counter"); + } +} + +bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kCountAppLevel)) { + LOG4CXX_INFO(logger_, "Incorrect statement of count app_level"); + return false; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Failed count app_level"); + return false; + } + return query.GetInteger(0) > 0; +} + +bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id, + FunctionalGroupIDs& all_groups) { + LOG4CXX_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) { + LOG4CXX_WARN(logger_, "Incorrect statement for select app groups id."); + return false; + } + + query.Bind(0, policy_app_id); + + while (query.Next()) { + all_groups.push_back(query.GetInteger(0)); + } + + return true; +} + +bool SQLPTExtRepresentation::GetConsentedGroups( + const std::string& policy_app_id, const std::string& device_id, + FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) { + + LOG4CXX_INFO(logger_, "GetConsentedGroups"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) { + LOG4CXX_WARN(logger_, "Incorrect statement for select consent groups id."); + return false; + } + + query.Bind(0, policy_app_id); + query.Bind(1, device_id); + + while (query.Next()) { + if (query.GetBoolean(1)) { + allowed_groups.push_back(query.GetInteger(0)); + } else { + disallowed_groups.push_back(query.GetInteger(0)); + } + } + + return true; +} + +bool SQLPTExtRepresentation::GetPreconsentedGroups( + const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) { + LOG4CXX_INFO(logger_, "GetPreconsentedGroups"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) { + LOG4CXX_WARN(logger_, + "Incorrect statement for select preconsented groups id."); + return false; + } + + query.Bind(0, policy_app_id); + + while (query.Next()) { + preconsented_groups.push_back(query.GetInteger(0)); + } + + return true; +} + +bool SQLPTExtRepresentation::GetFunctionalGroupNames( + FunctionalGroupNames& names) { + LOG4CXX_INFO(logger_, "GetFunctionalGroupNames"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) { + LOG4CXX_WARN(logger_, + "Incorrect statement for select functional groups names."); + return false; + } + + while (query.Next()) { + // Some of functional grous doesn't have filled user_consent_prompt + if (query.IsNull(1)) { + names[query.GetInteger(0)] = + std::make_pair<std::string, std::string>("", query.GetString(2)); + } else { + names[query.GetInteger(0)] = + std::make_pair<std::string, std::string>(query.GetString(1), query.GetString(2)); + } + + } + + return true; +} + +void SQLPTExtRepresentation::FillFunctionalGroupPermissions( + FunctionalGroupIDs& ids, FunctionalGroupNames& names, GroupConsent state, + std::vector<FunctionalGroupPermission>& permissions) { + FunctionalGroupIDs::const_iterator it = ids.begin(); + FunctionalGroupIDs::const_iterator it_end = ids.end(); + for (; it != it_end; ++it) { + FunctionalGroupPermission current_group; + current_group.group_id = *it; + current_group.group_alias = names[*it].first; + current_group.group_name = names[*it].second; + current_group.state = state; + permissions.push_back(current_group); + } +} + +void SQLPTExtRepresentation::Increment(const std::string& app_id, + const std::string& type) const { + dbms::SQLQuery query(db()); + std::string sql_counter; + if (IsExistAppLevel(app_id)) { + // update + sql_counter = "UPDATE `app_level` SET `" + type + "` = `" + type + + "` + 1 WHERE `application_id` = ?"; + } else { + // insert + sql_counter = "INSERT INTO `app_level` (`application_id`, `" + type + "`) " + "VALUES (?, 1)"; + } + if (!query.Prepare(sql_counter)) { + LOG4CXX_INFO(logger_, "Incorrect statement of update app counter"); + return; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Failed updating app counter"); + } +} + +void SQLPTExtRepresentation::Set(const std::string& app_id, + const std::string& type, + const std::string& value) const { + dbms::SQLQuery query(db()); + std::string sql_info; + if (IsExistAppLevel(app_id)) { + // update + sql_info = "UPDATE `app_level` SET `" + type + "` = ? " + "WHERE `application_id` = ?"; + } else { + // insert + sql_info = "INSERT INTO `app_level` (`" + type + "`, `application_id`) " + "VALUES (?, ?)"; + } + if (!query.Prepare(sql_info)) { + LOG4CXX_INFO(logger_, "Incorrect statement of update app info"); + return; + } + query.Bind(0, value); + query.Bind(1, app_id); + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Failed updating app info"); + } +} + +void SQLPTExtRepresentation::Add(const std::string& app_id, + const std::string& type, int seconds) const { + dbms::SQLQuery query(db()); + std::string sql_stopwatch; + if (IsExistAppLevel(app_id)) { + // update + sql_stopwatch = "UPDATE `app_level` SET `" + type + "` = `" + type + + "` + ? WHERE `application_id` = ?"; + } else { + // insert + sql_stopwatch = "INSERT INTO `app_level` (`" + type + + "`, `application_id`) " + "VALUES (?, ?)"; + } + if (!query.Prepare(sql_stopwatch)) { + LOG4CXX_INFO(logger_, "Incorrect statement of update app stopwatch"); + return; + } + query.Bind(0, seconds); + query.Bind(1, app_id); + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Failed updating app stopwatch"); + } +} + +bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id, + std::string* default_hmi) { + LOG4CXX_INFO(logger_, "GetDefaultHMI"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) { + LOG4CXX_INFO(logger_, "Incorrect statement for default hmi."); + return false; + } + + query.Bind(0, policy_app_id); + + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Error during default hmi getting."); + return false; + } + + if (query.IsNull(0)) { + default_hmi->clear(); + return true; + } + + default_hmi->assign(query.GetString(0)); + + return true; +} + +bool SQLPTExtRepresentation::CountUnconsentedGroups( + const std::string& policy_app_id, + const std::string& device_id, + int* result) const { + LOG4CXX_INFO(logger_, "CountUnconsentedGroups"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) { + LOG4CXX_WARN(logger_, "Incorrect select for unconsented groups."); + return false; + } + + query.Bind(0, policy_app_id); + query.Bind(1, device_id); + query.Bind(2, kDefaultId); + query.Bind(3, kPreDataConsentId); + + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Error during executing unconsented groups."); + return false; + } + *result = query.GetInteger(0); + return true; +} + +bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string &message, + const std::string &language) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) { + LOG4CXX_WARN(logger_, "Incorrect statement for message language check."); + return false; + } + + query.Bind(0, message); + query.Bind(1, language); + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed to check message language code."); + return false; + } + + return query.GetInteger(0) != 0; +} + +bool SQLPTExtRepresentation::SaveMessageString( + const std::string& type, const std::string& lang, + const policy_table::MessageString& strings) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertMessageString)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for message."); + return false; + } + + query.Bind(0, *strings.tts); + query.Bind(1, *strings.label); + query.Bind(2, *strings.line1); + query.Bind(3, *strings.line2); + query.Bind(4, lang); + query.Bind(5, type); + query.Bind(6, *strings.textBody); + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into message."); + return false; + } + + return true; +} + +bool SQLPTExtRepresentation::SaveUsageAndErrorCounts( + const policy_table::UsageAndErrorCounts& counts) { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteAppLevel)) { + LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + return false; + } + if (!query.Prepare(sql_pt::kInsertAppLevel)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + return false; + } + + policy_table::AppLevels::const_iterator it; + const policy_table::AppLevels& app_levels = *counts.app_level; + for (it = app_levels.begin(); it != app_levels.end(); ++it) { + query.Bind(0, it->first); + query.Bind(1, it->second.minutes_in_hmi_full); + query.Bind(2, it->second.minutes_in_hmi_limited); + query.Bind(3, it->second.minutes_in_hmi_background); + query.Bind(4, it->second.minutes_in_hmi_none); + query.Bind(5, it->second.count_of_user_selections); + query.Bind(6, it->second.count_of_rejections_sync_out_of_memory); + query.Bind(7, it->second.count_of_rejections_nickname_mismatch); + query.Bind(8, it->second.count_of_rejections_duplicate_name); + query.Bind(9, it->second.count_of_rejected_rpc_calls); + query.Bind(10, it->second.count_of_rpcs_sent_in_hmi_none); + query.Bind(11, it->second.count_of_removals_for_bad_behavior); + query.Bind(12, it->second.count_of_run_attempts_while_revoked); + query.Bind(13, it->second.app_registration_language_gui); + query.Bind(14, it->second.app_registration_language_vui); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + return false; + } + } + return true; +} + +bool SQLPTExtRepresentation::CleanupUnpairedDevices( + const DeviceIds& device_ids) const { + LOG4CXX_INFO(logger_, "CleanupUnpairedDevices"); + dbms::SQLQuery delete_device_query(db()); + if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) { + LOG4CXX_WARN(logger_, "Incorrect statement for device delete."); + return true; + } + + dbms::SQLQuery delete_device_consent_query(db()); + if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) { + LOG4CXX_WARN(logger_, "Incorrect statement for delete device consent."); + return false; + } + + dbms::SQLQuery delete_app_consent_query(db()); + if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) { + LOG4CXX_WARN(logger_, "Incorrect statement for delete app consent."); + return false; + } + + DeviceIds::const_iterator it = device_ids.begin(); + DeviceIds::const_iterator it_end = device_ids.end(); + for (; it != it_end; ++it) { + delete_device_query.Bind(0, (*it)); + if (!delete_device_query.Exec() || !delete_device_query.Reset()) { + LOG4CXX_WARN(logger_, "Failed to delete from device"); + return false; + } + + delete_device_consent_query.Bind(0, (*it)); + if (!delete_device_consent_query.Exec() || + !delete_device_consent_query.Reset()) { + LOG4CXX_WARN(logger_, "Failed to delete from device consent."); + return false; + } + + delete_app_consent_query.Bind(0, (*it)); + if (!delete_app_consent_query.Exec() || !delete_app_consent_query.Reset()) { + LOG4CXX_WARN(logger_, "Failed to delete from app consent."); + return false; + } + } + return true; +} + +bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { + LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + return false; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + return false; + } + + if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { + LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + return false; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + return false; + } + + if (!CopyApplication(kDefaultId, app_id)) { + return false; + } + + SetPreloaded(false); + + policy_table::Strings default_groups; + policy_table::Strings default_preconsented_groups; + GatherAppGroup(kDefaultId, &default_groups); + GatherPreconsentedGroup(kDefaultId, &default_preconsented_groups); + if (SaveAppGroup(app_id, default_groups) && + SavePreconsentedGroup(app_id, default_preconsented_groups)) { + return SetIsDefault(app_id, true) && SetIsPredata(app_id, false); + } + + return false; +} + +bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) { + LOG4CXX_INFO(logger_, "SQLPTExtRepresentation::SetPredataPolicy for " << app_id); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { + LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + return false; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + return false; + } + + if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) { + LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + return false; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + return false; + } + + if (!CopyApplication(kPreDataConsentId, app_id)) { + return false; + } + + SetPreloaded(false); + + policy_table::Strings predataconsent_groups; + policy_table::Strings predataconsent_preconsented_groups; + GatherAppGroup(kPreDataConsentId, &predataconsent_groups); + GatherPreconsentedGroup(kPreDataConsentId, &predataconsent_groups); + if (SaveAppGroup(app_id, predataconsent_groups) && + SavePreconsentedGroup(app_id, predataconsent_groups)) { + return SetIsDefault(app_id, false) && SetIsPredata(app_id, true); + } + return false; +} + +bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) { + LOG4CXX_WARN(logger_, "Incorrect select application is pre_dataConsented"); + return false; + } + + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed select application is pre_dataConsented"); + return false; + } + return query.IsNull(0) ? false : query.GetBoolean(0); +} + +bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id, + bool is_pre_data) { + LOG4CXX_TRACE(logger_, "Set flag is_predata of application"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) { + LOG4CXX_WARN(logger_, "Incorect statement for updating is_predata"); + return false; + } + + query.Bind(0, is_pre_data); + query.Bind(1, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed update is_predata"); + return false; + } + return true; +} + +bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id) const { + LOG4CXX_TRACE(logger_, "Set unpaired device: " << device_id); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) { + LOG4CXX_WARN(logger_, "Incorect statement for updating unpaired device"); + return false; + } + + query.Bind(0, true); + query.Bind(1, device_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed update unpaired device"); + return false; + } + return true; +} + +bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const { + LOG4CXX_TRACE(logger_, "Get list of unpaired devices"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) { + LOG4CXX_WARN(logger_, "Incorect statement for selecting unpaired devices"); + return false; + } + + while (query.Next()) { + device_ids->push_back(query.GetString(0)); + } + return true; +} + +bool SQLPTExtRepresentation::SetVINValue(const std::string& value){ + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) { + LOG4CXX_WARN(logger_, "Incorect statement for updating module_meta params"); + return false; + } + + query.Bind(0, value); + const bool result = query.Exec(); + + if (!result) { + LOG4CXX_WARN(logger_, "Failed update module_meta"); + } + return result; +} + +bool SQLPTExtRepresentation::RemoveAppConsentForGroup( + const std::string& policy_app_id, + const std::string& functional_group_name) const { + dbms::SQLQuery query_group_id(db()); + if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) { + LOG4CXX_WARN(logger_, "Incorect statement for select group name."); + return false; + } + + query_group_id.Bind(0, functional_group_name); + + if (!query_group_id.Exec()) { + LOG4CXX_WARN(logger_, "Failed to select group id."); + return false; + } + + const int id = query_group_id.GetInteger(0); + + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) { + LOG4CXX_WARN(logger_, "Incorect statement for remove app consent."); + return false; + } + + query.Bind(0, policy_app_id); + query.Bind(1, id); + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed to remove app consent."); + return false; + } + + return true; +} + +} // namespace policy + diff --git a/src/components/policy/src/policy/src/sql_pt_queries.cc b/src/components/policy/src/policy/src/sql_pt_queries.cc new file mode 100644 index 0000000000..1b7fcdfb6f --- /dev/null +++ b/src/components/policy/src/policy/src/sql_pt_queries.cc @@ -0,0 +1,650 @@ +/* + Copyright (c) 2013, " Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, " with or without + modification, " are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, " this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, " + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR + CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN + CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "policy/sql_pt_queries.h" + +namespace policy { +namespace sql_pt { + +const std::string kSelectPriority = + "SELECT `priority_value` FROM `application` WHERE `id` = ? LIMIT 1"; +const std::string kCreateSchema = + "BEGIN; " + "CREATE TABLE IF NOT EXISTS `device`( " + " `id` VARCHAR(100) PRIMARY KEY NOT NULL, " + " `hardware` VARCHAR(45), " + " `firmware_rev` VARCHAR(45), " + " `os` VARCHAR(45), " + " `os_version` VARCHAR(45), " + " `carrier` VARCHAR(45), " + " `max_number_rfcom_ports` INTEGER," + " `connection_type` VARCHAR(45), " + " `unpaired` BOOL " + "); " + "CREATE TABLE IF NOT EXISTS `usage_and_error_count`( " + " `count_of_iap_buffer_full` INTEGER, " + " `count_sync_out_of_memory` INTEGER, " + " `count_of_sync_reboots` INTEGER " + "); " + "CREATE TABLE IF NOT EXISTS `module_meta`( " + " `ccpu_version` VARCHAR(45), " + " `language` VARCHAR(45), " + " `wers_country_code` VARCHAR(45), " + " `pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0, " + " `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0, " + " `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0, " + " `vin` VARCHAR(45)," + " `flag_update_required` BOOL NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `module_config`( " + " `preloaded_pt` BOOL NOT NULL, " + " `exchange_after_x_ignition_cycles` INTEGER NOT NULL, " + " `exchange_after_x_kilometers` INTEGER NOT NULL, " + " `exchange_after_x_days` INTEGER NOT NULL, " + " `timeout_after_x_seconds` INTEGER NOT NULL, " + " `vehicle_make` VARCHAR(45), " + " `vehicle_model` VARCHAR(45), " + " `vehicle_year` VARCHAR(4) " + "); " + "CREATE TABLE IF NOT EXISTS `functional_group`( " + " `id` INTEGER PRIMARY KEY NOT NULL, " + " `user_consent_prompt` TEXT UNIQUE ON CONFLICT REPLACE, " + " `name` VARCHAR(100) NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `priority`( " + " `value` VARCHAR(45) PRIMARY KEY NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `hmi_level`( " + " `value` VARCHAR(45) PRIMARY KEY NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `notifications_by_priority`( " + " `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `value` INTEGER NOT NULL, " + " CONSTRAINT `fk_notifications_by_priority_priority1` " + " FOREIGN KEY(`priority_value`) " + " REFERENCES `priority`(`value`) " + "); " + "CREATE INDEX IF NOT EXISTS " + "`notifications_by_priority.fk_notifications_by_priority_priority1_idx` " + " ON `notifications_by_priority`(`priority_value`); " + "CREATE TABLE IF NOT EXISTS `language`( " + " `code` VARCHAR(25) PRIMARY KEY NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `message_type`( " + " `name` VARCHAR(45) PRIMARY KEY NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `version`( " + " `number` VARCHAR(45) NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `rpc`( " + " `id` INTEGER PRIMARY KEY NOT NULL, " + " `name` VARCHAR(45) NOT NULL, " + " `parameter` VARCHAR(45), " + " `hmi_level_value` VARCHAR(45) NOT NULL, " + " `functional_group_id` INTEGER NOT NULL, " + " CONSTRAINT `fk_rpc_hmi_level1` " + " FOREIGN KEY(`hmi_level_value`) " + " REFERENCES `hmi_level`(`value`), " + " CONSTRAINT `fk_rpc_functional_group1` " + " FOREIGN KEY(`functional_group_id`) " + " REFERENCES `functional_group`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_hmi_level1_idx` " + " ON `rpc`(`hmi_level_value`); " + "CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_functional_group1_idx` " + " ON `rpc`(`functional_group_id`); " + "CREATE INDEX `rpc.select_rpc_name_hmi_level` " + " ON `rpc`(`name`,`hmi_level_value`);" + "CREATE TABLE IF NOT EXISTS `application`( " + " `id` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `keep_context` BOOLEAN, " + " `steal_focus` BOOLEAN, " + " `default_hmi` VARCHAR(45), " + " `priority_value` VARCHAR(45), " + " `is_revoked` BOOLEAN, " + " `is_default` BOOLEAN, " + " `is_predata` BOOLEAN, " + " `memory_kb` INTEGER NOT NULL, " + " `heart_beat_timeout_ms` INTEGER NOT NULL, " + " `certificate` VARCHAR(45), " + " CONSTRAINT `fk_application_hmi_level1` " + " FOREIGN KEY(`default_hmi`) " + " REFERENCES `hmi_level`(`value`), " + " CONSTRAINT `fk_application_priorities1` " + " FOREIGN KEY(`priority_value`) " + " REFERENCES `priority`(`value`) " + "); " + "CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` " + " ON `application`(`default_hmi`); " + "CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` " + " ON `application`(`priority_value`); " + "CREATE TABLE IF NOT EXISTS `app_group`( " + " `application_id` VARCHAR(45) NOT NULL, " + " `functional_group_id` INTEGER NOT NULL, " + " PRIMARY KEY(`application_id`,`functional_group_id`), " + " CONSTRAINT `fk_application_has_functional_group_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`), " + " CONSTRAINT `fk_application_has_functional_group_functional_group1` " + " FOREIGN KEY(`functional_group_id`) " + " REFERENCES `functional_group`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx` " + " ON `app_group`(`functional_group_id`); " + "CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_application1_idx` " + " ON `app_group`(`application_id`); " + "CREATE TABLE IF NOT EXISTS `preconsented_group`( " + " `application_id` VARCHAR(45) NOT NULL, " + " `functional_group_id` INTEGER NOT NULL, " + " PRIMARY KEY(`application_id`,`functional_group_id`), " + " CONSTRAINT `fk_application_has_functional_group_application2` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`), " + " CONSTRAINT `fk_application_has_functional_group_functional_group2` " + " FOREIGN KEY(`functional_group_id`) " + " REFERENCES `functional_group`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS " + "`preconsented_group.fk_application_has_functional_group_functional_group2_idx` " + " ON `preconsented_group`(`functional_group_id`); " + "CREATE INDEX IF NOT EXISTS " + "`preconsented_group.fk_application_has_functional_group_application2_idx` " + " ON `preconsented_group`(`application_id`); " + "CREATE TABLE IF NOT EXISTS `seconds_between_retry`( " + " `index` INTEGER PRIMARY KEY NOT NULL, " + " `value` INTEGER NOT NULL " + "); " + "CREATE TABLE IF NOT EXISTS `device_consent_group`( " + " `device_id` VARCHAR(100) NOT NULL, " + " `functional_group_id` INTEGER NOT NULL, " + " `is_consented` BOOL NOT NULL, " + " `input` VARCHAR(45), " + " `time_stamp` DATETIME DEFAULT CURRENT_TIMESTAMP, " + " PRIMARY KEY(`device_id`,`functional_group_id`), " + " CONSTRAINT `fk_device_has_functional_group_device1` " + " FOREIGN KEY(`device_id`) " + " REFERENCES `device`(`id`), " + " CONSTRAINT `fk_device_has_functional_group_functional_group1` " + " FOREIGN KEY(`functional_group_id`) " + " REFERENCES `functional_group`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS " + "`device_consent_group.fk_device_has_functional_group_functional_group1_idx` " + " ON `device_consent_group`(`functional_group_id`); " + "CREATE INDEX IF NOT EXISTS " + "`device_consent_group.fk_device_has_functional_group_device1_idx` " + " ON `device_consent_group`(`device_id`); " + "CREATE TABLE IF NOT EXISTS `app_level`( " + " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `minutes_in_hmi_full` INTEGER DEFAULT 0, " + " `minutes_in_hmi_limited` INTEGER DEFAULT 0, " + " `minutes_in_hmi_background` INTEGER DEFAULT 0, " + " `minutes_in_hmi_none` INTEGER DEFAULT 0, " + " `count_of_user_selections` INTEGER DEFAULT 0, " + " `count_of_rejections_sync_out_of_memory` INTEGER DEFAULT 0, " + " `count_of_rejections_nickname_mismatch` INTEGER DEFAULT 0, " + " `count_of_rejections_duplicate_name` INTEGER DEFAULT 0, " + " `count_of_rejected_rpcs_calls` INTEGER DEFAULT 0, " + " `count_of_rpcs_sent_in_hmi_none` INTEGER DEFAULT 0, " + " `count_of_removals_for_bad_behavior` INTEGER DEFAULT 0, " + " `count_of_run_attempts_while_revoked` INTEGER DEFAULT 0, " + " `app_registration_language_gui` VARCHAR(25), " + " `app_registration_language_vui` VARCHAR(25), " + " CONSTRAINT `fk_app_levels_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`), " + " CONSTRAINT `fk_app_level_language1` " + " FOREIGN KEY(`app_registration_language_gui`) " + " REFERENCES `language`(`code`), " + " CONSTRAINT `fk_app_level_language2` " + " FOREIGN KEY(`app_registration_language_vui`) " + " REFERENCES `language`(`code`) " + "); " + "CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` " + " ON `app_level`(`application_id`); " + "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` " + " ON `app_level`(`app_registration_language_gui`); " + "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` " + " ON `app_level`(`app_registration_language_vui`); " + "CREATE TABLE IF NOT EXISTS `nickname`( " + " `name` VARCHAR(100) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL, " + " PRIMARY KEY(`name`,`application_id`), " + " CONSTRAINT `fk_nickname_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` " + " ON `nickname`(`application_id`); " + "CREATE TABLE IF NOT EXISTS `app_type`( " + " `name` VARCHAR(50) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL, " + " PRIMARY KEY(`name`,`application_id`), " + " CONSTRAINT `fk_app_type_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` " + " ON `app_type`(`application_id`); " + "CREATE TABLE IF NOT EXISTS `consent_group`( " + " `device_id` VARCHAR(100) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL, " + " `functional_group_id` INTEGER NOT NULL, " + " `is_consented` BOOL NOT NULL, " + " `input` VARCHAR(45), " + " `time_stamp` DATETIME DEFAULT CURRENT_TIMESTAMP, " + " PRIMARY KEY(`application_id`,`functional_group_id`,`device_id`), " + " CONSTRAINT `fk_consent_group_device1` " + " FOREIGN KEY(`device_id`) " + " REFERENCES `device`(`id`), " + " CONSTRAINT `fk_consent_group_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`), " + " CONSTRAINT `fk_consent_group_functional_group1` " + " FOREIGN KEY(`functional_group_id`) " + " REFERENCES `functional_group`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS " + "`consent_group.fk_consent_group_device1_idx` " + " ON `device_consent_group`(`device_id`); " + "CREATE INDEX IF NOT EXISTS `consent_group.fk_consent_group_functional_group1_idx` " + " ON `consent_group`(`functional_group_id`); " + "CREATE TABLE IF NOT EXISTS `endpoint`( " + " `service` INTEGER NOT NULL, " + " `url` VARCHAR(100) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL, " + " CONSTRAINT `fk_endpoint_application1` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " + "CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` " + " ON `endpoint`(`application_id`); " + "CREATE TABLE IF NOT EXISTS `message`( " + " `id` INTEGER PRIMARY KEY NOT NULL, " + " `tts` TEXT, " + " `label` TEXT, " + " `line1` TEXT, " + " `line2` TEXT, " + " `textBody` TEXT, " + " `language_code` VARCHAR(25) NOT NULL, " + " `message_type_name` VARCHAR(45) NOT NULL, " + " CONSTRAINT `fk_messages_languages1` " + " FOREIGN KEY(`language_code`) " + " REFERENCES `language`(`code`), " + " CONSTRAINT `fk_message_consumer_friendly_messages1` " + " FOREIGN KEY(`message_type_name`) " + " REFERENCES `message_type`(`name`) " + "); " + "CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` " + " ON `message`(`language_code`);" + "CREATE INDEX IF NOT EXISTS `message.fk_message_consumer_friendly_messages1_idx` " + " ON `message`(`message_type_name`);" + "COMMIT;"; + +const std::string kInsertInitData = + "INSERT OR IGNORE INTO `usage_and_error_count` ( " + " `count_of_iap_buffer_full`, `count_sync_out_of_memory`, " + " `count_of_sync_reboots`) VALUES (0, 0, 0); " + "INSERT OR IGNORE INTO `module_meta` (`pt_exchanged_at_odometer_x`, " + " `pt_exchanged_x_days_after_epoch`, `ignition_cycles_since_last_exchange`," + " `flag_update_required`) " + " VALUES (0, 0, 0, 0); " + "INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, " + " `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, " + " `exchange_after_x_days`, `timeout_after_x_seconds`) " + " VALUES(1, 0, 0, 0, 0); " + "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); " + "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); " + "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION'); " + "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('COMMUNICATION'); " + "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NORMAL'); " + "INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NONE'); " + "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('FULL'); " + "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); " + "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); " + "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); " + "INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); " + ""; + +const std::string kDropSchema = + "BEGIN; " + "DROP INDEX IF EXISTS `message.fk_messages_languages1_idx`; " + "DROP INDEX IF EXISTS `message.fk_message_consumer_friendly_messages1_idx`; " + "DROP TABLE IF EXISTS `message`; " + "DROP INDEX IF EXISTS `endpoint.fk_endpoint_application1_idx`; " + "DROP TABLE IF EXISTS `endpoint`; " + "DROP INDEX IF EXISTS `consent_group.fk_consent_group_device1_idx`; " + "DROP INDEX IF EXISTS `consent_group.fk_consent_group_functional_group1_idx`; " + "DROP TABLE IF EXISTS `consent_group`; " + "DROP INDEX IF EXISTS `app_type.fk_app_type_application1_idx`; " + "DROP TABLE IF EXISTS `app_type`; " + "DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; " + "DROP TABLE IF EXISTS `nickname`; " + "DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; " + "DROP INDEX IF EXISTS `app_level.fk_app_level_language1_idx`; " + "DROP INDEX IF EXISTS `app_level.fk_app_levels_application1_idx`; " + "DROP TABLE IF EXISTS `app_level`; " + "DROP INDEX IF EXISTS `device_consent_group.fk_device_has_functional_group_device1_idx`; " + "DROP INDEX IF EXISTS `device_consent_group.fk_device_has_functional_group_functional_group1_idx`; " + "DROP TABLE IF EXISTS `device_consent_group`; " + "DROP TABLE IF EXISTS `seconds_between_retry`; " + "DROP INDEX IF EXISTS `preconsented_group.fk_application_has_functional_group_application2_idx`; " + "DROP INDEX IF EXISTS `preconsented_group.fk_application_has_functional_group_functional_group2_idx`; " + "DROP TABLE IF EXISTS `preconsented_group`; " + "DROP INDEX IF EXISTS `app_group.fk_application_has_functional_group_application1_idx`; " + "DROP INDEX IF EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx`; " + "DROP TABLE IF EXISTS `app_group`; " + "DROP INDEX IF EXISTS `application.fk_application_priorities1_idx`; " + "DROP INDEX IF EXISTS `application.fk_application_hmi_level1_idx`; " + "DROP TABLE IF EXISTS `application`; " + "DROP INDEX IF EXISTS `rpc.select_rpc_name_hmi_level`; " + "DROP INDEX IF EXISTS `rpc.fk_rpc_functional_group1_idx`; " + "DROP INDEX IF EXISTS `rpc.fk_rpc_hmi_level1_idx`; " + "DROP TABLE IF EXISTS `rpc`; " + "DROP TABLE IF EXISTS `version`; " + "DROP TABLE IF EXISTS `message_type`; " + "DROP TABLE IF EXISTS `language`; " + "DROP INDEX IF EXISTS `notifications_by_priority.fk_notifications_by_priority_priority1_idx`; " + "DROP TABLE IF EXISTS `notifications_by_priority`; " + "DROP TABLE IF EXISTS `hmi_level`; " + "DROP TABLE IF EXISTS `priority`; " + "DROP TABLE IF EXISTS `functional_group`; " + "DROP TABLE IF EXISTS `module_config`; " + "DROP TABLE IF EXISTS `module_meta`; " + "DROP TABLE IF EXISTS `usage_and_error_count`; " + "DROP TABLE IF EXISTS `device`; " + "COMMIT; " + "VACUUM;"; + +const std::string kDeleteData = + "BEGIN; " + "DELETE FROM `message`; " + "DELETE FROM `endpoint`; " + "DELETE FROM `consent_group`; " + "DELETE FROM `app_type`; " + "DELETE FROM `nickname`; " + "DELETE FROM `app_level`; " + "DELETE FROM `device_consent_group`; " + "DELETE FROM `seconds_between_retry`; " + "DELETE FROM `preconsented_group`; " + "DELETE FROM `app_group`; " + "DELETE FROM `application`; " + "DELETE FROM `rpc`; " + "DELETE FROM `version`; " + "DELETE FROM `message_type`; " + "DELETE FROM `language`; " + "DELETE FROM `notifications_by_priority`; " + "DELETE FROM `hmi_level`; " + "DELETE FROM `priority`; " + "DELETE FROM `functional_group`; " + "DELETE FROM `module_config`; " + "DELETE FROM `module_meta`; " + "DELETE FROM `usage_and_error_count`; " + "DELETE FROM `device`; " + "COMMIT; " + "VACUUM;"; + +const std::string kCheckDBIntegrity = "PRAGMA integrity_check"; + +const std::string kCheckPgNumber = "PRAGMA page_count"; + +const std::string kSelectRpc = + "SELECT DISTINCT `rpc`.`parameter` FROM `rpc` " + " JOIN `app_group` AS `g` ON (`g`.`functional_group_id` = `rpc`.`functional_group_id` " + " AND (`g`.`application_id` = ?)) " + "WHERE `rpc`.`hmi_level_value` = ? AND `rpc`.`name` = ?"; + +const std::string kSelectPreloaded = + "SELECT `preloaded_pt` FROM `module_config` " + "WHERE `preloaded_pt` = 1 LIMIT 1"; + +const std::string kUpdatePreloaded = + "UPDATE `module_config` SET `preloaded_pt` = ?"; + +const std::string kIsFirstRun = + "SELECT `is_first_run` FROM `module_config` "; + +const std::string kSetNotFirstRun = + "UPDATE `module_config` SET `is_first_run`= 0 "; + +const std::string kSelectEndpoint = + "SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? "; + +const std::string kInsertFunctionalGroup = + "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`) " + " VALUES (?, ?, ?)"; + +const std::string kInsertRpc = + "INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) " + " VALUES (?, ?, ?)"; + +const std::string kInsertRpcWithParameter = + "INSERT INTO `rpc` (`name`, `hmi_level_value`, `parameter`, `functional_group_id`) " + " VALUES (?, ?, ?, ?)"; + +const std::string kInsertApplication = + "INSERT OR IGNORE INTO `application` (`id`, `priority_value`, `is_revoked`, `memory_kb`," + " `heart_beat_timeout_ms`, `certificate`) VALUES (?,?,?,?,?,?)"; + +const std::string kInsertAppGroup = + "INSERT INTO `app_group` (`application_id`, `functional_group_id`)" + " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1"; + +const std::string kInsertNickname = + "INSERT OR IGNORE INTO `nickname` (`application_id`, `name`) VALUES (?, ?)"; + +const std::string kInsertAppType = + "INSERT OR IGNORE INTO `app_type` (`application_id`, `name`) VALUES (?, ?)"; + +const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?"; + +const std::string kInsertMessageType = + "INSERT OR IGNORE INTO `message_type` (`name`) VALUES (?)"; + +const std::string kInsertLanguage = + "INSERT OR IGNORE INTO `language` (`code`) VALUES (?)"; + +const std::string kInsertMessageString = + "INSERT INTO `message` (`tts`, `label`, `line1`, `line2`, `language_code`, " + " `message_type_name`, `textBody`) VALUES (?, ?, ?, ?, ?, ?, ?)"; + +const std::string kUpdateModuleConfig = + "UPDATE `module_config` SET `preloaded_pt` = ?, " + " `exchange_after_x_ignition_cycles` = ?," + " `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, " + " `timeout_after_x_seconds` = ?, `vehicle_make` = ?, " + " `vehicle_model` = ?, `vehicle_year` = ?"; + +const std::string kInsertEndpoint = + "INSERT INTO `endpoint` (`service`, `url`, `application_id`) " + " VALUES (?, ?, ?)"; + +const std::string kInsertSecondsBetweenRetry = + "INSERT INTO `seconds_between_retry` (`index`, `value`) VALUES (?, ?)"; + +const std::string kInsertNotificationsByPriority = + "INSERT OR REPLACE INTO `notifications_by_priority` (`priority_value`, `value`) " + " VALUES (?, ?)"; + +const std::string kInsertDeviceData = + "INSERT OR IGNORE INTO `device` (`id`) VALUES (?)"; + +const std::string kInsertAppLevel = + "INSERT INTO `app_level` (`application_id`, `minutes_in_hmi_full`," + "`minutes_in_hmi_limited` ,`minutes_in_hmi_background`," + "`minutes_in_hmi_none`,`count_of_user_selections`," + "`count_of_rejections_sync_out_of_memory`," + "`count_of_rejections_nickname_mismatch`," + "`count_of_rejections_duplicate_name`,`count_of_rejected_rpcs_calls`," + "`count_of_rpcs_sent_in_hmi_none`,`count_of_removals_for_bad_behavior`," + "`count_of_run_attempts_while_revoked`,`app_registration_language_gui`," + "`app_registration_language_vui`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + +const std::string kDeleteSecondsBetweenRetries = + "DELETE FROM `seconds_between_retry`"; + +const std::string kDeleteEndpoint = "DELETE FROM `endpoint`"; + +const std::string kDeleteAppLevel = "DELETE FROM `app_level`"; + +const std::string kDeleteMessageString = "DELETE FROM `message`"; + +const std::string kDeleteFunctionalGroup = "DELETE FROM `functional_group`"; + +const std::string kDeleteRpc = "DELETE FROM `rpc`"; + +const std::string kDeleteAppGroup = "DELETE FROM `app_group`"; + +const std::string kSelectModuleConfig = + "SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, " + " `exchange_after_x_kilometers`, `exchange_after_x_days`, " + " `timeout_after_x_seconds`, `vehicle_make`," + " `vehicle_model`, `vehicle_year` " + " FROM `module_config`"; + +const std::string kSelectEndpoints = + "SELECT `url`, `service`, `application_id` " + "FROM `endpoint` " + "GROUP BY `application_id`"; + +const std::string kSelectNotificationsPerMin = + "SELECT `priority_value`, `value` FROM notifications_by_priority"; + +const std::string kSelectNotificationsPerPriority = + "SELECT `value` FROM notifications_by_priority WHERE `priority_value` = ? "; + +const std::string kSelectAppLevels = "SELECT `application_id` FROM `app_level`"; + +const std::string kSelectDeviceData = "SELECT * FROM `device`"; + +const std::string kSelectFunctionalGroups = + "SELECT `id`,`name`, `user_consent_prompt` " + "FROM `functional_group`"; + +const std::string kSelectAllRpcs = + "SELECT `name`, `hmi_level_value`, `parameter` " + "FROM `rpc` WHERE `functional_group_id` = ? "; + +const std::string kSelectUserMsgsVersion = + "SELECT DISTINCT `number` FROM `version`"; + +const std::string kSelectAppPolicies = "SELECT `id`, `priority_value`, `memory_kb`, " + " `heart_beat_timeout_ms`, `certificate` FROM `application`"; + +const std::string kSelectAppGroups = "SELECT `f`.`name` FROM `app_group` AS `a`" + " LEFT JOIN `functional_group` AS `f` " + " ON (`f`.`id` = `a`.`functional_group_id`)" + " WHERE `a`.`application_id` = ?"; + +const std::string kSelectNicknames = "SELECT DISTINCT `name` FROM `nickname` " + "WHERE `application_id` = ?"; + +const std::string kSelectAppTypes = "SELECT DISTINCT `name` FROM `app_type` " + "WHERE `application_id` = ?"; + +const std::string kSelectSecondsBetweenRetries = + "SELECT `value` FROM `seconds_between_retry` ORDER BY `index`"; + +const std::string kSelectIgnitionCycles = + "SELECT `c`.`exchange_after_x_ignition_cycles`, " + " `m`.`ignition_cycles_since_last_exchange` " + " FROM `module_config` AS `c`, `module_meta` AS `m` " + "LIMIT 1"; + +const std::string kSelectKilometers = + "SELECT `c`.`exchange_after_x_kilometers`, " + " `m`.`pt_exchanged_at_odometer_x` " + " FROM `module_config` AS `c`, `module_meta` AS `m` " + "LIMIT 1"; + +const std::string kSelectDays = "SELECT `c`.`exchange_after_x_days`, " + " `m`.`pt_exchanged_x_days_after_epoch` " + " FROM `module_config` AS `c`, `module_meta` AS `m` " + "LIMIT 1"; + +const std::string kIncrementIgnitionCycles = + "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 1 + " + " `ignition_cycles_since_last_exchange`"; + +const std::string kResetIgnitionCycles = + "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 0"; + +const std::string kSelectTimeoutResponse = + "SELECT `timeout_after_x_seconds` FROM `module_config` LIMIT 1"; + +const std::string kUpdateFlagUpdateRequired = + "UPDATE `module_meta` SET `flag_update_required` = ?"; + +const std::string kSelectFlagUpdateRequired = + "SELECT `flag_update_required` FROM `module_meta` LIMIT 1"; + +const std::string kUpdateCountersSuccessfulUpdate = + "UPDATE `module_meta` SET `pt_exchanged_at_odometer_x` = ?," + "`pt_exchanged_x_days_after_epoch` = ?"; + +const std::string kDeleteApplication = "DELETE FROM `application`"; + +const std::string kSelectApplicationRevoked = + "SELECT `is_revoked` FROM `application` WHERE `id` = ?"; + +const std::string kUpdateApplicationCustomData = + "UPDATE `application` SET `is_revoked` = ?, `is_default` = ?," + "`is_predata` = ? WHERE `id` = ?"; + +const std::string kSelectApplicationRepresented = + "SELECT COUNT(`id`) FROM `application` WHERE `id` = ?"; + +const std::string kSelectApplicationIsDefault = + "SELECT `is_default` FROM `application` WHERE `id` = ?"; + +const std::string kUpdateIsDefault = + "UPDATE `application` SET `is_default` = ? WHERE `id` = ?"; + +const std::string kDeleteDevice = "DELETE FROM `device` WHERE `id` = ?"; + +const std::string kDeleteAppGroupByApplicationId = + "DELETE FROM `app_group` WHERE `application_id` = ?"; + +const std::string kInsertApplicationFull = + "INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, " + " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, `is_predata`, " + " `memory_kb`, `heart_beat_timeout_ms`, `certificate`) " + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + +const std::string kSelectApplicationFull = + "SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, " + " `is_revoked`, `is_default`, `is_predata`, `memory_kb`," + " `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = ?"; + +} // namespace sql_pt +} // namespace policy + diff --git a/src/components/policy/src/policy/src/sql_pt_representation.cc b/src/components/policy/src/policy/src/sql_pt_representation.cc new file mode 100644 index 0000000000..4946284f3c --- /dev/null +++ b/src/components/policy/src/policy/src/sql_pt_representation.cc @@ -0,0 +1,1468 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sstream> +#include <stdlib.h> +#include <stdint.h> +#include <errno.h> + +#include "utils/logger.h" +#include "policy/sql_pt_representation.h" +#include "policy/sql_wrapper.h" +#include "policy/sql_pt_queries.h" +#include "policy/policy_helper.h" +#include "policy/cache_manager.h" +#ifndef __QNX__ +# include "config_profile/profile.h" +#endif // __QNX__ + +namespace policy { + +CREATE_LOGGERPTR_GLOBAL(logger_, "SQLPTRepresentation") + +namespace { +template<typename T, typename K> void InsertUnique(K value, T* array) { + uint32_t i = 0; + for (; i < array->size() && array->at(i) != value; ++i) { + continue; + } + if (array->size() == i) { + array->push_back(value); + } +} +} // namespace + +// CUSTOMER_PASA +const std::string SQLPTRepresentation::kDatabaseName = "policy"; + +SQLPTRepresentation::SQLPTRepresentation() + : db_(new dbms::SQLDatabase(kDatabaseName)) { +#ifndef __QNX__ + std::string path = profile::Profile::instance()->app_storage_folder(); + if (!path.empty()) { + db_->set_path(path + "/"); + } +#endif // __QNX__ +} + +SQLPTRepresentation::~SQLPTRepresentation() { + db_->Backup(); + db_->Close(); + delete db_; +} + +void SQLPTRepresentation::CheckPermissions(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + CheckPermissionResult& result) { + dbms::SQLQuery query(db()); + + if (!query.Prepare(sql_pt::kSelectRpc)) { + LOG4CXX_WARN( + logger_, + "Incorrect select statement from rpcs" << query.LastError().text()); + return; + } + query.Bind(0, app_id); + query.Bind(1, hmi_level); + query.Bind(2, rpc); + + bool ret = query.Next(); + result.hmi_level_permitted = ret ? kRpcAllowed : kRpcDisallowed; + LOG4CXX_INFO( + logger_, + "Level is " + << (result.hmi_level_permitted == kRpcAllowed ? "permitted" + : "not permitted")); + std::string parameter; + while (ret) { + if (!query.IsNull(0)) { + parameter = query.GetString(0); + result.list_of_allowed_params.push_back(parameter); + } + ret = query.Next(); + } +} + +bool SQLPTRepresentation::IsPTPreloaded() { + dbms::SQLQuery query(db()); + return query.Prepare(sql_pt::kSelectPreloaded) && query.Next(); +} + +int SQLPTRepresentation::IgnitionCyclesBeforeExchange() { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) { + LOG4CXX_WARN(logger_, "Can not select ignition cycles"); + return 0; + } + int limit = query.GetInteger(0); + int current = query.GetInteger(1); + + if (limit < 0 || current < 0 || current > limit) { + return 0; + } + + return limit - current; +} + +int SQLPTRepresentation::KilometersBeforeExchange(int current) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) { + LOG4CXX_WARN(logger_, "Can not select kilometers"); + return 0; + } + int limit = query.GetInteger(0); + int last = query.GetInteger(1); + + if (limit < 0 || last < 0 || current < 0 || current < last + || limit < (current - last)) { + return 0; + } + + return limit - (current - last); +} + +bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate( + int kilometers, int days_after_epoch) { + LOG4CXX_INFO(logger_, + "SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) { + LOG4CXX_WARN(logger_, + "Wrong update query for counters on successful update."); + return false; + } + query.Bind(0, kilometers); + query.Bind(1, days_after_epoch); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed to update counters on successful update."); + return false; + } + return true; +} + +int SQLPTRepresentation::DaysBeforeExchange(int current) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) { + LOG4CXX_WARN(logger_, "Can not select days"); + return 0; + } + int limit = query.GetInteger(0); + int last = query.GetInteger(1); + + if (0 == last) { + return limit; + } + + if (limit < 0 || last < 0 || current < 0 || current < last + || limit < (current - last)) { + return 0; + } + + return limit - (current - last); +} + +int SQLPTRepresentation::TimeoutResponse() { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) { + LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence"); + const int kDefault = 30; + return kDefault; + } + return query.GetInteger(0); +} + +bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { + LOG4CXX_INFO(logger_, + "Incorrect select statement from seconds between retries"); + return false; + } + while (query.Next()) { + seconds->push_back(query.GetInteger(0)); + } + return true; +} + +std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg( + const std::vector<std::string>& msg_codes, const std::string& language) { + std::vector<UserFriendlyMessage> result; + std::vector<std::string>::const_iterator it = msg_codes.begin(); + std::vector<std::string>::const_iterator it_end = msg_codes.end(); + for (; it != it_end; ++it) { + UserFriendlyMessage msg; + msg.message_code = *it; + result.push_back(msg); + } + return result; +} + +EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) { + LOG4CXX_INFO(logger_, "SQLPTRepresentation::GetUpdateUrls for " + << service_type); + dbms::SQLQuery query(db()); + EndpointUrls ret; + if (query.Prepare(sql_pt::kSelectEndpoint)) { + query.Bind(0, service_type); + while (query.Next()) { + EndpointData data; + + data.url.push_back(query.GetString(0)); + if (!query.IsNull(1)) { + data.app_id = query.GetString(1); + } + ret.push_back(data); + } + } else { + LOG4CXX_WARN(logger_, "Invalid select endpoints statement."); + } + return ret; +} + +int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) { + LOG4CXX_INFO(logger_, "GetNotificationsNumber"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) { + LOG4CXX_WARN(logger_, "Incorrect select statement for priority " + "notification number."); + return 0; + } + query.Bind(0, priority); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority."); + return 0; + } + + if (!query.IsNull(0)) { + return query.GetInteger(0); + } + + return 0; +} + +bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id, + std::string* priority) { + LOG4CXX_INFO(logger_, "GetPriority"); + if (NULL == priority) { + LOG4CXX_WARN(logger_, "Input priority parameter is null."); + return false; + } + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectPriority)) { + LOG4CXX_INFO(logger_, "Incorrect statement for priority."); + return false; + } + + query.Bind(0, policy_app_id); + + if (!query.Exec()) { + LOG4CXX_INFO(logger_, "Error during select priority."); + return false; + } + + if (query.IsNull(0)) { + priority->clear(); + return true; + } + + priority->assign(query.GetString(0)); + + return true; +} + +InitResult SQLPTRepresentation::Init() { + LOG4CXX_INFO(logger_, "SQLPTRepresentation::Init"); + + if (!db_->Open()) { + LOG4CXX_ERROR(logger_, "Failed opening database"); + return InitResult::FAIL; + } + dbms::SQLQuery check_pages(db()); + if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) { + LOG4CXX_WARN(logger_, "Incorrect pragma for page counting."); + } else { + if (0 < check_pages.GetInteger(0)) { + dbms::SQLQuery db_check(db()); + if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) { + LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check."); + } else { + while (db_check.Next()) { + if (db_check.GetString(0).compare("ok") == 0) { + dbms::SQLQuery check_first_run(db()); + if (check_first_run.Prepare(sql_pt::kIsFirstRun) && + check_first_run.Next()) { + LOG4CXX_INFO(logger_, "Selecting is first run " + << check_first_run.GetBoolean(0)); + if (check_first_run.GetBoolean(0)) { + dbms::SQLQuery set_not_first_run(db()); + set_not_first_run.Exec(sql_pt::kSetNotFirstRun); + return InitResult::SUCCESS; + } + } else { + LOG4CXX_WARN(logger_, "Incorrect select is first run"); + } + return InitResult::EXISTS; + } else { + LOG4CXX_ERROR(logger_, + "Existing policy table representation is invlaid."); + // TODO(PV): add handle + return InitResult::FAIL; + } + } + } + } + } + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kCreateSchema)) { + LOG4CXX_ERROR( + logger_, + "Failed creating schema of database: " << query.LastError().text()); + return InitResult::FAIL; + } + if (!query.Exec(sql_pt::kInsertInitData)) { + LOG4CXX_ERROR( + logger_, + "Failed insert init data to database: " << query.LastError().text()); + return InitResult::FAIL; + } + return InitResult::SUCCESS; +} + +bool SQLPTRepresentation::Close() { + db_->Close(); + return db_->LastError().number() == dbms::OK; +} + +VehicleData SQLPTRepresentation::GetVehicleData() { + return VehicleData(); +} + +bool SQLPTRepresentation::Drop() { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDropSchema)) { + LOG4CXX_WARN(logger_, + "Failed dropping database: " << query.LastError().text()); + return false; + } + return true; +} + +bool SQLPTRepresentation::Clear() { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteData)) { + LOG4CXX_ERROR(logger_, + "Failed clearing database: " << query.LastError().text()); + return false; + } + if (!query.Exec(sql_pt::kInsertInitData)) { + LOG4CXX_ERROR( + logger_, + "Failed insert init data to database: " << query.LastError().text()); + return false; + } + return true; +} + +utils::SharedPtr<policy_table::Table> +SQLPTRepresentation::GenerateSnapshot() const { + LOG4CXX_INFO(logger_, "GenerateSnapshot"); + utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + GatherModuleMeta(&*table->policy_table.module_meta); + GatherModuleConfig(&table->policy_table.module_config); + GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); + GatherDeviceData(&*table->policy_table.device_data); + GatherFunctionalGroupings(&table->policy_table.functional_groupings); + GatherConsumerFriendlyMessages( + &*table->policy_table.consumer_friendly_messages); + GatherApplicationPolicies(&table->policy_table.app_policies); + return table; +} + +void SQLPTRepresentation::GatherModuleMeta( + policy_table::ModuleMeta* meta) const { + LOG4CXX_INFO(logger_, "Gather Module Meta Info"); + meta->mark_initialized(); + // Section Module Meta is empty for SDL specific +} + +void SQLPTRepresentation::GatherModuleConfig( + policy_table::ModuleConfig* config) const { + LOG4CXX_INFO(logger_, "Gather Configuration Info"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) { + LOG4CXX_WARN(logger_, "Incorrect select statement for module config"); + } else { + *config->preloaded_pt = query.GetBoolean(0); + config->exchange_after_x_ignition_cycles = query.GetInteger(1); + config->exchange_after_x_kilometers = query.GetInteger(2); + config->exchange_after_x_days = query.GetInteger(3); + config->timeout_after_x_seconds = query.GetInteger(4); + *config->vehicle_make = query.GetString(5); + *config->vehicle_model = query.GetString(6); + *config->vehicle_year = query.GetString(7); + } + + dbms::SQLQuery endpoints(db()); + if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) { + LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints"); + } else { + while (endpoints.Next()) { + std::stringstream stream; + stream << "0x0" << endpoints.GetInteger(1); + config->endpoints[stream.str()][endpoints.GetString(2)] + .push_back(endpoints.GetString(0)); + } + } + + dbms::SQLQuery notifications(db()); + if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) { + LOG4CXX_WARN(logger_, "Incorrect select statement for notifications"); + } else { + while (notifications.Next()) { + config->notifications_per_minute_by_priority[notifications.GetString(0)] = + notifications.GetInteger(1); + } + } + dbms::SQLQuery seconds(db()); + if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) { + LOG4CXX_INFO(logger_, + "Incorrect select statement from seconds between retries"); + } else { + while (seconds.Next()) { + config->seconds_between_retries.push_back(seconds.GetInteger(0)); + } + } +} + +bool SQLPTRepresentation::GatherUsageAndErrorCounts( + policy_table::UsageAndErrorCounts* counts) const { + LOG4CXX_INFO(logger_, "Gather Usage and Error Counts."); + dbms::SQLQuery query(db()); + if (query.Prepare(sql_pt::kSelectAppLevels)) { + policy_table::AppLevel app_level_empty; + app_level_empty.mark_initialized(); + while (query.Next()) { + (*counts->app_level)[query.GetString(0)] = app_level_empty; + } + } + return true; +} + +void SQLPTRepresentation::GatherDeviceData( + policy_table::DeviceData* data) const { + LOG4CXX_INFO(logger_, "Gather device data."); + data->mark_initialized(); + + dbms::SQLQuery query(db()); + if (query.Prepare(sql_pt::kSelectDeviceData)) { + policy_table::DeviceParams device_data_empty; + device_data_empty.mark_initialized(); + while (query.Next()) { + (*data)[query.GetString(0)] = device_data_empty; + } + } +} + +bool SQLPTRepresentation::GatherFunctionalGroupings( + policy_table::FunctionalGroupings* groups) const { + LOG4CXX_INFO(logger_, "Gather Functional Groupings info"); + dbms::SQLQuery func_group(db()); + if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) { + LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings"); + return false; + } + dbms::SQLQuery rpcs(db()); + if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) { + LOG4CXX_WARN(logger_, "Incorrect select all from rpc"); + return false; + } + while (func_group.Next()) { + policy_table::Rpcs rpcs_tbl; + if (!func_group.IsNull(2)) { + *rpcs_tbl.user_consent_prompt = func_group.GetString(2); + } + int func_id = func_group.GetInteger(0); + rpcs.Bind(0, func_id); + while (rpcs.Next()) { + if (!rpcs.IsNull(1)) { + policy_table::HmiLevel level; + if (policy_table::EnumFromJsonString(rpcs.GetString(1), &level)) { + InsertUnique(level, &rpcs_tbl.rpcs[rpcs.GetString(0)].hmi_levels); + } + } + if (!rpcs.IsNull(2)) { + policy_table::Parameter param; + if (policy_table::EnumFromJsonString(rpcs.GetString(2), ¶m)) { + // TODO(IKozyrenko): Check logic if optional container is missing + InsertUnique(param, &(*rpcs_tbl.rpcs[rpcs.GetString(0)].parameters)); + } + } + } + if (!rpcs_tbl.rpcs.is_initialized()) { + rpcs_tbl.rpcs.set_to_null(); + } + rpcs.Reset(); + (*groups)[func_group.GetString(1)] = rpcs_tbl; + } + return true; +} + +bool SQLPTRepresentation::GatherConsumerFriendlyMessages( + policy_table::ConsumerFriendlyMessages* messages) const { + LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) { + LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages"); + return false; + } + messages->version = query.GetString(0); + return true; +} + +bool SQLPTRepresentation::GatherApplicationPolicies( + policy_table::ApplicationPolicies* apps) const { + LOG4CXX_INFO(logger_, "Gather applications policies"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectAppPolicies)) { + LOG4CXX_WARN(logger_, "Incorrect select from app_policies"); + return false; + } + + while (query.Next()) { + rpc::Nullable<policy_table::ApplicationParams> params; + const std::string& app_id = query.GetString(0); + if (IsApplicationRevoked(app_id)) { + params.set_to_null(); + (*apps)[app_id] = params; + continue; + } + if (IsDefaultPolicy(app_id)) { + (*apps)[app_id].set_to_string(kDefaultId); + } + if (IsPredataPolicy(app_id)) { + (*apps)[app_id].set_to_string(kPreDataConsentId); + } + policy_table::Priority priority; + policy_table::EnumFromJsonString(query.GetString(1), &priority); + params.priority = priority; + + *params.memory_kb = query.GetInteger(2); + *params.heart_beat_timeout_ms = query.GetInteger(3); + if (!query.IsNull(3)) { + *params.certificate = query.GetString(4); + } + if (!GatherAppGroup(app_id, ¶ms.groups)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!GatherNickName(app_id, &*params.nicknames)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!GatherAppType(app_id, &*params.AppHMIType)) { + return false; + } + (*apps)[app_id] = params; + } + return true; +} + +bool SQLPTRepresentation::Save(const policy_table::Table& table) { + LOG4CXX_INFO(logger_, "SQLPTRepresentation::Save"); + db_->BeginTransaction(); + if (!SaveFunctionalGroupings(table.policy_table.functional_groupings)) { + db_->RollbackTransaction(); + return false; + } + if (!SaveApplicationPolicies(table.policy_table.app_policies)) { + db_->RollbackTransaction(); + return false; + } + if (!SaveModuleConfig(table.policy_table.module_config)) { + db_->RollbackTransaction(); + return false; + } + if (!SaveConsumerFriendlyMessages( + *table.policy_table.consumer_friendly_messages)) { + db_->RollbackTransaction(); + return false; + } + + if (!SaveDeviceData(*table.policy_table.device_data)) { + db_->RollbackTransaction(); + return false; + } + if (!SaveUsageAndErrorCounts(*table.policy_table.usage_and_error_counts)) { + db_->RollbackTransaction(); + return false; + } + if (!SaveModuleMeta(*table.policy_table.module_meta)) { + db_->RollbackTransaction(); + return false; + } + db_->CommitTransaction(); + return true; +} + +bool SQLPTRepresentation::SaveFunctionalGroupings( + const policy_table::FunctionalGroupings& groups) { + dbms::SQLQuery query_delete(db()); + if (!query_delete.Exec(sql_pt::kDeleteRpc)) { + LOG4CXX_WARN(logger_, "Incorrect delete from rpc."); + return false; + } + + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) { + LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + return false; + } + if (!query.Prepare(sql_pt::kInsertFunctionalGroup)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for functional groups"); + return false; + } + + policy_table::FunctionalGroupings::const_iterator it; + + for (it = groups.begin(); it != groups.end(); ++it) { + // Since we uses this id in other tables, we have to be sure + // that id for certain group will be same in case when + // we drop records from the table and add them again. + // That's why we use hash as a primary key insted of + // simple auto incremental index. + const long int id = abs(CacheManager::GenerateHash(it->first)); + // SQLite's Bind doesn support 'long' type + // So we need to explicitly cast it to int64_t + // to avoid ambiguity. + query.Bind(0, static_cast<int64_t>(id)); + query.Bind(1, it->first); + it->second.user_consent_prompt.is_initialized() ? + query.Bind(2, *(it->second.user_consent_prompt)) : query.Bind(2); + + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into functional groups"); + return false; + } + + if (!SaveRpcs(query.LastInsertId(), it->second.rpcs)) { + return false; + } + } + return true; +} + +bool SQLPTRepresentation::SaveRpcs(int64_t group_id, + const policy_table::Rpc& rpcs) { + dbms::SQLQuery query(db()); + dbms::SQLQuery query_parameter(db()); + if (!query.Prepare(sql_pt::kInsertRpc) + || !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc"); + return false; + } + + policy_table::Rpc::const_iterator it; + for (it = rpcs.begin(); it != rpcs.end(); ++it) { + const policy_table::HmiLevels& hmi_levels = it->second.hmi_levels; + // TODO(IKozyrenko): Check logic if optional container is missing + const policy_table::Parameters& parameters = *it->second.parameters; + policy_table::HmiLevels::const_iterator hmi_it; + policy_table::Parameters::const_iterator ps_it; + for (hmi_it = hmi_levels.begin(); hmi_it != hmi_levels.end(); ++hmi_it) { + if (!parameters.empty()) { + for (ps_it = parameters.begin(); ps_it != parameters.end(); ++ps_it) { + query_parameter.Bind(0, it->first); + query_parameter.Bind( + 1, std::string(policy_table::EnumToJsonString(*hmi_it))); + query_parameter.Bind( + 2, std::string(policy_table::EnumToJsonString(*ps_it))); + query_parameter.Bind(3, group_id); + if (!query_parameter.Exec() || !query_parameter.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter"); + return false; + } + } + } else { + query.Bind(0, it->first); + query.Bind(1, std::string(policy_table::EnumToJsonString(*hmi_it))); + query.Bind(2, group_id); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into rpc"); + return false; + } + } + } + } + + return true; +} + +bool SQLPTRepresentation::SaveApplicationPolicies( + const policy_table::ApplicationPolicies& apps) { + dbms::SQLQuery query_delete(db()); + if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) { + LOG4CXX_WARN(logger_, "Incorrect delete from app_group."); + return false; + } + if (!query_delete.Exec(sql_pt::kDeleteApplication)) { + LOG4CXX_WARN(logger_, "Incorrect delete from application."); + return false; + } + + // All predefined apps (e.g. default, pre_DataConsent) should be saved first, + // otherwise another app with the predefined permissions can get incorrect + // permissions + policy_table::ApplicationPolicies::const_iterator it_default = + apps.find(kDefaultId); + if (apps.end() != it_default) { + if (!SaveSpecificAppPolicy(*it_default)) { + return false; + } + } + policy_table::ApplicationPolicies::const_iterator it_pre_data_consented = + apps.find(kPreDataConsentId); + if (apps.end() != it_pre_data_consented) { + if (!SaveSpecificAppPolicy(*it_pre_data_consented)) { + return false; + } + } + policy_table::ApplicationPolicies::const_iterator it_device = + apps.find(kDeviceId); + if (apps.end() != it_pre_data_consented) { + if (!SaveSpecificAppPolicy(*it_device)) { + return false; + } + } + policy_table::ApplicationPolicies::const_iterator it; + for (it = apps.begin(); it != apps.end(); ++it) { + // Skip saving of predefined app, since they should be saved before + if (IsPredefinedApp(*it)) { + continue; + } + if (!SaveSpecificAppPolicy(*it)) { + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveSpecificAppPolicy( + const policy_table::ApplicationPolicies::value_type& app) { + dbms::SQLQuery app_query(db()); + if (!app_query.Prepare(sql_pt::kInsertApplication)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + return false; + } + + app_query.Bind(0, app.first); + app_query.Bind(1, std::string(policy_table::EnumToJsonString(app.second.priority))); + app_query.Bind(2, app.second.is_null()); + app_query.Bind(3, *app.second.memory_kb); + app_query.Bind(4, *app.second.heart_beat_timeout_ms); + app.second.certificate.is_initialized() ? + app_query.Bind(5, *app.second.certificate) : app_query.Bind(5); + + if (!app_query.Exec() || !app_query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into application."); + return false; + } + + if (app.second.is_string()) { + if (kDefaultId.compare(app.second.get_string()) == 0) { + if (!SetDefaultPolicy(app.first)) { + return false; + } + // Stop saving other params, since predefined permissions already set + return true; + } + } + + if (!SaveAppGroup(app.first, app.second.groups)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!SaveNickname(app.first, *app.second.nicknames)) { + return false; + } + // TODO(IKozyrenko): Check logic if optional container is missing + if (!SaveAppType(app.first, *app.second.AppHMIType)) { + return false; + } + + return true; +} + +bool SQLPTRepresentation::SaveAppGroup( + const std::string& app_id, const policy_table::Strings& app_groups) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertAppGroup)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for app group"); + return false; + } + LOG4CXX_INFO(logger_, "SaveAppGroup"); + policy_table::Strings::const_iterator it; + for (it = app_groups.begin(); it != app_groups.end(); ++it) { + std::string ssss = *it; + LOG4CXX_INFO(logger_, "Group: " << ssss); + query.Bind(0, app_id); + query.Bind(1, *it); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN( + logger_, + "Incorrect insert into app group." << query.LastError().text()); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveNickname(const std::string& app_id, + const policy_table::Strings& nicknames) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertNickname)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname"); + return false; + } + + policy_table::Strings::const_iterator it; + for (it = nicknames.begin(); it != nicknames.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, *it); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into nickname."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveAppType(const std::string& app_id, + const policy_table::AppHMITypes& types) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertAppType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for app type"); + return false; + } + + policy_table::AppHMITypes::const_iterator it; + for (it = types.begin(); it != types.end(); ++it) { + query.Bind(0, app_id); + query.Bind(1, std::string(policy_table::EnumToJsonString(*it))); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into app type."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) { + // Section Module Meta is empty for SDL specific + return true; +} + +bool SQLPTRepresentation::SaveModuleConfig( + const policy_table::ModuleConfig& config) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdateModuleConfig)) { + LOG4CXX_WARN(logger_, "Incorrect update statement for module config"); + return false; + } + + config.preloaded_pt.is_initialized() ? + query.Bind(0, config.preloaded_pt) : query.Bind(0, false); + query.Bind(1, config.exchange_after_x_ignition_cycles); + query.Bind(2, config.exchange_after_x_kilometers); + query.Bind(3, config.exchange_after_x_days); + query.Bind(4, config.timeout_after_x_seconds); + config.vehicle_make.is_initialized() ? + query.Bind(5, *(config.vehicle_make)) : query.Bind(5); + config.vehicle_model.is_initialized() ? + query.Bind(6, *(config.vehicle_model)) : query.Bind(6); + config.vehicle_year.is_initialized() ? + query.Bind(7, *(config.vehicle_year)) : query.Bind(7); + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect update module config"); + return false; + } + + if (!SaveSecondsBetweenRetries(config.seconds_between_retries)) { + return false; + } + + if (!SaveNumberOfNotificationsPerMinute( + config.notifications_per_minute_by_priority)) { + return false; + } + + if (!SaveServiceEndpoints(config.endpoints)) { + return false; + } + + return true; +} + +bool SQLPTRepresentation::SaveServiceEndpoints( + const policy_table::ServiceEndpoints& endpoints) { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteEndpoint)) { + LOG4CXX_WARN(logger_, "Incorrect delete from endpoint."); + return false; + } + + if (!query.Prepare(sql_pt::kInsertEndpoint)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for endpoint"); + return false; + } + + policy_table::ServiceEndpoints::const_iterator it; + for (it = endpoints.begin(); it != endpoints.end(); ++it) { + const policy_table::URLList& apps = it->second; + policy_table::URLList::const_iterator app_it; + for (app_it = apps.begin(); app_it != apps.end(); ++app_it) { + const policy_table::URL& urls = app_it->second; + policy_table::URL::const_iterator url_it; + for (url_it = urls.begin(); url_it != urls.end(); ++url_it) { + std::stringstream temp_stream(it->first); + int service; + temp_stream.seekg(3); + temp_stream >> service; + query.Bind(0, service); + query.Bind(1, *url_it); + query.Bind(2, app_it->first); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into endpoint"); + return false; + } + } + } + } + + return true; +} + +bool SQLPTRepresentation::SaveConsumerFriendlyMessages( + const policy_table::ConsumerFriendlyMessages& messages) { + LOG4CXX_TRACE_ENTER(logger_); + + // According CRS-2419 If there is no “consumer_friendly_messages” key, + // the current local consumer_friendly_messages section shall be maintained in + // the policy table. So it won't be changed/updated + if (messages.messages.is_initialized()) { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteMessageString)) { + LOG4CXX_WARN(logger_, "Incorrect delete from message."); + return false; + } + + if (query.Prepare(sql_pt::kUpdateVersion)) { + query.Bind(0, messages.version); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect update into version."); + return false; + } + } else { + LOG4CXX_WARN(logger_, "Incorrect update statement for version."); + return false; + } + + policy_table::Messages::const_iterator it; + // TODO(IKozyrenko): Check logic if optional container is missing + for (it = messages.messages->begin(); it != messages.messages->end(); ++it) { + if (!SaveMessageType(it->first)) { + return false; + } + const policy_table::Languages& langs = it->second.languages; + policy_table::Languages::const_iterator lang_it; + for (lang_it = langs.begin(); lang_it != langs.end(); ++lang_it) { + if (!SaveLanguage(lang_it->first)) { + return false; + } + if (!SaveMessageString(it->first, lang_it->first, lang_it->second)) { + return false; + } + } + } + } else { + LOG4CXX_INFO(logger_, "Messages list is empty"); + } + + return true; +} + +bool SQLPTRepresentation::SaveMessageType(const std::string& type) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertMessageType)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for message type."); + return false; + } + + query.Bind(0, type); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into message type."); + return false; + } + + return true; +} + +bool SQLPTRepresentation::SaveLanguage(const std::string& code) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertLanguage)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for language."); + return false; + } + + query.Bind(0, code); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into language."); + return false; + } + + return true; +} + +bool SQLPTRepresentation::SaveMessageString( + const std::string& type, const std::string& lang, + const policy_table::MessageString& strings) { + // Section is empty for SDL specific + return true; +} + +bool SQLPTRepresentation::SaveSecondsBetweenRetries( + const policy_table::SecondsBetweenRetries& seconds) { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) { + LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries."); + return false; + } + if (!query.Prepare(sql_pt::kInsertSecondsBetweenRetry)) { + LOG4CXX_WARN(logger_, + "Incorrect insert statement for seconds between retries."); + return false; + } + + for (uint32_t i = 0; i < seconds.size(); ++i) { + query.Bind(0, static_cast<int>(i)); + query.Bind(1, seconds[i]); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into seconds between retries."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute( + const policy_table::NumberOfNotificationsPerMinute& notifications) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) { + LOG4CXX_WARN(logger_, + "Incorrect insert statement for notifications by priority."); + return false; + } + + policy_table::NumberOfNotificationsPerMinute::const_iterator it; + for (it = notifications.begin(); it != notifications.end(); ++it) { + query.Bind(0, it->first); + query.Bind(1, it->second); + if (!query.Exec() || !query.Reset()) { + LOG4CXX_WARN(logger_, "Incorrect insert into notifications by priority."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveDeviceData( + const policy_table::DeviceData& devices) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertDeviceData)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for device data."); + return false; + } + + policy_table::DeviceData::const_iterator it; + for (it = devices.begin(); it != devices.end(); ++it) { + query.Bind(0, it->first); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into device data."); + return false; + } + } + + return true; +} + +bool SQLPTRepresentation::SaveUsageAndErrorCounts( + const policy_table::UsageAndErrorCounts& counts) { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kDeleteAppLevel)) { + LOG4CXX_WARN(logger_, "Incorrect delete from app level."); + return false; + } + if (!query.Prepare(sql_pt::kInsertAppLevel)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement for app level."); + return false; + } + + policy_table::AppLevels::const_iterator it; + const policy_table::AppLevels& app_levels = *counts.app_level; + for (it = app_levels.begin(); it != app_levels.end(); ++it) { + query.Bind(0, it->first); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Incorrect insert into app level."); + return false; + } + } + return true; +} + +void SQLPTRepresentation::IncrementIgnitionCycles() { + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) { + LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles"); + } +} + +void SQLPTRepresentation::ResetIgnitionCycles() { + LOG4CXX_INFO(logger_, "ResetIgnitionCycles"); + dbms::SQLQuery query(db()); + if (!query.Exec(sql_pt::kResetIgnitionCycles)) { + LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number."); + } +} + +bool SQLPTRepresentation::UpdateRequired() const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) { + LOG4CXX_WARN(logger_, + "Failed select update required flag from module meta"); + return false; + } + return query.GetBoolean(0); +} + +void SQLPTRepresentation::SaveUpdateRequired(bool value) { + dbms::SQLQuery query(db()); + // TODO(AOleynik): Quick fix, will be reworked + if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/ + "UPDATE `module_meta` SET `flag_update_required` = ?")) { + LOG4CXX_WARN(logger_, + "Incorrect update into module meta (update_required): " << + strerror(errno)); + return; + } + query.Bind(0, value); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed update module meta (update_required)"); + } +} + +bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id, + StringArray* nicknames, + StringArray* app_types) { + LOG4CXX_INFO(logger_, "Getting initial application data."); + dbms::SQLQuery app_names(db()); + if (!app_names.Prepare(sql_pt::kSelectNicknames)) { + LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + return false; + } + dbms::SQLQuery app_hmi_types(db()); + if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) { + LOG4CXX_WARN(logger_, "Incorrect select from app types"); + return false; + } + app_names.Bind(0, app_id); + while (app_names.Next()) { + nicknames->push_back(app_names.GetString(0)); + } + app_names.Reset(); + app_hmi_types.Bind(0, app_id); + while (app_hmi_types.Next()) { + app_types->push_back(app_hmi_types.GetString(0)); + } + app_hmi_types.Reset(); + return true; +} + +bool SQLPTRepresentation::GetFunctionalGroupings( + policy_table::FunctionalGroupings& groups) { + LOG4CXX_INFO(logger_, "GetFunctionalGroupings"); + return GatherFunctionalGroupings(&groups); +} + +bool SQLPTRepresentation::GatherAppType( + const std::string& app_id, policy_table::AppHMITypes* app_types) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectAppTypes)) { + LOG4CXX_WARN(logger_, "Incorrect select from app types"); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + policy_table::AppHMIType type; + if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) { + return false; + } + app_types->push_back(type); + } + return true; +} + +bool SQLPTRepresentation::GatherNickName( + const std::string& app_id, policy_table::Strings* nicknames) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectNicknames)) { + LOG4CXX_WARN(logger_, "Incorrect select from app nicknames"); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + nicknames->push_back(query.GetString(0)); + } + return true; +} + +bool SQLPTRepresentation::GatherAppGroup( + const std::string& app_id, policy_table::Strings* app_groups) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectAppGroups)) { + LOG4CXX_WARN(logger_, "Incorrect select from app groups"); + return false; + } + + query.Bind(0, app_id); + while (query.Next()) { + app_groups->push_back(query.GetString(0)); + } + return true; +} + +bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id, + bool is_revoked, + bool is_default, + bool is_predata) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) { + LOG4CXX_WARN(logger_, "Incorrect update in application"); + return false; + } + + query.Bind(0, is_revoked); + query.Bind(1, is_default); + query.Bind(2, is_predata); + query.Bind(3, app_id); + + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed update in application"); + return false; + } + + return true; +} + +bool SQLPTRepresentation::IsApplicationRevoked( + const std::string& app_id) const { + + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) { + LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application"); + } + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed select is_revoked of application"); + return false; + } + return query.IsNull(0) ? false : query.GetBoolean(0); + } +bool SQLPTRepresentation::IsApplicationRepresented( + const std::string& app_id) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) { + LOG4CXX_WARN(logger_, "Incorrect select application by id"); + return false; + } + + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed select application by id"); + return false; + } + return query.GetInteger(0) != 0; +} + +bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) { + LOG4CXX_WARN(logger_, "Incorrect select application by id"); + return false; + } + + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed select application by id"); + return false; + } + return query.IsNull(0) ? false : query.GetBoolean(0); +} + +bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const { + return false; +} + +bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) { + LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group."); + return false; + } + query.Bind(0, app_id); + if (!query.Exec()) { + LOG4CXX_ERROR(logger_, "Failed deleting from app_group."); + return false; + } + + if (!CopyApplication(kDefaultId, app_id)) { + return false; + } + + SetPreloaded(false); + + policy_table::Strings default_groups; + if (GatherAppGroup(kDefaultId, &default_groups) && + SaveAppGroup(app_id, default_groups)) { + return SetIsDefault(app_id, true); + } + return false; +} + +bool SQLPTRepresentation::SetIsDefault(const std::string& app_id, + bool is_default) const { + LOG4CXX_TRACE(logger_, "Set flag is_default of application"); + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdateIsDefault)) { + LOG4CXX_WARN(logger_, "Incorect statement for updating is_default"); + return false; + } + + query.Bind(0, is_default); + query.Bind(1, app_id); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed update is_default"); + return false; + } + return true; +} + +dbms::SQLDatabase* SQLPTRepresentation::db() const { +#ifdef __QNX__ + dbms::SQLDatabase* db = new dbms::SQLDatabase(kDatabaseName); + db->Open(); + return db; +#else + return db_; +#endif +} + +bool SQLPTRepresentation::CopyApplication(const std::string& source, + const std::string& destination) { + dbms::SQLQuery source_app(db()); + if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) { + LOG4CXX_WARN(logger_, "Incorrect select statement from application."); + return false; + } + source_app.Bind(0, source); + if (!source_app.Exec()) { + LOG4CXX_WARN(logger_, "Failed selecting from application."); + return false; + } + + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kInsertApplicationFull)) { + LOG4CXX_WARN(logger_, "Incorrect insert statement into application."); + return false; + } + query.Bind(0, destination); + source_app.IsNull(0) ? query.Bind(1) + : query.Bind(1, source_app.GetBoolean(0)); + source_app.IsNull(1) ? query.Bind(2) + : query.Bind(2, source_app.GetBoolean(1)); + source_app.IsNull(2) ? query.Bind(3) + : query.Bind(3, source_app.GetString(2)); + source_app.IsNull(3) ? query.Bind(4) + : query.Bind(4, source_app.GetString(3)); + source_app.IsNull(4) ? query.Bind(5) + : query.Bind(5, source_app.GetBoolean(4)); + source_app.IsNull(5) ? query.Bind(6) + : query.Bind(6, source_app.GetBoolean(5)); + source_app.IsNull(6) ? query.Bind(7) + : query.Bind(7, source_app.GetBoolean(6)); + query.Bind(8, source_app.GetInteger(7)); + query.Bind(9, source_app.GetInteger(8)); + source_app.IsNull(9) ? query.Bind(10) + : query.Bind(10, source_app.GetString(9)); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed inserting into application."); + return false; + } + return true; +} + +void SQLPTRepresentation::SetPreloaded(bool value) { + dbms::SQLQuery query(db()); + if (!query.Prepare(sql_pt::kUpdatePreloaded)) { + LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded."); + return; + } + + query.Bind(0, value); + if (!query.Exec()) { + LOG4CXX_WARN(logger_, "Failed updating preloaded."); + return; + } +} + +bool SQLPTRepresentation::SetVINValue(const std::string& value) { + return true; +} + +} // namespace policy diff --git a/src/components/policy/src/policy/src/update_status_manager.cc b/src/components/policy/src/policy/src/update_status_manager.cc new file mode 100644 index 0000000000..872e0c3e98 --- /dev/null +++ b/src/components/policy/src/policy/src/update_status_manager.cc @@ -0,0 +1,159 @@ +/* + Copyright (c) 2014, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "policy/update_status_manager.h" +#include "policy/policy_listener.h" +#include "utils/logger.h" + +namespace policy { + +CREATE_LOGGERPTR_GLOBAL(logger_, "UpdateStatusManager") + +UpdateStatusManager::UpdateStatusManager() : + listener_(NULL), + exchange_in_progress_(false), + update_required_(false), + exchange_pending_(false), + last_update_status_(policy::StatusUnknown), + update_response_timer_(this) { +} + +UpdateStatusManager::~UpdateStatusManager() { + LOG4CXX_DEBUG(logger_, "Destroy update Status manager"); +} + +void UpdateStatusManager::set_listener(PolicyListener* listener) { + listener_ = listener; +} + +void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) { + LOG4CXX_INFO(logger_, "OnUpdateSentOut"); + update_response_timer_.start(update_timeout); + set_exchange_in_progress(true); +} + +void UpdateStatusManager::OnUpdateTimeoutOccurs() { + LOG4CXX_INFO(logger_, "OnUpdateTimeoutOccurs"); + set_update_required(true); + set_exchange_in_progress(false); +} + +void UpdateStatusManager::OnValidUpdateReceived() { + LOG4CXX_INFO(logger_, "OnValidUpdateReceived"); + update_response_timer_.stop(); + set_update_required(false); + set_exchange_in_progress(false); +} + +void UpdateStatusManager::OnWrongUpdateReceived() { + LOG4CXX_INFO(logger_, "OnWrongUpdateReceived"); + update_response_timer_.stop(); + set_update_required(true); + set_exchange_in_progress(false); +} + +void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) { + LOG4CXX_INFO(logger_, "OnResetDefaultPT"); + exchange_in_progress_ = false; + update_required_ = is_update_required; + exchange_pending_ = false; + last_update_status_ = policy::StatusUnknown; +} + +void UpdateStatusManager::OnResetRetrySequence() { + LOG4CXX_INFO(logger_, "OnResetRetrySequence"); + if (exchange_in_progress_) { + set_exchange_pending(true); + } + set_update_required(true); +} + +void UpdateStatusManager::OnNewApplicationAdded() { + LOG4CXX_INFO(logger_, "OnNewApplicationAdded"); + set_update_required(true); +} + +void UpdateStatusManager::OnPolicyInit(bool is_update_required) { + LOG4CXX_INFO(logger_, "OnPolicyInit"); + update_required_ = is_update_required; +} + +PolicyTableStatus UpdateStatusManager::GetUpdateStatus() { + LOG4CXX_INFO(logger_, "GetUpdateStatus"); + if (!exchange_in_progress_ && !exchange_pending_ && !update_required_) { + return PolicyTableStatus::StatusUpToDate; + } + + if (update_required_ && !exchange_in_progress_ && !exchange_pending_) { + return PolicyTableStatus::StatusUpdateRequired; + } + + return PolicyTableStatus::StatusUpdatePending; +} + +void UpdateStatusManager::CheckUpdateStatus() { + LOG4CXX_INFO(logger_, "CheckUpdateStatus"); + policy::PolicyTableStatus status = GetUpdateStatus(); + if (listener_ && last_update_status_ != status) { + listener_->OnUpdateStatusChanged(status); + } + last_update_status_ = status; +} + +void UpdateStatusManager::set_exchange_in_progress(bool value) { + sync_primitives::AutoLock lock(exchange_in_progress_lock_); + LOG4CXX_INFO(logger_, + "Exchange in progress value is:" << std::boolalpha << value); + exchange_in_progress_ = value; + CheckUpdateStatus(); +} + +void UpdateStatusManager::set_exchange_pending(bool value) { + sync_primitives::AutoLock lock(exchange_pending_lock_); + LOG4CXX_INFO(logger_, + "Exchange pending value is:" << std::boolalpha << value); + exchange_pending_ = value; + CheckUpdateStatus(); +} + +void UpdateStatusManager::set_update_required(bool value) { + sync_primitives::AutoLock lock(update_required_lock_); + LOG4CXX_INFO(logger_, "Update required value is:" << std::boolalpha << value); + update_required_ = value; + CheckUpdateStatus(); +} + +UpdateStatusManager::UpdateResponseTimer::~UpdateResponseTimer() { + LOG4CXX_DEBUG(logger_, "Destroy update Status manager timer"); +} + +} // namespace policy diff --git a/src/components/policy/src/policy/usage_statistics/CMakeLists.txt b/src/components/policy/src/policy/usage_statistics/CMakeLists.txt new file mode 100644 index 0000000000..b57431b8f8 --- /dev/null +++ b/src/components/policy/src/policy/usage_statistics/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (c) 2014, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +include_directories(include) + +set(SOURCES + src/counter.cc +) + +add_library(UsageStatistics ${SOURCES}) diff --git a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h new file mode 100644 index 0000000000..35147344c6 --- /dev/null +++ b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h @@ -0,0 +1,93 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_COUNTER_H +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_COUNTER_H + +#include <ctime> +#include "usage_statistics/statistics_manager.h" +#include "utils/shared_ptr.h" +namespace usage_statistics { + +class GlobalCounter { + public: + GlobalCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + GlobalCounterId counter_type); + void operator++() const; + private: + GlobalCounterId counter_type_; + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_; +}; + +class AppCounter { + public: + AppCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + const std::string& app_id, + AppCounterId counter_type); + void operator++() const; + private: + std::string app_id_; + AppCounterId counter_type_; + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_; +}; + +class AppInfo { + public: + AppInfo(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + const std::string& app_id, + AppInfoId info_type); + void Update(const std::string& new_info) const; + private: + std::string app_id_; + AppInfoId info_type_; + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_; +}; + +class AppStopwatch { + public: + AppStopwatch(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + const std::string& app_id); + ~AppStopwatch(); + void Start(AppStopwatchId stopwatch_type); + void Switch(AppStopwatchId stopwatch_type); + void Stop(); + private: + // Fields + std::string app_id_; + AppStopwatchId stopwatch_type_; + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_; + time_t start_time_; +}; + +} // namespace usage_statistics + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_COUNTER_H diff --git a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h new file mode 100644 index 0000000000..3af8f4c195 --- /dev/null +++ b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h @@ -0,0 +1,84 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ + +#include <stdint.h> +#include <string> + +namespace usage_statistics { + +enum GlobalCounterId { + IAP_BUFFER_FULL, + SYNC_OUT_OF_MEMORY, + SYNC_REBOOTS +}; + +enum AppInfoId { + LANGUAGE_GUI, + LANGUAGE_VUI +}; + +enum AppStopwatchId { + SECONDS_HMI_FULL, + SECONDS_HMI_LIMITED, + SECONDS_HMI_BACKGROUND, + SECONDS_HMI_NONE +}; + +enum AppCounterId { + USER_SELECTIONS, + REJECTIONS_SYNC_OUT_OF_MEMORY, + REJECTIONS_NICKNAME_MISMATCH, + REJECTIONS_DUPLICATE_NAME, + REJECTED_RPC_CALLS, + RPCS_IN_HMI_NONE, + REMOVALS_MISBEHAVED, + RUN_ATTEMPTS_WHILE_REVOKED +}; + +class StatisticsManager { + public: + virtual ~StatisticsManager() {} + virtual void Increment(GlobalCounterId type) = 0; + virtual void Increment(const std::string& app_id, AppCounterId type) = 0; + virtual void Set(const std::string& app_id, AppInfoId type, + const std::string& value) = 0; + virtual void Add(const std::string& app_id, + AppStopwatchId type, + int32_t timespan_seconds) = 0; +}; + +} // namespace usage_statistics + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_ diff --git a/src/components/policy/src/policy/usage_statistics/src/counter.cc b/src/components/policy/src/policy/usage_statistics/src/counter.cc new file mode 100644 index 0000000000..6375db8f89 --- /dev/null +++ b/src/components/policy/src/policy/usage_statistics/src/counter.cc @@ -0,0 +1,117 @@ +/* + Copyright (c) 2013, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_ + +#include "usage_statistics/counter.h" +#include <cassert> + +namespace usage_statistics { + +GlobalCounter::GlobalCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + GlobalCounterId counter_type) + : counter_type_(counter_type), + statistics_manager_(statistics_manager) { +} + +void GlobalCounter::operator++() const { + if (statistics_manager_) { + statistics_manager_->Increment(counter_type_); + } +} + +AppCounter::AppCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + const std::string& app_id, + AppCounterId counter_type) + : app_id_(app_id), + counter_type_(counter_type), + statistics_manager_(statistics_manager) { +} + +void AppCounter::operator++() const { + if (statistics_manager_) { + statistics_manager_->Increment(app_id_, counter_type_); + } +} + +AppInfo::AppInfo(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + const std::string& app_id, + AppInfoId info_type) + : app_id_(app_id), + info_type_(info_type), + statistics_manager_(statistics_manager) { +} + +void AppInfo::Update(const std::string& new_info) const { + if (statistics_manager_) { + statistics_manager_->Set(app_id_, info_type_, new_info); + } +} + +AppStopwatch::AppStopwatch(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + const std::string& app_id) + : app_id_(app_id), + stopwatch_type_(SECONDS_HMI_NONE), + statistics_manager_(statistics_manager), + start_time_() { +} + +AppStopwatch::~AppStopwatch() { + if (start_time_) { + Stop(); + } +} + +void AppStopwatch::Start(AppStopwatchId stopwatch_type) { + assert(0 == start_time_); + stopwatch_type_ = stopwatch_type; + start_time_ = time(NULL); +} + +void AppStopwatch::Switch(AppStopwatchId stopwatch_type) { + Stop(); + Start(stopwatch_type); +} + +void AppStopwatch::Stop() { + assert(start_time_ != 0); + double difference = difftime(time(NULL), start_time_); + if (statistics_manager_) { + statistics_manager_->Add(app_id_, stopwatch_type_, int32_t(difference)); + } + start_time_ = 0; +} + +} // namespace usage_statistics + +#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_ diff --git a/src/components/policy/test/CMakeLists.txt b/src/components/policy/test/CMakeLists.txt new file mode 100644 index 0000000000..1b39d5a25a --- /dev/null +++ b/src/components/policy/test/CMakeLists.txt @@ -0,0 +1,96 @@ +# Copyright (c) 2013-2014, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +include_directories( + include + ${GMOCK_INCLUDE_DIRECTORY} + ${JSONCPP_INCLUDE_DIRECTORY} + ../src/policy/include/ + ../src/policy/sqlite_wrapper/include + ../src/policy/qdb_wrapper/include + ../src/policy/usage_statistics/include + ${CMAKE_SOURCE_DIR}/src/components/rpc_base/include + ${CMAKE_SOURCE_DIR}/src/components/utils/include/ +) + +set(testLibraries + gtest + gmock + Utils + Policy + ${RTLIB} + dl + UsageStatistics + dbms +) + +set(testSources + main.cc + usage_statistics_test.cc + shared_library_test.cc + generated_code_test.cc + policy_manager_impl_test.cc +) + + include_directories(../src/policy/policy_table/table_struct) + list (APPEND testSources + sql_pt_representation_test.cc + ) + +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + list(REMOVE_ITEM testLibraries dl) + # --- Tests for QDB Wrapper + include_directories(../src/policy/qdb_wrapper/include) + list (APPEND testSources + qdb_wrapper/sql_database_test.cc + qdb_wrapper/sql_query_test.cc + ) + file(COPY qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY policy.sql DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +else () + # --- Tests for SQLite Wrapper + find_package(Sqlite3 REQUIRED) + include_directories(../src/policy/sqlite_wrapper/include) + list (APPEND testSources + sqlite_wrapper/sql_database_test.cc + sqlite_wrapper/sql_query_test.cc + generated_code_with_sqlite_test.cc + policy_manager_impl_stress_test.cc + ) + list (APPEND testLibraries sqlite3) +endif() + +add_executable(policy_test ${testSources}) +target_link_libraries(policy_test ${testLibraries}) + +file(COPY valid_sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/components/policy/test/generated_code_test.cc b/src/components/policy/test/generated_code_test.cc new file mode 100644 index 0000000000..3c5b013c3d --- /dev/null +++ b/src/components/policy/test/generated_code_test.cc @@ -0,0 +1,72 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <fstream> + +#include "gtest/gtest.h" + +#include "json/reader.h" +#include "json/value.h" +#include "./enums.h" +#include "./types.h" +#include "rpc_base/gtest_support.h" + +using rpc::policy_table_interface_base::Table; + +namespace test { +namespace components { +namespace policy { + +TEST(PolicyGeneratedCodeTest, TestValidPTPreloadJsonIsValid) { + std::ifstream json_file("sdl_preloaded_pt.json"); + ASSERT_TRUE(json_file.is_open()); + Json::Value valid_table; + Json::Reader reader; + ASSERT_TRUE(reader.parse(json_file, valid_table)); + Table table(&valid_table); + table.SetPolicyTableType(rpc::policy_table_interface_base::PT_PRELOADED); + ASSERT_RPCTYPE_VALID(table); +} + +TEST(PolicyGeneratedCodeTest, TestValidPTUpdateJsonIsValid) { + std::ifstream json_file("valid_sdl_pt_update.json"); + ASSERT_TRUE(json_file.is_open()); + Json::Value valid_table; + Json::Reader reader; + ASSERT_TRUE(reader.parse(json_file, valid_table)); + Table table(&valid_table); + table.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE); + ASSERT_RPCTYPE_VALID(table); +} + +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/generated_code_with_sqlite_test.cc b/src/components/policy/test/generated_code_with_sqlite_test.cc new file mode 100644 index 0000000000..8c9eef371e --- /dev/null +++ b/src/components/policy/test/generated_code_with_sqlite_test.cc @@ -0,0 +1,173 @@ +/* Copyright (c) 2013, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <sqlite3.h> + +#include "gtest/gtest.h" + +#include "generated_code_with_sqlite_test.h" + +namespace rpc { + +class GeneratedCodeTest : public ::testing::Test { + public: + static void SetUpTestCase() { + sqlite3* conn; + sqlite3_open((kDatabaseName + ".sqlite").c_str(), &conn); + sqlite3_exec(conn, kEndpointsCreation.c_str(), NULL, NULL, NULL); + sqlite3_exec(conn, kEndpointsContent.c_str(), NULL, NULL, NULL); + sqlite3_exec(conn, kAppPoliciesCreation.c_str(), NULL, NULL, NULL); + sqlite3_exec(conn, kGroupsCreation.c_str(), NULL, NULL, NULL); + sqlite3_close(conn); + } + + static void TearDownTestCase() { + remove((kDatabaseName + ".sqlite").c_str()); + } + + static const std::string kDatabaseName; + static const std::string kEndpointsCreation; + static const std::string kEndpointsContent; + static const std::string kAppPoliciesCreation; + static const std::string kGroupsCreation; +}; + +const std::string GeneratedCodeTest::kDatabaseName = "test_db"; + +const std::string GeneratedCodeTest::kEndpointsCreation = "CREATE TABLE Endpoints (" + "endpoint_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "service_id VARCHAR(45) NOT NULL," + "application_id VARCHAR(45)," + "url VARCHAR(45) NOT NULL," + "is_default INTEGER NOT NULL CHECK(is_default>=0))"; + +const std::string GeneratedCodeTest::kEndpointsContent = "INSERT INTO Endpoints " + "VALUES (1, '0x07', null, 'http://test.example.com', 1)"; + +const std::string GeneratedCodeTest::kAppPoliciesCreation = "CREATE TABLE AppPolicies (" + "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "application_id VARCHAR(45)," + "priority VARCHAR(45)," + "is_default INTEGER NOT NULL CHECK(is_default>=0))"; + +const std::string GeneratedCodeTest::kGroupsCreation = "CREATE TABLE Groups (" + "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + "application_id VARCHAR(45) NOT NULL," + "group_name VARCHAR(45) NOT NULL )"; + + +TEST_F(GeneratedCodeTest, FindSectionEndpoints) { + dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName); + EXPECT_TRUE(db.Open()); + policy_table::ServiceEndpoints ep; + EXPECT_TRUE(policy_table::FindSection(&db, ep)); + EXPECT_EQ(1u, ep.size()); + std::string url = ep["0x07"]["default"].front(); + EXPECT_EQ("http://test.example.com", url); +} + +TEST_F(GeneratedCodeTest, RemoveSectionEndpoints) { + dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName); + EXPECT_TRUE(db.Open()); + policy_table::ServiceEndpoints ep; + EXPECT_TRUE(policy_table::RemoveSection(&db, ep)); + dbms::SQLQuery sqlquery(&db); + std::string check_query = "select count (*) from endpoints"; + EXPECT_TRUE(sqlquery.Prepare(check_query)); + EXPECT_TRUE(sqlquery.Exec()); + // Index for binding starts from 1, index for results starts from 0 + EXPECT_EQ(0, sqlquery.GetInteger(0)); +} + +TEST_F(GeneratedCodeTest, UpdateSectionEndpoints) { + dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName); + EXPECT_TRUE(db.Open()); + + std::string test_url = "http://url.example.com"; + + policy_table::URL urls; + urls.push_back(test_url); + + policy_table::URLList urllist; + urllist["default"] = urls; + + policy_table::ServiceEndpoints ep; + ep["0x07"] = urllist; + + EXPECT_TRUE(policy_table::UpdateSection(&db, ep)); + + dbms::SQLQuery sqlquery(&db); + std::string num_of_records_check = "select count (*) from endpoints"; + EXPECT_TRUE(sqlquery.Prepare(num_of_records_check)); + EXPECT_TRUE(sqlquery.Exec()); + // Index for binding starts from 1, index for results starts from 0 + EXPECT_EQ(1, sqlquery.GetInteger(0)); + EXPECT_TRUE(sqlquery.Reset()); + + std::string url_check_query = "select * from endpoints"; + EXPECT_TRUE(sqlquery.Prepare(url_check_query)); + EXPECT_TRUE(sqlquery.Exec()); + // Index for binding starts from 1, index for results starts from 0 + EXPECT_EQ(test_url, sqlquery.GetString(3)); +} + +TEST_F(GeneratedCodeTest, UpdateSectionAppPolicies) { + dbms::SQLDatabase db(GeneratedCodeTest::kDatabaseName); + EXPECT_TRUE(db.Open()); + + policy_table::ApplicationPolicies ap; + const std::string application_id = "12345678"; + ap[application_id].groups.push_back("Base-4"); + ap[application_id].priority = policy_table::P_NORMAL; + + EXPECT_TRUE(policy_table::UpdateSection(&db, ap)); + + dbms::SQLQuery sqlquery(&db); + EXPECT_TRUE(sqlquery.Prepare("select count (*) from AppPolicies")); + EXPECT_TRUE(sqlquery.Exec()); + // Index for binding starts from 1, index for results starts from 0 + EXPECT_EQ(1, sqlquery.GetInteger(0)); + EXPECT_TRUE(sqlquery.Reset()); + + EXPECT_TRUE(sqlquery.Prepare("select count (*) from Groups")); + EXPECT_TRUE(sqlquery.Exec()); + // Index for binding starts from 1, index for results starts from 0 + EXPECT_EQ(1, sqlquery.GetInteger(0)); + EXPECT_TRUE(sqlquery.Reset()); + + EXPECT_TRUE(sqlquery.Prepare("select application_id from Groups where group_name='Base-4'")); + EXPECT_TRUE(sqlquery.Exec()); + // Index for binding starts from 1, index for results starts from 0 + EXPECT_EQ(application_id, sqlquery.GetString(0)); + EXPECT_TRUE(sqlquery.Reset()); +} + +} // namespace rpc diff --git a/src/components/policy/test/include.cmake b/src/components/policy/test/include.cmake new file mode 100644 index 0000000000..fa9622e1cd --- /dev/null +++ b/src/components/policy/test/include.cmake @@ -0,0 +1,95 @@ +# Copyright (c) 2014, Ford Motor Company +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following +# disclaimer in the documentation and/or other materials provided with the +# distribution. +# +# Neither the name of the Ford Motor Company nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +set(POLICY_DIR ${CMAKE_SOURCE_DIR}/src/components/policy) + +include_directories( + ${JSONCPP_INCLUDE_DIRECTORY} + ${POLICY_DIR}/test/include + ${POLICY_DIR}/src/policy/include/ + ${POLICY_DIR}/src/policy/sqlite_wrapper/include + ${POLICY_DIR}/src/policy/qdb_wrapper/include + ${POLICY_DIR}/src/policy/usage_statistics/include + ${CMAKE_SOURCE_DIR}/src/components/rpc_base/include + ${CMAKE_SOURCE_DIR}/src/components/utils/include/ +) + +list(APPEND test_exec_libraries + Policy + UsageStatistics + dbms + Utils + dl + ${RTLIB} +) + +list(APPEND testSources + ${POLICY_DIR}/test/usage_statistics_test.cc + ${POLICY_DIR}/test/generated_code_test.cc + ${POLICY_DIR}/test/policy_manager_impl_test.cc + # TODO(KKolodiy): need to resolve issue about path to libPolicy.so + # ${POLICY_DIR}/test/shared_library_test.cc +) + +if (EXTENDED_POLICY_FLAG) + add_definitions(-DEXTENDED_POLICY) + include_directories(${POLICY_DIR}/src/policy/policy_table/table_struct_ext) + list (APPEND testSources ${POLICY_DIR}/test/sql_pt_ext_representation_test.cc) +else () + include_directories(${POLICY_DIR}/src/policy/policy_table/table_struct) + list (APPEND testSources ${POLICY_DIR}/test/sql_pt_representation_test.cc) +endif () + +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + list(REMOVE_ITEM test_exec_libraries dl) + # --- Tests for QDB Wrapper + include_directories(${POLICY_DIR}/src/policy/qdb_wrapper/include) + list (APPEND testSources + ${POLICY_DIR}/test/qdb_wrapper/sql_database_test.cc + ${POLICY_DIR}/test/qdb_wrapper/sql_query_test.cc + ) + file(COPY ${POLICY_DIR}/test/qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY ${POLICY_DIR}/test/test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY ${POLICY_DIR}/test/policy.sql DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +else () + # --- Tests for SQLite Wrapper + find_package(Sqlite3 REQUIRED) + include_directories(${POLICY_DIR}/src/policy/sqlite_wrapper/include) + list (APPEND testSources + ${POLICY_DIR}/test/sqlite_wrapper/sql_database_test.cc + ${POLICY_DIR}/test/sqlite_wrapper/sql_query_test.cc + ${POLICY_DIR}/test/generated_code_with_sqlite_test.cc + ${POLICY_DIR}/test/policy_manager_impl_stress_test.cc + ) + list (APPEND test_exec_libraries sqlite3) +endif() + +file(COPY ${POLICY_DIR}/test/valid_sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY ${POLICY_DIR}/test/sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
\ No newline at end of file diff --git a/src/components/policy/test/include/driver_dbms.h b/src/components/policy/test/include/driver_dbms.h new file mode 100644 index 0000000000..5b1a0553dd --- /dev/null +++ b/src/components/policy/test/include/driver_dbms.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_TEST_INCLUDE_DRIVER_DBMS_H_ +#define SRC_COMPONENTS_POLICY_TEST_INCLUDE_DRIVER_DBMS_H_ + +#ifdef __QNX__ +# include <qdb/qdb.h> +#else // __QNX__ +# include <sqlite3.h> +#endif // __QNX__ + +namespace test { +namespace components { +namespace policy { + +#ifdef __QNX__ +class DBMS { + public: + explicit DBMS(std::string db_name) : db_name_(db_name), conn_(0) { + } + ~DBMS() { + Close(); + } + bool Open() { + conn_ = qdb_connect(db_name_.c_str(), 0); + return conn_ != NULL; + } + void Close() { + qdb_disconnect(conn_); + } + bool Exec(const char* query) { + return -1 != qdb_statement(conn_, query); + } + int FetchOneInt(const char* query) { + int stmt = qdb_stmt_init(conn_, query, strlen(query)+1); + qdb_stmt_exec(conn_, stmt, NULL, 0); + qdb_result_t* res = qdb_getresult(conn_); + void* ret = qdb_cell(res, 0, 0); + int value = 0; + if (ret) { + value = *static_cast<int*>(ret); + } + qdb_stmt_free(conn_, stmt); + return value; + } + double FetchOneDouble(const char* query) { + int stmt = qdb_stmt_init(conn_, query, strlen(query)+1); + qdb_stmt_exec(conn_, stmt, NULL, 0); + qdb_result_t* res = qdb_getresult(conn_); + void* ret = qdb_cell(res, 0, 0); + double value = 0.0; + if (ret) { + value = *static_cast<double*>(ret); + } + qdb_stmt_free(conn_, stmt); + + return value; + } + std::string FetchOneString(const char* query) { + int stmt = qdb_stmt_init(conn_, query, strlen(query)+1); + qdb_stmt_exec(conn_, stmt, NULL, 0); + qdb_result_t* res = qdb_getresult(conn_); + void* ret = qdb_cell(res, 0, 0); + std::string value = ""; + if (ret) { + value = std::string(static_cast<const char*>(ret)); + } + qdb_stmt_free(conn_, stmt); + + return value; + } + + private: + std::string db_name_; + qdb_hdl_t* conn_; +}; + +#else // __QNX__ +class DBMS { + public: + explicit DBMS(std::string file_name) : file_name_(file_name), conn_(0) { + } + ~DBMS() { + Close(); + } + bool Open() { + return SQLITE_OK == sqlite3_open(file_name_.c_str(), &conn_); + } + void Close() { + sqlite3_close(conn_); + remove(file_name_.c_str()); + } + bool Exec(const char* query) { + return SQLITE_OK == sqlite3_exec(conn_, query, NULL, NULL, NULL); + } + int FetchOneInt(const char* query) { + sqlite3_stmt* statement; + sqlite3_prepare(conn_, query, -1, &statement, NULL); + sqlite3_step(statement); + int value = sqlite3_column_int(statement, 0); + sqlite3_finalize(statement); + return value; + } + double FethcOneDouble(const char* query) { + sqlite3_stmt* statement; + sqlite3_prepare(conn_, query, -1, &statement, NULL); + sqlite3_step(statement); + double value = sqlite3_column_double(statement, 0); + sqlite3_finalize(statement); + return value; + } + std::string FetchOneString(const char* query) { + sqlite3_stmt* statement; + sqlite3_prepare(conn_, query, -1, &statement, NULL); + sqlite3_step(statement); + const unsigned char* txt = sqlite3_column_text(statement, 0); + std::string value = std::string(reinterpret_cast<const char*>(txt)); + sqlite3_finalize(statement); + return value; + } + + private: + std::string file_name_; + sqlite3* conn_; +}; +#endif // __QNX__ + +} // namespace policy +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_POLICY_TEST_INCLUDE_DRIVER_DBMS_H_ diff --git a/src/components/policy/test/include/generated_code_with_sqlite_test.h b/src/components/policy/test/include/generated_code_with_sqlite_test.h new file mode 100644 index 0000000000..ed231e92d3 --- /dev/null +++ b/src/components/policy/test/include/generated_code_with_sqlite_test.h @@ -0,0 +1,399 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_GENERATED_CODE_WITH_SQLITE_TEST_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_GENERATED_CODE_WITH_SQLITE_TEST_H_ + +#include <string> +#include "./types.h" +#include "rpc_base/rpc_base.h" +#include "sqlite_wrapper/sql_query.h" +#include "sqlite_wrapper/sql_database.h" + +namespace policy_table = rpc::policy_table_interface_base; +namespace dbms = policy::dbms; + +namespace rpc { +namespace policy_table_interface_base { + +bool FindSection(dbms::SQLDatabase* db, policy_table::ServiceEndpoints& ep) { + /* + * Following table structure is assumed: + * + * table Endpoints + * index, service_type, application_id, url, is_default + * + * If url belongs to default section, application_id should be null and is_defaut = true + * Otherwise application_id should be set and is_default = false + */ + + std::string query = "select * from Endpoints"; + + dbms::SQLQuery sqlquery(db); + sqlquery.Prepare(query); + if (!sqlquery.Exec()) { + return false; + } + + /* + * Following query result is assumed (data from wp1_policy_table.json): + * 1, 0x07, null, http://applinkqa.trafficmanager.net/api/policies, true + */ + + policy_table::URL urls; + urls.push_back(sqlquery.GetString(3)); + + policy_table::URLList urllist; + if (sqlquery.GetBoolean(4)) { + urllist["default"] = urls; + } else { + urllist[sqlquery.GetString(2)] = urls; + } + + policy_table::ServiceEndpoints new_ep; + new_ep[sqlquery.GetString(1)] = urllist; + + ep = new_ep; + + return true; +} + +bool FindSection(dbms::SQLDatabase* db, policy_table::ModuleConfig& mc) { + policy_table::ModuleConfig new_mc; + FindSection(db, new_mc.endpoints); + mc = new_mc; + + return true; +} + +bool RemoveSection(dbms::SQLDatabase* db, + const policy_table::ApplicationPolicies& ap) { + dbms::SQLQuery sqlquery(db); + bool is_policies_removed = sqlquery.Exec("delete from AppPolicies"); + // bool is_nicknames_removed = sqlquery.Exec("delete from Nicknames"); + bool is_groups_removed = sqlquery.Exec("delete from Groups"); + + return is_policies_removed /*&& is_nicknames_removed*/&& is_groups_removed; +} + +bool RemoveSection(dbms::SQLDatabase* db, + const policy_table::ServiceEndpoints& ep) { + std::string query = "delete from Endpoints"; + dbms::SQLQuery sqlquery(db); + return sqlquery.Exec(query); +} + +bool RemoveSection(dbms::SQLDatabase* db, + const policy_table::ModuleConfig& mc) { + // std::string query = "delete * from ModuleConfig"; + // sqlite::SQLQuery sqlquery(db); + // sqlquery.Exec(query); + + return RemoveSection(db, mc.endpoints); +} + +bool RemoveSection(dbms::SQLDatabase* db, + const policy_table::FunctionalGroupings& fg) { + std::string query = "delete from FunctionalGroups"; + dbms::SQLQuery sqlquery(db); + return sqlquery.Exec(query); +} + +bool UpdateSection(dbms::SQLDatabase* db, + const policy_table::ServiceEndpoints& ep) { + /* + * Following table structure is assumed: + * + * table Endpoints + * index, service_type, application_id, url, is_default + * + * If url belongs to default section, application_id should be null and is_defaut = true + * Otherwise application_id should be set and is_default = false + */ + + // According to documentation, we have to REPLACE this part on update coming, + // so we delete all data first; + if (!RemoveSection(db, ep)) { + return false; + } + + std::string query = "insert into Endpoints values(?,?,?,?,?)"; + dbms::SQLQuery sqlquery(db); + sqlquery.Prepare(query); + + policy_table::ServiceEndpoints::const_iterator it_ep = ep.begin(); + policy_table::ServiceEndpoints::const_iterator it_ep_end = ep.end(); + + // TODO: use define for int from stdint.h + for (int index = 1; it_ep != it_ep_end; ++it_ep, ++index) { + policy_table::URLList::const_iterator it_urllist = (*it_ep).second.begin(); + policy_table::URLList::const_iterator it_urllist_end = + (*it_ep).second.end(); + + for (; it_urllist != it_urllist_end; ++it_urllist) { + policy_table::URL::const_iterator it_url = (*it_urllist).second.begin(); + policy_table::URL::const_iterator it_url_end = (*it_urllist).second.end(); + + for (; it_url != it_url_end; ++it_url) { + // Index binding + sqlquery.Bind(0, index); + + // Service type binding + sqlquery.Bind(1, (*it_ep).first); + + // Application_id and is_default binding + std::string url_list_name = (*it_urllist).first; + if ("default" == url_list_name) { + sqlquery.Bind(2, "null"); + sqlquery.Bind(4, true); + } else { + sqlquery.Bind(2, url_list_name); + sqlquery.Bind(4, false); + } + + // URL binding + sqlquery.Bind(3, (*it_url)); + + if (sqlquery.Exec()) { + sqlquery.Reset(); + } else { + return false; + } + } + } + } + + return true; +} + +bool UpdateSection(dbms::SQLDatabase* db, + const policy_table::ModuleConfig& mc) { + UpdateSection(db, mc.endpoints); + return true; +} + +bool UpdateSection(dbms::SQLDatabase* db, + const policy_table::FunctionalGroupings& fg) { + /* + * Following table structure is assumed: + * + * table Rpcs - list of all available RPC commands + * index, rpc + * + * table HmiLevels -list of all available hmi levels + * index, hmi_level + * + * table Groups - list of functional group names + * index, group_name + * + * table FunctionalGroups - list of functional groups + * index, group_name_id, rpc_id, hmi_level_id + * + */ + + // According to documentation, we have to REPLACE this part on update coming, + // so we delete all data first; + if (!RemoveSection(db, fg)) { + return false; + } + + std::string query = "insert into FunctionalGroups values(" + "?," + "(select index from Groups where group_name=?)," + "(select index from Rpcs where rpc=?)," + "(select index from HmiLevels where hmi_levels=?)"; + + dbms::SQLQuery sqlquery(db); + sqlquery.Prepare(query); + + policy_table::FunctionalGroupings::const_iterator it_fg = fg.begin(); + policy_table::FunctionalGroupings::const_iterator it_fg_end = fg.end(); + + for (int index = 1; it_fg != it_fg_end; ++it_fg, ++index) { + policy_table::Rpcs rpcs = (*it_fg).second; + policy_table::Rpc::const_iterator it_rpcs = rpcs.rpcs.begin(); + policy_table::Rpc::const_iterator it_rpcs_end = rpcs.rpcs.end(); + + for (; it_rpcs != it_rpcs_end; ++it_rpcs) { + policy_table::RpcParameters rpc_params = (*it_rpcs).second; + + policy_table::HmiLevels::const_iterator it_hmi_levels = rpc_params + .hmi_levels.begin(); + policy_table::HmiLevels::const_iterator it_hmi_levels_end = rpc_params + .hmi_levels.end(); + + for (; it_hmi_levels != it_hmi_levels_end; ++it_hmi_levels) { + // Index binding + sqlquery.Bind(0, index); + + // Group name binding + sqlquery.Bind(1, (*it_fg).first); + + // RPC name binding + sqlquery.Bind(2, (*it_rpcs).first); + + // Hmi levels binding + sqlquery.Bind(3, (*it_hmi_levels)); + if (sqlquery.Exec()) { + sqlquery.Reset(); + } else { + return false; + } + } + } + } + + return true; +} + +bool UpdateSection(dbms::SQLDatabase* db, const policy_table::Table& pt) { + UpdateSection(db, pt.policy_table.module_config); + UpdateSection(db, pt.policy_table.functional_groupings); + return true; +} + +bool UpdateSection(dbms::SQLDatabase* db, + const policy_table::ApplicationPolicies& ap) { + /* + * Following structure is assumed: + * + * table Groups - list of functional groups for application + * index, application_id, functional_group_id + * + * table Nicknames - list of nickname for application + * index, application_id, nickname + * + * table AppPolicies - policies for applications + * index, application_id, priority, is_default + * + */ + + // According to documentation, we have to REPLACE this part on update coming, + // so we delete all data first; + if (!RemoveSection(db, ap)) { + return false; + } + + std::string groups_query = "insert into Groups values (" + "?," + "?," + "?)"; + dbms::SQLQuery groups_sqlquery(db); + groups_sqlquery.Prepare(groups_query); + + std::string nicknames_query = "insert into Nicknames values(?,?,?)"; + dbms::SQLQuery nicknames_sqlquery(db); + nicknames_sqlquery.Prepare(nicknames_query); + + std::string app_policies_query = "insert into AppPolicies values(?,?,?,?)"; + dbms::SQLQuery app_policies_sqlquery(db); + app_policies_sqlquery.Prepare(app_policies_query); + + policy_table::ApplicationPolicies::const_iterator it_ap = ap.begin(); + policy_table::ApplicationPolicies::const_iterator it_ap_end = ap.end(); + + for (int index = 0; it_ap != it_ap_end; ++it_ap, ++index) { + // Index binding for AppPolicies table + app_policies_sqlquery.Bind(0, index); + + std::string app_policy_name = (*it_ap).first; + bool is_default_policy = "default" == app_policy_name ? true : false; + if (is_default_policy) { + app_policies_sqlquery.Bind(1, "null"); + app_policies_sqlquery.Bind(3, true); + } else { + app_policies_sqlquery.Bind(1, app_policy_name); + app_policies_sqlquery.Bind(3, false); + } + + // Struct contains groups, nicknames, priority for application/default section + policy_table::ApplicationParams app_params = (*it_ap).second; + + // Priority binding + app_policies_sqlquery.Bind(2, app_params.priority); + app_policies_sqlquery.Bind(2, "Dummy priority parameter"); + + // Add record to AppPolicies table + if (app_policies_sqlquery.Exec()) { + app_policies_sqlquery.Reset(); + } else { + return false; + } + + if (!is_default_policy) { + // Seems, there is generator issue with Optional type inheritance + // It should have pubic inheritance from type T to have array + // begin/end methods in its interface + // To be discussed with I.Kozyrenko + + // policy_table::StringArray::const_iterator it_nicknames = app_params.nicknames.begin(); + // policy_table::StringArray::const_iterator it_nicknames_end = app_params.nicknames.end(); + // + // for (int nick_index = 0;it_nicknames != it_nicknames_end; ++ it_nicknames, ++nick_index) { + // nicknames_sqlquery.Bind(0, nick_index); + // nicknames_sqlquery.Bind(1, app_policy_name); + // + // nicknames_sqlquery.Bind(2, (*it_nicknames)); + // + // if (nicknames_sqlquery.Exec()) { + // nicknames_sqlquery.Reset(); + // } else { + // return false; + // } + // } + + policy_table::Strings::const_iterator it_groups = + app_params.groups.begin(); + policy_table::Strings::const_iterator it_groups_end = app_params.groups + .end(); + + for (int group_index = 0; it_groups != it_groups_end; + ++it_groups, ++group_index) { + groups_sqlquery.Bind(0, group_index); + groups_sqlquery.Bind(1, app_policy_name); + groups_sqlquery.Bind(2, (*it_groups)); + + if (groups_sqlquery.Exec()) { + groups_sqlquery.Reset(); + } else { + return false; + } + } + } + } + + return true; +} + +} // namespace policy_table_interface_base +} // namespace rpc + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_GENERATED_CODE_WITH_SQLITE_TEST_H_ diff --git a/src/components/policy/test/include/mock_cache_manager.h b/src/components/policy/test/include/mock_cache_manager.h new file mode 100644 index 0000000000..610a7a3fb0 --- /dev/null +++ b/src/components/policy/test/include/mock_cache_manager.h @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_CACHE_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_CACHE_MANAGER_H_ + + +#include <string> +#include <vector> + +#include "gmock/gmock.h" + +#include "policy/cache_manager_interface.h" + +namespace policy_table = rpc::policy_table_interface_base; + +namespace policy { + +class MockCacheManagerInterface : public CacheManagerInterface { + public: + MOCK_METHOD4(CheckPermissions, + void(const PTString& app_id, const PTString& hmi_level, const PTString& rpc, CheckPermissionResult& result)); + MOCK_METHOD0(IsPTPreloaded, + bool()); + MOCK_METHOD0(IgnitionCyclesBeforeExchange, + int()); + MOCK_METHOD1(KilometersBeforeExchange, + int(int current)); + MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate, + bool(int kilometers, int days_after_epoch)); + MOCK_METHOD1(DaysBeforeExchange, + int(int current)); + MOCK_METHOD0(IncrementIgnitionCycles, + void()); + MOCK_METHOD0(ResetIgnitionCycles, + void()); + MOCK_METHOD0(TimeoutResponse, + int()); + MOCK_METHOD1(SecondsBetweenRetries, + bool(std::vector<int> &seconds)); + MOCK_METHOD0(GetVehicleData, + VehicleData()); + MOCK_METHOD1(SetVINValue, + bool(const std::string& value)); + MOCK_METHOD2(GetUserFriendlyMsg, + std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_codes, const std::string& language)); + MOCK_METHOD1(GetUpdateUrls, + EndpointUrls(int service_type)); + MOCK_METHOD1(GetNotificationsNumber, + int(const std::string& priority)); + MOCK_METHOD2(GetPriority, + bool(const std::string& policy_app_id, std::string& priority)); + MOCK_METHOD1(Init, + bool(const std::string& file_name)); + MOCK_METHOD0(GenerateSnapshot, + utils::SharedPtr<policy_table::Table>()); + MOCK_METHOD1(ApplyUpdate, + bool(const policy_table::Table& update_pt)); + MOCK_METHOD1(Save, + bool(const policy_table::Table& table)); + MOCK_CONST_METHOD0(UpdateRequired, + bool()); + MOCK_METHOD1(SaveUpdateRequired, + void(bool status)); + MOCK_METHOD3(GetInitialAppData, + bool(const std::string& app_id, StringArray& nicknames, StringArray& app_hmi_types)); + MOCK_METHOD1(IsApplicationRevoked, + bool(const std::string& app_id)); + MOCK_METHOD1(GetFunctionalGroupings, + bool(policy_table::FunctionalGroupings& groups)); + MOCK_CONST_METHOD1(IsApplicationRepresented, + bool(const std::string& app_id)); + MOCK_METHOD1(IsDefaultPolicy, + bool(const std::string& app_id)); + MOCK_METHOD2(SetIsDefault, + bool(const std::string& app_id, bool is_default)); + MOCK_METHOD1(IsPredataPolicy, + bool(const std::string& app_id)); + MOCK_METHOD1(SetDefaultPolicy, + bool(const std::string& app_id)); + MOCK_METHOD1(CanAppKeepContext, + bool(const std::string& app_id)); + MOCK_METHOD1(CanAppStealFocus, + bool(const std::string& app_id)); + MOCK_METHOD2(GetDefaultHMI, + bool(const std::string& app_id, std::string &default_hmi)); + MOCK_METHOD0(ResetUserConsent, + bool()); + MOCK_METHOD3(GetUserPermissionsForDevice, + bool(const std::string& device_id, StringArray &consented_groups, StringArray &disallowed_groups)); + MOCK_METHOD3(GetPermissionsForApp, + bool(const std::string& device_id, const std::string& app_id, FunctionalIdType &group_types)); + MOCK_METHOD2(GetDeviceGroupsFromPolicies, + bool(rpc::policy_table_interface_base::Strings &groups, rpc::policy_table_interface_base::Strings &preconsented_groups)); + MOCK_METHOD8(SetDeviceData, + bool(const std::string& device_id, const std::string& hardware, const std::string& firmware, const std::string& os, const std::string& os_version, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type)); + MOCK_METHOD3(SetUserPermissionsForDevice, + bool(const std::string& device_id, const StringArray& consented_groups, const StringArray& disallowed_groups)); + MOCK_METHOD2(ReactOnUserDevConsentForApp, + bool(const std::string& app_id, bool is_device_allowed)); + MOCK_METHOD1(SetUserPermissionsForApp, + bool(const PermissionConsent& permissions)); + MOCK_METHOD3(SetMetaInfo, + bool(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& language)); + MOCK_CONST_METHOD0(IsMetaInfoPresent, + bool()); + MOCK_METHOD1(SetSystemLanguage, + bool(const std::string& language)); + MOCK_METHOD1(Increment, + void(usage_statistics::GlobalCounterId type)); + MOCK_METHOD2(Increment, + void(const std::string& app_id, usage_statistics::AppCounterId type)); + MOCK_METHOD3(Set, + void(const std::string& app_id, usage_statistics::AppInfoId type, const std::string& value)); + MOCK_METHOD3(Add, + void(const std::string& app_id, usage_statistics::AppStopwatchId type, int seconds)); + MOCK_METHOD3(CountUnconsentedGroups, + bool(const std::string& policy_app_id, const std::string& device_id, int& result)); + MOCK_METHOD1(GetFunctionalGroupNames, + bool(FunctionalGroupNames& names)); + MOCK_METHOD2(GetAllAppGroups, + void(const std::string& app_id, FunctionalGroupIDs& all_group_ids)); + MOCK_METHOD2(GetPreConsentedGroups, + void(const std::string &app_id, FunctionalGroupIDs& preconsented_groups)); + MOCK_METHOD4(GetConsentedGroups, + void(const std::string &device_id, const std::string &app_id, FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups)); + MOCK_METHOD3(GetUnconsentedGroups, + void(const std::string& device_id, const std::string& policy_app_id, FunctionalGroupIDs& unconsented_groups)); + MOCK_METHOD2(RemoveAppConsentForGroup, + void(const std::string& app_id, const std::string& group_name)); + MOCK_METHOD1(SetPredataPolicy, + bool(const std::string& app_id)); + MOCK_METHOD2(SetIsPredata, + bool(const std::string& app_id, bool is_pre_data)); + MOCK_METHOD1(CleanupUnpairedDevices, + bool(const DeviceIds& device_ids)); + MOCK_METHOD1(SetUnpairedDevice, + bool(const std::string& device_id)); + MOCK_METHOD1(UnpairedDevicesList, + bool(DeviceIds& device_ids)); + MOCK_METHOD1(ResetPT, + bool(const std::string& file_name)); + MOCK_METHOD0(LoadFromBackup, + bool()); + MOCK_METHOD1(LoadFromFile, + bool(const std::string& file_name)); + MOCK_METHOD0(Backup, + void()); + MOCK_CONST_METHOD1(HeartBeatTimeout, + uint16_t(const std::string& app_id)); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_CACHE_MANAGER_H_ diff --git a/src/components/policy/test/include/mock_policy_listener.h b/src/components/policy/test/include/mock_policy_listener.h new file mode 100644 index 0000000000..8e7a67c1f6 --- /dev/null +++ b/src/components/policy/test/include/mock_policy_listener.h @@ -0,0 +1,77 @@ +/* Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_LISTENER_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_LISTENER_H_ + + +#include <string> + +#include "gmock/gmock.h" + +#include "policy/policy_listener.h" +#include "rpc_base/rpc_base.h" +#include "./types.h" + +namespace policy_table = ::rpc::policy_table_interface_base; + +namespace policy { + +class MockPolicyListener : public PolicyListener { + public: + MOCK_METHOD0(OnPTExchangeNeeded, + void()); + MOCK_METHOD3(OnPermissionsUpdated, + void(const std::string& policy_app_id, + const Permissions& permissions, + const policy::HMILevel& default_hmi)); + MOCK_METHOD1(OnPendingPermissionChange, + void(const std::string& policy_app_id)); + MOCK_METHOD1(OnAppRevoked, + void(const std::string& policy_app_id)); + MOCK_METHOD1(OnUpdateStatusChanged, + void(policy::PolicyTableStatus status)); + MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired, + std::string(const std::string& policy_app_id)); + MOCK_METHOD0(OnSystemInfoUpdateRequired, + void()); + MOCK_METHOD1(GetAppName, + std::string(const std::string& policy_app_id)); + MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, + void()); + MOCK_METHOD2(OnDeviceConsentChanged, + void(const std::string& device_id, + bool is_allowed)); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_LISTENER_H_ diff --git a/src/components/policy/test/include/mock_pt_ext_representation.h b/src/components/policy/test/include/mock_pt_ext_representation.h new file mode 100644 index 0000000000..dbd421706c --- /dev/null +++ b/src/components/policy/test/include/mock_pt_ext_representation.h @@ -0,0 +1,132 @@ +/* Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_PT_EXT_REPRESENTATION_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_PT_EXT_REPRESENTATION_H_ + + +#include <string> +#include <vector> + +#include "gmock/gmock.h" + +#include "policy/pt_ext_representation.h" +#include "rpc_base/rpc_base.h" +#include "./types.h" +#include "mock_pt_representation.h" + +namespace policy_table = ::rpc::policy_table_interface_base; + +namespace policy { +class MockPTExtRepresentation : public MockPTRepresentation, + public PTExtRepresentation { + public: + MOCK_METHOD1(CanAppKeepContext, + bool(const std::string& app_id)); + MOCK_METHOD1(CanAppStealFocus, + bool(const std::string& app_id)); + MOCK_METHOD2(GetDefaultHMI, + bool(const std::string& app_id, std::string* default_hmi)); + MOCK_METHOD0(ResetUserConsent, + bool()); + MOCK_METHOD0(ResetDeviceConsents, bool()); + MOCK_METHOD0(ResetAppConsents, bool()); + MOCK_METHOD3(GetUserPermissionsForDevice, + bool(const std::string&, StringArray*, StringArray*)); + MOCK_METHOD3(GetPermissionsForApp, + bool(const std::string&, const std::string&, + FunctionalIdType* group_types)); + MOCK_METHOD2(GetDeviceGroupsFromPolicies, + bool(policy_table::Strings*, policy_table::Strings*)); + MOCK_METHOD2(GetUserFriendlyMsg, + std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_code, + const std::string& language)); + MOCK_METHOD8(SetDeviceData, bool(const std::string& device_id, + const std::string& hardware, + const std::string& firmware, + const std::string& os, + const std::string& os_version, + const std::string& carrier, + const uint32_t number_of_ports, + const std::string& connection_type)); + MOCK_METHOD6(SetDeviceData, + bool(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&)); + MOCK_METHOD2(SetMaxNumberPorts, + bool(const std::string& device_id, unsigned int number_of_ports)); + MOCK_METHOD3(SetUserPermissionsForDevice, + bool(const std::string&, const StringArray&, const StringArray&)); + MOCK_METHOD1(SetUserPermissionsForApp, + bool(const PermissionConsent&)); + MOCK_METHOD1(IncreaseStatisticsData, + bool(StatisticsType type)); + MOCK_METHOD3(SetAppRegistrationLanguage, + bool(const std::string& app_id, LanguageType type, const std::string& language)); + MOCK_METHOD3(SetMetaInfo, + bool(const std::string& ccpu_version, const std::string& wers_country_code, const std::string& vin)); + MOCK_METHOD0(IsMetaInfoPresent, + bool()); + MOCK_METHOD1(SetSystemLanguage, + bool(const std::string& language)); + MOCK_METHOD0(GetKmFromSuccessfulExchange, + int()); + MOCK_METHOD0(GetDayFromScsExchange, + int()); + MOCK_METHOD0(GetIgnitionsFromScsExchange, + int()); + MOCK_CONST_METHOD1(Increment, + void(const std::string& type)); + MOCK_CONST_METHOD2(Increment, + void(const std::string& app_id, const std::string& type)); + MOCK_CONST_METHOD3(Set, + void(const std::string& app_id, const std::string& type, const std::string& value)); + MOCK_CONST_METHOD3(Add, + void(const std::string& app_id, const std::string& type, int seconds)); + MOCK_CONST_METHOD3(CountUnconsentedGroups, + bool(const std::string& app_id, + const std::string& device_id, + int* count)); + MOCK_METHOD1(GetFunctionalGroupNames, + bool(FunctionalGroupNames& names)); + MOCK_CONST_METHOD1(CleanupUnpairedDevices, + bool(const DeviceIds& device_ids)); + MOCK_METHOD2(ReactOnUserDevConsentForApp, + bool(const std::string& app_id, bool is_device_allowed)); + MOCK_METHOD1(SetPredataPolicy, bool(const std::string& app_id)); + MOCK_METHOD2(SetIsPredata, bool(const std::string& app_id, bool is_predata)); + MOCK_CONST_METHOD1(SetUnpairedDevice, bool(const std::string& device_id)); + MOCK_CONST_METHOD1(UnpairedDevicesList, bool(DeviceIds* device_ids)); + MOCK_CONST_METHOD2(RemoveAppConsentForGroup, bool(const std::string& policy_app_id, + const std::string& functional_group)); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_PT_EXT_REPRESENTATION_H_ diff --git a/src/components/policy/test/include/mock_pt_representation.h b/src/components/policy/test/include/mock_pt_representation.h new file mode 100644 index 0000000000..f9b188983b --- /dev/null +++ b/src/components/policy/test/include/mock_pt_representation.h @@ -0,0 +1,122 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_PT_REPRESENTATION_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_PT_REPRESENTATION_H_ + +#include <string> +#include <vector> + +#include "gmock/gmock.h" + +#include "policy/pt_representation.h" +#include "rpc_base/rpc_base.h" +#include "./types.h" + +namespace policy_table = ::rpc::policy_table_interface_base; + +namespace policy { + +class MockPTRepresentation : virtual public PTRepresentation { + public: + MOCK_METHOD4(CheckPermissions, + void(const PTString& app_id, + const PTString& hmi_level, + const PTString& rpc, + CheckPermissionResult& result)); + MOCK_METHOD0(IsPTPreloaded, + bool()); + MOCK_METHOD0(IgnitionCyclesBeforeExchange, + int()); + MOCK_METHOD1(KilometersBeforeExchange, + int(int current)); + MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate, + bool(int kilometers, int days_after_epoch)); + MOCK_METHOD1(DaysBeforeExchange, + int(int current)); + MOCK_METHOD0(IncrementIgnitionCycles, + void()); + MOCK_METHOD0(ResetIgnitionCycles, + void()); + MOCK_METHOD0(TimeoutResponse, + int()); + MOCK_METHOD1(SecondsBetweenRetries, + bool(std::vector<int>* seconds)); + MOCK_METHOD2(GetPriority, + bool(const std::string& app_id, std::string* priority)); + MOCK_METHOD0(GetVehicleData, + VehicleData()); + MOCK_METHOD1(SetVINValue, + bool(const std::string& value)); + MOCK_METHOD2(GetUserFriendlyMsg, + std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_code, + const std::string& language)); + MOCK_METHOD1(GetUpdateUrls, + EndpointUrls(int service_type)); + MOCK_METHOD1(GetNotificationsNumber, + int(const std::string& priority)); + MOCK_METHOD0(Init, + InitResult()); + MOCK_METHOD0(Close, + bool()); + MOCK_METHOD0(Clear, + bool()); + MOCK_METHOD0(Drop, + bool()); + MOCK_CONST_METHOD0(GenerateSnapshot, + utils::SharedPtr<policy_table::Table>()); + MOCK_METHOD1(Save, + bool(const policy_table::Table& table)); + MOCK_CONST_METHOD0(UpdateRequired, + bool()); + MOCK_METHOD1(SaveUpdateRequired, + void(bool value)); + MOCK_METHOD3(GetInitialAppData, + bool(const std::string& app_id, StringArray* nicknames, StringArray* app_types)); + + MOCK_METHOD4(SaveApplicationCustomData, + bool(const std::string& app_id, + bool is_revoked, + bool is_default, + bool is_predata)); + + MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id)); + MOCK_METHOD1(GetFunctionalGroupings, + bool(policy_table::FunctionalGroupings& groups)); + MOCK_CONST_METHOD1(IsApplicationRepresented, bool(const std::string& app_id)); + MOCK_CONST_METHOD1(IsDefaultPolicy, bool(const std::string& app_id)); + MOCK_METHOD1(SetDefaultPolicy, bool(const std::string& app_id)); + MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& app_id)); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_PT_REPRESENTATION_H_ diff --git a/src/components/policy/test/include/mock_statistics_manager.h b/src/components/policy/test/include/mock_statistics_manager.h new file mode 100644 index 0000000000..2de072f095 --- /dev/null +++ b/src/components/policy/test/include/mock_statistics_manager.h @@ -0,0 +1,58 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_STATISTICS_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_STATISTICS_MANAGER_H_ + +#include <string> + +#include "gmock/gmock.h" + +#include "usage_statistics/statistics_manager.h" + +namespace usage_statistics { +namespace test { + +class MockStatisticsManager: public StatisticsManager { + public: + MOCK_METHOD1(Increment, void(GlobalCounterId type)); + MOCK_METHOD2(Increment, void(const std::string& app_id, AppCounterId type)); + MOCK_METHOD3(Set, void(const std::string& app_id, + AppInfoId type, + const std::string& value)); + MOCK_METHOD3(Add, void(const std::string& app_id, + AppStopwatchId type, + int32_t timespan_seconds)); +}; + +} // namespace test +} // namespace usage_statistics + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_STATISTICS_MANAGER_H_ diff --git a/src/components/policy/test/include/mock_update_status_manager.h b/src/components/policy/test/include/mock_update_status_manager.h new file mode 100644 index 0000000000..9956a34c5d --- /dev/null +++ b/src/components/policy/test/include/mock_update_status_manager.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_UPDATE_STATUS_MANAGER_H_ +#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_UPDATE_STATUS_MANAGER_H_ + +#include "gmock/gmock.h" + +#include "policy/update_status_manager_interface.h" + +namespace policy { + +class MockUpdateStatusManagerInterface : public UpdateStatusManagerInterface { + public: + MOCK_METHOD1(set_listener, + void(PolicyListener* listener)); + MOCK_METHOD1(OnUpdateSentOut, + void(uint32_t update_timeout)); + MOCK_METHOD0(OnUpdateTimeoutOccurs, + void()); + MOCK_METHOD0(OnValidUpdateReceived, + void()); + MOCK_METHOD0(OnWrongUpdateReceived, + void()); + MOCK_METHOD1(OnResetDefaultPT, + void(bool is_update_required)); + MOCK_METHOD0(OnResetRetrySequence, + void()); + MOCK_METHOD0(OnNewApplicationAdded, + void()); + MOCK_METHOD1(OnPolicyInit, + void(bool is_update_required)); + MOCK_METHOD0(GetUpdateStatus, + PolicyTableStatus()); +}; + +} // namespace policy + +#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_UPDATE_STATUS_MANAGER_H_ diff --git a/src/components/policy/test/log4cxx.properties b/src/components/policy/test/log4cxx.properties new file mode 100644 index 0000000000..632ab540c5 --- /dev/null +++ b/src/components/policy/test/log4cxx.properties @@ -0,0 +1,21 @@ +# Only ERROR and FATAL messages are logged to console +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.ImmediateFlush=true +log4j.appender.Console.layout=org.apache.log4j.PatternLayout +log4j.appender.Console.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %m%n +log4j.appender.Console.Threshold=ERROR + +# Log for all SQLPTRepresentation messages +log4j.appender.SQLPTRepresentationLogFile=org.apache.log4j.DailyRollingFileAppender +log4j.appender.SQLPTRepresentationLogFile.File=SQLRepresentation.log +log4j.appender.SQLPTRepresentationLogFile.ImmediateFlush=true +log4j.appender.SQLPTRepresentationLogFile.layout=org.apache.log4j.PatternLayout +log4j.appender.SQLPTRepresentationLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}] :%L %M: %m%n +log4j.appender.SQLPTRepresentationLogFile.Schedule=DAILY +log4j.appender.SQLPTRepresentationLogFile.DatePattern='.' yyyy-MM-dd + +# All SmartDeviceLinkCore logs +log4j.rootLogger=ALL, Console + +# SQLPTRepresentation logs +log4j.logger.SQLPTRepresentation=ALL, SQLPTRepresentationLogFile
\ No newline at end of file diff --git a/src/components/policy/test/main.cc b/src/components/policy/test/main.cc new file mode 100644 index 0000000000..edfc998db8 --- /dev/null +++ b/src/components/policy/test/main.cc @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "gmock/gmock.h" + +int main(int argc, char** argv) { + testing::InitGoogleMock(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/components/policy/test/policy.sql b/src/components/policy/test/policy.sql new file mode 100644 index 0000000000..406579f6b7 --- /dev/null +++ b/src/components/policy/test/policy.sql @@ -0,0 +1,295 @@ +BEGIN TRANSACTION; + CREATE TABLE IF NOT EXISTS `device`( + `id` VARCHAR(100) PRIMARY KEY NOT NULL, + `hardware` VARCHAR(45), + `firmware_rev` VARCHAR(45), + `os` VARCHAR(45), + `os_version` VARCHAR(45), + `carrier` VARCHAR(45), + `max_number_rfcom_ports` INTEGER , + `connection_type` VARCHAR(45), + `unpaired` BOOL + ); + CREATE TABLE IF NOT EXISTS `usage_and_error_count`( + `count_of_iap_buffer_full` INTEGER, + `count_sync_out_of_memory` INTEGER, + `count_of_sync_reboots` INTEGER + ); + INSERT OR IGNORE INTO `usage_and_error_count` ( + `count_of_iap_buffer_full`, `count_sync_out_of_memory`, + `count_of_sync_reboots`) VALUES (0, 0, 0); + CREATE TABLE IF NOT EXISTS `module_meta`( + `ccpu_version` VARCHAR(45), + `language` VARCHAR(45), + `wers_country_code` VARCHAR(45), + `pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0, + `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0, + `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0, + `vin` VARCHAR(45), + `flag_update_required` BOOL NOT NULL + ); + INSERT OR IGNORE INTO `module_meta` (`pt_exchanged_at_odometer_x`, + `pt_exchanged_x_days_after_epoch`, `ignition_cycles_since_last_exchange`, + `flag_update_required`) + VALUES (0, 0, 0, 0); + CREATE TABLE IF NOT EXISTS `module_config`( + `preloaded_pt` BOOL NOT NULL, + `is_first_run` BOOL NOT NULL, + `exchange_after_x_ignition_cycles` INTEGER NOT NULL, + `exchange_after_x_kilometers` INTEGER NOT NULL, + `exchange_after_x_days` INTEGER NOT NULL, + `timeout_after_x_seconds` INTEGER NOT NULL, + `vehicle_make` VARCHAR(45), + `vehicle_model` VARCHAR(45), + `vehicle_year` VARCHAR(4) + ); + INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`, + `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, + `exchange_after_x_days`, `timeout_after_x_seconds`) + VALUES(1, 1, 0, 0, 0, 0); + CREATE TABLE IF NOT EXISTS `functional_group`( + `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + `user_consent_prompt` TEXT UNIQUE ON CONFLICT REPLACE, + `name` VARCHAR(100) NOT NULL + ); + CREATE TABLE IF NOT EXISTS `priority`( + `value` VARCHAR(45) PRIMARY KEY NOT NULL + ); + INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); + INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); + INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION'); + INSERT OR IGNORE INTO `priority`(`value`) VALUES ('COMMUNICATION'); + INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NORMAL'); + INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NONE'); + CREATE TABLE IF NOT EXISTS `hmi_level`( + `value` VARCHAR(45) PRIMARY KEY NOT NULL + ); + INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('FULL'); + INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); + INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); + INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); + CREATE TABLE IF NOT EXISTS `notifications_by_priority`( + `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, + `value` INTEGER NOT NULL, + CONSTRAINT `fk_notifications_by_priority_priority1` + FOREIGN KEY(`priority_value`) + REFERENCES `priority`(`value`) + ); + CREATE INDEX IF NOT EXISTS + `notifications_by_priority.fk_notifications_by_priority_priority1_idx` + ON `notifications_by_priority`(`priority_value`); + CREATE TABLE IF NOT EXISTS `language`( + `code` VARCHAR(25) PRIMARY KEY NOT NULL + ); + CREATE TABLE IF NOT EXISTS `message_type`( + `name` VARCHAR(45) PRIMARY KEY NOT NULL + ); + CREATE TABLE IF NOT EXISTS `version`( + `number` VARCHAR(45) NOT NULL + ); + INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); + CREATE TABLE IF NOT EXISTS `rpc`( + `id` INTEGER PRIMARY KEY NOT NULL, + `name` VARCHAR(45) NOT NULL, + `parameter` VARCHAR(45), + `hmi_level_value` VARCHAR(45) NOT NULL, + `functional_group_id` INTEGER NOT NULL, + CONSTRAINT `fk_rpc_hmi_level1` + FOREIGN KEY(`hmi_level_value`) + REFERENCES `hmi_level`(`value`), + CONSTRAINT `fk_rpc_functional_group1` + FOREIGN KEY(`functional_group_id`) + REFERENCES `functional_group`(`id`) + ); + CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_hmi_level1_idx` + ON `rpc`(`hmi_level_value`); + CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_functional_group1_idx` + ON `rpc`(`functional_group_id`); + CREATE INDEX `rpc.select_rpc_name_hmi_level` + ON `rpc`(`name`,`hmi_level_value`); + CREATE TABLE IF NOT EXISTS `application`( + `id` VARCHAR(45) PRIMARY KEY NOT NULL, + `keep_context` BOOLEAN, + `steal_focus` BOOLEAN, + `default_hmi` VARCHAR(45), + `priority_value` VARCHAR(45), + `is_revoked` BOOLEAN, + `is_default` BOOLEAN, + `is_predata` BOOLEAN, + `memory_kb` INTEGER NOT NULL, + `heart_beat_timeout_ms` INTEGER NOT NULL, + `certificate` VARCHAR(45), + CONSTRAINT `fk_application_hmi_level1` + FOREIGN KEY(`default_hmi`) + REFERENCES `hmi_level`(`value`), + CONSTRAINT `fk_application_priorities1` + FOREIGN KEY(`priority_value`) + REFERENCES `priority`(`value`) + ); + CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` + ON `application`(`default_hmi`); + CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` + ON `application`(`priority_value`); + CREATE TABLE IF NOT EXISTS `app_group`( + `application_id` VARCHAR(45) NOT NULL, + `functional_group_id` INTEGER NOT NULL, + PRIMARY KEY(`application_id`,`functional_group_id`), + CONSTRAINT `fk_application_has_functional_group_application1` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`), + CONSTRAINT `fk_application_has_functional_group_functional_group1` + FOREIGN KEY(`functional_group_id`) + REFERENCES `functional_group`(`id`) + ); + CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx` + ON `app_group`(`functional_group_id`); + CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_application1_idx` + ON `app_group`(`application_id`); + CREATE TABLE IF NOT EXISTS `preconsented_group`( + `application_id` VARCHAR(45) NOT NULL, + `functional_group_id` INTEGER NOT NULL, + PRIMARY KEY(`application_id`,`functional_group_id`), + CONSTRAINT `fk_application_has_functional_group_application2` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`), + CONSTRAINT `fk_application_has_functional_group_functional_group2` + FOREIGN KEY(`functional_group_id`) + REFERENCES `functional_group`(`id`) + ); + CREATE INDEX IF NOT EXISTS + `preconsented_group.fk_application_has_functional_group_functional_group2_idx` + ON `preconsented_group`(`functional_group_id`); + CREATE INDEX IF NOT EXISTS + `preconsented_group.fk_application_has_functional_group_application2_idx` + ON `preconsented_group`(`application_id`); + CREATE TABLE IF NOT EXISTS `seconds_between_retry`( + `index` INTEGER PRIMARY KEY NOT NULL, + `value` INTEGER NOT NULL + ); + CREATE TABLE IF NOT EXISTS `device_consent_group`( + `device_id` VARCHAR(100) NOT NULL, + `functional_group_id` INTEGER NOT NULL, + `is_consented` BOOL NOT NULL, + `input` VARCHAR(45), + `time_stamp` DATETIME DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY(`device_id`,`functional_group_id`), + CONSTRAINT `fk_device_has_functional_group_device1` + FOREIGN KEY(`device_id`) + REFERENCES `device`(`id`), + CONSTRAINT `fk_device_has_functional_group_functional_group1` + FOREIGN KEY(`functional_group_id`) + REFERENCES `functional_group`(`id`) + ); + CREATE INDEX IF NOT EXISTS + `device_consent_group.fk_device_has_functional_group_functional_group1_idx` + ON `device_consent_group`(`functional_group_id`); + CREATE INDEX IF NOT EXISTS + `device_consent_group.fk_device_has_functional_group_device1_idx` + ON `device_consent_group`(`device_id`); + CREATE TABLE IF NOT EXISTS `app_level`( + `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, + `minutes_in_hmi_full` INTEGER DEFAULT 0, + `minutes_in_hmi_limited` INTEGER DEFAULT 0, + `minutes_in_hmi_background` INTEGER DEFAULT 0, + `minutes_in_hmi_none` INTEGER DEFAULT 0, + + `count_of_user_selections` INTEGER DEFAULT 0, + `count_of_rejections_sync_out_of_memory` INTEGER DEFAULT 0, + `count_of_rejections_nickname_mismatch` INTEGER DEFAULT 0, + `count_of_rejections_duplicate_name` INTEGER DEFAULT 0, + `count_of_rejected_rpcs_calls` INTEGER DEFAULT 0, + `count_of_rpcs_sent_in_hmi_none` INTEGER DEFAULT 0, + `count_of_removals_for_bad_behavior` INTEGER DEFAULT 0, + `count_of_run_attempts_while_revoked` INTEGER DEFAULT 0, + `app_registration_language_gui` VARCHAR(25), + `app_registration_language_vui` VARCHAR(25), + CONSTRAINT `fk_app_levels_application1` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`), + CONSTRAINT `fk_app_level_language1` + FOREIGN KEY(`app_registration_language_gui`) + REFERENCES `language`(`code`), + CONSTRAINT `fk_app_level_language2` + FOREIGN KEY(`app_registration_language_vui`) + REFERENCES `language`(`code`) + ); + CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` + ON `app_level`(`application_id`); + CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` + ON `app_level`(`app_registration_language_gui`); + CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` + ON `app_level`(`app_registration_language_vui`); + CREATE TABLE IF NOT EXISTS `nickname`( + `name` VARCHAR(100) NOT NULL, + `application_id` VARCHAR(45) NOT NULL, + PRIMARY KEY(`name`,`application_id`), + CONSTRAINT `fk_nickname_application1` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`) + ); + CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` + ON `nickname`(`application_id`); + CREATE TABLE IF NOT EXISTS `app_type`( + `name` VARCHAR(50) NOT NULL, + `application_id` VARCHAR(45) NOT NULL, + PRIMARY KEY(`name`,`application_id`), + CONSTRAINT `fk_app_type_application1` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`) + ); + CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` + ON `app_type`(`application_id`); + CREATE TABLE IF NOT EXISTS `consent_group`( + `device_id` VARCHAR(100) NOT NULL, + `application_id` VARCHAR(45) NOT NULL, + `functional_group_id` INTEGER NOT NULL, + `is_consented` BOOL NOT NULL, + `input` VARCHAR(45), + `time_stamp` DATETIME DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY(`application_id`,`functional_group_id`,`device_id`), + CONSTRAINT `fk_consent_group_device1` + FOREIGN KEY(`device_id`) + REFERENCES `device`(`id`), + CONSTRAINT `fk_consent_group_application1` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`), + CONSTRAINT `fk_consent_group_functional_group1` + FOREIGN KEY(`functional_group_id`) + REFERENCES `functional_group`(`id`) + ); + CREATE INDEX IF NOT EXISTS + `consent_group.fk_consent_group_device1_idx` + ON `device_consent_group`(`device_id`); + CREATE INDEX IF NOT EXISTS `consent_group.fk_consent_group_functional_group1_idx` + ON `consent_group`(`functional_group_id`); + CREATE TABLE IF NOT EXISTS `endpoint`( + `service` INTEGER NOT NULL, + `url` VARCHAR(100) NOT NULL, + `application_id` VARCHAR(45) NOT NULL, + CONSTRAINT `fk_endpoint_application1` + FOREIGN KEY(`application_id`) + REFERENCES `application`(`id`) + ); + CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` + ON `endpoint`(`application_id`); + CREATE TABLE IF NOT EXISTS `message`( + `id` INTEGER PRIMARY KEY NOT NULL, + `tts` TEXT, + `label` TEXT, + `line1` TEXT, + `line2` TEXT, + `textBody` TEXT, + `language_code` VARCHAR(25) NOT NULL, + `message_type_name` VARCHAR(45) NOT NULL, + CONSTRAINT `fk_messages_languages1` + FOREIGN KEY(`language_code`) + REFERENCES `language`(`code`), + CONSTRAINT `fk_message_consumer_friendly_messages1` + FOREIGN KEY(`message_type_name`) + REFERENCES `message_type`(`name`) + ); + CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` + ON `message`(`language_code`); + CREATE INDEX IF NOT EXISTS `message.fk_message_consumer_friendly_messages1_idx` + ON `message`(`message_type_name`); +COMMIT; diff --git a/src/components/policy/test/policy/CMakeLists.txt b/src/components/policy/test/policy/CMakeLists.txt new file mode 100644 index 0000000000..e390901cfb --- /dev/null +++ b/src/components/policy/test/policy/CMakeLists.txt @@ -0,0 +1,86 @@ +include_directories( + ./ + ./include + ${LOG4CXX_INCLUDE_DIRECTORY} + ${GMOCK_INCLUDE_DIRECTORY} + ${JSONCPP_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/include/ + ${CMAKE_SOURCE_DIR}/src/components/rpc_base/include + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/sqlite_wrapper/include + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/qdb_wrapper/include + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/usage_statistics/include + ${CMAKE_SOURCE_DIR}/src/components/utils/include/ +) + +set(LIBRARIES + gtest + gtest_main + gmock + gmock_main + Policy + ConfigProfile + ${RTLIB} +) + +set(SHARED_LIBRARY_LIBRARIES + gtest + gtest_main + gmock + gmock_main + dl +) + +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + list(REMOVE_ITEM SHARED_LIBRARY_LIBRARIES dl) +endif() + +set(SHARED_LIBRARY_SOURCES + ./src/test_shared_library.cc +) + +set(SQL_PT_REPRESENTATION_SOURCES + ./src/test_sql_pt_representation.cc +) + +set(GENERATED_CODE_SOURCES + ./src/generated_code_test.cc +) + +set(GENERATED_CODE_WITH_SQLITE_SOURCES + ./src/generated_code_with_sqlite_test.cc +) + +set(POLICY_MANAGER_IMPL_SOURCES + ./src/test_policy_manager_impl.cc +) + +set(STRESS_POLICY_MANAGER_IMPL_SOURCES + ./src/test_stress_policy_manager_impl.cc +) + +add_subdirectory(usage_statistics) + + + +if (CMAKE_SYSTEM_NAME STREQUAL "QNX") + # --- Tests for QDB Wrapper + add_subdirectory(qdb_wrapper) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +else () + # --- Tests for SQLite Wrapper + add_subdirectory(sqlite_wrapper) + create_test("test_generated_code_with_sqlite" "${GENERATED_CODE_WITH_SQLITE_SOURCES}" "${LIBRARIES}") + + include_directories(${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/policy_table/table_struct) + # TODO(KKolodiy): test crashes in QNX and failed for extended policy + create_test("test_stress_PolicyManagerImpl" "${STRESS_POLICY_MANAGER_IMPL_SOURCES}" "${LIBRARIES}") +endif() + +create_test("test_generated_policy_code" "${GENERATED_CODE_SOURCES}" "${LIBRARIES}") +create_test("test_SharedLibrary" "${SHARED_LIBRARY_SOURCES}" "${SHARED_LIBRARY_LIBRARIES}") +create_test("test_SQLPTRepresentation" "${SQL_PT_REPRESENTATION_SOURCES}" "${LIBRARIES}") +create_test("test_PolicyManagerImpl" "${POLICY_MANAGER_IMPL_SOURCES}" "${LIBRARIES}") + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/valid_sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt b/src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt new file mode 100644 index 0000000000..16191eaf50 --- /dev/null +++ b/src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt @@ -0,0 +1,29 @@ +find_package(Sqlite3 REQUIRED) + +include_directories( + ${LOG4CXX_INCLUDE_DIRECTORY} + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/qdb_wrapper/include +) + +set(LIBRARIES + gtest + gtest_main + gmock + gmock_main + dbms +) + +set(DATABASE_SOURCES + ./src/test_sql_database.cc +) + +set(QUERY_SOURCES + ./src/test_sql_query.cc +) + +create_test("test_SQLDatabase" "${DATABASE_SOURCES}" "${LIBRARIES}") +create_test("test_SQLQuery" "${QUERY_SOURCES}" "${LIBRARIES}") + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt b/src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt new file mode 100644 index 0000000000..40a901ed82 --- /dev/null +++ b/src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt @@ -0,0 +1,27 @@ +find_package(Sqlite3 REQUIRED) + +include_directories( + ${LOG4CXX_INCLUDE_DIRECTORY} + ${GMOCK_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/sqlite_wrapper/include +) + +set(LIBRARIES + gtest + gtest_main + gmock + gmock_main + dbms + sqlite3 +) + +set(DATABASE_SOURCES + ./src/test_sql_database.cc +) + +set(QUERY_SOURCES + ./src/test_sql_query.cc +) + +create_test("test_SQLDatabase" "${DATABASE_SOURCES}" "${LIBRARIES}") +create_test("test_SQLQuery" "${QUERY_SOURCES}" "${LIBRARIES}") diff --git a/src/components/policy/test/policy/usage_statistics/CMakeLists.txt b/src/components/policy/test/policy/usage_statistics/CMakeLists.txt new file mode 100644 index 0000000000..25717b4cad --- /dev/null +++ b/src/components/policy/test/policy/usage_statistics/CMakeLists.txt @@ -0,0 +1,17 @@ +include_directories( + include + ${LOG4CXX_INCLUDE_DIRECTORY} + ${CMAKE_SOURCE_DIR}/src/components/policy/usage_statistics/include + ${GMOCK_INCLUDE_DIRECTORY} +) + +set(LIBRARIES + gmock_main + UsageStatistics +) + +set(SOURCES + src/test_counter.cc +) + +create_test("test_counter" "${SOURCES}" "${LIBRARIES}") diff --git a/src/components/policy/test/policy_manager_impl_stress_test.cc b/src/components/policy/test/policy_manager_impl_stress_test.cc new file mode 100644 index 0000000000..6c5e5d1a7b --- /dev/null +++ b/src/components/policy/test/policy_manager_impl_stress_test.cc @@ -0,0 +1,286 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <gtest/gtest.h> +#include <gmock/gmock.h> +#include <string> +#include <set> +#include <sstream> +#include <fstream> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "mock_policy_listener.h" +#include "policy/policy_manager_impl.h" + +using ::testing::_; +using ::policy::PolicyManagerImpl; +using ::policy::BinaryMessage; +using ::policy::MockPolicyListener; + +namespace test { +namespace components { +namespace policy { + +class PolicyManagerImplStressTest : public ::testing::Test { + protected: + static const std::string kNameFile; + static const int kNumberGroups = 10; + static const int kNumberFuncs = 100; + static const int kNumberApps = 5; + static const int kNumberAppGroups = 5; + static PolicyManagerImpl* manager; + static MockPolicyListener* mock_listener; + + static void SetUpTestCase(); + static void TearDownTestCase(); + static void CreateTable(std::ofstream& ofs); + static void CreateGroups(std::ofstream& ofs); + static void CreateFuncs(std::ofstream& ofs); + static void CreateApps(std::ofstream& ofs); + static void CreateAppGroups(std::ofstream& ofs); +}; + +const std::string PolicyManagerImplStressTest::kNameFile = "pt.json"; +PolicyManagerImpl* PolicyManagerImplStressTest::manager = 0; +MockPolicyListener* PolicyManagerImplStressTest::mock_listener = 0; + +void PolicyManagerImplStressTest::SetUpTestCase() { + std::ofstream ofs; + ofs.open(kNameFile.c_str(), std::ofstream::out); + CreateTable(ofs); + ofs.close(); + + manager = new PolicyManagerImpl(); + mock_listener = new MockPolicyListener(); + manager->set_listener(mock_listener); + + ASSERT_TRUE(manager->InitPT(kNameFile)); +} + +void PolicyManagerImplStressTest::TearDownTestCase() { + delete manager; + delete mock_listener; + remove(kNameFile.c_str()); +#ifndef __QNX__ + remove("policy.sqlite"); +#endif // __QNX__ +} + +void PolicyManagerImplStressTest::CreateGroups(std::ofstream& ofs) { + std::stringstream ss; + std::string number; + for (int i = 0; i < kNumberGroups - 1; ++i) { + ss << i << std::endl; + ss >> number; + ofs << "\"Group-" << number << "\":{ \"rpcs\":{"; + CreateFuncs(ofs); + ofs << "} },\n"; + } + ss << kNumberGroups - 1 << std::endl; + ss >> number; + ofs << "\"Group-" << number << "\":{ \"rpcs\":{"; + CreateFuncs(ofs); + ofs << "} }\n"; +} + +void PolicyManagerImplStressTest::CreateFuncs(std::ofstream& ofs) { + std::string func = "{" + "\"hmi_levels\":[" + "\"BACKGROUND\"," + "\"FULL\"," + "\"LIMITED\"" + "]," + "\"parameters\":[" + "\"gps\"," + "\"speed\"," + "\"enginetorque\"," + "\"externaltemperature\"," + "\"fuellevel\"," + "\"fuellevel_state\"," + "\"headlampstatus\"," + "\"instantfuelconsumption\"," + "\"odometer\"," + "\"tirepressure\"," + "\"wiperstatus\"," + "\"vin\"," + "\"accpedalposition\"," + "\"beltstatus\"," + "\"driverbraking\"," + "\"prndl\"," + "\"rpm\"," + "\"steeringwheelangle\"" + "]" + "}\n"; + + std::stringstream ss; + std::string number; + for (int i = 0; i < kNumberFuncs - 1; ++i) { + ss << i << std::endl; + ss >> number; + ofs << "\"Func-" << number << "\":" << func << ","; + } + ss << kNumberFuncs - 1 << std::endl; + ss >> number; + ofs << "\"Func-" << number << "\":" + func; +} + +void PolicyManagerImplStressTest::CreateApps(std::ofstream& ofs) { + ofs << "\"default\":{" + "\"groups\":[" + "\"Group-1\"" + "]" + "},\n"; + + std::stringstream ss; + std::string number; + for (int i = 0; i < kNumberApps - 1; ++i) { + ss << i << std::endl; + ss >> number; + ofs << "\"" << number << "\": { \"groups\": "; + CreateAppGroups(ofs); + ofs << "},\n"; + } + ss << kNumberApps - 1 << std::endl; + ss >> number; + ofs << "\"" << number << "\": { \"groups\": "; + CreateAppGroups(ofs); + ofs << "}\n"; +} + +void PolicyManagerImplStressTest::CreateAppGroups(std::ofstream& ofs) { + ofs << "["; + + std::stringstream ss; + std::string number; + std::set<int> app_groups; + for (int i = 0; i < kNumberAppGroups; ++i) { + app_groups.insert(rand() % kNumberGroups); + } + + std::set<int>::const_iterator i = app_groups.begin(); + ss << *i << std::endl; + ss >> number; + ofs << "\"Group-" << number << "\""; + ++i; + for (; i != app_groups.end(); ++i) { + ss << *i << std::endl; + ss >> number; + ofs << ",\"Group-" << number << "\""; + } + ofs << "]\n"; +} + +void PolicyManagerImplStressTest::CreateTable(std::ofstream& ofs) { + ofs << "{" + "\"policy_table\":{" + "\"module_config\":{" + "\"preloaded_pt\":true," + "\"endpoints\":{" + "\"default\": {" + "\"default\":[" + "\"http://sdl.net/api\"" + "]" + "}" + "}," + "\"exchange_after_x_ignition_cycles\": 40," + "\"exchange_after_x_kilometers\" : 2," + "\"exchange_after_x_days\" : 23," + "\"timeout_after_x_seconds\" : 20," + "\"seconds_between_retries\" : [10, 7, 5, 3, 1]" + "}," + "\"consumer_friendly_messages\":{" + "\"version\":\"001.001.001\"," + "\"messages\":{} },\n" + "\"functional_groupings\":{"; + + CreateGroups(ofs); + + ofs << "}, \"app_policies\":{"; + + CreateApps(ofs); + + ofs << "} } }"; +} + +TEST_F(PolicyManagerImplStressTest, OneCheck) { + ::policy::RPCParams input_params; + ::policy::CheckPermissionResult output; + manager->CheckPermissions("2", "FULL", "Func-1",input_params, output); + EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted); +} + +TEST_F(PolicyManagerImplStressTest, NoApp) { + ::policy::RPCParams input_params; + ::policy::CheckPermissionResult output; + manager->CheckPermissions("150", "FULL", "Func-88",input_params, output); + EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted); +} + +TEST_F(PolicyManagerImplStressTest, NoFunc) { + ::policy::RPCParams input_params; + ::policy::CheckPermissionResult output; + manager->CheckPermissions("2", "FULL", "Func-400",input_params, output); + EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted); +} + +TEST_F(PolicyManagerImplStressTest, NoHmi) { + ::policy::RPCParams input_params; + ::policy::CheckPermissionResult output; + manager->CheckPermissions("2", "NONE", "Func-88",input_params, output); + EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted); +} + +TEST_F(PolicyManagerImplStressTest, FewChecks) { + const int kNumberOfCheckings = 100; + std::stringstream ss; + int app, func; + std::string app_number, func_number; + for (int i = 0; i < kNumberOfCheckings; ++i) { + app = rand() % kNumberApps; + func = rand() % kNumberFuncs; + ss << app << std::endl; + ss >> app_number; + ss << func << std::endl; + ss >> func_number; + + ::policy::RPCParams input_params; + ::policy::CheckPermissionResult output; + manager->CheckPermissions(app_number, "FULL", "Func-" + func_number, + input_params, output); + EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted); + } +} + +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/policy_manager_impl_test.cc b/src/components/policy/test/policy_manager_impl_test.cc new file mode 100644 index 0000000000..6930c28320 --- /dev/null +++ b/src/components/policy/test/policy_manager_impl_test.cc @@ -0,0 +1,338 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <vector> + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + +#include "mock_policy_listener.h" +#include "mock_pt_representation.h" +#include "mock_pt_ext_representation.h" +#include "mock_cache_manager.h" +#include "mock_update_status_manager.h" +#include "policy/policy_manager_impl.h" +#include "policy/update_status_manager_interface.h" +#include "policy/cache_manager_interface.h" +#include "json/value.h" +#include "utils/shared_ptr.h" + +using ::testing::_; +using ::testing::Return; +using ::testing::DoAll; +using ::testing::SetArgReferee; +using ::testing::NiceMock; + +using ::policy::PTRepresentation; +using ::policy::MockPolicyListener; +using ::policy::MockPTRepresentation; +using ::policy::MockPTExtRepresentation; +using ::policy::MockCacheManagerInterface; +using ::policy::MockUpdateStatusManagerInterface; +using ::policy::PolicyManagerImpl; +using ::policy::PolicyTable; +using ::policy::EndpointUrls; +using ::policy::CacheManagerInterfaceSPtr; +using ::policy::UpdateStatusManagerInterfaceSPtr; + +namespace policy_table = rpc::policy_table_interface_base; + +namespace test { +namespace components { +namespace policy { + +class PolicyManagerImplTest : public ::testing::Test { + protected: + PolicyManagerImpl* manager; + MockCacheManagerInterface* cache_manager; + MockUpdateStatusManagerInterface* update_manager; + MockPolicyListener* listener; + + void SetUp() { + manager = new PolicyManagerImpl(); + + cache_manager = new MockCacheManagerInterface(); + manager->set_cache_manager(cache_manager); + + update_manager = new MockUpdateStatusManagerInterface(); + manager->set_update_status_manager(update_manager); + + listener = new MockPolicyListener(); + EXPECT_CALL(*update_manager, set_listener(listener)).Times(1); + manager->set_listener(listener); + } + + void TearDown() { + EXPECT_CALL(*update_manager, GetUpdateStatus()).Times(1) + .WillOnce(Return(::policy::StatusUpToDate)); + EXPECT_CALL(*cache_manager, Backup()).Times(1); + EXPECT_CALL(*cache_manager, SaveUpdateRequired(_)).Times(1); + delete manager; + delete listener; + } + + ::testing::AssertionResult IsValid(const policy_table::Table& table) { + if (table.is_valid()) { + return ::testing::AssertionSuccess(); + } else { + ::rpc::ValidationReport report(" - table"); + table.ReportErrors(&report); + return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report); + } + } +}; + +TEST_F(PolicyManagerImplTest, ExceededIgnitionCycles) { + EXPECT_CALL(*cache_manager, IgnitionCyclesBeforeExchange()).Times(2).WillOnce( + Return(5)).WillOnce(Return(0)); + EXPECT_CALL(*cache_manager, IncrementIgnitionCycles()).Times(1); + + EXPECT_FALSE(manager->ExceededIgnitionCycles()); + manager->IncrementIgnitionCycles(); + EXPECT_TRUE(manager->ExceededIgnitionCycles()); +} + +TEST_F(PolicyManagerImplTest, ExceededDays) { + EXPECT_CALL(*cache_manager, DaysBeforeExchange(_)).Times(2).WillOnce( + Return(5)).WillOnce(Return(0)); + + EXPECT_FALSE(manager->ExceededDays(5)); + EXPECT_TRUE(manager->ExceededDays(15)); +} + +TEST_F(PolicyManagerImplTest, ExceededKilometers) { + EXPECT_CALL(*cache_manager, KilometersBeforeExchange(_)).Times(2).WillOnce( + Return(50)).WillOnce(Return(0)); + + EXPECT_FALSE(manager->ExceededKilometers(50)); + EXPECT_TRUE(manager->ExceededKilometers(150)); +} + +TEST_F(PolicyManagerImplTest, RefreshRetrySequence) { + std::vector<int> seconds; + seconds.push_back(50); + seconds.push_back(100); + seconds.push_back(200); + + EXPECT_CALL(*cache_manager, TimeoutResponse()).Times(1).WillOnce(Return(60)); + EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_)).Times(1).WillOnce( + DoAll(SetArgReferee<0>(seconds), Return(true))); + + manager->RefreshRetrySequence(); + EXPECT_EQ(50, manager->NextRetryTimeout()); + EXPECT_EQ(100, manager->NextRetryTimeout()); + EXPECT_EQ(200, manager->NextRetryTimeout()); + EXPECT_EQ(0, manager->NextRetryTimeout()); +} + +TEST_F(PolicyManagerImplTest, RefreshRetrySequence) { + ::testing::NiceMock<MockPTRepresentation> mock_pt; + std::vector<int> seconds, seconds_empty; + seconds.push_back(50); + seconds.push_back(100); + seconds.push_back(200); + + EXPECT_CALL(mock_pt, TimeoutResponse()).Times(2).WillOnce(Return(0)).WillOnce( + Return(60)); + EXPECT_CALL(mock_pt, SecondsBetweenRetries(_)).Times(2).WillOnce( + DoAll(SetArgPointee<0>(seconds_empty), Return(true))).WillOnce( + DoAll(SetArgPointee<0>(seconds), Return(true))); + + PolicyManagerImpl* manager = new PolicyManagerImpl(); + manager->ResetDefaultPT(::policy::PolicyTable(&mock_pt)); + manager->RefreshRetrySequence(); + EXPECT_EQ(60, manager->TimeoutExchange()); + EXPECT_EQ(50, manager->NextRetryTimeout()); + EXPECT_EQ(100, manager->NextRetryTimeout()); + EXPECT_EQ(200, manager->NextRetryTimeout()); +} + + +TEST_F(PolicyManagerImplTest, ResetPT) { + EXPECT_CALL(*cache_manager, ResetPT("filename")).WillOnce(Return(true)) + .WillOnce(Return(false)); + EXPECT_CALL(*cache_manager, TimeoutResponse()).Times(1); + EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_)).Times(1); + + EXPECT_TRUE(manager->ResetPT("filename")); + EXPECT_FALSE(manager->ResetPT("filename")); +} + +// EXTENDED_POLICY +TEST_F(PolicyManagerImplTest, CheckPermissions) { + ::policy::CheckPermissionResult expected; + expected.hmi_level_permitted = ::policy::kRpcAllowed; + expected.list_of_allowed_params.push_back("speed"); + expected.list_of_allowed_params.push_back("gps"); + + EXPECT_CALL(*cache_manager, CheckPermissions("12345678", "FULL", "Alert", _)) + .Times(1).WillOnce(SetArgReferee<3>(expected)); + + ::policy::RPCParams input_params; + ::policy::CheckPermissionResult output; + manager->CheckPermissions("12345678", "FULL", "Alert", input_params, output); + + EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted); + ASSERT_TRUE(!output.list_of_allowed_params.empty()); + ASSERT_EQ(2u, output.list_of_allowed_params.size()); + EXPECT_EQ("speed", output.list_of_allowed_params[0]); + EXPECT_EQ("gps", output.list_of_allowed_params[1]); +} + +TEST_F(PolicyManagerImplTest, LoadPT) { + Json::Value table(Json::objectValue); + table["policy_table"] = Json::Value(Json::objectValue); + + Json::Value& policy_table = table["policy_table"]; + policy_table["module_config"] = Json::Value(Json::objectValue); + policy_table["functional_groupings"] = Json::Value(Json::objectValue); + policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue); + policy_table["app_policies"] = Json::Value(Json::objectValue); + + Json::Value& module_config = policy_table["module_config"]; + module_config["preloaded_pt"] = Json::Value(true); + module_config["exchange_after_x_ignition_cycles"] = Json::Value(10); + module_config["exchange_after_x_kilometers"] = Json::Value(100); + module_config["exchange_after_x_days"] = Json::Value(5); + module_config["timeout_after_x_seconds"] = Json::Value(500); + module_config["seconds_between_retries"] = Json::Value(Json::arrayValue); + module_config["seconds_between_retries"][0] = Json::Value(10); + module_config["seconds_between_retries"][1] = Json::Value(20); + module_config["seconds_between_retries"][2] = Json::Value(30); + module_config["endpoints"] = Json::Value(Json::objectValue); + module_config["endpoints"]["0x00"] = Json::Value(Json::objectValue); + module_config["endpoints"]["0x00"]["default"] = Json::Value(Json::arrayValue); + module_config["endpoints"]["0x00"]["default"][0] = Json::Value( + "http://ford.com/cloud/default"); + module_config["notifications_per_minute_by_priority"] = Json::Value( + Json::objectValue); + module_config["notifications_per_minute_by_priority"]["emergency"] = + Json::Value(1); + module_config["notifications_per_minute_by_priority"]["navigation"] = + Json::Value(2); + module_config["notifications_per_minute_by_priority"]["VOICECOMM"] = + Json::Value(3); + module_config["notifications_per_minute_by_priority"]["communication"] = + Json::Value(4); + module_config["notifications_per_minute_by_priority"]["normal"] = Json::Value( + 5); + module_config["notifications_per_minute_by_priority"]["none"] = Json::Value( + 6); + module_config["vehicle_make"] = Json::Value("MakeT"); + module_config["vehicle_model"] = Json::Value("ModelT"); + module_config["vehicle_year"] = Json::Value("2014"); + + Json::Value& functional_groupings = policy_table["functional_groupings"]; + functional_groupings["default"] = Json::Value(Json::objectValue); + Json::Value& default_group = functional_groupings["default"]; + default_group["rpcs"] = Json::Value(Json::objectValue); + default_group["rpcs"]["Update"] = Json::Value(Json::objectValue); + default_group["rpcs"]["Update"]["hmi_levels"] = Json::Value(Json::arrayValue); + default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL"); + default_group["rpcs"]["Update"]["parameters"] = Json::Value(Json::arrayValue); + default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed"); + + Json::Value& consumer_friendly_messages = + policy_table["consumer_friendly_messages"]; + consumer_friendly_messages["version"] = Json::Value("1.2"); + + Json::Value& app_policies = policy_table["app_policies"]; + app_policies["default"] = Json::Value(Json::objectValue); + app_policies["default"]["memory_kb"] = Json::Value(50); + app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(100); + app_policies["default"]["groups"] = Json::Value(Json::arrayValue); + app_policies["default"]["groups"][0] = Json::Value("default"); + app_policies["default"]["priority"] = Json::Value("EMERGENCY"); + app_policies["default"]["default_hmi"] = Json::Value("FULL"); + app_policies["default"]["keep_context"] = Json::Value(true); + app_policies["default"]["steal_focus"] = Json::Value(true); + app_policies["default"]["certificate"] = Json::Value("sign"); + app_policies["1234"] = Json::Value(Json::objectValue); + app_policies["1234"]["memory_kb"] = Json::Value(50); + app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(100); + app_policies["1234"]["groups"] = Json::Value(Json::arrayValue); + app_policies["1234"]["groups"][0] = Json::Value("default"); + app_policies["1234"]["priority"] = Json::Value("EMERGENCY"); + app_policies["1234"]["default_hmi"] = Json::Value("FULL"); + app_policies["1234"]["keep_context"] = Json::Value(true); + app_policies["1234"]["steal_focus"] = Json::Value(true); + app_policies["1234"]["certificate"] = Json::Value("sign"); + + policy_table::Table update(&table); + update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE); + ASSERT_TRUE(IsValid(update)); + + std::string json = table.toStyledString(); + ::policy::BinaryMessage msg(json.begin(), json.end()); + + utils::SharedPtr<policy_table::Table> snapshot = + new policy_table::Table(update.policy_table); + + EXPECT_CALL(*update_manager, OnValidUpdateReceived()).Times(1); + EXPECT_CALL(*cache_manager, GenerateSnapshot()).Times(1).WillOnce(Return(snapshot)); + EXPECT_CALL(*cache_manager, ApplyUpdate(_)).Times(1).WillOnce(Return(true)); + EXPECT_CALL(*listener, GetAppName("1234")).Times(1).WillOnce(Return("")); + EXPECT_CALL(*cache_manager, TimeoutResponse()).Times(1); + EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_)).Times(1); + EXPECT_CALL(*listener, OnUserRequestedUpdateCheckRequired()).Times(1); + + EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg)); +} + +TEST_F(PolicyManagerImplTest, RequestPTUpdate) { + ::utils::SharedPtr< ::policy_table::Table> p_table = + new ::policy_table::Table(); + std::string json = p_table->ToJsonValue().toStyledString(); + ::policy::BinaryMessageSptr expect = new ::policy::BinaryMessage(json.begin(), + json.end()); + + EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(p_table)); + + ::policy::BinaryMessageSptr output = manager->RequestPTUpdate(); + EXPECT_EQ(*expect, *output); +} + + +TEST_F(PolicyManagerImplTest, AddApplication) { + // TODO(AOleynik): Implementation of method should be changed to avoid + // using of snapshot + //manager->AddApplication("12345678"); +} + +TEST_F(PolicyManagerImplTest, GetPolicyTableStatus) { + // TODO(AOleynik): Test is not finished, to be continued + //manager->GetPolicyTableStatus(); +} + + +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/qdb_wrapper/sql_database_test.cc b/src/components/policy/test/qdb_wrapper/sql_database_test.cc new file mode 100644 index 0000000000..5ebf188042 --- /dev/null +++ b/src/components/policy/test/qdb_wrapper/sql_database_test.cc @@ -0,0 +1,139 @@ +/* Copyright (c) 2013, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#include <cstdlib> + +#include "gtest/gtest.h" + +#include "qdb_wrapper/sql_error.h" +#include "qdb_wrapper/sql_database.h" + +using ::policy::dbms::SQLError; +using ::policy::dbms::SQLDatabase; + +namespace test { +namespace components { +namespace policy { +namespace dbms { + +::testing::AssertionResult IsError(SQLError error) { + if (error.number() != ::policy::dbms::OK) { + return ::testing::AssertionSuccess() << error.text(); + } else { + return ::testing::AssertionFailure() << error.text(); + } +} + +TEST(SQLDatabaseTest, OpenClose) { + SQLDatabase db("test-database"); + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); +} + +TEST(SQLDatabaseTest, DoubleOpen) { + SQLDatabase db("test-database"); + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + db.Close(); +} + +TEST(SQLDatabaseTest, DoubleClose) { + SQLDatabase db("test-database"); + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); +} + +TEST(SQLDatabaseTest, CloseWithoutOpen) { + SQLDatabase db("test-database"); + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); +} + +TEST(SQLDatabaseTest, CommitTransaction) { + SQLDatabase db("test-database"); + ASSERT_TRUE(db.Open()); + EXPECT_TRUE(db.BeginTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + EXPECT_TRUE(db.CommitTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, RollbackTransaction) { + SQLDatabase db("test-database"); + ASSERT_TRUE(db.Open()); + EXPECT_TRUE(db.BeginTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + EXPECT_TRUE(db.RollbackTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, FailedCommitTransaction) { + SQLDatabase db("test-database"); + ASSERT_TRUE(db.Open()); + EXPECT_FALSE(db.CommitTransaction()); + EXPECT_TRUE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, FailedRollbackTransaction) { + SQLDatabase db("test-database"); + ASSERT_TRUE(db.Open()); + EXPECT_FALSE(db.RollbackTransaction()); + EXPECT_TRUE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, BadTransaction) { + SQLDatabase db("test-database"); + EXPECT_FALSE(db.BeginTransaction()); + EXPECT_TRUE(IsError(db.LastError())); +} + +} // namespace dbms +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/qdb_wrapper/sql_query_test.cc b/src/components/policy/test/qdb_wrapper/sql_query_test.cc new file mode 100644 index 0000000000..122241ea1f --- /dev/null +++ b/src/components/policy/test/qdb_wrapper/sql_query_test.cc @@ -0,0 +1,301 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <qdb/qdb.h> +#include <string> + +#include "gtest/gtest.h" + +#include "qdb_wrapper/sql_error.h" +#include "qdb_wrapper/sql_database.h" +#include "qdb_wrapper/sql_query.h" + +using ::policy::dbms::SQLError; +using ::policy::dbms::SQLDatabase; +using ::policy::dbms::SQLQuery; + +namespace test { +namespace components { +namespace policy { +namespace dbms { + +class SQLQueryTest : public ::testing::Test { + protected: + static qdb_hdl_t* conn; + static const std::string kDatabaseName; + + static void SetUpTestCase() { + conn = qdb_connect(kDatabaseName.c_str(), 0); + ASSERT_TRUE(conn); + int ret = qdb_statement(conn, "CREATE TABLE testTable (integerValue INTEGER," + " doubleValue REAL, stringValue TEXT)"); + ASSERT_NE(-1, ret); + } + + static void TearDownTestCase() { + qdb_statement(conn, "DROP TABLE IF EXISTS testTable"); + qdb_disconnect(conn); + } + + void SetUp() { + qdb_statement(conn, "DELETE FROM testTable"); + } + + ::testing::AssertionResult IsError(SQLError error) { + if (error.number() != ::policy::dbms::OK) { + return ::testing::AssertionSuccess() << error.text(); + } else { + return ::testing::AssertionFailure() << error.text(); + } + } +}; + +qdb_hdl_t* SQLQueryTest::conn = 0; +const std::string SQLQueryTest::kDatabaseName = "test-query"; + +TEST_F(SQLQueryTest, Query) { + const std::string kSelect("SELECT * FROM testTable WHERE integerValue = ?"); + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + query.Prepare(kSelect); + EXPECT_STREQ(kSelect.c_str(), query.query().c_str()); +} + +TEST_F(SQLQueryTest, ExecString) { + const std::string kInsert("INSERT INTO testTable" + " (integerValue, doubleValue, stringValue)" + " VALUES(1, 1.1, 'one-один')"); + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Exec(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, BindInteger) { + const std::string kInsert("INSERT INTO testTable (integerValue) VALUES (?)"); + const int kIntegerValue = 2; + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kIntegerValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, BindDouble) { + const std::string kInsert("INSERT INTO testTable (doubleValue) VALUES (?)"); + const double kDoubleValue = 3.3; + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + SQLQuery query(db); + EXPECT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kDoubleValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, BindString) { + const std::string kInsert("INSERT INTO testTable (stringValue) VALUES (?)"); + const std::string kStringValue = "four-четыре"; + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kStringValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, BindAllTypes) { + const std::string kInsert("INSERT INTO testTable (integerValue, doubleValue," + " stringValue) VALUES (?, ?, ?)"); + const int kIntegerValue = 5; + const double kDoubleValue = 5.5; + const std::string kStringValue = "five-пять"; + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kIntegerValue); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(1, kDoubleValue); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(2, kStringValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, Value) { + const char* insert = "INSERT INTO testTable " + "(integerValue, doubleValue, stringValue) " + "VALUES (6, 6.6, 'six-шесть');"; + ASSERT_NE(-1, qdb_statement(conn, insert)); + + const std::string kSelect("SELECT integerValue, doubleValue, stringValue" + " FROM testTable WHERE integerValue = 6"); + const int kIntegerValue = 6; + const double kDoubleValue = 6.6; + const std::string kStringValue = "six-шесть"; + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Prepare(kSelect)); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_EQ(kIntegerValue, query.GetInteger(0)); + EXPECT_EQ(kDoubleValue, query.GetDouble(1)); + EXPECT_EQ(kStringValue, query.GetString(2)); + EXPECT_FALSE(query.Next()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, EmptySelect) { + const std::string kSelect("SELECT integerValue, doubleValue, stringValue" + " FROM testTable WHERE 0"); + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Prepare(kSelect)); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, NextAndBind) { + const char* insert = "INSERT INTO testTable " + "(integerValue, doubleValue, stringValue) " + "VALUES (7, 7.7, 'seven-семь');"; + ASSERT_NE(-1, qdb_statement(conn, insert)); + + const std::string kSelect("SELECT integerValue, doubleValue, stringValue" + " FROM testTable WHERE integerValue = ?"); + const int kIntegerValue = 7; + const double kDoubleValue = 7.7; + const std::string kStringValue = "seven-семь"; + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + ASSERT_TRUE(query.Prepare(kSelect)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kIntegerValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + ASSERT_FALSE(IsError(query.LastError())); + EXPECT_EQ(kIntegerValue, query.GetInteger(0)); + EXPECT_EQ(kDoubleValue, query.GetDouble(1)); + EXPECT_EQ(kStringValue, query.GetString(2)); + EXPECT_FALSE(query.Next()); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, LastInsertId) { + const char* create = "CREATE TABLE idTable ( " + "id INTEGER PRIMARY KEY AUTOINCREMENT," + "value TEXT)"; + ASSERT_NE(-1, qdb_statement(conn, create)); + + const int64_t kExpectId = 1; + const std::string kValue("Test last id of insert row"); + const std::string kInsert("INSERT INTO idTable (value) VALUES(?)"); + + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + ASSERT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + ASSERT_FALSE(IsError(query.LastError())); + EXPECT_EQ(kExpectId, query.LastInsertId()); + + ASSERT_NE(-1, qdb_statement(conn, "DROP TABLE idTable")); +} + +TEST_F(SQLQueryTest, BindNull) { + const std::string kInsert("INSERT INTO testTable (`integerValue`)" + " VALUES (?)"); + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + ASSERT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + ASSERT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, DoublePrepare) { + SQLDatabase* db = new SQLDatabase(kDatabaseName); + ASSERT_TRUE(db->Open()); + + SQLQuery query(db); + EXPECT_TRUE(query.Prepare("SELECT * FROM testTable")); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Prepare("SELECT * FROM testTable")); + EXPECT_FALSE(IsError(query.LastError())); +} + +} // namespace dbms +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/qdbserver.sh b/src/components/policy/test/qdbserver.sh new file mode 100755 index 0000000000..3f0144106d --- /dev/null +++ b/src/components/policy/test/qdbserver.sh @@ -0,0 +1,6 @@ +# This script star QDB server for SDL +# Need superuser to start qdb + +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/qnx650/target/qnx6/x86/usr/lib +export LD_LIBRARY_PATH +/usr/sbin/qdb -c test-qdb.ini diff --git a/src/components/policy/test/sdl_preloaded_pt.json b/src/components/policy/test/sdl_preloaded_pt.json new file mode 100644 index 0000000000..52b7684b06 --- /dev/null +++ b/src/components/policy/test/sdl_preloaded_pt.json @@ -0,0 +1,1937 @@ +{ + "policy_table": { + "module_config": { + "preloaded_pt": true, + "exchange_after_x_ignition_cycles": 100, + "exchange_after_x_kilometers": 1800, + "exchange_after_x_days": 30, + "timeout_after_x_seconds": 60, + "seconds_between_retries": [1, + 5, + 25, + 125, + 625], + "endpoints": { + "0x07": { + "default": ["http://policies.telematics.ford.com/api/policies"] + } + }, + "notifications_per_minute_by_priority": { + "EMERGENCY": 60, + "NAVIGATION": 15, + "COMMUNICATION": 6, + "NORMAL": 4, + "NONE": 0 + } + }, + "functional_groupings": { + "Base-4": { + "rpcs": { + "AddCommand": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "AddSubMenu": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "Alert": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "ChangeRegistration": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "CreateInteractionChoiceSet": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "DeleteCommand": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "DeleteFile": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "DeleteInteractionChoiceSet": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "DeleteSubMenu": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "EncodedSyncPData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "EndAudioPassThru": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "GenericResponse": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "ListFiles": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnAppInterfaceUnregistered": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnAudioPassThru": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "OnButtonEvent": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "OnButtonPress": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "OnCommand": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "OnDriverDistraction": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "OnEncodedSyncPData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnHashChange": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnHMIStatus": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnLanguageChange": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnPermissionsChange": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnSystemRequest": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "PerformAudioPassThru": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "PerformInteraction": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "PutFile": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "RegisterAppInterface": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "ResetGlobalProperties": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "ScrollableMessage": { + "hmi_levels": ["FULL"] + }, + "SetAppIcon": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "SetDisplayLayout": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "SetGlobalProperties": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "SetMediaClockTimer": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "Show": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "Slider": { + "hmi_levels": ["FULL"] + }, + "Speak": { + "hmi_levels": ["FULL", + "LIMITED"] + }, + "SubscribeButton": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "SystemRequest": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "UnregisterAppInterface": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "UnsubscribeButton": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + } + } + }, + "Location-1": { + "user_consent_prompt": "Location", + "rpcs": { + "GetVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["gps", + "speed"] + }, + "OnVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["gps", + "speed"] + }, + "SubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["gps", + "speed"] + }, + "UnsubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["gps", + "speed"] + } + } + }, + "Notifications": { + "user_consent_prompt": "Notifications", + "rpcs": { + "Alert": { + "hmi_levels": ["BACKGROUND"] + } + } + }, + "DrivingCharacteristics-3": { + "user_consent_prompt": "DrivingCharacteristics", + "rpcs": { + "GetVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle"] + }, + "OnVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle"] + }, + "SubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle"] + }, + "UnsubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle"] + } + } + }, + "VehicleInfo-3": { + "user_consent_prompt": "VehicleInfo", + "rpcs": { + "GetVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["bodyInformation", + "deviceStatus", + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "vin", + "wiperStatus"] + }, + "OnVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["bodyInformation", + "deviceStatus", + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "vin", + "wiperStatus"] + }, + "SubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["bodyInformation", + "deviceStatus", + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "wiperStatus"] + }, + "UnsubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["bodyInformation", + "deviceStatus", + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "wiperStatus"] + } + } + }, + "PropriataryData-1": { + "rpcs": { + "DiagnosticMessage": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "GetDTCs": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "ReadDID": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + } + } + }, + "Emergency-1": { + "rpcs": { + "GetVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["airbagStatus", + "clusterModeStatus", + "eCallInfo", + "emergencyEvent"] + }, + "OnVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["airbagStatus", + "clusterModeStatus", + "eCallInfo", + "emergencyEvent"] + }, + "SubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["airbagStatus", + "clusterModeStatus", + "eCallInfo", + "emergencyEvent"] + }, + "UnsubscribeVehicleData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"], + "parameters": ["airbagStatus", + "clusterModeStatus", + "eCallInfo", + "emergencyEvent"] + } + } + }, + "Navigation-1": { + "rpcs": { + "AlertManeuver": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "ShowConstantTBT": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + }, + "UpdateTurnList": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED"] + } + } + }, + "DataConsent-2": { + "user_consent_prompt": "DataConsent", + "rpcs": null + }, + "BaseBeforeDataConsent": { + "rpcs": { + "ChangeRegistration": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "DeleteFile": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "EncodedSyncPData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "ListFiles": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnAppInterfaceUnregistered": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnEncodedSyncPData": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnHashChange": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnHMIStatus": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnLanguageChange": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnPermissionsChange": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "OnSystemRequest": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "PutFile": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "RegisterAppInterface": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "SetAppIcon": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "SetDisplayLayout": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "SystemRequest": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + }, + "UnregisterAppInterface": { + "hmi_levels": ["BACKGROUND", + "FULL", + "LIMITED", + "NONE"] + } + } + } + }, + "consumer_friendly_messages": { + "version": "001.001.019", + "messages": { + "AppPermissions": { + "languages": { + "de-de": { + "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.", + "line1": "Zugriffsanfrage(n)", + "line2": "erlauben?" + }, + "en-au": { + "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.", + "line1": "Grant requested", + "line2": "permission(s)?" + }, + "en-gb": { + "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.", + "line1": "Grant requested", + "line2": "permission(s)?", + "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu." + }, + "en-ie": { + "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.", + "line1": "Grant requested", + "line2": "permission(s)?" + }, + "en-us": { + "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.", + "line1": "Grant Requested", + "line2": "Permission(s)?", + "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu." + }, + "es-en": { + "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.", + "line1": "¿Otorgar permiso(s)", + "line2": "solicitado(s)?", + "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles." + }, + "es-es": { + "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.", + "line1": "¿Conceder permisos", + "line2": "solicitados?" + }, + "es-mx": { + "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.", + "line1": "¿Otorgar permiso(s)", + "line2": "solicitado(s)?" + }, + "fr-ca": { + "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.", + "line1": "Accorder permission(s)", + "line2": "demandée(s)", + "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles." + }, + "fr-fr": { + "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.", + "line1": "Accorder permission(s)", + "line2": "demandée(s)" + }, + "it-it": { + "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.", + "line1": "Concedi autorizzaz.", + "line2": "richiesta(e)?" + }, + "nl-nl": { + "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.", + "line1": "Aangevraagde", + "line2": "permissie(s) verlenen?" + }, + "pl-pl": { + "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.", + "line1": "Udzielić żądanych", + "line2": "pozwoleń?" + }, + "pt-br": { + "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.", + "line1": "Conceder permissão", + "line2": "solicitada?" + }, + "pt-pt": { + "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.", + "line1": "Conceder permiss.", + "line2": "solicitada(s)?" + }, + "ru-ru": { + "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.", + "line1": "Предост. заправш.", + "line2": "разрешения?" + }, + "sv-se": { + "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.", + "line1": "Vill du ge", + "line2": "tillstånd?" + }, + "tr-tr": { + "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.", + "line1": "İstenen izinler", + "line2": "verilsin mi?" + }, + "zh-cn": { + "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。", + "line1": "是否允许请求的", + "line2": "权限?" + }, + "zh-tw": { + "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。", + "line1": "允許", + "line2": "授權請求?" + } + } + }, + "AppPermissionsHelp": { + "languages": { + "de-de": { + "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab." + }, + "en-au": { + "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." + }, + "en-gb": { + "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." + }, + "en-ie": { + "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." + }, + "en-us": { + "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." + }, + "es-en": { + "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." + }, + "es-es": { + "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." + }, + "es-mx": { + "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." + }, + "fr-ca": { + "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser." + }, + "fr-fr": { + "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser." + }, + "it-it": { + "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle." + }, + "nl-nl": { + "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren." + }, + "pl-pl": { + "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania." + }, + "pt-br": { + "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar." + }, + "pt-pt": { + "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar." + }, + "ru-ru": { + "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять." + }, + "sv-se": { + "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka." + }, + "tr-tr": { + "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın." + }, + "zh-cn": { + "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。" + }, + "zh-tw": { + "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。" + } + } + }, + "AppPermissionsRevoked": { + "languages": { + "de-de": { + "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.." + }, + "en-au": { + "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "en-gb": { + "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "en-ie": { + "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "en-us": { + "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "es-en": { + "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." + }, + "es-es": { + "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." + }, + "es-mx": { + "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." + }, + "fr-ca": { + "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile." + }, + "fr-fr": { + "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile." + }, + "it-it": { + "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile." + }, + "nl-nl": { + "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt." + }, + "pl-pl": { + "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji." + }, + "pt-br": { + "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel." + }, + "pt-pt": { + "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel." + }, + "ru-ru": { + "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения." + }, + "sv-se": { + "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten." + }, + "tr-tr": { + "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun." + }, + "zh-cn": { + "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。" + }, + "zh-tw": { + "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。" + } + } + }, + "AppUnauthorized": { + "languages": { + "de-de": { + "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.", + "line1": "nicht autorisiert" + }, + "en-au": { + "tts": "This version of %appName% is not authorized and will not work with SYNC.", + "line1": "not authorized" + }, + "en-gb": { + "tts": "This version of %appName% is not authorized and will not work with SYNC.", + "line1": "not authorized", + "textBody": "This version of %appName% is not authorized and will not work with SYNC." + }, + "en-ie": { + "tts": "This version of %appName% is not authorized and will not work with SYNC.", + "line1": "not authorized" + }, + "en-us": { + "tts": "This version of %appName% is not authorized and will not work with SYNC.", + "line1": "Not Authorized", + "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%." + }, + "es-en": { + "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", + "line1": "no autorizada", + "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." + }, + "es-es": { + "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.", + "line1": "No autorizada" + }, + "es-mx": { + "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", + "line1": "no autorizada" + }, + "fr-ca": { + "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.", + "line1": "non autorisée", + "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC." + }, + "fr-fr": { + "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.", + "line1": "non autorisée" + }, + "it-it": { + "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.", + "line1": "non autorizzata" + }, + "nl-nl": { + "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.", + "line1": "niet geautoriseerd" + }, + "pl-pl": { + "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.", + "line1": "brak autoryzacji" + }, + "pt-br": { + "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.", + "line1": "não autorizado" + }, + "pt-pt": { + "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.", + "line1": "não autorizada" + }, + "ru-ru": { + "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.", + "line1": "не авторизировано" + }, + "sv-se": { + "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.", + "line1": "är ej godkänd" + }, + "tr-tr": { + "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.", + "line1": "için izin yok" + }, + "zh-cn": { + "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。", + "line1": "未得到授权" + }, + "zh-tw": { + "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。", + "line1": "無授權" + } + } + }, + "AppUnsupported": { + "languages": { + "de-de": { + "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.", + "line1": "nicht unterstützt" + }, + "en-au": { + "tts": "This version of %appName% is not supported by SYNC.", + "line1": "not supported" + }, + "en-gb": { + "tts": "This version of %appName% is not supported by SYNC.", + "line1": "not supported", + "textBody": "This version of %appName% is not supported by SYNC." + }, + "en-ie": { + "tts": "This version of %appName% is not supported by SYNC.", + "line1": "not supported" + }, + "en-us": { + "tts": "This version of %appName% is not supported by SYNC.", + "line1": "Not Supported", + "textBody": "Your version of %appName% is not supported by SYNC." + }, + "es-en": { + "tts": "Esta versión de %appName% no es compatible con SYNC.", + "line1": "no compatible", + "textBody": "Esta versión de %appName% no es compatible con SYNC." + }, + "es-es": { + "tts": "Esta versión de %appName% no es compatible con SYNC.", + "line1": "No compatible" + }, + "es-mx": { + "tts": "Esta versión de %appName% no es compatible con SYNC.", + "line1": "no compatible" + }, + "fr-ca": { + "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.", + "line1": "incompatible", + "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC." + }, + "fr-fr": { + "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.", + "line1": "incompatible" + }, + "it-it": { + "tts": "Questa versione di %appName% non è supportata dal SYNC.", + "line1": "non supportata" + }, + "nl-nl": { + "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.", + "line1": "niet ondersteund" + }, + "pl-pl": { + "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.", + "line1": "aplikacja nie obsług." + }, + "pt-br": { + "tts": "Esta versão do %appName% não é suportada pelo SYNC.", + "line1": "não suportado" + }, + "pt-pt": { + "tts": "Esta versão de %appName% não é suportado pelo SYNC.", + "line1": "não suportada" + }, + "ru-ru": { + "tts": "Эта версия %appName% не поддерживается SYNC.", + "line1": "не поддерживается" + }, + "sv-se": { + "tts": "SYNC har inte stöd för den här versionen av %appName%.", + "line1": "stöds ej" + }, + "tr-tr": { + "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.", + "line1": "desteklenmiyor" + }, + "zh-cn": { + "tts": "SYNC不支持此版本的%appName%。", + "line1": "不受支持" + }, + "zh-tw": { + "tts": "SYNC 不支援此版本的%appName% 。", + "line1": "不支援" + } + } + }, + "DataConsent": { + "languages": { + "en-gb": { + "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information." + }, + "en-us": { + "line1": "Enable Mobile Apps", + "line2": "on SYNC? (Uses Data)", + "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information." + }, + "es-en": { + "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar." + }, + "fr-ca": { + "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser." + } + } + }, + "DataConsentHelp": { + "languages": { + "en-us": { + "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information." + }, + "es-en": { + "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario." + }, + "fr-ca": { + "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements." + } + } + }, + "DisableApps": { + "languages": { + "de-de": { + "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.", + "line1": "Auto-Update", + "line2": "und Mobile Apps deaktivieren" + }, + "en-au": { + "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", + "line1": "Disable auto-updates", + "line2": "and Mobile Apps?" + }, + "en-gb": { + "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", + "line1": "Disable auto-updates", + "line2": "and Mobile Apps?", + "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." + }, + "en-ie": { + "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", + "line1": "Disable auto-updates", + "line2": "and Mobile Apps?" + }, + "en-us": { + "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.", + "line1": "Disable Auto-Updates", + "line2": "and Mobile Apps?", + "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." + }, + "es-en": { + "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", + "line1": "¿Deshab. actualiz.", + "line2": "autom. y aplic. móv.?", + "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." + }, + "es-es": { + "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.", + "line1": "¿Desact. actual. auto", + "line2": "y apl. móviles?" + }, + "es-mx": { + "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", + "line1": "¿Deshab. actualiz.", + "line2": "autom. y aplic. móv.?" + }, + "fr-ca": { + "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.", + "line1": "Désactiver màj autom.", + "line2": "et app. mobiles?", + "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler." + }, + "fr-fr": { + "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.", + "line1": "Désactiver màj autom.", + "line2": "et app. mobiles?" + }, + "it-it": { + "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.", + "line1": "Disabilitare agg. aut.", + "line2": "e app mobili?" + }, + "nl-nl": { + "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.", + "line1": "Auto-updates en mob.", + "line2": "apps uitschakelen?" + }, + "pl-pl": { + "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.", + "line1": "Wył. automat. aktual.", + "line2": "i aplikacje mobilne?" + }, + "pt-br": { + "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.", + "line1": "Desativar atualizações", + "line2": "autom. e aplicativos?" + }, + "pt-pt": { + "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.", + "line1": "Desact. actual. autom.", + "line2": "e aplicações móveis?" + }, + "ru-ru": { + "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.", + "line1": "Откл. автообновления", + "line2": "и мобил. прилож.?" + }, + "sv-se": { + "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.", + "line1": "Avaktiverar autouppdat.", + "line2": "och mobilappar?" + }, + "tr-tr": { + "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.", + "line1": "Oto. güncelleme ve", + "line2": "mobil uygul. kapat?" + }, + "zh-cn": { + "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。", + "line1": "是否禁用自动更新和", + "line2": "移动应用程序?" + }, + "zh-tw": { + "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。", + "line1": "停用自動更新", + "line2": "和行動應用程式?" + } + } + }, + "DrivingCharacteristics": { + "languages": { + "de-de": { + "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.", + "label": "Fahreigenschaften" + }, + "en-au": { + "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", + "label": "Driving characteristics" + }, + "en-gb": { + "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", + "label": "Driving characteristics", + "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." + }, + "en-ie": { + "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", + "label": "Driving characteristics" + }, + "en-us": { + "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.", + "label": "Driving Characteristics", + "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status." + }, + "es-en": { + "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", + "label": "Características del manejo", + "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." + }, + "es-es": { + "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.", + "label": "Características de conducción" + }, + "es-mx": { + "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", + "label": "Características del manejo" + }, + "fr-ca": { + "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.", + "label": "Caractéristiques de conduite", + "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité." + }, + "fr-fr": { + "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.", + "label": "Caractéristiques de conduite" + }, + "it-it": { + "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.", + "label": "Caratteristiche di guida" + }, + "nl-nl": { + "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.", + "label": "Rijkenmerken" + }, + "pl-pl": { + "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.", + "label": "Informacje dotyczące stylu jazdy" + }, + "pt-br": { + "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.", + "label": "Características de condução" + }, + "pt-pt": { + "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.", + "label": "Características de condução" + }, + "ru-ru": { + "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.", + "label": "Характеристики движения" + }, + "sv-se": { + "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.", + "label": "Köregenskaper" + }, + "tr-tr": { + "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.", + "label": "Sürüş karakteristikleri" + }, + "zh-cn": { + "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态", + "label": "行驶特性" + }, + "zh-tw": { + "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態", + "label": "駕駛特性" + } + } + }, + "Location": { + "languages": { + "de-de": { + "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.", + "label": "GPS und Geschwindigkeit" + }, + "en-au": { + "tts": "An app can access vehicle GPS and speed.", + "label": "GPS and speed" + }, + "en-gb": { + "tts": "An app can access vehicle GPS and speed.", + "label": "GPS and speed", + "textBody": "An app can access vehicle GPS and speed." + }, + "en-ie": { + "tts": "An app can access vehicle GPS and speed.", + "label": "GPS and speed" + }, + "en-us": { + "tts": "An app can access vehicle GPS and speed.", + "label": "GPS and speed", + "textBody": "An app can access vehicle GPS and speed." + }, + "es-en": { + "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", + "label": "GPS y velocidad", + "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." + }, + "es-es": { + "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.", + "label": "GPS y velocidad" + }, + "es-mx": { + "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", + "label": "GPS y velocidad" + }, + "fr-ca": { + "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.", + "label": "GPS et vitesse", + "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule." + }, + "fr-fr": { + "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.", + "label": "GPS et vitesse" + }, + "it-it": { + "tts": "Un'app può avere accesso a GPS e velocità del veicolo.", + "label": "GPS e velocità" + }, + "nl-nl": { + "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.", + "label": "Gps en snelheid" + }, + "pl-pl": { + "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.", + "label": "GPS i prędkość" + }, + "pt-br": { + "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.", + "label": "GPS e velocidade" + }, + "pt-pt": { + "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.", + "label": "GPS e velocidade" + }, + "ru-ru": { + "tts": "Приложение имеет доступ к GPS и скорости автомобиля.", + "label": "GPS и скорость" + }, + "sv-se": { + "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.", + "label": "GPS och hastighet" + }, + "tr-tr": { + "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.", + "label": "GPS ve hız" + }, + "zh-cn": { + "tts": "移动应用程序可以访问车辆 GPS 和车速信息。", + "label": "GPS 和车速" + }, + "zh-tw": { + "tts": "應用程式可存取車輛的GPS和速度。", + "label": "GPS和車速" + } + } + }, + "Notifications": { + "languages": { + "de-de": { + "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.", + "label": "Push-Benachrichtigungen" + }, + "en-au": { + "tts": "An app can send notifications when running in the background.", + "label": "Push notifications" + }, + "en-gb": { + "tts": "An app can send notifications when running in the background.", + "label": "Push notifications", + "textBody": "An app can send notifications when running in the background." + }, + "en-ie": { + "tts": "An app can send notifications when running in the background.", + "label": "Push notifications" + }, + "en-us": { + "tts": "An app can send notifications when running in the background.", + "label": "Push notifications", + "textBody": "An app can send notifications when running in the background." + }, + "es-en": { + "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", + "label": "Notificaciones tipo Push", + "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." + }, + "es-es": { + "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.", + "label": "Notificaciones push" + }, + "es-mx": { + "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", + "label": "Notificaciones tipo Push" + }, + "fr-ca": { + "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.", + "label": "Notifications instantanées", + "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan." + }, + "fr-fr": { + "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.", + "label": "Notifications push" + }, + "it-it": { + "tts": "Un'app può inviare notifiche se eseguita in background.", + "label": "Notifiche push" + }, + "nl-nl": { + "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.", + "label": "Push-meldingen" + }, + "pl-pl": { + "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.", + "label": "Powiadomienia Push" + }, + "pt-br": { + "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.", + "label": "Notificações Push" + }, + "pt-pt": { + "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.", + "label": "Notificações push" + }, + "ru-ru": { + "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.", + "label": "Оповещения о пересылке" + }, + "sv-se": { + "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.", + "label": "Push-notiser" + }, + "tr-tr": { + "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.", + "label": "Anlık bildirimleri" + }, + "zh-cn": { + "tts": "移动应用程序在后台运行时可推送通知。", + "label": "推送通知" + }, + "zh-tw": { + "tts": "車輛行進時,應用程式可在背景中傳送通知。", + "label": "傳送通知" + } + } + }, + "SettingDisableUpdates": { + "languages": { + "de-de": { + "line1": "Updates deakt." + }, + "en-au": { + "line1": "Disable updates" + }, + "en-gb": { + "line1": "Disable updates" + }, + "en-ie": { + "line1": "Disable updates" + }, + "en-us": { + "line1": "Disable Updates", + "textBody": "Disable Updates" + }, + "es-en": { + "line1": "Deshab. actual.", + "textBody": "Deshab. actual." + }, + "es-es": { + "line1": "Desact. actual." + }, + "es-mx": { + "line1": "Deshab. actual." + }, + "fr-ca": { + "line1": "Désactiver MAJ", + "textBody": "Désactiver MAJ" + }, + "fr-fr": { + "line1": "Désactiver màj" + }, + "it-it": { + "line1": "Disabilita agg." + }, + "nl-nl": { + "line1": "Upd. uitschak." + }, + "pl-pl": { + "line1": "Wyłącz aktual." + }, + "pt-br": { + "line1": "Desat. atualiz." + }, + "pt-pt": { + "line1": "Desact. actualiz." + }, + "ru-ru": { + "line1": "Откл. обновл." + }, + "sv-se": { + "line1": "Inaktivera uppd." + }, + "tr-tr": { + "line1": "Güncell. Kapat" + }, + "zh-cn": { + "line1": "禁用更新" + }, + "zh-tw": { + "line1": "停用更新" + } + } + }, + "SettingEnableUpdates": { + "languages": { + "de-de": { + "line1": "Apps aktivieren" + }, + "en-au": { + "line1": "Enable Apps" + }, + "en-gb": { + "line1": "Enable Apps" + }, + "en-ie": { + "line1": "Enable Apps" + }, + "en-us": { + "line1": "Enable Apps" + }, + "es-en": { + "line1": "Hab. aplic." + }, + "es-es": { + "line1": "Activar apl." + }, + "es-mx": { + "line1": "Hab. aplic." + }, + "fr-ca": { + "line1": "Activer app.", + "textBody": "Activer app." + }, + "fr-fr": { + "line1": "Activer app." + }, + "it-it": { + "line1": "Abilita app" + }, + "nl-nl": { + "line1": "Apps inschak." + }, + "pl-pl": { + "line1": "Włącz aplikacje" + }, + "pt-br": { + "line1": "Ativar aplic." + }, + "pt-pt": { + "line1": "Activar actualiz." + }, + "ru-ru": { + "line1": "Вкл. прилож." + }, + "sv-se": { + "line1": "Aktivera appar" + }, + "tr-tr": { + "line1": "Uygulamaları aç" + }, + "zh-cn": { + "line1": "启用应用程序" + }, + "zh-tw": { + "line1": "啟用應用程式" + } + } + }, + "SettingUpdateAuto": { + "languages": { + "de-de": { + "line1": "Update anford." + }, + "en-au": { + "line1": "Request update" + }, + "en-gb": { + "line1": "Request update" + }, + "en-ie": { + "line1": "Request update" + }, + "en-us": { + "line1": "Request Update", + "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute." + }, + "es-en": { + "line1": "Solicit. actualiz.", + "textBody": "Solicit. actualiz." + }, + "es-es": { + "line1": "Solicitar actual." + }, + "es-mx": { + "line1": "Solicit. actualiz." + }, + "fr-ca": { + "line1": "Demander MAJ", + "textBody": "Demander MAJ" + }, + "fr-fr": { + "line1": "Demander màj" + }, + "it-it": { + "line1": "Rich. aggiorn." + }, + "nl-nl": { + "line1": "Upd. aanvragen" + }, + "pl-pl": { + "line1": "Zażądaj aktual." + }, + "pt-br": { + "line1": "Solicitar atualiz." + }, + "pt-pt": { + "line1": "Solicit. actualiz." + }, + "ru-ru": { + "line1": "Запрос на обн." + }, + "sv-se": { + "line1": "Begär uppdat." + }, + "tr-tr": { + "line1": "Güncelleme iste" + }, + "zh-cn": { + "line1": "请求更新" + }, + "zh-tw": { + "line1": "請求更新" + } + } + }, + "StatusNeeded": { + "languages": { + "de-de": { + "line1": "Update benötigt" + }, + "en-au": { + "line1": "Update needed" + }, + "en-gb": { + "line1": "Update needed", + "textBody": "Update needed" + }, + "en-ie": { + "line1": "Update needed" + }, + "en-us": { + "line1": "Update Needed", + "textBody": "Update Needed" + }, + "es-en": { + "line1": "Actualiz. neces.", + "textBody": "Actualiz. neces." + }, + "es-es": { + "line1": "Actu. necesaria" + }, + "es-mx": { + "line1": "Actualiz. neces." + }, + "fr-ca": { + "line1": "Màj requise", + "textBody": "Màj requise" + }, + "fr-fr": { + "line1": "Mise à jour requise" + }, + "it-it": { + "line1": "Necess. aggiorn." + }, + "nl-nl": { + "line1": "Update nodig" + }, + "pl-pl": { + "line1": "Potrzeba aktual." + }, + "pt-br": { + "line1": "Atualiz. necess." + }, + "pt-pt": { + "line1": "Actual. necess." + }, + "ru-ru": { + "line1": "Необх. обновл." + }, + "sv-se": { + "line1": "Uppdat. krävs" + }, + "tr-tr": { + "line1": "Güncellenmeli" + }, + "zh-cn": { + "line1": "需要进行更新" + }, + "zh-tw": { + "line1": "需更新" + } + } + }, + "StatusPending": { + "languages": { + "de-de": { + "line1": "Aktualisieren..." + }, + "en-au": { + "line1": "Updating..." + }, + "en-gb": { + "line1": "Updating...", + "textBody": "Updating..." + }, + "en-ie": { + "line1": "Updating..." + }, + "en-us": { + "line1": "Updating...", + "textBody": "Updating..." + }, + "es-en": { + "line1": "Actualizando...", + "textBody": "Actualizando..." + }, + "es-es": { + "line1": "Actualizando..." + }, + "es-mx": { + "line1": "Actualizando..." + }, + "fr-ca": { + "line1": "MAJ en cours...", + "textBody": "MAJ en cours..." + }, + "fr-fr": { + "line1": "Màj en cours..." + }, + "it-it": { + "line1": "Aggiornamento" + }, + "nl-nl": { + "line1": "Updaten..." + }, + "pl-pl": { + "line1": "Aktualizowanie" + }, + "pt-br": { + "line1": "Atualizando..." + }, + "pt-pt": { + "line1": "A actualizar..." + }, + "ru-ru": { + "line1": "Обновление..." + }, + "sv-se": { + "line1": "Uppdaterar..." + }, + "tr-tr": { + "line1": "Güncelleniyor..." + }, + "zh-cn": { + "line1": "正在更新......" + }, + "zh-tw": { + "line1": "更新中..." + } + } + }, + "StatusUpToDate": { + "languages": { + "de-de": { + "line1": "Aktuelle Version" + }, + "en-au": { + "line1": "Up-to-date" + }, + "en-gb": { + "line1": "Up-to-date", + "textBody": "Up-to-date" + }, + "en-ie": { + "line1": "Up-to-date" + }, + "en-us": { + "line1": "Up-To-Date", + "textBody": "Up-To-Date" + }, + "es-en": { + "line1": "Actualizado", + "textBody": "Actualizado" + }, + "es-es": { + "line1": "Actualizada" + }, + "es-mx": { + "line1": "Actualizado" + }, + "fr-ca": { + "line1": "Déjà à jour", + "textBody": "Déjà à jour" + }, + "fr-fr": { + "line1": "Déjà à jour" + }, + "it-it": { + "line1": "più recente" + }, + "nl-nl": { + "line1": "Up-to-date" + }, + "pl-pl": { + "line1": "Aktualne" + }, + "pt-br": { + "line1": "Atualizado" + }, + "pt-pt": { + "line1": "Actualizado" + }, + "ru-ru": { + "line1": "Обновлено" + }, + "sv-se": { + "line1": "Uppdat. krävs ej" + }, + "tr-tr": { + "line1": "Güncel" + }, + "zh-cn": { + "line1": "最新更新" + }, + "zh-tw": { + "line1": "更新最新" + } + } + }, + "VehicleInfo": { + "languages": { + "de-de": { + "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.", + "label": "Fahrzeuginformationen" + }, + "en-au": { + "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.", + "label": "Vehicle information" + }, + "en-gb": { + "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.", + "label": "Vehicle information", + "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure." + }, + "en-ie": { + "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.", + "label": "Vehicle information" + }, + "en-us": { + "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.", + "label": "Vehicle information", + "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure." + }, + "es-en": { + "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", + "label": "Información del vehículo", + "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." + }, + "es-es": { + "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.", + "label": "Información del vehículo" + }, + "es-mx": { + "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", + "label": "Información del vehículo" + }, + "fr-ca": { + "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.", + "label": "Renseignements du véhicule", + "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus." + }, + "fr-fr": { + "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.", + "label": "Renseignements du véhicule" + }, + "it-it": { + "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.", + "label": "Informazioni sul veicolo" + }, + "nl-nl": { + "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.", + "label": "Voertuiginformatie" + }, + "pl-pl": { + "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.", + "label": "Informacje o pojeździe" + }, + "pt-br": { + "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.", + "label": "Informações sobre o veículo" + }, + "pt-pt": { + "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.", + "label": "Informações do veículo" + }, + "ru-ru": { + "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.", + "label": "Информация об автомобиле" + }, + "sv-se": { + "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.", + "label": "Fordonsinformation" + }, + "tr-tr": { + "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.", + "label": "Araç bilgisi" + }, + "zh-cn": { + "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.", + "label": "车辆信息" + }, + "zh-tw": { + "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.", + "label": "車輛資訊" + } + } + } + } + }, + "app_policies": { + "default": { + "keep_context": false, + "steal_focus": false, + "priority": "NONE", + "default_hmi": "NONE", + "groups": ["Base-4"] + }, + "device": { + "keep_context": false, + "steal_focus": false, + "priority": "NONE", + "default_hmi": "NONE", + "groups": ["DataConsent-2"] + }, + "pre_DataConsent": { + "keep_context": false, + "steal_focus": false, + "priority": "NONE", + "default_hmi": "NONE", + "groups": ["BaseBeforeDataConsent"] + } + } + } +}
\ No newline at end of file diff --git a/src/components/policy/test/shared_library_test.cc b/src/components/policy/test/shared_library_test.cc new file mode 100644 index 0000000000..c0e111b08e --- /dev/null +++ b/src/components/policy/test/shared_library_test.cc @@ -0,0 +1,66 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <dlfcn.h> + +#include "gtest/gtest.h" + +namespace test { +namespace components { +namespace policy { + +::testing::AssertionResult IsError(void* error) { + if (error) { + return ::testing::AssertionSuccess() << static_cast<const char*>(error); + } else { + return ::testing::AssertionFailure() << error; + } +} + +TEST(SharedLibraryTest, Full) { + const std::string kLib = "../src/policy/libPolicy.so"; + void* handle = dlopen(kLib.c_str(), RTLD_LAZY); + EXPECT_FALSE(IsError(dlerror())); + ASSERT_TRUE(handle); + + const std::string kSymbol = "CreateManager"; + void* symbol = dlsym(handle, kSymbol.c_str()); + EXPECT_FALSE(IsError(dlerror())); + EXPECT_TRUE(symbol); + + int ret = dlclose(handle); + EXPECT_FALSE(ret); + EXPECT_FALSE(IsError(dlerror())); +} + +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/sql_pt_ext_representation_test.cc b/src/components/policy/test/sql_pt_ext_representation_test.cc new file mode 100644 index 0000000000..bb444ee20b --- /dev/null +++ b/src/components/policy/test/sql_pt_ext_representation_test.cc @@ -0,0 +1,310 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <vector> +#include <algorithm> + +#include "gtest/gtest.h" + +#include "driver_dbms.h" +#include "json/value.h" +#include "policy/sql_pt_ext_representation.h" +#include "policy/policy_types.h" +#include "./types.h" +#include "./enums.h" + +using policy::SQLPTExtRepresentation; + +namespace test { +namespace components { +namespace policy { + +class SQLPTExtRepresentationTest : public ::testing::Test { + protected: + static DBMS* dbms; + static SQLPTExtRepresentation* reps; + static const std::string kDatabaseName; + + static void SetUpTestCase() { + reps = new SQLPTExtRepresentation; + dbms = new DBMS(kDatabaseName); + EXPECT_EQ(::policy::SUCCESS, reps->Init()); + EXPECT_TRUE(dbms->Open()); + } + + static void TearDownTestCase() { + EXPECT_TRUE(reps->Drop()); + EXPECT_TRUE(reps->Close()); + delete reps; + dbms->Close(); + } +}; + +DBMS* SQLPTExtRepresentationTest::dbms = 0; +SQLPTExtRepresentation* SQLPTExtRepresentationTest::reps = 0; +#ifdef __QNX__ +const std::string SQLPTExtRepresentationTest::kDatabaseName = "policy"; +#else // __QNX__ +const std::string SQLPTExtRepresentationTest::kDatabaseName = "policy.sqlite"; +#endif // __QNX__ + +::testing::AssertionResult IsValid(const policy_table::Table& table) { + if (table.is_valid()) { + return ::testing::AssertionSuccess(); + } else { + ::rpc::ValidationReport report(" - table"); + table.ReportErrors(&report); + return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report); + } +} + +TEST_F(SQLPTExtRepresentationTest, SaveGenerateSnapshot) { + Json::Value table(Json::objectValue); + table["policy_table"] = Json::Value(Json::objectValue); + + Json::Value& policy_table = table["policy_table"]; + policy_table["module_config"] = Json::Value(Json::objectValue); + policy_table["functional_groupings"] = Json::Value(Json::objectValue); + policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue); + policy_table["app_policies"] = Json::Value(Json::objectValue); + + Json::Value& module_config = policy_table["module_config"]; + module_config["preloaded_pt"] = Json::Value(true); + module_config["exchange_after_x_ignition_cycles"] = Json::Value(10); + module_config["exchange_after_x_kilometers"] = Json::Value(100); + module_config["exchange_after_x_days"] = Json::Value(5); + module_config["timeout_after_x_seconds"] = Json::Value(500); + module_config["seconds_between_retries"] = Json::Value(Json::arrayValue); + module_config["seconds_between_retries"][0] = Json::Value(10); + module_config["seconds_between_retries"][1] = Json::Value(20); + module_config["seconds_between_retries"][2] = Json::Value(30); + module_config["endpoints"] = Json::Value(Json::objectValue); + module_config["endpoints"]["0x00"] = Json::Value(Json::objectValue); + module_config["endpoints"]["0x00"]["default"] = Json::Value(Json::arrayValue); + module_config["endpoints"]["0x00"]["default"][0] = Json::Value( + "http://ford.com/cloud/default"); + module_config["notifications_per_minute_by_priority"] = Json::Value( + Json::objectValue); + module_config["notifications_per_minute_by_priority"]["emergency"] = + Json::Value(1); + module_config["notifications_per_minute_by_priority"]["navigation"] = + Json::Value(2); + module_config["notifications_per_minute_by_priority"]["VOICECOMM"] = + Json::Value(3); + module_config["notifications_per_minute_by_priority"]["communication"] = + Json::Value(4); + module_config["notifications_per_minute_by_priority"]["normal"] = Json::Value( + 5); + module_config["notifications_per_minute_by_priority"]["none"] = Json::Value( + 6); + module_config["vehicle_make"] = Json::Value("MakeT"); + module_config["vehicle_model"] = Json::Value("ModelT"); + module_config["vehicle_year"] = Json::Value("2014"); + + Json::Value& functional_groupings = policy_table["functional_groupings"]; + functional_groupings["default"] = Json::Value(Json::objectValue); + Json::Value& default_group = functional_groupings["default"]; + default_group["rpcs"] = Json::Value(Json::objectValue); + default_group["rpcs"]["Update"] = Json::Value(Json::objectValue); + default_group["rpcs"]["Update"]["hmi_levels"] = Json::Value(Json::arrayValue); + default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL"); + default_group["rpcs"]["Update"]["parameters"] = Json::Value(Json::arrayValue); + default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed"); + + Json::Value& consumer_friendly_messages = + policy_table["consumer_friendly_messages"]; + consumer_friendly_messages["version"] = Json::Value("1.2"); + consumer_friendly_messages["messages"] = Json::Value(Json::objectValue); + consumer_friendly_messages["messages"]["MSG1"] = Json::Value(Json::objectValue); + Json::Value& msg1 = consumer_friendly_messages["messages"]["MSG1"]; + msg1["languages"] = Json::Value(Json::objectValue); + msg1["languages"]["en-us"] = Json::Value(Json::objectValue); + msg1["languages"]["en-us"]["tts"] = Json::Value("TTS message"); + msg1["languages"]["en-us"]["label"] = Json::Value("LABEL message"); + msg1["languages"]["en-us"]["line1"] = Json::Value("LINE1 message"); + msg1["languages"]["en-us"]["line2"] = Json::Value("LINE2 message"); + msg1["languages"]["en-us"]["textBody"] = Json::Value("TEXTBODY message"); + + Json::Value& app_policies = policy_table["app_policies"]; + app_policies["default"] = Json::Value(Json::objectValue); + app_policies["default"]["memory_kb"] = Json::Value(50); + app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(10); + app_policies["default"]["groups"] = Json::Value(Json::arrayValue); + app_policies["default"]["groups"][0] = Json::Value("default"); + app_policies["default"]["priority"] = Json::Value("EMERGENCY"); + app_policies["default"]["default_hmi"] = Json::Value("FULL"); + app_policies["default"]["keep_context"] = Json::Value(true); + app_policies["default"]["steal_focus"] = Json::Value(true); + app_policies["default"]["certificate"] = Json::Value("sign"); + + policy_table::Table update(&table); + update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE); + + ASSERT_TRUE(IsValid(update)); + ASSERT_TRUE(reps->Save(update)); + utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); + + policy_table["module_meta"] = Json::Value(Json::objectValue); + policy_table["usage_and_error_counts"] = Json::Value(Json::objectValue); + policy_table["device_data"] = Json::Value(Json::objectValue); + + Json::Value& module_meta = policy_table["module_meta"]; + module_meta["ccpu_version"] = Json::Value(""); + module_meta["language"] = Json::Value(""); + module_meta["wers_country_code"] = Json::Value(""); + module_meta["pt_exchanged_at_odometer_x"] = Json::Value(0); + module_meta["pt_exchanged_x_days_after_epoch"] = Json::Value(0); + module_meta["ignition_cycles_since_last_exchange"] = Json::Value(0); + module_meta["vin"] = Json::Value(""); + + Json::Value& usage_and_error_counts = policy_table["usage_and_error_counts"]; + usage_and_error_counts["count_of_iap_buffer_full"] = Json::Value(0); + usage_and_error_counts["count_sync_out_of_memory"] = Json::Value(0); + usage_and_error_counts["count_of_sync_reboots"] = Json::Value(0); + + policy_table::Table expected(&table); + + EXPECT_EQ(expected.ToJsonValue().toStyledString(), + snapshot->ToJsonValue().toStyledString()); +} + +TEST_F(SQLPTExtRepresentationTest, CanAppKeepContext) { + const char* query_delete = "DELETE FROM `application`; "; + ASSERT_TRUE(dbms->Exec(query_delete)); + const char* query_insert = "INSERT INTO `application` (`id`, `memory_kb`," + " `heart_beat_timeout_ms`, `keep_context`) VALUES ('12345', 5, 10, 1)"; + ASSERT_TRUE(dbms->Exec(query_insert)); + EXPECT_FALSE(reps->CanAppKeepContext("0")); + EXPECT_TRUE(reps->CanAppKeepContext("12345")); +} + +TEST_F(SQLPTExtRepresentationTest, CanAppStealFocus) { + const char* query_delete = "DELETE FROM `application`; "; + ASSERT_TRUE(dbms->Exec(query_delete)); + const char* query_insert = "INSERT INTO `application` (`id`, `memory_kb`," + " `heart_beat_timeout_ms`, `steal_focus`) VALUES ('12345', 5, 10, 1)"; + ASSERT_TRUE(dbms->Exec(query_insert)); + EXPECT_TRUE(reps->CanAppStealFocus("12345")); + EXPECT_FALSE(reps->CanAppStealFocus("0")); +} + +TEST_F(SQLPTExtRepresentationTest, IncrementGlobalCounter) { + const char* query_update = "UPDATE `usage_and_error_count` SET" + " `count_of_sync_reboots` = 0"; + ASSERT_TRUE(dbms->Exec(query_update)); + + reps->Increment("count_of_sync_reboots"); + reps->Increment("count_of_sync_reboots"); + reps->Increment("count_of_sync_reboots"); + + const char* query_select = + "SELECT `count_of_sync_reboots` FROM `usage_and_error_count`"; + EXPECT_EQ(3, dbms->FetchOneInt(query_select)); +} + +TEST_F(SQLPTExtRepresentationTest, IncrementAppCounter) { + const char* query_delete = + "DELETE FROM `app_level` WHERE `application_id` = '12345'"; + ASSERT_TRUE(dbms->Exec(query_delete)); + + reps->Increment("12345", "count_of_user_selections"); + reps->Increment("12345", "count_of_user_selections"); + reps->Increment("12345", "count_of_user_selections"); + + const char* query_select = + "SELECT `count_of_user_selections` FROM `app_level`" + " WHERE `application_id` = '12345'"; + EXPECT_EQ(3, dbms->FetchOneInt(query_select)); +} + +TEST_F(SQLPTExtRepresentationTest, SetAppInfo) { + const char* query_delete = + "DELETE FROM `app_level` WHERE `application_id` = '12345'"; + ASSERT_TRUE(dbms->Exec(query_delete)); + + reps->Set("12345", "app_registration_language_gui", "ru-ru"); + reps->Set("12345", "app_registration_language_vui", "en-en"); + + const char* query_select_gui = "SELECT `app_registration_language_gui`" + " FROM `app_level` WHERE `application_id` = '12345'"; + + const char* query_select_vui = "SELECT `app_registration_language_vui`" + " FROM `app_level` WHERE `application_id` = '12345'"; + + EXPECT_EQ("ru-ru", dbms->FetchOneString(query_select_gui)); + EXPECT_EQ("en-en", dbms->FetchOneString(query_select_vui)); +} + +TEST_F(SQLPTExtRepresentationTest, AddAppStopwatch) { + const char* query_delete = + "DELETE FROM `app_level` WHERE `application_id` = '12345'"; + ASSERT_TRUE(dbms->Exec(query_delete)); + + reps->Add("12345", "minutes_in_hmi_full", 10); + reps->Add("12345", "minutes_in_hmi_full", 60); + + const char* query_select = "SELECT `minutes_in_hmi_full` FROM `app_level`" + " WHERE `application_id` = '12345'"; + EXPECT_EQ(70, dbms->FetchOneInt(query_select)); +} + +TEST_F(SQLPTExtRepresentationTest, SetUnpairedDevice) { + const char* query_delete = "DELETE FROM `device`"; + ASSERT_TRUE(dbms->Exec(query_delete)); + const char* query_insert = "INSERT INTO `device` (`id`) VALUES('12345')"; + ASSERT_TRUE(dbms->Exec(query_insert)); + + ASSERT_TRUE(reps->SetUnpairedDevice("12345")); + + const char* query_select = "SELECT `id` FROM `device` WHERE `unpaired` = 1"; + EXPECT_EQ("12345", dbms->FetchOneString(query_select)); +} + +TEST_F(SQLPTExtRepresentationTest, UnpairedDevicesList) { + const char* query_delete = "DELETE FROM `device`"; + ASSERT_TRUE(dbms->Exec(query_delete)); + const char* query_insert = "INSERT INTO `device` (`id`, `unpaired`)" + " VALUES('12345', 1)"; + ASSERT_TRUE(dbms->Exec(query_insert)); + query_insert = "INSERT INTO `device` (`id`, `unpaired`) VALUES('54321', 1)"; + ASSERT_TRUE(dbms->Exec(query_insert)); + + std::vector<std::string> output; + ASSERT_TRUE(reps->UnpairedDevicesList(&output)); + ASSERT_EQ(2u, output.size()); + EXPECT_NE(output.end(), std::find(output.begin(), output.end(), "12345")); + EXPECT_NE(output.end(), std::find(output.begin(), output.end(), "54321")); +} + +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/sql_pt_representation_test.cc b/src/components/policy/test/sql_pt_representation_test.cc new file mode 100644 index 0000000000..bba65e41ac --- /dev/null +++ b/src/components/policy/test/sql_pt_representation_test.cc @@ -0,0 +1,393 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <vector> + +#include "gtest/gtest.h" + +#include "driver_dbms.h" +#include "json/value.h" +#include "policy/sql_pt_representation.h" +#include "policy/policy_types.h" +#include "./types.h" +#include "./enums.h" + +using policy::SQLPTRepresentation; +using policy::CheckPermissionResult; +using policy::EndpointUrls; + +namespace test { +namespace components { +namespace policy { + +class SQLPTRepresentationTest : public ::testing::Test { + protected: + static DBMS* dbms; + static SQLPTRepresentation* reps; + static const std::string kDatabaseName; + + static void SetUpTestCase() { + reps = new SQLPTRepresentation; + dbms = new DBMS(kDatabaseName); + EXPECT_EQ(::policy::SUCCESS, reps->Init()); + EXPECT_TRUE(dbms->Open()); + } + + static void TearDownTestCase() { + EXPECT_TRUE(reps->Drop()); + EXPECT_TRUE(reps->Close()); + delete reps; + dbms->Close(); + } + + ::testing::AssertionResult IsValid(const policy_table::Table& table) { + if (table.is_valid()) { + return ::testing::AssertionSuccess(); + } else { + ::rpc::ValidationReport report(" - table"); + table.ReportErrors(&report); + return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report); + } +} +}; + +DBMS* SQLPTRepresentationTest::dbms = 0; +SQLPTRepresentation* SQLPTRepresentationTest::reps = 0; +#ifdef __QNX__ +const std::string SQLPTRepresentationTest::kDatabaseName = "policy"; +#else // __QNX__ +const std::string SQLPTRepresentationTest::kDatabaseName = "policy.sqlite"; +#endif // __QNX__ + +TEST_F(SQLPTRepresentationTest, CheckPermissionsAllowed) { + const char* query = "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`," + " `heart_beat_timeout_ms`) VALUES ('12345', 5, 10); " + "INSERT OR REPLACE INTO functional_group (`id`, `name`)" + " VALUES (1, 'Base-4'); " + "INSERT OR REPLACE INTO `app_group` (`application_id`," + " `functional_group_id`) VALUES ('12345', 1); " + "INSERT OR REPLACE INTO `rpc` (`name`, `parameter`, `hmi_level_value`," + " `functional_group_id`) VALUES ('Update', 'gps', 'FULL', 1); " + "INSERT OR REPLACE INTO `rpc` (`name`, `parameter`, `hmi_level_value`," + " `functional_group_id`) VALUES ('Update', 'speed', 'FULL', 1);"; + ASSERT_TRUE(dbms->Exec(query)); + + CheckPermissionResult ret; + reps->CheckPermissions("12345", "FULL", "Update", ret); + EXPECT_TRUE(ret.hmi_level_permitted == ::policy::kRpcAllowed); + ASSERT_EQ(2u, ret.list_of_allowed_params.size()); + EXPECT_EQ("gps", ret.list_of_allowed_params[0]); + EXPECT_EQ("speed", ret.list_of_allowed_params[1]); +} + +TEST_F(SQLPTRepresentationTest, CheckPermissionsAllowedWithoutParameters) { + const char* query = "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`," + " `heart_beat_timeout_ms`) VALUES ('12345', 5, 10); " + "INSERT OR REPLACE INTO functional_group (`id`, `name`)" + " VALUES (1, 'Base-4'); " + "INSERT OR REPLACE INTO `app_group` (`application_id`," + " `functional_group_id`) VALUES ('12345', 1); " + "DELETE FROM `rpc`; " + "INSERT OR REPLACE INTO `rpc` (`name`, `hmi_level_value`," + " `functional_group_id`) VALUES ('Update', 'LIMITED', 1);"; + ASSERT_TRUE(dbms->Exec(query)); + + CheckPermissionResult ret; + reps->CheckPermissions("12345", "LIMITED", "Update", ret); + EXPECT_TRUE(ret.hmi_level_permitted == ::policy::kRpcAllowed); + EXPECT_TRUE(ret.list_of_allowed_params.empty()); +} + +TEST_F(SQLPTRepresentationTest, CheckPermissionsDisallowed) { + const char* query = "DELETE FROM `app_group`"; + ASSERT_TRUE(dbms->Exec(query)); + + CheckPermissionResult ret; + reps->CheckPermissions("12345", "FULL", "Update", ret); + EXPECT_EQ(::policy::kRpcDisallowed, ret.hmi_level_permitted); + EXPECT_TRUE(ret.list_of_allowed_params.empty()); +} + +TEST_F(SQLPTRepresentationTest, IsPTPReloaded) { + const char* query = "UPDATE `module_config` SET `preloaded_pt` = 1"; + ASSERT_TRUE(dbms->Exec(query)); + EXPECT_TRUE(reps->IsPTPreloaded()); +} + +TEST_F(SQLPTRepresentationTest, GetUpdateUrls) { + const char* query_delete = "DELETE FROM `endpoint`; "; + ASSERT_TRUE(dbms->Exec(query_delete)); + EndpointUrls ret = reps->GetUpdateUrls(7); + EXPECT_TRUE(ret.empty()); + + const char* query_insert = + "INSERT INTO `endpoint` (`application_id`, `url`, `service`) " + " VALUES ('12345', 'http://ford.com/cloud/1', 7);" + "INSERT INTO `endpoint` (`application_id`, `url`, `service`) " + " VALUES ('12345', 'http://ford.com/cloud/2', 7);"; + + ASSERT_TRUE(dbms->Exec(query_insert)); + ret = reps->GetUpdateUrls(7); + ASSERT_EQ(2u, ret.size()); + EXPECT_EQ("http://ford.com/cloud/1", ret[0].url[0]); + EXPECT_EQ("http://ford.com/cloud/2", ret[1].url[0]); + + ret = reps->GetUpdateUrls(0); + EXPECT_TRUE(ret.empty()); +} + +TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchangeAndIncrement) { + const char* query_zeros = "UPDATE `module_meta` SET " + " `ignition_cycles_since_last_exchange` = 0; " + " UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 0"; + ASSERT_TRUE(dbms->Exec(query_zeros)); + EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange()); + reps->IncrementIgnitionCycles(); + EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange()); + + const char* query_less_limit = "UPDATE `module_meta` SET " + " `ignition_cycles_since_last_exchange` = 5; " + " UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 10"; + ASSERT_TRUE(dbms->Exec(query_less_limit)); + EXPECT_EQ(5, reps->IgnitionCyclesBeforeExchange()); + reps->IncrementIgnitionCycles(); + EXPECT_EQ(4, reps->IgnitionCyclesBeforeExchange()); + + const char* query_limit = "UPDATE `module_meta` SET " + " `ignition_cycles_since_last_exchange` = 9; " + " UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 10"; + ASSERT_TRUE(dbms->Exec(query_limit)); + EXPECT_EQ(1, reps->IgnitionCyclesBeforeExchange()); + reps->IncrementIgnitionCycles(); + EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange()); + + const char* query_more_limit = "UPDATE `module_meta` SET " + " `ignition_cycles_since_last_exchange` = 12; " + " UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 10"; + ASSERT_TRUE(dbms->Exec(query_more_limit)); + EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange()); + + const char* query_negative_limit = "UPDATE `module_meta` SET " + " `ignition_cycles_since_last_exchange` = 3; " + " UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = -1"; + ASSERT_TRUE(dbms->Exec(query_negative_limit)); + EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange()); + + const char* query_negative_current = "UPDATE `module_meta` SET " + " `ignition_cycles_since_last_exchange` = -1; " + " UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 2"; + ASSERT_TRUE(dbms->Exec(query_negative_current)); + EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange()); +} + +TEST_F(SQLPTRepresentationTest, KilometersBeforeExchange) { + const char* query_zeros = "UPDATE `module_meta` SET " + " `pt_exchanged_at_odometer_x` = 0; " + " UPDATE `module_config` SET `exchange_after_x_kilometers` = 0"; + ASSERT_TRUE(dbms->Exec(query_zeros)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(0)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(-10)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(10)); + + const char* query_negative_limit = "UPDATE `module_meta` SET " + " `pt_exchanged_at_odometer_x` = 10; " + " UPDATE `module_config` SET `exchange_after_x_kilometers` = -10"; + ASSERT_TRUE(dbms->Exec(query_negative_limit)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(0)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(10)); + + const char* query_negative_last = "UPDATE `module_meta` SET " + " `pt_exchanged_at_odometer_x` = -10; " + " UPDATE `module_config` SET `exchange_after_x_kilometers` = 20"; + ASSERT_TRUE(dbms->Exec(query_negative_last)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(0)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(10)); + + const char* query_limit = "UPDATE `module_meta` SET " + " `pt_exchanged_at_odometer_x` = 10; " + " UPDATE `module_config` SET `exchange_after_x_kilometers` = 100"; + ASSERT_TRUE(dbms->Exec(query_limit)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(120)); + EXPECT_EQ(60, reps->KilometersBeforeExchange(50)); + EXPECT_EQ(0, reps->KilometersBeforeExchange(5)); +} + +TEST_F(SQLPTRepresentationTest, DaysBeforeExchange) { + const char* query_zeros = "UPDATE `module_meta` SET " + " `pt_exchanged_x_days_after_epoch` = 0; " + " UPDATE `module_config` SET `exchange_after_x_days` = 0"; + ASSERT_TRUE(dbms->Exec(query_zeros)); + EXPECT_EQ(0, reps->DaysBeforeExchange(0)); + EXPECT_EQ(0, reps->DaysBeforeExchange(-10)); + EXPECT_EQ(0, reps->DaysBeforeExchange(10)); + + const char* query_negative_limit = "UPDATE `module_meta` SET " + " `pt_exchanged_x_days_after_epoch` = 10; " + " UPDATE `module_config` SET `exchange_after_x_days` = -10"; + ASSERT_TRUE(dbms->Exec(query_negative_limit)); + EXPECT_EQ(0, reps->DaysBeforeExchange(0)); + EXPECT_EQ(0, reps->DaysBeforeExchange(10)); + + const char* query_negative_last = "UPDATE `module_meta` SET " + " `pt_exchanged_x_days_after_epoch` = -10; " + " UPDATE `module_config` SET `exchange_after_x_days` = 20"; + ASSERT_TRUE(dbms->Exec(query_negative_last)); + EXPECT_EQ(0, reps->DaysBeforeExchange(0)); + EXPECT_EQ(0, reps->DaysBeforeExchange(10)); + + const char* query_limit = "UPDATE `module_meta` SET " + " `pt_exchanged_x_days_after_epoch` = 10; " + " UPDATE `module_config` SET `exchange_after_x_days` = 100"; + ASSERT_TRUE(dbms->Exec(query_limit)); + EXPECT_EQ(0, reps->DaysBeforeExchange(120)); + EXPECT_EQ(60, reps->DaysBeforeExchange(50)); + EXPECT_EQ(0, reps->DaysBeforeExchange(5)); +} + +TEST_F(SQLPTRepresentationTest, SecondsBetweenRetries) { + std::vector<int> seconds; + + const char* query_delete = "DELETE FROM `seconds_between_retry`; "; + ASSERT_TRUE(dbms->Exec(query_delete)); + ASSERT_TRUE(reps->SecondsBetweenRetries(&seconds)); + EXPECT_EQ(0u, seconds.size()); + + const char* query_insert = + "INSERT INTO `seconds_between_retry` (`index`, `value`) " + " VALUES (0, 10); " + "INSERT INTO `seconds_between_retry` (`index`, `value`) " + " VALUES (1, 20); "; + ASSERT_TRUE(dbms->Exec(query_insert)); + ASSERT_TRUE(reps->SecondsBetweenRetries(&seconds)); + ASSERT_EQ(2u, seconds.size()); + EXPECT_EQ(10, seconds[0]); + EXPECT_EQ(20, seconds[1]); +} + +TEST_F(SQLPTRepresentationTest, TimeoutResponse) { + const char* query = + "UPDATE `module_config` SET `timeout_after_x_seconds` = 60"; + ASSERT_TRUE(dbms->Exec(query)); + EXPECT_EQ(60, reps->TimeoutResponse()); +} + +TEST_F(SQLPTRepresentationTest, SaveGenerateSnapshot) { + Json::Value table(Json::objectValue); + table["policy_table"] = Json::Value(Json::objectValue); + + Json::Value& policy_table = table["policy_table"]; + policy_table["module_meta"] = Json::Value(Json::objectValue); + policy_table["module_config"] = Json::Value(Json::objectValue); + policy_table["functional_groupings"] = Json::Value(Json::objectValue); + policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue); + policy_table["app_policies"] = Json::Value(Json::objectValue); + + Json::Value& module_config = policy_table["module_config"]; + module_config["preloaded_pt"] = Json::Value(true); + module_config["exchange_after_x_ignition_cycles"] = Json::Value(10); + module_config["exchange_after_x_kilometers"] = Json::Value(100); + module_config["exchange_after_x_days"] = Json::Value(5); + module_config["timeout_after_x_seconds"] = Json::Value(500); + module_config["seconds_between_retries"] = Json::Value(Json::arrayValue); + module_config["seconds_between_retries"][0] = Json::Value(10); + module_config["seconds_between_retries"][1] = Json::Value(20); + module_config["seconds_between_retries"][2] = Json::Value(30); + module_config["endpoints"] = Json::Value(Json::objectValue); + module_config["endpoints"]["0x00"] = Json::Value(Json::objectValue); + module_config["endpoints"]["0x00"]["default"] = Json::Value(Json::arrayValue); + module_config["endpoints"]["0x00"]["default"][0] = Json::Value( + "http://ford.com/cloud/default"); + module_config["notifications_per_minute_by_priority"] = Json::Value( + Json::objectValue); + module_config["notifications_per_minute_by_priority"]["emergency"] = + Json::Value(1); + module_config["notifications_per_minute_by_priority"]["navigation"] = + Json::Value(2); + module_config["notifications_per_minute_by_priority"]["VOICECOMM"] = + Json::Value(3); + module_config["notifications_per_minute_by_priority"]["communication"] = + Json::Value(4); + module_config["notifications_per_minute_by_priority"]["normal"] = Json::Value( + 5); + module_config["notifications_per_minute_by_priority"]["none"] = Json::Value( + 6); + module_config["vehicle_make"] = Json::Value("MakeT"); + module_config["vehicle_model"] = Json::Value("ModelT"); + module_config["vehicle_year"] = Json::Value("2014"); + + Json::Value& functional_groupings = policy_table["functional_groupings"]; + functional_groupings["default"] = Json::Value(Json::objectValue); + Json::Value& default_group = functional_groupings["default"]; + default_group["rpcs"] = Json::Value(Json::objectValue); + default_group["rpcs"]["Update"] = Json::Value(Json::objectValue); + default_group["rpcs"]["Update"]["hmi_levels"] = Json::Value(Json::arrayValue); + default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL"); + default_group["rpcs"]["Update"]["parameters"] = Json::Value(Json::arrayValue); + default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed"); + + Json::Value& consumer_friendly_messages = + policy_table["consumer_friendly_messages"]; + consumer_friendly_messages["version"] = Json::Value("1.2"); + consumer_friendly_messages["messages"] = Json::Value(Json::objectValue); + consumer_friendly_messages["messages"]["MSG1"] = Json::Value(Json::objectValue); + Json::Value& msg1 = consumer_friendly_messages["messages"]["MSG1"]; + msg1["languages"] = Json::Value(Json::objectValue); + msg1["languages"]["en-us"] = Json::Value(Json::objectValue); + + Json::Value& app_policies = policy_table["app_policies"]; + app_policies["default"] = Json::Value(Json::objectValue); + app_policies["default"]["priority"] = Json::Value("EMERGENCY"); + app_policies["default"]["memory_kb"] = Json::Value(50); + app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(10); + app_policies["default"]["groups"] = Json::Value(Json::arrayValue); + app_policies["default"]["groups"][0] = Json::Value("default"); + app_policies["default"]["certificate"] = Json::Value("sign"); + + policy_table::Table update(&table); + update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE); + + ASSERT_TRUE(IsValid(update)); + ASSERT_TRUE(reps->Save(update)); + utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); + + consumer_friendly_messages.removeMember("messages"); + policy_table["device_data"] = Json::Value(Json::objectValue); + + policy_table::Table expected(&table); + + EXPECT_EQ(expected.ToJsonValue().toStyledString(), + snapshot->ToJsonValue().toStyledString()); +} + +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/sqlite_wrapper/sql_database_test.cc b/src/components/policy/test/sqlite_wrapper/sql_database_test.cc new file mode 100644 index 0000000000..85d595a3d9 --- /dev/null +++ b/src/components/policy/test/sqlite_wrapper/sql_database_test.cc @@ -0,0 +1,147 @@ +/* Copyright (c) 2013, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "gtest/gtest.h" + +#include "sqlite_wrapper/sql_error.h" +#include "sqlite_wrapper/sql_database.h" + +using ::policy::dbms::SQLError; +using ::policy::dbms::SQLDatabase; + +namespace test { +namespace components { +namespace policy { +namespace dbms { + +::testing::AssertionResult IsError(SQLError error) { + if (error.number() != ::policy::dbms::OK) { + return ::testing::AssertionSuccess() << error.text(); + } else { + return ::testing::AssertionFailure() << error.text(); + } +} + +TEST(SQLDatabaseTest, OpenCloseMemory) { + SQLDatabase db; + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); +} +TEST(SQLDatabaseTest, OpenCloseFile) { + SQLDatabase db("test-database"); + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); + remove("test-database.sqlite"); +} + +TEST(SQLDatabaseTest, DoubleOpen) { + SQLDatabase db; + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + db.Close(); +} + +TEST(SQLDatabaseTest, DoubleClose) { + SQLDatabase db; + bool ret = db.Open(); + EXPECT_FALSE(IsError(db.LastError())); + ASSERT_TRUE(ret); + + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); +} + +TEST(SQLDatabaseTest, CloseWithoutOpen) { + SQLDatabase db; + db.Close(); + EXPECT_FALSE(IsError(db.LastError())); +} + +TEST(SQLDatabaseTest, CommitTransaction) { + SQLDatabase db; + ASSERT_TRUE(db.Open()); + EXPECT_TRUE(db.BeginTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + EXPECT_TRUE(db.CommitTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, RollbackTransaction) { + SQLDatabase db; + ASSERT_TRUE(db.Open()); + EXPECT_TRUE(db.BeginTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + EXPECT_TRUE(db.RollbackTransaction()); + EXPECT_FALSE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, FailedCommitTransaction) { + SQLDatabase db; + ASSERT_TRUE(db.Open()); + EXPECT_FALSE(db.CommitTransaction()); + EXPECT_TRUE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, FailedRollbackTransaction) { + SQLDatabase db; + ASSERT_TRUE(db.Open()); + EXPECT_FALSE(db.RollbackTransaction()); + EXPECT_TRUE(IsError(db.LastError())); + db.Close(); +} + +TEST(SQLDatabaseTest, BadTransaction) { + SQLDatabase db; + EXPECT_FALSE(db.BeginTransaction()); + EXPECT_TRUE(IsError(db.LastError())); +} + +} // namespace dbms +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/sqlite_wrapper/sql_query_test.cc b/src/components/policy/test/sqlite_wrapper/sql_query_test.cc new file mode 100644 index 0000000000..73545630fb --- /dev/null +++ b/src/components/policy/test/sqlite_wrapper/sql_query_test.cc @@ -0,0 +1,294 @@ +/* Copyright (c) 2013, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sqlite3.h> +#include <string> + +#include "gtest/gtest.h" + +#include "sqlite_wrapper/sql_error.h" +#include "sqlite_wrapper/sql_database.h" +#include "sqlite_wrapper/sql_query.h" + +using ::policy::dbms::SQLError; +using ::policy::dbms::SQLDatabase; +using ::policy::dbms::SQLQuery; + +namespace test { +namespace components { +namespace policy { +namespace dbms { + +class SQLQueryTest : public ::testing::Test { + protected: + static sqlite3* conn; + static const std::string kDatabaseName; + + static void SetUpTestCase() { + sqlite3_open((kDatabaseName + ".sqlite").c_str(), &conn); + sqlite3_exec(conn, "CREATE TABLE testTable (integerValue INTEGER," + " doubleValue REAL, stringValue TEXT)", + NULL, NULL, NULL); + } + + static void TearDownTestCase() { + sqlite3_close(conn); + remove((kDatabaseName + ".sqlite").c_str()); + } + + void SetUp() { + sqlite3_exec(conn, "DELETE FROM testTable", NULL, NULL, NULL); + } + + ::testing::AssertionResult IsError(SQLError error) { + if (error.number() != ::policy::dbms::OK) { + return ::testing::AssertionSuccess() << error.text(); + } else { + return ::testing::AssertionFailure() << error.text(); + } + } + + ::testing::AssertionResult IsDone(SQLError error) { + if (error.number() == ::policy::dbms::DONE) { + return ::testing::AssertionSuccess() << error.text(); + } else { + return ::testing::AssertionFailure() << error.text(); + } + } + + ::testing::AssertionResult IsRow(SQLError error) { + if (error.number() == ::policy::dbms::ROW) { + return ::testing::AssertionSuccess() << error.text(); + } else { + return ::testing::AssertionFailure() << error.text(); + } + } +}; + +sqlite3* SQLQueryTest::conn = 0; +const std::string SQLQueryTest::kDatabaseName = "test-query"; + + +TEST_F(SQLQueryTest, Query) { + const std::string kSelect("SELECT * FROM testTable WHERE integerValue = ?"); + + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + query.Prepare(kSelect); + EXPECT_STREQ(kSelect.c_str(), query.query().c_str()); +} + +TEST_F(SQLQueryTest, ExecString) { + const std::string kInsert("INSERT INTO testTable" + " (integerValue, doubleValue, stringValue)" + " VALUES(2, 3.4, 'five-пять')"); + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + SQLQuery query(&db); + EXPECT_TRUE(query.Exec(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); +} + +TEST_F(SQLQueryTest, Bind) { + const std::string kInsert1("INSERT INTO testTable (integerValue) VALUES (?)"); + const std::string kInsert2("INSERT INTO testTable (doubleValue) VALUES (?)"); + const std::string kInsert3("INSERT INTO testTable (stringValue) VALUES (?)"); + const std::string kInsert4("INSERT INTO testTable (integerValue, doubleValue," + " stringValue) VALUES (?, ?, ?)"); + const int kIntegerValue = 1; + const double kDoubleValue = 2.3; + const std::string kStringValue = "four"; + + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query1(&db); + EXPECT_TRUE(query1.Prepare(kInsert1)); + EXPECT_FALSE(IsError(query1.LastError())); + query1.Bind(0, kIntegerValue); + EXPECT_FALSE(IsError(query1.LastError())); + EXPECT_TRUE(query1.Exec()); + EXPECT_TRUE(IsDone(query1.LastError())); + + SQLQuery query2(&db); + EXPECT_TRUE(query2.Prepare(kInsert2)); + EXPECT_FALSE(IsError(query2.LastError())); + query2.Bind(0, kDoubleValue); + EXPECT_FALSE(IsError(query2.LastError())); + EXPECT_TRUE(query2.Exec()); + EXPECT_TRUE(IsDone(query2.LastError())); + + SQLQuery query3(&db); + EXPECT_TRUE(query3.Prepare(kInsert3)); + EXPECT_FALSE(IsError(query3.LastError())); + query3.Bind(0, kStringValue); + EXPECT_FALSE(IsError(query3.LastError())); + EXPECT_TRUE(query3.Exec()); + EXPECT_TRUE(IsDone(query3.LastError())); + + SQLQuery query4(&db); + EXPECT_TRUE(query4.Prepare(kInsert4)); + EXPECT_FALSE(IsError(query4.LastError())); + query4.Bind(0, kIntegerValue); + query4.Bind(1, kDoubleValue); + query4.Bind(2, kStringValue); + EXPECT_FALSE(IsError(query4.LastError())); + EXPECT_TRUE(query4.Exec()); + EXPECT_TRUE(IsDone(query4.LastError())); +} + +TEST_F(SQLQueryTest, Value) { + const char* insert = "INSERT INTO testTable " + "(integerValue, doubleValue, stringValue) " + "VALUES (1, 2.3, 'four');"; + ASSERT_EQ(SQLITE_OK, sqlite3_exec(conn, insert, NULL, NULL, NULL)); + + const std::string kSelect("SELECT integerValue, doubleValue, stringValue" + " FROM testTable"); + const int kIntegerValue = 1; + const double kDoubleValue = 2.3; + const std::string kStringValue = "four"; + + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + EXPECT_TRUE(query.Prepare(kSelect)); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_TRUE(IsRow(query.LastError())); + EXPECT_EQ(kIntegerValue, query.GetInteger(0)); + EXPECT_EQ(kDoubleValue, query.GetDouble(1)); + EXPECT_EQ(kStringValue, query.GetString(2)); + EXPECT_FALSE(query.Next()); + EXPECT_TRUE(IsDone(query.LastError())); +} + +TEST_F(SQLQueryTest, EmptySelect) { + const std::string kSelect("SELECT integerValue, doubleValue, stringValue" + " FROM testTable WHERE 0"); + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + EXPECT_TRUE(query.Prepare(kSelect)); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + EXPECT_TRUE(IsDone(query.LastError())); +} + +TEST_F(SQLQueryTest, NextAndBind) { + const char* insert = "INSERT INTO testTable " + "(integerValue, doubleValue, stringValue) " + "VALUES (1, 2.3, 'four');"; + ASSERT_EQ(SQLITE_OK, sqlite3_exec(conn, insert, NULL, NULL, NULL)); + + const std::string kSelect("SELECT integerValue, doubleValue, stringValue" + " FROM testTable WHERE stringValue = ?"); + const int kIntegerValue = 1; + const double kDoubleValue = 2.3; + const std::string kStringValue = "four"; + + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + ASSERT_TRUE(query.Prepare(kSelect)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kStringValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + ASSERT_TRUE(IsRow(query.LastError())); + EXPECT_EQ(kIntegerValue, query.GetInteger(0)); + EXPECT_EQ(kDoubleValue, query.GetDouble(1)); + EXPECT_EQ(kStringValue, query.GetString(2)); + EXPECT_FALSE(query.Next()); + EXPECT_TRUE(IsDone(query.LastError())); +} + +TEST_F(SQLQueryTest, LastInsertId) { + const char* create = "CREATE TABLE idTable ( " + "id INTEGER PRIMARY KEY AUTOINCREMENT," + "value TEXT)"; + ASSERT_EQ(SQLITE_OK, sqlite3_exec(conn, create, NULL, NULL, NULL)); + + const int64_t kExpectId = 1; + const std::string kValue("Test last id of insert row"); + const std::string kInsert("INSERT INTO idTable (value) VALUES(?)"); + + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + ASSERT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0, kValue); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + ASSERT_TRUE(IsDone(query.LastError())); + EXPECT_EQ(kExpectId, query.LastInsertId()); + + ASSERT_EQ(SQLITE_OK, + sqlite3_exec(conn, "DROP TABLE idTable", NULL, NULL, NULL)); +} + +TEST_F(SQLQueryTest, BindNull) { + const std::string kInsert("INSERT INTO testTable (`integerValue`)" + " VALUES (?)"); + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + ASSERT_TRUE(query.Prepare(kInsert)); + EXPECT_FALSE(IsError(query.LastError())); + query.Bind(0); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Exec()); + ASSERT_TRUE(IsDone(query.LastError())); +} + +TEST_F(SQLQueryTest, DoublePrepare) { + SQLDatabase db(kDatabaseName); + ASSERT_TRUE(db.Open()); + + SQLQuery query(&db); + EXPECT_TRUE(query.Prepare("SELECT * FROM testTable")); + EXPECT_FALSE(IsError(query.LastError())); + EXPECT_TRUE(query.Prepare("SELECT * FROM testTable")); + EXPECT_FALSE(IsError(query.LastError())); +} + +} // namespace dbms +} // namespace policy +} // namespace components +} // namespace test diff --git a/src/components/policy/test/test-qdb.ini b/src/components/policy/test/test-qdb.ini new file mode 100644 index 0000000000..5f8c46c0cf --- /dev/null +++ b/src/components/policy/test/test-qdb.ini @@ -0,0 +1,11 @@ +# This config file for QDB +# Format see in manual of QNX +[policy] +Filename=policy.db +Schema File=policy.sql + +[test-database] +Filename=test-database.sqlite + +[test-query] +Filename=test-query.sqlite
\ No newline at end of file diff --git a/src/components/policy/test/usage_statistics_test.cc b/src/components/policy/test/usage_statistics_test.cc new file mode 100644 index 0000000000..1410c5811f --- /dev/null +++ b/src/components/policy/test/usage_statistics_test.cc @@ -0,0 +1,145 @@ +/* Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "gtest/gtest.h" + +#include "mock_statistics_manager.h" +#include "usage_statistics/counter.h" + +using ::testing::StrictMock; +using ::testing::InSequence; + +namespace usage_statistics { +namespace test { + +TEST(UsageStatisticsTest, TestGlobalCounterIncrementsStatistics) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + GlobalCounter reboots_counter(msm, SYNC_REBOOTS); + + EXPECT_CALL(*msm, Increment(SYNC_REBOOTS)).Times(1); + ++reboots_counter; +} + +TEST(UsageStatisticsTest, TestGlobalCounterIncrementsStatisticsTwice) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + GlobalCounter reboots_counter(msm, SYNC_REBOOTS); + + EXPECT_CALL(*msm, Increment(SYNC_REBOOTS)).Times(2); + ++reboots_counter; + ++reboots_counter; +} + +TEST(UsageStatisticsTest, TestAppCounterIncrementsStatistics) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); + + EXPECT_CALL(*msm, Increment("HelloApp", USER_SELECTIONS)).Times(1); + ++user_selections_counter; +} + +TEST(UsageStatisticsTest, TestAppCounterIncrementsStatisticsTwice) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); + + EXPECT_CALL(*msm, Increment("HelloApp", USER_SELECTIONS)).Times(2); + ++user_selections_counter; + ++user_selections_counter; +} + +TEST(UsageStatisticsTest, TestAppInfoUpdates) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); + + EXPECT_CALL(*msm, Set("HelloApp", LANGUAGE_GUI, "Klingon")).Times(1); + gui_language_info.Update("Klingon"); +} + +TEST(UsageStatisticsTest, TestAppInfoUpdatesTwice) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); + + InSequence s; + EXPECT_CALL(*msm, Set("HelloApp", LANGUAGE_GUI, "Klingon")).Times(1); + EXPECT_CALL(*msm, Set("HelloApp", LANGUAGE_GUI, "UA")).Times(1); + gui_language_info.Update("Klingon"); + gui_language_info.Update("UA"); +} + +TEST(UsageStatisticsTest, TestAppStopwatchAutoStopsAndAddsZero) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppStopwatch hmi_full_stopwatch(msm, "HelloApp"); + + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 0)).Times(1); + + hmi_full_stopwatch.Start(SECONDS_HMI_FULL); +} + +TEST(UsageStatisticsTest, TestAppStopwatchAddsZero) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppStopwatch hmi_full_stopwatch(msm, "HelloApp"); + + InSequence s; + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 0)).Times(1); + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_BACKGROUND, 0)).Times(1); + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 0)).Times(1); + + hmi_full_stopwatch.Start(SECONDS_HMI_FULL); + hmi_full_stopwatch.Switch(SECONDS_HMI_BACKGROUND); + hmi_full_stopwatch.Switch(SECONDS_HMI_FULL); + hmi_full_stopwatch.Stop(); +} + +TEST(UsageStatisticsTest, TestAppStopwatchAutoStopsInASecond) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppStopwatch hmi_full_stopwatch(msm, "HelloApp"); + + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 1)).Times(1); + + hmi_full_stopwatch.Start(SECONDS_HMI_FULL); + sleep(1); +} + +TEST(UsageStatisticsTest, TestAppStopwatchStopsInTwoSeconds) { + MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + AppStopwatch hmi_full_stopwatch(msm, "HelloApp"); + + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_NONE, 0)).Times(1); + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 1)).Times(1); + EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_BACKGROUND, 1)).Times(1); + + hmi_full_stopwatch.Start(SECONDS_HMI_NONE); + hmi_full_stopwatch.Switch(SECONDS_HMI_FULL); + sleep(1); + hmi_full_stopwatch.Switch(SECONDS_HMI_BACKGROUND); + sleep(1); +} + +} // namespace test +} // namespace usage_statistics diff --git a/src/components/policy/test/valid_sdl_pt_update.json b/src/components/policy/test/valid_sdl_pt_update.json new file mode 100644 index 0000000000..6556ad5106 --- /dev/null +++ b/src/components/policy/test/valid_sdl_pt_update.json @@ -0,0 +1,1723 @@ +{ + "policy_table" : { + "app_policies" : { + "1766825573" : { + "AppHMIType" : [ "MEDIA" ], + "certificate" : "akdjfhaliuygrglurng", + "default_hmi" : "BACKGROUND", + "groups" : [ + "Notifications", + "Location-1", + "PropriataryData-1", + "Navigation-1", + "Base-4", + "VehicleInfo-3", + "DrivingCharacteristics-3", + "Emergency-1" + ], + "keep_context" : true, + "memory_kb" : 1000, + "nicknames" : [ "SyncProxyTester" ], + "priority" : "EMERGENCY", + "steal_focus" : true, + "watchdog_timer_ms" : 20000 + }, + "default" : { + "default_hmi" : "NONE", + "groups" : [ "Base-4" ], + "keep_context" : false, + "memory_kb" : 1000, + "priority" : "NONE", + "steal_focus" : false, + "watchdog_timer_ms" : 20000 + }, + "device" : { + "default_hmi" : "NONE", + "groups" : [ "Base-4" ], + "memory_kb" : 1000, + "watchdog_timer_ms" : 20000, + "keep_context" : false, + "priority" : "NONE", + "steal_focus" : false + }, + "pre_DataConsent" : { + "default_hmi" : "NONE", + "groups" : [ "pre_Base-1" ], + "keep_context" : false, + "memory_kb" : 1000, + "priority" : "NONE", + "steal_focus" : false, + "watchdog_timer_ms" : 20000 + } + }, + "consumer_friendly_messages" : { + "messages" : { + "AppPermissions" : { + "languages" : { + "de-de" : { + "line1" : "Zugriffsanfrage(n)", + "line2" : "erlauben?", + "tts" : "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab." + }, + "en-au" : { + "line1" : "Grant requested", + "line2" : "permission(s)?", + "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." + }, + "en-gb" : { + "line1" : "Grant requested", + "line2" : "permission(s)?", + "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." + }, + "en-ie" : { + "line1" : "Grant requested", + "line2" : "permission(s)?", + "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." + }, + "en-us" : { + "line1" : "Grant Requested", + "line2" : "Permission(s)?", + "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny." + }, + "es-en" : { + "line1" : "¿Otorgar permiso(s)", + "line2" : "solicitado(s)?", + "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." + }, + "es-es" : { + "line1" : "¿Conceder permisos", + "line2" : "solicitados?", + "tts" : "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar." + }, + "es-mx" : { + "line1" : "¿Otorgar permiso(s)", + "line2" : "solicitado(s)?", + "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." + }, + "fr-ca" : { + "line1" : "Accorder permission(s)", + "line2" : "demandée(s)", + "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser." + }, + "fr-fr" : { + "line1" : "Accorder permission(s)", + "line2" : "demandée(s)", + "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser." + }, + "it-it" : { + "line1" : "Concedi autorizzaz.", + "line2" : "richiesta(e)?", + "tts" : "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare." + }, + "nl-nl" : { + "line1" : "Aangevraagde", + "line2" : "permissie(s) verlenen?", + "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren." + }, + "pl-pl" : { + "line1" : "Udzielić żądanych", + "line2" : "pozwoleń?", + "tts" : "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania." + }, + "pt-br" : { + "line1" : "Conceder permissão", + "line2" : "solicitada?", + "tts" : "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar." + }, + "pt-pt" : { + "line1" : "Conceder permiss.", + "line2" : "solicitada(s)?", + "tts" : "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar." + }, + "ru-ru" : { + "line1" : "Предост. заправш.", + "line2" : "разрешения?", + "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны." + }, + "sv-se" : { + "line1" : "Vill du ge", + "line2" : "tillstånd?", + "tts" : "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka." + }, + "tr-tr" : { + "line1" : "İstenen izinler", + "line2" : "verilsin mi?", + "tts" : "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın." + }, + "zh-cn" : { + "line1" : "是否允许请求的", + "line2" : "权限?", + "tts" : "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。" + }, + "zh-tw" : { + "line1" : "允許", + "line2" : "授權請求?", + "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。" + } + } + }, + "AppPermissionsHelp" : { + "languages" : { + "de-de" : { + "tts" : "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab." + }, + "en-au" : { + "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." + }, + "en-gb" : { + "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." + }, + "en-ie" : { + "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." + }, + "en-us" : { + "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." + }, + "es-en" : { + "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." + }, + "es-es" : { + "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." + }, + "es-mx" : { + "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." + }, + "fr-ca" : { + "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser." + }, + "fr-fr" : { + "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser." + }, + "it-it" : { + "tts" : "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle." + }, + "nl-nl" : { + "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren." + }, + "pl-pl" : { + "tts" : "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania." + }, + "pt-br" : { + "tts" : "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar." + }, + "pt-pt" : { + "tts" : "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar." + }, + "ru-ru" : { + "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять." + }, + "sv-se" : { + "tts" : "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka." + }, + "tr-tr" : { + "tts" : "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın." + }, + "zh-cn" : { + "tts" : "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。" + }, + "zh-tw" : { + "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。" + } + } + }, + "AppPermissionsRevoked" : { + "languages" : { + "de-de" : { + "tts" : "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.." + }, + "en-au" : { + "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "en-gb" : { + "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "en-ie" : { + "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "en-us" : { + "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." + }, + "es-en" : { + "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." + }, + "es-es" : { + "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." + }, + "es-mx" : { + "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." + }, + "fr-ca" : { + "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile." + }, + "fr-fr" : { + "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile." + }, + "it-it" : { + "tts" : "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile." + }, + "nl-nl" : { + "tts" : "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt." + }, + "pl-pl" : { + "tts" : "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji." + }, + "pt-br" : { + "tts" : "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel." + }, + "pt-pt" : { + "tts" : "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel." + }, + "ru-ru" : { + "tts" : "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения." + }, + "sv-se" : { + "tts" : "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten." + }, + "tr-tr" : { + "tts" : "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun." + }, + "zh-cn" : { + "tts" : "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。" + }, + "zh-tw" : { + "tts" : "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。" + } + } + }, + "AppUnauthorized" : { + "languages" : { + "de-de" : { + "line1" : "nicht autorisiert", + "tts" : "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren." + }, + "en-au" : { + "line1" : "not authorized", + "tts" : "This version of %appName% is not authorized and will not work with SYNC." + }, + "en-gb" : { + "line1" : "not authorized", + "tts" : "This version of %appName% is not authorized and will not work with SYNC." + }, + "en-ie" : { + "line1" : "not authorized", + "tts" : "This version of %appName% is not authorized and will not work with SYNC." + }, + "en-us" : { + "line1" : "Not Authorized", + "tts" : "This version of %appName% is not authorized and will not work with SYNC." + }, + "es-en" : { + "line1" : "no autorizada", + "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." + }, + "es-es" : { + "line1" : "No autorizada", + "tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC." + }, + "es-mx" : { + "line1" : "no autorizada", + "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." + }, + "fr-ca" : { + "line1" : "non autorisée", + "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC." + }, + "fr-fr" : { + "line1" : "non autorisée", + "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC." + }, + "it-it" : { + "line1" : "non autorizzata", + "tts" : "Questa versione di %appName% non è autorizzata e non funziona con il SYNC." + }, + "nl-nl" : { + "line1" : "niet geautoriseerd", + "tts" : "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC." + }, + "pl-pl" : { + "line1" : "brak autoryzacji", + "tts" : "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC." + }, + "pt-br" : { + "line1" : "não autorizado", + "tts" : "Esta versão do %appName% não tem autorização e não funcionará com o SYNC." + }, + "pt-pt" : { + "line1" : "não autorizada", + "tts" : "Esta versão de %appName% não está autorizada e não funcionará com o SYNC." + }, + "ru-ru" : { + "line1" : "не авторизировано", + "tts" : "Эта версия %appName% не авторизирована и не будет работать с SYNC." + }, + "sv-se" : { + "line1" : "är ej godkänd", + "tts" : "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC." + }, + "tr-tr" : { + "line1" : "için izin yok", + "tts" : "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz." + }, + "zh-cn" : { + "line1" : "未得到授权", + "tts" : "此版本的%appName% 未得到授权,无法在SYNC上使用。" + }, + "zh-tw" : { + "line1" : "無授權", + "tts" : "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。" + } + } + }, + "AppUnsupported" : { + "languages" : { + "de-de" : { + "line1" : "nicht unterstützt", + "tts" : "Diese Version von %appName% wird von SYNC nicht unterstützt." + }, + "en-au" : { + "line1" : "not supported", + "tts" : "This version of %appName% is not supported by SYNC." + }, + "en-gb" : { + "line1" : "not supported", + "tts" : "This version of %appName% is not supported by SYNC." + }, + "en-ie" : { + "line1" : "not supported", + "tts" : "This version of %appName% is not supported by SYNC." + }, + "en-us" : { + "line1" : "Not Supported", + "tts" : "This version of %appName% is not supported by SYNC." + }, + "es-en" : { + "line1" : "no compatible", + "tts" : "Esta versión de %appName% no es compatible con SYNC." + }, + "es-es" : { + "line1" : "No compatible", + "tts" : "Esta versión de %appName% no es compatible con SYNC." + }, + "es-mx" : { + "line1" : "no compatible", + "tts" : "Esta versión de %appName% no es compatible con SYNC." + }, + "fr-ca" : { + "line1" : "incompatible", + "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC." + }, + "fr-fr" : { + "line1" : "incompatible", + "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC." + }, + "it-it" : { + "line1" : "non supportata", + "tts" : "Questa versione di %appName% non è supportata dal SYNC." + }, + "nl-nl" : { + "line1" : "niet ondersteund", + "tts" : "Deze versie van %appName% wordt niet ondersteund door SYNC." + }, + "pl-pl" : { + "line1" : "aplikacja nie obsług.", + "tts" : "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC." + }, + "pt-br" : { + "line1" : "não suportado", + "tts" : "Esta versão do %appName% não é suportada pelo SYNC." + }, + "pt-pt" : { + "line1" : "não suportada", + "tts" : "Esta versão de %appName% não é suportado pelo SYNC." + }, + "ru-ru" : { + "line1" : "не поддерживается", + "tts" : "Эта версия %appName% не поддерживается SYNC." + }, + "sv-se" : { + "line1" : "stöds ej", + "tts" : "SYNC har inte stöd för den här versionen av %appName%." + }, + "tr-tr" : { + "line1" : "desteklenmiyor", + "tts" : "Bu %appName% sürümü SYNC tarafından desteklenmiyor." + }, + "zh-cn" : { + "line1" : "不受支持", + "tts" : "SYNC不支持此版本的%appName%。" + }, + "zh-tw" : { + "line1" : "不支援", + "tts" : "SYNC 不支援此版本的%appName% 。" + } + } + }, + "DataConsent" : { + "languages" : { + "en-us" : { + "line1" : "Enable Mobile Apps", + "line2" : "on SYNC? (Uses Data)", + "tts" : "To use mobile apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device's data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Please press yes or no, or help for more information. " + } + } + }, + "DataConsentHelp" : { + "languages" : { + "en-us" : { + "tts" : "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC mobile apps settings menu. See your Owner Guide for more information. " + } + } + }, + "DisableApps" : { + "languages" : { + "de-de" : { + "line1" : "Auto-Update", + "line2" : "und Mobile Apps deaktivieren", + "tts" : "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen." + }, + "en-au" : { + "line1" : "Disable auto-updates", + "line2" : "and Mobile Apps?", + "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." + }, + "en-gb" : { + "line1" : "Disable auto-updates", + "line2" : "and Mobile Apps?", + "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." + }, + "en-ie" : { + "line1" : "Disable auto-updates", + "line2" : "and Mobile Apps?", + "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." + }, + "en-us" : { + "line1" : "Disable Auto-Updates", + "line2" : "and Mobile Apps?", + "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." + }, + "es-en" : { + "line1" : "¿Deshab. actualiz.", + "line2" : "autom. y aplic. móv.?", + "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." + }, + "es-es" : { + "line1" : "¿Desact. actual. auto", + "line2" : "y apl. móviles?", + "tts" : "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar." + }, + "es-mx" : { + "line1" : "¿Deshab. actualiz.", + "line2" : "autom. y aplic. móv.?", + "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." + }, + "fr-ca" : { + "line1" : "Désactiver màj autom.", + "line2" : "et app. mobiles?", + "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler." + }, + "fr-fr" : { + "line1" : "Désactiver màj autom.", + "line2" : "et app. mobiles?", + "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler." + }, + "it-it" : { + "line1" : "Disabilitare agg. aut.", + "line2" : "e app mobili?", + "tts" : "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare." + }, + "nl-nl" : { + "line1" : "Auto-updates en mob.", + "line2" : "apps uitschakelen?", + "tts" : "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren." + }, + "pl-pl" : { + "line1" : "Wył. automat. aktual.", + "line2" : "i aplikacje mobilne?", + "tts" : "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować." + }, + "pt-br" : { + "line1" : "Desativar atualizações", + "line2" : "autom. e aplicativos?", + "tts" : "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar." + }, + "pt-pt" : { + "line1" : "Desact. actual. autom.", + "line2" : "e aplicações móveis?", + "tts" : "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar." + }, + "ru-ru" : { + "line1" : "Откл. автообновления", + "line2" : "и мобил. прилож.?", + "tts" : "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены." + }, + "sv-se" : { + "line1" : "Avaktiverar autouppdat.", + "line2" : "och mobilappar?", + "tts" : "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta." + }, + "tr-tr" : { + "line1" : "Oto. güncelleme ve", + "line2" : "mobil uygul. kapat?", + "tts" : "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın." + }, + "zh-cn" : { + "line1" : "是否禁用自动更新和", + "line2" : "移动应用程序?", + "tts" : "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。" + }, + "zh-tw" : { + "line1" : "停用自動更新", + "line2" : "和行動應用程式?", + "tts" : "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。" + } + } + }, + "DrivingCharacteristics" : { + "languages" : { + "de-de" : { + "label" : "Fahreigenschaften", + "tts" : "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus." + }, + "en-au" : { + "label" : "Driving characteristics", + "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." + }, + "en-gb" : { + "label" : "Driving characteristics", + "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." + }, + "en-ie" : { + "label" : "Driving characteristics", + "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." + }, + "en-us" : { + "label" : "Driving Characteristics", + "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status." + }, + "es-en" : { + "label" : "Características del manejo", + "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." + }, + "es-es" : { + "label" : "Características de conducción", + "tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad." + }, + "es-mx" : { + "label" : "Características del manejo", + "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." + }, + "fr-ca" : { + "label" : "Caractéristiques de conduite", + "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité." + }, + "fr-fr" : { + "label" : "Caractéristiques de conduite", + "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité." + }, + "it-it" : { + "label" : "Caratteristiche di guida", + "tts" : "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza." + }, + "nl-nl" : { + "label" : "Rijkenmerken", + "tts" : "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus." + }, + "pl-pl" : { + "label" : "Informacje dotyczące stylu jazdy", + "tts" : "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa." + }, + "pt-br" : { + "label" : "Características de condução", + "tts" : "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança." + }, + "pt-pt" : { + "label" : "Características de condução", + "tts" : "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança." + }, + "ru-ru" : { + "label" : "Характеристики движения", + "tts" : "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности." + }, + "sv-se" : { + "label" : "Köregenskaper", + "tts" : "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus." + }, + "tr-tr" : { + "label" : "Sürüş karakteristikleri", + "tts" : "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu." + }, + "zh-cn" : { + "label" : "行驶特性", + "tts" : "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态" + }, + "zh-tw" : { + "label" : "駕駛特性", + "tts" : "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態" + } + } + }, + "Location" : { + "languages" : { + "de-de" : { + "label" : "GPS und Geschwindigkeit", + "tts" : "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs." + }, + "en-au" : { + "label" : "GPS and speed", + "tts" : "An app can access vehicle GPS and speed." + }, + "en-gb" : { + "label" : "GPS and speed", + "tts" : "An app can access vehicle GPS and speed." + }, + "en-ie" : { + "label" : "GPS and speed", + "tts" : "An app can access vehicle GPS and speed." + }, + "en-us" : { + "label" : "GPS and speed", + "tts" : "An app can access vehicle GPS and speed." + }, + "es-en" : { + "label" : "GPS y velocidad", + "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." + }, + "es-es" : { + "label" : "GPS y velocidad", + "tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo." + }, + "es-mx" : { + "label" : "GPS y velocidad", + "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." + }, + "fr-ca" : { + "label" : "GPS et vitesse", + "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule." + }, + "fr-fr" : { + "label" : "GPS et vitesse", + "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule." + }, + "it-it" : { + "label" : "GPS e velocità", + "tts" : "Un'app può avere accesso a GPS e velocità del veicolo." + }, + "nl-nl" : { + "label" : "Gps en snelheid", + "tts" : "Een app heeft toegang tot gps en de snelheid van het voertuig." + }, + "pl-pl" : { + "label" : "GPS i prędkość", + "tts" : "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu." + }, + "pt-br" : { + "label" : "GPS e velocidade", + "tts" : "Um aplicativo pode acessar o GPS e a velocidade do veículo." + }, + "pt-pt" : { + "label" : "GPS e velocidade", + "tts" : "Uma aplicação consegue aceder ao GPS e à velocidade do veículo." + }, + "ru-ru" : { + "label" : "GPS и скорость", + "tts" : "Приложение имеет доступ к GPS и скорости автомобиля." + }, + "sv-se" : { + "label" : "GPS och hastighet", + "tts" : "Appen kan komma åt fordonets GPS och hastighetsmätare." + }, + "tr-tr" : { + "label" : "GPS ve hız", + "tts" : "Bu uygulama aracın GPS ve hız bilgilerine erişebilir." + }, + "zh-cn" : { + "label" : "GPS 和车速", + "tts" : "移动应用程序可以访问车辆 GPS 和车速信息。" + }, + "zh-tw" : { + "label" : "GPS和車速", + "tts" : "應用程式可存取車輛的GPS和速度。" + } + } + }, + "Notifications" : { + "languages" : { + "de-de" : { + "label" : "Push-Benachrichtigungen", + "tts" : "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden." + }, + "en-au" : { + "label" : "Push notifications", + "tts" : "An app can send notifications when running in the background." + }, + "en-gb" : { + "label" : "Push notifications", + "tts" : "An app can send notifications when running in the background." + }, + "en-ie" : { + "label" : "Push notifications", + "tts" : "An app can send notifications when running in the background." + }, + "en-us" : { + "label" : "Push notifications", + "tts" : "An app can send notifications when running in the background." + }, + "es-en" : { + "label" : "Notificaciones tipo Push", + "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." + }, + "es-es" : { + "label" : "Notificaciones push", + "tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano." + }, + "es-mx" : { + "label" : "Notificaciones tipo Push", + "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." + }, + "fr-ca" : { + "label" : "Notifications instantanées", + "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan." + }, + "fr-fr" : { + "label" : "Notifications push", + "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan." + }, + "it-it" : { + "label" : "Notifiche push", + "tts" : "Un'app può inviare notifiche se eseguita in background." + }, + "nl-nl" : { + "label" : "Push-meldingen", + "tts" : "Een app kan meldingen versturen als deze op de achtergrond actief is." + }, + "pl-pl" : { + "label" : "Powiadomienia Push", + "tts" : "Aplikacja może wysyłać powiadomienia, działając w tle." + }, + "pt-br" : { + "label" : "Notificações Push", + "tts" : "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano." + }, + "pt-pt" : { + "label" : "Notificações push", + "tts" : "Uma aplicação consegue enviar notificações quando está activa em segundo plano." + }, + "ru-ru" : { + "label" : "Оповещения о пересылке", + "tts" : "Если приложение работает в фоновом режиме, оно может отправлять оповещения." + }, + "sv-se" : { + "label" : "Push-notiser", + "tts" : "Appen kan skicka meddelanden när den körs i bakgrunden." + }, + "tr-tr" : { + "label" : "Anlık bildirimleri", + "tts" : "Bir uygulama arka planda çalışırken bildirim gönderebilir." + }, + "zh-cn" : { + "label" : "推送通知", + "tts" : "移动应用程序在后台运行时可推送通知。" + }, + "zh-tw" : { + "label" : "傳送通知", + "tts" : "車輛行進時,應用程式可在背景中傳送通知。" + } + } + }, + "SettingDisableUpdates" : { + "languages" : { + "de-de" : { + "line1" : "Updates deakt." + }, + "en-au" : { + "line1" : "Disable updates" + }, + "en-gb" : { + "line1" : "Disable updates" + }, + "en-ie" : { + "line1" : "Disable updates" + }, + "en-us" : { + "line1" : "Disable Updates" + }, + "es-en" : { + "line1" : "Deshab. actual." + }, + "es-es" : { + "line1" : "Desact. actual." + }, + "es-mx" : { + "line1" : "Deshab. actual." + }, + "fr-ca" : { + "line1" : "Désactiver MAJ" + }, + "fr-fr" : { + "line1" : "Désactiver màj" + }, + "it-it" : { + "line1" : "Disabilita agg." + }, + "nl-nl" : { + "line1" : "Upd. uitschak." + }, + "pl-pl" : { + "line1" : "Wyłącz aktual." + }, + "pt-br" : { + "line1" : "Desat. atualiz." + }, + "pt-pt" : { + "line1" : "Desact. actualiz." + }, + "ru-ru" : { + "line1" : "Откл. обновл." + }, + "sv-se" : { + "line1" : "Inaktivera uppd." + }, + "tr-tr" : { + "line1" : "Güncell. Kapat" + }, + "zh-cn" : { + "line1" : "禁用更新" + }, + "zh-tw" : { + "line1" : "停用更新" + } + } + }, + "SettingEnableUpdates" : { + "languages" : { + "de-de" : { + "line1" : "Apps aktivieren" + }, + "en-au" : { + "line1" : "Enable Apps" + }, + "en-gb" : { + "line1" : "Enable Apps" + }, + "en-ie" : { + "line1" : "Enable Apps" + }, + "en-us" : { + "line1" : "Enable Apps" + }, + "es-en" : { + "line1" : "Hab. aplic." + }, + "es-es" : { + "line1" : "Activar apl." + }, + "es-mx" : { + "line1" : "Hab. aplic." + }, + "fr-ca" : { + "line1" : "Activer app." + }, + "fr-fr" : { + "line1" : "Activer app." + }, + "it-it" : { + "line1" : "Abilita app" + }, + "nl-nl" : { + "line1" : "Apps inschak." + }, + "pl-pl" : { + "line1" : "Włącz aplikacje" + }, + "pt-br" : { + "line1" : "Ativar aplic." + }, + "pt-pt" : { + "line1" : "Activar actualiz." + }, + "ru-ru" : { + "line1" : "Вкл. прилож." + }, + "sv-se" : { + "line1" : "Aktivera appar" + }, + "tr-tr" : { + "line1" : "Uygulamaları aç" + }, + "zh-cn" : { + "line1" : "启用应用程序" + }, + "zh-tw" : { + "line1" : "啟用應用程式" + } + } + }, + "SettingUpdateAuto" : { + "languages" : { + "de-de" : { + "line1" : "Update anford." + }, + "en-au" : { + "line1" : "Request update" + }, + "en-gb" : { + "line1" : "Request update" + }, + "en-ie" : { + "line1" : "Request update" + }, + "en-us" : { + "line1" : "Request Update" + }, + "es-en" : { + "line1" : "Solicit. actualiz." + }, + "es-es" : { + "line1" : "Solicitar actual." + }, + "es-mx" : { + "line1" : "Solicit. actualiz." + }, + "fr-ca" : { + "line1" : "Demander MAJ" + }, + "fr-fr" : { + "line1" : "Demander màj" + }, + "it-it" : { + "line1" : "Rich. aggiorn." + }, + "nl-nl" : { + "line1" : "Upd. aanvragen" + }, + "pl-pl" : { + "line1" : "Zażądaj aktual." + }, + "pt-br" : { + "line1" : "Solicitar atualiz." + }, + "pt-pt" : { + "line1" : "Solicit. actualiz." + }, + "ru-ru" : { + "line1" : "Запрос на обн." + }, + "sv-se" : { + "line1" : "Begär uppdat." + }, + "tr-tr" : { + "line1" : "Güncelleme iste" + }, + "zh-cn" : { + "line1" : "请求更新" + }, + "zh-tw" : { + "line1" : "請求更新" + } + } + }, + "StatusNeeded" : { + "languages" : { + "de-de" : { + "line1" : "Update benötigt" + }, + "en-au" : { + "line1" : "Update needed" + }, + "en-gb" : { + "line1" : "Update needed" + }, + "en-ie" : { + "line1" : "Update needed" + }, + "en-us" : { + "line1" : "Update Needed" + }, + "es-en" : { + "line1" : "Actualiz. neces." + }, + "es-es" : { + "line1" : "Actu. necesaria" + }, + "es-mx" : { + "line1" : "Actualiz. neces." + }, + "fr-ca" : { + "line1" : "Màj requise" + }, + "fr-fr" : { + "line1" : "Mise à jour requise" + }, + "it-it" : { + "line1" : "Necess. aggiorn." + }, + "nl-nl" : { + "line1" : "Update nodig" + }, + "pl-pl" : { + "line1" : "Potrzeba aktual." + }, + "pt-br" : { + "line1" : "Atualiz. necess." + }, + "pt-pt" : { + "line1" : "Actual. necess." + }, + "ru-ru" : { + "line1" : "Необх. обновл." + }, + "sv-se" : { + "line1" : "Uppdat. krävs" + }, + "tr-tr" : { + "line1" : "Güncellenmeli" + }, + "zh-cn" : { + "line1" : "需要进行更新" + }, + "zh-tw" : { + "line1" : "需更新" + } + } + }, + "StatusPending" : { + "languages" : { + "de-de" : { + "line1" : "Aktualisieren..." + }, + "en-au" : { + "line1" : "Updating..." + }, + "en-gb" : { + "line1" : "Updating..." + }, + "en-ie" : { + "line1" : "Updating..." + }, + "en-us" : { + "line1" : "Updating..." + }, + "es-en" : { + "line1" : "Actualizando..." + }, + "es-es" : { + "line1" : "Actualizando..." + }, + "es-mx" : { + "line1" : "Actualizando..." + }, + "fr-ca" : { + "line1" : "MAJ en cours..." + }, + "fr-fr" : { + "line1" : "Màj en cours..." + }, + "it-it" : { + "line1" : "Aggiornamento" + }, + "nl-nl" : { + "line1" : "Updaten..." + }, + "pl-pl" : { + "line1" : "Aktualizowanie" + }, + "pt-br" : { + "line1" : "Atualizando..." + }, + "pt-pt" : { + "line1" : "A actualizar..." + }, + "ru-ru" : { + "line1" : "Обновление..." + }, + "sv-se" : { + "line1" : "Uppdaterar..." + }, + "tr-tr" : { + "line1" : "Güncelleniyor..." + }, + "zh-cn" : { + "line1" : "正在更新......" + }, + "zh-tw" : { + "line1" : "更新中..." + } + } + }, + "StatusUpToDate" : { + "languages" : { + "de-de" : { + "line1" : "Aktuelle Version" + }, + "en-au" : { + "line1" : "Up-to-date" + }, + "en-gb" : { + "line1" : "Up-to-date" + }, + "en-ie" : { + "line1" : "Up-to-date" + }, + "en-us" : { + "line1" : "Up-To-Date" + }, + "es-en" : { + "line1" : "Actualizado" + }, + "es-es" : { + "line1" : "Actualizada" + }, + "es-mx" : { + "line1" : "Actualizado" + }, + "fr-ca" : { + "line1" : "Déjà à jour" + }, + "fr-fr" : { + "line1" : "Déjà à jour" + }, + "it-it" : { + "line1" : "più recente" + }, + "nl-nl" : { + "line1" : "Up-to-date" + }, + "pl-pl" : { + "line1" : "Aktualne" + }, + "pt-br" : { + "line1" : "Atualizado" + }, + "pt-pt" : { + "line1" : "Actualizado" + }, + "ru-ru" : { + "line1" : "Обновлено" + }, + "sv-se" : { + "line1" : "Uppdat. krävs ej" + }, + "tr-tr" : { + "line1" : "Güncel" + }, + "zh-cn" : { + "line1" : "最新更新" + }, + "zh-tw" : { + "line1" : "更新最新" + } + } + }, + "VehicleInfo" : { + "languages" : { + "de-de" : { + "label" : "Fahrzeuginformationen", + "tts" : "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck." + }, + "en-au" : { + "label" : "Vehicle information", + "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." + }, + "en-gb" : { + "label" : "Vehicle information", + "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." + }, + "en-ie" : { + "label" : "Vehicle information", + "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." + }, + "en-us" : { + "label" : "Vehicle information", + "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure." + }, + "es-en" : { + "label" : "Información del vehículo", + "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." + }, + "es-es" : { + "label" : "Información del vehículo", + "tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos." + }, + "es-mx" : { + "label" : "Información del vehículo", + "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." + }, + "fr-ca" : { + "label" : "Renseignements du véhicule", + "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus." + }, + "fr-fr" : { + "label" : "Renseignements du véhicule", + "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus." + }, + "it-it" : { + "label" : "Informazioni sul veicolo", + "tts" : "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici." + }, + "nl-nl" : { + "label" : "Voertuiginformatie", + "tts" : "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning." + }, + "pl-pl" : { + "label" : "Informacje o pojeździe", + "tts" : "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon." + }, + "pt-br" : { + "label" : "Informações sobre o veículo", + "tts" : "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus." + }, + "pt-pt" : { + "label" : "Informações do veículo", + "tts" : "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus." + }, + "ru-ru" : { + "label" : "Информация об автомобиле", + "tts" : "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин." + }, + "sv-se" : { + "label" : "Fordonsinformation", + "tts" : "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck." + }, + "tr-tr" : { + "label" : "Araç bilgisi", + "tts" : "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı." + }, + "zh-cn" : { + "label" : "车辆信息", + "tts" : "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压." + }, + "zh-tw" : { + "label" : "車輛資訊", + "tts" : "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓." + } + } + } + }, + "version" : "001.001.015" + }, + "functional_groupings" : { + "Base-4" : { + "rpcs" : { + "AddCommand" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "AddSubMenu" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "Alert" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "ChangeRegistration" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "CreateInteractionChoiceSet" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "DeleteCommand" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "DeleteFile" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "DeleteInteractionChoiceSet" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "DeleteSubMenu" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "EncodedSyncPData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "EndAudioPassThru" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "GenericResponse" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "ListFiles" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnAppInterfaceUnregistered" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnAudioPassThru" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "OnButtonEvent" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "OnButtonPress" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "OnCommand" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "OnDriverDistraction" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "OnEncodedSyncPData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnHMIStatus" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnLanguageChange" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnPermissionsChange" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnSyncPData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnTBTClientState" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "PerformAudioPassThru" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "PerformInteraction" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "PutFile" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "RegisterAppInterface" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "ResetGlobalProperties" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "ScrollableMessage" : { + "hmi_levels" : [ "FULL" ] + }, + "SetAppIcon" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "SetDisplayLayout" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "SetGlobalProperties" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "SetMediaClockTimer" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "Show" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "Slider" : { + "hmi_levels" : [ "FULL" ] + }, + "Speak" : { + "hmi_levels" : [ "FULL", "LIMITED" ] + }, + "SubscribeButton" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "SyncPData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "UnregisterAppInterface" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "UnsubscribeButton" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + } + } + }, + "DrivingCharacteristics-3" : { + "rpcs" : { + "GetVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle" + ] + }, + "OnVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle" + ] + }, + "SubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle" + ] + }, + "UnsubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "accPedalPosition", + "beltStatus", + "driverBraking", + "myKey", + "prndl", + "rpm", + "steeringWheelAngle" + ] + } + }, + "user_consent_prompt" : "DrivingCharacteristics" + }, + "Emergency-1" : { + "rpcs" : { + "GetVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "airbagStatus", + "bodyInformation", + "clusterModeStatus", + "deviceStatus", + "eCallInfo", + "emergencyEvent" + ] + }, + "OnVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "airbagStatus", + "bodyInformation", + "clusterModeStatus", + "deviceStatus", + "eCallInfo", + "emergencyEvent" + ] + }, + "SubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "airbagStatus", + "bodyInformation", + "clusterModeStatus", + "deviceStatus", + "eCallInfo", + "emergencyEvent" + ] + }, + "UnsubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "airbagStatus", + "bodyInformation", + "clusterModeStatus", + "deviceStatus", + "eCallInfo", + "emergencyEvent" + ] + } + } + }, + "Location-1" : { + "rpcs" : { + "GetVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ "gps", "speed" ] + }, + "OnVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ "gps", "speed" ] + }, + "SubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ "gps", "speed" ] + }, + "UnsubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ "gps", "speed" ] + } + }, + "user_consent_prompt" : "Location" + }, + "Navigation-1" : { + "rpcs" : { + "AlertManeuver" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "ShowConstantTBT" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "UpdateTurnList" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + } + } + }, + "Notifications" : { + "rpcs" : { + "Alert" : { + "hmi_levels" : [ "BACKGROUND" ] + } + }, + "user_consent_prompt" : "Notifications" + }, + "PropriataryData-1" : { + "rpcs" : { + "DiagnosticMessage" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "GetDTCs" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "ReadDID" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + } + } + }, + "VehicleInfo-3" : { + "rpcs" : { + "GetVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "vin", + "wiperStatus" + ] + }, + "OnVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "vin", + "wiperStatus" + ] + }, + "SubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "wiperStatus" + ] + }, + "UnsubscribeVehicleData" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ], + "parameters" : [ + "engineTorque", + "externalTemperature", + "fuelLevel", + "fuelLevel_State", + "headLampStatus", + "instantFuelConsumption", + "odometer", + "tirePressure", + "wiperStatus" + ] + } + }, + "user_consent_prompt" : "VehicleInfo" + }, + "pre_Base-1" : { + "rpcs" : { + "ChangeRegistration" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "DeleteFile" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "GenericResponse" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "ListFiles" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnAppInterfaceUnregistered" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnLanguageChange" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "OnPermissionsChange" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "PutFile" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "RegisterAppInterface" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "ResetGlobalProperties" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "SetAppIcon" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "SetDisplayLayout" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + }, + "SetGlobalProperties" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ] + }, + "UnregisterAppInterface" : { + "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ] + } + } + } + }, + "module_config" : { + "device_certificates" : { + "HUU40DAS7F970UEI17A73JH32L41K32JH4L1K234H3K4" : "aldhfkahfgkafrblgjr" + }, + "endpoints" : { + "0x07" : { + "default" : [ "http://policies.telematics.ford.com/api/policies" ] + } + }, + "exchange_after_x_days" : 30, + "exchange_after_x_ignition_cycles" : 100, + "exchange_after_x_kilometers" : 1800, + "notifications_per_minute_by_priority" : { + "COMMUNICATION" : 6, + "EMERGENCY" : 60, + "NAVIGATION" : 15, + "NONE" : 0, + "NORMAL" : 4, + "VOICECOMM" : 10 + }, + "preloaded_pt" : true, + "seconds_between_retries" : [ 1, 5, 25, 125, 625 ], + "timeout_after_x_seconds" : 60, + "vehicle_make" : "Stark Industries", + "vehicle_model" : "E-Tron", + "vehicle_year" : "1992" + } + } +} diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index acf968f3a0..454287595a 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -1076,12 +1076,13 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( protocol_version, packet.service_type()); return RESULT_OK; } - const uint32_t connection_key = - session_observer_->KeyFromPair(connection_id, session_id); #ifdef ENABLE_SECURITY // for packet is encrypted and security plugin is enable if (protection && security_manager_) { + const uint32_t connection_key = + session_observer_->KeyFromPair(connection_id, session_id); + security_manager::SSLContext *ssl_context = security_manager_->CreateSSLContext(connection_key); if (!ssl_context) { @@ -1120,7 +1121,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( SendStartSessionAck(connection_id, session_id, packet.protocol_version(), hash_id, packet.service_type(), PROTECTION_OFF); return RESULT_OK; - } +} RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( ConnectionID connection_id, const ProtocolPacket &packet) { diff --git a/src/components/qt_hmi/References/Look/.DS_Store b/src/components/qt_hmi/References/Look/.DS_Store Binary files differnew file mode 100644 index 0000000000..c84f3ca965 --- /dev/null +++ b/src/components/qt_hmi/References/Look/.DS_Store diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll Binary files differnew file mode 100644 index 0000000000..52506bb139 --- /dev/null +++ b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll Binary files differnew file mode 100644 index 0000000000..4d811bed1e --- /dev/null +++ b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll diff --git a/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml b/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml index ec9731d1c4..895ebbf879 100644 --- a/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml +++ b/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml @@ -42,6 +42,7 @@ import "../popups" GeneralView { applicationContext: true + systemContext: Common.SystemContext.SYSCTXT_HMI_OBSCURED onLeaveScreen: { timer.stop() dataContainer.scrollableMessageModel.running = false diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h index f9b8914295..a581092340 100644 --- a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h +++ b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h @@ -89,7 +89,7 @@ namespace impl { // static inline const Json::Value* ValueMember(const Json::Value* value, const char* member_name) { - if (value && value->isMember(member_name)) { + if (value && value->isObject() && value->isMember(member_name)) { return &(*value)[member_name]; } return NULL; diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h index a2dce4bf8b..2b17e8d27c 100644 --- a/src/components/security_manager/include/security_manager/security_manager_impl.h +++ b/src/components/security_manager/include/security_manager/security_manager_impl.h @@ -78,13 +78,13 @@ class SecurityManagerImpl * Overriden ProtocolObserver::OnMessageReceived method * \param message Message with supporting params received */ - void OnMessageReceived(const RawMessagePtr message) OVERRIDE; + void OnMessageReceived(const ::protocol_handler::RawMessagePtr message) OVERRIDE; /** * \brief Post message to Mobile Application * Empty *overriden ProtocolObserver::OnMessageReceived method * \param message Message with supporting params received */ - void OnMobileMessageSent(const RawMessagePtr) OVERRIDE; + void OnMobileMessageSent(const ::protocol_handler::RawMessagePtr) OVERRIDE; /** * \brief Sets pointer for Connection Handler layer for managing sessions diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 7b538ed1fe..156ac5b83c 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -50,7 +50,7 @@ SecurityManagerImpl::SecurityManagerImpl() } void SecurityManagerImpl::OnMessageReceived( - const RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { if (message->service_type() != protocol_handler::kControl) { return; } @@ -73,7 +73,7 @@ void SecurityManagerImpl::OnMessageReceived( } void SecurityManagerImpl::OnMobileMessageSent( - const RawMessagePtr ) { + const ::protocol_handler::RawMessagePtr ) { } void SecurityManagerImpl::set_session_observer( @@ -297,7 +297,7 @@ bool SecurityManagerImpl::ProccessHandshakeData(const SecurityMessage &inMessage } bool SecurityManagerImpl::ProccessInternalError(const SecurityMessage &inMessage) { - LOG4CXX_INFO(logger_, "Recieved InternalError with Json message" + LOG4CXX_INFO(logger_, "Received InternalError with Json message" << inMessage->get_json_message()); Json::Value root; Json::Reader reader; @@ -305,7 +305,7 @@ bool SecurityManagerImpl::ProccessInternalError(const SecurityMessage &inMessage reader.parse(inMessage->get_json_message(), root); if (!parsingSuccessful) return false; - LOG4CXX_DEBUG(logger_, "Recieved InternalError id " << root[kErrId].asString() + LOG4CXX_DEBUG(logger_, "Received InternalError id " << root[kErrId].asString() << ", text: " << root[kErrText].asString()); return true; } @@ -350,7 +350,7 @@ void SecurityManagerImpl::SendQuery(const SecurityQuery& query, const uint32_t connection_key) { const std::vector<uint8_t> data_sending = query.DeserializeQuery(); - const RawMessagePtr rawMessagePtr( + const ::protocol_handler::RawMessagePtr rawMessagePtr( new protocol_handler::RawMessage(connection_key, protocol_handler::PROTOCOL_VERSION_3, &data_sending[0], data_sending.size(), diff --git a/src/components/time_tester/src/time_manager.cc b/src/components/time_tester/src/time_manager.cc index de1537e306..6cabe3ad14 100644 --- a/src/components/time_tester/src/time_manager.cc +++ b/src/components/time_tester/src/time_manager.cc @@ -70,7 +70,7 @@ void TimeManager::Init(protocol_handler::ProtocolHandlerImpl* ph) { DCHECK(ph); if (!thread_) { streamer_ = new Streamer(this); - thread_ = new threads::Thread("TimeManager", streamer_ ); + thread_ = threads::CreateThread("TimeManager", streamer_ ); application_manager::ApplicationManagerImpl::instance()->SetTimeMetricObserver(&app_observer); transport_manager::TransportManagerDefault::instance()->SetTimeMetricObserver(&tm_observer); ph->SetTimeMetricObserver(&ph_observer); @@ -82,7 +82,6 @@ void TimeManager::Init(protocol_handler::ProtocolHandlerImpl* ph) { void TimeManager::Stop() { if (thread_) { thread_->stop(); - delete thread_; thread_ = NULL; if (socket_fd_ != -1) { ::close(socket_fd_); @@ -164,8 +163,7 @@ void TimeManager::Streamer::Start() { return; } - sockaddr_in serv_addr_; - memset(&serv_addr_, 0, sizeof(serv_addr_)); + sockaddr_in serv_addr_ = { 0 }; serv_addr_.sin_addr.s_addr = inet_addr(server_->ip_.c_str()); serv_addr_.sin_family = AF_INET; serv_addr_.sin_port = htons(server_->port_); diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt index 922eb5431b..15ecc91619 100644 --- a/src/components/transport_manager/CMakeLists.txt +++ b/src/components/transport_manager/CMakeLists.txt @@ -65,32 +65,8 @@ if (BUILD_USB_SUPPORT) endif() endif(BUILD_USB_SUPPORT) -if (BUILD_MME_SUPPORT) - list (APPEND SOURCES - src/mme/mme_transport_adapter.cc - src/mme/mme_device.cc - src/mme/iap_device.cc - src/mme/iap2_device.cc - src/mme/mme_device_scanner.cc - src/mme/mme_connection_factory.cc - src/mme/iap_connection.cc - src/mme/iap2_connection.cc - src/mme/protocol_config.cc - ) -endif(BUILD_MME_SUPPORT) if (CMAKE_SYSTEM_NAME STREQUAL "QNX") - if (BUILD_AOA_SUPPORT) - list (APPEND SOURCES - src/aoa/aoa_wrapper.cc - src/aoa/aoa_device.cc - src/aoa/aoa_dynamic_device.cc - src/aoa/aoa_device_scanner.cc - src/aoa/aoa_connection.cc - src/aoa/aoa_connection_factory.cc - src/aoa/aoa_transport_adapter.cc - ) - endif(BUILD_AOA_SUPPORT) endif() add_library(${target} ${SOURCES}) @@ -102,11 +78,6 @@ if (BUILD_USB_SUPPORT) endif() endif(BUILD_USB_SUPPORT) -if (BUILD_MME_SUPPORT) - target_link_libraries (${target} ipod) - target_link_libraries (${target} iap2client) - target_link_libraries (${target} qdb) -endif(BUILD_MME_SUPPORT) if (BUILD_AVAHI_SUPPORT) target_link_libraries(${target} avahi-common) @@ -121,7 +92,4 @@ if (BUILD_BT_SUPPORT) endif() if (CMAKE_SYSTEM_NAME STREQUAL "QNX") - if (BUILD_AOA_SUPPORT) - target_link_libraries(${target} aoa) - endif(BUILD_AOA_SUPPORT) endif()
\ No newline at end of file diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h index 090f46d001..12eab5a1b5 100644 --- a/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h +++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h @@ -38,6 +38,9 @@ #include "transport_manager/transport_adapter/client_connection_listener.h" +#include "utils/threads/thread_delegate.h" +#include "utils/threads/thread.h" + namespace transport_manager { namespace transport_adapter { @@ -46,7 +49,8 @@ class TransportAdapterController; /** * @brief Listener of device adapter that use TCP transport. */ -class TcpClientListener : public ClientConnectionListener { +class TcpClientListener : public ClientConnectionListener, + public threads::ThreadDelegate { public: /** * @breaf Constructor. @@ -62,7 +66,9 @@ class TcpClientListener : public ClientConnectionListener { /** * @brief Start TCP client listener thread. */ - void Thread(); + void threadMain(); + + bool exitThreadMain(); protected: /** @@ -106,10 +112,9 @@ class TcpClientListener : public ClientConnectionListener { const bool enable_keepalive_; TransportAdapterController* controller_; // TODO(Eamakhov): change to threads::Thread usage - pthread_t thread_; + threads::Thread* thread_; int socket_; bool thread_started_; - bool shutdown_requested_; bool thread_stop_requested_; }; diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h b/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h index 2bfea9c818..094cb51921 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h @@ -63,7 +63,7 @@ class Connection { * * @return Error Information about possible reason of sending data failure. */ - virtual TransportAdapter::Error SendData(RawMessagePtr message) = 0; + virtual TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message) = 0; /** * @brief Disconnect the current connection. @@ -71,11 +71,6 @@ class Connection { virtual TransportAdapter::Error Disconnect() = 0; }; -/** - * @typedef Type definition of smart pointer to the Connection class. - */ -typedef utils::SharedPtr<Connection> ConnectionSptr; - } // namespace transport_adapter } // namespace transport_manager #endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_CONNECTION_H_ diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h b/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h index 5398b13869..851f250a88 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h @@ -40,6 +40,8 @@ #include "transport_manager/transport_adapter/connection.h" #include "protocol/common.h" +#include "utils/threads/thread_delegate.h" +#include "utils/threads/thread.h" using ::transport_manager::transport_adapter::Connection; @@ -51,7 +53,8 @@ class TransportAdapterController; /** * @brief Class responsible for communication over sockets. */ -class ThreadedSocketConnection : public Connection { +class ThreadedSocketConnection : public Connection, + public threads::ThreadDelegate { public: /** @@ -61,7 +64,7 @@ class ThreadedSocketConnection : public Connection { * * @return Error Information about possible reason of sending data failure. */ - TransportAdapter::Error SendData(RawMessagePtr message); + TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message); /** * @brief Disconnect the current connection. @@ -129,7 +132,8 @@ class ThreadedSocketConnection : public Connection { int read_fd_; int write_fd_; - void Thread(); + void threadMain(); + bool exitThreadMain(); void Transmit(); void Finalize(); TransportAdapter::Error Notify() const; @@ -137,24 +141,20 @@ class ThreadedSocketConnection : public Connection { bool Send(); void Abort(); - friend void* StartThreadedSocketConnection(void*); - TransportAdapterController* controller_; /** * @brief Frames that must be sent to remote device. **/ - typedef std::queue<RawMessagePtr> FrameQueue; + typedef std::queue<protocol_handler::RawMessagePtr> FrameQueue; FrameQueue frames_to_send_; mutable pthread_mutex_t frames_to_send_mutex_; - // TODO(Eamakhov): change to threads::Thread usage - pthread_t thread_; - int socket_; bool terminate_flag_; bool unexpected_disconnect_; const DeviceUID device_uid_; const ApplicationHandle app_handle_; + threads::Thread* thread_; }; } // namespace transport_adapter } // namespace transport_manager diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h index a2502f67f3..aaa1139b9f 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h @@ -95,7 +95,7 @@ class TransportAdapterController { * @param device_handle Device unique identifier. * @param app_handle Handle of application. */ - virtual void ConnectionCreated(ConnectionSptr connection, + virtual void ConnectionCreated(Connection* connection, const DeviceUID& device_handle, const ApplicationHandle& app_handle) = 0; @@ -164,7 +164,7 @@ class TransportAdapterController { */ virtual void DataReceiveDone(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - RawMessagePtr message) = 0; + ::protocol_handler::RawMessagePtr message) = 0; /** * @brief Launch OnDataReceiveFailed event in the device adapter listener. @@ -186,7 +186,7 @@ class TransportAdapterController { */ virtual void DataSendDone(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - RawMessagePtr message) = 0; + ::protocol_handler::RawMessagePtr message) = 0; /** * @brief Launch OnDataSendFailed event in the device adapter listener. @@ -198,7 +198,7 @@ class TransportAdapterController { */ virtual void DataSendFailed(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - RawMessagePtr message, const DataSendError&) = 0; + ::protocol_handler::RawMessagePtr message, const DataSendError&) = 0; }; } // namespace transport_adapter diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h index df9f0e4703..2c27e0d20f 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h @@ -165,7 +165,7 @@ class TransportAdapterImpl : public TransportAdapter, **/ virtual TransportAdapter::Error SendData(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - const RawMessagePtr data); + const ::protocol_handler::RawMessagePtr data); /** * @brief Start client listener. @@ -264,7 +264,7 @@ class TransportAdapterImpl : public TransportAdapter, * @param device_handle Device unique identifier. * @param app_handle Handle of application. */ - virtual void ConnectionCreated(ConnectionSptr connection, + virtual void ConnectionCreated(Connection* connection, const DeviceUID& device_handle, const ApplicationHandle& app_handle); @@ -337,7 +337,7 @@ class TransportAdapterImpl : public TransportAdapter, */ virtual void DataReceiveDone(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - RawMessagePtr message); + ::protocol_handler::RawMessagePtr message); /** * @brief Launch OnDataReceiveFailed event in the device adapter listener. @@ -359,7 +359,7 @@ class TransportAdapterImpl : public TransportAdapter, */ virtual void DataSendDone(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - RawMessagePtr message); + ::protocol_handler::RawMessagePtr message); /** * @brief Launch OnDataSendFailed event in the device adapter listener. @@ -371,7 +371,7 @@ class TransportAdapterImpl : public TransportAdapter, */ virtual void DataSendFailed(const DeviceUID& device_handle, const ApplicationHandle& app_handle, - RawMessagePtr message, + ::protocol_handler::RawMessagePtr message, const DataSendError& error); /** @@ -431,9 +431,9 @@ class TransportAdapterImpl : public TransportAdapter, * @param device_handle Device unique identifier. * @param app_handle Handle of application. * - * @return ConnectionSptr smart pointer to the connection. + * @return pointer to the connection. */ - ConnectionSptr FindEstablishedConnection(const DeviceUID& device_handle, + Connection* FindEstablishedConnection(const DeviceUID& device_handle, const ApplicationHandle& app_handle) const; private: @@ -464,7 +464,7 @@ class TransportAdapterImpl : public TransportAdapter, * @brief Structure that holds information about connection. */ struct ConnectionInfo { - ConnectionSptr connection; + Connection* connection; DeviceUID device_id; ApplicationHandle app_handle; enum { diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h index 1adfa0ad2e..3c302caf14 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h @@ -196,7 +196,7 @@ class TransportAdapterListener { virtual void OnDataSendDone(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, - const RawMessagePtr data_container) = 0; + const ::protocol_handler::RawMessagePtr data_container) = 0; /** * @brief Search specified device adapter in the container of shared pointers to device adapters to be sure it is available, create data receive error, @@ -210,7 +210,7 @@ class TransportAdapterListener { virtual void OnDataSendFailed(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, - const RawMessagePtr data_container, + const ::protocol_handler::RawMessagePtr data_container, const DataSendError& error) = 0; /** @@ -225,7 +225,7 @@ class TransportAdapterListener { virtual void OnDataReceiveDone(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, - const RawMessagePtr data_container) = 0; + const ::protocol_handler::RawMessagePtr data_container) = 0; /** * @brief Search specified device adapter in the container of shared pointers to device adapters to be sure it is available, create data send error, diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h index ea01dba49c..87d71ea56f 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h @@ -226,7 +226,7 @@ class TransportAdapterListenerImpl virtual void OnDataReceiveDone(const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id, - const RawMessagePtr data_container); + const ::protocol_handler::RawMessagePtr data_container); /** * @brief Search specified device adapter in the container of shared pointers @@ -257,7 +257,7 @@ class TransportAdapterListenerImpl virtual void OnDataSendDone(const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id, - const RawMessagePtr data_container); + const ::protocol_handler::RawMessagePtr data_container); /** * @brief Search specified device adapter in the container of shared pointers @@ -267,7 +267,7 @@ class TransportAdapterListenerImpl virtual void OnDataSendFailed(const TransportAdapter* adapter, const DeviceUID& device, const ApplicationHandle& app_id, - const RawMessagePtr data_container, + const ::protocol_handler::RawMessagePtr data_container, const DataSendError& error); /** diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h index 181c4089ed..62fdb3fa2e 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h @@ -35,13 +35,6 @@ #include <pthread.h> -#ifdef RWLOCK_SUPPORT -# if (defined(OS_LINUX) && (defined(__USE_UNIX98) || defined(__USE_XOPEN2K))) || \ - (defined(OS_QNX) && (defined(__EXT_POSIX1_200112))) -# define USE_RWLOCK -# endif -#endif - #include <queue> #include <map> #include <list> @@ -57,17 +50,18 @@ #ifdef TIME_TESTER #include "transport_manager/time_metric_observer.h" #endif // TIME_TESTER +#include "utils/threads/message_loop_thread.h" +#include "transport_manager/transport_adapter/transport_adapter_event.h" namespace transport_manager { /** * @brief Implementation of transport manager.s */ -class TransportManagerImpl : public TransportManager { +class TransportManagerImpl : public TransportManager, + public threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> >::Handler, + public threads::MessageLoopThread<std::queue<TransportAdapterEvent> >::Handler { public: - /** - * @brief Hold connection parameters. - */ struct Connection { ConnectionUID id; DeviceUID device; @@ -157,7 +151,7 @@ class TransportManagerImpl : public TransportManager { * * @return Code error. **/ - virtual int SendMessageToDevice(const RawMessagePtr message); + virtual int SendMessageToDevice(const protocol_handler::RawMessagePtr message); /** * @brief Post event in the event queue. @@ -244,25 +238,10 @@ class TransportManagerImpl : public TransportManager { * * @param message Smart pointer to the raw massage. **/ - void PostMessage(const RawMessagePtr message); + void PostMessage(const ::protocol_handler::RawMessagePtr message); - /** - * @brief update message in queue - * - * @param message shared pointer to raw massage - * - * @see @ref components_transportmanager_client_connection_management - **/ - /*not clear when this function shall be used - * void updateMessage(const RawMessagePtr old_message, const RawMessagePtr - * new_message);*/ - - /** - * @brief Remove message from the container of massages. - * - * @param message Smart pointer to the raw massage. - **/ - void RemoveMessage(const RawMessagePtr message); + void Handle(::protocol_handler::RawMessagePtr msg); + void Handle(TransportAdapterEvent msg); /** * @brief Post event to the container of events. @@ -272,67 +251,6 @@ class TransportManagerImpl : public TransportManager { void PostEvent(const TransportAdapterEvent& event); /** - * @brief Type definition of container that holds smart pointer to the raw - *massages. - **/ - typedef std::list<RawMessagePtr> MessageQueue; - - /** - * @brief Type definition of container that holds events of device adapters. - **/ - typedef std::vector<TransportAdapterEvent> EventQueue; - - static void* MessageQueueStartThread(void* data); - - /** - * @brief Scan message's queue and pull messages according to priority and - *serial number - * - * @param - * - * @see @ref components_transportmanager_client_connection_management - */ - void MessageQueueThread(); - - /** - * @brief Launch EventListenerThread(). - */ - static void* EventListenerStartThread(void*); - /** - * @brief wait until event happens - * - * @param - * - * @see @ref components_transportmanager_client_connection_management - */ - void EventListenerThread(); - - /** - * @brief store messages - * - * @see @ref components_transportmanager_client_connection_management - **/ - MessageQueue message_queue_; - - /** - * @brief Mutex restricting access to messages. - **/ - -#ifdef USE_RWLOCK - mutable sync_primitives::RWLock message_queue_rwlock_; -#endif - mutable pthread_mutex_t message_queue_mutex_; - - pthread_cond_t message_queue_cond_; - - /** - * @brief store events from comming device - * - * @see @ref components_transportmanager_client_connection_management - **/ - EventQueue event_queue_; - - /** * @brief flag that indicates that thread is active * if it is false then threads exist main loop **/ @@ -344,32 +262,12 @@ class TransportManagerImpl : public TransportManager { **/ TransportManagerListenerList transport_manager_listener_; - // TODO(Eamakhov): change to threads::Thread usage - /** - * @brief ID of message queue processing thread - **/ - pthread_t message_queue_thread_; - - /** - * @brief Conditional event thread - **/ - pthread_t event_queue_thread_; - /** * @brief Condition variable to wake up event **/ pthread_cond_t device_listener_thread_wakeup_; /** - * @brief Mutex restricting access to events. - **/ - -#ifdef USE_RWLOCK - mutable sync_primitives::RWLock event_queue_rwlock_; -#endif - mutable pthread_mutex_t event_queue_mutex_; - - /** * @brief Flag that TM is initialized */ bool is_initialized_; @@ -428,6 +326,8 @@ class TransportManagerImpl : public TransportManager { /** For keep listeners which were add TMImpl */ std::map<TransportAdapter*, TransportAdapterListenerImpl*> transport_adapter_listeners_; + threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> > message_queue_; + threads::MessageLoopThread<std::queue<TransportAdapterEvent> > event_queue_; typedef std::vector<std::pair<const TransportAdapter*, DeviceInfo> > DeviceInfoList; diff --git a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h index 868f7d59fd..fc6af46a47 100644 --- a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h +++ b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h @@ -54,7 +54,7 @@ class UsbConnection : public Connection { virtual ~UsbConnection(); protected: - virtual TransportAdapter::Error SendData(RawMessagePtr message); + virtual TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message); virtual TransportAdapter::Error Disconnect(); private: @@ -81,8 +81,8 @@ class UsbConnection : public Connection { libusb_transfer* in_transfer_; libusb_transfer* out_transfer_; - std::list<RawMessagePtr> out_messages_; - RawMessagePtr current_out_message_; + std::list<protocol_handler::RawMessagePtr> out_messages_; + protocol_handler::RawMessagePtr current_out_message_; sync_primitives::Lock out_messages_mutex_; size_t bytes_sent_; bool disconnecting_; diff --git a/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h b/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h index 47a25907d5..3a0d2f8a26 100644 --- a/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h +++ b/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h @@ -1,4 +1,4 @@ -/** +/* * \file usb_connection.h * \brief UsbConnection class header file. * @@ -58,7 +58,7 @@ class UsbConnection : public Connection { virtual ~UsbConnection(); protected: - virtual TransportAdapter::Error SendData(RawMessagePtr message); + virtual TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message); virtual TransportAdapter::Error Disconnect(); private: friend void InTransferCallback(usbd_urb* urb, usbd_pipe*, void*); @@ -86,8 +86,8 @@ class UsbConnection : public Connection { usbd_urb* in_urb_; usbd_urb* out_urb_; - std::list<RawMessagePtr> out_messages_; - RawMessagePtr current_out_message_; + std::list<protocol_handler::RawMessagePtr> out_messages_; + ::protocol_handler::RawMessagePtr current_out_message_; pthread_mutex_t out_messages_mutex_; size_t bytes_sent_; bool disconnecting_; diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc index e440ccb830..547dc463b2 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc @@ -117,7 +117,7 @@ BluetoothDeviceScanner::BluetoothDeviceScanner( }; sdp_uuid128_create(&smart_device_link_service_uuid_, smart_device_link_service_uuid_data); - thread_ = new threads::Thread("BT Device Scaner", new BluetoothDeviceScannerDelegate(this)); + thread_ = threads::CreateThread("BT Device Scaner", new BluetoothDeviceScannerDelegate(this)); } BluetoothDeviceScanner::~BluetoothDeviceScanner() { @@ -444,10 +444,9 @@ void BluetoothDeviceScanner::Terminate() { } LOG4CXX_INFO(logger_, "Waiting for bluetooth device scanner thread termination"); - thread_->join(); + thread_->stop(); LOG4CXX_INFO(logger_, "PASA Bluetooth device scanner thread joined"); } - delete thread_; LOG4CXX_TRACE(logger_, "exit"); } diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc index 514fbe66eb..c0f39cc490 100644 --- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc +++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc @@ -1,4 +1,4 @@ -/** +/* * * Copyright (c) 2013, Ford Motor Company * All rights reserved. @@ -50,6 +50,8 @@ # include <netinet/tcp_var.h> #endif // __linux__ +#include <sstream> + #include "utils/logger.h" #include "transport_manager/transport_adapter/transport_adapter_controller.h" @@ -67,20 +69,9 @@ TcpClientListener::TcpClientListener(TransportAdapterController* controller, : port_(port), enable_keepalive_(enable_keepalive), controller_(controller), - thread_(), + thread_(threads::CreateThread("TcpClientListener", this)), socket_(-1), - thread_started_(false), - shutdown_requested_(false), - thread_stop_requested_(false) {} - -void* tcpClientListenerThread(void* data) { - LOG4CXX_TRACE(logger_, "enter. data " << data); - TcpClientListener* tcpClientListener = static_cast<TcpClientListener*>(data); - assert(tcpClientListener != 0); - tcpClientListener->Thread(); - LOG4CXX_TRACE(logger_, "exit"); - return 0; -} + thread_stop_requested_(false) { } TransportAdapter::Error TcpClientListener::Init() { return TransportAdapter::OK; @@ -88,7 +79,6 @@ TransportAdapter::Error TcpClientListener::Init() { void TcpClientListener::Terminate() { LOG4CXX_TRACE(logger_, "enter"); - shutdown_requested_ = true; if (TransportAdapter::OK != StopListening()) { LOG4CXX_ERROR(logger_, "Cannot stop listening TCP"); } @@ -117,11 +107,10 @@ void SetKeepaliveOptions(const int fd) { setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl)); setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &user_timeout, sizeof(user_timeout)); -#elif __QNX__ // __linux__ +#elif defined(__QNX__) // __linux__ // TODO (KKolodiy): Out of order! const int kMidLength = 4; int mib[kMidLength]; - timeval tval; mib[0] = CTL_NET; mib[1] = AF_INET; @@ -141,7 +130,7 @@ void SetKeepaliveOptions(const int fd) { mib[3] = TCPCTL_KEEPINTVL; sysctl(mib, kMidLength, NULL, NULL, &keepintvl, sizeof(keepintvl)); - memset(&tval, sizeof(tval), 0); + struct timeval tval = { 0 }; tval.tv_sec = keepidle; setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes)); setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &tval, sizeof(tval)); @@ -149,9 +138,9 @@ void SetKeepaliveOptions(const int fd) { LOG4CXX_TRACE(logger_, "exit"); } -void TcpClientListener::Thread() { +void TcpClientListener::threadMain() { LOG4CXX_TRACE(logger_, "enter"); - while (false == thread_stop_requested_) { + while (!thread_stop_requested_) { sockaddr_in client_address; socklen_t client_address_size = sizeof(client_address); const int connection_fd = accept(socket_, (struct sockaddr*)&client_address, @@ -200,7 +189,7 @@ void TcpClientListener::Thread() { TransportAdapter::Error TcpClientListener::StartListening() { LOG4CXX_TRACE(logger_, "enter"); - if (thread_started_) { + if (thread_->is_running()) { LOG4CXX_TRACE(logger_, "exit with TransportAdapter::BAD_STATE. Condition: thread_started_"); return TransportAdapter::BAD_STATE; @@ -214,8 +203,7 @@ TransportAdapter::Error TcpClientListener::StartListening() { return TransportAdapter::FAIL; } - sockaddr_in server_address; - memset(&server_address, 0, sizeof(server_address)); + sockaddr_in server_address = { 0 }; server_address.sin_family = AF_INET; server_address.sin_port = htons(port_); server_address.sin_addr.s_addr = INADDR_ANY; @@ -237,47 +225,42 @@ TransportAdapter::Error TcpClientListener::StartListening() { return TransportAdapter::FAIL; } - const int thread_start_error = pthread_create(&thread_, 0, - &tcpClientListenerThread, this); - if (0 == thread_start_error) { - thread_started_ = true; + if (thread_->start()) { LOG4CXX_DEBUG(logger_, "Tcp client listener thread started"); - pthread_setname_np(thread_, "TCP listener"); } else { - LOG4CXX_ERROR(logger_, "Tcp client listener thread start failed, error code " - << thread_start_error); - LOG4CXX_TRACE(logger_, - "exit with TransportAdapter::FAIL. Condition: 0 !== thread_start_error"); + LOG4CXX_ERROR(logger_, "Tcp client listener thread start failed"); return TransportAdapter::FAIL; } LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK"); return TransportAdapter::OK; } +bool TcpClientListener::exitThreadMain() { + StopListening(); + return true; +} + TransportAdapter::Error TcpClientListener::StopListening() { LOG4CXX_TRACE(logger_, "enter"); - if (!thread_started_) { + if (!thread_->is_running()) { LOG4CXX_TRACE(logger_, "exit with TransportAdapter::BAD_STATE. Condition !thread_started_"); return TransportAdapter::BAD_STATE; } thread_stop_requested_ = true; - int byebyesocket = socket(AF_INET, SOCK_STREAM, 0); - sockaddr_in server_address; - memset(&server_address, 0, sizeof(server_address)); + // We need to connect to the listening socket to unblock accept() call + int byesocket = socket(AF_INET, SOCK_STREAM, 0); + sockaddr_in server_address = { 0 }; server_address.sin_family = AF_INET; server_address.sin_port = htons(port_); server_address.sin_addr.s_addr = INADDR_ANY; - connect(byebyesocket, (sockaddr*)&server_address, sizeof(server_address)); - shutdown(byebyesocket, SHUT_RDWR); - close(byebyesocket); - pthread_join(thread_, 0); + connect(byesocket, (sockaddr*)&server_address, sizeof(server_address)); + shutdown(byesocket, SHUT_RDWR); + close(byesocket); LOG4CXX_DEBUG(logger_, "Tcp client listener thread terminated"); close(socket_); socket_ = -1; - thread_started_ = false; - thread_stop_requested_ = false; LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK"); return TransportAdapter::OK; } diff --git a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc index cea5805348..3b208d8a07 100644 --- a/src/components/transport_manager/src/tcp/tcp_socket_connection.cc +++ b/src/components/transport_manager/src/tcp/tcp_socket_connection.cc @@ -95,8 +95,7 @@ bool TcpServerOiginatedSocketConnection::Establish(ConnectError** error) { return false; } - struct sockaddr_in addr; - memset((char*) &addr, 0, sizeof(addr)); + struct sockaddr_in addr = { 0 }; addr.sin_family = AF_INET; addr.sin_addr.s_addr = tcp_device->in_addr(); addr.sin_port = htons(port); diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc index 6067def111..3747225a89 100644 --- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc +++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc @@ -40,6 +40,7 @@ #include "resumption/last_state.h" #include "utils/logger.h" +#include "utils/threads/thread_delegate.h" #include "transport_manager/tcp/tcp_transport_adapter.h" #include "transport_manager/tcp/tcp_client_listener.h" diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc index 2c365ca405..1e189ed101 100644 --- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc +++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc @@ -51,27 +51,20 @@ ThreadedSocketConnection::ThreadedSocketConnection( : read_fd_(-1), write_fd_(-1), controller_(controller), frames_to_send_(), frames_to_send_mutex_(), - thread_(), socket_(-1), terminate_flag_(false), unexpected_disconnect_(false), device_uid_(device_id), - app_handle_(app_handle) { + app_handle_(app_handle) + { pthread_mutex_init(&frames_to_send_mutex_, 0); } ThreadedSocketConnection::~ThreadedSocketConnection() { terminate_flag_ = true; Notify(); - pthread_join(thread_, 0); pthread_mutex_destroy(&frames_to_send_mutex_); - if (-1 != read_fd_) { - close(read_fd_); - } - if (-1 != write_fd_) { - close(write_fd_); - } } void ThreadedSocketConnection::Abort() { @@ -81,15 +74,6 @@ void ThreadedSocketConnection::Abort() { LOG4CXX_TRACE(logger_, "exit"); } -void* StartThreadedSocketConnection(void* v) { - LOG4CXX_TRACE(logger_, "enter"); - ThreadedSocketConnection* connection = - static_cast<ThreadedSocketConnection*>(v); - connection->Thread(); - LOG4CXX_TRACE(logger_, "exit with 0"); - return 0; -} - TransportAdapter::Error ThreadedSocketConnection::Start() { LOG4CXX_TRACE(logger_, "enter"); int fds[2]; @@ -111,15 +95,16 @@ TransportAdapter::Error ThreadedSocketConnection::Start() { return TransportAdapter::FAIL; } - if (0 != pthread_create(&thread_, 0, &StartThreadedSocketConnection, this)) { + const std::string thread_name = std::string("Socket ") + device_handle(); + thread_ = threads::CreateThread(thread_name.c_str(), this); + + if (!thread_->start()) { LOG4CXX_WARN(logger_, "thread creation failed (#" << pthread_self() << ")"); LOG4CXX_TRACE(logger_, "exit with TransportAdapter::FAIL"); return TransportAdapter::FAIL; } LOG4CXX_DEBUG(logger_, "thread created (#" << pthread_self() << ")"); LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK"); - const std::string thread_name = std::string("Socket ") + device_handle(); - pthread_setname_np(thread_, thread_name.c_str()); return TransportAdapter::OK; } @@ -158,7 +143,7 @@ TransportAdapter::Error ThreadedSocketConnection::Notify() const { } TransportAdapter::Error ThreadedSocketConnection::SendData( - RawMessagePtr message) { + ::protocol_handler::RawMessagePtr message) { LOG4CXX_TRACE(logger_, "enter"); pthread_mutex_lock(&frames_to_send_mutex_); frames_to_send_.push(message); @@ -176,7 +161,13 @@ TransportAdapter::Error ThreadedSocketConnection::Disconnect() { return error; } -void ThreadedSocketConnection::Thread() { +bool ThreadedSocketConnection::exitThreadMain() { + terminate_flag_ = true; + Notify(); + return true; +} + +void ThreadedSocketConnection::threadMain() { LOG4CXX_TRACE(logger_, "enter"); controller_->ConnectionCreated(this, device_uid_, app_handle_); ConnectError* connect_error = NULL; @@ -190,7 +181,7 @@ void ThreadedSocketConnection::Thread() { Finalize(); while (!frames_to_send_.empty()) { LOG4CXX_INFO(logger_, "removing message (#" << pthread_self() << ")"); - RawMessagePtr message = frames_to_send_.front(); + ::protocol_handler::RawMessagePtr message = frames_to_send_.front(); frames_to_send_.pop(); controller_->DataSendFailed(device_handle(), application_handle(), message, DataSendError()); @@ -202,6 +193,12 @@ void ThreadedSocketConnection::Thread() { *connect_error); delete connect_error; } + if (-1 != read_fd_) { + close(read_fd_); + } + if (-1 != write_fd_) { + close(write_fd_); + } LOG4CXX_TRACE(logger_, "exit"); } @@ -296,7 +293,7 @@ bool ThreadedSocketConnection::Receive() { LOG4CXX_DEBUG( logger_, "Received " << bytes_read << " bytes for connection " << this); - RawMessagePtr frame( + ::protocol_handler::RawMessagePtr frame( new protocol_handler::RawMessage(0, 0, buffer, bytes_read)); controller_->DataReceiveDone(device_handle(), application_handle(), frame); @@ -328,7 +325,7 @@ bool ThreadedSocketConnection::Send() { size_t offset = 0; while (!frames_to_send.empty()) { LOG4CXX_INFO(logger_, "frames_to_send is not empty" << pthread_self() << ")"); - RawMessagePtr frame = frames_to_send.front(); + ::protocol_handler::RawMessagePtr frame = frames_to_send.front(); const ssize_t bytes_sent = ::send(socket_, frame->data() + offset, frame->data_size() - offset, 0); diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc index e1d6197072..3330e93e31 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc @@ -208,8 +208,8 @@ TransportAdapter::Error TransportAdapterImpl::Disconnect( LOG4CXX_TRACE(logger_, "exit with BAD_STATE"); return BAD_STATE; } - ConnectionSptr connection = FindEstablishedConnection(device_id, app_handle); - if (connection.valid()) { + Connection* connection = FindEstablishedConnection(device_id, app_handle); + if (connection) { TransportAdapter::Error err = connection->Disconnect(); LOG4CXX_TRACE(logger_, "exit with error: " << err); return err; @@ -248,7 +248,7 @@ TransportAdapter::Error TransportAdapterImpl::DisconnectDevice( TransportAdapter::Error TransportAdapterImpl::SendData( const DeviceUID& device_id, const ApplicationHandle& app_handle, - const RawMessagePtr data) { + const ::protocol_handler::RawMessagePtr data) { LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id << ", app_handle: " << &app_handle << ", data: " << data); if (!initialised_) { @@ -256,8 +256,8 @@ TransportAdapter::Error TransportAdapterImpl::SendData( return BAD_STATE; } - ConnectionSptr connection = FindEstablishedConnection(device_id, app_handle); - if (connection.get() != 0) { + Connection* connection = FindEstablishedConnection(device_id, app_handle); + if (connection) { TransportAdapter::Error err = connection->SendData(data); LOG4CXX_TRACE(logger_, "exit with error: " << err); return err; @@ -459,7 +459,7 @@ bool TransportAdapterImpl::IsClientOriginatedConnectSupported() const { } void TransportAdapterImpl::ConnectionCreated( - ConnectionSptr connection, const DeviceUID& device_id, + Connection* connection, const DeviceUID& device_id, const ApplicationHandle& app_handle) { LOG4CXX_TRACE(logger_, "enter connection:" << connection << ", device_id: " << &device_id << ", app_handle: " << &app_handle); @@ -546,7 +546,7 @@ void TransportAdapterImpl::DisconnectDone( void TransportAdapterImpl::DataReceiveDone(const DeviceUID& device_id, const ApplicationHandle& app_handle, - RawMessagePtr message) { + ::protocol_handler::RawMessagePtr message) { LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id << ", app_handle: " << &app_handle << ", message: " << message); @@ -575,7 +575,7 @@ void TransportAdapterImpl::DataReceiveFailed( void TransportAdapterImpl::DataSendDone(const DeviceUID& device_id, const ApplicationHandle& app_handle, - RawMessagePtr message) { + ::protocol_handler::RawMessagePtr message) { LOG4CXX_TRACE(logger_, "enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { @@ -586,7 +586,7 @@ void TransportAdapterImpl::DataSendDone(const DeviceUID& device_id, void TransportAdapterImpl::DataSendFailed(const DeviceUID& device_id, const ApplicationHandle& app_handle, - RawMessagePtr message, + ::protocol_handler::RawMessagePtr message, const DataSendError& error) { LOG4CXX_TRACE(logger_, "enter"); for (TransportAdapterListenerList::iterator it = listeners_.begin(); @@ -763,11 +763,11 @@ bool TransportAdapterImpl::ToBeAutoConnected(DeviceSptr device) const { return false; } -ConnectionSptr TransportAdapterImpl::FindEstablishedConnection( +Connection* TransportAdapterImpl::FindEstablishedConnection( const DeviceUID& device_id, const ApplicationHandle& app_handle) const { LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id << ", app_handle: " << &app_handle); - ConnectionSptr connection; + Connection* connection = NULL; pthread_mutex_lock(&connections_mutex_); ConnectionMap::const_iterator it = connections_.find(std::make_pair(device_id, app_handle)); @@ -778,7 +778,7 @@ ConnectionSptr TransportAdapterImpl::FindEstablishedConnection( } } pthread_mutex_unlock(&connections_mutex_); - LOG4CXX_TRACE(logger_, "exit with ConnectionSptr: " << connection); + LOG4CXX_TRACE(logger_, "exit with Connection: " << connection); return connection; } diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc index 18128d681e..f73748de52 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc @@ -51,7 +51,7 @@ void TransportAdapterListenerImpl::OnSearchDeviceDone( LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE, - transport_adapter_, "", 0, RawMessagePtr(), BaseErrorPtr()); + transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr()); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -65,7 +65,7 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed( SearchDeviceError* err = new SearchDeviceError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL, - transport_adapter_, "", 0, RawMessagePtr(), BaseErrorPtr(err)); + transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err)); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -78,7 +78,7 @@ void TransportAdapterListenerImpl::OnDeviceListUpdated( LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED, - transport_adapter_, "", 0, RawMessagePtr(), BaseErrorPtr()); + transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr()); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -91,7 +91,7 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest( LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); const TransportAdapterEvent event( TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST, - transport_adapter_, "", 0, RawMessagePtr(), BaseErrorPtr()); + transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr()); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -106,7 +106,7 @@ void TransportAdapterListenerImpl::OnConnectDone( ", application_id: " << &application_id); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE, - transport_adapter_, device, application_id, RawMessagePtr(), + transport_adapter_, device, application_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(new BaseError())); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { @@ -123,7 +123,7 @@ void TransportAdapterListenerImpl::OnConnectFailed( ConnectError* err = new ConnectError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL, - transport_adapter_, device, app_id, RawMessagePtr(), BaseErrorPtr(err)); + transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err)); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -138,7 +138,7 @@ void TransportAdapterListenerImpl::OnDisconnectDone( ", application_id: " << &app_id); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE, - transport_adapter_, device, app_id, RawMessagePtr(), + transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(new BaseError())); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { @@ -155,7 +155,7 @@ void TransportAdapterListenerImpl::OnDisconnectFailed( DisconnectError* err = new DisconnectError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL, - transport_adapter_, device, app_id, RawMessagePtr(), BaseErrorPtr(err)); + transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err)); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -174,7 +174,7 @@ void TransportAdapterListenerImpl::OnDisconnectDeviceFailed( void TransportAdapterListenerImpl::OnDataReceiveDone( const TransportAdapter* adapter, const DeviceUID& device, - const ApplicationHandle& app_id, const RawMessagePtr data_container) { + const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container) { LOG4CXX_TRACE(logger_, "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container); const TransportAdapterEvent event( @@ -196,7 +196,7 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( DataReceiveError* err = new DataReceiveError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL, - transport_adapter_, device, app_id, RawMessagePtr(), BaseErrorPtr(err)); + transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err)); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -206,7 +206,7 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( void TransportAdapterListenerImpl::OnDataSendDone( const TransportAdapter* adapter, const DeviceUID& device, - const ApplicationHandle& app_id, const RawMessagePtr data_container) { + const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container) { LOG4CXX_TRACE(logger_, "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container); const TransportAdapterEvent event( @@ -222,7 +222,7 @@ void TransportAdapterListenerImpl::OnDataSendDone( void TransportAdapterListenerImpl::OnDataSendFailed( const TransportAdapter* adapter, const DeviceUID& device, - const ApplicationHandle& app_id, const RawMessagePtr data_container, + const ApplicationHandle& app_id, const ::protocol_handler::RawMessagePtr data_container, const DataSendError& error) { LOG4CXX_TRACE(logger_, "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container << ", error: " @@ -251,7 +251,7 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect( CommunicationError* err = new CommunicationError(error); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT, - transport_adapter_, device, application, RawMessagePtr(), BaseErrorPtr(err)); + transport_adapter_, device, application, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err)); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); @@ -266,7 +266,7 @@ void TransportAdapterListenerImpl::OnCommunicationError( ", application_id: " << &app_id); const TransportAdapterEvent event( TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR, - transport_adapter_, device, app_id, RawMessagePtr(), + transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(new BaseError())); if (transport_manager::E_SUCCESS != transport_manager_impl_->ReceiveEventFromDevice(event)) { diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index 16810ef47d..0ee1d3304d 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -70,20 +70,16 @@ TransportManagerImpl::Connection TransportManagerImpl::convert( } TransportManagerImpl::TransportManagerImpl() - : message_queue_mutex_(), - all_thread_active_(false), - message_queue_thread_(), - event_queue_thread_(), + : all_thread_active_(false), device_listener_thread_wakeup_(), is_initialized_(false), #ifdef TIME_TESTER metric_observer_(NULL), #endif // TIME_TESTER - connection_id_counter_(0) { + connection_id_counter_(0), + message_queue_("TM MessageQueue", this), + event_queue_("TM EventQueue", this) { LOG4CXX_INFO(logger_, "=============================================="); - pthread_mutex_init(&message_queue_mutex_, NULL); - pthread_cond_init(&message_queue_cond_, NULL); - pthread_mutex_init(&event_queue_mutex_, 0); pthread_cond_init(&device_listener_thread_wakeup_, NULL); LOG4CXX_DEBUG(logger_, "TransportManager object created"); } @@ -103,9 +99,6 @@ TransportManagerImpl::~TransportManagerImpl() { delete it->second; } - pthread_mutex_destroy(&message_queue_mutex_); - pthread_cond_destroy(&message_queue_cond_); - pthread_mutex_destroy(&event_queue_mutex_); pthread_cond_destroy(&device_listener_thread_wakeup_); LOG4CXX_INFO(logger_, "TransportManager object destroyed"); } @@ -173,7 +166,10 @@ int TransportManagerImpl::Disconnect(const ConnectionUID& cid) { return E_INVALID_HANDLE; } - pthread_mutex_lock(&event_queue_mutex_); + connection->transport_adapter->Disconnect(connection->device, + connection->application); + // TODO(dchmerev@luxoft.com): Return disconnect timeout + /* int messages_count = 0; for (EventQueue::const_iterator it = event_queue_.begin(); it != event_queue_.end(); @@ -182,7 +178,6 @@ int TransportManagerImpl::Disconnect(const ConnectionUID& cid) { ++messages_count; } } - pthread_mutex_unlock(&event_queue_mutex_); if (messages_count > 0) { connection->messages_count = messages_count; @@ -197,6 +192,7 @@ int TransportManagerImpl::Disconnect(const ConnectionUID& cid) { connection->transport_adapter->Disconnect(connection->device, connection->application); } + */ LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); return E_SUCCESS; } @@ -209,21 +205,6 @@ int TransportManagerImpl::DisconnectForce(const ConnectionUID& cid) { "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == this->is_initialized_"); return E_TM_IS_NOT_INITIALIZED; } - pthread_mutex_lock(&event_queue_mutex_); - // Clear messages for this connection - // Note that MessageQueue typedef is assumed to be std::list, - // or there is a problem here. One more point versus typedefs-everywhere - MessageQueue::iterator e = message_queue_.begin(); - while (e != message_queue_.end()) { - if (static_cast<ConnectionUID>((*e)->connection_key()) == cid) { - RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, - DataSendTimeoutError(), *e); - e = message_queue_.erase(e); - } else { - ++e; - } - } - pthread_mutex_unlock(&event_queue_mutex_); const ConnectionInternal* connection = GetConnection(cid); if (NULL == connection) { LOG4CXX_ERROR( @@ -254,22 +235,13 @@ int TransportManagerImpl::Stop() { } all_thread_active_ = false; - pthread_mutex_lock(&event_queue_mutex_); pthread_cond_signal(&device_listener_thread_wakeup_); - pthread_mutex_unlock(&event_queue_mutex_); - - pthread_mutex_lock(&message_queue_mutex_); - pthread_cond_signal(&message_queue_cond_); - pthread_mutex_unlock(&message_queue_mutex_); - - pthread_join(message_queue_thread_, 0); - pthread_join(event_queue_thread_, 0); LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); return E_SUCCESS; } -int TransportManagerImpl::SendMessageToDevice(const RawMessagePtr message) { +int TransportManagerImpl::SendMessageToDevice(const ::protocol_handler::RawMessagePtr message) { LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message); LOG4CXX_INFO(logger_, "Send message to device called with arguments " << message.get()); @@ -419,29 +391,6 @@ int TransportManagerImpl::SearchDevices() { int TransportManagerImpl::Init() { LOG4CXX_TRACE(logger_, "enter"); all_thread_active_ = true; - - int error_code = pthread_create(&message_queue_thread_, 0, - &MessageQueueStartThread, this); - if (0 != error_code) { - LOG4CXX_ERROR(logger_, - "Message queue thread is not created exit with error code " - << error_code); - LOG4CXX_TRACE(logger_, "exit with E_TM_IS_NOT_INITIALIZED. Condition: 0 != error_code"); - return E_TM_IS_NOT_INITIALIZED; - } - pthread_setname_np(message_queue_thread_, "TM MessageQueue"); - - error_code = pthread_create(&event_queue_thread_, 0, - &EventListenerStartThread, this); - if (0 != error_code) { - LOG4CXX_ERROR(logger_, - "Event queue thread is not created exit with error code " - << error_code); - LOG4CXX_TRACE(logger_, "exit with E_TM_IS_NOT_INITIALIZED. Condition: 0 != error_code"); - return E_TM_IS_NOT_INITIALIZED; - } - pthread_setname_np(event_queue_thread_, "TM EventListener"); - is_initialized_ = true; LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); return E_SUCCESS; @@ -522,68 +471,19 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { LOG4CXX_TRACE(logger_, "exit"); } -void TransportManagerImpl::PostMessage(const RawMessagePtr message) { +void TransportManagerImpl::PostMessage(const ::protocol_handler::RawMessagePtr message) { LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message); -#ifdef USE_RWLOCK - message_queue_rwlock_.AcquireForWriting(); -#else - pthread_mutex_lock(&message_queue_mutex_); -#endif - message_queue_.push_back(message); - pthread_cond_signal(&message_queue_cond_); -#ifdef USE_RWLOCK - message_queue_rwlock_.Release(); -#else - pthread_mutex_unlock(&message_queue_mutex_); -#endif - LOG4CXX_TRACE(logger_, "exit"); -} - -void TransportManagerImpl::RemoveMessage(const RawMessagePtr message) { - // TODO: Reconsider necessity of this method, remove if it's useless, - // make to work otherwise. - // 2013-08-21 dchmerev@luxoft.com - LOG4CXX_TRACE(logger_, "enter RawMessageSptr: " << message); -#ifdef USE_RWLOCK - message_queue_rwlock_.AcquireForWriting(); -#else - pthread_mutex_lock(&message_queue_mutex_); -#endif - std::remove(message_queue_.begin(), message_queue_.end(), message); -#ifdef USE_RWLOCK - message_queue_rwlock_.Release(); -#else - pthread_mutex_unlock(&message_queue_mutex_); -#endif + message_queue_.PostMessage(message); LOG4CXX_TRACE(logger_, "exit"); } void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) { LOG4CXX_TRACE(logger_, "enter. TransportAdapterEvent: " << &event); -#ifdef USE_RWLOCK - event_queue_rwlock_.AcquireForWriting(); -#else - pthread_mutex_lock(&event_queue_mutex_); -#endif - event_queue_.push_back(event); + event_queue_.PostMessage(event); pthread_cond_signal(&device_listener_thread_wakeup_); -#ifdef USE_RWLOCK - event_queue_rwlock_.Release(); -#else - pthread_mutex_unlock(&event_queue_mutex_); -#endif LOG4CXX_TRACE(logger_, "exit"); } -void* TransportManagerImpl::EventListenerStartThread(void* data) { - LOG4CXX_TRACE(logger_, "enter Data: " << data); - if (NULL != data) { - static_cast<TransportManagerImpl*>(data)->EventListenerThread(); - } - LOG4CXX_TRACE(logger_, "exit with 0"); - return 0; -} - void TransportManagerImpl::AddConnection(const ConnectionInternal& c) { LOG4CXX_TRACE(logger_, "enter ConnectionInternal: " << &c); connections_.push_back(c); @@ -608,13 +508,12 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->id == id) { - LOG4CXX_TRACE(logger_, "exit with ConnectionInternal. It's adress: " << &*it); + LOG4CXX_TRACE(logger_, "exit with ConnectionInternal. It's address: " << &*it); return &*it; } } LOG4CXX_TRACE(logger_, "exit with NULL"); return NULL; - } TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( @@ -624,7 +523,7 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->device == device && it->application == application) { - LOG4CXX_TRACE(logger_, "exit with ConnectionInternal. It's adress: " << &*it); + LOG4CXX_TRACE(logger_, "exit with ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -653,209 +552,174 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { LOG4CXX_TRACE(logger_, "exit"); } -void TransportManagerImpl::EventListenerThread() { +void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_TRACE(logger_, "enter"); -#ifndef USE_RWLOCK - pthread_mutex_lock(&event_queue_mutex_); -#endif - LOG4CXX_INFO(logger_, "Event listener thread started"); - while (true) { - while (event_queue_.size() > 0) { -#ifdef USE_RWLOCK - event_queue_rwlock_.AcquireForReading(); -#endif - LOG4CXX_INFO(logger_, "Event listener queue pushed to process events"); - EventQueue::iterator current_it = event_queue_.begin(); - const TransportAdapterEvent event = *(current_it); - event_queue_.erase(current_it); -#ifdef USE_RWLOCK - event_queue_rwlock_.Release(); -#else - pthread_mutex_unlock(&event_queue_mutex_); -#endif - ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); - - switch (event.event_type) { - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE: { - RaiseEvent(&TransportManagerListener::OnScanDevicesFinished); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_DONE"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL: { - // error happened in real search process (external error) - RaiseEvent(&TransportManagerListener::OnScanDevicesFailed, - *static_cast<SearchDeviceError*>(event.event_error.get())); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_FAIL"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED: { - OnDeviceListUpdated(event.transport_adapter); - LOG4CXX_DEBUG(logger_, "event_type = ON_DEVICE_LIST_UPDATED"); - break; - } - case TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST: { - RaiseEvent(&TransportManagerListener::OnFindNewApplicationsRequest); - LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE: { - const DeviceHandle device_handle = converter_.UidToHandle(event.device_uid); - AddConnection(ConnectionInternal(this, event.transport_adapter, ++connection_id_counter_, - event.device_uid, event.application_id, - device_handle)); - RaiseEvent(&TransportManagerListener::OnConnectionEstablished, - DeviceInfo(device_handle, event.device_uid, + ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); + switch (event.event_type) { + case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE: { + RaiseEvent(&TransportManagerListener::OnScanDevicesFinished); + LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_DONE"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL: { + // error happened in real search process (external error) + RaiseEvent(&TransportManagerListener::OnScanDevicesFailed, + *static_cast<SearchDeviceError*>(event.event_error.get())); + LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_FAIL"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED: { + OnDeviceListUpdated(event.transport_adapter); + LOG4CXX_DEBUG(logger_, "event_type = ON_DEVICE_LIST_UPDATED"); + break; + } + case TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST: { + RaiseEvent(&TransportManagerListener::OnFindNewApplicationsRequest); + LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE: { + const DeviceHandle device_handle = converter_.UidToHandle(event.device_uid); + AddConnection(ConnectionInternal(this, event.transport_adapter, ++connection_id_counter_, + event.device_uid, event.application_id, + device_handle)); + RaiseEvent(&TransportManagerListener::OnConnectionEstablished, + DeviceInfo(device_handle, event.device_uid, event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), - connection_id_counter_); - LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL: { - RaiseEvent(&TransportManagerListener::OnConnectionFailed, - DeviceInfo(converter_.UidToHandle(event.device_uid), event.device_uid, + connection_id_counter_); + LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL: { + RaiseEvent(&TransportManagerListener::OnConnectionFailed, + DeviceInfo(converter_.UidToHandle(event.device_uid), event.device_uid, event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), - ConnectError()); - LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_FAIL"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE: { - if (NULL == connection) { - LOG4CXX_ERROR(logger_, "Connection not found"); - LOG4CXX_DEBUG(logger_, - "event_type = ON_DISCONNECT_DONE && NULL == connection"); - break; - } - RaiseEvent(&TransportManagerListener::OnConnectionClosed, - connection->id); - RemoveConnection(connection->id); - LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL: { - const DeviceHandle device_handle = converter_.UidToHandle(event.device_uid); - RaiseEvent(&TransportManagerListener::OnDisconnectFailed, - device_handle, DisconnectDeviceError()); - LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_FAIL"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE: { + ConnectError()); + LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_FAIL"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE: { + if (NULL == connection) { + LOG4CXX_ERROR(logger_, "Connection not found"); + LOG4CXX_DEBUG(logger_, + "event_type = ON_DISCONNECT_DONE && NULL == connection"); + break; + } + RaiseEvent(&TransportManagerListener::OnConnectionClosed, + connection->id); + RemoveConnection(connection->id); + LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL: { + const DeviceHandle device_handle = converter_.UidToHandle(event.device_uid); + RaiseEvent(&TransportManagerListener::OnDisconnectFailed, + device_handle, DisconnectDeviceError()); + LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_FAIL"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE: { #ifdef TIME_TESTER - if (metric_observer_) { - metric_observer_->StopRawMsg(event.event_data.get()); - } + if (metric_observer_) { + metric_observer_->StopRawMsg(event.event_data.get()); + } #endif // TIME_TESTER - if (connection == NULL) { - LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE. Condition: NULL == connection"); - break; - } - RaiseEvent(&TransportManagerListener::OnTMMessageSend, event.event_data); - this->RemoveMessage(event.event_data); - if (connection->shutDown && --connection->messages_count == 0) { - connection->timer->stop(); - connection->transport_adapter->Disconnect(connection->device, - connection->application); - } - LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL: { + if (connection == NULL) { + LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " + << event.application_id + << ") not found"); + LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE. Condition: NULL == connection"); + break; + } + RaiseEvent(&TransportManagerListener::OnTMMessageSend, event.event_data); + if (connection->shutDown && --connection->messages_count == 0) { + connection->timer->stop(); + connection->transport_adapter->Disconnect(connection->device, + connection->application); + } + LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL: { #ifdef TIME_TESTER - if (metric_observer_) { - metric_observer_->StopRawMsg(event.event_data.get()); - } + if (metric_observer_) { + metric_observer_->StopRawMsg(event.event_data.get()); + } #endif // TIME_TESTER - if (connection == NULL) { - LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_FAIL. Condition: NULL == connection"); - break; - } - - // TODO(YK): start timer here to wait before notify caller - // and remove unsent messages - LOG4CXX_ERROR(logger_, "Transport adapter failed to send data"); - // TODO(YK): potential error case -> thread unsafe - // update of message content - if (event.event_data.valid()) { - event.event_data->set_waiting(true); - } else { - LOG4CXX_DEBUG(logger_, "Data is invalid"); - } - LOG4CXX_DEBUG(logger_, "eevent_type = ON_SEND_FAIL"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE: { - if (connection == NULL) { - LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE. Condition: NULL == connection"); - break; - } - event.event_data->set_connection_key(connection->id); + if (connection == NULL) { + LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " + << event.application_id + << ") not found"); + LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_FAIL. Condition: NULL == connection"); + break; + } + + // TODO(YK): start timer here to wait before notify caller + // and remove unsent messages + LOG4CXX_ERROR(logger_, "Transport adapter failed to send data"); + // TODO(YK): potential error case -> thread unsafe + // update of message content + if (event.event_data.valid()) { + event.event_data->set_waiting(true); + } else { + LOG4CXX_DEBUG(logger_, "Data is invalid"); + } + LOG4CXX_DEBUG(logger_, "eevent_type = ON_SEND_FAIL"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE: { + if (connection == NULL) { + LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " + << event.application_id + << ") not found"); + LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE. Condition: NULL == connection"); + break; + } + event.event_data->set_connection_key(connection->id); #ifdef TIME_TESTER - if (metric_observer_) { - metric_observer_->StopRawMsg(event.event_data.get()); - } + if (metric_observer_) { + metric_observer_->StopRawMsg(event.event_data.get()); + } #endif // TIME_TESTER - RaiseEvent(&TransportManagerListener::OnTMMessageReceived, event.event_data); - LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL: { - LOG4CXX_DEBUG(logger_, "Event ON_RECEIVED_FAIL"); - if (connection == NULL) { - LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - break; - } - - RaiseEvent(&TransportManagerListener::OnTMMessageReceiveFailed, - connection->id, *static_cast<DataReceiveError*>(event.event_error.get())); - LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR: { - LOG4CXX_DEBUG(logger_, "event_type = ON_COMMUNICATION_ERROR"); - break; - } - case TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT: { - if (connection) { - RaiseEvent(&TransportManagerListener::OnUnexpectedDisconnect, - connection->id, - *static_cast<CommunicationError*>(event.event_error.get())); - RemoveConnection(connection->id); - } else { - LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " - << event.application_id - << ") not found"); - } - LOG4CXX_DEBUG(logger_, "eevent_type = ON_UNEXPECTED_DISCONNECT"); - break; - } - } // switch -#ifndef USE_RWLOCK - pthread_mutex_lock(&event_queue_mutex_); -#endif - } // while (event_queue_.size() > 0) - - if (all_thread_active_) { - pthread_cond_wait(&device_listener_thread_wakeup_, &event_queue_mutex_); - } else { - LOG4CXX_DEBUG(logger_, "break. Condition: NOT all_thread_active_"); + RaiseEvent(&TransportManagerListener::OnTMMessageReceived, event.event_data); + LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE"); break; } - } // while (true) - - pthread_mutex_unlock(&event_queue_mutex_); + case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL: { + LOG4CXX_DEBUG(logger_, "Event ON_RECEIVED_FAIL"); + if (connection == NULL) { + LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " + << event.application_id + << ") not found"); + break; + } + RaiseEvent(&TransportManagerListener::OnTMMessageReceiveFailed, + connection->id, *static_cast<DataReceiveError*>(event.event_error.get())); + LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR: { + LOG4CXX_DEBUG(logger_, "event_type = ON_COMMUNICATION_ERROR"); + break; + } + case TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT: { + if (connection) { + RaiseEvent(&TransportManagerListener::OnUnexpectedDisconnect, + connection->id, + *static_cast<CommunicationError*>(event.event_error.get())); + RemoveConnection(connection->id); + } else { + LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " + << event.application_id + << ") not found"); + } + LOG4CXX_DEBUG(logger_, "eevent_type = ON_UNEXPECTED_DISCONNECT"); + break; + } + } // switch LOG4CXX_TRACE(logger_, "exit"); } @@ -865,96 +729,41 @@ void TransportManagerImpl::SetTimeMetricObserver(TMMetricObserver* observer) { } #endif // TIME_TESTER -void* TransportManagerImpl::MessageQueueStartThread(void* data) { - LOG4CXX_TRACE(logger_, "enter. Data:" << data); - if (NULL != data) { - static_cast<TransportManagerImpl*>(data)->MessageQueueThread(); - } - LOG4CXX_TRACE(logger_, "exit with 0"); - return 0; -} - -void TransportManagerImpl::MessageQueueThread() { +void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) { LOG4CXX_TRACE(logger_, "enter"); -#ifndef USE_RWLOCK - pthread_mutex_lock(&message_queue_mutex_); -#endif - - while (all_thread_active_) { - // TODO(YK): add priority processing - - while (message_queue_.size() > 0) { -#ifdef USE_RWLOCK - message_queue_rwlock_.AcquireForReading(); -#endif - MessageQueue::iterator it = message_queue_.begin(); - while (it != message_queue_.end() && it->valid() && (*it)->IsWaiting()) { - ++it; - } - if (it == message_queue_.end()) { -#ifdef USE_RWLOCK - message_queue_rwlock_.Release(); -#endif - LOG4CXX_TRACE(logger_, "break. Condition: it == message_queue_.end()"); - break; - } - RawMessagePtr active_msg = *it; -#ifdef USE_RWLOCK - message_queue_rwlock_.Release(); -#else - pthread_mutex_unlock(&message_queue_mutex_); -#endif - if (active_msg.valid() && !active_msg->IsWaiting()) { - ConnectionInternal* connection = - GetConnection(active_msg->connection_key()); - if (connection == NULL) { - std::stringstream ss; - ss << "Connection " << active_msg->connection_key() << " not found"; - LOG4CXX_ERROR(logger_, ss.str()); - RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, - DataSendError(ss.str()), active_msg); - message_queue_.remove(active_msg); - continue; - } - TransportAdapter* transport_adapter = connection->transport_adapter; - LOG4CXX_DEBUG(logger_, "Got adapter " - << transport_adapter << "[" - << transport_adapter->GetDeviceType() << "]" - << " by session id " - << active_msg->connection_key()); - - if (NULL == transport_adapter) { - std::string error_text = - "Transport adapter is not found - message removed"; - LOG4CXX_ERROR(logger_, error_text); - RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, - DataSendError(error_text), active_msg); - message_queue_.remove(active_msg); - } else { - if (TransportAdapter::OK == - transport_adapter->SendData( - connection->device, connection->application, active_msg)) { - LOG4CXX_INFO(logger_, "Data sent to adapter"); - active_msg->set_waiting(true); - } else { - LOG4CXX_ERROR(logger_, "Data sent error"); - RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, - DataSendError("Send failed - message removed"), - active_msg); - message_queue_.remove(active_msg); - } - } - } -#ifndef USE_RWLOCK - pthread_mutex_lock(&message_queue_mutex_); -#endif + ConnectionInternal* connection = GetConnection(msg->connection_key()); + if (connection == NULL) { + LOG4CXX_WARN(logger_, "Connection " << msg->connection_key() << " not found"); + RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, + DataSendTimeoutError(), msg); + return; + } + + TransportAdapter* transport_adapter = connection->transport_adapter; + LOG4CXX_DEBUG(logger_, "Got adapter " + << transport_adapter << "[" + << transport_adapter->GetDeviceType() << "]" + << " by session id " + << msg->connection_key()); + + if (NULL == transport_adapter) { + std::string error_text = + "Transport adapter is not found"; + LOG4CXX_ERROR(logger_, error_text); + RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, + DataSendError(error_text), msg); + } else { + if (TransportAdapter::OK == + transport_adapter->SendData( + connection->device, connection->application, msg)) { + LOG4CXX_INFO(logger_, "Data sent to adapter"); + } else { + LOG4CXX_ERROR(logger_, "Data sent error"); + RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed, + DataSendError("Send failed"), + msg); } - pthread_cond_wait(&message_queue_cond_, &message_queue_mutex_); - } // while(true) - - message_queue_.clear(); - - pthread_mutex_unlock(&message_queue_mutex_); + } LOG4CXX_TRACE(logger_, "exit"); } diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index 76f2f99e4c..40891d3513 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -123,7 +123,7 @@ void UsbConnection::OnInTransfer(libusb_transfer* transfer) { LOG4CXX_DEBUG(logger_, "USB incoming transfer, size:" << transfer->actual_length << ", data:" << hex_data(transfer->buffer, transfer->actual_length)); - RawMessagePtr data(new protocol_handler::RawMessage( + ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage( 0, 0, in_buffer_, transfer->actual_length)); controller_->DataReceiveDone(device_uid_, app_handle_, data); } else { @@ -208,7 +208,7 @@ void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { LOG4CXX_TRACE(logger_, "exit"); } -TransportAdapter::Error UsbConnection::SendData(RawMessagePtr message) { +TransportAdapter::Error UsbConnection::SendData(::protocol_handler::RawMessagePtr message) { LOG4CXX_TRACE(logger_, "enter with RawMessagePtr: " << message.get()); if (disconnecting_) { LOG4CXX_TRACE(logger_, "exit with TransportAdapter::BAD_STATE. Condition: " @@ -249,7 +249,7 @@ void UsbConnection::Finalise() { waiting_in_transfer_cancel_ = false; } } - for (std::list<RawMessagePtr>::iterator it = out_messages_.begin(); + for (std::list<protocol_handler::RawMessagePtr>::iterator it = out_messages_.begin(); it != out_messages_.end(); it = out_messages_.erase(it)) { controller_->DataSendFailed(device_uid_, app_handle_, *it, DataSendError()); } diff --git a/src/components/transport_manager/src/usb/qnx/usb_connection.cc b/src/components/transport_manager/src/usb/qnx/usb_connection.cc index da5d30136b..db3cac014d 100644 --- a/src/components/transport_manager/src/usb/qnx/usb_connection.cc +++ b/src/components/transport_manager/src/usb/qnx/usb_connection.cc @@ -1,4 +1,4 @@ -/** +/* * \file usb_connection.cc * \brief UsbConnection class source file. * @@ -144,7 +144,7 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) { controller_->DataReceiveFailed(device_uid_, app_handle_, DataReceiveError()); } else { - RawMessagePtr msg(new protocol_handler::RawMessage(0, 0, in_buffer_, len)); + ::protocol_handler::RawMessagePtr msg(new protocol_handler::RawMessage(0, 0, in_buffer_, len)); controller_->DataReceiveDone(device_uid_, app_handle_, msg); } @@ -237,7 +237,7 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) { pthread_mutex_unlock(&out_messages_mutex_); } -TransportAdapter::Error UsbConnection::SendData(RawMessagePtr message) { +TransportAdapter::Error UsbConnection::SendData(::protocol_handler::RawMessagePtr message) { if (disconnecting_) { return TransportAdapter::BAD_STATE; } @@ -261,7 +261,7 @@ void UsbConnection::Finalise() { disconnecting_ = true; usbd_abort_pipe(in_pipe_); usbd_abort_pipe(out_pipe_); - for (std::list<RawMessagePtr>::iterator it = out_messages_.begin(); + for (std::list<protocol_handler::RawMessagePtr>::iterator it = out_messages_.begin(); it != out_messages_.end(); it = out_messages_.erase(it)) { controller_->DataSendFailed(device_uid_, app_handle_, *it, DataSendError()); } diff --git a/src/components/transport_manager/src/usb/usb_connection_factory.cc b/src/components/transport_manager/src/usb/usb_connection_factory.cc index f68edebd06..d57391ebcc 100644 --- a/src/components/transport_manager/src/usb/usb_connection_factory.cc +++ b/src/components/transport_manager/src/usb/usb_connection_factory.cc @@ -74,9 +74,8 @@ TransportAdapter::Error UsbConnectionFactory::CreateConnection( UsbConnection* usb_connection = new UsbConnection(device_uid, app_handle, controller_, usb_handler_, usb_device->usb_device()); - ConnectionSptr connection(usb_connection); - controller_->ConnectionCreated(connection, device_uid, app_handle); + controller_->ConnectionCreated(usb_connection, device_uid, app_handle); if (usb_connection->Init()) { LOG4CXX_INFO(logger_, "USB connection initialised"); diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index 12c70746d7..bbb74dc1e1 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -44,7 +44,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "QNX") ) endif() -add_library("Utils" ${SOURCES}) +add_library("Utils" SHARED ${SOURCES}) if(ENABLE_LOG) list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) @@ -62,3 +62,10 @@ if(BUILD_TESTS) add_subdirectory(test) endif() +install(TARGETS "Utils" + DESTINATION bin + PERMISSIONS + OWNER_READ OWNER_WRITE + GROUP_READ + WORLD_READ +) diff --git a/src/components/utils/include/utils/threads/thread_manager.h b/src/components/utils/include/utils/threads/thread_manager.h index 03330170e1..d72abb428f 100644 --- a/src/components/utils/include/utils/threads/thread_manager.h +++ b/src/components/utils/include/utils/threads/thread_manager.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -34,38 +34,24 @@ #define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_ #include "utils/threads/thread.h" -#include "utils/lock.h" + +#include <pthread.h> #include <map> #include <string> #include <set> +#include <list> #include "utils/macro.h" #include "utils/singleton.h" +#include "utils/lock.h" +#include "utils/conditional_variable.h" +#include "utils/message_queue.h" +#include "utils/threads/thread.h" +#include "utils/threads/thread_delegate.h" namespace threads { -namespace impl { - -/* - * Generates short and unique names for unnamed threads - * and remembers association between thread handle and that short name - */ -class UnnamedThreadRegistry { - public: - UnnamedThreadRegistry(); - ~UnnamedThreadRegistry(); - /* - * Returns a name for given unnamed thread id. - * If id is first seen, new name is generated and memorized - * If id is already known, previously generated name is returned - */ - std::string GetUniqueName(PlatformThreadHandle id); - private: - typedef std::map<PlatformThreadHandle, std::string> IdNameMap; - IdNameMap id_number_; - int32_t last_thread_number_; - sync_primitives::Lock state_lock_; -}; + class Thread; /* * This class is here currently to remember names associated to threads. @@ -77,41 +63,18 @@ class UnnamedThreadRegistry { */ class ThreadManager : public utils::Singleton<ThreadManager> { public: - // Name a thread. Should be called only once for every thread. - // Threads can't be renamed - void RegisterName(PlatformThreadHandle id, const std::string& name); - - // Get a name for previously registered thread - std::string GetName(PlatformThreadHandle id) const; - - // Forget a name of (possibly destroyed) thread - // Make sure to call it after thread is finished - // Because thread id's can be recycled - void Unregister(PlatformThreadHandle id); - private: - ThreadManager(); - ~ThreadManager(); - - private: - typedef std::set<std::string> NamesSet; - typedef std::map<PlatformThreadHandle, std::string> IdNamesMap; - // Set of thread names for fast checking if name is unique - NamesSet names_; - // Map from system handle to the thread name - IdNamesMap id_names_; - mutable sync_primitives::Lock state_lock_; - - // Generator of shorter sequental names for unnamed threads - // Has to memorize every generated name this is why it is mutable - mutable UnnamedThreadRegistry unnamed_thread_namer_; - + struct ThreadDesc { + pthread_t handle; + ThreadDelegate* delegate; + }; + ThreadManager() {} + MessageQueue<ThreadDesc> threads_to_terminate; private: DISALLOW_COPY_AND_ASSIGN(ThreadManager); FRIEND_BASE_SINGLETON_CLASS(ThreadManager); }; -} // namespace impl } // namespace threads #endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_ diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc index 5eb2457a09..64e021a6f1 100644 --- a/src/components/utils/src/file_system.cc +++ b/src/components/utils/src/file_system.cc @@ -48,8 +48,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") uint64_t file_system::GetAvailableDiskSpace(const std::string& path) { - struct statvfs fsInfo; - memset(reinterpret_cast<void*>(&fsInfo), 0, sizeof(fsInfo)); + struct statvfs fsInfo = { 0 }; if (statvfs(path.c_str(), &fsInfo) == 0) { return fsInfo.f_bsize * fsInfo.f_bfree; } else { @@ -59,8 +58,7 @@ uint64_t file_system::GetAvailableDiskSpace(const std::string& path) { int64_t file_system::FileSize(const std::string &path) { if (file_system::FileExists(path)) { - struct stat file_info; - memset(reinterpret_cast<void*>(&file_info), 0, sizeof(file_info)); + struct stat file_info = { 0 }; stat(path.c_str(), &file_info); return file_info.st_size; } @@ -82,7 +80,7 @@ size_t file_system::DirectorySize(const std::string& path) { struct dirent* dir_element = new(direntbuffer) dirent; #endif struct dirent* result = NULL; - struct stat file_info; + struct stat file_info = { 0 }; directory = opendir(path.c_str()); if (NULL != directory) { return_code = readdir_r(directory, dir_element, &result); @@ -96,7 +94,6 @@ size_t file_system::DirectorySize(const std::string& path) { if (file_system::IsDirectory(full_element_path)) { size += DirectorySize(full_element_path); } else { - memset(reinterpret_cast<void*>(&file_info), 0, sizeof(file_info)); stat(full_element_path.c_str(), &file_info); size += file_info.st_size; } @@ -134,8 +131,7 @@ bool file_system::CreateDirectoryRecursively(const std::string& path) { } bool file_system::IsDirectory(const std::string& name) { - struct stat status; - memset(&status, 0, sizeof(status)); + struct stat status = { 0 }; if (-1 == stat(name.c_str(), &status)) { return false; @@ -145,8 +141,7 @@ bool file_system::IsDirectory(const std::string& name) { } bool file_system::DirectoryExists(const std::string& name) { - struct stat status; - memset(&status, 0, sizeof(status)); + struct stat status = { 0 }; if (-1 == stat(name.c_str(), &status) || !S_ISDIR(status.st_mode)) { return false; @@ -156,8 +151,7 @@ bool file_system::DirectoryExists(const std::string& name) { } bool file_system::FileExists(const std::string& name) { - struct stat status; - memset(&status, 0, sizeof(status)); + struct stat status = { 0 }; if (-1 == stat(name.c_str(), &status)) { return false; @@ -213,16 +207,11 @@ void file_system::Close(std::ofstream* file_stream) { } std::string file_system::CurrentWorkingDirectory() { - size_t filename_max_lenght = 1024; - char currentAppPath[filename_max_lenght]; - memset(currentAppPath, 0, filename_max_lenght); - if (0 == getcwd(currentAppPath, filename_max_lenght)) { + const size_t filename_max_length = 1024; + char path[filename_max_length]; + if (0 == getcwd(path, filename_max_length)) { LOG4CXX_WARN(logger_, "Could not get CWD"); } - - char path[filename_max_lenght]; - memset(path, 0, filename_max_lenght); - snprintf(path, filename_max_lenght - 1, "%s", currentAppPath); return std::string(path); } @@ -396,7 +385,7 @@ const std::string file_system::ConvertPathForURL(const std::string& path) { for (; it_sym != it_sym_end; ++it_sym) { if (*it_path == *it_sym) { - size_t size = 100; + const size_t size = 100; char percent_value[size]; snprintf(percent_value, size, "%%%x", *it_path); converted_path += percent_value; diff --git a/src/components/utils/src/lock_posix.cc b/src/components/utils/src/lock_posix.cc index 7591d4b525..f75b7ee9ea 100644 --- a/src/components/utils/src/lock_posix.cc +++ b/src/components/utils/src/lock_posix.cc @@ -132,7 +132,7 @@ bool Lock::Try() { #ifndef NDEBUG void Lock::AssertFreeAndMarkTaken() { if ((lock_taken_ > 0) && !is_mutex_recursive_) { - LOG4CXX_ERROR(logger_, "Locking already taken not recurcive mutex"); + LOG4CXX_ERROR(logger_, "Locking already taken not recursive mutex"); NOTREACHED(); } lock_taken_++; diff --git a/src/components/utils/src/signals_linux.cc b/src/components/utils/src/signals_linux.cc index f592a1e22b..3ded6a5877 100644 --- a/src/components/utils/src/signals_linux.cc +++ b/src/components/utils/src/signals_linux.cc @@ -30,15 +30,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <csignal> +#include <cstdlib> #include <stdint.h> namespace utils { bool SubscribeToTerminateSignal(void (*func)(int32_t p)) { - void (*prev_func)(int32_t p); + struct sigaction act; + act.sa_handler = func; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; - prev_func = signal(SIGINT, func); - return (SIG_ERR != prev_func); + return (sigaction(SIGINT, &act, NULL) == 0) + && (sigaction(SIGTERM, &act, NULL) == 0); } bool ResetSubscribeToTerminateSignal() { diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc index faaadd673c..3f7e006eca 100644 --- a/src/components/utils/src/threads/posix_thread.cc +++ b/src/components/utils/src/threads/posix_thread.cc @@ -36,25 +36,12 @@ #include <stddef.h> #include <signal.h> +#include "utils/atomic.h" #include "utils/threads/thread.h" #include "utils/threads/thread_manager.h" #include "utils/logger.h" #include "pthread.h" -using namespace std; -using namespace threads::impl; - -namespace { - -static void* threadFunc(void* closure) { - threads::ThreadDelegate* delegate = - static_cast<threads::ThreadDelegate*>(closure); - delegate->threadMain(); - return NULL; -} - -static pthread_t main_thread_id; -static bool main_thread_id_set = false; #ifndef __QNXNTO__ const int EOK = 0; @@ -63,71 +50,61 @@ static bool main_thread_id_set = false; #if defined(OS_POSIX) const size_t THREAD_NAME_SIZE = 15; #endif -} namespace threads { CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") -size_t Thread::kMinStackSize = PTHREAD_STACK_MIN; /* Ubuntu : 16384 ; QNX : 256; */ - -bool Thread::Id::operator==(const Thread::Id& other) const { - return pthread_equal(id_, other.id_) != 0; -} +namespace { -// static -Thread::Id Thread::CurrentId() { - return Id(pthread_self()); +static void* threadFunc(void* arg) { + LOG4CXX_INFO(logger_, "Thread #" << pthread_self() << " started successfully"); + threads::Thread* thread = static_cast<threads::Thread*>(arg); + threads::ThreadDelegate* delegate = thread->delegate(); + delegate->threadMain(); + thread->set_running(false); + MessageQueue<ThreadManager::ThreadDesc>& threads = ::threads::ThreadManager::instance()->threads_to_terminate; + if (!threads.IsShuttingDown()) { + LOG4CXX_INFO(logger_, "Pushing thread #" << pthread_self() << " to join queue"); + ThreadManager::ThreadDesc desc = { pthread_self(), delegate }; + threads.push(desc); + } + LOG4CXX_INFO(logger_, "Thread #" << pthread_self() << " exited successfully"); + return NULL; } -//static -std::string Thread::NameFromId(const Id& thread_id) { - return ThreadManager::instance()->GetName(thread_id.id_); } -//static -void Thread::SetNameForId(const Id& thread_id, const std::string& name) { - ThreadManager::instance()->RegisterName(thread_id.id_, name); - - const std::string striped_name = - name.length() > THREAD_NAME_SIZE ? std::string(name.begin(), name.begin() + THREAD_NAME_SIZE) : name; +size_t Thread::kMinStackSize = PTHREAD_STACK_MIN; /* Ubuntu : 16384 ; QNX : 256; */ - const int pthread_result = pthread_setname_np(thread_id.id_, striped_name.c_str()); - if (pthread_result != EOK) { - LOG4CXX_WARN(logger_,"Couldn't set pthread name \"" << striped_name - << "\", error code " << pthread_result << - " (" << strerror(pthread_result) << ")"); +/* +void ThreadBase::set_name(const std::string name) { + std::string trimname = name.erase(15); + if(pthread_setname_np(thread_handle_, trimname.c_str()) != EOK) { + LOG4CXX_WARN(logger_, "Couldn't set pthread name \"" + << trimname + << "\", error code " + << pthread_result + << " (" + << strerror(pthread_result) + << ")"); } } +*/ -//static -void Thread::SetMainThread() { - main_thread_id = pthread_self(); - main_thread_id_set = true; -} - -//static -bool Thread::InterruptMainThread() { - if (!main_thread_id_set) { - LOG4CXX_WARN(logger_, "Cannot interrupt main thread: not specified"); - return false; +void Thread::SetNameForId(const Id& thread_id, const std::string& name) { + std::string nm = name; + std::string& trimname = nm.size() > 15 ? nm.erase(15) : nm; + const int rc = pthread_setname_np(thread_id.id_, trimname.c_str()); + if(rc == EOK) { + LOG4CXX_WARN(logger_, "Couldn't set pthread name \"" + << trimname + << "\", error code " + << rc + << " (" + << strerror(rc) + << ")"); } - pthread_kill(main_thread_id, SIGINT); - return true; -} - -//static -void Thread::MaskSignals() { - sigset_t sigset; - sigfillset(&sigset); - pthread_sigmask(SIG_SETMASK, &sigset, 0); -} - -//static -void Thread::UnmaskSignals() { - sigset_t sigset; - sigemptyset(&sigset); - pthread_sigmask(SIG_SETMASK, &sigset, 0); } Thread::Thread(const char* name, ThreadDelegate* delegate) @@ -135,19 +112,21 @@ Thread::Thread(const char* name, ThreadDelegate* delegate) delegate_(delegate), thread_handle_(0), thread_options_(), - isThreadRunning_(false) { + isThreadRunning_(0) { } -Thread::~Thread() { - ThreadManager::instance()->Unregister(thread_handle_); - delete delegate_; - LOG4CXX_INFO(logger_,"Deleted thread: " << name_); +ThreadDelegate* Thread::delegate() const { + return delegate_; } bool Thread::start() { return startWithOptions(thread_options_); } +Thread::Id Thread::CurrentId() { + return Id(pthread_self()); +} + bool Thread::startWithOptions(const ThreadOptions& options) { LOG4CXX_TRACE_ENTER(logger_); if (!delegate_) { @@ -171,6 +150,7 @@ bool Thread::startWithOptions(const ThreadOptions& options) { if (pthread_result != EOK) { LOG4CXX_WARN(logger_,"Couldn't set detach state attribute.. Error code = " << pthread_result << "(\"" << strerror(pthread_result) << "\")"); + thread_options_.is_joinable(false); } } @@ -184,7 +164,7 @@ bool Thread::startWithOptions(const ThreadOptions& options) { } } - pthread_result = pthread_create(&thread_handle_, &attributes, threadFunc, delegate_); + pthread_result = pthread_create(&thread_handle_, &attributes, threadFunc, this); isThreadRunning_ = (pthread_result == EOK); if (!isThreadRunning_) { LOG4CXX_WARN(logger_, "Couldn't create thread. Error code = " @@ -199,61 +179,51 @@ bool Thread::startWithOptions(const ThreadOptions& options) { void Thread::stop() { LOG4CXX_TRACE_ENTER(logger_); - LOG4CXX_DEBUG(logger_, "Canceling thread (#" << thread_handle_ - << " \"" << name_ << "\") from #" << pthread_self()); - if (!is_running()) { - LOG4CXX_WARN(logger_, "Thread (#" << thread_handle_ - << " \"" << name_ << "\") is not running"); - LOG4CXX_TRACE_EXIT(logger_); + + if (!atomic_post_clr(&isThreadRunning_)) + { return; } - // TODO (EZamakhov): why exitThreadMain return bool and stop does not? if (delegate_ && !delegate_->exitThreadMain()) { - if (pthread_self() == thread_handle_) { - LOG4CXX_ERROR(logger_, - "Couldn't cancel the same thread (#" << thread_handle_ - << "\"" << name_ << "\")"); - } else { - const int pthread_result = pthread_cancel(thread_handle_); - if (pthread_result != EOK) { - LOG4CXX_WARN(logger_, - "Couldn't cancel thread (#" << thread_handle_ << " \"" << name_ << - "\") from thread #" << pthread_self() << ". Error code = " - << pthread_result << " (\"" << strerror(pthread_result) << "\")"); - } + if (thread_handle_ != pthread_self()) { + LOG4CXX_WARN(logger_, "Cancelling thread #" << thread_handle_); + const int pthread_result = pthread_cancel(thread_handle_); + if (pthread_result != EOK) { + LOG4CXX_WARN(logger_, + "Couldn't cancel thread (#" << thread_handle_ << " \"" << name_ << + "\") from thread #" << pthread_self() << ". Error code = " + << pthread_result << " (\"" << strerror(pthread_result) << "\")"); + } + } else { + LOG4CXX_ERROR(logger_, + "Couldn't cancel the same thread (#" << thread_handle_ + << "\"" << name_ << "\")"); } } - // Wait for the thread to exit. It should already have terminated but make - // sure this assumption is valid. - join(); LOG4CXX_TRACE_EXIT(logger_); } -void Thread::join() { - LOG4CXX_TRACE_ENTER(logger_); - LOG4CXX_DEBUG(logger_, "Join thread (#" << thread_handle_ - << " \"" << name_ << "\") from #" << pthread_self()); - if (thread_handle_ == pthread_self()) { - LOG4CXX_ERROR(logger_, - "Couldn't join with the same thread (#" << thread_handle_ - << " \"" << name_ << "\")"); - } else { - const int pthread_result = pthread_join(thread_handle_, NULL); - if (pthread_result != EOK) { - LOG4CXX_WARN(logger_, - "Couldn't join thread (#" << thread_handle_ << " \"" << name_ << - "\") from thread #" << pthread_self() << ". Error code = " - << pthread_result << "(\"" << strerror(pthread_result) << "\")"); - } - } - isThreadRunning_ = false; - LOG4CXX_TRACE_EXIT(logger_); +bool Thread::Id::operator==(const Thread::Id& other) const { + return pthread_equal(id_, other.id_) != 0; } std::ostream& operator<<(std::ostream& os, const Thread::Id& thread_id) { - return os<<Thread::NameFromId(thread_id); + char name[32]; + if(pthread_getname_np(thread_id.Handle(), name, 32) == 0) { + os << name; + } + return os; +} + +Thread* CreateThread(const char* name, ThreadDelegate* delegate) { + return new Thread(name, delegate); } +void DeleteThread(Thread* thread) { + delete thread; +} + + } // namespace threads diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/src/threads/thread_manager.cc index 32a073ad15..528dc8c4de 100644 --- a/src/components/utils/src/threads/thread_manager.cc +++ b/src/components/utils/src/threads/thread_manager.cc @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * @@ -31,9 +31,16 @@ */ #include "utils/threads/thread_manager.h" +#include "utils/threads/thread_delegate.h" +#include "utils/lock.h" +#include "utils/conditional_variable.h" +#include "utils/threads/thread.h" #include "utils/logger.h" +#include <pthread.h> + #include <sstream> +#include <list> #if defined(OS_LINUX) #include <sys/syscall.h> @@ -41,75 +48,7 @@ #endif namespace threads { -namespace impl { -using namespace std; -using namespace sync_primitives; CREATE_LOGGERPTR_GLOBAL(logger_, "Utils") -namespace { - const char* kUnknownName = "UnnamedThread"; -} - -UnnamedThreadRegistry::UnnamedThreadRegistry() { -} - -UnnamedThreadRegistry::~UnnamedThreadRegistry() { -} - -std::string UnnamedThreadRegistry::GetUniqueName(PlatformThreadHandle id) { - AutoLock auto_lock(state_lock_); - IdNameMap::iterator found = id_number_.find(id); - if (found != id_number_.end()) { - return found->second; - } - ++last_thread_number_; - std::stringstream namestream; - namestream << kUnknownName << last_thread_number_; - return id_number_[id] = namestream.str(); -} - -ThreadManager::ThreadManager() { - names_.insert(kUnknownName); -} - -ThreadManager::~ThreadManager() { -} - -void ThreadManager::RegisterName(PlatformThreadHandle id, const string& name) { - AutoLock auto_lock(state_lock_); - if (names_.find(name) != names_.end()) { - LOG4CXX_ERROR(logger_, "Ignoring duplicate thread name: " << name); - return; - } - names_.insert(name); - pair<IdNamesMap::iterator, bool> inserted = - id_names_.insert(make_pair(id, name)); - if (!inserted.second) { - LOG4CXX_ERROR(logger_, "Trying to register thread name " << name - <<", but it is already registered with name " - <<inserted.first->second); - } -} - -string ThreadManager::GetName(PlatformThreadHandle id) const { - AutoLock auto_lock(state_lock_); - IdNamesMap::const_iterator found = id_names_.find(id); - if (found == id_names_.end()) { - LOG4CXX_WARN(logger_, "Thread " << id << " doesn't have associated name"); - return unnamed_thread_namer_.GetUniqueName(id); - } - return found->second; -} - -void ThreadManager::Unregister(PlatformThreadHandle id) { - AutoLock auto_lock(state_lock_); - IdNamesMap::iterator it = id_names_.find(id); - if(it != id_names_.end()) { - names_.erase(it->second); - id_names_.erase(it); - } -} - -} // namespace impl } // namespace threads diff --git a/src/components/utils/test/main.cc b/src/components/utils/test/main.cc index d8242c89a0..59fa20e8b5 100644 --- a/src/components/utils/test/main.cc +++ b/src/components/utils/test/main.cc @@ -1,7 +1,7 @@ -#include "gmock/gmock.h" - -int main(int argc, char** argv) { - testing::InitGoogleMock(&argc, argv); - return RUN_ALL_TESTS(); -} - +#include "gmock/gmock.h"
+
+int main(int argc, char** argv) {
+ testing::InitGoogleMock(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 12581400aa..1a4eff13b5 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -28,4 +28,6 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. +if(ENABLE_LOG) add_subdirectory(appenders) +endif() diff --git a/test/components/include/security_manager/security_manager_mock.h b/test/components/include/security_manager/security_manager_mock.h index 0a8a9161dd..1d41b05e4e 100644 --- a/test/components/include/security_manager/security_manager_mock.h +++ b/test/components/include/security_manager/security_manager_mock.h @@ -66,9 +66,9 @@ class SecurityManagerMock: public ::security_manager::SecurityManager { void(::security_manager::SecurityManagerListener *)); // protocol_handler::ProtocolObserver part MOCK_METHOD1(OnMessageReceived, - void(const RawMessagePtr)); + void(const ::protocol_handler::RawMessagePtr)); MOCK_METHOD1(OnMobileMessageSent, - void(const RawMessagePtr)); + void(const ::protocol_handler::RawMessagePtr)); }; } // namespace security_manager_test } // namespace components diff --git a/test/components/include/transport_manager/transport_manager_mock.h b/test/components/include/transport_manager/transport_manager_mock.h index 8da60a8f00..db333b4da3 100644 --- a/test/components/include/transport_manager/transport_manager_mock.h +++ b/test/components/include/transport_manager/transport_manager_mock.h @@ -65,7 +65,7 @@ class TransportManagerMock: public ::transport_manager::TransportManager { MOCK_METHOD1(DisconnectForce, int(const ConnectionUID &)); MOCK_METHOD1(SendMessageToDevice, - int(const RawMessagePtr)); + int(const ::protocol_handler::RawMessagePtr)); MOCK_METHOD1(ReceiveEventFromDevice, int(const TransportAdapterEvent&)); MOCK_METHOD1(AddTransportAdapter, diff --git a/test/components/mobile_message_handler/include/mobile_message_handler/mobile_message_handler_test.h b/test/components/mobile_message_handler/include/mobile_message_handler/mobile_message_handler_test.h index c13b1add92..296e757267 100644 --- a/test/components/mobile_message_handler/include/mobile_message_handler/mobile_message_handler_test.h +++ b/test/components/mobile_message_handler/include/mobile_message_handler/mobile_message_handler_test.h @@ -1,4 +1,4 @@ -/** +/* * \file mobile_message_handler_test.h * \brief MobileMessageHandler test header file. * @@ -80,7 +80,7 @@ class MobileMessageHandlerTester : * \brief Method for sending message to Mobile Application. * \param message RawMessage with params to be sent to Mobile App. */ - void SendMessageToMobileApp(const RawMessagePtr& message) {} + void SendMessageToMobileApp(const protocol_handler::RawMessagePtr& message) {} void SendFramesNumber(int connection_key, int number_of_frames) {} @@ -103,7 +103,7 @@ class MobileMessageHandlerTester : cond_var.NotifyOne(); } - void sendMessageToMobileApp(const RawMessagePtr message) { + void sendMessageToMobileApp(const protocol_handler::RawMessagePtr message) { // mmh_->OnMessageReceived(message);//todo: YK uncoment sometime } diff --git a/test/components/protocol_handler/include/protocol_handler/protocol_handler_tm_test.h b/test/components/protocol_handler/include/protocol_handler/protocol_handler_tm_test.h index a1ff406077..0139d0e0de 100644 --- a/test/components/protocol_handler/include/protocol_handler/protocol_handler_tm_test.h +++ b/test/components/protocol_handler/include/protocol_handler/protocol_handler_tm_test.h @@ -35,10 +35,8 @@ #include <gmock/gmock.h> #include <string> -#include <vector> #include "utils/shared_ptr.h" -#include "utils/byte_order.h" #include "protocol_handler/protocol_handler_impl.h" #include "protocol/common.h" @@ -61,6 +59,7 @@ namespace protocol_handler_test { using namespace ::protocol_handler; using namespace ::transport_manager; // For TM states +//using namespace ::security_manager; using ::transport_manager::TransportManagerListener; using protocol_handler_test::ControlMessage; using ::testing::Return; @@ -70,10 +69,6 @@ using ::testing::Ge; using ::testing::Le; using ::testing::_; using ::testing::Invoke; -using ::testing::DoAll; -using ::testing::NotNull; -using ::testing::SetArgPointee; -using ::testing::ElementsAreArray; class ProtocolHandlerImplTest : public ::testing::Test { protected: @@ -85,24 +80,15 @@ class ProtocolHandlerImplTest : public ::testing::Test { session_id = 0xFFu; connection_key = 0xFF00AAu; message_id = 0xABCDEFu; - hash_id = 0x1234ABCD; - const uint32_t hash_id_be = LE_TO_BE32(hash_id); - const uint8_t* raw_data = reinterpret_cast<const uint8_t*>(&hash_id_be); - hash_id_data.assign(raw_data, raw_data + sizeof(hash_id)); // expect ConnectionHandler support methods call (conversion, check heartbeat) EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id)). - // return some connection_key + //return some connection_key WillRepeatedly(Return(connection_key)); EXPECT_CALL(session_observer_mock, - PairFromKey(_, NotNull(), NotNull())). - // return some connection_key - WillRepeatedly(DoAll(SetArgPointee<1>(connection_id), - SetArgPointee<2>(session_id))); - EXPECT_CALL(session_observer_mock, IsHeartBeatSupported(connection_id, _)). - // return false to avoid call KeepConnectionAlive + //return false to avoid call KeepConnectionAlive WillRepeatedly(Return(false)); } void TearDown() OVERRIDE { @@ -122,26 +108,26 @@ class ProtocolHandlerImplTest : public ::testing::Test { void AddSession() { AddConnection(); const ServiceType start_service = kRpc; + #ifdef ENABLE_SECURITY + // For enabled protection callback shall use protection ON + const bool callback_protection_flag = PROTECTION_ON; + #else + // For disabled protection callback shall ignore protection income flad and use protection OFF + const bool callback_protection_flag = PROTECTION_OFF; + #endif // ENABLE_SECURITY // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, - PROTECTION_OFF, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); - - // Generate ordered payload - const int32_t hash_id_be = LE_TO_BE32(hash_id); - const uint8_t* data = reinterpret_cast<const uint8_t*>(&hash_id_be); - std::vector<uint8_t> expected_payload; - expected_payload.assign(data, data + sizeof(hash_id_be)); - // expect send Ack with PROTECTION_OFF (on no Security Manager) with hash inpayload + callback_protection_flag)). + //return sessions start success + WillOnce(Return(session_id)); + + // expect send Ack with PROTECTION_OFF (on no Security Manager) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(expected_payload)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); - SendControlMessage(PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); + SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); } #ifdef ENABLE_SECURITY @@ -165,10 +151,9 @@ class ProtocolHandlerImplTest : public ::testing::Test { tm_listener->OnTMMessageReceived(packet.serializePacket()); } void SendControlMessage(bool protection, uint8_t service_type, - uint8_t sessionId, uint32_t frame_data, - uint32_t data_size = 0, const uint8_t *data = 0) { + uint8_t sessionId, uint32_t frame_data) { SendTMMessage(connection_id, PROTOCOL_VERSION_3, protection, FRAME_TYPE_CONTROL, - service_type, frame_data, sessionId, data_size, message_id, data); + service_type, frame_data, sessionId, 0, message_id); } ::utils::SharedPtr<ProtocolHandlerImpl> protocol_handler_impl; @@ -180,9 +165,6 @@ class ProtocolHandlerImplTest : public ::testing::Test { // uniq id as connection_id and session_id in one uint32_t connection_key; uint32_t message_id; - uint32_t hash_id; - std::vector<uint8_t> hash_id_data; - std::vector<uint8_t> empty_payload; // Strict mocks (same as all methods EXPECT_CALL().Times(0)) testing::StrictMock<transport_manager_test::TransportManagerMock> transport_manager_mock; testing::StrictMock<protocol_handler_test::SessionObserverMock> session_observer_mock; @@ -194,13 +176,13 @@ class ProtocolHandlerImplTest : public ::testing::Test { #ifdef ENABLE_SECURITY class OnHandshakeDoneFunctor { - public: +public: OnHandshakeDoneFunctor(const uint32_t connection_key, const bool result) : connection_key(connection_key), result(result) {} void operator()(security_manager::SecurityManagerListener * listener) const { listener->OnHandshakeDone(connection_key, result); } - private: +private: const uint32_t connection_key; const bool result; }; @@ -210,7 +192,7 @@ class OnHandshakeDoneFunctor { * ProtocolHandler shall skip empty message */ TEST_F(ProtocolHandlerImplTest, RecieveEmptyRawMessage) { - tm_listener->OnTMMessageReceived(::protocol_handler::RawMessagePtr()); + tm_listener->OnTMMessageReceived(RawMessagePtr()); } /* * ProtocolHandler shall disconnect on no connection @@ -234,17 +216,14 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverReject) // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, OnSessionStartedCallback( - connection_id, NEW_SESSION_ID, AllOf(Ge(kControl), Le(kBulk)), - PROTECTION_OFF, NotNull())). + connection_id, NEW_SESSION_ID, AllOf(Ge(kControl), Le(kBulk)), PROTECTION_OFF)). Times(call_times). - // return sessions start rejection - WillRepeatedly(DoAll(SetArgPointee<4>(hash_id), - Return(SESSION_START_REJECT))); + //return sessions start rejection + WillRepeatedly(Return(SESSION_START_REJECT)); // expect send NAck EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, PROTECTION_OFF))). Times(call_times). WillRepeatedly(Return(E_SUCCESS)); @@ -270,16 +249,14 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) { // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, OnSessionStartedCallback(connection_id, NEW_SESSION_ID, AllOf(Ge(kControl), Le(kBulk)), - callback_protection_flag, NotNull())). + callback_protection_flag)). Times(call_times). - // return sessions start rejection - WillRepeatedly(DoAll(SetArgPointee<4>(hash_id), - Return(SESSION_START_REJECT))); + //return sessions start rejection + WillRepeatedly(Return(SESSION_START_REJECT)); // expect send NAck with encryption OFF EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, PROTECTION_OFF))). Times(call_times). WillRepeatedly(Return(E_SUCCESS)); @@ -296,17 +273,13 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverAccept) const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_OFF, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF)). + //return sessions start success + WillOnce(Return(session_id)); // expect send Ack EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, - PROTECTION_OFF, connection_id, - ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -320,145 +293,68 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverAccept) { AddSession(); } /* - * ProtocolHandler shall ignore hash id for protocol version less 2 - */ -TEST_F(ProtocolHandlerImplTest, EndSession_ProtocoloVersion1) { - AddSession(); - const int call_count = 7; - - // expect ConnectionHandler check with null hash value - EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, - protocol_handler::HASH_ID_NOT_SUPPORTED, kRpc)). - Times(call_count). - // return sessions start success - WillRepeatedly(Return(SESSION_START_REJECT)); - - // expect send NAck with empty payload - EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). - Times(call_count). - WillRepeatedly(Return(E_SUCCESS)); - - for (int32_t call = 0; call < call_count; ++call) { - const int32_t some_hash_id = call_count * 0xF0F0F0F0; - const uint32_t hash_id_le = BE_TO_LE32(some_hash_id); - // Emulate TM message with PROTOCOL_VERSION_1 and some payload - SendTMMessage(connection_id, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_CONTROL, - kRpc, FRAME_DATA_END_SERVICE, session_id, - sizeof(hash_id_le), 0u, reinterpret_cast<const uint8_t*>(&hash_id_le)); - } -} - -/* - * ProtocolHandler shall correct convert hash_id from packet v.2 - */ -TEST_F(ProtocolHandlerImplTest, EndSession_ProtocolVersion2) { - AddSession(); - const int call_count = 0xFF; - // expect END_SERVICE_ACK (with no payload) - EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). - Times(call_count - 1).WillRepeatedly(Return(E_SUCCESS)); - - for (int32_t call = 1; call < call_count; ++call) { - const int32_t some_hash_id = call * 0x01010101; - // HASH_ID_NOT_SUPPORTED (null) value shall be interpret as wrong - EXPECT_NE(some_hash_id, - static_cast<int>(protocol_handler::HASH_ID_NOT_SUPPORTED)); - const uint32_t hash_id_be = LE_TO_BE32(some_hash_id); - - // expect ConnectionHandler check with the hash value - EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, some_hash_id, kRpc)). - // return sessions start success - WillOnce(Return(connection_key)); - - // Emulate TM message with PROTOCOL_VERSION_1 and some payload - SendTMMessage(connection_id, PROTOCOL_VERSION_2, PROTECTION_OFF, FRAME_TYPE_CONTROL, - kRpc, FRAME_DATA_END_SERVICE, session_id, - sizeof(hash_id_be), 0u, reinterpret_cast<const uint8_t*>(&hash_id_be)); - usleep(500); - } -} - -/* - * ProtocolHandler shall correct convert null hash_id from packet v.2 + * ProtocolHandler shall send NAck on session_observer rejection */ -TEST_F(ProtocolHandlerImplTest, EndSession_ProtocolVersion2_NullHashId) { +TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) { AddSession(); + const ServiceType service = kRpc; - EXPECT_EQ(0, static_cast<int>(protocol_handler::HASH_ID_NOT_SUPPORTED)); - - const int32_t some_hash_id = protocol_handler::HASH_ID_NOT_SUPPORTED; - const uint32_t hash_id_be = BE_TO_LE32(some_hash_id); - - const uint8_t* raw_data = reinterpret_cast<const uint8_t*>(&hash_id_be); - std::vector<uint8_t> null_hash_id_data; - null_hash_id_data.assign(raw_data, raw_data + sizeof(hash_id_be)); - - // expect ConnectionHandler check with null hash value + // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, - protocol_handler::HASH_ID_WRONG, kRpc)). - // return sessions start success + OnSessionEndedCallback(connection_id, session_id, message_id, service)). + //return sessions start success WillOnce(Return(SESSION_START_REJECT)); - // expect send NAck with null payload + // expect send Ack EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); - // Emulate TM message with PROTOCOL_VERSION_1 and some payload - SendTMMessage(connection_id, PROTOCOL_VERSION_2, PROTECTION_OFF, FRAME_TYPE_CONTROL, - kRpc, FRAME_DATA_END_SERVICE, session_id, - null_hash_id_data.size(), 0u, &null_hash_id_data[0]); + SendControlMessage(PROTECTION_OFF, service, session_id, FRAME_DATA_END_SERVICE); } /* - * ProtocolHandler shall send NAck on session_observer rejection + * ProtocolHandler shall send NAck on wrong hash code */ -TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) { +TEST_F(ProtocolHandlerImplTest, EndSession_WrongHash) { AddSession(); + const ServiceType service = kRpc; + // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, hash_id, kRpc)). - // return sessions start success - WillOnce(Return(SESSION_START_REJECT)); + OnSessionEndedCallback(connection_id, session_id, message_id, service)). + //return sessions start success + WillOnce(Return(connection_key ^ 0xFF)); - // expect send NAck + // expect send Ack EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); - const uint32_t hash_id_le = BE_TO_LE32(hash_id); - SendControlMessage(PROTECTION_OFF, kRpc, session_id, FRAME_DATA_END_SERVICE, - sizeof(hash_id_le), reinterpret_cast<const uint8_t*>(&hash_id_le)); + SendControlMessage(PROTECTION_OFF, service, session_id, FRAME_DATA_END_SERVICE); } /* * ProtocolHandler shall send NAck on wrong hash code */ TEST_F(ProtocolHandlerImplTest, EndSession_Success) { AddSession(); + const ServiceType service = kRpc; + + //Send with correct hash code + const uint32_t hash = connection_key; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionEndedCallback(connection_id, session_id, hash_id, kRpc)). - // return sessions start success + OnSessionEndedCallback(connection_id, session_id, hash, service)). + //return sessions start success WillOnce(Return(connection_key)); // expect send Ack EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(empty_payload)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); - const uint32_t hash_id_le = BE_TO_LE32(hash_id); - SendControlMessage(PROTECTION_OFF, kRpc, session_id, FRAME_DATA_END_SERVICE, - sizeof(hash_id_le), reinterpret_cast<const uint8_t*>(&hash_id_le)); + SendTMMessage(connection_id, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_CONTROL, + service, FRAME_DATA_END_SERVICE, session_id, 0, hash); } #ifdef ENABLE_SECURITY @@ -473,16 +369,13 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_OFF, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF)). + //return sessions start success + WillOnce(Return(session_id)); // expect send Ack with PROTECTION_OFF (on no Security Manager) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); SendTMMessage(connection_id, PROTOCOL_VERSION_1, PROTECTION_ON, FRAME_TYPE_CONTROL, @@ -498,16 +391,13 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) { const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_OFF, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF)). + //return sessions start success + WillOnce(Return(session_id)); // expect send Ack with PROTECTION_OFF (on no Security Manager) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -521,22 +411,19 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_ON, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON)). + //return sessions start success + WillOnce(Return(session_id)); // expect start protection for unprotected session EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)). - // return fail protection + //return fail protection WillOnce(ReturnNull()); // expect send Ack with PROTECTION_OFF (on fail SLL creation) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -544,28 +431,26 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { /* * ProtocolHandler shall send Ack with PROTECTION_ON on already established and initialized SLLContext */ -TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_SSLInitialized) { +TEST_F(ProtocolHandlerImplTest,SecurityEnable_StartSessionProtected_SSLInitialized) { AddConnection(); AddSecurityManager(); const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_ON, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON)). + //return sessions start success + WillOnce(Return(session_id)); // call new SSLContext creation EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)). - // return new SSLContext + //return new SSLContext WillOnce(Return(&ssl_context_mock)); // initilization check EXPECT_CALL(ssl_context_mock, IsInitCompleted()). - // emulate SSL is initilized + //emulate SSL is initilized WillOnce(Return(true)); // Expect service protection enable @@ -574,8 +459,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_SSLInitiali // expect send Ack with PROTECTION_ON (on SSL is initilized) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -589,33 +473,31 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeFa const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_ON, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON)). + //return sessions start success + WillOnce(Return(session_id)); // call new SSLContext creation EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)). - // return new SSLContext + //return new SSLContext WillOnce(Return(&ssl_context_mock)); // initilization check EXPECT_CALL(ssl_context_mock, IsInitCompleted()). - // emulate SSL is not initilized + //emulate SSL is not initilized WillOnce(Return(false)); // Pending handshake check EXPECT_CALL(ssl_context_mock, IsHandshakePending()). - // emulate is pending + //emulate is pending WillOnce(Return(true)); // expect add listener for handshake result EXPECT_CALL(security_manager_mock, - AddListener(NotNull())) + AddListener(_)) // emulate handshake fail .WillOnce(Invoke(OnHandshakeDoneFunctor(connection_key, PROTECTION_OFF))); @@ -627,8 +509,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeFa // expect send Ack with PROTECTION_OFF (on fail handshake) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -642,33 +523,31 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSu const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_ON, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON)). + //return sessions start success + WillOnce(Return(session_id)); // call new SSLContext creation EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)). - // return new SSLContext + //return new SSLContext WillOnce(Return(&ssl_context_mock)); // initilization check EXPECT_CALL(ssl_context_mock, IsInitCompleted()). - // emulate SSL is not initilized + //emulate SSL is not initilized WillOnce(Return(false)); // Pending handshake check EXPECT_CALL(ssl_context_mock, IsHandshakePending()). - // emulate is pending + //emulate is pending WillOnce(Return(true)); // expect add listener for handshake result EXPECT_CALL(security_manager_mock, - AddListener(NotNull())) + AddListener(_)) // emulate handshake fail .WillOnce(Invoke(OnHandshakeDoneFunctor(connection_key, PROTECTION_ON))); @@ -684,8 +563,7 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSu // expect send Ack with PROTECTION_OFF (on fail handshake) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -700,33 +578,31 @@ TEST_F(ProtocolHandlerImplTest, const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_ON, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON)). + //return sessions start success + WillOnce(Return(session_id)); // call new SSLContext creation EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)). - // return new SSLContext + //return new SSLContext WillOnce(Return(&ssl_context_mock)); // initilization check EXPECT_CALL(ssl_context_mock, IsInitCompleted()). - // emulate SSL is not initilized + //emulate SSL is not initilized WillOnce(Return(false)); // Pending handshake check EXPECT_CALL(ssl_context_mock, IsHandshakePending()). - // emulate is pending + //emulate is pending WillOnce(Return(true)); // expect add listener for handshake result EXPECT_CALL(security_manager_mock, - AddListener(NotNull())) + AddListener(_)) // emulate handshake fail .WillOnce(Invoke(OnHandshakeDoneFunctor(connection_key, PROTECTION_ON))); @@ -742,8 +618,7 @@ TEST_F(ProtocolHandlerImplTest, // expect send Ack with PROTECTION_OFF (on fail handshake) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); @@ -758,28 +633,26 @@ TEST_F(ProtocolHandlerImplTest, const ServiceType start_service = kRpc; // expect ConnectionHandler check EXPECT_CALL(session_observer_mock, - OnSessionStartedCallback(connection_id, NEW_SESSION_ID, - start_service, PROTECTION_ON, NotNull())). - // return sessions start success - WillOnce(DoAll(SetArgPointee<4>(hash_id), - Return(session_id))); + OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON)). + //return sessions start success + WillOnce(Return(session_id)); // call new SSLContext creation EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)). - // return new SSLContext + //return new SSLContext WillOnce(Return(&ssl_context_mock)); // initilization check EXPECT_CALL(ssl_context_mock, IsInitCompleted()). - // emulate SSL is not initilized + //emulate SSL is not initilized WillOnce(Return(false)); // Pending handshake check EXPECT_CALL(ssl_context_mock, IsHandshakePending()). - // emulate is pending + //emulate is pending WillOnce(Return(false)); // Wait restart handshake operation @@ -788,7 +661,7 @@ TEST_F(ProtocolHandlerImplTest, // expect add listener for handshake result EXPECT_CALL(security_manager_mock, - AddListener(NotNull())) + AddListener(_)) // emulate handshake fail .WillOnce(Invoke(OnHandshakeDoneFunctor(connection_key, PROTECTION_ON))); @@ -804,37 +677,13 @@ TEST_F(ProtocolHandlerImplTest, // expect send Ack with PROTECTION_OFF (on fail handshake) EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON, - connection_id, ElementsAreArray(hash_id_data)))). + SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))). WillOnce(Return(E_SUCCESS)); SendControlMessage(PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); } #endif // ENABLE_SECURITY - -/* - * Flow control - do nothing for unknown connection - */ -TEST_F(ProtocolHandlerImplTest, FlowControl) { - AddConnection(); - const int call_count = 7; - for (int32_t call = 0; call < call_count; ++call) { - const int32_t frame_number = call_count * 0xF0F0F0F0; - const int32_t frame_number_be = LE_TO_BE32(frame_number); - const uint8_t* data = reinterpret_cast<const uint8_t*>(&frame_number_be); - - std::vector<uint8_t> expected_payload; - expected_payload.assign(data, data + sizeof(frame_number_be)); - EXPECT_CALL(transport_manager_mock, - SendMessageToDevice(ControlMessage(FRAME_DATA_SERVICE_DATA_ACK, PROTECTION_OFF, - connection_id, ElementsAreArray(expected_payload)))). - WillOnce(Return(E_SUCCESS)); - - protocol_handler_impl->SendFramesNumber(connection_id, frame_number); - usleep(50000); - } -} -} // namespace protocol_handler_test -} // namespace components } // namespace test -#endif // TEST_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_TM_TEST_H_ +} // namespace components +} // namespace protocol_handler_test +#endif //TEST_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_TM_TEST_H_ diff --git a/test/components/security_manager/include/security_manager/security_manager_test.h b/test/components/security_manager/include/security_manager/security_manager_test.h index ec21aac053..ece82c8d90 100644 --- a/test/components/security_manager/include/security_manager/security_manager_test.h +++ b/test/components/security_manager/include/security_manager/security_manager_test.h @@ -79,8 +79,6 @@ using namespace ::security_manager; const size_t handshake_data_out_size = sizeof(handshake_data_out)/sizeof(handshake_data_out[0]); -// using ::RawMessage; -// using ::RawMessagePtr; using ::security_manager::SecurityQuery; using security_manager_test::InternalErrorWithErrId; using ::testing::Return; @@ -112,8 +110,8 @@ using namespace ::security_manager; */ void call_OnMessageReceived(const uint8_t* const data, uint32_t dataSize, const ServiceType serviceType) { - const RawMessagePtr rawMessagePtr( - new RawMessage(key, protocolVersion, data, dataSize, serviceType)); + const ::protocol_handler::RawMessagePtr rawMessagePtr( + new ::protocol_handler::RawMessage(key, protocolVersion, data, dataSize, serviceType)); security_manager_->OnMessageReceived(rawMessagePtr); } /* @@ -263,8 +261,8 @@ using namespace ::security_manager; * Shall skip all OnMobileMessageSent */ TEST_F(SecurityManagerTest, OnMobileMessageSent) { - const RawMessagePtr rawMessagePtr( - new RawMessage(key, protocolVersion, NULL, 0)); + const ::protocol_handler::RawMessagePtr rawMessagePtr( + new ::protocol_handler::RawMessage(key, protocolVersion, NULL, 0)); security_manager_->OnMobileMessageSent(rawMessagePtr); } /* diff --git a/test/components/transport_manager/src/test_dnssd_service_browser.cc b/test/components/transport_manager/src/test_dnssd_service_browser.cc index ee801cd9c1..46411435bb 100644 --- a/test/components/transport_manager/src/test_dnssd_service_browser.cc +++ b/test/components/transport_manager/src/test_dnssd_service_browser.cc @@ -23,7 +23,7 @@ class MockTransportAdapterController : public TransportAdapterController { MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle)); MOCK_METHOD3(ConnectionCreated, - void(ConnectionSptr connection, const DeviceUID& device_handle, const ApplicationHandle& app_handle)); + void(Connection* connection, const DeviceUID& device_handle, const ApplicationHandle& app_handle)); MOCK_METHOD2(ConnectDone, void(const DeviceUID& device_handle, const ApplicationHandle& app_handle)); MOCK_METHOD3(ConnectFailed, diff --git a/test/tools/policy_table_validator/CMakeLists.txt b/test/tools/policy_table_validator/CMakeLists.txt index 2d9038e74a..2a372d7ffa 100644 --- a/test/tools/policy_table_validator/CMakeLists.txt +++ b/test/tools/policy_table_validator/CMakeLists.txt @@ -8,18 +8,10 @@ include_directories( ) -if (EXTENDED_POLICY_FLAG) -add_definitions(-DEXTENDED_POLICY) -link_directories ( - ${CMAKE_BINARY_DIR}/src/components/policy/src/policy/policy_table/table_struct_ext/ - ${CMAKE_BINARY_DIR}/src/components/rpc_base/ -) -else () link_directories ( ${CMAKE_BINARY_DIR}/src/components/policy/src/policy/policy_table/table_struct/ ${CMAKE_BINARY_DIR}/src/components/rpc_base/ ) -endif () set(LIBRARIES |