diff --git a/.gitignore b/.gitignore index a17037b..b08db88 100644 --- a/.gitignore +++ b/.gitignore @@ -119,5 +119,7 @@ test/site.exp test/test.sh test/config_test test/pack_scan +test/amipack_create_test +test/amipack_parse_test src/amiws diff --git a/config.h b/config.h index f1e65ea..8a77289 100644 --- a/config.h +++ b/config.h @@ -4,9 +4,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 -/* Define to 1 if you have the `amip' library (-lamip). */ -#define HAVE_LIBAMIP 1 - /* Define to 1 if you have the `yaml' library (-lyaml). */ #define HAVE_LIBYAML 1 @@ -34,9 +31,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - /* Name of package */ #define PACKAGE "amiws" @@ -52,6 +46,9 @@ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "amiws" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "1.0.0" diff --git a/configure b/configure index f31ffa2..09f0e28 100755 --- a/configure +++ b/configure @@ -1,20 +1,22 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for amiws 1.0.0. +# Generated by GNU Autoconf 2.69 for amiws 1.0.0. # # Report bugs to . # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# 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. ## -## --------------------- ## +## -------------------- ## +## 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 +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 @@ -22,23 +24,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# 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_nl=' ' export as_nl @@ -46,7 +40,13 @@ export as_nl 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 -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# 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 @@ -57,7 +57,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -80,13 +80,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -96,15 +89,16 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +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 + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -116,12 +110,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# 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='> ' @@ -133,7 +131,294 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: staskobzar@gmail.com about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -147,8 +432,12 @@ 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 -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -168,415 +457,111 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH +# 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 -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi + 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 test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 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 } -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi +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 -if as_func_ret_success; then - : +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +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 - exitcode=1 - echo positional parameters were not saved. + as_ln_s='cp -pR' fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -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 +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - + test -d ./-p && rmdir ./-p + as_mkdir_p=false fi +as_test_x='test -x' +as_executable_p=as_fn_executable_p -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -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 +# 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'" -fi +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. 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 - { (exit 1); exit 1; }; } - - # 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 -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -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 -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -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=: -else - test -d ./-p && rmdir ./-p - 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 - -# 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 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# 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` @@ -591,7 +576,6 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='amiws' @@ -599,6 +583,7 @@ PACKAGE_TARNAME='amiws' PACKAGE_VERSION='1.0.0' PACKAGE_STRING='amiws 1.0.0' PACKAGE_BUGREPORT='staskobzar@gmail.com' +PACKAGE_URL='' ac_unique_file="src/amiws.c" # Factoring default headers for most tests. @@ -641,12 +626,15 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +ac_ct_AR +AR EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE +am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE @@ -661,6 +649,10 @@ LDFLAGS CFLAGS CC RANLIB +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V am__untar am__tar AMTAR @@ -703,6 +695,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -714,6 +707,7 @@ bindir program_transform_name prefix exec_prefix +PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -724,6 +718,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +enable_silent_rules enable_dependency_tracking ' ac_precious_vars='build_alias @@ -773,6 +768,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -797,8 +793,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -843,8 +840,7 @@ do 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -870,8 +866,7 @@ do 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1026,6 +1021,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1075,8 +1079,7 @@ do 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1092,8 +1095,7 @@ do 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1123,17 +1125,17 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) 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. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + 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 ;; @@ -1142,7 +1144,7 @@ Try \`$0 --help' for more information." >&2 $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} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1150,15 +1152,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1167,7 +1167,7 @@ fi 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 + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1181,8 +1181,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + 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' @@ -1196,8 +1195,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 @@ -1212,11 +1209,9 @@ 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_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1255,13 +1250,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + 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_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + 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 @@ -1301,7 +1294,7 @@ Configuration: --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 + -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 @@ -1327,6 +1320,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1361,8 +1355,12 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build Some influential environment variables: CC C compiler command @@ -1370,7 +1368,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -1441,73 +1439,361 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF amiws configure 1.0.0 -generated by GNU Autoconf 2.63 +generated by GNU Autoconf 2.69 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 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 exit fi -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 amiws $as_me 1.0.0, which was -generated by GNU Autoconf 2.63. Invocation command line was - - $ $0 $@ +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## -_ACEOF -exec 5>>config.log +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () { -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` + 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 -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -/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` +} # ac_fn_c_try_compile -_ASUNAME +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -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 + 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 -} >&5 +} # ac_fn_c_try_link -cat >&5 <<_ACEOF +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -## ----------- ## -## Core tests. ## -## ----------- ## +} # 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; } - -# Keep a trace of the command line. +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ----------------------------------- ## +## Report this to staskobzar@gmail.com ## +## ----------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by amiws $as_me 1.0.0, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. @@ -1529,9 +1815,9 @@ do ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + 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 @@ -1547,13 +1833,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args '$ac_arg'" + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ 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 @@ -1565,11 +1851,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -1578,13 +1862,13 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 + *_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= ;; #( - *) $as_unset $ac_var ;; + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -1603,11 +1887,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -1620,11 +1902,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -1638,11 +1918,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -1656,46 +1934,53 @@ _ASBOX exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + 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 - ac_site_file1=$CONFIG_SITE + # 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 @@ -1706,19 +1991,23 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 + 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" + . "$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. - if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 + # 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";; @@ -1726,7 +2015,7 @@ $as_echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1741,11 +2030,11 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { $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:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 + { $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=: ;; ,);; @@ -1755,17 +2044,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 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:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { $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:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 + { $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:$LINENO: former value: \`$ac_old_val'" >&5 + { $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:$LINENO: current value: \`$ac_new_val'" >&5 + { $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 @@ -1777,43 +2066,20 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { $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:$LINENO: error: changes in the environment can compromise the build" >&5 + { $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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + 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' @@ -1822,7 +2088,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.11' +am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -1841,9 +2107,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } + 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, @@ -1869,10 +2133,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # 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:$LINENO: checking for a BSD-compatible install" >&5 +{ $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 test "${ac_cv_path_install+set}" = set; then +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -1880,11 +2144,11 @@ 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/* | \ + # 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\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -1892,7 +2156,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. @@ -1921,7 +2185,7 @@ case $as_dir/ in ;; esac -done + done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir @@ -1937,7 +2201,7 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +{ $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}. @@ -1948,68 +2212,73 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5 -$as_echo "$as_me: error: unsafe absolute working directory name" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5 -$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac -# Do `set' in a subshell so we don't clobber the current shell's +# 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_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$2" = conftest.file ) then # Ok. : else - { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -$as_echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2020,8 +2289,8 @@ test "$program_suffix" != NONE && 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` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -2032,15 +2301,15 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -2049,17 +2318,17 @@ if test x"${install_sh}" != xset; then esac fi -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# 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. +# 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2070,24 +2339,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2097,9 +2366,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2110,24 +2379,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -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:$LINENO: result: $ac_ct_STRIP" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2136,7 +2405,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $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 @@ -2149,10 +2418,10 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2160,9 +2429,9 @@ for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do + for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2172,11 +2441,12 @@ do esac done done -done + done IFS=$as_save_IFS fi + test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else @@ -2184,26 +2454,19 @@ fi # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. - test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2214,24 +2477,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:$LINENO: result: $AWK" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2239,11 +2502,11 @@ fi test -n "$AWK" && break done -{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +{ $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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2251,7 +2514,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# 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;; @@ -2261,11 +2524,11 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2279,15 +2542,52 @@ else fi rmdir .tst 2>/dev/null +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi @@ -2331,25 +2631,78 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' -AMTAR=${AMTAR-"${am_missing_run}tar"} -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -2360,24 +2713,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2387,9 +2740,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -2400,24 +2753,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -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:$LINENO: result: $ac_ct_RANLIB" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2426,7 +2779,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $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 @@ -2450,9 +2803,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2463,24 +2816,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2490,9 +2843,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2503,24 +2856,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -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:$LINENO: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2529,7 +2882,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $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 @@ -2543,9 +2896,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2556,24 +2909,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2583,9 +2936,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2597,18 +2950,18 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -2627,10 +2980,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2642,9 +2995,9 @@ if test -z "$CC"; then 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2655,24 +3008,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2686,9 +3039,9 @@ if test -z "$CC"; then 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2699,24 +3052,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -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:$LINENO: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2729,7 +3082,7 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $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 @@ -2740,57 +3093,37 @@ fi fi -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +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_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +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:$LINENO: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" +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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 +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=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2806,8 +3139,8 @@ 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:$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}: 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: @@ -2823,17 +3156,17 @@ do done rm -f $ac_rmfiles -if { (ac_try="$ac_link_default" +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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +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:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $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, @@ -2850,7 +3183,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2869,84 +3202,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi - -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 +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:$LINENO: error: in \`$ac_pwd':" >&5 +{ { $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:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } +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 -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - fi - fi -fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +{ $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" +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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +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:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $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 @@ -2961,32 +3251,83 @@ for ac_file in conftest.exe conftest conftest.*; do esac done else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $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:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +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 -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2998,17 +3339,17 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" +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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +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:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $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 @@ -3021,31 +3362,23 @@ else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +{ { $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:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +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:$LINENO: result: $ac_cv_objext" >&5 +{ $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:$LINENO: checking whether we are using the GNU C compiler" >&5 +{ $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 test "${ac_cv_c_compiler_gnu+set}" = set; then +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3059,37 +3392,16 @@ main () return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no + 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:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +{ $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 @@ -3098,20 +3410,16 @@ else fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then +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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3122,35 +3430,11 @@ main () return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3161,36 +3445,12 @@ main () return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_compile "$LINENO"; then : - ac_c_werror_flag=$ac_save_c_werror_flag +else + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3201,42 +3461,17 @@ main () return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - 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:$LINENO: result: $ac_cv_prog_cc_g" >&5 +{ $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 @@ -3253,23 +3488,18 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +{ $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 test "${ac_cv_prog_cc_c89+set}" = set; then +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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3321,32 +3551,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -3357,23 +3564,84 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 + { $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:$LINENO: result: $ac_cv_prog_cc_c89" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" @@ -3386,14 +3654,14 @@ am__doit: .PHONY: am__doit END # If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. +# Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include @@ -3414,18 +3682,19 @@ if test "$am__include" = "#"; then fi -{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 +{ $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 +if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' + am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= @@ -3439,17 +3708,18 @@ fi depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then +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'. + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. @@ -3483,16 +3753,16 @@ else : > 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 + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" + # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -3501,16 +3771,16 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested + # 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 ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -3549,7 +3819,7 @@ else fi fi -{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +{ $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 @@ -3564,20 +3834,18 @@ else fi - case $ac_cv_prog_cc_stdc in - no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; - *) { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 + case $ac_cv_prog_cc_stdc in #( + no) : + ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if test "${ac_cv_prog_cc_c99+set}" = set; then +if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3716,35 +3984,12 @@ main () return 0; } _ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" - 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done @@ -3755,36 +4000,31 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c99" != xno; then +if test "x$ac_cv_prog_cc_c99" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else - { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 + { $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 test "${ac_cv_prog_cc_c89+set}" = set; then +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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3836,32 +4076,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -3872,59 +4089,58 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 + { $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:$LINENO: result: $ac_cv_prog_cc_c89" >&5 + { $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 +if test "x$ac_cv_prog_cc_c89" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi - fi - ;; esac - { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO Standard C" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } - if test "${ac_cv_prog_cc_stdc+set}" = set; then + if ${ac_cv_prog_cc_stdc+:} false; then : $as_echo_n "(cached) " >&6 fi - case $ac_cv_prog_cc_stdc in - no) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - '') { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - *) { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 + case $ac_cv_prog_cc_stdc in #( + no) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; #( + '') : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; #( + *) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac - # Checks for libraries. +#AC_CHECK_LIB([amip], [amipack_init], [], +# [ AC_MSG_ERROR([AMI library "amip" not found. +# >> Install it from "https://github.com/staskobzar/libamip" and retry.]) ]) -{ $as_echo "$as_me:$LINENO: checking for amipack_init in -lamip" >&5 -$as_echo_n "checking for amipack_init in -lamip... " >&6; } -if test "${ac_cv_lib_amip_amipack_init+set}" = set; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yaml_parser_initialize in -lyaml" >&5 +$as_echo_n "checking for yaml_parser_initialize in -lyaml... " >&6; } +if ${ac_cv_lib_yaml_yaml_parser_initialize+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lamip $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +LIBS="-lyaml $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3933,182 +4149,73 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char amipack_init (); +char yaml_parser_initialize (); int main () { -return amipack_init (); +return yaml_parser_initialize (); ; return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_amip_amipack_init=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_yaml_yaml_parser_initialize=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_amip_amipack_init=no + ac_cv_lib_yaml_yaml_parser_initialize=no fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +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:$LINENO: result: $ac_cv_lib_amip_amipack_init" >&5 -$as_echo "$ac_cv_lib_amip_amipack_init" >&6; } -if test "x$ac_cv_lib_amip_amipack_init" = x""yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_yaml_yaml_parser_initialize" >&5 +$as_echo "$ac_cv_lib_yaml_yaml_parser_initialize" >&6; } +if test "x$ac_cv_lib_yaml_yaml_parser_initialize" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_LIBAMIP 1 +#define HAVE_LIBYAML 1 _ACEOF - LIBS="-lamip $LIBS" + LIBS="-lyaml $LIBS" else - { { $as_echo "$as_me:$LINENO: error: AMI library \"amip\" not found. - >> Install it from \"https://github.com/staskobzar/libamip\" and retry." >&5 -$as_echo "$as_me: error: AMI library \"amip\" not found. - >> Install it from \"https://github.com/staskobzar/libamip\" and retry." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "YAML library not found. + >> Install libyaml and retry." "$LINENO" 5 fi +# Checks for header files. +#AC_CHECK_HEADER([amip.h], [], +# [ AC_MSG_ERROR([AMI library header "amip.h" not found. +# >> Install it from "https://github.com/staskobzar/libamip" and retry.]) ]) -{ $as_echo "$as_me:$LINENO: checking for yaml_parser_initialize in -lyaml" >&5 -$as_echo_n "checking for yaml_parser_initialize in -lyaml... " >&6; } -if test "${ac_cv_lib_yaml_yaml_parser_initialize+set}" = set; then +# Checks for syslog header files. +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 - ac_check_lib_save_LIBS=$LIBS -LIBS="-lyaml $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* 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 yaml_parser_initialize (); -int -main () -{ -return yaml_parser_initialize (); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_lib_yaml_yaml_parser_initialize=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_yaml_yaml_parser_initialize=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_yaml_yaml_parser_initialize" >&5 -$as_echo "$ac_cv_lib_yaml_yaml_parser_initialize" >&6; } -if test "x$ac_cv_lib_yaml_yaml_parser_initialize" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBYAML 1 -_ACEOF - - LIBS="-lyaml $LIBS" - -else - { { $as_echo "$as_me:$LINENO: error: YAML library not found. - >> Install libyaml and retry." >&5 -$as_echo "$as_me: error: YAML library not found. - >> Install libyaml and retry." >&2;} - { (exit 1); exit 1; }; } -fi - - -# Checks for header files. -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:$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 test "${ac_cv_prog_CPP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -4117,78 +4224,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -4200,7 +4263,7 @@ fi else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +{ $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 @@ -4211,11 +4274,7 @@ do # 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -4224,87 +4283,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $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:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -4314,9 +4326,9 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +{ $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 test "${ac_cv_path_GREP+set}" = set; then +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4327,10 +4339,10 @@ 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_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 @@ -4347,7 +4359,7 @@ case `"$ac_path_GREP" --version 2>&1` in $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 - ac_count=`expr $ac_count + 1` + 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" @@ -4362,26 +4374,24 @@ esac $ac_path_GREP_found && break 3 done done -done + done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + 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:$LINENO: result: $ac_cv_path_GREP" >&5 +{ $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:$LINENO: checking for egrep" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4395,10 +4405,10 @@ 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_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 @@ -4415,7 +4425,7 @@ case `"$ac_path_EGREP" --version 2>&1` in $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 - ac_count=`expr $ac_count + 1` + 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" @@ -4430,12 +4440,10 @@ esac $ac_path_EGREP_found && break 3 done done -done + done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + 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 @@ -4443,21 +4451,17 @@ fi fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +{ $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 test "${ac_cv_header_stdc+set}" = set; then +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4472,48 +4476,23 @@ main () return 0; } _ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no + 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -4523,18 +4502,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -4544,14 +4519,10 @@ 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 + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4578,118 +4549,33 @@ main () return 0; } _ACEOF -rm -f 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -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 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +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:$LINENO: result: $ac_cv_header_stdc" >&5 +{ $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 -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$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` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +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 @@ -4699,427 +4585,189 @@ fi done -if test "${ac_cv_header_amip_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for amip.h" >&5 -$as_echo_n "checking for amip.h... " >&6; } -if test "${ac_cv_header_amip_h+set}" = set; then - $as_echo_n "(cached) " >&6 -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_amip_h" >&5 -$as_echo "$ac_cv_header_amip_h" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking amip.h usability" >&5 -$as_echo_n "checking amip.h usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi +ac_fn_c_check_header_mongrel "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_syslog_h" = xyes; then : -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking amip.h presence" >&5 -$as_echo_n "checking amip.h presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no + as_fn_error $? "syslog library header \"syslog.h\" not found." "$LINENO" 5 fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: amip.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: amip.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: amip.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: amip.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: amip.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: amip.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: amip.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: amip.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: amip.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: amip.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: amip.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: amip.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: amip.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: amip.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: amip.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: amip.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------------- ## -## Report this to staskobzar@gmail.com ## -## ----------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for amip.h" >&5 -$as_echo_n "checking for amip.h... " >&6; } -if test "${ac_cv_header_amip_h+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_header_amip_h=$ac_header_preproc -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_amip_h" >&5 -$as_echo "$ac_cv_header_amip_h" >&6; } -fi -if test "x$ac_cv_header_amip_h" = x""yes; then - : -else - { { $as_echo "$as_me:$LINENO: error: AMI library header \"amip.h\" not found. - >> Install it from \"https://github.com/staskobzar/libamip\" and retry." >&5 -$as_echo "$as_me: error: AMI library header \"amip.h\" not found. - >> Install it from \"https://github.com/staskobzar/libamip\" and retry." >&2;} - { (exit 1); exit 1; }; } -fi +# Checks for typedefs, structures, and compiler characteristics. +# Checks for library functions. -# Checks for syslog header files. -if test "${ac_cv_header_syslog_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for syslog.h" >&5 -$as_echo_n "checking for syslog.h... " >&6; } -if test "${ac_cv_header_syslog_h+set}" = set; then +if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_syslog_h" >&5 -$as_echo "$ac_cv_header_syslog_h" >&6; } else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking syslog.h usability" >&5 -$as_echo_n "checking syslog.h usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ac_header_compiler=no fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking syslog.h presence" >&5 -$as_echo_n "checking syslog.h presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes +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: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: syslog.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: syslog.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: syslog.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: syslog.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: syslog.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: syslog.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: syslog.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: syslog.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: syslog.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: syslog.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ----------------------------------- ## -## Report this to staskobzar@gmail.com ## -## ----------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for syslog.h" >&5 -$as_echo_n "checking for syslog.h... " >&6; } -if test "${ac_cv_header_syslog_h+set}" = set; then + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_header_syslog_h=$ac_header_preproc -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_syslog_h" >&5 -$as_echo "$ac_cv_header_syslog_h" >&6; } + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi -if test "x$ac_cv_header_syslog_h" = x""yes; then - : +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:$LINENO: error: syslog library header \"syslog.h\" not found." >&5 -$as_echo "$as_me: error: syslog library header \"syslog.h\" not found." >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_AR" && break +done -# Checks for typedefs, structures, and compiler characteristics. + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi -# Checks for library functions. +: ${AR=ar} -if test "x$CC" != xcc; then - { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 -$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } -else - { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 -$as_echo_n "checking whether cc understands -c and -o together... " >&6; } -fi -set dummy $CC; ac_cc=`$as_echo "$2" | - sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ + 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 - ; - return 0; -} + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; _ACEOF -# Make sure it works both with $CC and with simple cc. -# We do the test twice because some compilers refuse to overwrite an -# existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - test -f conftest2.$ac_objext && { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; -then - eval ac_cv_prog_cc_${ac_cc}_c_o=yes - if test "x$CC" != xcc; then - # Test first that cc exists at all. - if { ac_try='cc -c conftest.$ac_ext >&5' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' - rm -f conftest2.* - if { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - test -f conftest2.$ac_objext && { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; - then - # cc works too. - : + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi - fi - fi -else - eval ac_cv_prog_cc_${ac_cc}_c_o=no -fi -rm -f core conftest* - -fi -if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define NO_MINUS_C_MINUS_O 1 -_ACEOF + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac ac_config_files="$ac_config_files Makefile doc/Doxyfile doc/Makefile src/Makefile src/lib/Makefile test/Makefile" @@ -5131,9 +4779,9 @@ 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:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -5144,24 +4792,24 @@ for as_dir in $PATH 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 + 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:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:$LINENO: result: $AWK" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -5197,13 +4845,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 + *_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= ;; #( - *) $as_unset $ac_var ;; + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -5211,8 +4859,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; (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 \). + # `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" @@ -5234,12 +4882,23 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 + 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;} - cat confcache >$cache_file + 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:$LINENO: not updating unwritable cache $cache_file" >&5 + { $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 @@ -5253,20 +4912,29 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -5276,27 +4944,22 @@ else fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } + 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_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: ${CONFIG_STATUS=./config.status} +: "${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:$LINENO: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +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. @@ -5306,17 +4969,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +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 +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 @@ -5324,23 +4988,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# 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_nl=' ' export as_nl @@ -5348,7 +5004,13 @@ export as_nl 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 -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# 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 @@ -5359,7 +5021,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -5382,13 +5044,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -5398,15 +5053,16 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +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 + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -5418,12 +5074,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# 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='> ' @@ -5435,7 +5095,89 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -5449,8 +5191,12 @@ 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 -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -5470,76 +5216,25 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. 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 - { (exit 1); exit 1; }; } - - # 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 -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# 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 +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -5554,49 +5249,85 @@ 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 + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p 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'" @@ -5606,13 +5337,19 @@ 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 -# Save the log message, to keep $[0] and so on meaningful, and to +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 amiws $as_me 1.0.0, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5644,13 +5381,15 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$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]... [FILE]... +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 @@ -5669,16 +5408,17 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ amiws config.status 1.0.0 -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2008 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." @@ -5696,11 +5436,16 @@ 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 @@ -5714,27 +5459,29 @@ do 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 - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -5742,11 +5489,10 @@ Try \`$0 --help' for more information." >&2 ac_cs_silent=: ;; # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -5763,7 +5509,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' @@ -5806,9 +5552,7 @@ do "src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -5831,26 +5575,24 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + 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 -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} +} || 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. @@ -5858,7 +5600,13 @@ $debug || if test -n "$CONFIG_FILES"; then -ac_cr=' ' +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' @@ -5866,7 +5614,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -5875,24 +5623,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -5900,7 +5642,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -5914,7 +5656,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -5928,7 +5670,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -5948,7 +5690,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -5980,23 +5722,29 @@ 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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } +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 $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# 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[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + 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 @@ -6008,7 +5756,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -6020,13 +5768,11 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6111,9 +5857,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -6126,9 +5870,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -6147,7 +5889,7 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) 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 `:'. @@ -6156,12 +5898,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + 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 - ac_file_inputs="$ac_file_inputs '$ac_f'" + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -6172,7 +5912,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 + { $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. @@ -6184,10 +5924,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -6215,47 +5953,7 @@ $as_echo X"$ac_file" | q } s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in @@ -6312,7 +6010,6 @@ 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 @@ -6322,12 +6019,11 @@ ac_sed_dataroot=' /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/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:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $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 @@ -6337,7 +6033,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -6365,27 +6061,24 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } +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' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 + { 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;} +which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -6394,27 +6087,21 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -6452,7 +6139,7 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -6460,7 +6147,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files + # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in @@ -6473,7 +6160,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # 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 + # 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. @@ -6507,21 +6194,19 @@ $as_echo X"$mf" | continue fi # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + # 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 + 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 + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || @@ -6547,47 +6232,7 @@ $as_echo X"$file" | q } s/.*/./; q'` - { as_dir=$dirpart/$fdir - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done @@ -6599,15 +6244,12 @@ $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -6628,10 +6270,10 @@ if test "$no_create" != yes; then 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 || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $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/configure.ac b/configure.ac index a25a732..70a038d 100644 --- a/configure.ac +++ b/configure.ac @@ -15,18 +15,18 @@ AC_PROG_CC AC_PROG_CC_STDC # Checks for libraries. -AC_CHECK_LIB([amip], [amipack_init], [], - [ AC_MSG_ERROR([AMI library "amip" not found. - >> Install it from "https://github.com/staskobzar/libamip" and retry.]) ]) +#AC_CHECK_LIB([amip], [amipack_init], [], +# [ AC_MSG_ERROR([AMI library "amip" not found. +# >> Install it from "https://github.com/staskobzar/libamip" and retry.]) ]) AC_CHECK_LIB([yaml], [yaml_parser_initialize], [], [ AC_MSG_ERROR([YAML library not found. >> Install libyaml and retry.]) ]) # Checks for header files. -AC_CHECK_HEADER([amip.h], [], - [ AC_MSG_ERROR([AMI library header "amip.h" not found. - >> Install it from "https://github.com/staskobzar/libamip" and retry.]) ]) +#AC_CHECK_HEADER([amip.h], [], +# [ AC_MSG_ERROR([AMI library header "amip.h" not found. +# >> Install it from "https://github.com/staskobzar/libamip" and retry.]) ]) # Checks for syslog header files. AC_CHECK_HEADER([syslog.h], [], @@ -36,6 +36,7 @@ AC_CHECK_HEADER([syslog.h], [], # Checks for library functions. +AM_PROG_AR AM_PROG_CC_C_O AC_CONFIG_FILES([Makefile doc/Doxyfile diff --git a/src/Makefile.am b/src/Makefile.am index 2db538a..c0453fc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,9 @@ -SUBDIRS=lib +SUBDIRS = lib -AM_CFLAGS= -Ilib +AM_CFLAGS = -Ilib bin_PROGRAMS = amiws amiws_SOURCES = amiws.c -amiws_CFLAGS = -Ilib -amiws_LDADD = -Llib -lamiws -lmongoose -lfrozen +amiws_CFLAGS = -Ilib +amiws_LDADD = -Llib -lamiws -lmongoose -lfrozen -lamipack + diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index f5556b0..31e08c0 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -1,7 +1,16 @@ -noinst_LIBRARIES=libamiws.a libmongoose.a libfrozen.a +noinst_LIBRARIES = libamiws.a libmongoose.a libfrozen.a libamipack.a -libamiws_a_SOURCES=amiws_lib.c amiws.h +libamiws_a_SOURCES = amiws_lib.c amiws.h #libmongoose_a_CPPFLAGS = -DMG_ENABLE_DEBUG -libmongoose_a_SOURCES=mongoose.c mongoose.h -libfrozen_a_SOURCES=frozen.c frozen.h +libmongoose_a_SOURCES= mongoose.c mongoose.h +libfrozen_a_SOURCES = frozen.c frozen.h +libamipack_a_SOURCES = amipack.c amipack_parse_prompt.c amipack_parse.c amipack.h + +amipack_parse_prompt.c: amipack_parse_prompt.re + @echo "== Generating AMI prompt parser with re2c" + re2c --no-generation-date -c -o $@ $^ + +amipack_parse.c: amipack_parse.re + @echo "== Generating AMI parser with re2c" + re2c --no-generation-date -c -o $@ $^ diff --git a/src/lib/amipack.c b/src/lib/amipack.c new file mode 100644 index 0000000..200cf58 --- /dev/null +++ b/src/lib/amipack.c @@ -0,0 +1,205 @@ +/** + * amiws -- Library with functions for read/create AMI packets + * Copyright (C) 2017, Stas Kobzar + * + * This file is part of amiws. + * + * amiws is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * amiws is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with amiws. If not, see . + */ + +/** + * @file amipack.c + * @brief AMI (Asterisk Management Interface) messages read/create functions. + * + * @author Stas Kobzar + */ + +#include +#include +#include + +#include "amipack.h" + +static const char *pack_type_name[] = { + "AMI_UNKNOWN", "AMI_PROMPT", "AMI_ACTION", "AMI_EVENT", "AMI_RESPONSE" +}; + + +AMIPacket *amipack_init() +{ + AMIPacket *pack = (AMIPacket*) malloc(sizeof(AMIPacket)); + pack->size = 0; + pack->length = 0; + pack->type = AMI_UNKNOWN; + pack->head = NULL; + pack->tail = NULL; + + return pack; +} + + +void amiheader_destroy (AMIHeader *hdr) +{ + if (hdr) { + + if (hdr->name) free(hdr->name); + if (hdr->value) free(hdr->value); + free(hdr); + + } + + hdr = NULL; +} + + +AMIHeader *amiheader_create(char *name, + size_t name_size, + char *value, + size_t value_size) +{ + AMIHeader *header = (AMIHeader *) malloc (sizeof (AMIHeader)); + assert ( header != NULL ); + + // add header name + header->name = name; + header->name_size = name_size; + + // add header value + header->value = value; + header->value_size = value_size; + + return header; +} + + +void amipack_destroy (AMIPacket *pack) +{ + AMIHeader *hdr, *hnext; + + for ( hdr = pack->head; hdr != NULL; hdr = hnext) { + + hnext = hdr->next; + amiheader_destroy (hdr); + + } + + if (pack != NULL) { + + free(pack); + pack = NULL; + + } +} + + +size_t amiheader_to_str(AMIHeader *hdr, char *buf) +{ + size_t len = 0; + + for (int i = 0; i < hdr->name_size; i++, len++) { + buf[len] = hdr->name[i]; + } + buf[len++] = ':'; + buf[len++] = ' '; + + for (int i = 0; i < hdr->value_size; i++, len++) { + buf[len] = hdr->value[i]; + } + buf[len++] = '\r'; + buf[len++] = '\n'; + + return len; +} + + +size_t amipack_to_str(AMIPacket *pack, char **pstr) +{ + size_t len = 0, size = 0; + char *buf; + if (pack->size == 0) { + return 0; + } + + buf = (char*) malloc(amipack_length(pack)); + + for (AMIHeader *hdr = pack->head; hdr; hdr = hdr->next) { + len = amiheader_to_str (hdr, buf); + buf += len; + size += len; + } + + *buf++ = '\r'; size++; + *buf++ = '\n'; size++; + // rewind pstr + buf = buf - size; + *pstr = buf; + + return size; +} + + +int amipack_append( AMIPacket *pack, + char *hdr_name, + size_t name_size, + char *hdr_value, + size_t value_size) +{ + AMIHeader *header = amiheader_create(hdr_name, name_size, hdr_value, value_size); + + return amipack_list_append (pack, header); +} + + +int amipack_list_append(AMIPacket *pack, + AMIHeader *header) +{ + pack->length += header->name_size + header->value_size + 4; // ": " = 2 char and CRLF = 2 char + + // first header becomes head and tail + if (pack->size == 0) { + pack->head = header; + } else { + pack->tail->next = header; + } + + pack->tail = header; + header->next = NULL; // append function allways add header to tail of packet. + + pack->size++; + + return pack->size; +} + + +size_t amiheader_find(AMIPacket *pack, + const char *name, + char **val) +{ + size_t size = strlen(name); + if (size == 0) return -1; + + for (AMIHeader *hdr = pack->head; hdr; hdr = hdr->next) { + + if (size == hdr->name_size && + strncasecmp(name, hdr->name, hdr->name_size) == 0) { + + *val = hdr->value; + return hdr->value_size; + } + + } + return -1; +} + + diff --git a/src/lib/amipack.h b/src/lib/amipack.h new file mode 100644 index 0000000..885effc --- /dev/null +++ b/src/lib/amipack.h @@ -0,0 +1,193 @@ +/** + * amiws -- Library with functions for read/create AMI packets + * Copyright (C) 2017, Stas Kobzar + * + * This file is part of amiws. + * + * amiws is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * amiws is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with amiws. If not, see . + */ + +/** + * @file amiws.h + * @brief AMI (Asterisk Management Interface) messages + * read/create functions interface. + * AMI packet is implemented as linked list of headers. + * + * @author Stas Kobzar + */ + +#ifndef __AMIP_H +#define __AMIP_H + +#include +#include + +/*! + * Return length of the packet as string representation. + * All headers length + CRLF stanza (2 bytes) + */ +#define amipack_length(pack) (pack)->length + 2 + +/*! Set AMI packet type. */ +#define amipack_type(pack, ptype) (pack)->type = ptype + +/*! Number of headers in packet. */ +#define amipack_size(pack) (pack)->size + +/*! Append Action header. */ +#define amipack_append_action(pack, val, len) amipack_append((pack), strdup("Action"), 6, val, len) + +/*! AMI packet types. */ +enum pack_type { + AMI_UNKNOWN, AMI_PROMPT, AMI_ACTION, AMI_EVENT, AMI_RESPONSE +}; + +/*! + * AMI semantic version structure. Used when AMI prompt line parsed. + */ +typedef struct AMIVer_ { + unsigned short major; /*!< major */ + unsigned short minor; /*!< minor */ + unsigned short patch; /*!< patch */ +} AMIVer; + +/*! + * AMI header structure. + */ +typedef struct AMIHeader_ { + + char *name; /*!< AMI header name as string. */ + size_t name_size; /*!< Name field size */ + char *value; /*!< AMI header value as string. */ + size_t value_size; /*!< Value field size */ + + struct AMIHeader_ *next; /*!< Next AMI header pointer. Linked list element. */ + +} AMIHeader; + +/*! + * AMI packet structure. + */ +typedef struct AMIPacket_ { + + int size; /*!< Number of headers. */ + + size_t length; /*!< Total length of all headers as string. */ + + enum pack_type type; /*!< AMI packet type: Action, Event etc. */ + + AMIHeader *head; /*!< Linked list head pointer to AMI header. */ + AMIHeader *tail; /*!< Linked list tail pointer to AMI header. */ + +} AMIPacket; + +/** + * Initiate AMIPacket and allocate memory. + * AMI packet is implemented as linked list data structure. + * @return AMIPacket pointer to the new structure. + */ +AMIPacket *amipack_init(); + +/** + * Destroy AMI packet and free memory. + * @param pack AMI header to destroy + */ +void amipack_destroy(AMIPacket *pack); + +/** + * Create new AMI header with given parameters. + * Will allocated memory for AMIHeader and return pointer to it. + * @param name AMI header name + * @param name_size Name field size + * @param value AMI header value + * @param value_size Value field size + * @return AMIHeader pointer to the new structure. + */ +AMIHeader *amiheader_create(char *name, size_t name_size, char *value, size_t value_size); + +/** + * Destroy AMI header and free memory. + * @param hdr AMI header to destroy + */ +void amiheader_destroy(AMIHeader *hdr); + +/** + * Convert AMIPacket to string. Will allocate + * memory for the string, set packet as string + * and return pointer to the char array. + * @param pack AMI packet structure pointer + * @param pstr AMI packet as string + * @return pointer to AMI packet as string + */ +size_t amipack_to_str(AMIPacket *pack, char **pstr); + +/** + * Convert AMIHeader pstr string. + * @param hdr AMI header structure pointer + * @param buf Header as string "Name: value\r\n" + * @return header characters length + */ +size_t amiheader_to_str(AMIHeader *hdr, char *buf); + +/** + * Append header to AMI packet. + * Will create new AMI header using given type and value string. + * New header will be appanded to the head of linked list. + * @param pack Pointer to AMI packet structure + * @param hdr_name AMI header name as string. + * @param name_size Header name size + * @param hdr_value AMI header value as string. + * @param value_size AMI header value size + * @return -1 if error or number of headers in packet + */ +int amipack_append(AMIPacket *pack, char *hdr_name, size_t name_size, char *hdr_value, size_t value_size); + +/** + * Append AMI header to packet. + * @param pack AMI packet structure pointer + * @param header AMI header structure pointer + * @return -1 if error or number of headers in packet + */ +int amipack_list_append (AMIPacket *pack, AMIHeader *header); + +/** + * Search header by header name. Will return header value + * length in packet exists otherwise -1. Will return only first found + * header value. + * @param pack AMI packet structure pointer + * @param header Header name + * @param value String where the found value will be stored. + * @return -1 or length of the header value + */ +size_t amiheader_find(AMIPacket *pack, const char *name, char **value); + +/** + * Parse AMI protocol prompt string when user logged in. + * Will set AMIver structure with parsed server AMI version. + * Prompt header example: Asterisk Call Manager/1.1 + * @param packet Packet received from server as bytes array. + * @param version AMIVer struct will be set when packet parsed + * @return 1 on success or 0 on fail + */ +int amiparse_prompt (const char *packet, AMIVer *version); + + +/** + * Parse AMI packet to AMIPacket structure. + * @param pack_str Bytes array received from server. + * @return AMIPacket pointer or NULL if AMI packet failed to parse. + */ +AMIPacket *amiparse_pack (const char *pack_str); + +#endif diff --git a/src/lib/amipack_parse.c b/src/lib/amipack_parse.c new file mode 100644 index 0000000..4976af8 --- /dev/null +++ b/src/lib/amipack_parse.c @@ -0,0 +1,1076 @@ +/* Generated by re2c 0.16 */ +#line 1 "amipack_parse.re" +/** + * amiws -- Library with functions for read/create AMI packets + * Copyright (C) 2016, Stas Kobzar + * + * This file is part of amiws. + * + * amiws is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * amiws is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with amiws. If not, see . + */ + +/** + * @file amipack_parse.c + * @brief AMI (Asterisk Management Interface) packet parser. + * + * @author Stas Kobzar + */ + +#include +#include +#include "amipack.h" + +/** + * Commands to run when known header parsed. + * @param flag Header type + */ +#define SET_HEADER(name) len = cur - tok; \ + hdr_name = strdup(name); \ + goto yyc_key; + +/** + * Commands to run on Command AMI response header. + * @param offset Header name offset + * @param flag Header type + */ +#define CMD_HEADER(offset, name) len = cur - tok - offset; tok += offset; \ + while(*tok == ' ') { tok++; len--; } \ + len -= 2; \ + char *val = strndup(tok, len); \ + amipack_append (pack, strdup(name), strlen(name), val, len); \ + tok = cur; goto yyc_command; + +// introducing types:re2c for AMI packet +/*! re2c parcing conditions. */ +enum yycond_pack { + yyckey, + yycvalue, + yyccommand, +}; + +AMIPacket *amiparse_pack (const char *pack_str) +{ + AMIPacket *pack = amipack_init (); + const char *marker = pack_str; + const char *cur = marker; + const char *ctxmarker; + int c = yyckey; + int len = 0; + + const char *tok = marker; + char *hdr_name; + + +#line 76 "amipack_parse.c" +{ + unsigned char yych; + unsigned int yyaccept = 0; + switch (c) { + case yyckey: goto yyc_key; + case yycvalue: goto yyc_value; + case yyccommand: goto yyc_command; + } +/* *********************************** */ +yyc_command: + yych = *cur; + switch (yych) { + case '\n': goto yy5; + case '-': goto yy7; + case 'A': + case 'a': goto yy8; + case 'M': + case 'm': goto yy9; + case 'O': + case 'o': goto yy10; + case 'P': + case 'p': goto yy11; + default: goto yy3; + } +yy3: + yyaccept = 0; + yych = *(marker = ++cur); + goto yy13; +yy4: +#line 96 "amipack_parse.re" + { + if (hdr_name) free (hdr_name); + amipack_destroy (pack); + return NULL; + } +#line 112 "amipack_parse.c" +yy5: + ++cur; +yy6: +#line 152 "amipack_parse.re" + { goto yyc_command; } +#line 118 "amipack_parse.c" +yy7: + yyaccept = 0; + yych = *(marker = ++cur); + switch (yych) { + case '-': goto yy14; + default: goto yy13; + } +yy8: + yyaccept = 0; + yych = *(marker = ++cur); + switch (yych) { + case 'C': + case 'c': goto yy15; + default: goto yy13; + } +yy9: + yyaccept = 0; + yych = *(marker = ++cur); + switch (yych) { + case 'E': + case 'e': goto yy16; + default: goto yy13; + } +yy10: + yyaccept = 0; + yych = *(marker = ++cur); + switch (yych) { + case 'U': + case 'u': goto yy17; + default: goto yy13; + } +yy11: + yyaccept = 0; + yych = *(marker = ++cur); + switch (yych) { + case 'R': + case 'r': goto yy18; + default: goto yy13; + } +yy12: + ++cur; + yych = *cur; +yy13: + switch (yych) { + case '\n': goto yy5; + default: goto yy12; + } +yy14: + yych = *++cur; + switch (yych) { + case 'E': goto yy19; + default: goto yy13; + } +yy15: + yych = *++cur; + switch (yych) { + case 'T': + case 't': goto yy20; + default: goto yy13; + } +yy16: + yych = *++cur; + switch (yych) { + case 'S': + case 's': goto yy21; + default: goto yy13; + } +yy17: + yych = *++cur; + switch (yych) { + case 'T': + case 't': goto yy22; + default: goto yy13; + } +yy18: + yych = *++cur; + switch (yych) { + case 'I': + case 'i': goto yy23; + default: goto yy13; + } +yy19: + yych = *++cur; + switch (yych) { + case 'N': goto yy24; + default: goto yy13; + } +yy20: + yych = *++cur; + switch (yych) { + case 'I': + case 'i': goto yy25; + default: goto yy13; + } +yy21: + yych = *++cur; + switch (yych) { + case 'S': + case 's': goto yy26; + default: goto yy13; + } +yy22: + yych = *++cur; + switch (yych) { + case 'P': + case 'p': goto yy27; + default: goto yy13; + } +yy23: + yych = *++cur; + switch (yych) { + case 'V': + case 'v': goto yy28; + default: goto yy13; + } +yy24: + yych = *++cur; + switch (yych) { + case 'D': goto yy29; + default: goto yy13; + } +yy25: + yych = *++cur; + switch (yych) { + case 'O': + case 'o': goto yy30; + default: goto yy13; + } +yy26: + yych = *++cur; + switch (yych) { + case 'A': + case 'a': goto yy31; + default: goto yy13; + } +yy27: + yych = *++cur; + switch (yych) { + case 'U': + case 'u': goto yy32; + default: goto yy13; + } +yy28: + yych = *++cur; + switch (yych) { + case 'I': + case 'i': goto yy33; + default: goto yy13; + } +yy29: + yych = *++cur; + switch (yych) { + case ' ': goto yy34; + default: goto yy13; + } +yy30: + yych = *++cur; + switch (yych) { + case 'N': + case 'n': goto yy35; + default: goto yy13; + } +yy31: + yych = *++cur; + switch (yych) { + case 'G': + case 'g': goto yy36; + default: goto yy13; + } +yy32: + yych = *++cur; + switch (yych) { + case 'T': + case 't': goto yy37; + default: goto yy13; + } +yy33: + yych = *++cur; + switch (yych) { + case 'L': + case 'l': goto yy38; + default: goto yy13; + } +yy34: + yych = *++cur; + switch (yych) { + case 'C': goto yy39; + default: goto yy13; + } +yy35: + yych = *++cur; + switch (yych) { + case 'I': + case 'i': goto yy40; + default: goto yy13; + } +yy36: + yych = *++cur; + switch (yych) { + case 'E': + case 'e': goto yy41; + default: goto yy13; + } +yy37: + yych = *++cur; + switch (yych) { + case ':': goto yy42; + default: goto yy13; + } +yy38: + yych = *++cur; + switch (yych) { + case 'E': + case 'e': goto yy44; + default: goto yy13; + } +yy39: + yych = *++cur; + switch (yych) { + case 'O': goto yy45; + default: goto yy13; + } +yy40: + yych = *++cur; + switch (yych) { + case 'D': + case 'd': goto yy46; + default: goto yy13; + } +yy41: + yych = *++cur; + switch (yych) { + case ':': goto yy47; + default: goto yy13; + } +yy42: + yyaccept = 1; + yych = *(marker = ++cur); + switch (yych) { + case ' ': goto yy49; + default: goto yy13; + } +yy43: +#line 151 "amipack_parse.re" + { tok = cur; goto yyc_command; } +#line 364 "amipack_parse.c" +yy44: + yych = *++cur; + switch (yych) { + case 'G': + case 'g': goto yy50; + default: goto yy13; + } +yy45: + yych = *++cur; + switch (yych) { + case 'M': goto yy51; + default: goto yy13; + } +yy46: + yych = *++cur; + switch (yych) { + case ':': goto yy52; + default: goto yy13; + } +yy47: + ++cur; + yych = *cur; + switch (yych) { + case '\n': goto yy5; + case '\r': goto yy54; + default: goto yy47; + } +yy49: + yyaccept = 1; + yych = *(marker = ++cur); + goto yy13; +yy50: + yych = *++cur; + switch (yych) { + case 'E': + case 'e': goto yy56; + default: goto yy13; + } +yy51: + yych = *++cur; + switch (yych) { + case 'M': goto yy57; + default: goto yy13; + } +yy52: + ++cur; + yych = *cur; + switch (yych) { + case '\n': goto yy5; + case '\r': goto yy58; + default: goto yy52; + } +yy54: + ++cur; + yych = *cur; + switch (yych) { + case '\n': goto yy60; + case '\r': goto yy54; + default: goto yy47; + } +yy56: + yych = *++cur; + switch (yych) { + case ':': goto yy62; + default: goto yy13; + } +yy57: + yych = *++cur; + switch (yych) { + case 'A': goto yy64; + default: goto yy13; + } +yy58: + ++cur; + yych = *cur; + switch (yych) { + case '\n': goto yy65; + case '\r': goto yy58; + default: goto yy52; + } +yy60: + ++cur; +#line 150 "amipack_parse.re" + { CMD_HEADER(8, "Message"); } +#line 449 "amipack_parse.c" +yy62: + ++cur; + yych = *cur; + switch (yych) { + case '\n': goto yy5; + case '\r': goto yy67; + default: goto yy62; + } +yy64: + yych = *++cur; + switch (yych) { + case 'N': goto yy69; + default: goto yy13; + } +yy65: + ++cur; +#line 149 "amipack_parse.re" + { CMD_HEADER(9, "ActionID"); } +#line 468 "amipack_parse.c" +yy67: + ++cur; + yych = *cur; + switch (yych) { + case '\n': goto yy70; + case '\r': goto yy67; + default: goto yy62; + } +yy69: + yych = *++cur; + switch (yych) { + case 'D': goto yy72; + default: goto yy13; + } +yy70: + ++cur; +#line 148 "amipack_parse.re" + { CMD_HEADER(10, "Privilege"); } +#line 487 "amipack_parse.c" +yy72: + yych = *++cur; + switch (yych) { + case '-': goto yy73; + default: goto yy13; + } +yy73: + yych = *++cur; + switch (yych) { + case '-': goto yy74; + default: goto yy13; + } +yy74: + yych = *++cur; + switch (yych) { + case '\r': goto yy75; + default: goto yy13; + } +yy75: + yych = *++cur; + switch (yych) { + case '\n': goto yy76; + default: goto yy12; + } +yy76: + yyaccept = 2; + yych = *(marker = ++cur); + switch (yych) { + case '\r': goto yy77; + default: goto yy6; + } +yy77: + yych = *++cur; + switch (yych) { + case '\n': goto yy79; + default: goto yy78; + } +yy78: + cur = marker; + switch (yyaccept) { + case 0: goto yy4; + case 1: goto yy43; + default: goto yy6; + } +yy79: + ++cur; +#line 153 "amipack_parse.re" + { + len = cur - tok - 19; // output minus command end tag + char *val = strndup(tok, len); + amipack_append (pack, strdup("Output"), 6, val, len); + goto done; + } +#line 541 "amipack_parse.c" +/* *********************************** */ +yyc_key: + yych = *cur; + switch (yych) { + case '\r': goto yy86; + case ' ': goto yy87; + case ':': goto yy89; + case 'A': + case 'a': goto yy92; + case 'E': + case 'e': goto yy93; + case 'R': + case 'r': goto yy94; + default: goto yy83; + } +yy83: + ++cur; + yych = *cur; +yy84: + switch (yych) { + case ' ': + case ':': goto yy85; + default: goto yy83; + } +yy85: +#line 134 "amipack_parse.re" + { + len = cur - tok; + hdr_name = strndup(tok, len); + goto yyc_key; + } +#line 573 "amipack_parse.c" +yy86: + yych = *++cur; + switch (yych) { + case '\n': goto yy95; + default: goto yy84; + } +yy87: + ++cur; +#line 96 "amipack_parse.re" + { + if (hdr_name) free (hdr_name); + amipack_destroy (pack); + return NULL; + } +#line 588 "amipack_parse.c" +yy89: + yyaccept = 0; + marker = ++cur; + yych = *cur; + switch (yych) { + case '\r': goto yy96; + case ' ': goto yy89; + default: goto yy91; + } +yy91: +#line 103 "amipack_parse.re" + { tok = cur; goto yyc_value; } +#line 601 "amipack_parse.c" +yy92: + yych = *++cur; + switch (yych) { + case 'C': + case 'c': goto yy98; + default: goto yy84; + } +yy93: + yych = *++cur; + switch (yych) { + case 'V': + case 'v': goto yy99; + default: goto yy84; + } +yy94: + yych = *++cur; + switch (yych) { + case 'E': + case 'e': goto yy100; + default: goto yy84; + } +yy95: + yych = *++cur; + switch (yych) { + case '\r': goto yy101; + default: goto yy84; + } +yy96: + yych = *++cur; + switch (yych) { + case '\n': goto yy102; + default: goto yy97; + } +yy97: + cur = marker; + if (yyaccept == 0) { + goto yy91; + } else { + goto yy125; + } +yy98: + yych = *++cur; + switch (yych) { + case 'T': + case 't': goto yy103; + default: goto yy84; + } +yy99: + yych = *++cur; + switch (yych) { + case 'E': + case 'e': goto yy104; + default: goto yy84; + } +yy100: + yych = *++cur; + switch (yych) { + case 'S': + case 's': goto yy105; + default: goto yy84; + } +yy101: + yych = *++cur; + switch (yych) { + case '\n': goto yy106; + default: goto yy84; + } +yy102: + yych = *++cur; + ctxmarker = cur; + switch (yych) { + case '\r': goto yy108; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy109; + default: goto yy97; + } +yy103: + yych = *++cur; + switch (yych) { + case 'I': + case 'i': goto yy111; + default: goto yy84; + } +yy104: + yych = *++cur; + switch (yych) { + case 'N': + case 'n': goto yy112; + default: goto yy84; + } +yy105: + yych = *++cur; + switch (yych) { + case 'P': + case 'p': goto yy113; + default: goto yy84; + } +yy106: + ++cur; + switch ((yych = *cur)) { + case ' ': + case ':': goto yy107; + default: goto yy83; + } +yy107: +#line 101 "amipack_parse.re" + { goto done; } +#line 759 "amipack_parse.c" +yy108: + yych = *++cur; + switch (yych) { + case '\n': goto yy114; + default: goto yy97; + } +yy109: + ++cur; + cur = ctxmarker; +#line 104 "amipack_parse.re" + { + tok = cur; + amipack_append(pack, hdr_name, strlen(hdr_name), strdup(""), 0); + goto yyc_key; + } +#line 775 "amipack_parse.c" +yy111: + yych = *++cur; + switch (yych) { + case 'O': + case 'o': goto yy116; + default: goto yy84; + } +yy112: + yych = *++cur; + switch (yych) { + case 'T': + case 't': goto yy117; + default: goto yy84; + } +yy113: + yych = *++cur; + switch (yych) { + case 'O': + case 'o': goto yy119; + default: goto yy84; + } +yy114: + ++cur; +#line 109 "amipack_parse.re" + { + tok = cur; + amipack_append(pack, hdr_name, strlen(hdr_name), strdup(""), 0); + goto done; + } +#line 805 "amipack_parse.c" +yy116: + yych = *++cur; + switch (yych) { + case 'N': + case 'n': goto yy120; + default: goto yy84; + } +yy117: + ++cur; + switch ((yych = *cur)) { + case ' ': + case ':': goto yy118; + default: goto yy83; + } +yy118: +#line 129 "amipack_parse.re" + { + amipack_type (pack, AMI_EVENT); + SET_HEADER("Event"); + } +#line 826 "amipack_parse.c" +yy119: + yych = *++cur; + switch (yych) { + case 'N': + case 'n': goto yy122; + default: goto yy84; + } +yy120: + ++cur; + switch ((yych = *cur)) { + case ' ': + case ':': goto yy121; + default: goto yy83; + } +yy121: +#line 125 "amipack_parse.re" + { + amipack_type (pack, AMI_ACTION); + SET_HEADER("Action"); + } +#line 847 "amipack_parse.c" +yy122: + yych = *++cur; + switch (yych) { + case 'S': + case 's': goto yy123; + default: goto yy84; + } +yy123: + yych = *++cur; + switch (yych) { + case 'E': + case 'e': goto yy124; + default: goto yy84; + } +yy124: + yyaccept = 1; + yych = *(marker = ++cur); + switch (yych) { + case ' ': goto yy125; + case ':': goto yy126; + default: goto yy83; + } +yy125: +#line 121 "amipack_parse.re" + { + amipack_type (pack, AMI_RESPONSE); + SET_HEADER("Response"); + } +#line 876 "amipack_parse.c" +yy126: + ++cur; + yych = *cur; + switch (yych) { + case ' ': goto yy126; + case 'F': + case 'f': goto yy128; + default: goto yy97; + } +yy128: + yych = *++cur; + switch (yych) { + case 'O': + case 'o': goto yy129; + default: goto yy97; + } +yy129: + yych = *++cur; + switch (yych) { + case 'L': + case 'l': goto yy130; + default: goto yy97; + } +yy130: + yych = *++cur; + switch (yych) { + case 'L': + case 'l': goto yy131; + default: goto yy97; + } +yy131: + yych = *++cur; + switch (yych) { + case 'O': + case 'o': goto yy132; + default: goto yy97; + } +yy132: + yych = *++cur; + switch (yych) { + case 'W': + case 'w': goto yy133; + default: goto yy97; + } +yy133: + yych = *++cur; + switch (yych) { + case 'S': + case 's': goto yy134; + default: goto yy97; + } +yy134: + yych = *++cur; + switch (yych) { + case '\r': goto yy135; + default: goto yy97; + } +yy135: + yych = *++cur; + switch (yych) { + case '\n': goto yy136; + default: goto yy97; + } +yy136: + ++cur; +#line 114 "amipack_parse.re" + { + len = cur - tok; + tok = cur; + amipack_type (pack, AMI_RESPONSE); + amipack_append(pack, strdup("Response"), 8, strdup("Follows"), 7); + goto yyc_command; + } +#line 950 "amipack_parse.c" +/* *********************************** */ +yyc_value: + yych = *cur; + switch (yych) { + case '\n': goto yy143; + case '\r': goto yy145; + default: goto yy141; + } +yy140: +#line 141 "amipack_parse.re" + { + len = cur - tok; + char *val = strndup(tok, len); + amipack_append(pack, hdr_name, strlen(hdr_name), val, len); + goto yyc_value; + } +#line 967 "amipack_parse.c" +yy141: + ++cur; + yych = *cur; + switch (yych) { + case '\n': + case '\r': goto yy140; + default: goto yy141; + } +yy143: + ++cur; +yy144: +#line 96 "amipack_parse.re" + { + if (hdr_name) free (hdr_name); + amipack_destroy (pack); + return NULL; + } +#line 985 "amipack_parse.c" +yy145: + yych = *(marker = ++cur); + switch (yych) { + case '\n': goto yy146; + default: goto yy144; + } +yy146: + yych = *++cur; + ctxmarker = cur; + switch (yych) { + case '\r': goto yy148; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': goto yy149; + default: goto yy147; + } +yy147: + cur = marker; + goto yy144; +yy148: + yych = *++cur; + switch (yych) { + case '\n': goto yy151; + default: goto yy147; + } +yy149: + ++cur; + cur = ctxmarker; +#line 140 "amipack_parse.re" + { tok = cur; goto yyc_key; } +#line 1065 "amipack_parse.c" +yy151: + ++cur; +#line 101 "amipack_parse.re" + { goto done; } +#line 1070 "amipack_parse.c" +} +#line 159 "amipack_parse.re" + + +done: + return pack; +} diff --git a/src/lib/amipack_parse.re b/src/lib/amipack_parse.re new file mode 100644 index 0000000..2fdb0c3 --- /dev/null +++ b/src/lib/amipack_parse.re @@ -0,0 +1,163 @@ +/** + * amiws -- Library with functions for read/create AMI packets + * Copyright (C) 2016, Stas Kobzar + * + * This file is part of amiws. + * + * amiws is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * amiws is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with amiws. If not, see . + */ + +/** + * @file amipack_parse.c + * @brief AMI (Asterisk Management Interface) packet parser. + * + * @author Stas Kobzar + */ + +#include +#include +#include "amipack.h" + +/** + * Commands to run when known header parsed. + * @param flag Header type + */ +#define SET_HEADER(name) len = cur - tok; \ + hdr_name = strdup(name); \ + goto yyc_key; + +/** + * Commands to run on Command AMI response header. + * @param offset Header name offset + * @param flag Header type + */ +#define CMD_HEADER(offset, name) len = cur - tok - offset; tok += offset; \ + while(*tok == ' ') { tok++; len--; } \ + len -= 2; \ + char *val = strndup(tok, len); \ + amipack_append (pack, strdup(name), strlen(name), val, len); \ + tok = cur; goto yyc_command; + +// introducing types:re2c for AMI packet +/*! re2c parcing conditions. */ +enum yycond_pack { + yyckey, + yycvalue, + yyccommand, +}; + +AMIPacket *amiparse_pack (const char *pack_str) +{ + AMIPacket *pack = amipack_init (); + const char *marker = pack_str; + const char *cur = marker; + const char *ctxmarker; + int c = yyckey; + int len = 0; + + const char *tok = marker; + char *hdr_name; + +/*!re2c + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = "cur"; + re2c:define:YYMARKER = "marker"; + re2c:define:YYCTXMARKER = "ctxmarker"; + re2c:define:YYCONDTYPE = "yycond_pack"; + re2c:define:YYGETCONDITION = "c"; + re2c:define:YYGETCONDITION:naked = 1; + re2c:define:YYSETCONDITION = "c = @@;"; + re2c:define:YYSETCONDITION:naked = 1; + re2c:yyfill:enable = 0; + + CRLF = "\r\n"; + END_COMMAND = "--END COMMAND--"; + + ACTION = 'Action'; + EVENT = 'Event'; + RESPONSE = 'Response'; + + PRIVILEGE = 'Privilege'; + ACTIONID = 'ActionID'; + MESSAGE = 'Message'; + OUTPUT = 'Output'; + + <*> * { + if (hdr_name) free (hdr_name); + amipack_destroy (pack); + return NULL; + } + CRLF CRLF { goto done; } + + ":" " "* { tok = cur; goto yyc_value; } + ":" " "* CRLF / [a-zA-Z] { + tok = cur; + amipack_append(pack, hdr_name, strlen(hdr_name), strdup(""), 0); + goto yyc_key; + } + ":" " "* CRLF CRLF { + tok = cur; + amipack_append(pack, hdr_name, strlen(hdr_name), strdup(""), 0); + goto done; + } + RESPONSE ":" " "* 'Follows' CRLF { + len = cur - tok; + tok = cur; + amipack_type (pack, AMI_RESPONSE); + amipack_append(pack, strdup("Response"), 8, strdup("Follows"), 7); + goto yyc_command; + } + RESPONSE { + amipack_type (pack, AMI_RESPONSE); + SET_HEADER("Response"); + } + ACTION { + amipack_type (pack, AMI_ACTION); + SET_HEADER("Action"); + } + EVENT { + amipack_type (pack, AMI_EVENT); + SET_HEADER("Event"); + } + + [^: ]+ { + len = cur - tok; + hdr_name = strndup(tok, len); + goto yyc_key; + } + + CRLF / [a-zA-Z] { tok = cur; goto yyc_key; } + [^\r\n]* { + len = cur - tok; + char *val = strndup(tok, len); + amipack_append(pack, hdr_name, strlen(hdr_name), val, len); + goto yyc_value; + } + + PRIVILEGE ":" .* CRLF { CMD_HEADER(10, "Privilege"); } + ACTIONID ":" .* CRLF { CMD_HEADER(9, "ActionID"); } + MESSAGE ":" .* CRLF { CMD_HEADER(8, "Message"); } + OUTPUT ":" " "? { tok = cur; goto yyc_command; } + .* "\r"? "\n" { goto yyc_command; } + END_COMMAND CRLF CRLF { + len = cur - tok - 19; // output minus command end tag + char *val = strndup(tok, len); + amipack_append (pack, strdup("Output"), 6, val, len); + goto done; + } +*/ + +done: + return pack; +} diff --git a/src/lib/amipack_parse_prompt.c b/src/lib/amipack_parse_prompt.c new file mode 100644 index 0000000..fda15af --- /dev/null +++ b/src/lib/amipack_parse_prompt.c @@ -0,0 +1,330 @@ +/* Generated by re2c 0.16 */ +#line 1 "amipack_parse_prompt.re" +/** + * amiws -- Library with functions for read/create AMI packets + * Copyright (C) 2016, Stas Kobzar + * + * This file is part of amiws. + * + * amiws is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * amiws is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with amiws. If not, see . + */ + +/** + * @file parse_prompt.c + * @brief AMI (Asterisk Management Interface) prompt packet parser. + * + * @author Stas Kobzar + */ + +#include "amipack.h" + +// introducing types:re2c for prompt packet +/*! re2c condition markers */ +enum yycond_prompt { + yycinit, + yycminor, + yycpatch, + yycmajor, +}; + +int amiparse_prompt (const char *packet, AMIVer *ver) +{ + // init version structure + ver->major = 0; + ver->minor = 0; + ver->patch = 0; + + const char *cur = packet; + int c = yycinit; + + +#line 53 "amipack_parse_prompt.c" +{ + unsigned char yych; + switch (c) { + case yycinit: goto yyc_init; + case yycminor: goto yyc_minor; + case yycpatch: goto yyc_patch; + case yycmajor: goto yyc_major; + } +/* *********************************** */ +yyc_init: + yych = *cur; + switch (yych) { + case 'A': goto yy5; + default: goto yy3; + } +yy3: + ++cur; +yy4: +#line 63 "amipack_parse_prompt.re" + { return 0; } +#line 74 "amipack_parse_prompt.c" +yy5: + yych = *(packet = ++cur); + switch (yych) { + case 's': goto yy6; + default: goto yy4; + } +yy6: + yych = *++cur; + switch (yych) { + case 't': goto yy8; + default: goto yy7; + } +yy7: + cur = packet; + goto yy4; +yy8: + yych = *++cur; + switch (yych) { + case 'e': goto yy9; + default: goto yy7; + } +yy9: + yych = *++cur; + switch (yych) { + case 'r': goto yy10; + default: goto yy7; + } +yy10: + yych = *++cur; + switch (yych) { + case 'i': goto yy11; + default: goto yy7; + } +yy11: + yych = *++cur; + switch (yych) { + case 's': goto yy12; + default: goto yy7; + } +yy12: + yych = *++cur; + switch (yych) { + case 'k': goto yy13; + default: goto yy7; + } +yy13: + yych = *++cur; + switch (yych) { + case ' ': goto yy14; + default: goto yy7; + } +yy14: + yych = *++cur; + switch (yych) { + case 'C': goto yy15; + default: goto yy7; + } +yy15: + yych = *++cur; + switch (yych) { + case 'a': goto yy16; + default: goto yy7; + } +yy16: + yych = *++cur; + switch (yych) { + case 'l': goto yy17; + default: goto yy7; + } +yy17: + yych = *++cur; + switch (yych) { + case 'l': goto yy18; + default: goto yy7; + } +yy18: + yych = *++cur; + switch (yych) { + case ' ': goto yy19; + default: goto yy7; + } +yy19: + yych = *++cur; + switch (yych) { + case 'M': goto yy20; + default: goto yy7; + } +yy20: + yych = *++cur; + switch (yych) { + case 'a': goto yy21; + default: goto yy7; + } +yy21: + yych = *++cur; + switch (yych) { + case 'n': goto yy22; + default: goto yy7; + } +yy22: + yych = *++cur; + switch (yych) { + case 'a': goto yy23; + default: goto yy7; + } +yy23: + yych = *++cur; + switch (yych) { + case 'g': goto yy24; + default: goto yy7; + } +yy24: + yych = *++cur; + switch (yych) { + case 'e': goto yy25; + default: goto yy7; + } +yy25: + yych = *++cur; + switch (yych) { + case 'r': goto yy26; + default: goto yy7; + } +yy26: + yych = *++cur; + switch (yych) { + case '/': goto yy27; + default: goto yy7; + } +yy27: + ++cur; + c = yycmajor; + goto yyc_major; +/* *********************************** */ +yyc_major: + yych = *cur; + switch (yych) { + case '.': goto yy33; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy35; + default: goto yy31; + } +yy31: + ++cur; +#line 63 "amipack_parse_prompt.re" + { return 0; } +#line 229 "amipack_parse_prompt.c" +yy33: + ++cur; +#line 69 "amipack_parse_prompt.re" + { goto yyc_minor; } +#line 234 "amipack_parse_prompt.c" +yy35: + ++cur; +#line 68 "amipack_parse_prompt.re" + { ver->major = ver->major * 10 + (yych - '0'); goto yyc_major; } +#line 239 "amipack_parse_prompt.c" +/* *********************************** */ +yyc_minor: + yych = *cur; + switch (yych) { + case '\r': goto yy41; + case '.': goto yy42; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy44; + default: goto yy39; + } +yy39: + ++cur; +yy40: +#line 63 "amipack_parse_prompt.re" + { return 0; } +#line 263 "amipack_parse_prompt.c" +yy41: + yych = *++cur; + switch (yych) { + case '\n': goto yy46; + default: goto yy40; + } +yy42: + ++cur; +#line 72 "amipack_parse_prompt.re" + { goto yyc_patch; } +#line 274 "amipack_parse_prompt.c" +yy44: + ++cur; +#line 71 "amipack_parse_prompt.re" + { ver->minor = ver->minor * 10 + (yych - '0'); goto yyc_minor; } +#line 279 "amipack_parse_prompt.c" +yy46: + ++cur; +#line 66 "amipack_parse_prompt.re" + { goto done; } +#line 284 "amipack_parse_prompt.c" +/* *********************************** */ +yyc_patch: + yych = *cur; + switch (yych) { + case '\r': goto yy52; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy53; + default: goto yy50; + } +yy50: + ++cur; +yy51: +#line 63 "amipack_parse_prompt.re" + { return 0; } +#line 307 "amipack_parse_prompt.c" +yy52: + yych = *++cur; + switch (yych) { + case '\n': goto yy55; + default: goto yy51; + } +yy53: + ++cur; +#line 74 "amipack_parse_prompt.re" + { ver->patch = ver->patch * 10 + (yych - '0'); goto yyc_patch; } +#line 318 "amipack_parse_prompt.c" +yy55: + ++cur; +#line 66 "amipack_parse_prompt.re" + { goto done; } +#line 323 "amipack_parse_prompt.c" +} +#line 75 "amipack_parse_prompt.re" + + +done: + return 1; +} + diff --git a/src/lib/amipack_parse_prompt.re b/src/lib/amipack_parse_prompt.re new file mode 100644 index 0000000..c58a578 --- /dev/null +++ b/src/lib/amipack_parse_prompt.re @@ -0,0 +1,80 @@ +/** + * amiws -- Library with functions for read/create AMI packets + * Copyright (C) 2016, Stas Kobzar + * + * This file is part of amiws. + * + * amiws is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * amiws is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with amiws. If not, see . + */ + +/** + * @file parse_prompt.c + * @brief AMI (Asterisk Management Interface) prompt packet parser. + * + * @author Stas Kobzar + */ + +#include "amipack.h" + +// introducing types:re2c for prompt packet +/*! re2c condition markers */ +enum yycond_prompt { + yycinit, + yycminor, + yycpatch, + yycmajor, +}; + +int amiparse_prompt (const char *packet, AMIVer *ver) +{ + // init version structure + ver->major = 0; + ver->minor = 0; + ver->patch = 0; + + const char *cur = packet; + int c = yycinit; + +/*!re2c + re2c:define:YYCTYPE = "unsigned char"; + re2c:define:YYCURSOR = "cur"; + re2c:define:YYMARKER = "packet"; + re2c:define:YYCONDTYPE = "yycond_prompt"; + re2c:define:YYGETCONDITION = "c"; + re2c:define:YYGETCONDITION:naked = 1; + re2c:define:YYSETCONDITION = "c = @@;"; + re2c:define:YYSETCONDITION:naked = 1; + re2c:yyfill:enable = 0; + + CRLF = "\r\n"; + DIGIT = [0-9]; + + <*> * { return 0; } + "Asterisk Call Manager/" :=> major + + CRLF { goto done; } + + DIGIT { ver->major = ver->major * 10 + (yych - '0'); goto yyc_major; } + "." { goto yyc_minor; } + + DIGIT { ver->minor = ver->minor * 10 + (yych - '0'); goto yyc_minor; } + "." { goto yyc_patch; } + + DIGIT { ver->patch = ver->patch * 10 + (yych - '0'); goto yyc_patch; } +*/ + +done: + return 1; +} + diff --git a/src/lib/amiws.h b/src/lib/amiws.h index fd73564..ea42a39 100644 --- a/src/lib/amiws.h +++ b/src/lib/amiws.h @@ -32,8 +32,8 @@ #include #include #include -#include +#include "amipack.h" #include "config.h" #include "frozen.h" #include "mongoose.h" diff --git a/src/lib/amiws_lib.c b/src/lib/amiws_lib.c index 88a70fe..5b862a9 100644 --- a/src/lib/amiws_lib.c +++ b/src/lib/amiws_lib.c @@ -94,7 +94,7 @@ void ami_ev_handler(struct mg_connection *nc, case MG_EV_RECV: - if ( amiparse_prompt(io->buf, &conn->ami_ver) == RV_SUCCESS ) { + if ( amiparse_prompt(io->buf, &conn->ami_ver) == 1 ) { syslog (LOG_INFO, "AMI version: %d.%d.%d", conn->ami_ver.major, conn->ami_ver.minor, conn->ami_ver.patch); @@ -148,7 +148,7 @@ char *amipack_to_json(const char *ami_pack_str, struct amiws_conn *conn) ami_pack->type, conn->id, conn->name); for (AMIHeader *hdr = ami_pack->head; hdr; hdr = hdr->next) { - len += json_printf(&out, "%Q: %Q", hdr->name->buf, hdr->value->buf); + len += json_printf(&out, "%Q: %Q", hdr->name, hdr->value); if (hdr != ami_pack->tail) { len += json_printf(&out, ","); } @@ -209,19 +209,19 @@ void websock_ev_handler (struct mg_connection *nc, int ev, void *ev_data) void ami_login(struct mg_connection *nc, struct amiws_conn *conn) { - struct str *pack_str; + char *pack_str; + size_t len; AMIPacket *pack = (AMIPacket *) amipack_init (); amipack_type(pack, AMI_ACTION); - amipack_append (pack, Action, "Login"); - amipack_append (pack, Username, conn->username); - amipack_append (pack, Secret, conn->secret); + amipack_append_action (pack, strdup("Login"), 5); + amipack_append (pack, strdup("Username"), 8, conn->username, strlen(conn->username)); + amipack_append (pack, strdup("Secret"), 6, conn->secret, strlen(conn->secret)); - pack_str = amipack_to_str (pack); + len = amipack_to_str(pack, &pack_str); syslog (LOG_INFO, "AMI login with user: %s to server: %s", conn->username, conn->name); - mg_send(nc, pack_str->buf, pack_str->len); + mg_send(nc, pack_str, len); - str_destroy (pack_str); amipack_destroy (pack); } @@ -340,7 +340,8 @@ int scan_amipack( const char *p, static void send_ami_action(struct websocket_message *wm, struct mg_connection *nc) { - struct str *p_str; + char *p_str; + size_t len; struct mg_connection *c; char buf[BUFSIZE] = ""; AMIPacket *pack = (AMIPacket *) amipack_init (); @@ -351,16 +352,16 @@ static void send_ami_action(struct websocket_message *wm, return; } - p_str = amipack_to_str(pack); - syslog (LOG_DEBUG, "Converted to AMI packet from JSON:\n %.*s", (int)p_str->len, p_str->buf); + len = amipack_to_str(pack, &p_str); + syslog (LOG_DEBUG, "Converted to AMI packet from JSON:\n %.*s", (int)len, p_str); // send to all AMI connection for (c = mg_next(nc->mgr, NULL); c != NULL; c = mg_next(nc->mgr, c)) { if(c->flags & MG_F_IS_WEBSOCKET) continue; - mg_send(c, p_str->buf, p_str->len); + mg_send(c, p_str, len); } - str_destroy(p_str); + free(p_str); amipack_destroy(pack); } @@ -369,7 +370,6 @@ static void json_scan_cb( void *callback_data, const char *path, const struct json_token *token) { - char field[512], val[512]; AMIPacket *pack = (AMIPacket*) callback_data; switch(token->type) { case JSON_TYPE_STRING: @@ -377,12 +377,11 @@ static void json_scan_cb( void *callback_data, case JSON_TYPE_TRUE: case JSON_TYPE_FALSE: case JSON_TYPE_NULL: - strncpy(field, name, name_len); - strncpy(val, token->ptr, token->len); - + // // TODO: fix memory leak on amipack_append_unknown //amipack_append_unknown(pack, "Action", "CoreStatus"); - amipack_append_unknown(pack, field, val); + amipack_append(pack, strndup(name, name_len), name_len, + strndup(token->ptr, token->len), token->len); break; default: break; } @@ -479,21 +478,22 @@ static int str2int( const char *val, int len) static int auth_fail(AMIPacket *pack) { - struct str *resp; + char *resp; + size_t len; if(pack->type != AMI_RESPONSE) return 0; - resp = amiheader_value(pack, Response); - if(strncasecmp(resp->buf, "Error", resp->len) != 0) { + len = amiheader_find(pack, "Response", &resp); + if(strncasecmp(resp, "Error", len) != 0) { return 0; } - resp = amiheader_value(pack, Message); - if(strncasecmp(resp->buf, "Authentication failed", resp->len) == 0) { - str_destroy(resp); + len = amiheader_find(pack, "Message", &resp); + if(strncasecmp(resp, "Authentication failed", len) == 0) { + free(resp); return 1; } - str_destroy(resp); + free(resp); return 0; } @@ -542,8 +542,13 @@ static struct amiws_config *valid_conf(struct amiws_config *conf) static void free_conf(struct amiws_config *conf) { + if(!conf) return; for (struct amiws_conn *conn = conf->head; conn; conn = conn->next) { - free(conn); + if(conn->name) free(conn->name); + if(conn->address) free(conn->address); + if(conn->host) free(conn->host); + if(conn->username) free(conn->username); + if(conn->secret) free(conn->secret); } if (conf) free(conf); diff --git a/test/Makefile.am b/test/Makefile.am index 15aa562..c262766 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,15 +1,23 @@ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(top_srcdir)/tap-driver.sh -TESTS = config_test pack_scan +TESTS = config_test pack_scan amipack_create_test amipack_parse_test -check_PROGRAMS = config_test pack_scan +check_PROGRAMS = config_test pack_scan amipack_create_test amipack_parse_test -config_test_SOURCE=config_test.c -config_test_CFLAGS= -I$(top_builddir)/src/lib -config_test_LDADD= -L$(top_builddir)/src/lib -lamiws -lmongoose -lfrozen -lcmocka +config_test_SOURCE = config_test.c +config_test_CFLAGS = -I$(top_builddir)/src/lib +config_test_LDADD = -L$(top_builddir)/src/lib -lamiws -lamipack -lmongoose -lfrozen -lcmocka -pack_scan_SOURCE=pack_scan.c -pack_scan_CFLAGS= -I$(top_builddir)/src/lib -pack_scan_LDADD= -L$(top_builddir)/src/lib -lamiws -lmongoose -lfrozen -lcmocka +pack_scan_SOURCE = pack_scan.c +pack_scan_CFLAGS = -I$(top_builddir)/src/lib +pack_scan_LDADD = -L$(top_builddir)/src/lib -lamiws -lamipack -lmongoose -lfrozen -lcmocka + +amipack_create_test_SOURCES = amipack_create_test.c +amipack_create_test_CFLAGS = -I$(top_builddir)/src/lib +amipack_create_test_LDADD = -L$(top_builddir)/src/lib -lamipack -lcmocka + +amipack_parse_test_SOURCES = amipack_parse_test.c +amipack_parse_test_CFLAGS = -I$(top_builddir)/src/lib +amipack_parse_test_LDADD = -L$(top_builddir)/src/lib -lamipack -lcmocka diff --git a/test/ami_msg_parse_test.c b/test/ami_msg_parse_test.c new file mode 100644 index 0000000..5407fe6 --- /dev/null +++ b/test/ami_msg_parse_test.c @@ -0,0 +1,533 @@ +#include +#include +#include +#include + +#include + +#include "amip.h" + +static void parse_prompt_header_11 (void **state) +{ + (void)*state; + const char *str = "Asterisk Call Manager/1.1\r\n"; + AMIVer ver; + int ret = amiparse_prompt (str, &ver); + assert_int_equal (RV_SUCCESS, ret); + assert_int_equal (1, ver.major); + assert_int_equal (1, ver.minor); + assert_int_equal (0, ver.patch); +} + +static void parse_prompt_header_280 (void **state) +{ + (void)*state; + const char *str = "Asterisk Call Manager/2.8.4\r\n"; + AMIVer ver; + int ret = amiparse_prompt (str, &ver); + assert_int_equal (RV_SUCCESS, ret); + assert_int_equal (2, ver.major); + assert_int_equal (8, ver.minor); + assert_int_equal (4, ver.patch); +} + +static void parse_not_prompt_pack (void **state) +{ + (void)*state; + const char *str = "Response: Success\r\n"; + AMIVer ver; + int ret = amiparse_prompt (str, &ver); + assert_int_equal (RV_FAIL, ret); + assert_int_equal (0, ver.major); + assert_int_equal (0, ver.minor); + assert_int_equal (0, ver.patch); +} + +static void parse_packet_stanza (void **state) +{ + (void)*state; + int rv; + // "Action: CoreStatus\r\n\r\n" + const char pack1[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x43,0x6f,0x72,0x65,0x53,0x74,0x61,0x74,0x75,0x73,0x0d,0x0a,0x0d,0x0a}; + // "Action: CoreStatus\r\n" + const char pack2[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x43,0x6f,0x72,0x65,0x53,0x74,0x61,0x74,0x75,0x73,0x0d,0x0a}; + // "\r\n" + const char pack3[] = {0x0d,0x0a}; + // empty string + const char pack4[] = {}; + // "\r\n\r\n" + const char pack5[] = {0x0d,0x0a,0x0d,0x0a}; + // "Stanza pack\r\n\r\n\r\n" + const char pack6[] = {0x53,0x74,0x61,0x6e,0x7a,0x61,0x20,0x70,0x61,0x63,0x6b,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a}; + + assert_int_equal ( amiparse_stanza (pack1, sizeof(pack1)), + RV_SUCCESS); + assert_int_equal ( amiparse_stanza (pack2, sizeof(pack2)), + RV_FAIL); + assert_int_equal ( amiparse_stanza (pack3, sizeof(pack3)), + RV_FAIL); + assert_int_equal ( amiparse_stanza (pack4, sizeof(pack4)), + RV_FAIL); + assert_int_equal ( amiparse_stanza (pack5, sizeof(pack5)), + RV_SUCCESS); + assert_int_equal ( amiparse_stanza (pack6, sizeof(pack6)), + RV_SUCCESS); + +} + +static void parse_packet_stanza_multiline (void **state) +{ + (void)*state; + //"Action: CoreStatus\r\nActionID: 1q2w3e4\r\n\r\n" + const char pack1[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x43,0x6f,0x72,0x65,0x53,0x74,0x61,0x74,0x75,0x73,0x0d,0x0a,0x41,0x63,0x74,0x69,0x6f,0x6e,0x49,0x44,0x3a,0x20,0x31,0x71,0x32,0x77,0x33,0x65,0x34,0x0d,0x0a,0x0d,0x0a}; + //"Action: CoreStatus\r\n\r\nActionID: 1q2w3e4\r\n" + const char pack2[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x43,0x6f,0x72,0x65,0x53,0x74,0x61,0x74,0x75,0x73,0x0d,0x0a,0x0d,0x0a,0x41,0x63,0x74,0x69,0x6f,0x6e,0x49,0x44,0x3a,0x20,0x31,0x71,0x32,0x77,0x33,0x65,0x34,0x0d,0x0a}; + /* + "Action: Redirect\r\n" + "Channel: SIP/5558877449-C-00006cf\r\n" + "ExtraChannel: SIP/258-C-000069a\r\n" + "Context: outbound-local\r\n" + "ExtraContext: extens-internal\r\n" + "Priority: 1\r\n" + "ExtraPriority: 1\r\n\r\n" + */ + const char pack3[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x52,0x65,0x64,0x69,0x72,0x65,0x63,0x74,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x35,0x35,0x35,0x38,0x38,0x37,0x37,0x34,0x34,0x39,0x2d,0x43,0x2d,0x30,0x30,0x30,0x30,0x36,0x63,0x66,0x0d,0x0a,0x45,0x78,0x74,0x72,0x61,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x32,0x35,0x38,0x2d,0x43,0x2d,0x30,0x30,0x30,0x30,0x36,0x39,0x61,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x78,0x74,0x3a,0x20,0x6f,0x75,0x74,0x62,0x6f,0x75,0x6e,0x64,0x2d,0x6c,0x6f,0x63,0x61,0x6c,0x0d,0x0a,0x45,0x78,0x74,0x72,0x61,0x43,0x6f,0x6e,0x74,0x65,0x78,0x74,0x3a,0x20,0x65,0x78,0x74,0x65,0x6e,0x73,0x2d,0x69,0x6e,0x74,0x65,0x72,0x6e,0x61,0x6c,0x0d,0x0a,0x50,0x72,0x69,0x6f,0x72,0x69,0x74,0x79,0x3a,0x20,0x31,0x0d,0x0a,0x45,0x78,0x74,0x72,0x61,0x50,0x72,0x69,0x6f,0x72,0x69,0x74,0x79,0x3a,0x20,0x31,0x0d,0x0a,0x0d,0x0a}; + /* + "Action: Redirect\r\n" + "Channel: SIP/5558877449-C-00006cf\r\n" + "ExtraChannel: SIP/258-C-000069a\r\na\r\n" + */ + const char pack4[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x52,0x65,0x64,0x69,0x72,0x65,0x63,0x74,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x35,0x35,0x35,0x38,0x38,0x37,0x37,0x34,0x34,0x39,0x2d,0x43,0x2d,0x30,0x30,0x30,0x30,0x36,0x63,0x66,0x0d,0x0a,0x45,0x78,0x74,0x72,0x61,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x32,0x35,0x38,0x2d,0x43,0x2d,0x30,0x30,0x30,0x30,0x36,0x39,0x61,0x0d,0x0a,0x61,0x0d,0x0a}; + //"Action: CoreStatus\r\n\r\nActionID: 1q2w3e4\r\n\r\n\r\n" + const char pack5[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x43,0x6f,0x72,0x65,0x53,0x74,0x61,0x74,0x75,0x73,0x0d,0x0a,0x0d,0x0a,0x41,0x63,0x74,0x69,0x6f,0x6e,0x49,0x44,0x3a,0x20,0x31,0x71,0x32,0x77,0x33,0x65,0x34,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a}; + //"Action: CoreStatus\r\n\r\nActionID: 1q2w3e4\r\n\r\n\r\n\r\n" + const char pack6[] = {0x41,0x63,0x74,0x69,0x6f,0x6e,0x3a,0x20,0x43,0x6f,0x72,0x65,0x53,0x74,0x61,0x74,0x75,0x73,0x0d,0x0a,0x0d,0x0a,0x41,0x63,0x74,0x69,0x6f,0x6e,0x49,0x44,0x3a,0x20,0x31,0x71,0x32,0x77,0x33,0x65,0x34,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a,0x0d,0x0a}; + + assert_int_equal(amiparse_stanza (pack1, sizeof(pack1)), RV_SUCCESS); + assert_int_equal(amiparse_stanza (pack2, sizeof(pack2)), RV_FAIL); + assert_int_equal(amiparse_stanza (pack3, sizeof(pack3)), RV_SUCCESS); + assert_int_equal(amiparse_stanza (pack4, sizeof(pack4)), RV_FAIL); + assert_int_equal(amiparse_stanza (pack5, sizeof(pack5)), RV_SUCCESS); + assert_int_equal(amiparse_stanza (pack6, sizeof(pack6)), RV_SUCCESS); +} + +static void parse_action_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + const char *str = "Action: CoreStatus\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (AMI_ACTION, pack->type); + assert_int_equal (pack->size, 1); + hv = amiheader_value(pack, Action); + assert_string_equal(hv->buf, "CoreStatus"); + amipack_destroy (pack); +} + +static void parse_event_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + const char *str = "Event: FullyBooted\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (pack->type, AMI_EVENT); + assert_int_equal (pack->size, 1); + hv = amiheader_value(pack, Event); + assert_string_equal(hv->buf, "FullyBooted"); + amipack_destroy (pack); +} + +static void parse_response_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + const char *str = "Response: Success\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (pack->type, AMI_RESPONSE); + assert_int_equal (pack->size, 1); + hv = amiheader_value(pack, Response); + assert_string_equal(hv->buf, "Success"); + amipack_destroy (pack); +} + +static void parse_unknown_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + const char *str = "Unknown-Header_Name: Unknown AMI Packet\r\n\r\n"; + + pack = amiparse_pack (str); + assert_non_null (pack); + assert_int_equal (pack->type, AMI_UNKNOWN); + assert_int_equal (pack->size, 1); + amipack_destroy (pack); +} + +static void parse_invalid_pack (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + const char *str = "invalid pack that match stanza\r\n\r\n"; + + pack = amiparse_pack (str); + assert_null (pack); +} + +static void parse_response_one_header_caseinsen (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + const char *str = "response: Fail\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (pack->type, AMI_RESPONSE); + assert_int_equal (pack->size, 1); + hv = amiheader_value(pack, Response); + assert_string_equal(hv->buf, "Fail"); + amipack_destroy (pack); +} + +static void parse_multi_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + /* + "Event: Hangup\r\n" + "Privilege: call,all\r\n" + "Channel: SIP/ipauthTp3BCHH7-00573401\r\n" + "Uniqueid: 1486254977.6071371\r\n" + "CallerIDNum: 18072280333\r\n" + "CallerIDName: \r\n" + "ConnectedLineNum: 16478472022\r\n" + "ConnectedLineName: John Bar\r\n" + "Cause: 16\r\n" + "Cause-txt: Normal Clearing\r\n\r\n"; + */ + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x48,0x61,0x6e,0x67,0x75,0x70,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x63,0x61,0x6c,0x6c,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x69,0x70,0x61,0x75,0x74,0x68,0x54,0x70,0x33,0x42,0x43,0x48,0x48,0x37,0x2d,0x30,0x30,0x35,0x37,0x33,0x34,0x30,0x31,0x0d,0x0a,0x55,0x6e,0x69,0x71,0x75,0x65,0x69,0x64,0x3a,0x20,0x31,0x34,0x38,0x36,0x32,0x35,0x34,0x39,0x37,0x37,0x2e,0x36,0x30,0x37,0x31,0x33,0x37,0x31,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x75,0x6d,0x3a,0x20,0x31,0x38,0x30,0x37,0x32,0x32,0x38,0x30,0x33,0x33,0x33,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x61,0x6d,0x65,0x3a,0x20,0x3c,0x75,0x6e,0x6b,0x6e,0x6f,0x77,0x6e,0x3e,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x65,0x64,0x4c,0x69,0x6e,0x65,0x4e,0x75,0x6d,0x3a,0x20,0x31,0x36,0x34,0x37,0x38,0x34,0x37,0x32,0x30,0x32,0x32,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x65,0x64,0x4c,0x69,0x6e,0x65,0x4e,0x61,0x6d,0x65,0x3a,0x20,0x4a,0x6f,0x68,0x6e,0x20,0x42,0x61,0x72,0x0d,0x0a,0x43,0x61,0x75,0x73,0x65,0x3a,0x20,0x31,0x36,0x0d,0x0a,0x43,0x61,0x75,0x73,0x65,0x2d,0x74,0x78,0x74,0x3a,0x20,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x43,0x6c,0x65,0x61,0x72,0x69,0x6e,0x67,0x0d,0x0a,0x0d,0x0a}; + + ret = amiparse_stanza (str_pack, sizeof(str_pack)); + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + assert_int_equal (pack->size, 10); + + hv = amiheader_value(pack, Event); + assert_memory_equal (hv->buf, "Hangup", hv->len); + + hv = amiheader_value(pack, Privilege); + assert_memory_equal (hv->buf, "call,all", hv->len); + + hv = amiheader_value(pack, Channel); + assert_memory_equal (hv->buf, "SIP/ipauthTp3BCHH7-00573401", hv->len); + + hv = amiheader_value(pack, Uniqueid); + assert_memory_equal (hv->buf, "1486254977.6071371", hv->len); + + hv = amiheader_value(pack, CallerIDNum); + assert_memory_equal (hv->buf, "18072280333", hv->len); + + hv = amiheader_value(pack, CallerIDName); + assert_memory_equal (hv->buf, "", hv->len); + + hv = amiheader_value(pack, ConnectedLineNum); + assert_memory_equal (hv->buf, "16478472022", hv->len); + + hv = amiheader_value(pack, ConnectedLineName); + assert_memory_equal (hv->buf, "John Bar", hv->len); + + hv = amiheader_value(pack, Cause); + assert_memory_equal (hv->buf, "16", hv->len); + + hv = amiheader_value(pack, Cause_txt); + assert_memory_equal (hv->buf, "Normal Clearing", hv->len); + + amipack_destroy (pack); +} + +static void parse_headers_with_empty_value (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + /* + "Event: Newchannel\r\n" + "Privilege: call,all\r\n" + "Channel: SIP/ipauthTp3BCHH7-00573539\r\n" + "ChannelState: 0\r\n" + "ChannelStateDesc: Down\r\n" + "CallerIDNum: \r\n" + "CallerIDName: \r\n" + "AccountCode: 81\r\n" + "Exten: \r\n" + "Context: mor\r\n" + "Uniqueid: 1486256739.6071687\r\n\r\n"; + */ + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x4e,0x65,0x77,0x63,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x63,0x61,0x6c,0x6c,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x69,0x70,0x61,0x75,0x74,0x68,0x54,0x70,0x33,0x42,0x43,0x48,0x48,0x37,0x2d,0x30,0x30,0x35,0x37,0x33,0x35,0x33,0x39,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x53,0x74,0x61,0x74,0x65,0x3a,0x20,0x30,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x53,0x74,0x61,0x74,0x65,0x44,0x65,0x73,0x63,0x3a,0x20,0x44,0x6f,0x77,0x6e,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x75,0x6d,0x3a,0x20,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x61,0x6d,0x65,0x3a,0x20,0x0d,0x0a,0x41,0x63,0x63,0x6f,0x75,0x6e,0x74,0x43,0x6f,0x64,0x65,0x3a,0x20,0x38,0x31,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x78,0x74,0x3a,0x20,0x6d,0x6f,0x72,0x0d,0x0a,0x55,0x6e,0x69,0x71,0x75,0x65,0x69,0x64,0x3a,0x20,0x31,0x34,0x38,0x36,0x32,0x35,0x36,0x37,0x33,0x39,0x2e,0x36,0x30,0x37,0x31,0x36,0x38,0x37,0x0d,0x0a,0x0d,0x0a}; + + ret = amiparse_stanza (str_pack, sizeof(str_pack)); + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + + assert_int_equal (pack->size, 11); + assert_int_equal (amipack_length(pack), sizeof(str_pack)); + + hv = amiheader_value(pack, Event); + assert_string_equal(hv->buf, "Newchannel"); + + hv = amiheader_value(pack, ChannelStateDesc); + assert_string_equal(hv->buf, "Down"); + + hv = amiheader_value(pack, CallerIDName); + assert_string_equal(hv->buf, ""); + + hv = amiheader_value(pack, Exten); + assert_string_equal(hv->buf, ""); + + hv = amiheader_value(pack, Uniqueid); + assert_string_equal(hv->buf, "1486256739.6071687"); + + amipack_destroy (pack); +} + +static void parse_pack_with_empty_last_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + /* + "Event: Custom\r\n" + "Privilege: call,all\r\n" + "Exten: \r\n" + "Peer: \r\n\r\n"; + */ + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x43,0x75,0x73,0x74,0x6f,0x6d,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x63,0x61,0x6c,0x6c,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x50,0x65,0x65,0x72,0x3a,0x20,0x0d,0x0a,0x0d,0x0a}; + + ret = amiparse_stanza (str_pack, sizeof(str_pack)); + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + + assert_int_equal (pack->size, 4); + assert_int_equal (amipack_length(pack), sizeof(str_pack)); + + hv = amiheader_value(pack, Event); + assert_string_equal(hv->buf, "Custom"); + + hv = amiheader_value(pack, Peer); + assert_string_equal(hv->buf, ""); + + amipack_destroy (pack); +} + +static void parse_pack_unordered (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + /* + "Status: Fully Booted\r\n" + "Exten: \r\n" + "Event: FullyBooted\r\n" + "Privilege: system,all\r\n\r\n"; + */ + const char str_pack[] = {0x53,0x74,0x61,0x74,0x75,0x73,0x3a,0x20,0x46,0x75,0x6c,0x6c,0x79,0x20,0x42,0x6f,0x6f,0x74,0x65,0x64,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x46,0x75,0x6c,0x6c,0x79,0x42,0x6f,0x6f,0x74,0x65,0x64,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x0d,0x0a}; + + ret = amiparse_stanza (str_pack, sizeof(str_pack)); + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + + hv = amiheader_value(pack, Event); + assert_string_equal(hv->buf, "FullyBooted"); + + amipack_destroy (pack); +} + +static void parse_pack_with_invalid_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + /* + "Event: FullyBooted\r\n" + "invalid header\r\n" + "Exten: \r\n" + "Privilege: system,all\r\n\r\n"; + */ + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x46,0x75,0x6c,0x6c,0x79,0x42,0x6f,0x6f,0x74,0x65,0x64,0x0d,0x0a,0x69,0x6e,0x76,0x61,0x6c,0x69,0x64,0x20,0x68,0x65,0x61,0x64,0x65,0x72,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x0d,0x0a}; + + ret = amiparse_stanza (str_pack, sizeof(str_pack)); + assert_int_equal (RV_SUCCESS, ret); + + assert_null(amiparse_pack (str_pack)); + +} + +static void parse_pack_command_output (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + const char str_pack[] = "Response: Follows\r\n" + "ActionID: 12345\r\n" + "Privilege: Command\r\n" + "Channel Location State Application(Data) \n" + "Local/5143607296@dia IVR_603@default:1 Up AppDial((Outgoing Line)) \n" + "Local/5146020115@dia 5146020115@dial-foll Ring Dial(SIP/5146020115@drspa.ntek\n" + "1754093 calls processed\n" + "--END COMMAND--\r\n\r\n"; + + const char output_cmp[] = "Channel Location State Application(Data) \n" + "Local/5143607296@dia IVR_603@default:1 Up AppDial((Outgoing Line)) \n" + "Local/5146020115@dia 5146020115@dial-foll Ring Dial(SIP/5146020115@drspa.ntek\n" + "1754093 calls processed\n"; + + ret = amiparse_stanza (str_pack, sizeof(str_pack) - 1); // -1 to remove last \000 + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_RESPONSE, pack->type); + + hv = amiheader_value(pack, Privilege); + assert_string_equal(hv->buf, "Command"); + + hv = amiheader_value(pack, ActionID); + assert_string_equal(hv->buf, "12345"); + + hv = amiheader_value(pack, Output); + assert_string_equal(hv->buf, output_cmp); + + amipack_destroy (pack); +} + +/* + * Command output compatibale with AMI v2 + * Command output is a value of the header "Output: " + */ +static void parse_pack_command_output_v2 (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *hv; // header value + + const char str_pack[] = "Response: Follows\r\n" + "Message: Command output follows\r\n" + "Output: Name/username Host Dyn Forcerport Comedia ACL Port Status Description \r\n" + "8888/8888 (Unspecified) D Auto (No) No 0 Unmonitored \n" + "1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 1 offline]\n" + "--END COMMAND--\r\n\r\n"; + + const char output_cmp[] = "Output: Name/username Host Dyn Forcerport Comedia ACL Port Status Description \r\n" + "8888/8888 (Unspecified) D Auto (No) No 0 Unmonitored \n" + "1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 1 offline]\n"; + + ret = amiparse_stanza (str_pack, sizeof(str_pack) - 1); + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_RESPONSE, pack->type); + + hv = amiheader_value(pack, Message); + assert_string_equal(hv->buf, "Command output follows"); + + hv = amiheader_value(pack, Output); + assert_string_equal(hv->buf, output_cmp); + + amipack_destroy (pack); +} + +static void parse_pack_with_multiple_unknown_headers (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + struct str *pack_str; + + const char inpack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x53,0x75,0x63,0x63,0x65,0x73,0x73,0x66,0x75,0x6c,0x41,0x75,0x74,0x68,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69, + 0x6c,0x65,0x67,0x65,0x3a,0x20,0x73,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x45,0x76,0x65,0x6e,0x74,0x54,0x56,0x3a, + 0x20,0x32,0x30,0x31,0x37,0x2d,0x30,0x34,0x2d,0x30,0x32,0x54,0x31,0x35,0x3a,0x35,0x32,0x3a,0x30,0x38,0x2e,0x30,0x33,0x34,0x2d,0x30,0x34,0x30, + 0x30,0x0d,0x0a,0x53,0x65,0x76,0x65,0x72,0x69,0x74,0x79,0x3a,0x20,0x49,0x6e,0x66,0x6f,0x72,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x0d,0x0a, + 0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x3a,0x20,0x41,0x4d,0x49,0x0d,0x0a,0x45,0x76,0x65,0x6e,0x74,0x56,0x65,0x72,0x73,0x69,0x6f,0x6e,0x3a,0x20, + 0x31,0x0d,0x0a,0x41,0x63,0x63,0x6f,0x75,0x6e,0x74,0x49,0x44,0x3a,0x20,0x61,0x64,0x6d,0x69,0x6e,0x0d,0x0a,0x53,0x65,0x73,0x73,0x69,0x6f,0x6e, + 0x49,0x44,0x3a,0x20,0x30,0x78,0x61,0x31,0x33,0x34,0x65,0x64,0x63,0x0d,0x0a,0x4c,0x6f,0x63,0x61,0x6c,0x41,0x64,0x64,0x72,0x65,0x73,0x73,0x3a, + 0x20,0x49,0x50,0x56,0x34,0x2f,0x54,0x43,0x50,0x2f,0x30,0x2e,0x30,0x2e,0x30,0x2e,0x30,0x2f,0x35,0x30,0x33,0x38,0x0d,0x0a,0x52,0x65,0x6d,0x6f, + 0x74,0x65,0x41,0x64,0x64,0x72,0x65,0x73,0x73,0x3a,0x20,0x49,0x50,0x56,0x34,0x2f,0x54,0x43,0x50,0x2f,0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e, + 0x31,0x2e,0x31,0x32,0x32,0x2f,0x35,0x30,0x34,0x34,0x38,0x0d,0x0a,0x55,0x73,0x69,0x6e,0x67,0x50,0x61,0x73,0x73,0x77,0x6f,0x72,0x64,0x3a,0x20, + 0x30,0x0d,0x0a,0x53,0x65,0x73,0x73,0x69,0x6f,0x6e,0x54,0x56,0x3a,0x20,0x32,0x30,0x31,0x37,0x2d,0x30,0x34,0x2d,0x30,0x32,0x54,0x31,0x35,0x3a, + 0x35,0x32,0x3a,0x30,0x38,0x2e,0x30,0x33,0x34,0x2d,0x30,0x34,0x30,0x30,0x0d,0x0a,0x0d,0x0a}; + + ret = amiparse_stanza (inpack, sizeof(inpack)); + assert_int_equal (RV_SUCCESS, ret); + + pack = amiparse_pack (inpack); + assert_int_equal (AMI_EVENT, pack->type); + + pack_str = amipack_to_str(pack); + assert_memory_equal (pack_str->buf, inpack, pack_str->len); + + str_destroy(pack_str); + amipack_destroy (pack); +} + +int main(void) +{ + const struct CMUnitTest tests[] = { + cmocka_unit_test (parse_prompt_header_11), + cmocka_unit_test (parse_prompt_header_280), + cmocka_unit_test (parse_not_prompt_pack), + cmocka_unit_test (parse_packet_stanza), + cmocka_unit_test (parse_packet_stanza_multiline), + cmocka_unit_test (parse_action_one_header), + cmocka_unit_test (parse_event_one_header), + cmocka_unit_test (parse_response_one_header), + cmocka_unit_test (parse_unknown_one_header), + cmocka_unit_test (parse_invalid_pack), + cmocka_unit_test (parse_response_one_header_caseinsen), + cmocka_unit_test (parse_multi_header), + cmocka_unit_test (parse_headers_with_empty_value), + cmocka_unit_test (parse_pack_with_empty_last_header), + cmocka_unit_test (parse_pack_unordered), + cmocka_unit_test (parse_pack_with_invalid_header), + cmocka_unit_test (parse_pack_command_output), + cmocka_unit_test (parse_pack_command_output_v2), + cmocka_unit_test (parse_pack_with_multiple_unknown_headers), + }; + + cmocka_set_message_output(CM_OUTPUT_TAP); + + return cmocka_run_group_tests_name("Parse AMI package tests.", tests, NULL, NULL); +} diff --git a/test/amipack_create_test.c b/test/amipack_create_test.c new file mode 100644 index 0000000..79e3741 --- /dev/null +++ b/test/amipack_create_test.c @@ -0,0 +1,223 @@ +#include +#include +#include +#include + +#include +#include "amipack.h" + +static int setup_pack(void **state) +{ + *state = (AMIPacket *) amipack_init (); + return 0; +} + +static int teardown_pack(void **state) +{ + amipack_destroy (*state); + return 0; +} + +static void create_pack_with_no_header (void **state) +{ + char *pack_str; + AMIPacket *pack = *state; + + assert_int_equal (pack->size, 0); + assert_int_equal ( amipack_to_str(pack, &pack_str), 0 ); +} + +static void create_pack_with_single_header (void **state) +{ + char *pstr; + AMIPacket *pack = *state; + size_t plen; + + amipack_type(pack, AMI_ACTION); + amipack_append_action(pack, strdup("CoreStatus"), 10); + + assert_int_equal(pack->size, 1); + + plen = amipack_to_str(pack, &pstr); + assert_memory_equal(pstr, "Action: CoreStatus\r\n\r\n", plen); + + assert_int_equal(plen, amipack_length(pack)); + + free(pstr); +} + +static void create_pack_with_two_headers (void **state) +{ + char *pack_str; + size_t len; + AMIPacket *pack = *state; + + amipack_type(pack, AMI_ACTION); + amipack_append_action(pack, strdup("Command"), 7); + amipack_append (pack, strdup("Command"), 7, strdup("core show uptime"), 16); + + assert_int_equal (pack->size, 2); + + len = amipack_to_str (pack, &pack_str); + assert_memory_equal (pack_str, + "Action: Command\r\nCommand: core show uptime\r\n\r\n", + len); + + assert_int_equal(len, amipack_length (pack)); + free(pack_str); +} + +static void create_pack_with_three_headers (void **state) +{ + char *pack_str; + size_t len; + AMIPacket *pack = *state; + + amipack_type(pack, AMI_ACTION); + amipack_append_action(pack, strdup("ExtensionState"), 14); + amipack_append (pack, strdup("Exten"), 5, strdup("5555"), 4); + amipack_append (pack, strdup("Context"), 7, strdup("inbound-local"), 13); + + assert_int_equal (pack->size, 3); + + len = amipack_to_str (pack, &pack_str); + assert_memory_equal (pack_str, + "Action: ExtensionState\r\nExten: 5555\r\nContext: inbound-local\r\n\r\n", + len); + + assert_int_equal(len, amipack_length (pack)); + free(pack_str); +} + +static void create_pack_with_multi_headers (void **state) +{ + size_t len; + const char *pack_result = "Action: Redirect\r\n" + "Channel: SIP/5558877449-C-00006cf\r\n" + "ExtraChannel: SIP/258-C-000069a\r\n" + "Context: outbound-local\r\n" + "ExtraContext: extens-internal\r\n" + "Priority: 1\r\n" + "ExtraPriority: 1\r\n\r\n"; + char *pack_str; + AMIPacket *pack = *state; + + amipack_type(pack, AMI_ACTION); + amipack_append_action (pack, strdup("Redirect"), 8); + amipack_append (pack, strdup("Channel"), 7, strdup("SIP/5558877449-C-00006cf"), 24); + amipack_append (pack, strdup("ExtraChannel"), 12, strdup("SIP/258-C-000069a"), 17); + amipack_append (pack, strdup("Context"), 7, strdup("outbound-local"), 14); + amipack_append (pack, strdup("ExtraContext"), 12, strdup("extens-internal"), 15); + amipack_append (pack, strdup("Priority"), 8, strdup("1"), 1); + amipack_append (pack, strdup("ExtraPriority"), 13, strdup("1"), 1); + + assert_int_equal (pack->size, 7); + + len = amipack_to_str (pack, &pack_str); + + assert_memory_equal (pack_str, pack_result, len); + + assert_int_equal(len, amipack_length (pack)); + free(pack_str); +} + +static void create_pack_with_empty_header (void **state) +{ + char *pack_str; + size_t len; + AMIPacket *pack = *state; + + amipack_type(pack, AMI_EVENT); + + amipack_append (pack, strdup("Event"), 5, strdup("Newchannel"), 10); + amipack_append (pack, strdup("ChannelState"), 12, strdup("0"), 1); + amipack_append (pack, strdup("CallerIDNum"), 11, strdup(""), 0); + amipack_append (pack, strdup("CallerIDName"),12, NULL, 0); + amipack_append (pack, strdup("Exten1"), 6, strdup(""), 0); + amipack_append (pack, strdup("Context"), 7, strdup("mor"), 3); + + assert_int_equal (pack->size, 6); + len = amipack_to_str (pack, &pack_str); + assert_memory_equal (pack_str, + "Event: Newchannel\r\nChannelState: 0\r\nCallerIDNum: \r\nCallerIDName: \r\nExten1: \r\nContext: mor\r\n\r\n", + len); + assert_int_equal(len, amipack_length (pack)); + free(pack_str); +} + +static void create_pack_with_empty_last_header (void **state) +{ + char *pack_str; + size_t len; + AMIPacket *pack = *state; + + amipack_type(pack, AMI_EVENT); + + amipack_append (pack, strdup("Event"), 5, strdup("Newchannel"), 10); + amipack_append (pack, strdup("ChannelState"), 12, strdup("0"), 1); + amipack_append (pack, strdup("CallerIDNum"), 11, strdup(""), 0); + + assert_int_equal (pack->size, 3); + len = amipack_to_str (pack, &pack_str); + assert_memory_equal (pack_str, + "Event: Newchannel\r\nChannelState: 0\r\nCallerIDNum: \r\n\r\n", + len); + assert_int_equal(len, amipack_length (pack)); + free (pack_str); +} + +static void pack_find_headers (void **state) +{ + AMIPacket *pack = *state; + char *hdr_val; // header value + size_t len; + + amipack_type(pack, AMI_EVENT); + amipack_append (pack, strdup("Event"), 5, strdup("Hangup"), 6); + amipack_append (pack, strdup("Privilege"), 9, strdup("dialplan,all"), 12); + amipack_append (pack, strdup("Channel"), 7, strdup("PJSIP/kermit-00000001"), 21); + amipack_append (pack, strdup("Uniqueid"), 8, strdup("asterisk-1368479157.1"), 21); + amipack_append (pack, strdup("ChannelState"), 12, strdup("6"), 1); + amipack_append (pack, strdup("ChannelStateDesc"), 16, strdup("Up"), 2); + amipack_append (pack, strdup("Cause"), 5, strdup("16"), 2); + amipack_append (pack, strdup("Cause-txt"), 9, strdup("Normal Clearing"), 15); + + // found header value + len = amiheader_find(pack, "Cause", &hdr_val); + assert_memory_equal(hdr_val, "16", len); + + len = amiheader_find(pack, "Uniqueid", &hdr_val); + assert_memory_equal(hdr_val, "asterisk-1368479157.1", len); + + // case insencetive + len = amiheader_find(pack, "chaNNelsTateDesc", &hdr_val); + assert_memory_equal(hdr_val, "Up", len); + + // header value not found + len = amiheader_find(pack, "TheHeaderThatDoesNotExists", &hdr_val); + assert_int_equal(-1, len); + + len = amiheader_find(pack, "Grivileje", &hdr_val); + assert_int_equal(-1, len); + + assert_int_equal (pack->size, 8); + assert_int_equal (pack->type, AMI_EVENT); +} + +int main(void) +{ + const struct CMUnitTest tests[] = { + cmocka_unit_test_setup_teardown (create_pack_with_no_header, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (create_pack_with_single_header, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (create_pack_with_two_headers, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (create_pack_with_three_headers, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (create_pack_with_multi_headers, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (create_pack_with_empty_header, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (create_pack_with_empty_last_header, setup_pack, teardown_pack), + cmocka_unit_test_setup_teardown (pack_find_headers, setup_pack, teardown_pack), + }; + + cmocka_set_message_output(CM_OUTPUT_TAP); + + return cmocka_run_group_tests_name("Create AMI package tests.", tests, NULL, NULL); +} diff --git a/test/amipack_parse_test.c b/test/amipack_parse_test.c new file mode 100644 index 0000000..b70e545 --- /dev/null +++ b/test/amipack_parse_test.c @@ -0,0 +1,412 @@ +#include +#include +#include +#include + +#include + +#include "amipack.h" + +#define RV_SUCCESS 1 +#define RV_FAIL !RV_SUCCESS + +static void parse_prompt_header_11 (void **state) +{ + (void)*state; + const char *str = "Asterisk Call Manager/1.1\r\n"; + AMIVer ver; + int ret = amiparse_prompt (str, &ver); + assert_int_equal (1, ret); + assert_int_equal (1, ver.major); + assert_int_equal (1, ver.minor); + assert_int_equal (0, ver.patch); +} + +static void parse_prompt_header_280 (void **state) +{ + (void)*state; + const char *str = "Asterisk Call Manager/2.8.4\r\n"; + AMIVer ver; + int ret = amiparse_prompt (str, &ver); + assert_int_equal (1, ret); + assert_int_equal (2, ver.major); + assert_int_equal (8, ver.minor); + assert_int_equal (4, ver.patch); +} + +static void parse_not_prompt_pack (void **state) +{ + (void)*state; + const char *str = "Response: Success\r\n"; + AMIVer ver; + int ret = amiparse_prompt (str, &ver); + assert_int_equal (0, ret); + assert_int_equal (0, ver.major); + assert_int_equal (0, ver.minor); + assert_int_equal (0, ver.patch); +} + +static void parse_action_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + int ret; + size_t len; + char *hv; // header value + const char *str = "Action: CoreStatus\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (AMI_ACTION, pack->type); + assert_int_equal (pack->size, 1); + len = amiheader_find(pack, "Action", &hv); + assert_string_equal(hv, "CoreStatus"); + amipack_destroy (pack); +} + +static void parse_event_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + const char *str = "Event: FullyBooted\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (pack->type, AMI_EVENT); + assert_int_equal (pack->size, 1); + len = amiheader_find(pack, "Event", &hv); + assert_string_equal(hv, "FullyBooted"); + amipack_destroy (pack); +} + +static void parse_response_one_header (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + const char *str = "Response: Success\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (pack->type, AMI_RESPONSE); + assert_int_equal (pack->size, 1); + len = amiheader_find(pack, "Response", &hv); + assert_string_equal(hv, "Success"); + amipack_destroy (pack); +} + +static void parse_invalid_pack (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + const char *str = "invalid pack that match stanza\r\n\r\n"; + + pack = amiparse_pack (str); + assert_null (pack); +} + +static void parse_response_one_header_caseinsen (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + const char *str = "response: Fail\r\n\r\n"; + + pack = amiparse_pack (str); + assert_int_equal (pack->type, AMI_RESPONSE); + assert_int_equal (pack->size, 1); + len = amiheader_find(pack, "Response", &hv); + assert_string_equal(hv, "Fail"); + amipack_destroy (pack); +} + +static void parse_multi_header (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + + // "Event: Hangup\r\n" + // "Privilege: call,all\r\n" + // "Channel: SIP/ipauthTp3BCHH7-00573401\r\n" + // "Uniqueid: 1486254977.6071371\r\n" + // "CallerIDNum: 18072280333\r\n" + // "CallerIDName: \r\n" + // "ConnectedLineNum: 16478472022\r\n" + // "ConnectedLineName: John Bar\r\n" + // "Cause: 16\r\n" + // "Cause-txt: Normal Clearing\r\n\r\n"; + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x48,0x61,0x6e,0x67,0x75,0x70,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x63,0x61,0x6c,0x6c,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x69,0x70,0x61,0x75,0x74,0x68,0x54,0x70,0x33,0x42,0x43,0x48,0x48,0x37,0x2d,0x30,0x30,0x35,0x37,0x33,0x34,0x30,0x31,0x0d,0x0a,0x55,0x6e,0x69,0x71,0x75,0x65,0x69,0x64,0x3a,0x20,0x31,0x34,0x38,0x36,0x32,0x35,0x34,0x39,0x37,0x37,0x2e,0x36,0x30,0x37,0x31,0x33,0x37,0x31,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x75,0x6d,0x3a,0x20,0x31,0x38,0x30,0x37,0x32,0x32,0x38,0x30,0x33,0x33,0x33,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x61,0x6d,0x65,0x3a,0x20,0x3c,0x75,0x6e,0x6b,0x6e,0x6f,0x77,0x6e,0x3e,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x65,0x64,0x4c,0x69,0x6e,0x65,0x4e,0x75,0x6d,0x3a,0x20,0x31,0x36,0x34,0x37,0x38,0x34,0x37,0x32,0x30,0x32,0x32,0x0d,0x0a,0x43,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x65,0x64,0x4c,0x69,0x6e,0x65,0x4e,0x61,0x6d,0x65,0x3a,0x20,0x4a,0x6f,0x68,0x6e,0x20,0x42,0x61,0x72,0x0d,0x0a,0x43,0x61,0x75,0x73,0x65,0x3a,0x20,0x31,0x36,0x0d,0x0a,0x43,0x61,0x75,0x73,0x65,0x2d,0x74,0x78,0x74,0x3a,0x20,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x43,0x6c,0x65,0x61,0x72,0x69,0x6e,0x67,0x0d,0x0a,0x0d,0x0a}; + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + assert_int_equal (pack->size, 10); + + len = amiheader_find(pack, "Event", &hv); + assert_memory_equal (hv, "Hangup", len); + + len = amiheader_find(pack, "Privilege", &hv); + assert_memory_equal (hv, "call,all", len); + + len = amiheader_find(pack, "Channel", &hv); + assert_memory_equal (hv, "SIP/ipauthTp3BCHH7-00573401", len); + + len = amiheader_find(pack, "Uniqueid", &hv); + assert_memory_equal (hv, "1486254977.6071371", len); + + len = amiheader_find(pack, "CallerIDNum", &hv); + assert_memory_equal (hv, "18072280333", len); + + len = amiheader_find(pack, "CallerIDName", &hv); + assert_memory_equal (hv, "", len); + + len = amiheader_find(pack, "ConnectedLineNum", &hv); + assert_memory_equal (hv, "16478472022", len); + + len = amiheader_find(pack, "ConnectedLineName", &hv); + assert_memory_equal (hv, "John Bar", len); + + len = amiheader_find(pack, "Cause", &hv); + assert_memory_equal (hv, "16", len); + + len = amiheader_find(pack, "Cause-txt", &hv); + assert_memory_equal (hv, "Normal Clearing", len); + + amipack_destroy (pack); +} + +static void parse_headers_with_empty_value (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + + // "Event: Newchannel\r\n" + // "Privilege: call,all\r\n" + // "Channel: SIP/ipauthTp3BCHH7-00573539\r\n" + // "ChannelState: 0\r\n" + // "ChannelStateDesc: Down\r\n" + // "CallerIDNum: \r\n" + // "CallerIDName: \r\n" + // "AccountCode: 81\r\n" + // "Exten: \r\n" + // "Context: mor\r\n" + // "Uniqueid: 1486256739.6071687\r\n\r\n"; + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x4e,0x65,0x77,0x63,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x63,0x61,0x6c,0x6c,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x3a,0x20,0x53,0x49,0x50,0x2f,0x69,0x70,0x61,0x75,0x74,0x68,0x54,0x70,0x33,0x42,0x43,0x48,0x48,0x37,0x2d,0x30,0x30,0x35,0x37,0x33,0x35,0x33,0x39,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x53,0x74,0x61,0x74,0x65,0x3a,0x20,0x30,0x0d,0x0a,0x43,0x68,0x61,0x6e,0x6e,0x65,0x6c,0x53,0x74,0x61,0x74,0x65,0x44,0x65,0x73,0x63,0x3a,0x20,0x44,0x6f,0x77,0x6e,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x75,0x6d,0x3a,0x20,0x0d,0x0a,0x43,0x61,0x6c,0x6c,0x65,0x72,0x49,0x44,0x4e,0x61,0x6d,0x65,0x3a,0x20,0x0d,0x0a,0x41,0x63,0x63,0x6f,0x75,0x6e,0x74,0x43,0x6f,0x64,0x65,0x3a,0x20,0x38,0x31,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x65,0x78,0x74,0x3a,0x20,0x6d,0x6f,0x72,0x0d,0x0a,0x55,0x6e,0x69,0x71,0x75,0x65,0x69,0x64,0x3a,0x20,0x31,0x34,0x38,0x36,0x32,0x35,0x36,0x37,0x33,0x39,0x2e,0x36,0x30,0x37,0x31,0x36,0x38,0x37,0x0d,0x0a,0x0d,0x0a}; + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + + assert_int_equal (pack->size, 11); + assert_int_equal (amipack_length(pack), sizeof(str_pack)); + + len = amiheader_find(pack, "Event", &hv); + assert_string_equal(hv, "Newchannel"); + + len = amiheader_find(pack, "ChannelStateDesc", &hv); + assert_string_equal(hv, "Down"); + + len = amiheader_find(pack, "CallerIDNum", &hv); + assert_string_equal(hv, ""); + + len = amiheader_find(pack, "Exten", &hv); + assert_string_equal(hv, ""); + + len = amiheader_find(pack, "Uniqueid", &hv); + assert_string_equal(hv, "1486256739.6071687"); + + amipack_destroy (pack); +} + +static void parse_pack_with_empty_last_header (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + + // "Event: Custom\r\n" + // "Privilege: call,all\r\n" + // "Exten: \r\n" + // "Peer: \r\n\r\n"; + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x43,0x75,0x73,0x74,0x6f,0x6d,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x63,0x61,0x6c,0x6c,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x50,0x65,0x65,0x72,0x3a,0x20,0x0d,0x0a,0x0d,0x0a}; + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + + assert_int_equal (pack->size, 4); + assert_int_equal (amipack_length(pack), sizeof(str_pack)); + + len = amiheader_find(pack, "Event", &hv); + assert_string_equal(hv, "Custom"); + + len = amiheader_find(pack, "Peer", &hv); + assert_string_equal(hv, ""); + + amipack_destroy (pack); +} + +static void parse_pack_unordered (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + + // "Status: Fully Booted\r\n" + // "Exten: \r\n" + // "Event: FullyBooted\r\n" + // "Privilege: system,all\r\n\r\n"; + const char str_pack[] = {0x53,0x74,0x61,0x74,0x75,0x73,0x3a,0x20,0x46,0x75,0x6c,0x6c,0x79,0x20,0x42,0x6f,0x6f,0x74,0x65,0x64,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x46,0x75,0x6c,0x6c,0x79,0x42,0x6f,0x6f,0x74,0x65,0x64,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x0d,0x0a}; + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_EVENT, pack->type); + + len = amiheader_find(pack, "Event", &hv); + assert_string_equal(hv, "FullyBooted"); + + amipack_destroy (pack); +} + +static void parse_pack_with_invalid_header (void **state) +{ + (void)*state; + AMIPacket *pack; + + // "Event: FullyBooted\r\n" + // "invalid header\r\n" + // "Exten: \r\n" + // "Privilege: system,all\r\n\r\n"; + const char str_pack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x46,0x75,0x6c,0x6c,0x79,0x42,0x6f,0x6f,0x74,0x65,0x64,0x0d,0x0a,0x69,0x6e,0x76,0x61,0x6c,0x69,0x64,0x20,0x68,0x65,0x61,0x64,0x65,0x72,0x0d,0x0a,0x45,0x78,0x74,0x65,0x6e,0x3a,0x20,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69,0x6c,0x65,0x67,0x65,0x3a,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x0d,0x0a}; + + assert_null(amiparse_pack (str_pack)); +} + +static void parse_pack_command_output (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + + const char str_pack[] = "Response: Follows\r\n" + "ActionID: 12345\r\n" + "Privilege: Command\r\n" + "Channel Location State Application(Data) \n" + "Local/5143607296@dia IVR_603@default:1 Up AppDial((Outgoing Line)) \n" + "Local/5146020115@dia 5146020115@dial-foll Ring Dial(SIP/5146020115@drspa.ntek\n" + "1754093 calls processed\n" + "--END COMMAND--\r\n\r\n"; + + const char output_cmp[] = "Channel Location State Application(Data) \n" + "Local/5143607296@dia IVR_603@default:1 Up AppDial((Outgoing Line)) \n" + "Local/5146020115@dia 5146020115@dial-foll Ring Dial(SIP/5146020115@drspa.ntek\n" + "1754093 calls processed\n"; + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_RESPONSE, pack->type); + + len = amiheader_find(pack, "Privilege", &hv); + assert_string_equal(hv, "Command"); + + len = amiheader_find(pack, "ActionID", &hv); + assert_string_equal(hv, "12345"); + + len = amiheader_find(pack, "Output", &hv); + assert_string_equal(hv, output_cmp); + + amipack_destroy (pack); +} + +// Command output compatibale with AMI v2 +// Command output is a value of the header "Output: " +static void parse_pack_command_output_v2 (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *hv; // header value + + const char str_pack[] = "Response: Follows\r\n" + "Message: Command output follows\r\n" + "Output: Name/username Host Dyn Forcerport Comedia ACL Port Status Description \r\n" + "8888/8888 (Unspecified) D Auto (No) No 0 Unmonitored \n" + "1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 1 offline]\n" + "--END COMMAND--\r\n\r\n"; + + const char output_cmp[] = "Output: Name/username Host Dyn Forcerport Comedia ACL Port Status Description \r\n" + "8888/8888 (Unspecified) D Auto (No) No 0 Unmonitored \n" + "1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 1 offline]\n"; + + pack = amiparse_pack (str_pack); + assert_int_equal (AMI_RESPONSE, pack->type); + + len = amiheader_find(pack, "Message", &hv); + assert_string_equal(hv, "Command output follows"); + + len = amiheader_find(pack, "Output", &hv); + assert_string_equal(hv, output_cmp); + + amipack_destroy (pack); +} + +static void parse_pack_with_multiple_unknown_headers (void **state) +{ + (void)*state; + AMIPacket *pack; + size_t len; + char *pack_str; + + const char inpack[] = {0x45,0x76,0x65,0x6e,0x74,0x3a,0x20,0x53,0x75,0x63,0x63,0x65,0x73,0x73,0x66,0x75,0x6c,0x41,0x75,0x74,0x68,0x0d,0x0a,0x50,0x72,0x69,0x76,0x69, + 0x6c,0x65,0x67,0x65,0x3a,0x20,0x73,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2c,0x61,0x6c,0x6c,0x0d,0x0a,0x45,0x76,0x65,0x6e,0x74,0x54,0x56,0x3a, + 0x20,0x32,0x30,0x31,0x37,0x2d,0x30,0x34,0x2d,0x30,0x32,0x54,0x31,0x35,0x3a,0x35,0x32,0x3a,0x30,0x38,0x2e,0x30,0x33,0x34,0x2d,0x30,0x34,0x30, + 0x30,0x0d,0x0a,0x53,0x65,0x76,0x65,0x72,0x69,0x74,0x79,0x3a,0x20,0x49,0x6e,0x66,0x6f,0x72,0x6d,0x61,0x74,0x69,0x6f,0x6e,0x61,0x6c,0x0d,0x0a, + 0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x3a,0x20,0x41,0x4d,0x49,0x0d,0x0a,0x45,0x76,0x65,0x6e,0x74,0x56,0x65,0x72,0x73,0x69,0x6f,0x6e,0x3a,0x20, + 0x31,0x0d,0x0a,0x41,0x63,0x63,0x6f,0x75,0x6e,0x74,0x49,0x44,0x3a,0x20,0x61,0x64,0x6d,0x69,0x6e,0x0d,0x0a,0x53,0x65,0x73,0x73,0x69,0x6f,0x6e, + 0x49,0x44,0x3a,0x20,0x30,0x78,0x61,0x31,0x33,0x34,0x65,0x64,0x63,0x0d,0x0a,0x4c,0x6f,0x63,0x61,0x6c,0x41,0x64,0x64,0x72,0x65,0x73,0x73,0x3a, + 0x20,0x49,0x50,0x56,0x34,0x2f,0x54,0x43,0x50,0x2f,0x30,0x2e,0x30,0x2e,0x30,0x2e,0x30,0x2f,0x35,0x30,0x33,0x38,0x0d,0x0a,0x52,0x65,0x6d,0x6f, + 0x74,0x65,0x41,0x64,0x64,0x72,0x65,0x73,0x73,0x3a,0x20,0x49,0x50,0x56,0x34,0x2f,0x54,0x43,0x50,0x2f,0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e, + 0x31,0x2e,0x31,0x32,0x32,0x2f,0x35,0x30,0x34,0x34,0x38,0x0d,0x0a,0x55,0x73,0x69,0x6e,0x67,0x50,0x61,0x73,0x73,0x77,0x6f,0x72,0x64,0x3a,0x20, + 0x30,0x0d,0x0a,0x53,0x65,0x73,0x73,0x69,0x6f,0x6e,0x54,0x56,0x3a,0x20,0x32,0x30,0x31,0x37,0x2d,0x30,0x34,0x2d,0x30,0x32,0x54,0x31,0x35,0x3a, + 0x35,0x32,0x3a,0x30,0x38,0x2e,0x30,0x33,0x34,0x2d,0x30,0x34,0x30,0x30,0x0d,0x0a,0x0d,0x0a}; + + pack = amiparse_pack (inpack); + assert_int_equal (AMI_EVENT, pack->type); + + len = amipack_to_str(pack, &pack_str); + assert_memory_equal (pack_str, inpack, len); + + amipack_destroy (pack); + free(pack_str); +} + +int main(void) +{ + const struct CMUnitTest tests[] = { + cmocka_unit_test (parse_prompt_header_11), + cmocka_unit_test (parse_prompt_header_280), + cmocka_unit_test (parse_not_prompt_pack), + cmocka_unit_test (parse_action_one_header), + cmocka_unit_test (parse_event_one_header), + cmocka_unit_test (parse_response_one_header), + cmocka_unit_test (parse_invalid_pack), + cmocka_unit_test (parse_response_one_header_caseinsen), + cmocka_unit_test (parse_multi_header), + cmocka_unit_test (parse_headers_with_empty_value), + cmocka_unit_test (parse_pack_with_empty_last_header), + cmocka_unit_test (parse_pack_unordered), + cmocka_unit_test (parse_pack_with_invalid_header), + cmocka_unit_test (parse_pack_command_output), + cmocka_unit_test (parse_pack_command_output_v2), + cmocka_unit_test (parse_pack_with_multiple_unknown_headers), + }; + + cmocka_set_message_output(CM_OUTPUT_TAP); + + return cmocka_run_group_tests_name("Parse AMI package tests.", tests, NULL, NULL); +}