diff -Nru libnice-0.1.4/aclocal.m4 libnice-0.1.7/aclocal.m4 --- libnice-0.1.4/aclocal.m4 2013-02-23 00:29:33.000000000 +0000 +++ libnice-0.1.7/aclocal.m4 2014-05-05 18:58:18.000000000 +0000 @@ -1,8 +1,7 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- +# generated automatically by aclocal 1.13.4 -*- Autoconf -*- + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, -# Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -12,13 +11,14 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, -[m4_warning([this file was generated for autoconf 2.68. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) dnl -*- mode: autoconf -*- @@ -59,7 +59,7 @@ dnl don't check for glib if we build glib if test "x$PACKAGE_NAME" != "xglib"; then dnl don't fail if someone does not have glib - PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,) + PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,[:]) fi fi @@ -80,6 +80,10 @@ enable_gtk_doc_pdf=no fi + if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 + fi + AC_SUBST([AM_DEFAULT_VERBOSITY]) AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes]) AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes]) @@ -1394,7 +1398,7 @@ rm -rf conftest* ;; -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext @@ -1408,7 +1412,10 @@ x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; - ppc64-*linux*|powerpc64-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -1427,7 +1434,10 @@ x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -8707,7 +8717,8 @@ # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) @@ -8753,7 +8764,8 @@ pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried @@ -8801,9 +8813,9 @@ AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD @@ -8816,7 +8828,7 @@ Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT]) +_PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) @@ -8827,7 +8839,7 @@ _PKG_TEXT -To get pkg-config, see .]) +To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS @@ -8837,25 +8849,77 @@ fi[]dnl ])# PKG_CHECK_MODULES -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software -# Foundation, Inc. + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + +# Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' +[am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.6], [], +m4_if([$1], [1.13.4], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -8871,24 +8935,81 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.6])dnl +[AM_AUTOMAKE_VERSION([1.13.4])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_AR([ACT-IF-FAIL]) +# ------------------------- +# Try to determine the archiver interface, and trigger the ar-lib wrapper +# if it is needed. If the detection of archiver interface fails, run +# ACT-IF-FAIL (default is to abort configure with a proper error message). +AC_DEFUN([AM_PROG_AR], +[AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + ]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) + # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -8907,7 +9028,7 @@ # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you +# harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -8933,22 +9054,19 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 9 - # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -8967,16 +9085,14 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, -# 2010, 2011 Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -8986,7 +9102,7 @@ # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -8999,12 +9115,13 @@ AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -9012,8 +9129,8 @@ # 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 @@ -9053,16 +9170,16 @@ : > 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 @@ -9071,8 +9188,8 @@ 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 @@ -9080,7 +9197,7 @@ fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # 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} @@ -9128,7 +9245,7 @@ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -9138,9 +9255,13 @@ # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -9155,20 +9276,18 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -#serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ - # 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 @@ -9181,7 +9300,7 @@ # 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. @@ -9193,21 +9312,19 @@ 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"])` @@ -9225,7 +9342,7 @@ # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will +# is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], @@ -9235,15 +9352,12 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 16 - # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -9259,7 +9373,7 @@ # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl +[AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -9288,31 +9402,40 @@ # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl @@ -9323,28 +9446,32 @@ [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], @@ -9372,15 +9499,12 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, -# Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. @@ -9394,16 +9518,14 @@ install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST(install_sh)]) +AC_SUBST([install_sh])]) -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 - # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], @@ -9419,14 +9541,12 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 - # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. @@ -9444,7 +9564,7 @@ _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 @@ -9471,15 +9591,12 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 6 - # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], @@ -9487,11 +9604,10 @@ $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) - # AM_MISSING_HAS_RUN # ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl @@ -9504,54 +9620,22 @@ 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= - AC_MSG_WARN([`missing' script is too old or missing]) + AC_MSG_WARN(['missing' script is too old or missing]) fi ]) -# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, -# Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 1 - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 - # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], @@ -9561,7 +9645,7 @@ # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ @@ -9577,22 +9661,16 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 5 - # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) -# 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=' @@ -9603,32 +9681,40 @@ esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; 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". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - 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". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done test "$[2]" = conftest.file ) then @@ -9638,31 +9724,50 @@ AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT(yes)]) +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) -# Copyright (C) 2009, 2011 Free Software Foundation, Inc. +# Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 - # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT -# (`yes' being less verbose, `no' or empty being verbose). +# ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], -[ --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0')]) -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl -dnl A few `make' implementations (e.g., NonStop OS and NextStep) +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} @@ -9680,7 +9785,7 @@ am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then - dnl Using `$V' instead of `$(V)' breaks IRIX make. + dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else @@ -9697,44 +9802,40 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. +# Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 1 - # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor `install' (even GNU) is that you can't +# One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize +# always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. +# Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 3 - # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. @@ -9748,18 +9849,16 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. +# Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 2 - # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -9769,77 +9868,116 @@ # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar +# AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. + +# We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/as-compiler-flag.m4]) diff -Nru libnice-0.1.4/agent/address.c libnice-0.1.7/agent/address.c --- libnice-0.1.4/agent/address.c 2013-02-01 21:17:30.000000000 +0000 +++ libnice-0.1.7/agent/address.c 2014-04-25 01:46:20.000000000 +0000 @@ -50,6 +50,14 @@ #define inet_pton inet_pton_win32 #define inet_ntop inet_ntop_win32 +/* Defined in recent versions of mingw: + * https://github.com/mirror/mingw-w64/commit/0f4899473c4ba2e34fa447b1931a04e38c1f105e + */ +#ifndef IN6_ARE_ADDR_EQUAL +#define IN6_ARE_ADDR_EQUAL(a, b) \ + (memcmp ((const void *) (a), (const void *) (b), sizeof (struct in6_addr)) == 0) +#endif + static const char * inet_ntop_win32 (int af, const void *src, char *dst, socklen_t cnt) @@ -180,9 +188,9 @@ return ntohs (addr->s.ip4.sin_port); case AF_INET6: return ntohs (addr->s.ip6.sin6_port); + default: + g_return_val_if_reached (0); } - - g_return_val_if_reached (0); } @@ -226,20 +234,25 @@ NICEAPI_EXPORT void nice_address_copy_to_sockaddr (const NiceAddress *addr, - struct sockaddr *sa) + struct sockaddr *_sa) { - struct sockaddr_in *sin4 = (struct sockaddr_in *)sa; - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; + union { + struct sockaddr *addr; + struct sockaddr_in *in; + struct sockaddr_in6 *in6; + } sa; + + sa.addr = _sa; - g_assert (sa); + g_assert (_sa); switch (addr->s.addr.sa_family) { case AF_INET: - memcpy (sin4, &addr->s.ip4, sizeof (*sin4)); + memcpy (sa.in, &addr->s.ip4, sizeof (*sa.in)); break; case AF_INET6: - memcpy (sin6, &addr->s.ip6, sizeof (*sin6)); + memcpy (sa.in6, &addr->s.ip6, sizeof (*sa.in6)); break; default: g_return_if_reached (); @@ -278,9 +291,10 @@ return IN6_ARE_ADDR_EQUAL (&a->s.ip6.sin6_addr, &b->s.ip6.sin6_addr) && (a->s.ip6.sin6_port == b->s.ip6.sin6_port) && (a->s.ip6.sin6_scope_id == b->s.ip6.sin6_scope_id); - } - g_return_val_if_reached (FALSE); + default: + g_return_val_if_reached (FALSE); + } } @@ -325,7 +339,7 @@ { return ( /* fe80::/10 */ - ((addr[0] == 0xfe) && ((addr[1] & 0xc) == 0x80)) || + ((addr[0] == 0xfe) && ((addr[1] & 0xc0) == 0x80)) || /* fc00::/7 */ ((addr[0] & 0xfe) == 0xfc) || /* ::1 loopback */ @@ -345,9 +359,9 @@ return ipv4_address_is_private (a->s.ip4.sin_addr.s_addr); case AF_INET6: return ipv6_address_is_private (a->s.ip6.sin6_addr.s6_addr); + default: + g_return_val_if_reached (FALSE); } - - g_return_val_if_reached (FALSE); } diff -Nru libnice-0.1.4/agent/agent.c libnice-0.1.7/agent/agent.c --- libnice-0.1.4/agent/agent.c 2013-02-05 23:28:20.000000000 +0000 +++ libnice-0.1.7/agent/agent.c 2014-04-28 18:35:48.000000000 +0000 @@ -1,7 +1,7 @@ /* * This file is part of the Nice GLib ICE library. * - * (C) 2006-2010 Collabora Ltd. + * (C) 2006-2010, 2013 Collabora Ltd. * Contact: Youness Alaoui * (C) 2006-2010 Nokia Corporation. All rights reserved. * Contact: Kai Vehmanen @@ -25,6 +25,7 @@ * Dafydd Harries, Collabora Ltd. * Youness Alaoui, Collabora Ltd. * Kai Vehmanen, Nokia + * Philip Withnall, Collabora Ltd. * * Alternatively, the contents of this file may be used under the terms of the * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which @@ -45,6 +46,7 @@ #endif #include +#include #include #include @@ -65,22 +67,26 @@ #include "discovery.h" #include "agent.h" #include "agent-priv.h" -#include "agent-signals-marshal.h" +#include "iostream.h" #include "stream.h" #include "interfaces.h" #include "pseudotcp.h" -/* This is the max size of a UDP packet - * will it work tcp relaying?? - */ -#define MAX_BUFFER_SIZE 65536 +/* Maximum size of a UDP packet’s payload, as the packet’s length field is 16b + * wide. */ +#define MAX_BUFFER_SIZE ((1 << 16) - 1) /* 65535 */ + #define DEFAULT_STUN_PORT 3478 -#define DEFAULT_UPNP_TIMEOUT 200 +#define DEFAULT_UPNP_TIMEOUT 200 /* milliseconds */ #define MAX_TCP_MTU 1400 /* Use 1400 because of VPNs and we assume IEE 802.3 */ +static void +nice_debug_input_message_composition (const NiceInputMessage *messages, + guint n_messages); + G_DEFINE_TYPE (NiceAgent, nice_agent, G_TYPE_OBJECT); enum @@ -113,48 +119,129 @@ SIGNAL_NEW_REMOTE_CANDIDATE, SIGNAL_INITIAL_BINDING_REQUEST_RECEIVED, SIGNAL_RELIABLE_TRANSPORT_WRITABLE, + SIGNAL_STREAMS_REMOVED, N_SIGNALS, }; static guint signals[N_SIGNALS]; #if GLIB_CHECK_VERSION(2,31,8) -static GRecMutex agent_mutex; /* Mutex used for thread-safe lib */ +static GMutex agent_mutex; /* Mutex used for thread-safe lib */ #else -static GStaticRecMutex agent_mutex = G_STATIC_REC_MUTEX_INIT; +static GStaticMutex agent_mutex = G_STATIC_REC_MUTEX_INIT; #endif -static gboolean priv_attach_stream_component (NiceAgent *agent, - Stream *stream, - Component *component); -static void priv_detach_stream_component (Stream *stream, Component *component); - static void priv_free_upnp (NiceAgent *agent); #if GLIB_CHECK_VERSION(2,31,8) void agent_lock (void) { - g_rec_mutex_lock (&agent_mutex); + g_mutex_lock (&agent_mutex); } void agent_unlock (void) { - g_rec_mutex_unlock (&agent_mutex); + g_mutex_unlock (&agent_mutex); } #else void agent_lock(void) { - g_static_rec_mutex_lock (&agent_mutex); + g_static_mutex_lock (&agent_mutex); } void agent_unlock(void) { - g_static_rec_mutex_unlock (&agent_mutex); + g_static_mutex_unlock (&agent_mutex); } #endif +static GType _nice_agent_stream_ids_get_type (void); + +G_DEFINE_POINTER_TYPE (_NiceAgentStreamIds, _nice_agent_stream_ids); + +#define NICE_TYPE_AGENT_STREAM_IDS _nice_agent_stream_ids_get_type () + +typedef struct { + guint signal_id; + GSignalQuery query; + GValue *params; +} QueuedSignal; + + +static void +free_queued_signal (QueuedSignal *sig) +{ + guint i; + + g_value_unset (&sig->params[0]); + + for (i = 0; i < sig->query.n_params; i++) { + if (G_VALUE_HOLDS(&sig->params[i + 1], NICE_TYPE_AGENT_STREAM_IDS)) + g_free (g_value_get_pointer (&sig->params[i + 1])); + g_value_unset (&sig->params[i + 1]); + } + + g_slice_free1 (sizeof(GValue) * (sig->query.n_params + 1), sig->params); + g_slice_free (QueuedSignal, sig); +} + +void +agent_unlock_and_emit (NiceAgent *agent) +{ + GQueue queue = G_QUEUE_INIT; + QueuedSignal *sig; + + queue = agent->pending_signals; + g_queue_init (&agent->pending_signals); + + agent_unlock (); + + while ((sig = g_queue_pop_head (&queue))) { + g_signal_emitv (sig->params, sig->signal_id, 0, NULL); + + free_queued_signal (sig); + } +} + +static void +agent_queue_signal (NiceAgent *agent, guint signal_id, ...) +{ + QueuedSignal *sig; + guint i; + gchar *error = NULL; + va_list var_args; + + sig = g_slice_new (QueuedSignal); + g_signal_query (signal_id, &sig->query); + + sig->signal_id = signal_id; + sig->params = g_slice_alloc0 (sizeof(GValue) * (sig->query.n_params + 1)); + + g_value_init (&sig->params[0], G_TYPE_OBJECT); + g_value_set_object (&sig->params[0], agent); + + va_start (var_args, signal_id); + for (i = 0; i < sig->query.n_params; i++) { + G_VALUE_COLLECT_INIT (&sig->params[i + 1], sig->query.param_types[i], + var_args, 0, &error); + if (error) + break; + } + va_end (var_args); + + if (error) { + free_queued_signal (sig); + g_critical ("Error collecting values for signal: %s", error); + g_free (error); + return; + } + + g_queue_push_tail (&agent->pending_signals, sig); +} + + StunUsageIceCompatibility agent_to_ice_compatibility (NiceAgent *agent) { @@ -463,8 +550,8 @@ /** * NiceAgent:upnp-timeout: * - * The maximum amount of time to wait for UPnP discovery to finish before - * signaling the #NiceAgent::candidate-gathering-done signal + * The maximum amount of time (in milliseconds) to wait for UPnP discovery to + * finish before signaling the #NiceAgent::candidate-gathering-done signal * * Since: 0.0.7 */ @@ -519,7 +606,7 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT_UINT_UINT, + NULL, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, @@ -541,7 +628,7 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT, + NULL, G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_INVALID); @@ -565,7 +652,7 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT_UINT_STRING_STRING, + NULL, G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, @@ -578,7 +665,7 @@ * @component_id: The ID of the component * @foundation: The foundation of the new candidate * - * This signal is fired when the agent discovers a new candidate + * This signal is fired when the agent discovers a new local candidate. * See also: #NiceAgent::candidate-gathering-done */ signals[SIGNAL_NEW_CANDIDATE] = @@ -589,7 +676,7 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT_UINT_STRING, + NULL, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, @@ -613,7 +700,7 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT_UINT_STRING, + NULL, G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, @@ -635,7 +722,7 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT, + NULL, G_TYPE_NONE, 1, G_TYPE_UINT, @@ -663,12 +750,36 @@ 0, NULL, NULL, - agent_marshal_VOID__UINT_UINT, + NULL, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID); + /** + * NiceAgent::streams-removed + * @agent: The #NiceAgent object + * @stream_ids: (array zero-terminated=1) (element-type uint): An array of + * unsigned integer stream IDs, ending with a 0 ID + * + * This signal is fired whenever one or more streams are removed from the + * @agent. + * + * Since: 0.1.5 + */ + signals[SIGNAL_STREAMS_REMOVED] = + g_signal_new ( + "streams-removed", + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, + 1, + NICE_TYPE_AGENT_STREAM_IDS, + G_TYPE_INVALID); /* Init debug options depending on env variables */ nice_debug_init (); @@ -709,6 +820,8 @@ agent->rng = nice_rng_new (); priv_generate_tie_breaker (agent); + + g_queue_init (&agent->pending_signals); } @@ -828,7 +941,7 @@ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } - agent_unlock(); + agent_unlock_and_emit(agent); } @@ -958,38 +1071,31 @@ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } - agent_unlock(); - -} - + agent_unlock_and_emit (agent); -static void priv_destroy_component_tcp (Component *component) -{ - if (component->tcp_clock) { - g_source_destroy (component->tcp_clock); - g_source_unref (component->tcp_clock); - component->tcp_clock = NULL; - } - if (component->tcp) { - pseudo_tcp_socket_close (component->tcp, TRUE); - g_object_unref (component->tcp); - component->tcp = NULL; - } - if (component->tcp_data != NULL) { - g_slice_free (TcpUserData, component->tcp_data); - component->tcp_data = NULL; - } } static void priv_pseudo_tcp_error (NiceAgent *agent, Stream *stream, Component *component) { + if (component->tcp_writable_cancellable) { + g_cancellable_cancel (component->tcp_writable_cancellable); + g_clear_object (&component->tcp_writable_cancellable); + } + if (component->tcp) { agent_signal_component_state_change (agent, stream->id, component->id, NICE_COMPONENT_STATE_FAILED); - priv_detach_stream_component (stream, component); + component_detach_all_sockets (component); + pseudo_tcp_socket_close (component->tcp, TRUE); + g_clear_object (&component->tcp); + } + + if (component->tcp_clock) { + g_source_destroy (component->tcp_clock); + g_source_unref (component->tcp_clock); + component->tcp_clock = NULL; } - priv_destroy_component_tcp (component); } static void @@ -999,85 +1105,273 @@ static void pseudo_tcp_socket_opened (PseudoTcpSocket *sock, gpointer user_data) { - TcpUserData *data = (TcpUserData *)user_data; - NiceAgent *agent = data->agent; - Component *component = data->component; - Stream *stream = data->stream; + Component *component = user_data; + NiceAgent *agent = component->agent; + Stream *stream = component->stream; - nice_debug ("Agent %p: s%d:%d pseudo Tcp socket Opened", data->agent, + nice_debug ("Agent %p: s%d:%d pseudo Tcp socket Opened", agent, stream->id, component->id); - g_signal_emit (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], 0, + g_cancellable_cancel (component->tcp_writable_cancellable); + + agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], stream->id, component->id); } +/* Will attempt to queue all @n_messages into the pseudo-TCP transmission + * buffer. This is always used in reliable mode, so essentially treats @messages + * as a massive flat array of buffers. + * + * Returns the number of messages successfully sent on success (which may be + * zero if sending the first buffer of the message would have blocked), or + * a negative number on error. If "allow_partial" is TRUE, then it returns + * the number of bytes sent + */ +static gint +pseudo_tcp_socket_send_messages (PseudoTcpSocket *self, + const NiceOutputMessage *messages, guint n_messages, gboolean allow_partial, + GError **error) +{ + guint i; + gint bytes_sent = 0; + + for (i = 0; i < n_messages; i++) { + const NiceOutputMessage *message = &messages[i]; + guint j; + + /* If allow_partial is FALSE and there’s not enough space for the + * entire message, bail now before queuing anything. This doesn’t + * gel with the fact this function is only used in reliable mode, + * and there is no concept of a ‘message’, but is necessary + * because the calling API has no way of returning to the client + * and indicating that a message was partially sent. */ + if (!allow_partial && + output_message_get_size (message) > + pseudo_tcp_socket_get_available_send_space (self)) { + return i; + } + + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + const GOutputVector *buffer = &message->buffers[j]; + gssize ret; + + /* Send on the pseudo-TCP socket. */ + ret = pseudo_tcp_socket_send (self, buffer->buffer, buffer->size); + + /* In case of -1, the error is either EWOULDBLOCK or ENOTCONN, which both + * need the user to wait for the reliable-transport-writable signal */ + if (ret < 0) { + if (pseudo_tcp_socket_get_error (self) == EWOULDBLOCK) + goto out; + + if (pseudo_tcp_socket_get_error (self) == ENOTCONN) + g_set_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, + "TCP connection is not yet established."); + else + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Error writing data to pseudo-TCP socket."); + return -1; + } else { + bytes_sent += ret; + } + } + } + + out: + + return allow_partial ? bytes_sent : (gint) i; +} + +/* Will fill up @messages from the first free byte onwards (as determined using + * @iter). This is always used in reliable mode, so it essentially treats + * @messages as a massive flat array of buffers. + * + * Updates @iter in place. @iter and @messages are left in invalid states if + * an error is returned. + * + * Returns the number of valid messages in @messages on success (which may be + * zero if reading into the first buffer of the message would have blocked), or + * a negative number on error. */ +static gint +pseudo_tcp_socket_recv_messages (PseudoTcpSocket *self, + NiceInputMessage *messages, guint n_messages, NiceInputMessageIter *iter, + GError **error) +{ + for (; iter->message < n_messages; iter->message++) { + NiceInputMessage *message = &messages[iter->message]; + + if (iter->buffer == 0 && iter->offset == 0) { + message->length = 0; + } + + for (; + (message->n_buffers >= 0 && iter->buffer < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[iter->buffer].buffer != NULL); + iter->buffer++) { + GInputVector *buffer = &message->buffers[iter->buffer]; + + do { + gssize len; + + len = pseudo_tcp_socket_recv (self, + (gchar *) buffer->buffer + iter->offset, + buffer->size - iter->offset); + + nice_debug ("%s: Received %" G_GSSIZE_FORMAT " bytes into " + "buffer %p (offset %" G_GSIZE_FORMAT ", length %" G_GSIZE_FORMAT + ").", G_STRFUNC, len, buffer->buffer, iter->offset, buffer->size); + + if (len < 0 && pseudo_tcp_socket_get_error (self) == EWOULDBLOCK) { + len = 0; + goto done; + } else if (len < 0 && pseudo_tcp_socket_get_error (self) == ENOTCONN) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, + "Error reading data from pseudo-TCP socket: not connected."); + return len; + } else if (len < 0) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Error reading data from pseudo-TCP socket."); + return len; + } else { + /* Got some data! */ + message->length += len; + iter->offset += len; + } + } while (iter->offset < buffer->size); + + iter->offset = 0; + } + + iter->buffer = 0; + } + +done: + return nice_input_message_iter_get_n_valid_messages (iter); +} + +/* This is called with the agent lock held. */ static void pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) { - TcpUserData *data = (TcpUserData *)user_data; - NiceAgent *agent = data->agent; - Component *component = data->component; - Stream *stream = data->stream; - gchar buf[MAX_BUFFER_SIZE]; - gint len; + Component *component = user_data; + NiceAgent *agent = component->agent; + Stream *stream = component->stream; + gboolean has_io_callback; + guint stream_id = stream->id; + guint component_id = component->id; + + g_object_ref (agent); nice_debug ("Agent %p: s%d:%d pseudo Tcp socket readable", agent, stream->id, component->id); component->tcp_readable = TRUE; - g_object_add_weak_pointer (G_OBJECT (sock), (gpointer *)&sock); - g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *)&agent); + has_io_callback = component_has_io_callback (component); + + /* Only dequeue pseudo-TCP data if we can reliably inform the client. The + * agent lock is held here, so has_io_callback can only change during + * component_emit_io_callback(), after which it’s re-queried. This ensures + * no data loss of packets already received and dequeued. */ + if (has_io_callback) { + do { + guint8 buf[MAX_BUFFER_SIZE]; + gssize len; + + /* FIXME: Why copy into a temporary buffer here? Why can’t the I/O + * callbacks be emitted directly from the pseudo-TCP receive buffer? */ + len = pseudo_tcp_socket_recv (sock, (gchar *) buf, sizeof(buf)); + + nice_debug ("%s: I/O callback case: Received %" G_GSSIZE_FORMAT " bytes", + G_STRFUNC, len); + + if (len == 0) { + component->tcp_readable = FALSE; + break; + } else if (len <= 0) { + /* Handle errors. */ + if (pseudo_tcp_socket_get_error (sock) != EWOULDBLOCK) { + nice_debug ("%s: calling priv_pseudo_tcp_error()", G_STRFUNC); + priv_pseudo_tcp_error (agent, stream, component); + + if (component->recv_buf_error != NULL) { + GIOErrorEnum error_code; + + if (pseudo_tcp_socket_get_error (sock) == ENOTCONN) + error_code = G_IO_ERROR_BROKEN_PIPE; + else + error_code = G_IO_ERROR_FAILED; + + g_set_error (component->recv_buf_error, G_IO_ERROR, error_code, + "Error reading data from pseudo-TCP socket."); + } + } - do { - if (component->g_source_io_cb) - len = pseudo_tcp_socket_recv (sock, buf, sizeof(buf)); - else - len = 0; - - if (len > 0) { - gpointer data = component->data; - gint sid = stream->id; - gint cid = component->id; - NiceAgentRecvFunc callback = component->g_source_io_cb; - /* Unlock the agent before calling the callback */ - agent_unlock(); - callback (agent, sid, cid, len, buf, data); - agent_lock(); - if (sock == NULL) { - nice_debug ("PseudoTCP socket got destroyed in readable callback!"); break; } - } else if (len < 0 && - pseudo_tcp_socket_get_error (sock) != EWOULDBLOCK) { - /* Signal error */ + + component_emit_io_callback (component, buf, len); + + if (!agent_find_component (agent, stream_id, component_id, + &stream, &component)) { + nice_debug ("Stream or Component disappeared during the callback"); + goto out; + } + if (!component->tcp) { + nice_debug ("PseudoTCP socket got destroyed in readable callback!"); + goto out; + } + + has_io_callback = component_has_io_callback (component); + } while (has_io_callback); + } else if (component->recv_messages != NULL) { + gint n_valid_messages; + + /* Fill up every buffer in every message until the connection closes or an + * error occurs. Copy the data directly into the client’s receive message + * array without making any callbacks. Update component->recv_messages_iter + * as we go. */ + n_valid_messages = pseudo_tcp_socket_recv_messages (sock, + component->recv_messages, component->n_recv_messages, + &component->recv_messages_iter, component->recv_buf_error); + + nice_debug ("%s: Client buffers case: Received %d valid messages:", + G_STRFUNC, n_valid_messages); + nice_debug_input_message_composition (component->recv_messages, + component->n_recv_messages); + + if (n_valid_messages < 0) { + nice_debug ("%s: calling priv_pseudo_tcp_error()", G_STRFUNC); priv_pseudo_tcp_error (agent, stream, component); - } else if (len < 0 && - pseudo_tcp_socket_get_error (sock) == EWOULDBLOCK){ + } else if (n_valid_messages == 0) { component->tcp_readable = FALSE; } - } while (len > 0); - - if (agent) { - adjust_tcp_clock (agent, stream, component); - g_object_remove_weak_pointer (G_OBJECT (agent), (gpointer *)&agent); } else { - nice_debug ("Not calling adjust_tcp_clock.. agent got destroyed!"); + nice_debug ("%s: no data read", G_STRFUNC); } - if (sock) - g_object_remove_weak_pointer (G_OBJECT (sock), (gpointer *)&sock); + + if (stream && component) + adjust_tcp_clock (agent, stream, component); + +out: + + g_object_unref (agent); + } static void pseudo_tcp_socket_writable (PseudoTcpSocket *sock, gpointer user_data) { - TcpUserData *data = (TcpUserData *)user_data; - NiceAgent *agent = data->agent; - Component *component = data->component; - Stream *stream = data->stream; - - nice_debug ("Agent %p: s%d:%d pseudo Tcp socket writable", data->agent, - data->stream->id, data->component->id); - g_signal_emit (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], 0, + Component *component = user_data; + NiceAgent *agent = component->agent; + Stream *stream = component->stream; + + nice_debug ("Agent %p: s%d:%d pseudo Tcp socket writable", agent, + stream->id, component->id); + g_cancellable_cancel (component->tcp_writable_cancellable); + agent_queue_signal (agent, signals[SIGNAL_RELIABLE_TRANSPORT_WRITABLE], stream->id, component->id); } @@ -1085,42 +1379,46 @@ pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err, gpointer user_data) { - TcpUserData *data = (TcpUserData *)user_data; - NiceAgent *agent = data->agent; - Component *component = data->component; - Stream *stream = data->stream; + Component *component = user_data; + NiceAgent *agent = component->agent; + Stream *stream = component->stream; - nice_debug ("Agent %p: s%d:%d pseudo Tcp socket closed", agent, - stream->id, component->id); + nice_debug ("Agent %p: s%d:%d pseudo Tcp socket closed. " + "Calling priv_pseudo_tcp_error().", agent, stream->id, component->id); priv_pseudo_tcp_error (agent, stream, component); } static PseudoTcpWriteResult -pseudo_tcp_socket_write_packet (PseudoTcpSocket *sock, +pseudo_tcp_socket_write_packet (PseudoTcpSocket *psocket, const gchar *buffer, guint32 len, gpointer user_data) { - TcpUserData *data = (TcpUserData *)user_data; - Component *component = data->component; + Component *component = user_data; if (component->selected_pair.local != NULL) { NiceSocket *sock; NiceAddress *addr; -#ifndef NDEBUG - gchar tmpbuf[INET6_ADDRSTRLEN]; - nice_address_to_string (&component->selected_pair.remote->addr, tmpbuf); + sock = component->selected_pair.local->sockptr; - nice_debug ("Agent %p : s%d:%d: sending %d bytes to [%s]:%d", data->agent, - data->stream->id, component->id, len, tmpbuf, - nice_address_get_port (&component->selected_pair.remote->addr)); -#endif + if (nice_debug_is_enabled ()) { + gchar tmpbuf[INET6_ADDRSTRLEN]; + nice_address_to_string (&component->selected_pair.remote->addr, tmpbuf); + + nice_debug ( + "Agent %p : s%d:%d: sending %d bytes on socket %p (FD %d) to [%s]:%d", + component->agent, component->stream->id, component->id, len, + sock->fileno, g_socket_get_fd (sock->fileno), tmpbuf, + nice_address_get_port (&component->selected_pair.remote->addr)); + } - sock = component->selected_pair.local->sockptr; addr = &component->selected_pair.remote->addr; - if (nice_socket_send (sock, addr, len, buffer)) { + + if (nice_socket_send (sock, addr, len, buffer)) return WR_SUCCESS; - } + } else { + nice_debug ("%s: WARNING: Failed to send pseudo-TCP packet from agent %p " + "as no pair has been selected yet.", G_STRFUNC, component->agent); } return WR_FAIL; @@ -1130,10 +1428,9 @@ static gboolean notify_pseudo_tcp_socket_clock (gpointer user_data) { - TcpUserData *data = (TcpUserData *)user_data; - Component *component = data->component; - Stream *stream = data->stream; - NiceAgent *agent = data->agent; + Component *component = user_data; + Stream *stream = component->stream; + NiceAgent *agent = component->agent; agent_lock(); @@ -1143,35 +1440,46 @@ agent_unlock (); return FALSE; } - if (component->tcp_clock) { - g_source_destroy (component->tcp_clock); - g_source_unref (component->tcp_clock); - component->tcp_clock = NULL; - } pseudo_tcp_socket_notify_clock (component->tcp); adjust_tcp_clock (agent, stream, component); - agent_unlock(); + agent_unlock_and_emit (agent); - return FALSE; + return G_SOURCE_CONTINUE; } static void adjust_tcp_clock (NiceAgent *agent, Stream *stream, Component *component) { - long timeout = 0; if (component->tcp) { + guint64 timeout = component->last_clock_timeout; + if (pseudo_tcp_socket_get_next_clock (component->tcp, &timeout)) { - if (component->tcp_clock) { - g_source_destroy (component->tcp_clock); - g_source_unref (component->tcp_clock); - component->tcp_clock = NULL; + if (timeout != component->last_clock_timeout) { + component->last_clock_timeout = timeout; + if (component->tcp_clock) { +#if GLIB_CHECK_VERSION (2, 36, 0) + g_source_set_ready_time (component->tcp_clock, timeout * 1000); +#else + g_source_destroy (component->tcp_clock); + g_source_unref (component->tcp_clock); + component->tcp_clock = NULL; +#endif + } + if (!component->tcp_clock) { + long interval = timeout - (g_get_monotonic_time () / 1000); + + /* Prevent integer overflows */ + if (interval < 0 || interval > G_MAXINT) + interval = 0; + component->tcp_clock = agent_timeout_add_with_context (agent, interval, + notify_pseudo_tcp_socket_clock, component); + } } - component->tcp_clock = agent_timeout_add_with_context (agent, - timeout, notify_pseudo_tcp_socket_clock, component->tcp_data); } else { - nice_debug ("Agent %p: component %d pseudo tcp socket should be destroyed", + nice_debug ("Agent %p: component %d pseudo-TCP socket should be " + "destroyed. Calling priv_pseudo_tcp_error().", agent, component->id); priv_pseudo_tcp_error (agent, stream, component); } @@ -1191,7 +1499,7 @@ for (k = component->local_candidates; k; k = k->next) { NiceCandidate *local_candidate = k->data; - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN]; nice_address_to_string (&local_candidate->addr, tmpbuf); nice_debug ("Agent %p: gathered local candidate : [%s]:%u" @@ -1236,7 +1544,8 @@ Stream *stream = i->data; if (stream->gathering) { stream->gathering = FALSE; - g_signal_emit (agent, signals[SIGNAL_CANDIDATE_GATHERING_DONE], 0, stream->id); + agent_queue_signal (agent, signals[SIGNAL_CANDIDATE_GATHERING_DONE], + stream->id); } } } @@ -1245,7 +1554,60 @@ { if (stream->initial_binding_request_received != TRUE) { stream->initial_binding_request_received = TRUE; - g_signal_emit (agent, signals[SIGNAL_INITIAL_BINDING_REQUEST_RECEIVED], 0, stream->id); + agent_queue_signal (agent, signals[SIGNAL_INITIAL_BINDING_REQUEST_RECEIVED], + stream->id); + } +} + +/* If the Component now has a selected_pair, and has pending TCP packets which + * it couldn’t receive before due to not being able to send out ACKs (or + * SYNACKs, for the initial SYN packet), handle them now. + * + * Must be called with the agent lock held. */ +static void +process_queued_tcp_packets (NiceAgent *agent, Stream *stream, + Component *component) +{ + GOutputVector *vec; + guint stream_id = stream->id; + guint component_id = component->id; + + if (component->selected_pair.local == NULL || component->tcp == NULL) + return; + + nice_debug ("%s: Sending outstanding packets for agent %p.", G_STRFUNC, + agent); + + while ((vec = g_queue_peek_head (&component->queued_tcp_packets)) != NULL) { + gboolean retval; + + nice_debug ("%s: Sending %" G_GSIZE_FORMAT " bytes.", G_STRFUNC, vec->size); + retval = + pseudo_tcp_socket_notify_packet (component->tcp, vec->buffer, + vec->size); + + if (!agent_find_component (agent, stream_id, component_id, + &stream, &component)) { + nice_debug ("Stream or Component disappeared during " + "pseudo_tcp_socket_notify_packet()"); + return; + } + if (!component->tcp) { + nice_debug ("PseudoTCP socket got destroyed in" + " pseudo_tcp_socket_notify_packet()!"); + return; + } + + adjust_tcp_clock (agent, stream, component); + + if (!retval) { + /* Failed to send; try again later. */ + break; + } + + g_queue_pop_head (&component->queued_tcp_packets); + g_free ((gpointer) vec->buffer); + g_slice_free (GOutputVector, vec); } } @@ -1253,8 +1615,6 @@ { Component *component; Stream *stream; - gchar *lf_copy; - gchar *rf_copy; if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) @@ -1266,6 +1626,8 @@ } if (component->tcp) { + process_queued_tcp_packets (agent, stream, component); + pseudo_tcp_socket_connect (component->tcp); pseudo_tcp_socket_notify_mtu (component->tcp, MAX_TCP_MTU); adjust_tcp_clock (agent, stream, component); @@ -1274,34 +1636,24 @@ return; } - lf_copy = g_strdup (local_foundation); - rf_copy = g_strdup (remote_foundation); - - g_signal_emit (agent, signals[SIGNAL_NEW_SELECTED_PAIR], 0, - stream_id, component_id, lf_copy, rf_copy); - - g_free (lf_copy); - g_free (rf_copy); + agent_queue_signal (agent, signals[SIGNAL_NEW_SELECTED_PAIR], + stream_id, component_id, local_foundation, remote_foundation); } void agent_signal_new_candidate (NiceAgent *agent, NiceCandidate *candidate) { - g_signal_emit (agent, signals[SIGNAL_NEW_CANDIDATE], 0, - candidate->stream_id, - candidate->component_id, - candidate->foundation); + agent_queue_signal (agent, signals[SIGNAL_NEW_CANDIDATE], + candidate->stream_id, candidate->component_id, candidate->foundation); } void agent_signal_new_remote_candidate (NiceAgent *agent, NiceCandidate *candidate) { - g_signal_emit (agent, signals[SIGNAL_NEW_REMOTE_CANDIDATE], 0, - candidate->stream_id, - candidate->component_id, - candidate->foundation); + agent_queue_signal (agent, signals[SIGNAL_NEW_REMOTE_CANDIDATE], + candidate->stream_id, candidate->component_id, candidate->foundation); } -static const gchar * -component_state_to_string (NiceComponentState state) +NICEAPI_EXPORT const gchar * +nice_component_state_to_string (NiceComponentState state) { switch (state) { @@ -1318,10 +1670,9 @@ case NICE_COMPONENT_STATE_FAILED: return "failed"; case NICE_COMPONENT_STATE_LAST: - break; + default: + return "invalid"; } - - return "invalid"; } void agent_signal_component_state_change (NiceAgent *agent, guint stream_id, guint component_id, NiceComponentState state) @@ -1335,21 +1686,23 @@ if (agent->reliable && component->tcp == NULL && state != NICE_COMPONENT_STATE_FAILED) { - nice_debug ("Agent %p: not changing component state for s%d:%d to %d " + nice_debug ("Agent %p: not changing component state for s%d:%d to %s " "because pseudo tcp socket does not exist in reliable mode", agent, - stream->id, component->id, state); + stream->id, component->id, nice_component_state_to_string (state)); return; } if (component->state != state && state < NICE_COMPONENT_STATE_LAST) { nice_debug ("Agent %p : stream %u component %u STATE-CHANGE %s -> %s.", agent, - stream_id, component_id, component_state_to_string (component->state), - component_state_to_string (state)); + stream_id, component_id, nice_component_state_to_string (component->state), + nice_component_state_to_string (state)); component->state = state; - g_signal_emit (agent, signals[SIGNAL_COMPONENT_STATE_CHANGED], 0, - stream_id, component_id, state); + process_queued_tcp_packets (agent, stream, component); + + agent_queue_signal (agent, signals[SIGNAL_COMPONENT_STATE_CHANGED], + stream_id, component_id, state); } } @@ -1364,7 +1717,7 @@ static void priv_add_new_candidate_discovery_stun (NiceAgent *agent, - NiceSocket *socket, NiceAddress server, + NiceSocket *nicesock, NiceAddress server, Stream *stream, guint component_id) { CandidateDiscovery *cdisco; @@ -1375,7 +1728,7 @@ cdisco = g_slice_new0 (CandidateDiscovery); cdisco->type = NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE; - cdisco->nicesock = socket; + cdisco->nicesock = nicesock; cdisco->server = server; cdisco->stream = stream; cdisco->component = stream_find_component_by_id (stream, component_id); @@ -1395,7 +1748,7 @@ static void priv_add_new_candidate_discovery_turn (NiceAgent *agent, - NiceSocket *socket, TurnServer *turn, + NiceSocket *nicesock, TurnServer *turn, Stream *stream, guint component_id) { CandidateDiscovery *cdisco; @@ -1409,69 +1762,65 @@ if (turn->type == NICE_RELAY_TYPE_TURN_UDP) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { - NiceAddress addr = socket->addr; + NiceAddress addr = nicesock->addr; NiceSocket *new_socket; nice_address_set_port (&addr, 0); new_socket = nice_udp_bsd_socket_new (&addr); if (new_socket) { _priv_set_socket_tos (agent, new_socket, stream->tos); - agent_attach_stream_component_socket (agent, stream, - component, new_socket); - component->sockets= g_slist_append (component->sockets, new_socket); - socket = new_socket; + component_attach_socket (component, new_socket); + nicesock = new_socket; } } - cdisco->nicesock = socket; + cdisco->nicesock = nicesock; } else { NiceAddress proxy_server; - socket = NULL; + nicesock = NULL; if (agent->proxy_type != NICE_PROXY_TYPE_NONE && agent->proxy_ip != NULL && nice_address_set_from_string (&proxy_server, agent->proxy_ip)) { nice_address_set_port (&proxy_server, agent->proxy_port); - socket = nice_tcp_bsd_socket_new (agent->main_context, &proxy_server); + nicesock = nice_tcp_bsd_socket_new (agent->main_context, &proxy_server); - if (socket) { - _priv_set_socket_tos (agent, socket, stream->tos); + if (nicesock) { + _priv_set_socket_tos (agent, nicesock, stream->tos); if (agent->proxy_type == NICE_PROXY_TYPE_SOCKS5) { - socket = nice_socks5_socket_new (socket, &turn->server, + nicesock = nice_socks5_socket_new (nicesock, &turn->server, agent->proxy_username, agent->proxy_password); } else if (agent->proxy_type == NICE_PROXY_TYPE_HTTP){ - socket = nice_http_socket_new (socket, &turn->server, + nicesock = nice_http_socket_new (nicesock, &turn->server, agent->proxy_username, agent->proxy_password); } else { - nice_socket_free (socket); - socket = NULL; + nice_socket_free (nicesock); + nicesock = NULL; } } } - if (socket == NULL) { - socket = nice_tcp_bsd_socket_new (agent->main_context, &turn->server); + if (nicesock == NULL) { + nicesock = nice_tcp_bsd_socket_new (agent->main_context, &turn->server); - if (socket) - _priv_set_socket_tos (agent, socket, stream->tos); + if (nicesock) + _priv_set_socket_tos (agent, nicesock, stream->tos); } /* The TURN server may be invalid or not listening */ - if (socket == NULL) + if (nicesock == NULL) return; if (turn->type == NICE_RELAY_TYPE_TURN_TLS && agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { - socket = nice_pseudossl_socket_new (socket); + nicesock = nice_pseudossl_socket_new (nicesock); } - cdisco->nicesock = nice_tcp_turn_socket_new (socket, + cdisco->nicesock = nice_tcp_turn_socket_new (nicesock, agent_to_turn_socket_compatibility (agent)); - agent_attach_stream_component_socket (agent, stream, - component, cdisco->nicesock); - component->sockets = g_slist_append (component->sockets, cdisco->nicesock); + component_attach_socket (component, cdisco->nicesock); } - cdisco->turn = turn; + cdisco->turn = turn_server_ref (turn); cdisco->server = turn->server; cdisco->stream = stream; @@ -1518,7 +1867,7 @@ guint i; agent_lock(); - stream = stream_new (n_components); + stream = stream_new (n_components, agent); agent->streams = g_slist_append (agent->streams, stream); stream->id = agent->next_stream_id++; @@ -1528,18 +1877,14 @@ for (i = 0; i < n_components; i++) { Component *component = stream_find_component_by_id (stream, i + 1); if (component) { - TcpUserData *data = g_slice_new0 (TcpUserData); - PseudoTcpCallbacks tcp_callbacks = {data, + PseudoTcpCallbacks tcp_callbacks = {component, pseudo_tcp_socket_opened, pseudo_tcp_socket_readable, pseudo_tcp_socket_writable, pseudo_tcp_socket_closed, pseudo_tcp_socket_write_packet}; - data->agent = agent; - data->stream = stream; - data->component = component; - component->tcp_data = data; component->tcp = pseudo_tcp_socket_new (0, &tcp_callbacks); + component->tcp_writable_cancellable = g_cancellable_new (); adjust_tcp_clock (agent, stream, component); nice_debug ("Agent %p: Create Pseudo Tcp Socket for component %d", agent, i+1); @@ -1553,7 +1898,7 @@ ret = stream->id; - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -1567,6 +1912,9 @@ { Component *component = NULL; + Stream *stream = NULL; + gboolean ret = TRUE; + TurnServer *turn; g_return_val_if_fail (server_ip, FALSE); g_return_val_if_fail (server_port, FALSE); @@ -1576,42 +1924,59 @@ agent_lock(); - if (agent_find_component (agent, stream_id, component_id, NULL, &component)) { - TurnServer *turn = g_slice_new0 (TurnServer); - nice_address_init (&turn->server); + if (!agent_find_component (agent, stream_id, component_id, &stream, + &component)) { + ret = FALSE; + goto done; + } + + turn = turn_server_new (server_ip, server_port, username, password, type); - if (nice_address_set_from_string (&turn->server, server_ip)) { - nice_address_set_port (&turn->server, server_port); - } else { - g_slice_free (TurnServer, turn); - agent_unlock(); - return FALSE; - } + if (!turn) { + ret = FALSE; + goto done; + } + + nice_debug ("Agent %p: added relay server [%s]:%d of type %d to s/c %d/%d " + "with user/pass : %s -- %s", agent, server_ip, server_port, type, + stream_id, component_id, username, password); + component->turn_servers = g_list_append (component->turn_servers, turn); - turn->username = g_strdup (username); - turn->password = g_strdup (password); - turn->type = type; + if (stream->gathering_started) { + GSList *i; + + for (i = component->local_candidates; i; i = i->next) { + NiceCandidate *candidate = i->data; - nice_debug ("Agent %p: added relay server [%s]:%d of type %d", agent, - server_ip, server_port, type); + if (candidate->type == NICE_CANDIDATE_TYPE_HOST) + priv_add_new_candidate_discovery_turn (agent, + candidate->sockptr, turn, stream, + component_id); + } - component->turn_servers = g_list_append (component->turn_servers, turn); + if (agent->discovery_unsched_items) + discovery_schedule (agent); } - agent_unlock(); - return TRUE; + + done: + + agent_unlock_and_emit (agent); + return ret; } #ifdef HAVE_GUPNP +static void agent_check_upnp_gathering_done (NiceAgent *agent); + static gboolean priv_upnp_timeout_cb (gpointer user_data) { NiceAgent *agent = (NiceAgent*)user_data; - GSList *i; agent_lock(); + /* If the source has been destroyed, we have already freed all mappings. */ if (g_source_is_destroyed (g_main_current_source ())) { agent_unlock (); return FALSE; @@ -1619,13 +1984,29 @@ nice_debug ("Agent %p : UPnP port mapping timed out", agent); - for (i = agent->upnp_mapping; i; i = i->next) { - NiceAddress *a = i->data; - nice_address_free (a); - } - g_slist_free (agent->upnp_mapping); + /* We cannot free priv->upnp here as it may be holding mappings open which + * we are using (e.g. if some mappings were successful and others errored). */ + g_slist_free_full (agent->upnp_mapping, (GDestroyNotify) nice_address_free); agent->upnp_mapping = NULL; + agent_check_upnp_gathering_done (agent); + + agent_unlock_and_emit (agent); + return FALSE; +} + +/* Check whether UPnP gathering is done, which is true when the list of pending + * mappings (upnp_mapping) is empty. When it is empty, we have heard back from + * gupnp-igd about each of the mappings we added, either successfully or not. + * + * Note that upnp_mapping has to be a list, rather than a counter, as the + * mapped-external-port and error-mapping-port signals could be emitted multiple + * times for each mapping. */ +static void agent_check_upnp_gathering_done (NiceAgent *agent) +{ + if (agent->upnp_mapping != NULL) + return; + if (agent->upnp_timer_source != NULL) { g_source_destroy (agent->upnp_timer_source); g_source_unref (agent->upnp_timer_source); @@ -1633,9 +2014,6 @@ } agent_gathering_done (agent); - - agent_unlock(); - return FALSE; } static void _upnp_mapped_external_port (GUPnPSimpleIgd *self, gchar *proto, @@ -1691,16 +2069,9 @@ } end: - if (g_slist_length (agent->upnp_mapping) == 0) { - if (agent->upnp_timer_source != NULL) { - g_source_destroy (agent->upnp_timer_source); - g_source_unref (agent->upnp_timer_source); - agent->upnp_timer_source = NULL; - } - agent_gathering_done (agent); - } + agent_check_upnp_gathering_done (agent); - agent_unlock(); + agent_unlock_and_emit (agent); } static void _upnp_error_mapping_port (GUPnPSimpleIgd *self, GError *error, @@ -1727,17 +2098,10 @@ } } - if (g_slist_length (agent->upnp_mapping) == 0) { - if (agent->upnp_timer_source != NULL) { - g_source_destroy (agent->upnp_timer_source); - g_source_unref (agent->upnp_timer_source); - agent->upnp_timer_source = NULL; - } - agent_gathering_done (agent); - } + agent_check_upnp_gathering_done (agent); } - agent_unlock(); + agent_unlock_and_emit (agent); } #endif @@ -1757,10 +2121,16 @@ stream = agent_find_stream (agent, stream_id); if (stream == NULL) { - agent_unlock(); + agent_unlock_and_emit (agent); return FALSE; } + if (stream->gathering_started) { + /* Stream is already gathering, ignore this call */ + agent_unlock_and_emit (agent); + return TRUE; + } + nice_debug ("Agent %p : In %s mode, starting candidate gathering.", agent, agent->full_mode ? "ICE-FULL" : "ICE-LITE"); @@ -1808,9 +2178,9 @@ } else { for (i = agent->local_addresses; i; i = i->next) { NiceAddress *addr = i->data; - NiceAddress *dup = nice_address_dup (addr); + NiceAddress *dupaddr = nice_address_dup (addr); - local_addresses = g_slist_append (local_addresses, dup); + local_addresses = g_slist_append (local_addresses, dupaddr); } } @@ -1827,11 +2197,16 @@ for (n = 0; n < stream->n_components; n++) { Component *component = stream_find_component_by_id (stream, n + 1); guint current_port; + guint start_port; if (component == NULL) continue; - current_port = component->min_port; + start_port = component->min_port; + if(component->min_port != 0) { + start_port = nice_rng_generate_int(agent->rng, component->min_port, component->max_port+1); + } + current_port = start_port; if (agent->reliable && component->tcp == NULL) { nice_debug ("Agent %p: not gathering candidates for s%d:%d because " @@ -1848,29 +2223,33 @@ n + 1, addr); if (current_port > 0) current_port++; - if (current_port == 0 || current_port > component->max_port) + if (current_port > component->max_port) current_port = component->min_port; + if (current_port == 0 || current_port == start_port) break; } nice_address_set_port (addr, 0); if (!host_candidate) { - gchar ip[NICE_ADDRESS_STRING_LEN]; - nice_address_to_string (addr, ip); - nice_debug ("Agent %p: Unable to add local host candidate %s for s%d:%d" - ". Invalid interface?", agent, ip, stream->id, component->id); + if (nice_debug_is_enabled ()) { + gchar ip[NICE_ADDRESS_STRING_LEN]; + nice_address_to_string (addr, ip); + nice_debug ("Agent %p: Unable to add local host candidate %s for" + " s%d:%d. Invalid interface?", agent, ip, stream->id, + component->id); + } ret = FALSE; goto error; } #ifdef HAVE_GUPNP if (agent->upnp_enabled) { - NiceAddress *addr = nice_address_dup (&host_candidate->base_addr); + NiceAddress *base_addr = nice_address_dup (&host_candidate->base_addr); nice_debug ("Agent %p: Adding UPnP port %s:%d", agent, local_ip, - nice_address_get_port (&host_candidate->base_addr)); + nice_address_get_port (base_addr)); gupnp_simple_igd_add_port (GUPNP_SIMPLE_IGD (agent->upnp), "UDP", - 0, local_ip, nice_address_get_port (&host_candidate->base_addr), + 0, local_ip, nice_address_get_port (base_addr), 0, PACKAGE_STRING); - agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, addr); + agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, base_addr); } #endif @@ -1905,7 +2284,7 @@ } stream->gathering = TRUE; - + stream->gathering_started = TRUE; /* Only signal the new candidates after we're sure that the gathering was * succesfful. But before sending gathering-done */ @@ -1920,7 +2299,7 @@ /* note: no async discoveries pending, signal that we are ready */ if (agent->discovery_unsched_items == 0 && #ifdef HAVE_GUPNP - g_slist_length (agent->upnp_mapping) == 0) { + agent->upnp_mapping == NULL) { #else TRUE) { #endif @@ -1941,25 +2320,19 @@ for (n = 0; n < stream->n_components; n++) { Component *component = stream_find_component_by_id (stream, n + 1); - priv_detach_stream_component (stream, component); + component_free_socket_sources (component); for (i = component->local_candidates; i; i = i->next) { NiceCandidate *candidate = i->data; nice_candidate_free (candidate); } - for (i = component->sockets; i; i = i->next) { - NiceSocket *udpsocket = i->data; - nice_socket_free (udpsocket); - } g_slist_free (component->local_candidates); component->local_candidates = NULL; - g_slist_free (component->sockets); - component->sockets = NULL; } discovery_prune_stream (agent, stream_id); } - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -1967,18 +2340,12 @@ static void priv_free_upnp (NiceAgent *agent) { #ifdef HAVE_GUPNP - GSList *i; - if (agent->upnp) { g_object_unref (agent->upnp); agent->upnp = NULL; } - for (i = agent->upnp_mapping; i; i = i->next) { - NiceAddress *a = i->data; - nice_address_free (a); - } - g_slist_free (agent->upnp_mapping); + g_slist_free_full (agent->upnp_mapping, (GDestroyNotify) nice_address_free); agent->upnp_mapping = NULL; if (agent->upnp_timer_source != NULL) { @@ -2003,6 +2370,8 @@ NiceAgent *agent, guint stream_id) { + guint stream_ids[] = { stream_id, 0 }; + /* note that streams/candidates can be in use by other threads */ Stream *stream; @@ -2011,7 +2380,8 @@ stream = agent_find_stream (agent, stream_id); if (!stream) { - goto done; + agent_unlock_and_emit (agent); + return; } /* note: remove items with matching stream_ids from both lists */ @@ -2019,45 +2389,54 @@ discovery_prune_stream (agent, stream_id); refresh_prune_stream (agent, stream_id); - /* remove the stream itself */ + /* Remove the stream and signal its removal. */ agent->streams = g_slist_remove (agent->streams, stream); stream_free (stream); if (!agent->streams) priv_remove_keepalive_timer (agent); - done: - agent_unlock(); + agent_queue_signal (agent, signals[SIGNAL_STREAMS_REMOVED], + g_memdup (stream_ids, sizeof(stream_ids))); + + agent_unlock_and_emit (agent); + return; } NICEAPI_EXPORT void nice_agent_set_port_range (NiceAgent *agent, guint stream_id, guint component_id, guint min_port, guint max_port) { + Stream *stream; Component *component; agent_lock(); - if (agent_find_component (agent, stream_id, component_id, NULL, &component)) { - component->min_port = min_port; - component->max_port = max_port; + if (agent_find_component (agent, stream_id, component_id, &stream, + &component)) { + if (stream->gathering_started) { + g_critical ("nice_agent_gather_candidates (stream_id=%u) already called for this stream", stream_id); + } else { + component->min_port = min_port; + component->max_port = max_port; + } } - agent_unlock(); + agent_unlock_and_emit (agent); } NICEAPI_EXPORT gboolean nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr) { - NiceAddress *dup; + NiceAddress *dupaddr; agent_lock(); - dup = nice_address_dup (addr); - nice_address_set_port (dup, 0); - agent->local_addresses = g_slist_append (agent->local_addresses, dup); + dupaddr = nice_address_dup (addr); + nice_address_set_port (dupaddr, 0); + agent->local_addresses = g_slist_append (agent->local_addresses, dupaddr); - agent_unlock(); + agent_unlock_and_emit (agent); return TRUE; } @@ -2083,7 +2462,7 @@ /* step: check whether the candidate already exists */ candidate = component_find_remote_candidate(component, addr, transport); if (candidate) { - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN]; nice_address_to_string (addr, tmpbuf); nice_debug ("Agent %p : Updating existing remote candidate with addr [%s]:%u" @@ -2117,8 +2496,6 @@ g_free (candidate->password); candidate->password = g_strdup (password); } - if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0) - goto errors; } else { /* case 2: add a new candidate */ @@ -2134,9 +2511,9 @@ if (addr) candidate->addr = *addr; - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN] = {0}; - if(addr) + if (addr) nice_address_to_string (addr, tmpbuf); nice_debug ("Agent %p : Adding remote candidate with addr [%s]:%u" " for s%d/c%d. U/P '%s'/'%s' prio: %u", agent, tmpbuf, @@ -2155,9 +2532,10 @@ if (foundation) g_strlcpy (candidate->foundation, foundation, NICE_CANDIDATE_MAX_FOUNDATION); + } - if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0) - goto errors; + if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0) { + goto errors; } return TRUE; @@ -2190,7 +2568,7 @@ } done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -2221,7 +2599,7 @@ done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -2295,145 +2673,959 @@ added = _set_remote_candidates_locked (agent, stream, component, candidates); done: - agent_unlock(); + agent_unlock_and_emit (agent); return added; } +/* Return values for agent_recv_message_unlocked(). Needed purely because it + * must differentiate between RECV_OOB and RECV_SUCCESS. */ +typedef enum { + RECV_ERROR = -2, + RECV_WOULD_BLOCK = -1, + RECV_OOB = 0, + RECV_SUCCESS = 1, +} RecvStatus; -static gint -_nice_agent_recv ( +/* + * agent_recv_message_unlocked: + * @agent: a #NiceAgent + * @stream: the stream to receive from + * @component: the component to receive from + * @socket: the socket to receive on + * @message: the message to write into (must have at least 65536 bytes of buffer + * space) + * + * Receive a single message of data from the given @stream, @component and + * @socket tuple, in a non-blocking fashion. The caller must ensure that + * @message contains enough buffers to provide at least 65536 bytes of buffer + * space, but the buffers may be split as the caller sees fit. + * + * This must be called with the agent’s lock held. + * + * Returns: number of valid messages received on success (i.e. %RECV_SUCCESS or + * 1), %RECV_OOB if data was successfully received but was handled out-of-band + * (e.g. due to being a STUN control packet), %RECV_WOULD_BLOCK if no data is + * available and the call would block, or %RECV_ERROR on error + */ +static RecvStatus +agent_recv_message_unlocked ( NiceAgent *agent, Stream *stream, Component *component, - NiceSocket *socket, - guint buf_len, - gchar *buf) + NiceSocket *nicesock, + NiceInputMessage *message) { NiceAddress from; - gint len; GList *item; + gint retval; + + /* We need an address for packet parsing, below. */ + if (message->from == NULL) { + message->from = &from; + } - len = nice_socket_recv (socket, &from, buf_len, buf); + retval = nice_socket_recv_messages (nicesock, message, 1); - if (len <= 0) - return len; + nice_debug ("%s: Received %d valid messages of length %" G_GSIZE_FORMAT + " from base socket %p.", G_STRFUNC, retval, message->length, nicesock); -#ifndef NDEBUG - if (len > 0) { - gchar tmpbuf[INET6_ADDRSTRLEN]; - nice_address_to_string (&from, tmpbuf); - nice_debug ("Agent %p : Packet received on local socket %u from [%s]:%u (%u octets).", agent, - g_socket_get_fd (socket->fileno), tmpbuf, nice_address_get_port (&from), len); + if (retval == 0) { + retval = RECV_WOULD_BLOCK; /* EWOULDBLOCK */ + goto done; + } else if (retval < 0) { + nice_debug ("Agent %p: %s returned %d, errno (%d) : %s", + agent, G_STRFUNC, retval, errno, g_strerror (errno)); + + retval = RECV_ERROR; + goto done; } -#endif + if (retval == RECV_OOB || message->length == 0) { + retval = RECV_OOB; + goto done; + } - if ((guint)len > buf_len) - { - /* buffer is not big enough to accept this packet */ - /* XXX: test this case */ - return 0; - } + if (nice_debug_is_enabled ()) { + gchar tmpbuf[INET6_ADDRSTRLEN]; + nice_address_to_string (message->from, tmpbuf); + nice_debug ("Agent %p : Packet received on local socket %d from [%s]:%u (%" G_GSSIZE_FORMAT " octets).", agent, + g_socket_get_fd (nicesock->fileno), tmpbuf, + nice_address_get_port (message->from), message->length); + } for (item = component->turn_servers; item; item = g_list_next (item)) { TurnServer *turn = item->data; - if (nice_address_equal (&from, &turn->server)) { - GSList * i = NULL; -#ifndef NDEBUG - nice_debug ("Agent %p : Packet received from TURN server candidate.", - agent); -#endif - for (i = component->local_candidates; i; i = i->next) { - NiceCandidate *cand = i->data; - if (cand->type == NICE_CANDIDATE_TYPE_RELAYED && - cand->stream_id == stream->id && - cand->component_id == component->id) { - len = nice_turn_socket_parse_recv (cand->sockptr, &socket, - &from, len, buf, &from, buf, len); - } + GSList *i = NULL; + + if (!nice_address_equal (message->from, &turn->server)) + continue; + + nice_debug ("Agent %p : Packet received from TURN server candidate.", + agent); + + for (i = component->local_candidates; i; i = i->next) { + NiceCandidate *cand = i->data; + + if (cand->type == NICE_CANDIDATE_TYPE_RELAYED && + cand->stream_id == stream->id && + cand->component_id == component->id) { + retval = nice_turn_socket_parse_recv_message (cand->sockptr, &nicesock, + message); + break; } - break; } } + if (retval == RECV_OOB) + goto done; + agent->media_after_tick = TRUE; - if (stun_message_validate_buffer_length ((uint8_t *) buf, (size_t) len, + /* If the message’s stated length is equal to its actual length, it’s probably + * a STUN message; otherwise it’s probably data. */ + if (stun_message_validate_buffer_length_fast ( + (StunInputVector *) message->buffers, message->n_buffers, message->length, (agent->compatibility != NICE_COMPATIBILITY_OC2007 && - agent->compatibility != NICE_COMPATIBILITY_OC2007R2)) != len) - /* If the retval is no 0, its not a valid stun packet, probably data */ - return len; + agent->compatibility != NICE_COMPATIBILITY_OC2007R2)) == (ssize_t) message->length) { + /* Slow path: If this message isn’t obviously *not* a STUN packet, compact + * its buffers + * into a single monolithic one and parse the packet properly. */ + guint8 *big_buf; + gsize big_buf_len; + + big_buf = compact_input_message (message, &big_buf_len); + + if (stun_message_validate_buffer_length (big_buf, big_buf_len, + (agent->compatibility != NICE_COMPATIBILITY_OC2007 && + agent->compatibility != NICE_COMPATIBILITY_OC2007R2)) == (gint) big_buf_len && + conn_check_handle_inbound_stun (agent, stream, component, nicesock, + message->from, (gchar *) big_buf, big_buf_len)) { + /* Handled STUN message. */ + nice_debug ("%s: Valid STUN packet received.", G_STRFUNC); + + retval = RECV_OOB; + g_free (big_buf); + goto done; + } + + nice_debug ("%s: WARNING: Packet passed fast STUN validation but failed " + "slow validation.", G_STRFUNC); + + g_free (big_buf); + } + + /* Unhandled STUN; try handling TCP data, then pass to the client. */ + if (message->length > 0 && component->tcp) { + /* If we don’t yet have an underlying selected socket, queue up the incoming + * data to handle later. This is because we can’t send ACKs (or, more + * importantly for the first few packets, SYNACKs) without an underlying + * socket. We’d rather wait a little longer for a pair to be selected, then + * process the incoming packets and send out ACKs, than try to process them + * now, fail to send the ACKs, and incur a timeout in our pseudo-TCP state + * machine. */ + if (component->selected_pair.local == NULL) { + GOutputVector *vec = g_slice_new (GOutputVector); + vec->buffer = compact_input_message (message, &vec->size); + g_queue_push_tail (&component->queued_tcp_packets, vec); + nice_debug ("%s: Queued %" G_GSSIZE_FORMAT " bytes for agent %p.", + G_STRFUNC, vec->size, agent); + + return RECV_OOB; + } else { + process_queued_tcp_packets (agent, stream, component); + } + + /* Received data on a reliable connection. */ + + nice_debug ("%s: notifying pseudo-TCP of packet, length %" G_GSIZE_FORMAT, + G_STRFUNC, message->length); + pseudo_tcp_socket_notify_message (component->tcp, message); + + adjust_tcp_clock (agent, stream, component); + + /* Success! Handled out-of-band. */ + retval = RECV_OOB; + goto done; + } else if (message->length > 0 && !component->tcp && agent->reliable) { + /* Received data on a reliable connection which has no TCP component. */ + nice_debug ("Received data on a pseudo tcp FAILED component. Ignoring."); + + retval = RECV_OOB; + goto done; + } + +done: + /* Clear local modifications. */ + if (message->from == &from) { + message->from = NULL; + } + + return retval; +} + +/* Print the composition of an array of messages. No-op if debugging is + * disabled. */ +static void +nice_debug_input_message_composition (const NiceInputMessage *messages, + guint n_messages) +{ + guint i; + + if (!nice_debug_is_enabled ()) + return; + + for (i = 0; i < n_messages; i++) { + const NiceInputMessage *message = &messages[i]; + guint j; + + nice_debug ("Message %p (from: %p, length: %" G_GSIZE_FORMAT ")", message, + message->from, message->length); + + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + GInputVector *buffer = &message->buffers[j]; + + nice_debug ("\tBuffer %p (length: %" G_GSIZE_FORMAT ")", buffer->buffer, + buffer->size); + } + } +} + +static guint8 * +compact_message (const NiceOutputMessage *message, gsize buffer_length) +{ + guint8 *buffer; + gsize offset = 0; + guint i; + + buffer = g_malloc (buffer_length); + + for (i = 0; + (message->n_buffers >= 0 && i < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[i].buffer != NULL); + i++) { + gsize len = MIN (buffer_length - offset, message->buffers[i].size); + memcpy (buffer + offset, message->buffers[i].buffer, len); + offset += len; + } + + return buffer; +} + +/* Concatenate all the buffers in the given @recv_message into a single, newly + * allocated, monolithic buffer which is returned. The length of the new buffer + * is returned in @buffer_length, and should be equal to the length field of + * @recv_message. + * + * The return value must be freed with g_free(). */ +guint8 * +compact_input_message (const NiceInputMessage *message, gsize *buffer_length) +{ + nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); + nice_debug_input_message_composition (message, 1); + + /* This works as long as NiceInputMessage is a subset of eNiceOutputMessage */ + + *buffer_length = message->length; + + return compact_message ((NiceOutputMessage *) message, *buffer_length); +} + +/* Returns the number of bytes copied. Silently drops any data from @buffer + * which doesn’t fit in @message. */ +gsize +memcpy_buffer_to_input_message (NiceInputMessage *message, + const guint8 *buffer, gsize buffer_length) +{ + guint i; + + nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); + + message->length = 0; + + for (i = 0; + buffer_length > 0 && + ((message->n_buffers >= 0 && i < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[i].buffer != NULL)); + i++) { + gsize len; + + len = MIN (message->buffers[i].size, buffer_length); + memcpy (message->buffers[i].buffer, buffer, len); + + buffer += len; + buffer_length -= len; + + message->length += len; + } + + nice_debug_input_message_composition (message, 1); + + if (buffer_length > 0) { + g_warning ("Dropped %" G_GSIZE_FORMAT " bytes of data from the end of " + "buffer %p (length: %" G_GSIZE_FORMAT ") due to not fitting in " + "message %p", buffer_length, buffer - message->length, + message->length + buffer_length, message); + } + + return message->length; +} + +/* Concatenate all the buffers in the given @message into a single, newly + * allocated, monolithic buffer which is returned. The length of the new buffer + * is returned in @buffer_length, and should be equal to the length field of + * @recv_message. + * + * The return value must be freed with g_free(). */ +guint8 * +compact_output_message (const NiceOutputMessage *message, gsize *buffer_length) +{ + nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); + + *buffer_length = output_message_get_size (message); + + return compact_message (message, *buffer_length); +} + +gsize +output_message_get_size (const NiceOutputMessage *message) +{ + guint i; + gsize message_len = 0; + + /* Find the total size of the message */ + for (i = 0; + (message->n_buffers >= 0 && i < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[i].buffer != NULL); + i++) + message_len += message->buffers[i].size; + + return message_len; +} + +static gsize +input_message_get_size (const NiceInputMessage *message) +{ + guint i; + gsize message_len = 0; + + /* Find the total size of the message */ + for (i = 0; + (message->n_buffers >= 0 && i < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[i].buffer != NULL); + i++) + message_len += message->buffers[i].size; + + return message_len; +} +/* + * nice_input_message_iter_reset: + * @iter: a #NiceInputMessageIter + * + * Reset the given @iter to point to the beginning of the array of messages. + * This may be used both to initialise it and to reset it after use. + * + * Since: 0.1.5 + */ +void +nice_input_message_iter_reset (NiceInputMessageIter *iter) +{ + iter->message = 0; + iter->buffer = 0; + iter->offset = 0; +} + +/* + * nice_input_message_iter_is_at_end: + * @iter: a #NiceInputMessageIter + * @messages: (array length=n_messages): an array of #NiceInputMessages + * @n_messages: number of entries in @messages + * + * Determine whether @iter points to the end of the given @messages array. If it + * does, the array is full: every buffer in every message is full of valid + * bytes. + * + * Returns: %TRUE if the messages’ buffers are full, %FALSE otherwise + * + * Since: 0.1.5 + */ +gboolean +nice_input_message_iter_is_at_end (NiceInputMessageIter *iter, + NiceInputMessage *messages, guint n_messages) +{ + return (iter->message == n_messages && + iter->buffer == 0 && iter->offset == 0); +} + +/* + * nice_input_message_iter_get_n_valid_messages: + * @iter: a #NiceInputMessageIter + * + * Calculate the number of valid messages in the messages array. A valid message + * is one which contains at least one valid byte of data in its buffers. + * + * Returns: number of valid messages (may be zero) + * + * Since: 0.1.5 + */ +guint +nice_input_message_iter_get_n_valid_messages (NiceInputMessageIter *iter) +{ + if (iter->buffer == 0 && iter->offset == 0) + return iter->message; + else + return iter->message + 1; +} + +/** + * nice_input_message_iter_compare: + * @a: a #NiceInputMessageIter + * @b: another #NiceInputMessageIter + * + * Compare two #NiceInputMessageIters for equality, returning %TRUE if they + * point to the same place in the receive message array. + * + * Returns: %TRUE if the iters match, %FALSE otherwise + * + * Since: 0.1.5 + */ +gboolean +nice_input_message_iter_compare (const NiceInputMessageIter *a, + const NiceInputMessageIter *b) +{ + return (a->message == b->message && a->buffer == b->buffer && a->offset == b->offset); +} + +/* Will fill up @messages from the first free byte onwards (as determined using + * @iter). This may be used in reliable or non-reliable mode; in non-reliable + * mode it will always increment the message index after each buffer is + * consumed. + * + * Updates @iter in place. No errors can occur. + * + * Returns the number of valid messages in @messages on success (which may be + * zero if reading into the first buffer of the message would have blocked). + * + * Must be called with the io_mutex held. */ +static gint +pending_io_messages_recv_messages (Component *component, gboolean reliable, + NiceInputMessage *messages, guint n_messages, NiceInputMessageIter *iter) +{ + gsize len; + IOCallbackData *data; + NiceInputMessage *message = &messages[iter->message]; + + g_assert (component->io_callback_id == 0); + + data = g_queue_peek_head (&component->pending_io_messages); + if (data == NULL) + goto done; + + if (iter->buffer == 0 && iter->offset == 0) { + message->length = 0; + } + + for (; + (message->n_buffers >= 0 && iter->buffer < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[iter->buffer].buffer != NULL); + iter->buffer++) { + GInputVector *buffer = &message->buffers[iter->buffer]; + + do { + len = MIN (data->buf_len - data->offset, buffer->size - iter->offset); + memcpy ((guint8 *) buffer->buffer + iter->offset, + data->buf + data->offset, len); + + nice_debug ("%s: Unbuffered %" G_GSIZE_FORMAT " bytes into " + "buffer %p (offset %" G_GSIZE_FORMAT ", length %" G_GSIZE_FORMAT + ").", G_STRFUNC, len, buffer->buffer, iter->offset, buffer->size); + + message->length += len; + iter->offset += len; + data->offset += len; + } while (iter->offset < buffer->size); + + iter->offset = 0; + } + + /* Only if we managed to consume the whole buffer should it be popped off the + * queue; otherwise we’ll have another go at it later. */ + if (data->offset == data->buf_len) { + g_queue_pop_head (&component->pending_io_messages); + io_callback_data_free (data); + + /* If we’ve consumed an entire message from pending_io_messages, and + * are in non-reliable mode, move on to the next message in + * @messages. */ + if (!reliable) { + iter->offset = 0; + iter->buffer = 0; + iter->message++; + } + } + +done: + return nice_input_message_iter_get_n_valid_messages (iter); +} + +static gboolean +nice_agent_recv_cancelled_cb (GCancellable *cancellable, gpointer user_data) +{ + GError **error = user_data; + return !g_cancellable_set_error_if_cancelled (cancellable, error); +} + +static gint +nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent, + guint stream_id, guint component_id, gboolean blocking, + NiceInputMessage *messages, guint n_messages, + GCancellable *cancellable, GError **error) +{ + GMainContext *context; + Stream *stream; + Component *component; + gint n_valid_messages = -1; + GSource *cancellable_source = NULL; + gboolean received_enough = FALSE, error_reported = FALSE; + gboolean all_sockets_would_block = FALSE; + GError *child_error = NULL; + NiceInputMessage *messages_orig = NULL; + guint i; - if (conn_check_handle_inbound_stun (agent, stream, component, socket, - &from, buf, len)) - /* handled STUN message*/ + g_return_val_if_fail (NICE_IS_AGENT (agent), -1); + g_return_val_if_fail (stream_id >= 1, -1); + g_return_val_if_fail (component_id >= 1, -1); + g_return_val_if_fail (n_messages == 0 || messages != NULL, -1); + g_return_val_if_fail (n_messages <= G_MAXINT, -1); + g_return_val_if_fail ( + cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1); + g_return_val_if_fail (error == NULL || *error == NULL, -1); + + if (n_messages == 0) return 0; - /* unhandled STUN, pass to client */ - return len; + if (n_messages > G_MAXINT) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, + "The number of messages can't exceed G_MAXINT: %d", G_MAXINT); + return -1; + } + + /* Receive buffer size must be at least 1280 for STUN */ + if (!agent->reliable) { + for (i = 0; i < n_messages; i++) { + if (input_message_get_size (&messages[i]) < 1280) { + GInputVector *vec; + + if (messages_orig == NULL) + messages_orig = g_memdup (messages, + sizeof (NiceInputMessage) * n_messages); + vec = g_slice_new (GInputVector); + vec->buffer = g_slice_alloc (1280); + vec->size = 1280; + messages[i].buffers = vec; + messages[i].n_buffers = 1; + } + } + } + + agent_lock (); + + if (!agent_find_component (agent, stream_id, component_id, + &stream, &component)) { + g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE, + "Invalid stream/component."); + goto done; + } + + nice_debug ("%s: %p: (%s):", G_STRFUNC, agent, + blocking ? "blocking" : "non-blocking"); + nice_debug_input_message_composition (messages, n_messages); + + /* Disallow re-entrant reads. */ + g_assert (component->n_recv_messages == 0 && + component->recv_messages == NULL); + + /* Set the component’s receive buffer. */ + context = component_dup_io_context (component); + component_set_io_callback (component, NULL, NULL, messages, n_messages, + &child_error); + + /* Add the cancellable as a source. */ + if (cancellable != NULL) { + cancellable_source = g_cancellable_source_new (cancellable); + g_source_set_callback (cancellable_source, + (GSourceFunc) nice_agent_recv_cancelled_cb, &child_error, NULL); + g_source_attach (cancellable_source, context); + } + + /* Is there already pending data left over from having an I/O callback + * attached and switching to using nice_agent_recv()? This is a horrifically + * specific use case which I hope nobody ever tries. And yet, it still must be + * supported. */ + g_mutex_lock (&component->io_mutex); + + while (!received_enough && + !g_queue_is_empty (&component->pending_io_messages)) { + pending_io_messages_recv_messages (component, agent->reliable, + component->recv_messages, component->n_recv_messages, + &component->recv_messages_iter); + + nice_debug ("%s: %p: Received %d valid messages from pending I/O buffer.", + G_STRFUNC, agent, + nice_input_message_iter_get_n_valid_messages ( + &component->recv_messages_iter)); + + received_enough = + nice_input_message_iter_is_at_end (&component->recv_messages_iter, + component->recv_messages, component->n_recv_messages); + } + + g_mutex_unlock (&component->io_mutex); + + /* For a reliable stream, grab any data from the pseudo-TCP input buffer + * before trying the sockets. */ + if (agent->reliable && component->tcp != NULL && + pseudo_tcp_socket_get_available_bytes (component->tcp) > 0) { + pseudo_tcp_socket_recv_messages (component->tcp, + component->recv_messages, component->n_recv_messages, + &component->recv_messages_iter, &child_error); + adjust_tcp_clock (agent, stream, component); + + nice_debug ("%s: %p: Received %d valid messages from pseudo-TCP read " + "buffer.", G_STRFUNC, agent, + nice_input_message_iter_get_n_valid_messages ( + &component->recv_messages_iter)); + + received_enough = + nice_input_message_iter_is_at_end (&component->recv_messages_iter, + component->recv_messages, component->n_recv_messages); + error_reported = (child_error != NULL); + } + + /* Each iteration of the main context will either receive some data, a + * cancellation error or a socket error. In non-reliable mode, the iter’s + * @message counter will be incremented after each read. + * + * In blocking, reliable mode, iterate the loop enough to fill exactly + * @n_messages messages. In blocking, non-reliable mode, iterate the loop to + * receive @n_messages messages (which may not fill all the buffers). In + * non-blocking mode, stop iterating the loop if all sockets would block (i.e. + * if no data was received for an iteration). + */ + while (!received_enough && !error_reported && !all_sockets_would_block) { + NiceInputMessageIter prev_recv_messages_iter; + + memcpy (&prev_recv_messages_iter, &component->recv_messages_iter, + sizeof (NiceInputMessageIter)); + + agent_unlock_and_emit (agent); + g_main_context_iteration (context, blocking); + agent_lock (); + + if (!agent_find_component (agent, stream_id, component_id, + &stream, &component)) { + g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE, + "Component removed during call."); + + component = NULL; + error_reported = TRUE; + + goto recv_error; + } + + received_enough = + nice_input_message_iter_is_at_end (&component->recv_messages_iter, + component->recv_messages, component->n_recv_messages); + error_reported = (child_error != NULL); + all_sockets_would_block = (!blocking && + nice_input_message_iter_compare (&prev_recv_messages_iter, + &component->recv_messages_iter)); + } + + n_valid_messages = + nice_input_message_iter_get_n_valid_messages ( + &component->recv_messages_iter); /* grab before resetting the iter */ + + component_set_io_callback (component, NULL, NULL, NULL, 0, NULL); + +recv_error: + /* Tidy up. Below this point, @component may be %NULL. */ + if (cancellable_source != NULL) { + g_source_destroy (cancellable_source); + g_source_unref (cancellable_source); + } + + g_main_context_unref (context); + + /* Handle errors and cancellations. */ + if (error_reported) { + n_valid_messages = -1; + } else if (n_valid_messages == 0 && all_sockets_would_block) { + g_set_error_literal (&child_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, + g_strerror (EAGAIN)); + n_valid_messages = -1; + } + + nice_debug ("%s: %p: n_valid_messages: %d, n_messages: %u", G_STRFUNC, agent, + n_valid_messages, n_messages); + +done: + g_assert ((child_error != NULL) == (n_valid_messages == -1)); + g_assert (n_valid_messages < 0 || (guint) n_valid_messages <= n_messages); + + if (child_error != NULL) + g_propagate_error (error, child_error); + + agent_unlock_and_emit (agent); + + if (messages_orig) { + for (i = 0; i < n_messages; i++) { + if (messages[i].buffers != messages_orig[i].buffers) { + g_assert_cmpint (messages[i].n_buffers, ==, 1); + + memcpy_buffer_to_input_message (&messages_orig[i], + messages[i].buffers[0].buffer, messages[i].length); + + g_slice_free1 (1280, messages[i].buffers[0].buffer); + g_slice_free (GInputVector, messages[i].buffers); + + messages[i].buffers = messages_orig[i].buffers; + messages[i].n_buffers = messages_orig[i].n_buffers; + messages[i].length = messages_orig[i].length; + } + } + g_free (messages_orig); + } + + return n_valid_messages; } +NICEAPI_EXPORT gint +nice_agent_recv_messages (NiceAgent *agent, guint stream_id, guint component_id, + NiceInputMessage *messages, guint n_messages, GCancellable *cancellable, + GError **error) +{ + return nice_agent_recv_messages_blocking_or_nonblocking (agent, stream_id, + component_id, TRUE, messages, n_messages, cancellable, error); +} + +NICEAPI_EXPORT gssize +nice_agent_recv (NiceAgent *agent, guint stream_id, guint component_id, + guint8 *buf, gsize buf_len, GCancellable *cancellable, GError **error) +{ + gint n_valid_messages; + GInputVector local_bufs = { buf, buf_len }; + NiceInputMessage local_messages = { &local_bufs, 1, NULL, 0 }; + + if (buf_len > G_MAXSSIZE) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, + "The buffer length can't exceed G_MAXSSIZE: %" G_GSSIZE_FORMAT, + G_MAXSSIZE); + return -1; + } + + n_valid_messages = nice_agent_recv_messages (agent, stream_id, component_id, + &local_messages, 1, cancellable, error); + + if (n_valid_messages <= 0) + return n_valid_messages; + + return local_messages.length; +} NICEAPI_EXPORT gint -nice_agent_send ( +nice_agent_recv_messages_nonblocking (NiceAgent *agent, guint stream_id, + guint component_id, NiceInputMessage *messages, guint n_messages, + GCancellable *cancellable, GError **error) +{ + return nice_agent_recv_messages_blocking_or_nonblocking (agent, stream_id, + component_id, FALSE, messages, n_messages, cancellable, error); +} + +NICEAPI_EXPORT gssize +nice_agent_recv_nonblocking (NiceAgent *agent, guint stream_id, + guint component_id, guint8 *buf, gsize buf_len, GCancellable *cancellable, + GError **error) +{ + gint n_valid_messages; + GInputVector local_bufs = { buf, buf_len }; + NiceInputMessage local_messages = { &local_bufs, 1, NULL, 0 }; + + if (buf_len > G_MAXSSIZE) { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, + "The buffer length can't exceed G_MAXSSIZE: %" G_GSSIZE_FORMAT, + G_MAXSSIZE); + return -1; + } + + n_valid_messages = nice_agent_recv_messages_nonblocking (agent, stream_id, + component_id, &local_messages, 1, cancellable, error); + + if (n_valid_messages <= 0) + return n_valid_messages; + + return local_messages.length; +} + +/* nice_agent_send_messages_nonblocking_internal: + * + * Returns: number of bytes sent if allow_partial is %TRUE, the number + * of messages otherwise. + */ + +static gint +nice_agent_send_messages_nonblocking_internal ( NiceAgent *agent, guint stream_id, guint component_id, - guint len, - const gchar *buf) + const NiceOutputMessage *messages, + guint n_messages, + gboolean allow_partial, + GError **error) { Stream *stream; Component *component; - gint ret = -1; + gint n_sent = -1; /* is in bytes if allow_partial is TRUE, + otherwise in messages */ + GError *child_error = NULL; - agent_lock(); + g_assert (n_messages == 1 || !allow_partial); + + agent_lock (); if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) { + g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE, + "Invalid stream/component."); goto done; } + /* FIXME: Cancellation isn’t yet supported, but it doesn’t matter because + * we only deal with non-blocking writes. */ + if (component->tcp != NULL) { - ret = pseudo_tcp_socket_send (component->tcp, buf, len); + /* Send on the pseudo-TCP socket. */ + n_sent = pseudo_tcp_socket_send_messages (component->tcp, messages, + n_messages, allow_partial, &child_error); adjust_tcp_clock (agent, stream, component); - /* - if (ret == -1 && - pseudo_tcp_socket_get_error (component->tcp) != EWOULDBLOCK) { - } - */ - /* In case of -1, the error is either EWOULDBLOCK or ENOTCONN, which both - need the user to wait for the reliable-transport-writable signal */ - } else if(agent->reliable) { - nice_debug ("Trying to send on a pseudo tcp FAILED component"); - goto done; + + if (!pseudo_tcp_socket_can_send (component->tcp)) + g_cancellable_reset (component->tcp_writable_cancellable); + if (n_sent < 0 && !g_error_matches (child_error, G_IO_ERROR, + G_IO_ERROR_WOULD_BLOCK)) { + /* Signal errors */ + priv_pseudo_tcp_error (agent, stream, component); + } + } else if (agent->reliable) { + g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Error writing data to failed pseudo-TCP socket."); } else if (component->selected_pair.local != NULL) { NiceSocket *sock; NiceAddress *addr; -#ifndef NDEBUG - gchar tmpbuf[INET6_ADDRSTRLEN]; - nice_address_to_string (&component->selected_pair.remote->addr, tmpbuf); + if (nice_debug_is_enabled ()) { + gchar tmpbuf[INET6_ADDRSTRLEN]; + nice_address_to_string (&component->selected_pair.remote->addr, tmpbuf); - nice_debug ("Agent %p : s%d:%d: sending %d bytes to [%s]:%d", agent, stream_id, component_id, - len, tmpbuf, - nice_address_get_port (&component->selected_pair.remote->addr)); -#endif + nice_debug ("Agent %p : s%d:%d: sending %u messages to " + "[%s]:%d", agent, stream_id, component_id, n_messages, tmpbuf, + nice_address_get_port (&component->selected_pair.remote->addr)); + } sock = component->selected_pair.local->sockptr; addr = &component->selected_pair.remote->addr; - if (nice_socket_send (sock, addr, len, buf)) { - ret = len; + + n_sent = nice_socket_send_messages (sock, addr, messages, n_messages); + + if (n_sent < 0) { + g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Error writing data to socket."); + } else if (allow_partial) { + g_assert (n_messages == 1); + n_sent = output_message_get_size (messages); } - goto done; + } else { + /* Socket isn’t properly open yet. */ + n_sent = 0; /* EWOULDBLOCK */ } - done: - agent_unlock(); - return ret; + /* Handle errors and cancellations. */ + if (n_sent == 0) { + g_set_error_literal (&child_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, + g_strerror (EAGAIN)); + n_sent = -1; + } + + nice_debug ("%s: n_sent: %d, n_messages: %u", G_STRFUNC, + n_sent, n_messages); + +done: + g_assert ((child_error != NULL) == (n_sent == -1)); + g_assert (n_sent != 0); + g_assert (n_sent < 0 || + (!allow_partial && (guint) n_sent <= n_messages) || + (allow_partial && n_messages == 1 && + (gsize) n_sent <= output_message_get_size (&messages[0]))); + + if (child_error != NULL) + g_propagate_error (error, child_error); + + agent_unlock_and_emit (agent); + + return n_sent; +} + +NICEAPI_EXPORT gint +nice_agent_send_messages_nonblocking ( + NiceAgent *agent, + guint stream_id, + guint component_id, + const NiceOutputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error) +{ + g_return_val_if_fail (NICE_IS_AGENT (agent), -1); + g_return_val_if_fail (stream_id >= 1, -1); + g_return_val_if_fail (component_id >= 1, -1); + g_return_val_if_fail (n_messages == 0 || messages != NULL, -1); + g_return_val_if_fail ( + cancellable == NULL || G_IS_CANCELLABLE (cancellable), -1); + g_return_val_if_fail (error == NULL || *error == NULL, -1); + + if (g_cancellable_set_error_if_cancelled (cancellable, error)) + return -1; + + return nice_agent_send_messages_nonblocking_internal (agent, stream_id, + component_id, messages, n_messages, FALSE, error); } +NICEAPI_EXPORT gint +nice_agent_send ( + NiceAgent *agent, + guint stream_id, + guint component_id, + guint len, + const gchar *buf) +{ + GOutputVector local_buf = { buf, len }; + NiceOutputMessage local_message = { &local_buf, 1 }; + gint n_sent_bytes; + + g_return_val_if_fail (NICE_IS_AGENT (agent), -1); + g_return_val_if_fail (stream_id >= 1, -1); + g_return_val_if_fail (component_id >= 1, -1); + g_return_val_if_fail (buf != NULL, -1); + + n_sent_bytes = nice_agent_send_messages_nonblocking_internal (agent, + stream_id, component_id, &local_message, 1, TRUE, NULL); + + return n_sent_bytes; +} NICEAPI_EXPORT GSList * nice_agent_get_local_candidates ( @@ -2455,7 +3647,7 @@ ret = g_slist_append (ret, nice_candidate_copy (item->data)); done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -2479,35 +3671,56 @@ ret = g_slist_append (ret, nice_candidate_copy (item->data)); done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } - gboolean nice_agent_restart ( NiceAgent *agent) { GSList *i; - gboolean res = TRUE; agent_lock(); - /* step: clean up all connectivity checks */ - conn_check_free (agent); - /* step: regenerate tie-breaker value */ priv_generate_tie_breaker (agent); - for (i = agent->streams; i && res; i = i->next) { + for (i = agent->streams; i; i = i->next) { Stream *stream = i->data; /* step: reset local credentials for the stream and * clean up the list of remote candidates */ - res = stream_restart (stream, agent->rng); + stream_restart (agent, stream); + } + + agent_unlock_and_emit (agent); + return TRUE; +} + +gboolean +nice_agent_restart_stream ( + NiceAgent *agent, + guint stream_id) +{ + gboolean res = FALSE; + Stream *stream; + + agent_lock(); + + stream = agent_find_stream (agent, stream_id); + if (!stream) { + g_warning ("Could not find stream %u", stream_id); + goto done; } - agent_unlock(); + /* step: reset local credentials for the stream and + * clean up the list of remote candidates */ + stream_restart (agent, stream); + + res = TRUE; + done: + agent_unlock_and_emit (agent); return res; } @@ -2516,6 +3729,7 @@ nice_agent_dispose (GObject *object) { GSList *i; + QueuedSignal *sig; NiceAgent *agent = NICE_AGENT (object); /* step: free resources for the binding discovery timers */ @@ -2549,6 +3763,10 @@ g_slist_free (agent->streams); agent->streams = NULL; + while ((sig = g_queue_pop_head (&agent->pending_signals))) { + free_queued_signal (sig); + } + g_free (agent->stun_server_ip); agent->stun_server_ip = NULL; @@ -2576,176 +3794,185 @@ } - -typedef struct _IOCtx IOCtx; - -struct _IOCtx +gboolean +component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data) { - GSource *source; + SocketSource *socket_source = user_data; + Component *component; NiceAgent *agent; Stream *stream; - Component *component; - NiceSocket *socket; -}; - - -static IOCtx * -io_ctx_new ( - NiceAgent *agent, - Stream *stream, - Component *component, - NiceSocket *socket, - GSource *source) -{ - IOCtx *ctx; - - ctx = g_slice_new0 (IOCtx); - ctx->agent = agent; - ctx->stream = stream; - ctx->component = component; - ctx->socket = socket; - ctx->source = source; - - return ctx; -} - - -static void -io_ctx_free (IOCtx *ctx) -{ - g_slice_free (IOCtx, ctx); -} - -static gboolean -nice_agent_g_source_cb ( - GSocket *gsocket, - GIOCondition condition, - gpointer data) -{ - IOCtx *ctx = data; - NiceAgent *agent = ctx->agent; - Stream *stream = ctx->stream; - Component *component = ctx->component; - gchar buf[MAX_BUFFER_SIZE]; - gint len; + gboolean has_io_callback; + gboolean remove_source = FALSE; - agent_lock(); + agent_lock (); if (g_source_is_destroyed (g_main_current_source ())) { + /* Silently return FALSE. */ + nice_debug ("%s: source %p destroyed", G_STRFUNC, g_main_current_source ()); + agent_unlock (); - return FALSE; + return G_SOURCE_REMOVE; } - len = _nice_agent_recv (agent, stream, component, ctx->socket, - MAX_BUFFER_SIZE, buf); + component = socket_source->component; + agent = component->agent; + stream = component->stream; - if (len > 0 && component->tcp) { - g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *)&agent); - pseudo_tcp_socket_notify_packet (component->tcp, buf, len); - if (agent) { - adjust_tcp_clock (agent, stream, component); - g_object_remove_weak_pointer (G_OBJECT (agent), (gpointer *)&agent); - } else { - nice_debug ("Our agent got destroyed in notify_packet!!"); - } - } else if(len > 0 && agent->reliable) { - nice_debug ("Received data on a pseudo tcp FAILED component"); - } else if (len > 0 && component->g_source_io_cb) { - gpointer data = component->data; - gint sid = stream->id; - gint cid = component->id; - NiceAgentRecvFunc callback = component->g_source_io_cb; - /* Unlock the agent before calling the callback */ - agent_unlock(); - callback (agent, sid, cid, len, buf, data); - goto done; - } else if (len < 0) { - GSource *source = ctx->source; - - nice_debug ("Agent %p: _nice_agent_recv returned %d, errno (%d) : %s", - agent, len, errno, g_strerror (errno)); - component->gsources = g_slist_remove (component->gsources, source); - g_source_destroy (source); - g_source_unref (source); - /* We don't close the socket because it would be way too complicated to - * take care of every path where the socket might still be used.. */ - nice_debug ("Agent %p: unable to recv from socket %p. Detaching", agent, - ctx->socket); - - } + g_object_ref (agent); - agent_unlock(); + has_io_callback = component_has_io_callback (component); - done: - - return TRUE; -} + /* Choose which receive buffer to use. If we’re reading for + * nice_agent_attach_recv(), use a local static buffer. If we’re reading for + * nice_agent_recv_messages(), use the buffer provided by the client. + * + * has_io_callback cannot change throughout this function, as we operate + * entirely with the agent lock held, and component_set_io_callback() would + * need to take the agent lock to change the Component’s io_callback. */ + g_assert (!has_io_callback || component->recv_messages == NULL); -/* - * Attaches one socket handle to the main loop event context - */ + if (agent->reliable) { +#define TCP_HEADER_SIZE 24 /* bytes */ + guint8 local_header_buf[TCP_HEADER_SIZE]; + /* FIXME: Currently, the critical path for reliable packet delivery has two + * memcpy()s: one into the pseudo-TCP receive buffer, and one out of it. + * This could moderately easily be reduced to one memcpy() in the common + * case of in-order packet delivery, by replacing local_body_buf with a + * pointer into the pseudo-TCP receive buffer. If it turns out the packet + * is out-of-order (which we can only know after parsing its header), the + * data will need to be moved in the buffer. If the packet *is* in order, + * however, the only memcpy() then needed is from the pseudo-TCP receive + * buffer to the client’s message buffers. + * + * In fact, in the case of a reliable agent with I/O callbacks, zero + * memcpy()s can be achieved (for in-order packet delivery) by emittin the + * I/O callback directly from the pseudo-TCP receive buffer. */ + guint8 local_body_buf[MAX_BUFFER_SIZE]; + GInputVector local_bufs[] = { + { local_header_buf, sizeof (local_header_buf) }, + { local_body_buf, sizeof (local_body_buf) }, + }; + NiceInputMessage local_message = { + local_bufs, G_N_ELEMENTS (local_bufs), NULL, 0 + }; + RecvStatus retval = 0; + + if (component->tcp == NULL) { + nice_debug ("Agent %p: not handling incoming packet for s%d:%d " + "because pseudo-TCP socket does not exist in reliable mode.", agent, + stream->id, component->id); + remove_source = TRUE; + goto done; + } -void -agent_attach_stream_component_socket (NiceAgent *agent, - Stream *stream, - Component *component, - NiceSocket *socket) -{ - GSource *source; - IOCtx *ctx; + while (has_io_callback || + (component->recv_messages != NULL && + !nice_input_message_iter_is_at_end (&component->recv_messages_iter, + component->recv_messages, component->n_recv_messages))) { + /* Receive a single message. This will receive it into the given + * @local_bufs then, for pseudo-TCP, emit I/O callbacks or copy it into + * component->recv_messages in pseudo_tcp_socket_readable(). STUN packets + * will be parsed in-place. */ + retval = agent_recv_message_unlocked (agent, stream, component, + socket_source->socket, &local_message); + + nice_debug ("%s: %p: received %d valid messages with %" G_GSSIZE_FORMAT + " bytes", G_STRFUNC, agent, retval, local_message.length); + + /* Don’t expect any valid messages to escape pseudo_tcp_socket_readable() + * when in reliable mode. */ + g_assert_cmpint (retval, !=, RECV_SUCCESS); - if (!component->ctx) - return; + if (retval == RECV_WOULD_BLOCK) { + /* EWOULDBLOCK. */ + break; + } else if (retval == RECV_ERROR) { + /* Other error. */ + nice_debug ("%s: error receiving message", G_STRFUNC); + remove_source = TRUE; + break; + } - /* note: without G_IO_ERR the glib mainloop goes into - * busyloop if errors are encountered */ - source = g_socket_create_source(socket->fileno, G_IO_IN | G_IO_ERR, NULL); - - ctx = io_ctx_new (agent, stream, component, socket, source); - g_source_set_callback (source, (GSourceFunc) nice_agent_g_source_cb, - ctx, (GDestroyNotify) io_ctx_free); - nice_debug ("Agent %p : Attach source %p (stream %u).", agent, source, stream->id); - g_source_attach (source, component->ctx); - component->gsources = g_slist_append (component->gsources, source); -} + has_io_callback = component_has_io_callback (component); + } + } else if (!agent->reliable && has_io_callback) { + while (has_io_callback) { + guint8 local_buf[MAX_BUFFER_SIZE]; + GInputVector local_bufs = { local_buf, sizeof (local_buf) }; + NiceInputMessage local_message = { &local_bufs, 1, NULL, 0 }; + RecvStatus retval; + + /* Receive a single message. */ + retval = agent_recv_message_unlocked (agent, stream, component, + socket_source->socket, &local_message); + nice_debug ("%s: %p: received %d valid messages with %" G_GSSIZE_FORMAT + " bytes", G_STRFUNC, agent, retval, local_message.length); -/* - * Attaches socket handles of 'stream' to the main eventloop - * context. - * - */ -static gboolean -priv_attach_stream_component (NiceAgent *agent, - Stream *stream, - Component *component) -{ - GSList *i; + if (retval == RECV_WOULD_BLOCK) { + /* EWOULDBLOCK. */ + break; + } else if (retval == RECV_ERROR) { + /* Other error. */ + nice_debug ("%s: error receiving message", G_STRFUNC); + remove_source = TRUE; + break; + } - for (i = component->sockets; i; i = i->next) - agent_attach_stream_component_socket (agent, stream, component, i->data); + if (retval == RECV_SUCCESS && local_message.length > 0) + component_emit_io_callback (component, local_buf, local_message.length); - return TRUE; -} + has_io_callback = component_has_io_callback (component); + } + } else if (!agent->reliable && component->recv_messages != NULL) { + RecvStatus retval; -/* - * Detaches socket handles of 'stream' from the main eventloop - * context. - * - */ -static void priv_detach_stream_component (Stream *stream, Component *component) -{ - GSList *i; + /* Don’t want to trample over partially-valid buffers. */ + g_assert (component->recv_messages_iter.buffer == 0); + g_assert (component->recv_messages_iter.offset == 0); + + while (!nice_input_message_iter_is_at_end (&component->recv_messages_iter, + component->recv_messages, component->n_recv_messages)) { + /* Receive a single message. This will receive it into the given + * user-provided #NiceInputMessage, which it’s the user’s responsibility + * to ensure is big enough to avoid data loss (since we’re in non-reliable + * mode). Iterate to receive as many messages as possible. + * + * STUN packets will be parsed in-place. */ + retval = agent_recv_message_unlocked (agent, stream, component, + socket_source->socket, + &component->recv_messages[component->recv_messages_iter.message]); + + nice_debug ("%s: %p: received %d valid messages", G_STRFUNC, agent, + retval); + + if (retval == RECV_SUCCESS) { + /* Successfully received a single message. */ + component->recv_messages_iter.message++; + } else if (retval == RECV_WOULD_BLOCK) { + /* EWOULDBLOCK. */ + break; + } else if (retval == RECV_ERROR) { + /* Other error. */ + remove_source = TRUE; + break; + } /* else if (retval == RECV_OOB) { ignore me and continue; } */ + } + } - for (i = component->gsources; i; i = i->next) { - GSource *source = i->data; - nice_debug ("Detach source %p (stream %u).", source, stream->id); - g_source_destroy (source); - g_source_unref (source); +done: + /* If we’re in the middle of a read, don’t emit any signals, or we could cause + * re-entrancy by (e.g.) emitting component-state-changed and having the + * client perform a read. */ + if (component->n_recv_messages == 0 && component->recv_messages == NULL) { + agent_unlock_and_emit (agent); + } else { + agent_unlock (); } - g_slist_free (component->gsources); - component->gsources = NULL; + g_object_unref (agent); + + return !remove_source; } NICEAPI_EXPORT gboolean @@ -2772,39 +3999,27 @@ goto done; } - if (component->g_source_io_cb) - priv_detach_stream_component (stream, component); + if (ctx == NULL) + ctx = g_main_context_default (); + /* Set the component’s I/O context. */ + component_set_io_context (component, ctx); + component_set_io_callback (component, func, data, NULL, 0, NULL); ret = TRUE; - component->g_source_io_cb = NULL; - component->data = NULL; - if (component->ctx) - g_main_context_unref (component->ctx); - component->ctx = NULL; - if (func) { - component->g_source_io_cb = func; - component->data = data; - component->ctx = ctx; - if (ctx) - g_main_context_ref (ctx); - - priv_attach_stream_component (agent, stream, component); - /* If we got detached, maybe our readable callback didn't finish reading * all available data in the pseudotcp, so we need to make sure we free * our recv window, so the readable callback can be triggered again on the * next incoming data. * but only do this if we know we're already readable, otherwise we might * trigger an error in the initial, pre-connection attach. */ - if (component->tcp && component->tcp_data && component->tcp_readable) - pseudo_tcp_socket_readable (component->tcp, component->tcp_data); - + if (component->tcp && component->tcp_readable) + pseudo_tcp_socket_readable (component->tcp, component); } done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -2852,7 +4067,7 @@ ret = TRUE; done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -2878,11 +4093,47 @@ } done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } +NICEAPI_EXPORT GSocket * +nice_agent_get_selected_socket (NiceAgent *agent, guint stream_id, + guint component_id) +{ + Component *component; + Stream *stream; + NiceSocket *nice_socket; + GSocket *g_socket = NULL; + + agent_lock(); + + /* Reliable streams are pseudotcp or MUST use RFC 4571 framing */ + if (agent->reliable) + goto done; + + /* step: check that params specify an existing pair */ + if (!agent_find_component (agent, stream_id, component_id, + &stream, &component)) + goto done; + + if (!component->selected_pair.local || !component->selected_pair.remote) + goto done; + + if (component->selected_pair.local->type == NICE_CANDIDATE_TYPE_RELAYED) + goto done; + + nice_socket = (NiceSocket *)component->selected_pair.local->sockptr; + if (nice_socket->fileno) + g_socket = g_object_ref (nice_socket->fileno); + + done: + agent_unlock_and_emit (agent); + + return g_socket; +} + GSource* agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSourceFunc function, gpointer data) { @@ -2945,7 +4196,7 @@ ret = TRUE; done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -2954,13 +4205,13 @@ { if (setsockopt (g_socket_get_fd (sock->fileno), IPPROTO_IP, IP_TOS, (const char *) &tos, sizeof (tos)) < 0) { - nice_debug ("Agent %p: Could not set socket ToS", agent, + nice_debug ("Agent %p: Could not set socket ToS: %s", agent, g_strerror (errno)); } #ifdef IPV6_TCLASS if (setsockopt (g_socket_get_fd (sock->fileno), IPPROTO_IPV6, IPV6_TCLASS, (const char *) &tos, sizeof (tos)) < 0) { - nice_debug ("Agent %p: Could not set IPV6 socket ToS", agent, + nice_debug ("Agent %p: Could not set IPV6 socket ToS: %s", agent, g_strerror (errno)); } #endif @@ -2992,7 +4243,7 @@ } done: - agent_unlock(); + agent_unlock_and_emit (agent); } NICEAPI_EXPORT void @@ -3007,7 +4258,7 @@ stun_agent_set_software (&agent->stun_agent, agent->software_attribute); - agent_unlock (); + agent_unlock_and_emit (agent); } NICEAPI_EXPORT gboolean @@ -3041,7 +4292,7 @@ ret = TRUE; done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -3061,7 +4312,7 @@ name = stream->name; done: - agent_unlock(); + agent_unlock_and_emit (agent); return name; } @@ -3131,7 +4382,7 @@ default_candidate = nice_candidate_copy (default_candidate); done: - agent_unlock (); + agent_unlock_and_emit (agent); return default_candidate; } @@ -3243,7 +4494,7 @@ _generate_stream_sdp (agent, stream, sdp, TRUE); } - agent_unlock(); + agent_unlock_and_emit (agent); return g_string_free (sdp, FALSE); } @@ -3267,7 +4518,7 @@ ret = g_string_free (sdp, FALSE); done: - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -3285,7 +4536,7 @@ sdp = g_string_new (NULL); _generate_candidate_sdp (agent, candidate, sdp); - agent_unlock(); + agent_unlock_and_emit (agent); return g_string_free (sdp, FALSE); } @@ -3379,7 +4630,7 @@ if (sdp_lines) g_strfreev(sdp_lines); - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -3424,7 +4675,7 @@ if (sdp_lines) g_strfreev(sdp_lines); - agent_unlock(); + agent_unlock_and_emit (agent); return candidates; } @@ -3437,14 +4688,14 @@ int ntype = -1; gchar **tokens = NULL; const gchar *foundation = NULL; - guint component_id; + guint component_id = 0; const gchar *transport = NULL; - guint32 priority; + guint32 priority = 0; const gchar *addr = NULL; - guint16 port; + guint16 port = 0; const gchar *type = NULL; const gchar *raddr = NULL; - guint16 rport; + guint16 rport = 0; static const gchar *type_names[] = {"host", "srflx", "prflx", "relay"}; guint i; @@ -3531,3 +4782,58 @@ return candidate; } + + +NICEAPI_EXPORT GIOStream * +nice_agent_get_io_stream (NiceAgent *agent, guint stream_id, + guint component_id) +{ + GIOStream *iostream = NULL; + Component *component; + + g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); + g_return_val_if_fail (stream_id >= 1, NULL); + g_return_val_if_fail (component_id >= 1, NULL); + + g_return_val_if_fail (agent->reliable, NULL); + + agent_lock (); + + if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) + goto done; + + if (component->iostream == NULL) + component->iostream = nice_io_stream_new (agent, stream_id, component_id); + + iostream = g_object_ref (component->iostream); + + done: + agent_unlock_and_emit (agent); + + return iostream; +} + +NICEAPI_EXPORT gboolean +nice_agent_forget_relays (NiceAgent *agent, guint stream_id, guint component_id) +{ + Component *component; + gboolean ret = TRUE; + + g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE); + g_return_val_if_fail (stream_id >= 1, FALSE); + g_return_val_if_fail (component_id >= 1, FALSE); + + agent_lock (); + + if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) { + ret = FALSE; + goto done; + } + + component_clean_turn_servers (component); + + done: + agent_unlock_and_emit (agent); + + return ret; +} diff -Nru libnice-0.1.4/agent/agent.h libnice-0.1.7/agent/agent.h --- libnice-0.1.4/agent/agent.h 2013-02-23 00:18:00.000000000 +0000 +++ libnice-0.1.7/agent/agent.h 2014-04-29 00:27:22.000000000 +0000 @@ -53,6 +53,22 @@ * It will take care of discovering your local candidates and do * connectivity checks to create a stream of data between you and your peer. * + * Streams and their components are referenced by integer IDs (with respect to a + * given #NiceAgent). These IDs are guaranteed to be positive (i.e. non-zero) + * for valid streams/components. + * + * Each stream can receive data in one of two ways: using + * nice_agent_attach_recv() or nice_agent_recv_messages() (and the derived + * #NiceInputStream and #NiceIOStream classes accessible using + * nice_agent_get_io_stream()). nice_agent_attach_recv() is non-blocking: it + * takes a user-provided callback function and attaches the stream’s socket to + * the provided #GMainContext, invoking the callback in that context for every + * packet received. nice_agent_recv_messages() instead blocks on receiving a + * packet, and writes it directly into a user-provided buffer. This reduces the + * number of callback invokations and (potentially) buffer copies required to + * receive packets. nice_agent_recv_messages() (or #NiceInputStream) is designed + * to be used in a blocking loop in a separate thread. + * Simple example on how to use libnice @@ -104,6 +120,7 @@ #include +#include /** * NiceAgent: @@ -120,6 +137,68 @@ G_BEGIN_DECLS +/** + * NiceInputMessage: + * @buffers: (array length=n_buffers): unowned array of #GInputVector buffers to + * store data in for this message + * @n_buffers: number of #GInputVectors in @buffers, or -1 to indicate @buffers + * is %NULL-terminated + * @from: (allow-none): return location to store the address of the peer who + * transmitted the message, or %NULL + * @length: total number of valid bytes contiguously stored in @buffers + * + * Represents a single message received off the network. For reliable + * connections, this is essentially just an array of buffers (specifically, + * @from can be ignored). for non-reliable connections, it represents a single + * packet as received from the OS. + * + * @n_buffers may be -1 to indicate that @buffers is terminated by a + * #GInputVector with a %NULL buffer pointer. + * + * By providing arrays of #NiceInputMessages to functions like + * nice_agent_recv_messages(), multiple messages may be received with a single + * call, which is more efficient than making multiple calls in a loop. In this + * manner, nice_agent_recv_messages() is analogous to recvmmsg(); and + * #NiceInputMessage to struct mmsghdr. + * + * Since: 0.1.5 + */ +typedef struct { + GInputVector *buffers; + gint n_buffers; /* may be -1 to indicate @buffers is NULL-terminated */ + NiceAddress *from; /* return location for address of message sender */ + gsize length; /* sum of the lengths of @buffers */ +} NiceInputMessage; + +/** + * NiceOutputMessage: + * @buffers: (array length=n_buffers): unowned array of #GOutputVector buffers + * which contain data to transmit for this message + * @n_buffers: number of #GOutputVectors in @buffers, or -1 to indicate @buffers + * is %NULL-terminated + * + * Represents a single message to transmit on the network. For + * reliable connections, this is essentially just an array of + * buffer. for non-reliable connections, it represents a single packet + * to send to the OS. + * + * @n_buffers may be -1 to indicate that @buffers is terminated by a + * #GOutputVector with a %NULL buffer pointer. + * + * By providing arrays of #NiceOutputMessages to functions like + * nice_agent_send_messages_nonblocking(), multiple messages may be transmitted + * with a single call, which is more efficient than making multiple calls in a + * loop. In this manner, nice_agent_send_messages_nonblocking() is analogous to + * sendmmsg(); and #NiceOutputMessage to struct mmsghdr. + * + * Since: 0.1.5 + */ +typedef struct { + GOutputVector *buffers; + gint n_buffers; +} NiceOutputMessage; + + #define NICE_TYPE_AGENT nice_agent_get_type() #define NICE_AGENT(obj) \ @@ -337,7 +416,8 @@ * @agent: The #NiceAgent Object * @n_components: The number of components to add to the stream * - * Adds a data stream to @agent containing @n_components components. + * Adds a data stream to @agent containing @n_components components. The + * returned stream ID is guaranteed to be positive on success. * * Returns: The ID of the new stream, 0 on failure **/ @@ -398,6 +478,8 @@ * @type: The type of relay to use * * Sets the settings for using a relay server during the candidate discovery. + * This may be called multiple times to add multiple relay servers to the + * discovery process; one TCP and one UDP, for example. * * Returns: %TRUE if the TURN settings were accepted. * %FALSE if the address was invalid. @@ -414,17 +496,23 @@ /** * nice_agent_gather_candidates: - * @agent: The #NiceAgent Object - * @stream_id: The id of the stream to start + * @agent: The #NiceAgent object + * @stream_id: The ID of the stream to start + * + * Allocate and start listening on local candidate ports and start the remote + * candidate gathering process. + * Once done, #NiceAgent::candidate-gathering-done is called for the stream. + * As soon as this function is called, #NiceAgent::new-candidate signals may be + * emitted, even before this function returns. * - * Start the candidate gathering process. - * Once done, #NiceAgent::candidate-gathering-done is called for the stream + * nice_agent_get_local_candidates() will only return non-empty results after + * calling this function. * * See also: nice_agent_add_local_address() * See also: nice_agent_set_port_range() * - * Returns: %FALSE if the stream id is invalid or if a host candidate couldn't be allocated - * on the requested interfaces/ports. + * Returns: %FALSE if the stream ID is invalid or if a host candidate couldn't + * be allocated on the requested interfaces/ports; %TRUE otherwise * @@ -473,14 +561,16 @@ * nice_agent_get_local_credentials: * @agent: The #NiceAgent Object * @stream_id: The ID of the stream - * @ufrag: a pointer to a NULL-terminated string containing - * an ICE username fragment [OUT]. - * This string must be freed with g_free() - * @pwd: a pointer to a NULL-terminated string containing an ICE - * password [OUT] - * This string must be freed with g_free() + * @ufrag: (out callee-allocates): return location for a nul-terminated string + * containing an ICE username fragment; must be freed with g_free() + * @pwd: (out callee-allocates): return location for a nul-terminated string + * containing an ICE password; must be freed with g_free() + * + * Gets the local credentials for stream @stream_id. This may be called any time + * after creating a stream using nice_agent_add_stream(). * - * Gets the local credentials for stream @stream_id. + * An error will be returned if this is called for a non-existent stream, or if + * either of @ufrag or @pwd are %NULL. * * Returns: %TRUE on success, %FALSE on error. */ @@ -572,6 +662,60 @@ const gchar *buf); /** + * nice_agent_send_messages_nonblocking: + * @agent: a #NiceAgent + * @stream_id: the ID of the stream to send to + * @component_id: the ID of the component to send to + * @messages: (array length=n_messages): array of messages to send, of at least + * @n_messages entries in length + * @n_messages: number of entries in @messages + * @cancellable: (allow-none): a #GCancellable to cancel the operation from + * another thread, or %NULL + * @error: (allow-none): return location for a #GError, or %NULL + * + * Sends multiple messages on the socket identified by the given + * stream/component pair. Transmission is non-blocking, so a + * %G_IO_ERROR_WOULD_BLOCK error may be returned if the send buffer is full. + * + * As with nice_agent_send(), the given component must be in + * %NICE_COMPONENT_STATE_READY or, as a special case, in any state if it was + * previously ready and was then restarted. + * + * On success, the number of messages written to the socket will be returned, + * which may be less than @n_messages if transmission would have blocked + * part-way through. Zero will be returned if @n_messages is zero, or if + * transmission would have blocked on the first message. + * + * In reliable mode, it is instead recommended to use + * nice_agent_send(). The return value can be less than @n_messages + * or 0 even if it is still possible to send a partial message. In + * this case, "nice-agent-writable" will never be triggered, so the + * application would have to use nice_agent_sent() to fill the buffer or have + * to retry sending at a later point. + * + * On failure, -1 will be returned and @error will be set. If the #NiceAgent is + * reliable and the socket is not yet connected, %G_IO_ERROR_BROKEN_PIPE will be + * returned; if the write buffer is full, %G_IO_ERROR_WOULD_BLOCK will be + * returned. In both cases, wait for the #NiceAgent::reliable-transport-writable + * signal before trying again. If the given @stream_id or @component_id are + * invalid or not yet connected, %G_IO_ERROR_BROKEN_PIPE will be returned. + * %G_IO_ERROR_FAILED will be returned for other errors. + * + * Returns: the number of messages sent (may be zero), or -1 on error + * + * Since: 0.1.5 + */ +gint +nice_agent_send_messages_nonblocking ( + NiceAgent *agent, + guint stream_id, + guint component_id, + const NiceOutputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error); + +/** * nice_agent_get_local_candidates: * @agent: The #NiceAgent Object * @stream_id: The ID of the stream @@ -609,8 +753,8 @@ * - The caller owns the returned GSList but not the candidates - contained within it. + The caller owns the returned GSList as well as the candidates contained + within it. The list of remote candidates can change during processing. @@ -643,6 +787,28 @@ nice_agent_restart ( NiceAgent *agent); +/** + * nice_agent_restart_stream: + * @agent: The #NiceAgent Object + * @stream_id: The ID of the stream + * + * Restarts a single stream as defined in RFC 5245. This function + * needs to be called both when initiating (ICE spec section 9.1.1.1. + * "ICE Restarts"), as well as when reacting (spec section 9.2.1.1. + * "Detecting ICE Restart") to a restart. + * + * Unlike nice_agent_restart(), this applies to a single stream. It also + * does not generate a new tie breaker. + * + * Returns: %TRUE on success %FALSE on error + * + * Since: 0.1.6 + **/ +gboolean +nice_agent_restart_stream ( + NiceAgent *agent, + guint stream_id); + /** * nice_agent_attach_recv: @@ -657,6 +823,15 @@ * Attaches the stream's component's sockets to the Glib Mainloop Context in * order to be notified whenever data becomes available for a component. * + * This must not be used in combination with nice_agent_recv_messages() (or + * #NiceIOStream or #NiceInputStream) on the same stream/component pair. + * + * Calling nice_agent_attach_recv() with a %NULL @func will detach any existing + * callback and cause reception to be paused for the given stream/component + * pair. You must iterate the previously specified #GMainContext sufficiently to + * ensure all pending I/O callbacks have been received before calling this + * function to unset @func, otherwise data loss of received packets may occur. + * * Returns: %TRUE on success, %FALSE if the stream or component IDs are invalid. */ gboolean @@ -668,6 +843,169 @@ NiceAgentRecvFunc func, gpointer data); +/** + * nice_agent_recv: + * @agent: a #NiceAgent + * @stream_id: the ID of the stream to receive on + * @component_id: the ID of the component to receive on + * @buf: (array length=buf_len) (out caller-allocates): caller-allocated buffer + * to write the received data into, of length at least @buf_len + * @buf_len: length of @buf + * @cancellable: (allow-none): a #GCancellable to allow the operation to be + * cancelled from another thread, or %NULL + * @error: (allow-none): return location for a #GError, or %NULL + * + * A single-message version of nice_agent_recv_messages(). + * + * Returns: the number of bytes written to @buf on success (guaranteed to be + * greater than 0 unless @buf_len is 0), or -1 on error + * + * Since: 0.1.5 + */ +gssize +nice_agent_recv ( + NiceAgent *agent, + guint stream_id, + guint component_id, + guint8 *buf, + gsize buf_len, + GCancellable *cancellable, + GError **error); + +/** + * nice_agent_recv_messages: + * @agent: a #NiceAgent + * @stream_id: the ID of the stream to receive on + * @component_id: the ID of the component to receive on + * @messages: (array length=n_messages) (out caller-allocates): caller-allocated + * array of #NiceInputMessages to write the received messages into, of length at + * least @n_messages + * @n_messages: number of entries in @messages + * @cancellable: (allow-none): a #GCancellable to allow the operation to be + * cancelled from another thread, or %NULL + * @error: (allow-none): return location for a #GError, or %NULL + * + * Block on receiving data from the given stream/component combination on + * @agent, returning only once exactly @n_messages messages have been received + * and written into @messages, the stream is closed by the other end or by + * calling nice_agent_remove_stream(), or @cancellable is cancelled. + * + * In the non-error case, in reliable mode, this will block until all buffers in + * all @n_messages have been filled with received data (i.e. @messages is + * treated as a large, flat array of buffers). In non-reliable mode, it will + * block until @n_messages messages have been received, each of which does not + * have to fill all the buffers in its #NiceInputMessage. In the non-reliable + * case, each #NiceInputMessage must have enough buffers to contain an entire + * message (65536 bytes), or any excess data may be silently dropped. + * + * For each received message, #NiceInputMessage::length will be set to the + * number of valid bytes stored in the message’s buffers. The bytes are stored + * sequentially in the buffers; there are no gaps apart from at the end of the + * buffer array (in non-reliable mode). If non-%NULL on input, + * #NiceInputMessage::from will have the address of the sending peer stored in + * it. The base addresses, sizes, and number of buffers in each message will not + * be modified in any case. + * + * This must not be used in combination with nice_agent_attach_recv() on the + * same stream/component pair. + * + * If the stream/component pair doesn’t exist, or if a suitable candidate socket + * hasn’t yet been selected for it, a %G_IO_ERROR_BROKEN_PIPE error will be + * returned. A %G_IO_ERROR_CANCELLED error will be returned if the operation was + * cancelled. %G_IO_ERROR_FAILED will be returned for other errors. + * + * Returns: the number of valid messages written to @messages on success + * (guaranteed to be greater than 0 unless @n_messages is 0), or -1 on error + * + * Since: 0.1.5 + */ +gint +nice_agent_recv_messages ( + NiceAgent *agent, + guint stream_id, + guint component_id, + NiceInputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error); + +/** + * nice_agent_recv_nonblocking: + * @agent: a #NiceAgent + * @stream_id: the ID of the stream to receive on + * @component_id: the ID of the component to receive on + * @buf: (array length=buf_len) (out caller-allocates): caller-allocated buffer + * to write the received data into, of length at least @buf_len + * @buf_len: length of @buf + * @cancellable: (allow-none): a #GCancellable to allow the operation to be + * cancelled from another thread, or %NULL + * @error: (allow-none): return location for a #GError, or %NULL + * + * A single-message version of nice_agent_recv_messages_nonblocking(). + * + * Returns: the number of bytes received into @buf on success (guaranteed to be + * greater than 0 unless @buf_len is 0), or -1 on error + * + * Since: 0.1.5 + */ +gssize +nice_agent_recv_nonblocking ( + NiceAgent *agent, + guint stream_id, + guint component_id, + guint8 *buf, + gsize buf_len, + GCancellable *cancellable, + GError **error); + +/** + * nice_agent_recv_messages_nonblocking: + * @agent: a #NiceAgent + * @stream_id: the ID of the stream to receive on + * @component_id: the ID of the component to receive on + * @messages: (array length=n_messages) (out caller-allocates): caller-allocated + * array of #NiceInputMessages to write the received messages into, of length at + * least @n_messages + * @n_messages: number of entries in @messages + * @cancellable: (allow-none): a #GCancellable to allow the operation to be + * cancelled from another thread, or %NULL + * @error: (allow-none): return location for a #GError, or %NULL + * + * Try to receive data from the given stream/component combination on @agent, + * without blocking. If receiving data would block, -1 is returned and + * %G_IO_ERROR_WOULD_BLOCK is set in @error. If any other error occurs, -1 is + * returned and @error is set accordingly. Otherwise, 0 is returned if (and only + * if) @n_messages is 0. In all other cases, the number of valid messages stored + * in @messages is returned, and will be greater than 0. + * + * This function behaves similarly to nice_agent_recv_messages(), except that it + * will not block on filling (in reliable mode) or receiving (in non-reliable + * mode) exactly @n_messages messages. In reliable mode, it will receive bytes + * into @messages until it would block; in non-reliable mode, it will receive + * messages until it would block. + * + * As this function is non-blocking, @cancellable is included only for parity + * with nice_agent_recv_messages(). If @cancellable is cancelled before this + * function is called, a %G_IO_ERROR_CANCELLED error will be returned + * immediately. + * + * This must not be used in combination with nice_agent_attach_recv() on the + * same stream/component pair. + * + * Returns: the number of valid messages written to @messages on success + * (guaranteed to be greater than 0 unless @n_messages is 0), or -1 on error + * + * Since: 0.1.5 + */ +gint +nice_agent_recv_messages_nonblocking ( + NiceAgent *agent, + guint stream_id, + guint component_id, + NiceInputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error); /** * nice_agent_set_selected_pair: @@ -715,6 +1053,36 @@ NiceCandidate **remote); /** + * nice_agent_get_selected_socket: + * @agent: The #NiceAgent Object + * @stream_id: The ID of the stream + * @component_id: The ID of the component + * + * Retreive the local socket associated with the selected candidate pair + * for media transmission for a given stream's component. + * + * This is useful for adding ICE support to legacy applications that already + * have a protocol that maintains a connection. If the socket is duplicated + * before unrefing the agent, the application can take over and continue to use + * it. New applications are encouraged to use the built in libnice stream + * handling instead and let libnice handle the connection maintenance. + * + * Users of this method are encouraged to not use a TURN relay or any kind + * of proxy, as in this case, the socket will not be available to the + * application because the packets are encapsulated. + * + * Returns: (transfer full) pointer to the #GSocket, or NULL if there is no + * selected candidate or if the selected candidate is a relayed candidate. + * + * Since: 0.1.5 + */ +GSocket * +nice_agent_get_selected_socket ( + NiceAgent *agent, + guint stream_id, + guint component_id); + +/** * nice_agent_set_selected_remote_candidate: * @agent: The #NiceAgent Object * @stream_id: The ID of the stream @@ -1041,6 +1409,64 @@ guint stream_id, const gchar *sdp); +/** + * nice_agent_get_io_stream: + * @agent: A #NiceAgent + * @stream_id: The ID of the stream to wrap + * @component_id: The ID of the component to wrap + * + * Gets a #GIOStream wrapper around the given stream and component in + * @agent. The I/O stream will be valid for as long as @stream_id is valid. + * The #GInputStream and #GOutputStream implement #GPollableInputStream and + * #GPollableOutputStream. + * + * This function may only be called on reliable #NiceAgents. It is a + * programming error to try and create an I/O stream wrapper for an + * unreliable stream. + * + * Returns: (transfer full): A #GIOStream. + * + * Since: 0.1.5 + */ +GIOStream * +nice_agent_get_io_stream ( + NiceAgent *agent, + guint stream_id, + guint component_id); + +/** + * nice_component_state_to_string: + * @state: a #NiceComponentState + * + * Returns a string representation of the state, generally to use in debug + * messages. + * + * Returns: (transfer none): a string representation of @state + * Since: 0.1.6 + */ +const gchar * +nice_component_state_to_string (NiceComponentState state); + +/** + * nice_agent_forget_relays: + * @agent: The #NiceAgent Object + * @stream_id: The ID of the stream + * @component_id: The ID of the component + * + * Forget all the relay servers previously added using + * nice_agent_set_relay_info(). Currently connected streams will keep + * using the relay as long as they have not been restarted and haven't + * succesfully negotiated a different path. + * + * Returns: %FALSE if the component could not be found, %TRUE otherwise + * + * Since: 0.1.6 + */ +gboolean +nice_agent_forget_relays (NiceAgent *agent, + guint stream_id, + guint component_id); + G_END_DECLS #endif /* _AGENT_H */ diff -Nru libnice-0.1.4/agent/agent-priv.h libnice-0.1.7/agent/agent-priv.h --- libnice-0.1.4/agent/agent-priv.h 2012-09-12 18:33:34.000000000 +0000 +++ libnice-0.1.7/agent/agent-priv.h 2014-04-17 22:20:47.000000000 +0000 @@ -52,11 +52,47 @@ #include #include "agent.h" + +/** + * NiceInputMessageIter: + * @message: index of the message currently being written into + * @buffer: index of the buffer currently being written into + * @offset: byte offset into the buffer + * + * Iterator for sequentially writing into an array of #NiceInputMessages, + * tracking the current write position (i.e. the index of the next byte to be + * written). + * + * If @message is equal to the number of messages in the associated + * #NiceInputMessage array, and @buffer and @offset are zero, the iterator is at + * the end of the messages array, and the array is (presumably) full. + * + * Since: 0.1.5 + */ +typedef struct { + guint message; + guint buffer; + gsize offset; +} NiceInputMessageIter; + +void +nice_input_message_iter_reset (NiceInputMessageIter *iter); +gboolean +nice_input_message_iter_is_at_end (NiceInputMessageIter *iter, + NiceInputMessage *messages, guint n_messages); +guint +nice_input_message_iter_get_n_valid_messages (NiceInputMessageIter *iter); +gboolean +nice_input_message_iter_compare (const NiceInputMessageIter *a, + const NiceInputMessageIter *b); + + #include "socket.h" #include "candidate.h" #include "stream.h" #include "conncheck.h" #include "component.h" +#include "random.h" #include "stun/stunagent.h" #include "stun/usages/turn.h" #include "stun/usages/ice.h" @@ -122,6 +158,8 @@ #endif gchar *software_attribute; /* SOFTWARE attribute */ gboolean reliable; /* property: reliable */ + + GQueue pending_signals; /* XXX: add pointer to internal data struct for ABI-safe extensions */ }; @@ -140,6 +178,7 @@ void agent_lock (void); void agent_unlock (void); +void agent_unlock_and_emit (NiceAgent *agent); void agent_signal_new_selected_pair ( NiceAgent *agent, @@ -166,15 +205,45 @@ GSource *agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSourceFunc function, gpointer data); -void agent_attach_stream_component_socket (NiceAgent *agent, - Stream *stream, - Component *component, - NiceSocket *socket); - StunUsageIceCompatibility agent_to_ice_compatibility (NiceAgent *agent); StunUsageTurnCompatibility agent_to_turn_compatibility (NiceAgent *agent); NiceTurnSocketCompatibility agent_to_turn_socket_compatibility (NiceAgent *agent); void _priv_set_socket_tos (NiceAgent *agent, NiceSocket *sock, gint tos); +gboolean +component_io_cb ( + GSocket *gsocket, + GIOCondition condition, + gpointer data); + +gsize +memcpy_buffer_to_input_message (NiceInputMessage *message, + const guint8 *buffer, gsize buffer_length); +guint8 * +compact_input_message (const NiceInputMessage *message, gsize *buffer_length); + +guint8 * +compact_output_message (const NiceOutputMessage *message, gsize *buffer_length); + +gsize +output_message_get_size (const NiceOutputMessage *message); + +/* + * nice_debug_init: + * + * Initialize the debugging system. Uses the NICE_DEBUG environment variable + * to set the appropriate debugging flags + */ +void nice_debug_init (void); + + +#ifdef NDEBUG +static inline gboolean nice_debug_is_enabled (void) { return FALSE; } +static inline void nice_debug (const char *fmt, ...) { } +#else +gboolean nice_debug_is_enabled (void); +void nice_debug (const char *fmt, ...) G_GNUC_PRINTF (1, 2); +#endif + #endif /*_NICE_AGENT_PRIV_H */ diff -Nru libnice-0.1.4/agent/agent-signals-marshal.c libnice-0.1.7/agent/agent-signals-marshal.c --- libnice-0.1.4/agent/agent-signals-marshal.c 2013-02-23 00:30:51.000000000 +0000 +++ libnice-0.1.7/agent/agent-signals-marshal.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,210 +0,0 @@ -#include "agent-signals-marshal.h" - -#include - - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_schar (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#define g_marshal_value_peek_variant(v) g_value_get_variant (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_long -#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* VOID:UINT,UINT,UINT (agent-signals-marshal.list:2) */ -void -agent_marshal_VOID__UINT_UINT_UINT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__UINT_UINT_UINT) (gpointer data1, - guint arg_1, - guint arg_2, - guint arg_3, - gpointer data2); - register GMarshalFunc_VOID__UINT_UINT_UINT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__UINT_UINT_UINT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_uint (param_values + 1), - g_marshal_value_peek_uint (param_values + 2), - g_marshal_value_peek_uint (param_values + 3), - data2); -(void)return_value;(void)invocation_hint;} - -/* VOID:UINT,UINT,STRING,STRING (agent-signals-marshal.list:4) */ -void -agent_marshal_VOID__UINT_UINT_STRING_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__UINT_UINT_STRING_STRING) (gpointer data1, - guint arg_1, - guint arg_2, - gpointer arg_3, - gpointer arg_4, - gpointer data2); - register GMarshalFunc_VOID__UINT_UINT_STRING_STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 5); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__UINT_UINT_STRING_STRING) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_uint (param_values + 1), - g_marshal_value_peek_uint (param_values + 2), - g_marshal_value_peek_string (param_values + 3), - g_marshal_value_peek_string (param_values + 4), - data2); -(void)return_value;(void)invocation_hint;} - -/* VOID:UINT,UINT,STRING (agent-signals-marshal.list:6) */ -void -agent_marshal_VOID__UINT_UINT_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__UINT_UINT_STRING) (gpointer data1, - guint arg_1, - guint arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_VOID__UINT_UINT_STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__UINT_UINT_STRING) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_uint (param_values + 1), - g_marshal_value_peek_uint (param_values + 2), - g_marshal_value_peek_string (param_values + 3), - data2); -(void)return_value;(void)invocation_hint;} - -/* VOID:UINT (agent-signals-marshal.list:9) */ - -/* VOID:UINT,UINT (agent-signals-marshal.list:11) */ -void -agent_marshal_VOID__UINT_UINT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__UINT_UINT) (gpointer data1, - guint arg_1, - guint arg_2, - gpointer data2); - register GMarshalFunc_VOID__UINT_UINT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__UINT_UINT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_uint (param_values + 1), - g_marshal_value_peek_uint (param_values + 2), - data2); -(void)return_value;(void)invocation_hint;} - diff -Nru libnice-0.1.4/agent/agent-signals-marshal.h libnice-0.1.7/agent/agent-signals-marshal.h --- libnice-0.1.4/agent/agent-signals-marshal.h 2013-02-23 00:30:51.000000000 +0000 +++ libnice-0.1.7/agent/agent-signals-marshal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ - -#ifndef __agent_marshal_MARSHAL_H__ -#define __agent_marshal_MARSHAL_H__ - -#include - -G_BEGIN_DECLS - -/* VOID:UINT,UINT,UINT (agent-signals-marshal.list:2) */ -extern void agent_marshal_VOID__UINT_UINT_UINT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:UINT,UINT,STRING,STRING (agent-signals-marshal.list:4) */ -extern void agent_marshal_VOID__UINT_UINT_STRING_STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:UINT,UINT,STRING (agent-signals-marshal.list:6) */ -extern void agent_marshal_VOID__UINT_UINT_STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:UINT (agent-signals-marshal.list:9) */ -#define agent_marshal_VOID__UINT g_cclosure_marshal_VOID__UINT - -/* VOID:UINT,UINT (agent-signals-marshal.list:11) */ -extern void agent_marshal_VOID__UINT_UINT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -G_END_DECLS - -#endif /* __agent_marshal_MARSHAL_H__ */ - diff -Nru libnice-0.1.4/agent/agent-signals-marshal.list libnice-0.1.7/agent/agent-signals-marshal.list --- libnice-0.1.4/agent/agent-signals-marshal.list 2011-02-02 04:49:41.000000000 +0000 +++ libnice-0.1.7/agent/agent-signals-marshal.list 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -# component-status-changed -VOID:UINT,UINT,UINT -# new-selected-pair -VOID:UINT,UINT,STRING,STRING -# new-candidate -VOID:UINT,UINT,STRING -# candidate-gathering-done -# initial-binding-request-received -VOID:UINT -# reliable-transport-writable -VOID:UINT,UINT - diff -Nru libnice-0.1.4/agent/candidate.c libnice-0.1.7/agent/candidate.c --- libnice-0.1.4/agent/candidate.c 2011-02-02 04:49:41.000000000 +0000 +++ libnice-0.1.7/agent/candidate.c 2014-04-25 01:09:45.000000000 +0000 @@ -80,6 +80,9 @@ if (candidate->password) g_free (candidate->password); + if (candidate->turn) + turn_server_unref (candidate->turn); + g_slice_free (NiceCandidate, candidate); } @@ -93,10 +96,8 @@ case NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE: return 900; case NICE_CANDIDATE_TYPE_PEER_REFLEXIVE: return 900; case NICE_CANDIDATE_TYPE_RELAYED: return 500; + default: return 0; } - - /* appease GCC */ - return 0; } guint32 @@ -108,10 +109,8 @@ case NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE: return 550; case NICE_CANDIDATE_TYPE_PEER_REFLEXIVE: return 550; case NICE_CANDIDATE_TYPE_RELAYED: return 450; + default: return 0; } - - /* appease GCC */ - return 0; } @@ -138,7 +137,7 @@ guint32 nice_candidate_ice_priority (const NiceCandidate *candidate) { - guint8 type_preference = 0; + guint8 type_preference; switch (candidate->type) { @@ -150,6 +149,8 @@ type_preference = NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE; break; case NICE_CANDIDATE_TYPE_RELAYED: type_preference = NICE_CANDIDATE_TYPE_PREF_RELAYED; break; + default: + type_preference = 0; break; } /* return _candidate_ice_priority (type_preference, 1, candidate->component_id); */ @@ -165,8 +166,11 @@ { guint32 max = o_prio > a_prio ? o_prio : a_prio; guint32 min = o_prio < a_prio ? o_prio : a_prio; + /* These two constants are here explictly to make some version of GCC happy */ + const guint64 one = 1; + const guint64 thirtytwo = 32; - return ((guint64)1 << 32) * min + 2 * max + (o_prio > a_prio ? 1 : 0); + return (one << thirtytwo) * min + 2 * max + (o_prio > a_prio ? 1 : 0); } /* @@ -179,6 +183,7 @@ memcpy (copy, candidate, sizeof(NiceCandidate)); + copy->turn = NULL; copy->username = g_strdup (copy->username); copy->password = g_strdup (copy->password); diff -Nru libnice-0.1.4/agent/candidate.h libnice-0.1.7/agent/candidate.h --- libnice-0.1.4/agent/candidate.h 2012-10-01 18:35:48.000000000 +0000 +++ libnice-0.1.7/agent/candidate.h 2014-04-25 01:09:45.000000000 +0000 @@ -129,6 +129,8 @@ */ struct _TurnServer { + gint ref_count; + NiceAddress server; /**< TURN server address */ gchar *username; /**< TURN username */ gchar *password; /**< TURN password */ diff -Nru libnice-0.1.4/agent/component.c libnice-0.1.7/agent/component.c --- libnice-0.1.4/agent/component.c 2012-02-15 21:04:46.000000000 +0000 +++ libnice-0.1.7/agent/component.c 2014-04-25 01:09:45.000000000 +0000 @@ -51,28 +51,154 @@ #include "debug.h" #include "component.h" +#include "discovery.h" #include "agent-priv.h" + +static void +component_schedule_io_callback (Component *component); +static void +component_deschedule_io_callback (Component *component); + + +/* Must *not* take the agent lock, since it’s called from within + * component_set_io_context(), which holds the Component’s I/O lock. */ +static void +socket_source_attach (SocketSource *socket_source, GMainContext *context) +{ + GSource *source; + + /* Create a source. */ + source = g_socket_create_source (socket_source->socket->fileno, + G_IO_IN, NULL); + g_source_set_callback (source, (GSourceFunc) component_io_cb, + socket_source, NULL); + + /* Add the source. */ + nice_debug ("Attaching source %p (socket %p, FD %d) to context %p", source, + socket_source->socket, g_socket_get_fd (socket_source->socket->fileno), + context); + + g_assert (socket_source->source == NULL); + socket_source->source = source; + g_source_attach (source, context); +} + +static void +socket_source_detach (SocketSource *source) +{ + nice_debug ("Detaching source %p (socket %p, FD %d) from context %p", + source->source, source->socket, + (source->socket->fileno != NULL) ? + g_socket_get_fd (source->socket->fileno) : 0, + (source->source != NULL) ? g_source_get_context (source->source) : 0); + + if (source->source != NULL) { + g_source_destroy (source->source); + g_source_unref (source->source); + } + source->source = NULL; +} + +static void +socket_source_free (SocketSource *source) +{ + socket_source_detach (source); + nice_socket_free (source->socket); + + g_slice_free (SocketSource, source); +} + Component * -component_new (guint id) +component_new (guint id, NiceAgent *agent, Stream *stream) { Component *component; + GSource *src; component = g_slice_new0 (Component); component->id = id; component->state = NICE_COMPONENT_STATE_DISCONNECTED; component->restart_candidate = NULL; component->tcp = NULL; + component->agent = agent; + component->stream = stream; + + g_mutex_init (&component->io_mutex); + g_queue_init (&component->pending_io_messages); + component->io_callback_id = 0; + + component->own_ctx = g_main_context_new (); + component->stop_cancellable = g_cancellable_new (); + src = g_cancellable_source_new (component->stop_cancellable); + g_source_set_dummy_callback (src); + g_source_attach (src, component->own_ctx); + g_source_unref (src); + component->ctx = g_main_context_ref (component->own_ctx); + + /* Start off with a fresh main context and all I/O paused. This + * will be updated when nice_agent_attach_recv() or nice_agent_recv_messages() + * are called. */ + component_set_io_context (component, NULL); + component_set_io_callback (component, NULL, NULL, NULL, 0, NULL); + + g_queue_init (&component->queued_tcp_packets); return component; } +void +component_clean_turn_servers (Component *cmp) +{ + GSList *i; + + g_list_free_full (cmp->turn_servers, (GDestroyNotify) turn_server_unref); + cmp->turn_servers = NULL; + + for (i = cmp->local_candidates; i;) { + NiceCandidate *candidate = i->data; + GSList *next = i->next; + + if (candidate->type != NICE_CANDIDATE_TYPE_RELAYED) { + i = next; + continue; + } + + /* note: do not remove the remote candidate that is + * currently part of the 'selected pair', see ICE + * 9.1.1.1. "ICE Restarts" (ID-19) + * + * So what we do instead is that we put the selected candidate + * in a special location and keep it "alive" that way. This is + * especially important for TURN, because refresh requests to the + * server need to keep happening. + */ + if (candidate == cmp->selected_pair.local) { + if (cmp->turn_candidate) { + refresh_prune_candidate (cmp->agent, cmp->turn_candidate); + component_detach_socket (cmp, cmp->turn_candidate->sockptr); + nice_candidate_free (cmp->turn_candidate); + } + /* Bring the priority down to 0, so that it will be replaced + * on the new run. + */ + cmp->selected_pair.priority = 0; + cmp->turn_candidate = candidate; + } else { + refresh_prune_candidate (cmp->agent, candidate); + component_detach_socket (cmp, candidate->sockptr); + nice_candidate_free (candidate); + } + cmp->local_candidates = g_slist_delete_link (cmp->local_candidates, i); + i = next; + } +} void component_free (Component *cmp) { GSList *i; - GList *item; + IOCallbackData *data; + GOutputVector *vec; for (i = cmp->local_candidates; i; i = i->next) { NiceCandidate *candidate = i->data; @@ -88,17 +214,10 @@ nice_candidate_free (cmp->restart_candidate), cmp->restart_candidate = NULL; - for (i = cmp->sockets; i; i = i->next) { - NiceSocket *udpsocket = i->data; - nice_socket_free (udpsocket); - } + if (cmp->turn_candidate) + nice_candidate_free (cmp->turn_candidate), + cmp->turn_candidate = NULL; - for (i = cmp->gsources; i; i = i->next) { - GSource *source = i->data; - g_source_destroy (source); - g_source_unref (source); - } - for (i = cmp->incoming_checks; i; i = i->next) { IncomingCheck *icheck = i->data; g_free (icheck->username); @@ -106,18 +225,14 @@ } g_slist_free (cmp->local_candidates); + cmp->local_candidates = NULL; g_slist_free (cmp->remote_candidates); - g_slist_free (cmp->sockets); - g_slist_free (cmp->gsources); + cmp->remote_candidates = NULL; + component_free_socket_sources (cmp); g_slist_free (cmp->incoming_checks); + cmp->incoming_checks = NULL; - for (item = cmp->turn_servers; item; item = g_list_next (item)) { - TurnServer *turn = item->data; - g_free (turn->username); - g_free (turn->password); - g_slice_free (TurnServer, turn); - } - g_list_free (cmp->turn_servers); + component_clean_turn_servers (cmp); if (cmp->selected_pair.keepalive.tick_source != NULL) { g_source_destroy (cmp->selected_pair.keepalive.tick_source); @@ -130,21 +245,39 @@ g_source_unref (cmp->tcp_clock); cmp->tcp_clock = NULL; } + if (cmp->tcp_writable_cancellable) { + g_cancellable_cancel (cmp->tcp_writable_cancellable); + g_clear_object (&cmp->tcp_writable_cancellable); + } if (cmp->tcp) { pseudo_tcp_socket_close (cmp->tcp, TRUE); - g_object_unref (cmp->tcp); - cmp->tcp = NULL; - } - if (cmp->tcp_data != NULL) { - g_slice_free (TcpUserData, cmp->tcp_data); - cmp->tcp_data = NULL; + g_clear_object(&cmp->tcp); } + while ((data = g_queue_pop_head (&cmp->pending_io_messages)) != NULL) + io_callback_data_free (data); + + component_deschedule_io_callback (cmp); + + g_cancellable_cancel (cmp->stop_cancellable); + g_clear_object (&cmp->stop_cancellable); + if (cmp->ctx != NULL) { g_main_context_unref (cmp->ctx); cmp->ctx = NULL; } + g_main_context_unref (cmp->own_ctx); + + while ((vec = g_queue_pop_head (&cmp->queued_tcp_packets)) != NULL) { + g_free ((gpointer) vec->buffer); + g_slice_free (GOutputVector, vec); + } + + g_clear_object (&cmp->iostream); + + g_mutex_clear (&cmp->io_mutex); + g_slice_free (Component, cmp); } @@ -191,7 +324,7 @@ * Resets the component state to that of a ICE restarted * session. */ -gboolean +void component_restart (Component *cmp) { GSList *i; @@ -199,7 +332,7 @@ for (i = cmp->remote_candidates; i; i = i->next) { NiceCandidate *candidate = i->data; - /* note: do not remove the remote candidate that is + /* note: do not remove the local candidate that is * currently part of the 'selected pair', see ICE * 9.1.1.1. "ICE Restarts" (ID-19) */ if (candidate == cmp->selected_pair.remote) { @@ -222,8 +355,6 @@ cmp->incoming_checks = NULL; /* note: component state managed by agent */ - - return TRUE; } /* @@ -334,3 +465,691 @@ return local; } + +static gint +_find_socket_source (gconstpointer a, gconstpointer b) +{ + const SocketSource *source_a = a; + const NiceSocket *socket_b = b; + + return (source_a->socket == socket_b) ? 0 : 1; +} + +/* This takes ownership of the socket. + * It creates and attaches a source to the component’s context. */ +void +component_attach_socket (Component *component, NiceSocket *nicesock) +{ + GSList *l; + SocketSource *socket_source; + + g_assert (component != NULL); + g_assert (nicesock != NULL); + + g_assert (component->ctx != NULL); + + /* Find an existing SocketSource in the component which contains @socket, or + * create a new one. + * + * Whenever a source is added or remove to socket_sources, socket_sources_age + * must be incremented. + */ + l = g_slist_find_custom (component->socket_sources, nicesock, + _find_socket_source); + if (l != NULL) { + socket_source = l->data; + } else { + socket_source = g_slice_new0 (SocketSource); + socket_source->socket = nicesock; + socket_source->component = component; + component->socket_sources = + g_slist_prepend (component->socket_sources, socket_source); + component->socket_sources_age++; + } + + /* Create and attach a source */ + nice_debug ("Component %p (agent %p): Attach source (stream %u).", + component, component->agent, component->stream->id); + socket_source_attach (socket_source, component->ctx); +} + +/* Reattaches socket handles of @component to the main context. + * + * Must *not* take the agent lock, since it’s called from within + * component_set_io_context(), which holds the Component’s I/O lock. */ +static void +component_reattach_all_sockets (Component *component) +{ + GSList *i; + + for (i = component->socket_sources; i != NULL; i = i->next) { + SocketSource *socket_source = i->data; + nice_debug ("Reattach source %p.", socket_source->source); + socket_source_detach (socket_source); + socket_source_attach (socket_source, component->ctx); + } +} + +/** + * component_detach_socket: + * @component: a #Component + * @socket: the socket to detach the source for + * + * Detach the #GSource for the single specified @socket. It also closes it + * and frees it! + * + * If the @socket doesn’t exist in this @component, do nothing. + */ +void +component_detach_socket (Component *component, NiceSocket *nicesock) +{ + GSList *l; + SocketSource *socket_source; + + nice_debug ("Detach socket %p.", nicesock); + + /* Find the SocketSource for the socket. */ + l = g_slist_find_custom (component->socket_sources, nicesock, + _find_socket_source); + if (l == NULL) + return; + + /* Detach the source. */ + socket_source = l->data; + component->socket_sources = g_slist_delete_link (component->socket_sources, l); + component->socket_sources_age++; + + socket_source_detach (socket_source); + socket_source_free (socket_source); +} + +/* + * Detaches socket handles of @component from the main context. Leaves the + * sockets themselves untouched. + * + * Must *not* take the agent lock, since it’s called from within + * component_set_io_context(), which holds the Component’s I/O lock. + */ +void +component_detach_all_sockets (Component *component) +{ + GSList *i; + + for (i = component->socket_sources; i != NULL; i = i->next) { + SocketSource *socket_source = i->data; + nice_debug ("Detach source %p, socket %p.", socket_source->source, + socket_source->socket); + socket_source_detach (socket_source); + } +} + +void +component_free_socket_sources (Component *component) +{ + nice_debug ("Free socket sources for component %p.", component); + + g_slist_free_full (component->socket_sources, + (GDestroyNotify) socket_source_free); + component->socket_sources = NULL; + component->socket_sources_age++; +} + +GMainContext * +component_dup_io_context (Component *component) +{ + return g_main_context_ref (component->own_ctx); +} + +/* If @context is %NULL, it's own context is used, so component->ctx is always + * guaranteed to be non-%NULL. */ +void +component_set_io_context (Component *component, GMainContext *context) +{ + g_mutex_lock (&component->io_mutex); + + if (component->ctx != context) { + if (context == NULL) + context = g_main_context_ref (component->own_ctx); + else + g_main_context_ref (context); + + component_detach_all_sockets (component); + g_main_context_unref (component->ctx); + + component->ctx = context; + component_reattach_all_sockets (component); + } + + g_mutex_unlock (&component->io_mutex); +} + +/* (func, user_data) and (recv_messages, n_recv_messages) are mutually + * exclusive. At most one of the two must be specified; if both are NULL, the + * Component will not receive any data (i.e. reception is paused). + * + * Apart from during setup, this must always be called with the agent lock held, + * and the I/O lock released (because it takes the I/O lock itself). Requiring + * the agent lock to be held means it can’t be called between a packet being + * dequeued from the kernel buffers in agent.c, and an I/O callback being + * emitted for it (which could cause data loss if the I/O callback function was + * unset in that time). */ +void +component_set_io_callback (Component *component, + NiceAgentRecvFunc func, gpointer user_data, + NiceInputMessage *recv_messages, guint n_recv_messages, + GError **error) +{ + g_assert (func == NULL || recv_messages == NULL); + g_assert (n_recv_messages == 0 || recv_messages != NULL); + g_assert (error == NULL || *error == NULL); + + g_mutex_lock (&component->io_mutex); + + if (func != NULL) { + component->io_callback = func; + component->io_user_data = user_data; + component->recv_messages = NULL; + component->n_recv_messages = 0; + + component_schedule_io_callback (component); + } else { + component->io_callback = NULL; + component->io_user_data = NULL; + component->recv_messages = recv_messages; + component->n_recv_messages = n_recv_messages; + + component_deschedule_io_callback (component); + } + + nice_input_message_iter_reset (&component->recv_messages_iter); + component->recv_buf_error = error; + + g_mutex_unlock (&component->io_mutex); +} + +gboolean +component_has_io_callback (Component *component) +{ + gboolean has_io_callback; + + g_mutex_lock (&component->io_mutex); + has_io_callback = (component->io_callback != NULL); + g_mutex_unlock (&component->io_mutex); + + return has_io_callback; +} + +IOCallbackData * +io_callback_data_new (const guint8 *buf, gsize buf_len) +{ + IOCallbackData *data; + + data = g_slice_new0 (IOCallbackData); + data->buf = g_memdup (buf, buf_len); + data->buf_len = buf_len; + data->offset = 0; + + return data; +} + +void +io_callback_data_free (IOCallbackData *data) +{ + g_free (data->buf); + g_slice_free (IOCallbackData, data); +} + +/* This is called with the global agent lock released. It does not take that + * lock, but does take the io_mutex. */ +static gboolean +emit_io_callback_cb (gpointer user_data) +{ + Component *component = user_data; + IOCallbackData *data; + NiceAgentRecvFunc io_callback; + gpointer io_user_data; + guint stream_id, component_id; + NiceAgent *agent; + + agent = component->agent; + + g_object_ref (agent); + + stream_id = component->stream->id; + component_id = component->id; + + g_mutex_lock (&component->io_mutex); + + /* The members of Component are guaranteed not to have changed since this + * GSource was attached in component_emit_io_callback(). The Component’s agent + * and stream are immutable after construction, as are the stream and + * component IDs. The callback and its user data may have changed, but are + * guaranteed to be non-%NULL at the start as the idle source is removed when + * the callback is set to %NULL. They may become %NULL during the io_callback, + * so must be re-checked every loop iteration. The data buffer is copied into + * the #IOCallbackData closure. + * + * If the component is destroyed (which happens if the agent or stream are + * destroyed) between attaching the GSource and firing it, the GSource is + * detached in component_free() and this callback is never invoked. If the + * agent is destroyed during an io_callback, its weak pointer will be + * nullified. Similarly, the Component needs to be re-queried for after every + * iteration, just in case the client has removed the stream in the + * callback. */ + while (TRUE) { + io_callback = component->io_callback; + io_user_data = component->io_user_data; + data = g_queue_peek_head (&component->pending_io_messages); + + if (data == NULL || io_callback == NULL) + break; + + g_mutex_unlock (&component->io_mutex); + + io_callback (agent, stream_id, component_id, + data->buf_len - data->offset, (gchar *) data->buf + data->offset, + io_user_data); + + /* Check for the user destroying things underneath our feet. */ + if (!agent_find_component (agent, stream_id, component_id, + NULL, &component)) { + nice_debug ("%s: Agent or component destroyed.", G_STRFUNC); + goto done; + } + + g_queue_pop_head (&component->pending_io_messages); + io_callback_data_free (data); + + g_mutex_lock (&component->io_mutex); + } + + component->io_callback_id = 0; + g_mutex_unlock (&component->io_mutex); + + done: + g_object_unref (agent); + + return G_SOURCE_REMOVE; +} + +/* This must be called with the agent lock *held*. */ +void +component_emit_io_callback (Component *component, + const guint8 *buf, gsize buf_len) +{ + NiceAgent *agent; + guint stream_id, component_id; + NiceAgentRecvFunc io_callback; + gpointer io_user_data; + + g_assert (component != NULL); + g_assert (buf != NULL); + g_assert (buf_len > 0); + + agent = component->agent; + stream_id = component->stream->id; + component_id = component->id; + + g_mutex_lock (&component->io_mutex); + io_callback = component->io_callback; + io_user_data = component->io_user_data; + g_mutex_unlock (&component->io_mutex); + + /* Allow this to be called with a NULL io_callback, since the caller can’t + * lock io_mutex to check beforehand. */ + if (io_callback == NULL) + return; + + g_assert (NICE_IS_AGENT (agent)); + g_assert (stream_id > 0); + g_assert (component_id > 0); + g_assert (io_callback != NULL); + + /* Only allocate a closure if the callback is being deferred to an idle + * handler. */ + if (g_main_context_is_owner (component->ctx)) { + /* Thread owns the main context, so invoke the callback directly. */ + agent_unlock_and_emit (agent); + io_callback (agent, stream_id, + component_id, buf_len, (gchar *) buf, io_user_data); + agent_lock (); + } else { + IOCallbackData *data; + + g_mutex_lock (&component->io_mutex); + + /* Slow path: Current thread doesn’t own the Component’s context at the + * moment, so schedule the callback in an idle handler. */ + data = io_callback_data_new (buf, buf_len); + g_queue_push_tail (&component->pending_io_messages, + data); /* transfer ownership */ + + nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); + + component_schedule_io_callback (component); + + g_mutex_unlock (&component->io_mutex); + } +} + +/* Note: Must be called with the io_mutex held. */ +static void +component_schedule_io_callback (Component *component) +{ + GSource *source; + + /* Already scheduled or nothing to schedule? */ + if (component->io_callback_id != 0 || + g_queue_is_empty (&component->pending_io_messages)) + return; + + /* Add the idle callback. If nice_agent_attach_recv() is called with a + * NULL callback before this source is dispatched, the source will be + * destroyed, but any pending data will remain in + * component->pending_io_messages, ready to be picked up when a callback + * is re-attached, or if nice_agent_recv() is called. */ + source = g_idle_source_new (); + g_source_set_priority (source, G_PRIORITY_DEFAULT); + g_source_set_callback (source, emit_io_callback_cb, component, NULL); + component->io_callback_id = g_source_attach (source, component->ctx); + g_source_unref (source); +} + +/* Note: Must be called with the io_mutex held. */ +static void +component_deschedule_io_callback (Component *component) +{ + /* Already descheduled? */ + if (component->io_callback_id == 0) + return; + + g_source_remove (component->io_callback_id); + component->io_callback_id = 0; +} + +/** + * ComponentSource: + * + * This is a GSource which wraps a single Component and is dispatched whenever + * any of its NiceSockets are dispatched, i.e. it proxies all poll() events for + * every socket in the Component. It is designed for use by GPollableInputStream + * and GPollableOutputStream, so that a Component can be incorporated into a + * custom main context iteration. + * + * The callbacks dispatched by a ComponentSource have type GPollableSourceFunc. + * + * ComponentSource supports adding a GCancellable child source which will + * additionally dispatch if a provided GCancellable is cancelled. + * + * Internally, ComponentSource adds a new GSocketSource for each socket in the + * Component. Changes to the Component’s list of sockets are detected on each + * call to component_source_prepare(), which compares a stored age with the + * current age of the Component’s socket list — if the socket list has changed, + * the age will have increased (indicating added sockets) or will have been + * reset to 0 (indicating all sockets have been closed). + */ +typedef struct { + GSource parent; + + GObject *pollable_stream; /* owned */ + + GWeakRef agent_ref; + guint stream_id; + guint component_id; + guint component_socket_sources_age; + + /* SocketSource, free with free_child_socket_source() */ + GSList *socket_sources; + + GIOCondition condition; +} ComponentSource; + +static gboolean +component_source_prepare (GSource *source, gint *timeout_) +{ + ComponentSource *component_source = (ComponentSource *) source; + NiceAgent *agent; + Component *component; + GSList *parentl, *childl; + + agent = g_weak_ref_get (&component_source->agent_ref); + if (!agent) + return FALSE; + + /* Needed due to accessing the Component. */ + agent_lock (); + + if (!agent_find_component (agent, + component_source->stream_id, component_source->component_id, NULL, + &component)) + goto done; + + + if (component->socket_sources_age == + component_source->component_socket_sources_age) + goto done; + + /* If the age has changed, either + * - one or more new socket has been prepended + * - old sockets have been removed + */ + + /* Add the new child sources. */ + + for (parentl = component->socket_sources; parentl; parentl = parentl->next) { + SocketSource *parent_socket_source = parentl->data; + SocketSource *child_socket_source; + + /* Iterating the list of socket sources every time isn't a big problem + * because the number of pairs is limited ~100 normally, so there will + * rarely be more than 10. + */ + childl = g_slist_find_custom (component_source->socket_sources, + parent_socket_source->socket, _find_socket_source); + + /* If we have reached this state, then all sources new sources have been + * added, because they are always prepended. + */ + if (childl) + break; + + child_socket_source = g_slice_new0 (SocketSource); + child_socket_source->socket = parent_socket_source->socket; + child_socket_source->source = + g_socket_create_source (child_socket_source->socket->fileno, G_IO_IN, + NULL); + g_source_set_dummy_callback (child_socket_source->source); + g_source_add_child_source (source, child_socket_source->source); + g_source_unref (child_socket_source->source); + component_source->socket_sources = + g_slist_prepend (component_source->socket_sources, child_socket_source); + } + + + for (childl = component_source->socket_sources; + childl;) { + SocketSource *child_socket_source = childl->data; + GSList *next = childl->next; + + parentl = g_slist_find_custom (component->socket_sources, + child_socket_source->socket, _find_socket_source); + + /* If this is not a currently used socket, remove the relevant source */ + if (!parentl) { + g_source_remove_child_source (source, child_socket_source->source); + g_slice_free (SocketSource, child_socket_source); + component_source->socket_sources = + g_slist_delete_link (component_source->socket_sources, childl); + } + + childl = next; + } + + + /* Update the age. */ + component_source->component_socket_sources_age = component->socket_sources_age; + + done: + + agent_unlock_and_emit (agent); + + /* We can’t be sure if the ComponentSource itself needs to be dispatched until + * poll() is called on all the child sources. */ + return FALSE; +} + +static gboolean +component_source_dispatch (GSource *source, GSourceFunc callback, + gpointer user_data) +{ + ComponentSource *component_source = (ComponentSource *) source; + GPollableSourceFunc func = (GPollableSourceFunc) callback; + + return func (component_source->pollable_stream, user_data); +} + +static void +free_child_socket_source (gpointer data) +{ + g_slice_free (SocketSource, data); +} + +static void +component_source_finalize (GSource *source) +{ + ComponentSource *component_source = (ComponentSource *) source; + + g_slist_free_full (component_source->socket_sources, free_child_socket_source); + + g_weak_ref_clear (&component_source->agent_ref); + g_object_unref (component_source->pollable_stream); + component_source->pollable_stream = NULL; +} + +static gboolean +component_source_closure_callback (GObject *pollable_stream, gpointer user_data) +{ + GClosure *closure = user_data; + GValue param_value = G_VALUE_INIT; + GValue result_value = G_VALUE_INIT; + gboolean retval; + + g_value_init (&result_value, G_TYPE_BOOLEAN); + g_value_init (¶m_value, G_TYPE_OBJECT); + g_value_set_object (¶m_value, pollable_stream); + + g_closure_invoke (closure, &result_value, 1, ¶m_value, NULL); + retval = g_value_get_boolean (&result_value); + + g_value_unset (¶m_value); + g_value_unset (&result_value); + + return retval; +} + +static GSourceFuncs component_source_funcs = { + component_source_prepare, + NULL, /* check */ + component_source_dispatch, + component_source_finalize, + (GSourceFunc) component_source_closure_callback, +}; + +/** + * component_source_new: + * @agent: a #NiceAgent + * @stream_id: The stream's id + * @component_id: The component's number + * @pollable_stream: a #GPollableInputStream or #GPollableOutputStream to pass + * to dispatched callbacks + * @cancellable: (allow-none): a #GCancellable, or %NULL + * + * Create a new #ComponentSource, a type of #GSource which proxies poll events + * from all sockets in the given @component. + * + * A callback function of type #GPollableSourceFunc must be connected to the + * returned #GSource using g_source_set_callback(). @pollable_stream is passed + * to all callbacks dispatched from the #GSource, and a reference is held on it + * by the #GSource. + * + * The #GSource will automatically update to poll sockets as they’re added to + * the @component (e.g. during peer discovery). + * + * Returns: (transfer full): a new #ComponentSource; unref with g_source_unref() + */ +GSource * +component_input_source_new (NiceAgent *agent, guint stream_id, + guint component_id, GPollableInputStream *pollable_istream, + GCancellable *cancellable) +{ + ComponentSource *component_source; + + g_assert (G_IS_POLLABLE_INPUT_STREAM (pollable_istream)); + + component_source = + (ComponentSource *) + g_source_new (&component_source_funcs, sizeof (ComponentSource)); + g_source_set_name ((GSource *) component_source, "ComponentSource"); + + component_source->component_socket_sources_age = 0; + component_source->pollable_stream = g_object_ref (pollable_istream); + g_weak_ref_init (&component_source->agent_ref, agent); + component_source->stream_id = stream_id; + component_source->component_id = component_id; + + /* Add a cancellable source. */ + if (cancellable != NULL) { + GSource *cancellable_source; + + cancellable_source = g_cancellable_source_new (cancellable); + g_source_set_dummy_callback (cancellable_source); + g_source_add_child_source ((GSource *) component_source, + cancellable_source); + g_source_unref (cancellable_source); + } + + return (GSource *) component_source; +} + + +TurnServer * +turn_server_new (const gchar *server_ip, guint server_port, + const gchar *username, const gchar *password, NiceRelayType type) +{ + TurnServer *turn = g_slice_new (TurnServer); + + nice_address_init (&turn->server); + + turn->ref_count = 1; + if (nice_address_set_from_string (&turn->server, server_ip)) { + nice_address_set_port (&turn->server, server_port); + } else { + g_slice_free (TurnServer, turn); + return NULL; + } + turn->username = g_strdup (username); + turn->password = g_strdup (password); + turn->type = type; + + return turn; +} + +TurnServer * +turn_server_ref (TurnServer *turn) +{ + turn->ref_count++; + + return turn; +} + +void +turn_server_unref (TurnServer *turn) +{ + turn->ref_count--; + + if (turn->ref_count == 0) { + g_free (turn->username); + g_free (turn->password); + g_slice_free (TurnServer, turn); + } +} diff -Nru libnice-0.1.4/agent/component.h libnice-0.1.7/agent/component.h --- libnice-0.1.4/agent/component.h 2011-02-02 04:50:08.000000000 +0000 +++ libnice-0.1.7/agent/component.h 2014-04-25 01:09:45.000000000 +0000 @@ -45,6 +45,7 @@ typedef struct _Component Component; #include "agent.h" +#include "agent-priv.h" #include "candidate.h" #include "stun/stunagent.h" #include "stun/usages/timer.h" @@ -95,11 +96,44 @@ uint16_t username_len; }; +/* A pair of a socket and the GSource which polls it from the main loop. All + * GSources in a Component must be attached to the same main context: + * component->ctx. + * + * Socket must be non-NULL, but source may be NULL if it has been detached. + * + * The Component is stored so this may be used as the user data for a GSource + * callback. */ typedef struct { - NiceAgent *agent; - Stream *stream; + NiceSocket *socket; + GSource *source; Component *component; -} TcpUserData; +} SocketSource; + + +/* A message which has been received and processed (so is guaranteed not + * to be a STUN packet, or to contain pseudo-TCP header bytes, for example), but + * which hasn’t yet been sent to the client in an I/O callback. This could be + * due to the main context not being run, or due to the I/O callback being + * detached. + * + * The @offset member gives the byte offset into @buf which has already been + * sent to the client. #IOCallbackData buffers remain in the + * #Component::pending_io_messages queue until all of their bytes have been sent + * to the client. + * + * @offset is guaranteed to be smaller than @buf_len. */ +typedef struct { + guint8 *buf; /* owned */ + gsize buf_len; + gsize offset; +} IOCallbackData; + +IOCallbackData * +io_callback_data_new (const guint8 *buf, gsize buf_len); +void +io_callback_data_free (IOCallbackData *data); + struct _Component { @@ -108,27 +142,71 @@ NiceComponentState state; GSList *local_candidates; /**< list of Candidate objs */ GSList *remote_candidates; /**< list of Candidate objs */ - GSList *sockets; /**< list of NiceSocket objs */ - GSList *gsources; /**< list of GSource objs */ + GSList *socket_sources; /**< list of SocketSource objs; must only grow monotonically */ + guint socket_sources_age; /**< incremented when socket_sources changes */ GSList *incoming_checks; /**< list of IncomingCheck objs */ GList *turn_servers; /**< List of TURN servers */ CandidatePair selected_pair; /**< independent from checklists, see ICE 11.1. "Sending Media" (ID-19) */ NiceCandidate *restart_candidate; /**< for storing active remote candidate during a restart */ - NiceAgentRecvFunc g_source_io_cb; /**< function called on io cb */ - gpointer data; /**< data passed to the io function */ - GMainContext *ctx; /**< context for data callbacks for this + NiceCandidate *turn_candidate; /**< for storing active turn candidate if turn servers have been cleared */ + /* I/O handling. The main context must always be non-NULL, and is used for all + * socket recv() operations. All io_callback emissions are invoked in this + * context too. + * + * recv_messages and io_callback are mutually exclusive, but it is allowed for + * both to be NULL if the Component is not currently ready to receive data. */ + GMutex io_mutex; /**< protects io_callback, io_user_data, + pending_io_messages and io_callback_id. + immutable: can be accessed without + holding the agent lock; if the agent + lock is to be taken, it must always be + taken before this one */ + NiceAgentRecvFunc io_callback; /**< function called on io cb */ + gpointer io_user_data; /**< data passed to the io function */ + GQueue pending_io_messages; /**< queue of messages which have been + received but not passed to the client + in an I/O callback or recv() call yet. + each element is an owned + IOCallbackData */ + guint io_callback_id; /* GSource ID of the I/O callback */ + + GMainContext *own_ctx; /**< own context for GSources for this component */ + GMainContext *ctx; /**< context for GSources for this + component (possibly set from the app) */ + NiceInputMessage *recv_messages; /**< unowned messages for receiving into */ + guint n_recv_messages; /**< length of recv_messages */ + NiceInputMessageIter recv_messages_iter; /**< current write position in + recv_messages */ + GError **recv_buf_error; /**< error information about failed reads */ + + NiceAgent *agent; /* unowned, immutable: can be accessed without holding the + * agent lock */ + Stream *stream; /* unowned, immutable: can be accessed without holding the + * agent lock */ + + GCancellable *stop_cancellable; + PseudoTcpSocket *tcp; GSource* tcp_clock; - TcpUserData *tcp_data; + guint64 last_clock_timeout; gboolean tcp_readable; + GCancellable *tcp_writable_cancellable; + + GIOStream *iostream; + guint min_port; guint max_port; + + /* Queue of messages received before a selected socket was available to send + * ACKs on. The messages are dequeued to the pseudo-TCP socket once a selected + * UDP socket is available. This is only used for reliable Components. */ + GQueue queued_tcp_packets; }; Component * -component_new (guint component_id); +component_new (guint component_id, NiceAgent *agent, Stream *stream); void component_free (Component *cmp); @@ -136,7 +214,7 @@ gboolean component_find_pair (Component *cmp, NiceAgent *agent, const gchar *lfoundation, const gchar *rfoundation, CandidatePair *pair); -gboolean +void component_restart (Component *cmp); void @@ -149,6 +227,51 @@ component_set_selected_remote_candidate (NiceAgent *agent, Component *component, NiceCandidate *candidate); +void +component_attach_socket (Component *component, NiceSocket *nsocket); +void +component_detach_socket (Component *component, NiceSocket *nsocket); +void +component_detach_all_sockets (Component *component); +void +component_free_socket_sources (Component *component); + +GSource * +component_input_source_new (NiceAgent *agent, guint stream_id, + guint component_id, GPollableInputStream *pollable_istream, + GCancellable *cancellable); + +GMainContext * +component_dup_io_context (Component *component); +void +component_set_io_context (Component *component, GMainContext *context); +void +component_set_io_callback (Component *component, + NiceAgentRecvFunc func, gpointer user_data, + NiceInputMessage *recv_messages, guint n_recv_messages, + GError **error); +void +component_emit_io_callback (Component *component, + const guint8 *buf, gsize buf_len); + +gboolean +component_has_io_callback (Component *component); + +void +component_clean_turn_servers (Component *component); + + +TurnServer * +turn_server_new (const gchar *server_ip, guint server_port, + const gchar *username, const gchar *password, NiceRelayType type); + +TurnServer * +turn_server_ref (TurnServer *turn); + +void +turn_server_unref (TurnServer *turn); + + G_END_DECLS #endif /* _NICE_COMPONENT_H */ diff -Nru libnice-0.1.4/agent/conncheck.c libnice-0.1.7/agent/conncheck.c --- libnice-0.1.4/agent/conncheck.c 2013-01-09 21:35:25.000000000 +0000 +++ libnice-0.1.7/agent/conncheck.c 2014-04-25 01:09:45.000000000 +0000 @@ -71,6 +71,7 @@ uint8_t *dest, guint dest_len, gboolean inbound); static size_t priv_get_password (NiceAgent *agent, Stream *stream, NiceCandidate *remote, uint8_t **password); +static void conn_check_free_item (gpointer data); static int priv_timer_expired (GTimeVal *timer, GTimeVal *now) { @@ -313,6 +314,9 @@ keep_timer_going = TRUE; break; } + default: + /* Nothing to do. */ + break; } } } @@ -385,10 +389,9 @@ * * @return will return FALSE when no more pending timers. */ -static gboolean priv_conn_check_tick_unlocked (gpointer pointer) +static gboolean priv_conn_check_tick_unlocked (NiceAgent *agent) { CandidateCheckPair *pair = NULL; - NiceAgent *agent = pointer; gboolean keep_timer_going = FALSE; GSList *i, *j; GTimeVal now; @@ -451,6 +454,7 @@ static gboolean priv_conn_check_tick (gpointer pointer) { gboolean ret; + NiceAgent *agent = pointer; agent_lock(); if (g_source_is_destroyed (g_main_current_source ())) { @@ -459,8 +463,9 @@ agent_unlock (); return FALSE; } - ret = priv_conn_check_tick_unlocked (pointer); - agent_unlock(); + + ret = priv_conn_check_tick_unlocked (agent); + agent_unlock_and_emit (agent); return ret; } @@ -530,10 +535,13 @@ stun_timer_remainder (&pair->keepalive.timer), priv_conn_keepalive_retransmissions_tick, pair); break; + default: + /* Nothing to do. */ + break; } - agent_unlock (); + agent_unlock_and_emit (pair->keepalive.agent); return FALSE; } @@ -575,16 +583,18 @@ uint8_t *password = NULL; size_t password_len = priv_get_password (agent, agent_find_stream (agent, stream->id), p->remote, &password); - gchar tmpbuf[INET6_ADDRSTRLEN]; - - nice_address_to_string (&p->remote->addr, tmpbuf); - nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', " - "socket=%u (c-id:%u), username='%s' (%d), " - "password='%s' (%d), priority=%u.", agent, - tmpbuf, nice_address_get_port (&p->remote->addr), - g_socket_get_fd(((NiceSocket *)p->local->sockptr)->fileno), component->id, - uname, uname_len, password, password_len, priority); + if (nice_debug_is_enabled ()) { + gchar tmpbuf[INET6_ADDRSTRLEN]; + nice_address_to_string (&p->remote->addr, tmpbuf); + nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', " + "socket=%u (c-id:%u), username='%.*s' (%" G_GSIZE_FORMAT "), " + "password='%.*s' (%" G_GSIZE_FORMAT "), priority=%u.", agent, + tmpbuf, nice_address_get_port (&p->remote->addr), + g_socket_get_fd(((NiceSocket *)p->local->sockptr)->fileno), + component->id, (int) uname_len, uname, uname_len, + (int) password_len, password, password_len, priority); + } if (uname_len > 0) { buf_len = stun_usage_ice_conncheck_create (&agent->stun_agent, &p->keepalive.stun_message, p->keepalive.stun_buffer, @@ -595,7 +605,7 @@ NULL, agent_to_ice_compatibility (agent)); - nice_debug ("Agent %p: conncheck created %d - %p", + nice_debug ("Agent %p: conncheck created %zd - %p", agent, buf_len, p->keepalive.stun_message.buffer); if (buf_len > 0) { @@ -715,7 +725,7 @@ agent->keepalive_timer_source = NULL; } } - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -768,27 +778,30 @@ stun_timer_remainder (&cand->timer), priv_turn_allocate_refresh_retransmissions_tick, cand); break; + default: + /* Nothing to do. */ + break; } - agent_unlock (); + agent_unlock_and_emit (cand->agent); return FALSE; } static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand) { uint8_t *username; - size_t username_len; + gsize username_len; uint8_t *password; - size_t password_len; + gsize password_len; size_t buffer_len = 0; StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (cand->agent); - username = (uint8_t *)cand->turn->username; - username_len = (size_t) strlen (cand->turn->username); - password = (uint8_t *)cand->turn->password; - password_len = (size_t) strlen (cand->turn->password); + username = (uint8_t *)cand->candidate->turn->username; + username_len = (size_t) strlen (cand->candidate->turn->username); + password = (uint8_t *)cand->candidate->turn->password; + password_len = (size_t) strlen (cand->candidate->turn->password); if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN || turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) { @@ -805,13 +818,12 @@ if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN || turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) { - g_free (cand->msn_turn_username); - g_free (cand->msn_turn_password); - cand->msn_turn_username = username; - cand->msn_turn_password = password; + g_free (username); + g_free (password); } - nice_debug ("Agent %p : Sending allocate Refresh %d", cand->agent, buffer_len); + nice_debug ("Agent %p : Sending allocate Refresh %zd", cand->agent, + buffer_len); if (cand->tick_source != NULL) { g_source_destroy (cand->tick_source); @@ -855,7 +867,7 @@ } priv_turn_allocate_refresh_tick_unlocked (cand); - agent_unlock (); + agent_unlock_and_emit (cand->agent); return FALSE; } @@ -875,7 +887,7 @@ nice_debug ("Agent %p : WARN: starting conn checks before local candidate gathering is finished.", agent); /* step: call once imediately */ - res = priv_conn_check_tick_unlocked ((gpointer) agent); + res = priv_conn_check_tick_unlocked (agent); nice_debug ("Agent %p : priv_conn_check_tick_unlocked returned %d", agent, res); /* step: schedule timer if not running yet */ @@ -1075,9 +1087,8 @@ c = list_len - upper_limit; if (c == list_len) { /* case: delete whole list */ - g_slist_foreach (conncheck_list, conn_check_free_item, NULL); - g_slist_free (conncheck_list), - result = NULL; + g_slist_free_full (conncheck_list, conn_check_free_item); + result = NULL; } else { /* case: remove 'c' items from list end (lowest priority) */ @@ -1089,11 +1100,8 @@ tmp = i->next; i->next = NULL; - if (tmp) { - /* delete the rest of the connectivity check list */ - g_slist_foreach (tmp, conn_check_free_item, NULL); - g_slist_free (tmp); - } + /* delete the rest of the connectivity check list */ + g_slist_free_full (tmp, conn_check_free_item); } } @@ -1120,6 +1128,14 @@ component->selected_pair.keepalive.tick_source = NULL; } + if (component->selected_pair.local && + component->selected_pair.local == component->turn_candidate) { + refresh_prune_candidate (agent, component->turn_candidate); + component_detach_socket (component, component->turn_candidate->sockptr); + nice_candidate_free (component->turn_candidate); + component->turn_candidate = NULL; + } + memset (&component->selected_pair, 0, sizeof(CandidatePair)); component->selected_pair.local = pair->local; component->selected_pair.remote = pair->remote; @@ -1152,6 +1168,18 @@ * must be fetched before entering the loop*/ guint c, components = stream->n_components; + for (i = agent->discovery_list; i; i = i->next) { + CandidateDiscovery *d = i->data; + + /* There is still discovery ogoing for this stream, + * so don't fail any of it's candidates. + */ + if (d->stream == stream && !d->done) + return; + } + if (agent->discovery_list != NULL) + return; + /* note: iterate the conncheck list for each component separately */ for (c = 0; c < components; c++) { Component *comp = NULL; @@ -1160,7 +1188,7 @@ for (i = stream->conncheck_list; i; i = i->next) { CandidateCheckPair *p = i->data; - + if (p->stream_id == stream->id && p->component_id == (c + 1)) { if (p->state != NICE_CHECK_FAILED) @@ -1382,17 +1410,28 @@ /* * Frees the CandidateCheckPair structure pointer to - * by 'user data'. Compatible with g_slist_foreach(). + * by 'user data'. Compatible with GDestroyNotify. */ -void conn_check_free_item (gpointer data, gpointer user_data) +static void conn_check_free_item (gpointer data) { CandidateCheckPair *pair = data; - g_assert (user_data == NULL); + pair->stun_message.buffer = NULL; pair->stun_message.buffer_len = 0; g_slice_free (CandidateCheckPair, pair); } +static void +conn_check_stop (NiceAgent *agent) +{ + if (agent->conncheck_timer_source == NULL) + return; + + g_source_destroy (agent->conncheck_timer_source); + g_source_unref (agent->conncheck_timer_source); + agent->conncheck_timer_source = NULL; +} + /* * Frees all resources of all connectivity checks. */ @@ -1402,19 +1441,15 @@ for (i = agent->streams; i; i = i->next) { Stream *stream = i->data; - nice_debug ("Agent %p, freeing conncheck_list of stream %p", agent, stream); if (stream->conncheck_list) { - g_slist_foreach (stream->conncheck_list, conn_check_free_item, NULL); - g_slist_free (stream->conncheck_list), - stream->conncheck_list = NULL; + nice_debug ("Agent %p, freeing conncheck_list of stream %p", agent, + stream); + g_slist_free_full (stream->conncheck_list, conn_check_free_item); + stream->conncheck_list = NULL; } } - if (agent->conncheck_timer_source != NULL) { - g_source_destroy (agent->conncheck_timer_source); - g_source_unref (agent->conncheck_timer_source); - agent->conncheck_timer_source = NULL; - } + conn_check_stop (agent); } /* @@ -1423,33 +1458,28 @@ * * @return TRUE on success, FALSE on a fatal error */ -gboolean conn_check_prune_stream (NiceAgent *agent, Stream *stream) +void conn_check_prune_stream (NiceAgent *agent, Stream *stream) { - CandidateCheckPair *pair; GSList *i; + gboolean keep_going = FALSE; - for (i = stream->conncheck_list; i ; ) { - GSList *next = i->next; - pair = i->data; - - g_assert (pair->stream_id == stream->id); - - stream->conncheck_list = - g_slist_remove (stream->conncheck_list, pair); - conn_check_free_item (pair, NULL); - i = next; - if (!stream->conncheck_list) - break; - } + if (stream->conncheck_list) { + nice_debug ("Agent %p, freeing conncheck_list of stream %p", agent, stream); - if (!stream->conncheck_list) - conn_check_free (agent); + g_slist_free_full (stream->conncheck_list, conn_check_free_item); + stream->conncheck_list = NULL; + } - /* return FALSE if there was a memory allocation failure */ - if (stream->conncheck_list == NULL && i != NULL) - return FALSE; + for (i = agent->streams; i; i = i->next) { + Stream *s = i->data; + if (s->conncheck_list) { + keep_going = TRUE; + break; + } + } - return TRUE; + if (!keep_going) + conn_check_stop (agent); } /* @@ -1637,11 +1667,11 @@ pair->local->component_id); uint8_t uname[NICE_STREAM_MAX_UNAME]; - size_t uname_len = + gsize uname_len = priv_create_username (agent, agent_find_stream (agent, pair->stream_id), pair->component_id, pair->remote, pair->local, uname, sizeof (uname), FALSE); uint8_t *password = NULL; - size_t password_len = priv_get_password (agent, + gsize password_len = priv_get_password (agent, agent_find_stream (agent, pair->stream_id), pair->remote, &password); bool controlling = agent->controlling_mode; @@ -1650,21 +1680,26 @@ size_t buffer_len; unsigned int timeout; - if (agent->compatibility == NICE_COMPATIBILITY_MSN || - agent->compatibility == NICE_COMPATIBILITY_OC2007) { + if (password != NULL && + (agent->compatibility == NICE_COMPATIBILITY_MSN || + agent->compatibility == NICE_COMPATIBILITY_OC2007)) { password = g_base64_decode ((gchar *) password, &password_len); } - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN]; nice_address_to_string (&pair->remote->addr, tmpbuf); - nice_debug ("Agent %p : STUN-CC REQ to '%s:%u', socket=%u, pair=%s (c-id:%u), tie=%llu, username='%s' (%d), password='%s' (%d), priority=%u.", agent, + nice_debug ("Agent %p : STUN-CC REQ to '%s:%u', socket=%u, " + "pair=%s (c-id:%u), tie=%llu, username='%.*s' (%" G_GSIZE_FORMAT "), " + "password='%.*s' (%" G_GSIZE_FORMAT "), priority=%u.", agent, tmpbuf, nice_address_get_port (&pair->remote->addr), g_socket_get_fd(((NiceSocket *)pair->local->sockptr)->fileno), pair->foundation, pair->component_id, (unsigned long long)agent->tie_breaker, - uname, uname_len, password, password_len, priority); + (int) uname_len, uname, uname_len, + (int) password_len, password, password_len, + priority); } @@ -1681,7 +1716,8 @@ pair->foundation, agent_to_ice_compatibility (agent)); - nice_debug ("Agent %p: conncheck created %d - %p", agent, buffer_len, pair->stun_message.buffer); + nice_debug ("Agent %p: conncheck created %zd - %p", agent, buffer_len, + pair->stun_message.buffer); if (agent->compatibility == NICE_COMPATIBILITY_MSN || agent->compatibility == NICE_COMPATIBILITY_OC2007) { @@ -1886,27 +1922,27 @@ * * @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE) */ -static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *socket, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate) +static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate) { g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE); - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN]; nice_address_to_string (toaddr, tmpbuf); nice_debug ("Agent %p : STUN-CC RESP to '%s:%u', socket=%u, len=%u, cand=%p (c-id:%u), use-cand=%d.", agent, tmpbuf, nice_address_get_port (toaddr), - g_socket_get_fd(socket->fileno), + g_socket_get_fd(sockptr->fileno), (unsigned)rbuf_len, rcand, component->id, (int)use_candidate); } - nice_socket_send (socket, toaddr, rbuf_len, (const gchar*)rbuf); - + nice_socket_send (sockptr, toaddr, rbuf_len, (const gchar*)rbuf); + if (rcand) { /* note: upon successful check, make the reserve check immediately */ - priv_schedule_triggered_check (agent, stream, component, socket, rcand, use_candidate); + priv_schedule_triggered_check (agent, stream, component, sockptr, rcand, use_candidate); if (use_candidate) priv_mark_pair_nominated (agent, stream, component, rcand); @@ -1922,7 +1958,7 @@ * @return non-zero on error, zero on success */ static int priv_store_pending_check (NiceAgent *agent, Component *component, - const NiceAddress *from, NiceSocket *socket, uint8_t *username, + const NiceAddress *from, NiceSocket *sockptr, uint8_t *username, uint16_t username_len, uint32_t priority, gboolean use_candidate) { IncomingCheck *icheck; @@ -1938,7 +1974,7 @@ icheck = g_slice_new0 (IncomingCheck); component->incoming_checks = g_slist_append (component->incoming_checks, icheck); icheck->from = *from; - icheck->local_socket = socket; + icheck->local_socket = sockptr; icheck->priority = priority; icheck->use_candidate = use_candidate; icheck->username_len = username_len; @@ -2087,7 +2123,10 @@ */ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *sockptr, const NiceAddress *from, NiceCandidate *local_candidate, NiceCandidate *remote_candidate, StunMessage *resp) { - struct sockaddr_storage sockaddr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sockaddr; socklen_t socklen = sizeof (sockaddr); GSList *i; StunUsageIceReturn res; @@ -2104,7 +2143,7 @@ if (memcmp (discovery_id, response_id, sizeof(StunTransactionId)) == 0) { res = stun_usage_ice_conncheck_process (resp, - (struct sockaddr *) &sockaddr, &socklen, + &sockaddr.storage, &socklen, agent_to_ice_compatibility (agent)); nice_debug ("Agent %p : stun_bind_process/conncheck for %p res %d " "(controlling=%d).", agent, p, (int)res, agent->controlling_mode); @@ -2123,18 +2162,19 @@ * sent the original request to (see 7.1.2.1. "Failure * Cases") */ if (nice_address_equal (from, &p->remote->addr) != TRUE) { - gchar tmpbuf[INET6_ADDRSTRLEN]; - gchar tmpbuf2[INET6_ADDRSTRLEN]; p->state = NICE_CHECK_FAILED; - nice_debug ("Agent %p : conncheck %p FAILED" - " (mismatch of source address).", agent, p); - nice_address_to_string (&p->remote->addr, tmpbuf); - nice_address_to_string (from, tmpbuf2); - nice_debug ("Agent %p : '%s:%u' != '%s:%u'", agent, - tmpbuf, nice_address_get_port (&p->remote->addr), - tmpbuf2, nice_address_get_port (from)); - + if (nice_debug_is_enabled ()) { + gchar tmpbuf[INET6_ADDRSTRLEN]; + gchar tmpbuf2[INET6_ADDRSTRLEN]; + nice_debug ("Agent %p : conncheck %p FAILED" + " (mismatch of source address).", agent, p); + nice_address_to_string (&p->remote->addr, tmpbuf); + nice_address_to_string (from, tmpbuf2); + nice_debug ("Agent %p : '%s:%u' != '%s:%u'", agent, + tmpbuf, nice_address_get_port (&p->remote->addr), + tmpbuf2, nice_address_get_port (from)); + } trans_found = TRUE; break; } @@ -2154,8 +2194,8 @@ " conncheck %p SUCCEEDED.", agent, p); priv_conn_check_unfreeze_related (agent, stream, p); } else { - ok_pair = priv_process_response_check_for_peer_reflexive(agent, - stream, component, p, sockptr, (struct sockaddr *) &sockaddr, + ok_pair = priv_process_response_check_for_peer_reflexive (agent, + stream, component, p, sockptr, &sockaddr.addr, local_candidate, remote_candidate); } @@ -2217,10 +2257,18 @@ */ static gboolean priv_map_reply_to_discovery_request (NiceAgent *agent, StunMessage *resp) { - struct sockaddr_storage sockaddr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sockaddr; socklen_t socklen = sizeof (sockaddr); - struct sockaddr_storage alternate; + + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } alternate; socklen_t alternatelen = sizeof (sockaddr); + GSList *i; StunUsageBindReturn res; gboolean trans_found = FALSE; @@ -2236,24 +2284,22 @@ stun_message_id (&d->stun_message, discovery_id); if (memcmp (discovery_id, response_id, sizeof(StunTransactionId)) == 0) { - res = stun_usage_bind_process (resp, (struct sockaddr *) &sockaddr, - &socklen, (struct sockaddr *) &alternate, &alternatelen); + res = stun_usage_bind_process (resp, &sockaddr.addr, + &socklen, &alternate.addr, &alternatelen); nice_debug ("Agent %p : stun_bind_process/disc for %p res %d.", agent, d, (int)res); if (res == STUN_USAGE_BIND_RETURN_ALTERNATE_SERVER) { /* handle alternate server */ NiceAddress niceaddr; - nice_address_set_from_sockaddr (&niceaddr, - (struct sockaddr *) &alternate); + nice_address_set_from_sockaddr (&niceaddr, &alternate.addr); d->server = niceaddr; d->pending = FALSE; } else if (res == STUN_USAGE_BIND_RETURN_SUCCESS) { /* case: successful binding discovery, create a new local candidate */ NiceAddress niceaddr; - nice_address_set_from_sockaddr (&niceaddr, - (struct sockaddr *) &sockaddr); + nice_address_set_from_sockaddr (&niceaddr, &sockaddr.addr); discovery_add_server_reflexive_candidate ( d->agent, @@ -2291,10 +2337,9 @@ cand = g_slice_new0 (CandidateRefresh); agent->refresh_list = g_slist_append (agent->refresh_list, cand); + cand->candidate = relay_cand; cand->nicesock = cdisco->nicesock; - cand->relay_socket = relay_cand->sockptr; cand->server = cdisco->server; - cand->turn = cdisco->turn; cand->stream = cdisco->stream; cand->component = cdisco->component; cand->agent = cdisco->agent; @@ -2319,7 +2364,7 @@ agent_timeout_add_with_context (agent, (lifetime - 60) * 1000, priv_turn_allocate_refresh_tick, cand); - nice_debug ("timer source is : %d", cand->timer_source); + nice_debug ("timer source is : %p", cand->timer_source); return cand; } @@ -2332,12 +2377,24 @@ */ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *resp) { - struct sockaddr_storage sockaddr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sockaddr; socklen_t socklen = sizeof (sockaddr); - struct sockaddr_storage alternate; + + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } alternate; socklen_t alternatelen = sizeof (alternate); - struct sockaddr_storage relayaddr; + + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } relayaddr; socklen_t relayaddrlen = sizeof (relayaddr); + uint32_t lifetime; uint32_t bandwidth; GSList *i; @@ -2356,19 +2413,17 @@ if (memcmp (discovery_id, response_id, sizeof(StunTransactionId)) == 0) { res = stun_usage_turn_process (resp, - (struct sockaddr *) &relayaddr, &relayaddrlen, - (struct sockaddr *) &sockaddr, &socklen, - (struct sockaddr *) &alternate, &alternatelen, + &relayaddr.storage, &relayaddrlen, + &sockaddr.storage, &socklen, + &alternate.storage, &alternatelen, &bandwidth, &lifetime, agent_to_turn_compatibility (agent)); nice_debug ("Agent %p : stun_turn_process/disc for %p res %d.", agent, d, (int)res); if (res == STUN_USAGE_TURN_RETURN_ALTERNATE_SERVER) { /* handle alternate server */ - nice_address_set_from_sockaddr (&d->server, - (struct sockaddr *) &alternate); - nice_address_set_from_sockaddr (&d->turn->server, - (struct sockaddr *) &alternate); + nice_address_set_from_sockaddr (&d->server, &alternate.addr); + nice_address_set_from_sockaddr (&d->turn->server, &alternate.addr); d->pending = FALSE; } else if (res == STUN_USAGE_TURN_RETURN_RELAY_SUCCESS || @@ -2381,8 +2436,7 @@ if (res == STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS && !nice_socket_is_reliable (d->nicesock)) { /* We also received our mapped address */ - nice_address_set_from_sockaddr (&niceaddr, - (struct sockaddr *) &sockaddr); + nice_address_set_from_sockaddr (&niceaddr, &sockaddr.addr); discovery_add_server_reflexive_candidate ( d->agent, @@ -2392,8 +2446,7 @@ d->nicesock); } - nice_address_set_from_sockaddr (&niceaddr, - (struct sockaddr *) &relayaddr); + nice_address_set_from_sockaddr (&niceaddr, &relayaddr.addr); relay_cand = discovery_add_relay_candidate ( d->agent, d->stream->id, @@ -2632,8 +2685,9 @@ stun_debug_bytes (username, username_len); stun_debug ("' (%d) with '", username_len); stun_debug_bytes (ufrag, ufrag_len); - stun_debug ("' (%d) : %d\n", - ufrag_len, memcmp (username, ufrag, ufrag_len)); + stun_debug ("' (%" G_GSIZE_FORMAT ") : %d\n", + ufrag_len, username_len >= ufrag_len ? + memcmp (username, ufrag, ufrag_len) : 0); if (ufrag_len > 0 && username_len >= ufrag_len && memcmp (username, ufrag, ufrag_len) == 0) { gchar *pass = NULL; @@ -2648,8 +2702,11 @@ *password_len = strlen (pass); if (msn_msoc_nice_compatibility) { - data->password = g_base64_decode (pass, password_len); + gsize pass_len; + + data->password = g_base64_decode (pass, &pass_len); *password = data->password; + *password_len = pass_len; } } @@ -2674,7 +2731,7 @@ * @param agent self pointer * @param stream stream the packet is related to * @param component component the packet is related to - * @param socket socket from which the packet was received + * @param nicesock socket from which the packet was received * @param from address of the sender * @param buf message contents * @param buf message length @@ -2684,10 +2741,13 @@ * @return XXX (what FALSE means exactly?) */ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, - Component *component, NiceSocket *socket, const NiceAddress *from, + Component *component, NiceSocket *nicesock, const NiceAddress *from, gchar *buf, guint len) { - struct sockaddr_storage sockaddr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sockaddr; uint8_t rbuf[MAX_STUN_DATAGRAM_PAYLOAD]; ssize_t res; size_t rbuf_len = sizeof (rbuf); @@ -2706,19 +2766,17 @@ NiceCandidate *local_candidate = NULL; gboolean discovery_msg = FALSE; - nice_address_copy_to_sockaddr (from, (struct sockaddr *) &sockaddr); + nice_address_copy_to_sockaddr (from, &sockaddr.addr); /* note: contents of 'buf' already validated, so it is * a valid and fully received STUN message */ -#ifndef NDEBUG - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN]; nice_address_to_string (from, tmpbuf); nice_debug ("Agent %p: inbound STUN packet for %u/%u (stream/component) from [%s]:%u (%u octets) :", agent, stream->id, component->id, tmpbuf, nice_address_get_port (from), len); } -#endif /* note: ICE 7.2. "STUN Server Procedures" (ID-19) */ @@ -2731,7 +2789,7 @@ for (i = agent->discovery_list; i; i = i->next) { CandidateDiscovery *d = i->data; if (d->stream == stream && d->component == component && - d->nicesock == socket) { + d->nicesock == nicesock) { valid = stun_agent_validate (&d->stun_agent, &req, (uint8_t *) buf, len, conncheck_stun_validater, &validater_data); @@ -2749,9 +2807,10 @@ for (i = agent->refresh_list; i; i = i->next) { CandidateRefresh *r = i->data; nice_debug ("Comparing %p to %p, %p to %p and %p and %p to %p", r->stream, - stream, r->component, component, r->nicesock, r->relay_socket, socket); + stream, r->component, component, r->nicesock, r->candidate->sockptr, + nicesock); if (r->stream == stream && r->component == component && - (r->nicesock == socket || r->relay_socket == socket)) { + (r->nicesock == nicesock || r->candidate->sockptr == nicesock)) { valid = stun_agent_validate (&r->stun_agent, &req, (uint8_t *) buf, len, conncheck_stun_validater, &validater_data); nice_debug ("Validating gave %d", valid); @@ -2782,7 +2841,7 @@ rbuf_len = stun_agent_build_unknown_attributes_error (&agent->stun_agent, &msg, rbuf, rbuf_len, &req); if (rbuf_len != 0) - nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf); + nice_socket_send (nicesock, from, rbuf_len, (const gchar*)rbuf); } return TRUE; } @@ -2795,7 +2854,7 @@ rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0); if (rbuf_len > 0 && agent->compatibility != NICE_COMPATIBILITY_MSN && agent->compatibility != NICE_COMPATIBILITY_OC2007) - nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf); + nice_socket_send (nicesock, from, rbuf_len, (const gchar*)rbuf); } return TRUE; } @@ -2806,7 +2865,7 @@ rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0); if (rbuf_len > 0 && agent->compatibility != NICE_COMPATIBILITY_MSN && agent->compatibility != NICE_COMPATIBILITY_OC2007) - nice_socket_send (socket, from, rbuf_len, (const gchar*)rbuf); + nice_socket_send (nicesock, from, rbuf_len, (const gchar*)rbuf); } return TRUE; } @@ -2889,19 +2948,23 @@ if ( agent->compatibility == NICE_COMPATIBILITY_MSN || agent->compatibility == NICE_COMPATIBILITY_OC2007) { if (local_candidate && remote_candidate2) { + gsize key_len; + if (agent->compatibility == NICE_COMPATIBILITY_MSN) { username = (uint8_t *) stun_message_find (&req, STUN_ATTRIBUTE_USERNAME, &username_len); uname_len = priv_create_username (agent, stream, component->id, remote_candidate2, local_candidate, uname, sizeof (uname), FALSE); - memcpy (username, uname, username_len); + memcpy (username, uname, MIN (uname_len, username_len)); req.key = g_base64_decode ((gchar *) remote_candidate2->password, - &req.key_len); + &key_len); + req.key_len = key_len; } else if (agent->compatibility == NICE_COMPATIBILITY_OC2007) { req.key = g_base64_decode ((gchar *) local_candidate->password, - &req.key_len); + &key_len); + req.key_len = key_len; } } else { nice_debug ("Agent %p : received MSN incoming check from unknown remote candidate. " @@ -2912,7 +2975,7 @@ rbuf_len = sizeof (rbuf); res = stun_usage_ice_conncheck_create_reply (&agent->stun_agent, &req, - &msg, rbuf, &rbuf_len, (struct sockaddr *) &sockaddr, sizeof (sockaddr), + &msg, rbuf, &rbuf_len, &sockaddr.storage, sizeof (sockaddr), &control, agent->tie_breaker, agent_to_ice_compatibility (agent)); @@ -2944,7 +3007,7 @@ nice_debug ("Agent %p : No matching remote candidate for incoming check ->" "peer-reflexive candidate.", agent); remote_candidate = discovery_learn_remote_peer_reflexive_candidate ( - agent, stream, component, priority, from, socket, + agent, stream, component, priority, from, nicesock, local_candidate, remote_candidate2 ? remote_candidate2 : remote_candidate); if(remote_candidate) @@ -2952,7 +3015,7 @@ } priv_reply_to_conn_check (agent, stream, component, remote_candidate, - from, socket, rbuf_len, rbuf, use_candidate); + from, nicesock, rbuf_len, rbuf, use_candidate); if (component->remote_candidates == NULL) { /* case: We've got a valid binding request to a local candidate @@ -2962,7 +3025,7 @@ * we get information about the remote candidates */ /* step: send a reply immediately but postpone other processing */ - priv_store_pending_check (agent, component, from, socket, + priv_store_pending_check (agent, component, from, nicesock, username, username_len, priority, use_candidate); } } else { @@ -2979,7 +3042,7 @@ /* step: let's try to match the response to an existing check context */ if (trans_found != TRUE) trans_found = priv_map_reply_to_conn_check_request (agent, stream, - component, socket, from, local_candidate, remote_candidate, &req); + component, nicesock, from, local_candidate, remote_candidate, &req); /* step: let's try to match the response to an existing discovery */ if (trans_found != TRUE) diff -Nru libnice-0.1.4/agent/conncheck.h libnice-0.1.7/agent/conncheck.h --- libnice-0.1.4/agent/conncheck.h 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/agent/conncheck.h 2014-04-25 01:09:45.000000000 +0000 @@ -83,11 +83,10 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *remote); int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local); -void conn_check_free_item (gpointer data, gpointer user_data); void conn_check_free (NiceAgent *agent); gboolean conn_check_schedule_next (NiceAgent *agent); int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair); -gboolean conn_check_prune_stream (NiceAgent *agent, Stream *stream); +void conn_check_prune_stream (NiceAgent *agent, Stream *stream); gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len); gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b); void conn_check_remote_candidates_set(NiceAgent *agent); diff -Nru libnice-0.1.4/agent/debug.c libnice-0.1.7/agent/debug.c --- libnice-0.1.4/agent/debug.c 2011-02-02 04:50:08.000000000 +0000 +++ libnice-0.1.7/agent/debug.c 2014-03-07 01:21:05.000000000 +0000 @@ -43,6 +43,8 @@ #include "stunagent.h" #include "pseudotcp.h" +#include "agent-priv.h" + static int debug_enabled = 0; #define NICE_DEBUG_STUN 1 @@ -59,7 +61,7 @@ }; -void nice_debug_init () +void nice_debug_init (void) { static gboolean debug_initialized = FALSE; const gchar *flags_string; @@ -91,6 +93,15 @@ } } +#ifndef NDEBUG +gboolean nice_debug_is_enabled (void) +{ + return debug_enabled; +} +#else +/* Defined in agent-priv.h. */ +#endif + void nice_debug_enable (gboolean with_stun) { nice_debug_init (); @@ -106,6 +117,7 @@ stun_debug_disable (); } +#ifndef NDEBUG void nice_debug (const char *fmt, ...) { va_list ap; @@ -115,3 +127,6 @@ va_end (ap); } } +#else +/* Defined in agent-priv.h. */ +#endif diff -Nru libnice-0.1.4/agent/debug.h libnice-0.1.7/agent/debug.h --- libnice-0.1.4/agent/debug.h 2011-02-02 04:49:41.000000000 +0000 +++ libnice-0.1.7/agent/debug.h 2014-03-07 01:21:05.000000000 +0000 @@ -74,14 +74,6 @@ G_BEGIN_DECLS /** - * nice_debug_init: - * - * Initialize the debugging system. Uses the NICE_DEBUG environment variable - * to set the appropriate debugging flags - */ -void nice_debug_init (void); - -/** * nice_debug_enable: * @with_stun: Also enable stun debugging messages * @@ -97,8 +89,6 @@ */ void nice_debug_disable (gboolean with_stun); -void nice_debug (const char *fmt, ...); - G_END_DECLS #endif /* _DEBUG_H */ diff -Nru libnice-0.1.4/agent/discovery.c libnice-0.1.7/agent/discovery.c --- libnice-0.1.4/agent/discovery.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/agent/discovery.c 2014-04-25 01:09:45.000000000 +0000 @@ -55,7 +55,6 @@ #include "agent.h" #include "agent-priv.h" -#include "agent-signals-marshal.h" #include "component.h" #include "discovery.h" #include "stun/usages/bind.h" @@ -71,14 +70,13 @@ /* * Frees the CandidateDiscovery structure pointed to - * by 'user data'. Compatible with g_slist_foreach(). + * by 'user data'. Compatible with g_slist_free_full(). */ -void discovery_free_item (gpointer data, gpointer user_data) +static void discovery_free_item (CandidateDiscovery *cand) { - CandidateDiscovery *cand = data; - g_assert (user_data == NULL); - g_free (cand->msn_turn_username); - g_free (cand->msn_turn_password); + if (cand->turn) + turn_server_unref (cand->turn); + g_slice_free (CandidateDiscovery, cand); } @@ -87,9 +85,8 @@ */ void discovery_free (NiceAgent *agent) { - - g_slist_foreach (agent->discovery_list, discovery_free_item, NULL); - g_slist_free (agent->discovery_list); + g_slist_free_full (agent->discovery_list, + (GDestroyNotify) discovery_free_item); agent->discovery_list = NULL; agent->discovery_unsched_items = 0; @@ -116,7 +113,7 @@ if (cand->stream->id == stream_id) { agent->discovery_list = g_slist_remove (agent->discovery_list, cand); - discovery_free_item (cand, NULL); + discovery_free_item (cand); } i = next; } @@ -130,21 +127,18 @@ /* * Frees the CandidateDiscovery structure pointed to - * by 'user data'. Compatible with g_slist_foreach(). + * by 'user data'. Compatible with g_slist_free_full(). */ -void refresh_free_item (gpointer data, gpointer user_data) +static void refresh_free_item (CandidateRefresh *cand) { - CandidateRefresh *cand = data; NiceAgent *agent = cand->agent; uint8_t *username; - size_t username_len; + gsize username_len; uint8_t *password; - size_t password_len; + gsize password_len; size_t buffer_len = 0; StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (agent); - g_assert (user_data == NULL); - if (cand->timer_source != NULL) { g_source_destroy (cand->timer_source); g_source_unref (cand->timer_source); @@ -156,10 +150,10 @@ cand->tick_source = NULL; } - username = (uint8_t *)cand->turn->username; - username_len = (size_t) strlen (cand->turn->username); - password = (uint8_t *)cand->turn->password; - password_len = (size_t) strlen (cand->turn->password); + username = (uint8_t *)cand->candidate->turn->username; + username_len = (size_t) strlen (cand->candidate->turn->username); + password = (uint8_t *)cand->candidate->turn->password; + password_len = (size_t) strlen (cand->candidate->turn->password); if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN || turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) { @@ -206,14 +200,13 @@ */ void refresh_free (NiceAgent *agent) { - g_slist_foreach (agent->refresh_list, refresh_free_item, NULL); - g_slist_free (agent->refresh_list); + g_slist_free_full (agent->refresh_list, (GDestroyNotify) refresh_free_item); agent->refresh_list = NULL; } /* * Prunes the list of discovery processes for items related - * to stream 'stream_id'. + * to stream 'stream_id'. * * @return TRUE on success, FALSE on a fatal error */ @@ -225,9 +218,12 @@ CandidateRefresh *cand = i->data; GSList *next = i->next; + /* Don't free the candidate refresh to the currently selected local candidate + * unless the whole pair is being destroyed. + */ if (cand->stream->id == stream_id) { - agent->refresh_list = g_slist_remove (agent->refresh_list, cand); - refresh_free_item (cand, NULL); + agent->refresh_list = g_slist_delete_link (agent->refresh_list, i); + refresh_free_item (cand); } i = next; @@ -235,13 +231,31 @@ } +void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate) +{ + GSList *i; + + for (i = agent->refresh_list; i;) { + GSList *next = i->next; + CandidateRefresh *refresh = i->data; + + if (refresh->candidate == candidate) { + agent->refresh_list = g_slist_delete_link (agent->refresh_list, i); + refresh_free_item (refresh); + } + + i = next; + } +} + void refresh_cancel (CandidateRefresh *refresh) { refresh->agent->refresh_list = g_slist_remove (refresh->agent->refresh_list, refresh); - refresh_free_item (refresh, NULL); + refresh_free_item (refresh); } + /* * Adds a new local candidate. Implements the candidate pruning * defined in ICE spec section 4.1.3 "Eliminating Redundant @@ -481,11 +495,6 @@ if (!udp_socket) goto errors; - - _priv_set_socket_tos (agent, udp_socket, stream->tos); - agent_attach_stream_component_socket (agent, stream, - component, udp_socket); - candidate->sockptr = udp_socket; candidate->addr = udp_socket->addr; candidate->base_addr = udp_socket->addr; @@ -493,7 +502,8 @@ if (!priv_add_local_candidate_pruned (agent, stream_id, component, candidate)) goto errors; - component->sockets = g_slist_append (component->sockets, udp_socket); + _priv_set_socket_tos (agent, udp_socket, stream->tos); + component_attach_socket (component, udp_socket); return candidate; @@ -598,7 +608,7 @@ candidate->stream_id = stream_id; candidate->component_id = component_id; candidate->addr = *address; - candidate->turn = turn; + candidate->turn = turn_server_ref (turn); /* step: link to the base candidate+socket */ relay_socket = nice_turn_socket_new (agent->main_context, address, @@ -624,7 +634,7 @@ if (!priv_add_local_candidate_pruned (agent, stream_id, component, candidate)) goto errors; - component->sockets = g_slist_append (component->sockets, relay_socket); + component_attach_socket (component, relay_socket); agent_signal_new_candidate (agent, candidate); return candidate; @@ -850,7 +860,7 @@ if (agent->discovery_unsched_items) --agent->discovery_unsched_items; - { + if (nice_debug_is_enabled ()) { gchar tmpbuf[INET6_ADDRSTRLEN]; nice_address_to_string (&cand->server, tmpbuf); nice_debug ("Agent %p : discovery - scheduling cand type %u addr %s.\n", @@ -870,9 +880,9 @@ &cand->stun_message, cand->stun_buffer, sizeof(cand->stun_buffer)); } else if (cand->type == NICE_CANDIDATE_TYPE_RELAYED) { uint8_t *username = (uint8_t *)cand->turn->username; - size_t username_len = (size_t) strlen (cand->turn->username); + gsize username_len = strlen (cand->turn->username); uint8_t *password = (uint8_t *)cand->turn->password; - size_t password_len = (size_t) strlen (cand->turn->password); + gsize password_len = strlen (cand->turn->password); StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (agent); @@ -893,10 +903,8 @@ if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN || turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) { - g_free (cand->msn_turn_username); - g_free (cand->msn_turn_password); - cand->msn_turn_username = username; - cand->msn_turn_password = password; + g_free (username); + g_free (password); } } @@ -987,6 +995,9 @@ ++not_done; /* note: retry later */ break; } + default: + /* Nothing to do. */ + break; } } else { @@ -1030,7 +1041,7 @@ agent->discovery_timer_source = NULL; } } - agent_unlock(); + agent_unlock_and_emit (agent); return ret; } @@ -1046,7 +1057,7 @@ g_assert (agent->discovery_list != NULL); if (agent->discovery_unsched_items > 0) { - + if (agent->discovery_timer_source == NULL) { /* step: run first iteration immediately */ gboolean res = priv_discovery_tick_unlocked (agent); diff -Nru libnice-0.1.4/agent/discovery.h libnice-0.1.7/agent/discovery.h --- libnice-0.1.4/agent/discovery.h 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/agent/discovery.h 2014-04-25 01:09:45.000000000 +0000 @@ -57,8 +57,6 @@ Component *component; TurnServer *turn; StunAgent stun_agent; - uint8_t *msn_turn_username; - uint8_t *msn_turn_password; StunTimer timer; uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; StunMessage stun_message; @@ -70,16 +68,13 @@ { NiceAgent *agent; /**< back pointer to owner */ NiceSocket *nicesock; /**< existing socket to use */ - NiceSocket *relay_socket; /**< relay socket from which we receive */ NiceAddress server; /**< STUN/TURN server address */ + NiceCandidate *candidate; /**< candidate to refresh */ Stream *stream; Component *component; - TurnServer *turn; StunAgent stun_agent; GSource *timer_source; GSource *tick_source; - uint8_t *msn_turn_username; - uint8_t *msn_turn_password; StunTimer timer; uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE]; StunMessage stun_message; @@ -87,13 +82,12 @@ StunMessage stun_resp_msg; } CandidateRefresh; -void refresh_free_item (gpointer data, gpointer user_data); void refresh_free (NiceAgent *agent); void refresh_prune_stream (NiceAgent *agent, guint stream_id); +void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate); void refresh_cancel (CandidateRefresh *refresh); -void discovery_free_item (gpointer data, gpointer user_data); void discovery_free (NiceAgent *agent); void discovery_prune_stream (NiceAgent *agent, guint stream_id); void discovery_schedule (NiceAgent *agent); diff -Nru libnice-0.1.4/agent/inputstream.c libnice-0.1.7/agent/inputstream.c --- libnice-0.1.4/agent/inputstream.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/agent/inputstream.c 2014-03-31 23:18:17.000000000 +0000 @@ -0,0 +1,462 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2013 Collabora Ltd. + * Contact: Youness Alaoui + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Youness Alaoui, Collabora Ltd. + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +/*** + * SECTION:nice_input_stream + * @short_description: #GInputStream implementation for libnice + * @see_also: #NiceAgent + * @include: inputstream.h + * @stability: Stable + * + * #NiceInputStream is a #GInputStream wrapper for a single reliable stream and + * component of a #NiceAgent. Given an existing reliable #NiceAgent, plus the + * IDs of an existing stream and component in the agent, it will provide a + * streaming input interface for reading from the given component. + * + * A single #NiceInputStream can only be used with a single agent, stream and + * component triple, and will be closed as soon as that stream is removed from + * the agent (e.g. if nice_agent_remove_stream() is called from another thread). + * If g_input_stream_close() is called on a #NiceInputStream, the input stream + * will be marked as closed, but the underlying #NiceAgent stream will not be + * removed. Use nice_agent_remove_stream() to do that. + * + * Since: 0.1.5 + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "inputstream.h" +#include "agent-priv.h" + +static void streams_removed_cb (NiceAgent *agent, guint *stream_ids, + gpointer user_data); +static void nice_input_stream_init_pollable ( + GPollableInputStreamInterface *iface); + +G_DEFINE_TYPE_WITH_CODE (NiceInputStream, + nice_input_stream, G_TYPE_INPUT_STREAM, + G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_INPUT_STREAM, + nice_input_stream_init_pollable)); + +enum +{ + PROP_AGENT = 1, + PROP_STREAM_ID, + PROP_COMPONENT_ID, +}; + +struct _NiceInputStreamPrivate +{ + GWeakRef/**/ agent_ref; + guint stream_id; + guint component_id; +}; + +static void nice_input_stream_dispose (GObject *object); +static void nice_input_stream_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec); +static void nice_input_stream_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec); +static gssize nice_input_stream_read (GInputStream *stream, void *buffer, + gsize count, GCancellable *cancellable, GError **error); +static gboolean nice_input_stream_is_readable (GPollableInputStream *stream); +static gssize nice_input_stream_read_nonblocking (GPollableInputStream *stream, + void *buffer, gsize count, GError **error); +static GSource *nice_input_stream_create_source (GPollableInputStream *stream, + GCancellable *cancellable); + +static void +nice_input_stream_class_init (NiceInputStreamClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass); + + g_type_class_add_private (klass, sizeof (NiceInputStreamPrivate)); + + gobject_class->set_property = nice_input_stream_set_property; + gobject_class->get_property = nice_input_stream_get_property; + gobject_class->dispose = nice_input_stream_dispose; + + stream_class->read_fn = nice_input_stream_read; + + /*** + * NiceInputStream:agent: + * + * The #NiceAgent to wrap with an input stream. This must be an existing + * reliable agent. + * + * A reference is not held on the #NiceAgent. If the agent is destroyed before + * the #NiceInputStream, %G_IO_ERROR_CLOSED will be returned for all + * subsequent operations on the stream. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_AGENT, + g_param_spec_object ("agent", + "NiceAgent", + "The underlying NiceAgent", + NICE_TYPE_AGENT, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /*** + * NiceInputStream:stream-id: + * + * ID of the stream to use in the #NiceInputStream:agent. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_STREAM_ID, + g_param_spec_uint ( + "stream-id", + "Agent’s stream ID", + "The ID of the agent’s stream to wrap.", + 0, G_MAXUINT, + 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /*** + * NiceInputStream:component-id: + * + * ID of the component to use in the #NiceInputStream:agent. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_COMPONENT_ID, + g_param_spec_uint ( + "component-id", + "Agent’s component ID", + "The ID of the agent’s component to wrap.", + 0, G_MAXUINT, + 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +static void +nice_input_stream_dispose (GObject *object) +{ + NiceInputStream *self = NICE_INPUT_STREAM (object); + NiceAgent *agent; + + agent = g_weak_ref_get (&self->priv->agent_ref); + if (agent != NULL) { + g_signal_handlers_disconnect_by_func (agent, streams_removed_cb, self); + g_object_unref (agent); + } + + g_weak_ref_clear (&self->priv->agent_ref); + + G_OBJECT_CLASS (nice_input_stream_parent_class)->dispose (object); +} + +static void +nice_input_stream_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NiceInputStream *self = NICE_INPUT_STREAM (object); + + switch (prop_id) { + case PROP_AGENT: + g_value_take_object (value, g_weak_ref_get (&self->priv->agent_ref)); + break; + case PROP_STREAM_ID: + g_value_set_uint (value, self->priv->stream_id); + break; + case PROP_COMPONENT_ID: + g_value_set_uint (value, self->priv->component_id); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +nice_input_stream_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NiceInputStream *self = NICE_INPUT_STREAM (object); + + switch (prop_id) { + case PROP_AGENT: { + /* Construct only. */ + NiceAgent *agent = g_value_dup_object (value); + g_weak_ref_set (&self->priv->agent_ref, agent); + + /* agent may be NULL if the stream is being constructed by + * nice_io_stream_get_input_stream() after the NiceIOStream’s agent has + * already been finalised. */ + if (agent != NULL) { + g_signal_connect (agent, "streams-removed", + (GCallback) streams_removed_cb, self); + g_object_unref (agent); + } + + break; + } + case PROP_STREAM_ID: + /* Construct only. */ + self->priv->stream_id = g_value_get_uint (value); + break; + case PROP_COMPONENT_ID: + /* Construct only. */ + self->priv->component_id = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +nice_input_stream_init (NiceInputStream *stream) +{ + stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, NICE_TYPE_INPUT_STREAM, + NiceInputStreamPrivate); + + g_weak_ref_init (&stream->priv->agent_ref, NULL); +} + +static void +nice_input_stream_init_pollable (GPollableInputStreamInterface *iface) +{ + iface->is_readable = nice_input_stream_is_readable; + iface->read_nonblocking = nice_input_stream_read_nonblocking; + iface->create_source = nice_input_stream_create_source; +} + +/*** + * nice_input_stream_new: + * @agent: A #NiceAgent + * @stream_id: The ID of the agent’s stream to wrap + * @component_id: The ID of the agent’s component to wrap + * + * Create a new #NiceInputStream wrapping the given stream/component from + * @agent, which must be a reliable #NiceAgent. + * + * The constructed #NiceInputStream will not hold a reference to @agent. If + * @agent is destroyed before the input stream, %G_IO_ERROR_CLOSED will be + * returned for all subsequent operations on the stream. + * + * Returns: The new #NiceInputStream object + * + * Since: 0.1.5 + */ +NiceInputStream * +nice_input_stream_new (NiceAgent *agent, guint stream_id, guint component_id) +{ + g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); + g_return_val_if_fail (stream_id >= 1, NULL); + g_return_val_if_fail (component_id >= 1, NULL); + + return g_object_new (NICE_TYPE_INPUT_STREAM, + "agent", agent, + "stream-id", stream_id, + "component-id", component_id, + NULL); +} + +static gssize +nice_input_stream_read (GInputStream *stream, void *buffer, gsize count, + GCancellable *cancellable, GError **error) +{ + NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv; + NiceAgent *agent; /* owned */ + gssize len; + + /* Closed streams are not readable. */ + if (g_input_stream_is_closed (stream)) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed."); + return -1; + } + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed due to the NiceAgent being finalised."); + return -1; + } + + len = nice_agent_recv (agent, priv->stream_id, priv->component_id, + buffer, count, cancellable, error); + + g_object_unref (agent); + + return len; +} + +static gboolean +nice_input_stream_is_readable (GPollableInputStream *stream) +{ + NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv; + Component *component = NULL; + Stream *_stream = NULL; + gboolean retval = FALSE; + GSList *i; + NiceAgent *agent; /* owned */ + + /* Closed streams are not readable. */ + if (g_input_stream_is_closed (G_INPUT_STREAM (stream))) + return FALSE; + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) + return FALSE; + + agent_lock (); + + if (!agent_find_component (agent, priv->stream_id, priv->component_id, + &_stream, &component)) { + g_warning ("Could not find component %u in stream %u", priv->component_id, + priv->stream_id); + goto done; + } + + /* If it’s a reliable agent, see if there’s any pending data in the pseudo-TCP + * buffer. */ + if (component->tcp != NULL && + pseudo_tcp_socket_get_available_bytes (component->tcp) > 0) { + retval = TRUE; + goto done; + } + + /* Check whether any of the component’s FDs are pollable. */ + for (i = component->socket_sources; i != NULL; i = i->next) { + SocketSource *socket_source = i->data; + NiceSocket *nicesock = socket_source->socket; + + if (g_socket_condition_check (nicesock->fileno, G_IO_IN) != 0) { + retval = TRUE; + break; + } + } + +done: + agent_unlock (); + + g_object_unref (agent); + + return retval; +} + +static gssize +nice_input_stream_read_nonblocking (GPollableInputStream *stream, void *buffer, + gsize count, GError **error) +{ + NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv; + NiceAgent *agent; /* owned */ + gssize len; + + /* Closed streams are not readable. */ + if (g_input_stream_is_closed (G_INPUT_STREAM (stream))) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed."); + return -1; + } + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed due to the NiceAgent being finalised."); + return -1; + } + + len = nice_agent_recv_nonblocking (agent, priv->stream_id, + priv->component_id, (guint8 *) buffer, count, NULL, error); + + g_object_unref (agent); + + return len; +} + +static GSource * +nice_input_stream_create_source (GPollableInputStream *stream, + GCancellable *cancellable) +{ + NiceInputStreamPrivate *priv = NICE_INPUT_STREAM (stream)->priv; + GSource *component_source = NULL; + NiceAgent *agent; /* owned */ + + /* Closed streams cannot have sources. */ + if (g_input_stream_is_closed (G_INPUT_STREAM (stream))) + goto dummy_source; + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) + goto dummy_source; + + component_source = component_input_source_new (agent, priv->stream_id, + priv->component_id, stream, cancellable); + + g_object_unref (agent); + + return component_source; + + dummy_source: + + component_source = g_pollable_source_new (G_OBJECT (stream)); + + if (cancellable) { + GSource *cancellable_source = g_cancellable_source_new (cancellable); + + g_source_set_dummy_callback (cancellable_source); + g_source_add_child_source (component_source, cancellable_source); + g_source_unref (cancellable_source); + } + + return component_source; +} + +static void +streams_removed_cb (NiceAgent *agent, guint *stream_ids, gpointer user_data) +{ + NiceInputStream *self = NICE_INPUT_STREAM (user_data); + guint i; + + for (i = 0; stream_ids[i] != 0; i++) { + if (stream_ids[i] == self->priv->stream_id) { + /* The socket has been closed. */ + g_input_stream_close (G_INPUT_STREAM (self), NULL, NULL); + break; + } + } +} diff -Nru libnice-0.1.4/agent/inputstream.h libnice-0.1.7/agent/inputstream.h --- libnice-0.1.4/agent/inputstream.h 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/agent/inputstream.h 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2013 Collabora Ltd. + * Contact: Youness Alaoui + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Youness Alaoui, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +#ifndef __NICE_INPUT_STREAM_H__ +#define __NICE_INPUT_STREAM_H__ + +#include +#include +#include "agent.h" + +G_BEGIN_DECLS + +/* TYPE MACROS */ +#define NICE_TYPE_INPUT_STREAM \ + (nice_input_stream_get_type ()) +#define NICE_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), NICE_TYPE_INPUT_STREAM, \ + NiceInputStream)) +#define NICE_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), NICE_TYPE_INPUT_STREAM, \ + NiceInputStreamClass)) +#define NICE_IS_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), NICE_TYPE_INPUT_STREAM)) +#define NICE_IS_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), NICE_TYPE_INPUT_STREAM)) +#define NICE_INPUT_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), NICE_TYPE_INPUT_STREAM, \ + NiceInputStreamClass)) + + +typedef struct _NiceInputStreamPrivate NiceInputStreamPrivate; +typedef struct _NiceInputStreamClass NiceInputStreamClass; +typedef struct _NiceInputStream NiceInputStream; + +GType nice_input_stream_get_type (void); + +struct _NiceInputStreamClass +{ + GInputStreamClass parent_class; +}; + +struct _NiceInputStream +{ + GInputStream parent_instance; + NiceInputStreamPrivate *priv; +}; + + +NiceInputStream *nice_input_stream_new (NiceAgent *agent, + guint stream_id, guint component_id); + + +G_END_DECLS + +#endif /* __NICE_INPUT_STREAM_H__ */ diff -Nru libnice-0.1.4/agent/interfaces.c libnice-0.1.7/agent/interfaces.c --- libnice-0.1.4/agent/interfaces.c 2011-12-19 22:22:52.000000000 +0000 +++ libnice-0.1.7/agent/interfaces.c 2014-03-07 02:14:00.000000000 +0000 @@ -27,7 +27,7 @@ #endif #include "interfaces.h" -#include "debug.h" +#include "agent-priv.h" #ifdef G_OS_UNIX @@ -51,7 +51,6 @@ #endif #include -#include #include #ifdef HAVE_GETIFADDRS @@ -143,25 +142,30 @@ static gboolean -nice_interfaces_is_private_ip (const struct sockaddr *sa) +nice_interfaces_is_private_ip (const struct sockaddr *_sa) { - if (sa->sa_family == AF_INET) { - struct sockaddr_in *sa4 = (struct sockaddr_in *) sa; + union { + const struct sockaddr *addr; + const struct sockaddr_in *in; + } sa; + sa.addr = _sa; + + if (sa.addr->sa_family == AF_INET) { /* 10.x.x.x/8 */ - if (sa4->sin_addr.s_addr >> 24 == 0x0A) + if (sa.in->sin_addr.s_addr >> 24 == 0x0A) return TRUE; /* 172.16.0.0 - 172.31.255.255 = 172.16.0.0/10 */ - if (sa4->sin_addr.s_addr >> 20 == 0xAC1) + if (sa.in->sin_addr.s_addr >> 20 == 0xAC1) return TRUE; /* 192.168.x.x/16 */ - if (sa4->sin_addr.s_addr >> 16 == 0xC0A8) + if (sa.in->sin_addr.s_addr >> 16 == 0xC0A8) return TRUE; /* 169.254.x.x/16 (for APIPA) */ - if (sa4->sin_addr.s_addr >> 16 == 0xA9FE) + if (sa.in->sin_addr.s_addr >> 16 == 0xA9FE) return TRUE; } @@ -185,6 +189,14 @@ for (ifa = results; ifa; ifa = ifa->ifa_next) { char addr_as_string[INET6_ADDRSTRLEN+1]; + union { + struct sockaddr *addr; + struct sockaddr_in *in; + struct sockaddr_in6 *in6; + } sa; + + sa.addr = ifa->ifa_addr; + /* no ip address from interface that is down */ if ((ifa->ifa_flags & IFF_UP) == 0) continue; @@ -192,19 +204,15 @@ if (ifa->ifa_addr == NULL) { continue; } else if (ifa->ifa_addr->sa_family == AF_INET) { - struct sockaddr_in *sa4 = (struct sockaddr_in *) ifa->ifa_addr; - - if (inet_ntop (AF_INET, &sa4->sin_addr, addr_as_string, + if (inet_ntop (AF_INET, &sa.in->sin_addr, addr_as_string, INET6_ADDRSTRLEN) == NULL) continue; } else if (ifa->ifa_addr->sa_family == AF_INET6) { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)ifa->ifa_addr; - /* Skip link-local addresses, they require a scope */ - if (IN6_IS_ADDR_LINKLOCAL (&sa6->sin6_addr)) + if (IN6_IS_ADDR_LINKLOCAL (&sa.in6->sin6_addr)) continue; - if (inet_ntop (AF_INET6, &sa6->sin6_addr, addr_as_string, + if (inet_ntop (AF_INET6, &sa.in6->sin6_addr, addr_as_string, INET6_ADDRSTRLEN) == NULL) continue; } else @@ -318,7 +326,10 @@ nice_interfaces_get_ip_for_interface (gchar *interface_name) { struct ifreq ifr; - struct sockaddr_in *sa; + union { + struct sockaddr *addr; + struct sockaddr_in *in; + } sa; gint sockfd; @@ -339,9 +350,9 @@ } close (sockfd); - sa = (struct sockaddr_in *) &ifr.ifr_addr; - nice_debug ("Address for %s: %s", interface_name, inet_ntoa (sa->sin_addr)); - return g_strdup (inet_ntoa (sa->sin_addr)); + sa.addr = &ifr.ifr_addr; + nice_debug ("Address for %s: %s", interface_name, inet_ntoa (sa.in->sin_addr)); + return g_strdup (inet_ntoa (sa.in->sin_addr)); } #else /* G_OS_UNIX */ diff -Nru libnice-0.1.4/agent/iostream.c libnice-0.1.7/agent/iostream.c --- libnice-0.1.4/agent/iostream.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/agent/iostream.c 2014-03-07 02:14:00.000000000 +0000 @@ -0,0 +1,350 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2013 Collabora Ltd. + * Contact: Youness Alaoui + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Youness Alaoui, Collabora Ltd. + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +/*** + * SECTION:nice_io_stream + * @short_description: #GIOStream implementation for libnice + * @see_also: #NiceAgent + * @include: iostream.h + * @stability: Stable + * + * #NiceIOStream is a #GIOStream wrapper for a single reliable stream and + * component of a #NiceAgent. Given an existing reliable #NiceAgent, plus the + * IDs of an existing stream and component in the agent, it will provide a + * streaming input and output interface for communication over the given + * component. + * + * A single #NiceIOStream can only be used with a single agent, stream and + * component triple, and will be closed as soon as that stream is removed from + * the agent (e.g. if nice_agent_remove_stream() is called from another thread). + * If g_io_stream_close() is called on a #NiceIOStream, the I/O stream will be + * marked as closed in both directions, but the underlying #NiceAgent stream + * will not be removed. Use nice_agent_remove_stream() to do that. + * + * Since: 0.1.5 + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "iostream.h" +#include "inputstream.h" +#include "outputstream.h" + +G_DEFINE_TYPE (NiceIOStream, nice_io_stream, G_TYPE_IO_STREAM); + +enum +{ + PROP_AGENT = 1, + PROP_STREAM_ID, + PROP_COMPONENT_ID, +}; + +struct _NiceIOStreamPrivate +{ + GWeakRef/**/ agent_ref; + guint stream_id; + guint component_id; + + GInputStream *input_stream; /* owned */ + GOutputStream *output_stream; /* owned */ +}; + +static void nice_io_stream_dispose (GObject *object); +static void nice_io_stream_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec); +static void nice_io_stream_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec); +static GInputStream *nice_io_stream_get_input_stream (GIOStream *stream); +static GOutputStream *nice_io_stream_get_output_stream (GIOStream *stream); + +static void streams_removed_cb (NiceAgent *agent, guint *stream_ids, + gpointer user_data); + +static void +nice_io_stream_class_init (NiceIOStreamClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GIOStreamClass *stream_class = G_IO_STREAM_CLASS (klass); + + g_type_class_add_private (klass, sizeof (NiceIOStreamPrivate)); + + gobject_class->set_property = nice_io_stream_set_property; + gobject_class->get_property = nice_io_stream_get_property; + gobject_class->dispose = nice_io_stream_dispose; + + stream_class->get_input_stream = nice_io_stream_get_input_stream; + stream_class->get_output_stream = nice_io_stream_get_output_stream; + + /* + * NiceIOStream:agent: + * + * The #NiceAgent to wrap with an I/O stream. This must be an existing + * reliable agent. + * + * A reference is not held on the #NiceAgent. If the agent is destroyed before + * the #NiceIOStream, %G_IO_ERROR_CLOSED will be returned for all subsequent + * operations on the stream. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_AGENT, + g_param_spec_object ("agent", + "NiceAgent", + "The underlying NiceAgent", + NICE_TYPE_AGENT, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /* + * NiceIOStream:stream-id: + * + * ID of the stream to use in the #NiceIOStream:agent. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_STREAM_ID, + g_param_spec_uint ( + "stream-id", + "Agent’s stream ID", + "The ID of the agent’s stream to wrap.", + 0, G_MAXUINT, + 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /* + * NiceIOStream:component-id: + * + * ID of the component to use in the #NiceIOStream:agent. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_COMPONENT_ID, + g_param_spec_uint ( + "component-id", + "Agent’s component ID", + "The ID of the agent’s component to wrap.", + 0, G_MAXUINT, + 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +static void +nice_io_stream_init (NiceIOStream *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NICE_TYPE_IO_STREAM, + NiceIOStreamPrivate); + + g_weak_ref_init (&self->priv->agent_ref, NULL); + + /* Invalidate the stream/component IDs to begin with. */ + self->priv->stream_id = 0; + self->priv->component_id = 0; +} + +static void +nice_io_stream_dispose (GObject *object) +{ + NiceIOStream *self = NICE_IO_STREAM (object); + NiceAgent *agent; + + /* Ensure the stream is closed before continuing. Otherwise, if the input or + * output streams haven’t yet been lazily created, closing the stream in + * g_io_stream_dispose() will lazily create them, but NiceAgent will be NULL + * by that point and things will explode. */ + if (!g_io_stream_is_closed (G_IO_STREAM (object))) + g_io_stream_close (G_IO_STREAM (object), NULL, NULL); + + /* Clear everything away. */ + if (self->priv->input_stream != NULL) + g_object_unref (self->priv->input_stream); + self->priv->input_stream = NULL; + + if (self->priv->output_stream != NULL) + g_object_unref (self->priv->output_stream); + self->priv->output_stream = NULL; + + agent = g_weak_ref_get (&self->priv->agent_ref); + if (agent != NULL) { + g_signal_handlers_disconnect_by_func (agent, streams_removed_cb, self); + g_object_unref (agent); + } + + g_weak_ref_clear (&self->priv->agent_ref); + + G_OBJECT_CLASS (nice_io_stream_parent_class)->dispose (object); +} + +static void +nice_io_stream_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NiceIOStream *self = NICE_IO_STREAM (object); + + switch (prop_id) { + case PROP_AGENT: + g_value_take_object (value, g_weak_ref_get (&self->priv->agent_ref)); + break; + case PROP_STREAM_ID: + g_value_set_uint (value, self->priv->stream_id); + break; + case PROP_COMPONENT_ID: + g_value_set_uint (value, self->priv->component_id); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +nice_io_stream_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NiceIOStream *self = NICE_IO_STREAM (object); + + switch (prop_id) { + case PROP_AGENT: { + /* Construct only. */ + NiceAgent *agent = g_value_dup_object (value); + g_weak_ref_set (&self->priv->agent_ref, agent); + g_signal_connect (agent, "streams-removed", + (GCallback) streams_removed_cb, self); + g_object_unref (agent); + + break; + } + case PROP_STREAM_ID: + /* Construct only. */ + self->priv->stream_id = g_value_get_uint (value); + break; + case PROP_COMPONENT_ID: + /* Construct only. */ + self->priv->component_id = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +/*** + * nice_io_stream_new: + * @agent: A #NiceAgent + * @stream_id: The ID of the agent’s stream to wrap + * @component_id: The ID of the agent’s component to wrap + * + * Create a new #NiceIOStream wrapping the given stream/component from @agent, + * which must be a reliable #NiceAgent. + * + * The constructed #NiceIOStream will not hold a reference to @agent. If @agent + * is destroyed before the I/O stream, %G_IO_ERROR_CLOSED will be returned for + * all subsequent operations on the stream. + * + * Returns: The new #NiceIOStream object + * + * Since: 0.1.5 + */ +GIOStream * +nice_io_stream_new (NiceAgent *agent, guint stream_id, guint component_id) +{ + g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); + g_return_val_if_fail (stream_id > 0, NULL); + g_return_val_if_fail (component_id > 0, NULL); + + return g_object_new (NICE_TYPE_IO_STREAM, + "agent", agent, + "stream-id", stream_id, + "component-id", component_id, + NULL); +} + +static GInputStream * +nice_io_stream_get_input_stream (GIOStream *stream) +{ + NiceIOStream *self = NICE_IO_STREAM (stream); + + if (G_UNLIKELY (self->priv->input_stream == NULL)) { + NiceAgent *agent; + + /* Note that agent may be NULL here. NiceInputStream must support + * construction with a NULL agent. */ + agent = g_weak_ref_get (&self->priv->agent_ref); + self->priv->input_stream = G_INPUT_STREAM (nice_input_stream_new ( + agent, self->priv->stream_id, self->priv->component_id)); + if (agent != NULL) + g_object_unref (agent); + } + + return self->priv->input_stream; +} + +static GOutputStream * +nice_io_stream_get_output_stream (GIOStream *stream) +{ + NiceIOStream *self = NICE_IO_STREAM (stream); + + if (G_UNLIKELY (self->priv->output_stream == NULL)) { + NiceAgent *agent; + + /* Note that agent may be NULL here. NiceOutputStream must support + * construction with a NULL agent. */ + agent = g_weak_ref_get (&self->priv->agent_ref); + self->priv->output_stream = g_object_new (NICE_TYPE_OUTPUT_STREAM, + "agent", agent, + "stream-id", self->priv->stream_id, + "component-id", self->priv->component_id, + NULL); + + if (agent != NULL) + g_object_unref (agent); + } + + return self->priv->output_stream; +} + +static void +streams_removed_cb (NiceAgent *agent, guint *stream_ids, gpointer user_data) +{ + NiceIOStream *self = NICE_IO_STREAM (user_data); + guint i; + + for (i = 0; stream_ids[i] != 0; i++) { + if (stream_ids[i] == self->priv->stream_id) { + /* The socket has been closed. */ + g_io_stream_close (G_IO_STREAM (self), NULL, NULL); + break; + } + } +} diff -Nru libnice-0.1.4/agent/iostream.h libnice-0.1.7/agent/iostream.h --- libnice-0.1.4/agent/iostream.h 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/agent/iostream.h 2014-03-07 02:14:00.000000000 +0000 @@ -0,0 +1,91 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2013 Collabora Ltd. + * Contact: Youness Alaoui + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Youness Alaoui, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +#ifndef __NICE_IO_STREAM_H__ +#define __NICE_IO_STREAM_H__ + +#include +#include + +G_BEGIN_DECLS + +/* TYPE MACROS */ + +/* IO Stream */ +#define NICE_TYPE_IO_STREAM \ + (nice_io_stream_get_type ()) +#define NICE_IO_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), NICE_TYPE_IO_STREAM, \ + NiceIOStream)) +#define NICE_IO_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), NICE_TYPE_IO_STREAM, \ + NiceIOStreamClass)) +#define NICE_IS_IO_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), NICE_TYPE_IO_STREAM)) +#define NICE_IS_IO_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), NICE_TYPE_IO_STREAM)) +#define NICE_IO_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), NICE_TYPE_IO_STREAM, \ + NiceIOStreamClass)) + +/* IO Stream */ +typedef struct _NiceIOStreamPrivate NiceIOStreamPrivate; +typedef struct _NiceIOStreamClass NiceIOStreamClass; +typedef struct _NiceIOStream NiceIOStream; + +#include "agent.h" +#include "inputstream.h" +#include "outputstream.h" + +/* IO Stream */ +GType nice_io_stream_get_type (void); + +struct _NiceIOStreamClass +{ + GIOStreamClass parent_class; +}; + +struct _NiceIOStream +{ + GIOStream parent_instance; + NiceIOStreamPrivate *priv; +}; + +GIOStream *nice_io_stream_new (NiceAgent *agent, + guint stream_id, guint component_id); + +G_END_DECLS + +#endif /* __NICE_IO_STREAM_H__ */ diff -Nru libnice-0.1.4/agent/Makefile.am libnice-0.1.7/agent/Makefile.am --- libnice-0.1.4/agent/Makefile.am 2011-12-20 19:05:00.000000000 +0000 +++ libnice-0.1.7/agent/Makefile.am 2014-03-31 23:27:40.000000000 +0000 @@ -10,7 +10,7 @@ AM_CFLAGS = \ -DG_LOG_DOMAIN=\"libnice\" \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) \ -I $(top_srcdir) \ @@ -22,23 +22,8 @@ AM_CFLAGS += -DWINVER=0x0501 # _WIN32_WINNT_WINXP endif -dist_noinst_DATA = agent-signals-marshal.list noinst_LTLIBRARIES = libagent.la -agent-signals-marshal.h: agent-signals-marshal.list - glib-genmarshal --header --prefix=agent_marshal $? > $@ - -agent-signals-marshal.c: agent-signals-marshal.list - echo '#include "agent-signals-marshal.h"' > $@ - glib-genmarshal --body --prefix=agent_marshal $? | \ - sed -e 's/^}$$/(void)return_value;(void)invocation_hint;}/' >> $@ - -BUILT_SOURCES = \ - agent-signals-marshal.h \ - agent-signals-marshal.c - -CLEANFILES += $(BUILT_SOURCES) - libagent_la_SOURCES = \ address.h \ address.c \ @@ -61,6 +46,12 @@ interfaces.h \ pseudotcp.h \ pseudotcp.c \ + iostream.h \ + iostream.c \ + inputstream.h \ + inputstream.c \ + outputstream.h \ + outputstream.c \ $(BUILT_SOURCES) libagent_la_LIBADD = \ @@ -72,7 +63,14 @@ $(top_builddir)/socket/libsocket.la \ $(top_builddir)/stun/libstun.la -pkginclude_HEADERS = agent.h candidate.h debug.h address.h interfaces.h pseudotcp.h +pkginclude_HEADERS = \ + agent.h \ + candidate.h \ + debug.h \ + address.h \ + interfaces.h \ + pseudotcp.h \ + $(NULL) if WINDOWS libagent_la_LIBADD += -liphlpapi -lws2_32 diff -Nru libnice-0.1.4/agent/Makefile.in libnice-0.1.7/agent/Makefile.in --- libnice-0.1.4/agent/Makefile.in 2013-02-23 00:29:34.000000000 +0000 +++ libnice-0.1.7/agent/Makefile.in 2014-05-05 18:58:19.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -24,25 +23,52 @@ # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. - VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -61,14 +87,15 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(dist_noinst_DATA) $(pkginclude_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ + $(pkginclude_HEADERS) @WINDOWS_TRUE@am__append_1 = -DWINVER=0x0501 # _WIN32_WINNT_WINXP @WINDOWS_TRUE@am__append_2 = -liphlpapi -lws2_32 subdir = agent ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -77,14 +104,26 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = -am__objects_1 = agent-signals-marshal.lo am_libagent_la_OBJECTS = address.lo debug.lo candidate.lo component.lo \ agent.lo stream.lo conncheck.lo discovery.lo interfaces.lo \ - pseudotcp.lo $(am__objects_1) + pseudotcp.lo iostream.lo inputstream.lo outputstream.lo libagent_la_OBJECTS = $(am_libagent_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -97,20 +136,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libagent_la_SOURCES) DIST_SOURCES = $(libagent_la_SOURCES) am__can_run_installinfo = \ @@ -118,7 +153,6 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -DATA = $(dist_noinst_DATA) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -148,6 +182,23 @@ } am__installdirs = "$(DESTDIR)$(pkgincludedir)" HEADERS = $(pkginclude_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -294,33 +345,12 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code -CLEANFILES = *.gcno *.gcda $(BUILT_SOURCES) -AM_CFLAGS = -DG_LOG_DOMAIN=\"libnice\" $(ERROR_CFLAGS) $(GLIB_CFLAGS) \ - $(GUPNP_CFLAGS) -I $(top_srcdir) -I $(top_srcdir)/random -I \ - $(top_srcdir)/socket -I $(top_srcdir)/stun $(am__append_1) -dist_noinst_DATA = agent-signals-marshal.list +CLEANFILES = *.gcno *.gcda +AM_CFLAGS = -DG_LOG_DOMAIN=\"libnice\" $(LIBNICE_CFLAGS) \ + $(GLIB_CFLAGS) $(GUPNP_CFLAGS) -I $(top_srcdir) -I \ + $(top_srcdir)/random -I $(top_srcdir)/socket -I \ + $(top_srcdir)/stun $(am__append_1) noinst_LTLIBRARIES = libagent.la -BUILT_SOURCES = \ - agent-signals-marshal.h \ - agent-signals-marshal.c - libagent_la_SOURCES = \ address.h \ address.c \ @@ -343,6 +373,12 @@ interfaces.h \ pseudotcp.h \ pseudotcp.c \ + iostream.h \ + iostream.c \ + inputstream.h \ + inputstream.c \ + outputstream.h \ + outputstream.c \ $(BUILT_SOURCES) libagent_la_LIBADD = $(top_builddir)/random/libnice-random.la \ @@ -353,9 +389,16 @@ $(top_builddir)/socket/libsocket.la \ $(top_builddir)/stun/libstun.la -pkginclude_HEADERS = agent.h candidate.h debug.h address.h interfaces.h pseudotcp.h -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am +pkginclude_HEADERS = \ + agent.h \ + candidate.h \ + debug.h \ + address.h \ + interfaces.h \ + pseudotcp.h \ + $(NULL) + +all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj @@ -393,12 +436,15 @@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libagent.la: $(libagent_la_OBJECTS) $(libagent_la_DEPENDENCIES) $(EXTRA_libagent_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libagent_la_OBJECTS) $(libagent_la_LIBADD) $(LIBS) @@ -409,14 +455,16 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/address.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agent-signals-marshal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/agent.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/candidate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/component.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conncheck.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/discovery.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inputstream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interfaces.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iostream.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/outputstream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pseudotcp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@ @@ -468,26 +516,15 @@ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -499,15 +536,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -516,6 +549,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -551,15 +599,13 @@ fi; \ done check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am +install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -590,7 +636,6 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ @@ -662,21 +707,22 @@ uninstall-am: uninstall-pkgincludeHEADERS -.MAKE: all check install install-am install-strip +.MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgincludeHEADERS \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-pkgincludeHEADERS +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-pkgincludeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pkgincludeHEADERS check-valgrind: @@ -684,14 +730,6 @@ .PHONY: check-valgrind -agent-signals-marshal.h: agent-signals-marshal.list - glib-genmarshal --header --prefix=agent_marshal $? > $@ - -agent-signals-marshal.c: agent-signals-marshal.list - echo '#include "agent-signals-marshal.h"' > $@ - glib-genmarshal --body --prefix=agent_marshal $? | \ - sed -e 's/^}$$/(void)return_value;(void)invocation_hint;}/' >> $@ - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -Nru libnice-0.1.4/agent/outputstream.c libnice-0.1.7/agent/outputstream.c --- libnice-0.1.4/agent/outputstream.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/agent/outputstream.c 2014-04-16 03:09:44.000000000 +0000 @@ -0,0 +1,638 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2013 Collabora Ltd. + * Contact: Youness Alaoui + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Youness Alaoui, Collabora Ltd. + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +/*** + * SECTION:nice_output_stream + * @short_description: #GOutputStream implementation for libnice + * @see_also: #NiceAgent + * @include: outputstream.h + * @stability: Stable + * + * #NiceOutputStream is a #GOutputStream wrapper for a single reliable stream + * and component of a #NiceAgent. Given an existing reliable #NiceAgent, plus + * the IDs of an existing stream and component in the agent, it will provide a + * streaming output interface for writing to the given component. + * + * A single #NiceOutputStream can only be used with a single agent, stream and + * component triple, and will be closed as soon as that stream is removed from + * the agent (e.g. if nice_agent_remove_stream() is called from another thread). + * If g_output_stream_close() is called on a #NiceOutputStream, the output + * stream will be marked as closed, but the underlying #NiceAgent stream will + * not be removed. Use nice_agent_remove_stream() to do that. + * + * The output stream can only be used once the + * #NiceAgent::reliable-transport-writable signal has been received for the + * stream/component pair. Any calls to g_output_stream_write() before then will + * return %G_IO_ERROR_BROKEN_PIPE. + * + * Since: 0.1.5 + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "outputstream.h" +#include "agent-priv.h" + +static void nice_output_stream_init_pollable ( + GPollableOutputStreamInterface *iface); +static void streams_removed_cb (NiceAgent *agent, guint *stream_ids, + gpointer user_data); + +G_DEFINE_TYPE_WITH_CODE (NiceOutputStream, + nice_output_stream, G_TYPE_OUTPUT_STREAM, + G_IMPLEMENT_INTERFACE (G_TYPE_POLLABLE_OUTPUT_STREAM, + nice_output_stream_init_pollable)); + +enum +{ + PROP_AGENT = 1, + PROP_STREAM_ID, + PROP_COMPONENT_ID, +}; + +struct _NiceOutputStreamPrivate +{ + GWeakRef/**/ agent_ref; + guint stream_id; + guint component_id; + + GCancellable *closed_cancellable; +}; + +static void nice_output_stream_dispose (GObject *object); +static void nice_output_stream_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec); +static void nice_output_stream_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec); + +static gssize nice_output_stream_write (GOutputStream *stream, + const void *buffer, gsize count, GCancellable *cancellable, GError **error); + +static gboolean nice_output_stream_is_writable (GPollableOutputStream *stream); +static gssize nice_output_stream_write_nonblocking ( + GPollableOutputStream *stream, const void *buffer, gsize count, + GError **error); +static GSource *nice_output_stream_create_source (GPollableOutputStream *stream, + GCancellable *cancellable); + +/* Output Stream */ +static void +nice_output_stream_class_init (NiceOutputStreamClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass); + + g_type_class_add_private (klass, sizeof (NiceOutputStreamPrivate)); + + stream_class->write_fn = nice_output_stream_write; + + gobject_class->set_property = nice_output_stream_set_property; + gobject_class->get_property = nice_output_stream_get_property; + gobject_class->dispose = nice_output_stream_dispose; + + /*** + * NiceOutputStream:agent: + * + * The #NiceAgent to wrap with an output stream. This must be an existing + * reliable agent. + * + * A reference is not held on the #NiceAgent. If the agent is destroyed before + * the #NiceOutputStream, %G_IO_ERROR_CLOSED will be returned for all + * subsequent operations on the stream. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_AGENT, + g_param_spec_object ("agent", + "NiceAgent", + "The underlying NiceAgent", + NICE_TYPE_AGENT, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /*** + * NiceOutputStream:stream-id: + * + * ID of the stream to use in the #NiceOutputStream:agent. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_STREAM_ID, + g_param_spec_uint ( + "stream-id", + "Agent’s stream ID", + "The ID of the agent’s stream to wrap.", + 0, G_MAXUINT, + 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /*** + * NiceOutputStream:component-id: + * + * ID of the component to use in the #NiceOutputStream:agent. + * + * Since: 0.1.5 + */ + g_object_class_install_property (gobject_class, PROP_COMPONENT_ID, + g_param_spec_uint ( + "component-id", + "Agent’s component ID", + "The ID of the agent’s component to wrap.", + 0, G_MAXUINT, + 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +static void +nice_output_stream_dispose (GObject *object) +{ + NiceOutputStream *self = NICE_OUTPUT_STREAM (object); + NiceAgent *agent; + + agent = g_weak_ref_get (&self->priv->agent_ref); + if (agent != NULL) { + g_signal_handlers_disconnect_by_func (agent, streams_removed_cb, self); + g_object_unref (agent); + } + + g_weak_ref_clear (&self->priv->agent_ref); + + g_clear_object (&self->priv->closed_cancellable); + + G_OBJECT_CLASS (nice_output_stream_parent_class)->dispose (object); +} + +static void +nice_output_stream_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NiceOutputStream *self = NICE_OUTPUT_STREAM (object); + + switch (prop_id) { + case PROP_AGENT: + g_value_take_object (value, g_weak_ref_get (&self->priv->agent_ref)); + break; + case PROP_STREAM_ID: + g_value_set_uint (value, self->priv->stream_id); + break; + case PROP_COMPONENT_ID: + g_value_set_uint (value, self->priv->component_id); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +nice_output_stream_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NiceOutputStream *self = NICE_OUTPUT_STREAM (object); + + switch (prop_id) { + case PROP_AGENT: { + /* Construct only. */ + NiceAgent *agent = g_value_dup_object (value); + g_weak_ref_set (&self->priv->agent_ref, agent); + + /* agent may be NULL if the stream is being constructed by + * nice_io_stream_get_output_stream() after the NiceIOStream’s agent has + * already been finalised. */ + if (agent != NULL) { + g_signal_connect (agent, "streams-removed", + (GCallback) streams_removed_cb, self); + g_object_unref (agent); + } + + break; + } + case PROP_STREAM_ID: + /* Construct only. */ + self->priv->stream_id = g_value_get_uint (value); + break; + case PROP_COMPONENT_ID: + /* Construct only. */ + self->priv->component_id = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +nice_output_stream_init (NiceOutputStream *stream) +{ + stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream, NICE_TYPE_OUTPUT_STREAM, + NiceOutputStreamPrivate); + + g_weak_ref_init (&stream->priv->agent_ref, NULL); + stream->priv->closed_cancellable = g_cancellable_new (); +} + +static void +nice_output_stream_init_pollable (GPollableOutputStreamInterface *iface) +{ + iface->is_writable = nice_output_stream_is_writable; + iface->write_nonblocking = nice_output_stream_write_nonblocking; + iface->create_source = nice_output_stream_create_source; +} + +/*** + * nice_output_stream_new: + * @agent: A #NiceAgent + * @stream_id: The ID of the agent’s stream to wrap + * @component_id: The ID of the agent’s component to wrap + * + * Create a new #NiceOutputStream wrapping the given stream/component from + * @agent, which must be a reliable #NiceAgent. + * + * The constructed #NiceOutputStream will not hold a reference to @agent. If + * @agent is destroyed before the output stream, %G_IO_ERROR_CLOSED will be + * returned for all subsequent operations on the stream. + * + * Returns: The new #NiceOutputStream object + * + * Since: 0.1.5 + */ +NiceOutputStream * +nice_output_stream_new (NiceAgent *agent, guint stream_id, guint component_id) +{ + g_return_val_if_fail (NICE_IS_AGENT (agent), NULL); + g_return_val_if_fail (stream_id >= 1, NULL); + g_return_val_if_fail (component_id >= 1, NULL); + + return g_object_new (NICE_TYPE_OUTPUT_STREAM, + "agent", agent, + "stream-id", stream_id, + "component-id", component_id, + NULL); +} + +typedef struct { + volatile gint ref_count; + + GCond cond; + GMutex mutex; + + gboolean writable; + gboolean cancelled; +} WriteData; + +static WriteData * +write_data_ref (WriteData *write_data) +{ + g_atomic_int_inc (&write_data->ref_count); + return write_data; +} + +static void +write_data_unref (WriteData *write_data) +{ + if (g_atomic_int_dec_and_test (&write_data->ref_count)) { + g_cond_clear (&write_data->cond); + g_mutex_clear (&write_data->mutex); + g_slice_free (WriteData, write_data); + } +} + +static void +write_cancelled_cb (GCancellable *cancellable, gpointer user_data) +{ + WriteData *write_data = user_data; + + g_mutex_lock (&write_data->mutex); + g_cond_broadcast (&write_data->cond); + write_data->cancelled = TRUE; + g_mutex_unlock (&write_data->mutex); +} + +static void +reliable_transport_writeable_cb (NiceAgent *agent, guint stream_id, + guint component_id, gpointer user_data) +{ + WriteData *write_data = user_data; + + g_mutex_lock (&write_data->mutex); + write_data->writable = TRUE; + g_cond_broadcast (&write_data->cond); + g_mutex_unlock (&write_data->mutex); +} + +static gssize +nice_output_stream_write (GOutputStream *stream, const void *buffer, gsize count, + GCancellable *cancellable, GError **error) +{ + NiceOutputStream *self = NICE_OUTPUT_STREAM (stream); + const gchar* buf = buffer; + gssize len = 0; + gint n_sent; + NiceAgent *agent = NULL; /* owned */ + gulong cancel_id = 0, closed_cancel_id, writeable_id; + WriteData *write_data; + + /* Closed streams are not writeable. */ + if (g_output_stream_is_closed (stream)) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed."); + return -1; + } + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&self->priv->agent_ref); + if (agent == NULL) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed due to the NiceAgent being finalised."); + return -1; + } + + if (count == 0) { + g_object_unref (agent); + return 0; + } + + /* FIXME: nice_agent_send() is non-blocking, which is a bit unexpected + * since nice_agent_recv() is blocking. Currently this uses a fairly dodgy + * GCond solution; would be much better for nice_agent_send() to block + * properly in the main loop. */ + write_data = g_slice_new0 (WriteData); + write_data->ref_count = 1; + g_mutex_init (&write_data->mutex); + g_cond_init (&write_data->cond); + + if (cancellable != NULL) { + cancel_id = g_cancellable_connect (cancellable, + (GCallback) write_cancelled_cb, write_data_ref (write_data), + (GDestroyNotify) write_data_unref); + } + + closed_cancel_id = g_cancellable_connect (self->priv->closed_cancellable, + (GCallback) write_cancelled_cb, write_data_ref (write_data), + (GDestroyNotify) write_data_unref); + + g_mutex_lock (&write_data->mutex); + + writeable_id = g_signal_connect_data (G_OBJECT (agent), + "reliable-transport-writable", + (GCallback) reliable_transport_writeable_cb, write_data_ref (write_data), + (GClosureNotify) write_data_unref, 0); + + + do { + /* Have to unlock while calling into the agent because + * it will take the agent lock which will cause a deadlock if one of + * the callbacks is called. + */ + if (g_cancellable_is_cancelled (cancellable) || + g_cancellable_is_cancelled (self->priv->closed_cancellable)) + break; + + write_data->writable = FALSE; + g_mutex_unlock (&write_data->mutex); + + n_sent = nice_agent_send (agent, self->priv->stream_id, + self->priv->component_id, count - len, buf + len); + + g_mutex_lock (&write_data->mutex); + + if (n_sent <= 0) { + if (!write_data->writable && !write_data->cancelled) + g_cond_wait (&write_data->cond, &write_data->mutex); + } else if (n_sent > 0) { + /* Success. */ + len += n_sent; + } + } while ((gsize) len < count); + + g_signal_handler_disconnect (G_OBJECT (agent), writeable_id); + g_mutex_unlock (&write_data->mutex); + + if (cancel_id) + g_cancellable_disconnect (cancellable, cancel_id); + g_cancellable_disconnect (self->priv->closed_cancellable, closed_cancel_id); + + if (len == 0) { + len = -1; + if (!g_cancellable_set_error_if_cancelled (cancellable, error)) { + if (g_cancellable_is_cancelled (self->priv->closed_cancellable)) + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream has been removed from agent"); + } + } + + write_data_unref (write_data); + + g_object_unref (agent); + g_assert (len != 0); + + return len; +} + +static gboolean +nice_output_stream_is_writable (GPollableOutputStream *stream) +{ + NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; + Component *component = NULL; + Stream *_stream = NULL; + gboolean retval = FALSE; + GSList *i; + NiceAgent *agent; /* owned */ + + /* Closed streams are not writeable. */ + if (g_output_stream_is_closed (G_OUTPUT_STREAM (stream))) + return FALSE; + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) + return FALSE; + + agent_lock (); + + if (!agent_find_component (agent, priv->stream_id, priv->component_id, + &_stream, &component)) { + g_warning ("Could not find component %u in stream %u", priv->component_id, + priv->stream_id); + goto done; + } + + /* If it’s a reliable agent, see if there’s any space in the pseudo-TCP output + * buffer. */ + if (component->tcp != NULL) { + retval = pseudo_tcp_socket_can_send (component->tcp); + goto done; + } + + /* Check whether any of the component’s FDs are pollable. */ + for (i = component->socket_sources; i != NULL; i = i->next) { + SocketSource *socket_source = i->data; + NiceSocket *nicesock = socket_source->socket; + + if (g_socket_condition_check (nicesock->fileno, G_IO_OUT) != 0) { + retval = TRUE; + break; + } + } + +done: + agent_unlock (); + + g_object_unref (agent); + + return retval; +} + +static gssize +nice_output_stream_write_nonblocking (GPollableOutputStream *stream, + const void *buffer, gsize count, GError **error) +{ + NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; + NiceAgent *agent; /* owned */ + gint n_sent; + + /* Closed streams are not writeable. */ + if (g_output_stream_is_closed (G_OUTPUT_STREAM (stream))) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed."); + return -1; + } + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_CLOSED, + "Stream is closed due to the NiceAgent being finalised."); + return -1; + } + + if (count == 0) + return 0; + + /* This is equivalent to the default GPollableOutputStream implementation. */ + if (!g_pollable_output_stream_is_writable (stream)) { + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, + g_strerror (EAGAIN)); + return -1; + } + + n_sent = nice_agent_send (agent, priv->stream_id, priv->component_id, + count, buffer); + + if (n_sent == -1) + g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK, + g_strerror (EAGAIN)); + + + + g_object_unref (agent); + + return n_sent; +} + +static GSource * +nice_output_stream_create_source (GPollableOutputStream *stream, + GCancellable *cancellable) +{ + NiceOutputStreamPrivate *priv = NICE_OUTPUT_STREAM (stream)->priv; + GSource *component_source = NULL; + Component *component = NULL; + Stream *_stream = NULL; + NiceAgent *agent; /* owned */ + + component_source = g_pollable_source_new (G_OBJECT (stream)); + + if (cancellable) { + GSource *cancellable_source = g_cancellable_source_new (cancellable); + + g_source_set_dummy_callback (cancellable_source); + g_source_add_child_source (component_source, cancellable_source); + g_source_unref (cancellable_source); + } + + /* Closed streams cannot have sources. */ + if (g_output_stream_is_closed (G_OUTPUT_STREAM (stream))) + return component_source; + + /* Has the agent disappeared? */ + agent = g_weak_ref_get (&priv->agent_ref); + if (agent == NULL) + return component_source; + + agent_lock (); + + /* Grab the socket for this component. */ + if (!agent_find_component (agent, priv->stream_id, priv->component_id, + &_stream, &component)) { + g_warning ("Could not find component %u in stream %u", priv->component_id, + priv->stream_id); + goto done; + } + + if (component->tcp_writable_cancellable) { + GSource *cancellable_source = + g_cancellable_source_new (component->tcp_writable_cancellable); + + g_source_set_dummy_callback (cancellable_source); + g_source_add_child_source (component_source, cancellable_source); + g_source_unref (cancellable_source); + } + +done: + agent_unlock (); + + g_object_unref (agent); + + return component_source; +} + +static void +streams_removed_cb (NiceAgent *agent, guint *stream_ids, gpointer user_data) +{ + NiceOutputStream *self = NICE_OUTPUT_STREAM (user_data); + guint i; + + for (i = 0; stream_ids[i] != 0; i++) { + if (stream_ids[i] == self->priv->stream_id) { + /* The socket has been closed. */ + g_cancellable_cancel (self->priv->closed_cancellable); + + g_output_stream_close (G_OUTPUT_STREAM (self), NULL, NULL); + break; + } + } +} diff -Nru libnice-0.1.4/agent/outputstream.h libnice-0.1.7/agent/outputstream.h --- libnice-0.1.4/agent/outputstream.h 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/agent/outputstream.h 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,87 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2013 Collabora Ltd. + * Contact: Youness Alaoui + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Youness Alaoui, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +#ifndef __NICE_OUTPUT_STREAM_H__ +#define __NICE_OUTPUT_STREAM_H__ + +#include +#include +#include "agent.h" + +G_BEGIN_DECLS + +/* TYPE MACROS */ +#define NICE_TYPE_OUTPUT_STREAM \ + (nice_output_stream_get_type ()) +#define NICE_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), NICE_TYPE_OUTPUT_STREAM, \ + NiceOutputStream)) +#define NICE_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), NICE_TYPE_OUTPUT_STREAM, \ + NiceOutputStreamClass)) +#define NICE_IS_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), NICE_TYPE_OUTPUT_STREAM)) +#define NICE_IS_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), NICE_TYPE_OUTPUT_STREAM)) +#define NICE_OUTPUT_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), NICE_TYPE_OUTPUT_STREAM, \ + NiceOutputStreamClass)) + + +typedef struct _NiceOutputStreamPrivate NiceOutputStreamPrivate; +typedef struct _NiceOutputStreamClass NiceOutputStreamClass; +typedef struct _NiceOutputStream NiceOutputStream; + + +GType nice_output_stream_get_type (void); + +struct _NiceOutputStreamClass +{ + GOutputStreamClass parent_class; +}; + +struct _NiceOutputStream +{ + GOutputStream parent_instance; + NiceOutputStreamPrivate *priv; +}; + + +NiceOutputStream *nice_output_stream_new (NiceAgent *agent, + guint stream_id, guint component_id); + +G_END_DECLS + +#endif /* __NICE_OUTPUT_STREAM_H__ */ diff -Nru libnice-0.1.4/agent/pseudotcp.c libnice-0.1.7/agent/pseudotcp.c --- libnice-0.1.4/agent/pseudotcp.c 2012-02-17 23:45:33.000000000 +0000 +++ libnice-0.1.7/agent/pseudotcp.c 2014-04-17 22:14:51.000000000 +0000 @@ -74,6 +74,7 @@ #endif #include "pseudotcp.h" +#include "agent-priv.h" G_DEFINE_TYPE (PseudoTcpSocket, pseudo_tcp_socket, G_TYPE_OBJECT); @@ -153,7 +154,17 @@ #define MIN_RTO 250 #define DEF_RTO 3000 /* 3 seconds (RFC1122, Sec 4.2.3.1) */ #define MAX_RTO 60000 /* 60 seconds */ -#define ACK_DELAY 100 /* 100 milliseconds */ +#define DEFAULT_ACK_DELAY 100 /* 100 milliseconds */ +#define DEFAULT_NO_DELAY FALSE + +#define DEFAULT_RCV_BUF_SIZE (60 * 1024) +#define DEFAULT_SND_BUF_SIZE (90 * 1024) + +#define TCP_OPT_EOL 0 // End of list. +#define TCP_OPT_NOOP 1 // No-op. +#define TCP_OPT_MSS 2 // Maximum segment size. +#define TCP_OPT_WND_SCALE 3 // Window scale factor. + /* #define FLAG_FIN 0x01 @@ -193,9 +204,7 @@ static guint32 get_current_time(void) { - GTimeVal tv; - g_get_current_time (&tv); - return tv.tv_sec * 1000 + tv.tv_usec / 1000; + return g_get_monotonic_time () / 1000; } static gboolean @@ -228,6 +237,150 @@ } } +//////////////////////////////////////////////////////// +// PseudoTcpFifo works exactly like FifoBuffer in libjingle +//////////////////////////////////////////////////////// + + +typedef struct { + guint8 *buffer; + gsize buffer_length; + gsize data_length; + gsize read_position; +} PseudoTcpFifo; + + +static void +pseudo_tcp_fifo_init (PseudoTcpFifo *b, gsize size) +{ + b->buffer = g_slice_alloc (size); + b->buffer_length = size; +} + +static void +pseudo_tcp_fifo_clear (PseudoTcpFifo *b) +{ + if (b->buffer) + g_slice_free1 (b->buffer_length, b->buffer); + b->buffer = NULL; + b->buffer_length = 0; +} + +static gsize +pseudo_tcp_fifo_get_buffered (PseudoTcpFifo *b) +{ + return b->data_length; +} + +static gboolean +pseudo_tcp_fifo_set_capacity (PseudoTcpFifo *b, gsize size) +{ + if (b->data_length > size) + return FALSE; + + if (size != b->data_length) { + guint8 *buffer = g_slice_alloc (size); + gsize copy = b->data_length; + gsize tail_copy = min (copy, b->buffer_length - b->read_position); + + memcpy (buffer, &b->buffer[b->read_position], tail_copy); + memcpy (buffer + tail_copy, &b->buffer[0], copy - tail_copy); + g_slice_free1 (b->buffer_length, b->buffer); + b->buffer = buffer; + b->buffer_length = size; + b->read_position = 0; + } + + return TRUE; +} + +static void +pseudo_tcp_fifo_consume_read_data (PseudoTcpFifo *b, gsize size) +{ + g_assert (size <= b->data_length); + + b->read_position = (b->read_position + size) % b->buffer_length; + b->data_length -= size; +} + +static void +pseudo_tcp_fifo_consume_write_buffer (PseudoTcpFifo *b, gsize size) +{ + g_assert (size <= b->buffer_length - b->data_length); + + b->data_length += size; +} + +static gsize +pseudo_tcp_fifo_get_write_remaining (PseudoTcpFifo *b) +{ + return b->buffer_length - b->data_length; +} + +static gsize +pseudo_tcp_fifo_read_offset (PseudoTcpFifo *b, guint8 *buffer, gsize bytes, + gsize offset) +{ + gsize available = b->data_length - offset; + gsize read_position = (b->read_position + offset) % b->buffer_length; + gsize copy = min (bytes, available); + gsize tail_copy = min(copy, b->buffer_length - read_position); + + /* EOS */ + if (offset >= b->data_length) + return 0; + + memcpy(buffer, &b->buffer[read_position], tail_copy); + memcpy(buffer + tail_copy, &b->buffer[0], copy - tail_copy); + + return copy; +} + +static gsize +pseudo_tcp_fifo_write_offset (PseudoTcpFifo *b, const guint8 *buffer, + gsize bytes, gsize offset) +{ + gsize available = b->buffer_length - b->data_length - offset; + gsize write_position = (b->read_position + b->data_length + offset) + % b->buffer_length; + gsize copy = min (bytes, available); + gsize tail_copy = min(copy, b->buffer_length - write_position); + + if (b->data_length + offset >= b->buffer_length) { + return 0; + } + + memcpy(&b->buffer[write_position], buffer, tail_copy); + memcpy(&b->buffer[0], buffer + tail_copy, copy - tail_copy); + + return copy; +} + +static gsize +pseudo_tcp_fifo_read (PseudoTcpFifo *b, guint8 *buffer, gsize bytes) +{ + gsize copy; + + copy = pseudo_tcp_fifo_read_offset (b, buffer, bytes, 0); + + b->read_position = (b->read_position + copy) % b->buffer_length; + b->data_length -= copy; + + return copy; +} + +static gsize +pseudo_tcp_fifo_write (PseudoTcpFifo *b, const guint8 *buffer, gsize bytes) +{ + gsize copy; + + copy = pseudo_tcp_fifo_write_offset (b, buffer, bytes, 0); + b->data_length += copy; + + return copy; +} + + ////////////////////////////////////////////////////////////////////// // PseudoTcp ////////////////////////////////////////////////////////////////////// @@ -244,14 +397,6 @@ sfImmediateAck } SendFlags; -enum { - // Note: can't go as high as 1024 * 64, because of uint16 precision - kRcvBufSize = 1024 * 60, - // Note: send buffer should be larger to make sure we can always fill the - // receiver window - kSndBufSize = 1024 * 90 -}; - typedef struct { guint32 conv, seq, ack; guint8 flags; @@ -286,13 +431,18 @@ // Incoming data GList *rlist; - gchar rbuf[kRcvBufSize]; - guint32 rcv_nxt, rcv_wnd, rlen, lastrecv; + guint32 rbuf_len, rcv_nxt, rcv_wnd, lastrecv; + guint8 rwnd_scale; // Window scale factor + PseudoTcpFifo rbuf; // Outgoing data - GList *slist; - gchar sbuf[kSndBufSize]; - guint32 snd_nxt, snd_wnd, slen, lastsend, snd_una; + GQueue slist; + GQueue unsent_slist; + guint32 sbuf_len, snd_nxt, snd_wnd, lastsend; + guint32 snd_una; /* oldest unacknowledged sequence number */ + guint8 swnd_scale; // Window scale factor + PseudoTcpFifo sbuf; + // Maximum segment size, estimated protocol level, largest segment sent guint32 mss, msslevel, largest, mtu_advise; // Retransmit timer @@ -308,10 +458,20 @@ guint32 ssthresh, cwnd; guint8 dup_acks; guint32 recover; - guint32 t_ack; + guint32 t_ack; /* time a delayed ack was scheduled; 0 if no acks scheduled */ + gboolean use_nagling; + guint32 ack_delay; + + // This is used by unit tests to test backward compatibility of + // PseudoTcp implementations that don't support window scaling. + gboolean support_wnd_scale; }; +#define LARGER(a,b) (((a) - (b) - 1) < (G_MAXUINT32 >> 1)) +#define LARGER_OR_EQUAL(a,b) (((a) - (b)) < (G_MAXUINT32 >> 1)) +#define SMALLER(a,b) LARGER ((b),(a)) +#define SMALLER_OR_EQUAL(a,b) LARGER_OR_EQUAL ((b),(a)) /* properties */ enum @@ -319,6 +479,10 @@ PROP_CONVERSATION = 1, PROP_CALLBACKS, PROP_STATE, + PROP_ACK_DELAY, + PROP_NO_DELAY, + PROP_RCV_BUF, + PROP_SND_BUF, LAST_PROPERTY }; @@ -330,17 +494,23 @@ static void pseudo_tcp_socket_finalize (GObject *object); +static void queue_connect_message (PseudoTcpSocket *self); static guint32 queue(PseudoTcpSocket *self, const gchar * data, guint32 len, gboolean bCtrl); static PseudoTcpWriteResult packet(PseudoTcpSocket *self, guint32 seq, - guint8 flags, const gchar * data, guint32 len); -static gboolean parse(PseudoTcpSocket *self, - const guint8 * buffer, guint32 size); + guint8 flags, guint32 offset, guint32 len, guint32 now); +static gboolean parse (PseudoTcpSocket *self, + const guint8 *_header_buf, gsize header_buf_len, + const guint8 *data_buf, gsize data_buf_len); static gboolean process(PseudoTcpSocket *self, Segment *seg); -static gboolean transmit(PseudoTcpSocket *self, const GList *seg, guint32 now); +static gboolean transmit(PseudoTcpSocket *self, SSegment *sseg, guint32 now); static void attempt_send(PseudoTcpSocket *self, SendFlags sflags); static void closedown(PseudoTcpSocket *self, guint32 err); static void adjustMTU(PseudoTcpSocket *self); +static void parse_options (PseudoTcpSocket *self, const guint8 *data, + guint32 len); +static void resize_send_buffer (PseudoTcpSocket *self, guint32 new_size); +static void resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size); // The following logging is for detailed (packet-level) pseudotcp analysis only. @@ -393,6 +563,29 @@ TCP_LISTEN, TCP_CLOSED, TCP_LISTEN, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_ACK_DELAY, + g_param_spec_uint ("ack-delay", "ACK Delay", + "Delayed ACK timeout (in milliseconds)", + 0, G_MAXUINT, DEFAULT_ACK_DELAY, + G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_NO_DELAY, + g_param_spec_boolean ("no-delay", "No Delay", + "Disable the Nagle algorithm (like the TCP_NODELAY option)", + DEFAULT_NO_DELAY, + G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_RCV_BUF, + g_param_spec_uint ("rcv-buf", "Receive Buffer", + "Receive Buffer size", + 1, G_MAXUINT, DEFAULT_RCV_BUF_SIZE, + G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property (object_class, PROP_SND_BUF, + g_param_spec_uint ("snd-buf", "Send Buffer", + "Send Buffer size", + 1, G_MAXUINT, DEFAULT_SND_BUF_SIZE, + G_PARAM_READWRITE| G_PARAM_STATIC_STRINGS)); } @@ -414,6 +607,18 @@ case PROP_STATE: g_value_set_uint (value, self->priv->state); break; + case PROP_ACK_DELAY: + g_value_set_uint (value, self->priv->ack_delay); + break; + case PROP_NO_DELAY: + g_value_set_boolean (value, !self->priv->use_nagling); + break; + case PROP_RCV_BUF: + g_value_set_uint (value, self->priv->rbuf_len); + break; + case PROP_SND_BUF: + g_value_set_uint (value, self->priv->sbuf_len); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -438,6 +643,20 @@ self->priv->callbacks = *c; } break; + case PROP_ACK_DELAY: + self->priv->ack_delay = g_value_get_uint (value); + break; + case PROP_NO_DELAY: + self->priv->use_nagling = !g_value_get_boolean (value); + break; + case PROP_RCV_BUF: + g_return_if_fail (self->priv->state == TCP_LISTEN); + resize_receive_buffer (self, g_value_get_uint (value)); + break; + case PROP_SND_BUF: + g_return_if_fail (self->priv->state == TCP_LISTEN); + resize_send_buffer (self, g_value_get_uint (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -450,23 +669,24 @@ PseudoTcpSocket *self = PSEUDO_TCP_SOCKET (object); PseudoTcpSocketPrivate *priv = self->priv; GList *i; + SSegment *sseg; if (priv == NULL) return; - for (i = priv->slist; i; i = i->next) { - SSegment *sseg = i->data; + while ((sseg = g_queue_pop_head (&priv->slist))) g_slice_free (SSegment, sseg); - } + g_queue_clear (&priv->unsent_slist); for (i = priv->rlist; i; i = i->next) { RSegment *rseg = i->data; g_slice_free (RSegment, rseg); } - g_list_free (priv->slist); - priv->slist = NULL; g_list_free (priv->rlist); priv->rlist = NULL; + pseudo_tcp_fifo_clear (&priv->rbuf); + pseudo_tcp_fifo_clear (&priv->sbuf); + g_free (priv); self->priv = NULL; @@ -489,12 +709,20 @@ priv->shutdown = SD_NONE; priv->error = 0; + priv->rbuf_len = DEFAULT_RCV_BUF_SIZE; + pseudo_tcp_fifo_init (&priv->rbuf, priv->rbuf_len); + priv->sbuf_len = DEFAULT_SND_BUF_SIZE; + pseudo_tcp_fifo_init (&priv->sbuf, priv->sbuf_len); + priv->state = TCP_LISTEN; priv->conv = 0; - priv->rcv_wnd = sizeof(priv->rbuf); - priv->snd_nxt = priv->slen = 0; + g_queue_init (&priv->slist); + g_queue_init (&priv->unsent_slist); + priv->rcv_wnd = priv->rbuf_len; + priv->rwnd_scale = priv->swnd_scale = 0; + priv->snd_nxt = 0; priv->snd_wnd = 1; - priv->snd_una = priv->rcv_nxt = priv->rlen = 0; + priv->snd_una = priv->rcv_nxt = 0; priv->bReadEnable = TRUE; priv->bWriteEnable = FALSE; priv->t_ack = 0; @@ -507,7 +735,7 @@ priv->rto_base = 0; priv->cwnd = 2 * priv->mss; - priv->ssthresh = sizeof(priv->rbuf); + priv->ssthresh = priv->rbuf_len; priv->lastrecv = priv->lastsend = priv->last_traffic = now; priv->bOutgoing = FALSE; @@ -518,6 +746,11 @@ priv->rx_rto = DEF_RTO; priv->rx_srtt = priv->rx_rttvar = 0; + + priv->ack_delay = DEFAULT_ACK_DELAY; + priv->use_nagling = !DEFAULT_NO_DELAY; + + priv->support_wnd_scale = TRUE; } PseudoTcpSocket *pseudo_tcp_socket_new (guint32 conversation, @@ -530,11 +763,30 @@ NULL); } +static void +queue_connect_message (PseudoTcpSocket *self) +{ + PseudoTcpSocketPrivate *priv = self->priv; + guint8 buf[4]; + gsize size = 1; + + buf[0] = CTL_CONNECT; + if (priv->support_wnd_scale) { + buf[1] = TCP_OPT_WND_SCALE; + buf[2] = 1; + buf[3] = priv->rwnd_scale; + size = 4; + } + + priv->snd_wnd = size; + + queue(self, (char*) buf, size, TRUE); +} + gboolean pseudo_tcp_socket_connect(PseudoTcpSocket *self) { PseudoTcpSocketPrivate *priv = self->priv; - gchar buffer[1]; if (priv->state != TCP_LISTEN) { priv->error = EINVAL; @@ -544,8 +796,7 @@ priv->state = TCP_SYN_SENT; DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "State: TCP_SYN_SENT"); - buffer[0] = CTL_CONNECT; - queue(self, buffer, 1, TRUE); + queue_connect_message (self); attempt_send(self, sfNone); return TRUE; @@ -573,7 +824,7 @@ // Check if it's time to retransmit a segment if (priv->rto_base && (time_diff(priv->rto_base + priv->rx_rto, now) <= 0)) { - if (g_list_length (priv->slist) == 0) { + if (g_queue_get_length (&priv->slist) == 0) { g_assert_not_reached (); } else { // Note: (priv->slist.front().xmit == 0)) { @@ -585,7 +836,7 @@ "(rto_base: %d) (now: %d) (dup_acks: %d)", priv->rx_rto, priv->rto_base, now, (guint) priv->dup_acks); - if (!transmit(self, priv->slist, now)) { + if (!transmit(self, g_queue_peek_head (&priv->slist), now)) { closedown(self, ECONNABORTED); return; } @@ -611,7 +862,7 @@ } // probe the window - packet(self, priv->snd_nxt - 1, 0, 0, 0); + packet(self, priv->snd_nxt - 1, 0, 0, 0, now); priv->lastsend = now; // back off retransmit timer @@ -619,8 +870,8 @@ } // Check if it's time to send delayed acks - if (priv->t_ack && (time_diff(priv->t_ack + ACK_DELAY, now) <= 0)) { - packet(self, priv->snd_nxt, 0, 0, 0); + if (priv->t_ack && (time_diff(priv->t_ack + priv->ack_delay, now) <= 0)) { + packet(self, priv->snd_nxt, 0, 0, 0, now); } } @@ -629,43 +880,96 @@ pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self, const gchar * buffer, guint32 len) { + gboolean retval; + if (len > MAX_PACKET) { //LOG_F(WARNING) << "packet too large"; return FALSE; + } else if (len < HEADER_SIZE) { + //LOG_F(WARNING) << "packet too small"; + return FALSE; } - return parse(self, (guint8 *) buffer, len); + + /* Hold a reference to the PseudoTcpSocket during parsing, since it may be + * closed from within a callback. */ + g_object_ref (self); + retval = parse (self, (guint8 *) buffer, HEADER_SIZE, + (guint8 *) buffer + HEADER_SIZE, len - HEADER_SIZE); + g_object_unref (self); + + return retval; +} + +/* Assume there are two buffers in the given #NiceInputMessage: a 24-byte one + * containing the header, and a bigger one for the data. */ +gboolean +pseudo_tcp_socket_notify_message (PseudoTcpSocket *self, + NiceInputMessage *message) +{ + gboolean retval; + + g_assert_cmpuint (message->n_buffers, >, 0); + + if (message->n_buffers == 1) + return pseudo_tcp_socket_notify_packet (self, message->buffers[0].buffer, + message->buffers[0].size); + + g_assert_cmpuint (message->n_buffers, ==, 2); + g_assert_cmpuint (message->buffers[0].size, ==, HEADER_SIZE); + + if (message->length > MAX_PACKET) { + //LOG_F(WARNING) << "packet too large"; + return FALSE; + } else if (message->length < HEADER_SIZE) { + //LOG_F(WARNING) << "packet too small"; + return FALSE; + } + + /* Hold a reference to the PseudoTcpSocket during parsing, since it may be + * closed from within a callback. */ + g_object_ref (self); + retval = parse (self, message->buffers[0].buffer, message->buffers[0].size, + message->buffers[1].buffer, message->length - message->buffers[0].size); + g_object_unref (self); + + return retval; } gboolean -pseudo_tcp_socket_get_next_clock(PseudoTcpSocket *self, long *timeout) +pseudo_tcp_socket_get_next_clock(PseudoTcpSocket *self, guint64 *timeout) { PseudoTcpSocketPrivate *priv = self->priv; guint32 now = get_current_time (); + gsize snd_buffered; if (priv->shutdown == SD_FORCEFUL) return FALSE; + snd_buffered = pseudo_tcp_fifo_get_buffered (&priv->sbuf); if ((priv->shutdown == SD_GRACEFUL) && ((priv->state != TCP_ESTABLISHED) - || ((priv->slen == 0) && (priv->t_ack == 0)))) { + || ((snd_buffered == 0) && (priv->t_ack == 0)))) { return FALSE; } + if (*timeout == 0 || *timeout < now) + *timeout = now + CLOSED_TIMEOUT; + if (priv->state == TCP_CLOSED) { - *timeout = CLOSED_TIMEOUT; + *timeout = min (*timeout, now + CLOSED_TIMEOUT); return TRUE; } - *timeout = DEFAULT_TIMEOUT; + *timeout = min (*timeout, now + DEFAULT_TIMEOUT); if (priv->t_ack) { - *timeout = min(*timeout, time_diff(priv->t_ack + ACK_DELAY, now)); + *timeout = min(*timeout, priv->t_ack + priv->ack_delay); } if (priv->rto_base) { - *timeout = min(*timeout, time_diff(priv->rto_base + priv->rx_rto, now)); + *timeout = min(*timeout, priv->rto_base + priv->rx_rto); } if (priv->snd_wnd == 0) { - *timeout = min(*timeout, time_diff(priv->lastsend + priv->rx_rto, now)); + *timeout = min(*timeout, priv->lastsend + priv->rx_rto); } return TRUE; @@ -676,40 +980,41 @@ pseudo_tcp_socket_recv(PseudoTcpSocket *self, char * buffer, size_t len) { PseudoTcpSocketPrivate *priv = self->priv; - guint32 read; + gsize bytesread; + gsize available_space; if (priv->state != TCP_ESTABLISHED) { priv->error = ENOTCONN; return -1; } - if (priv->rlen == 0) { + if (len == 0) + return 0; + + bytesread = pseudo_tcp_fifo_read (&priv->rbuf, (guint8 *) buffer, len); + + // If there's no data in |m_rbuf|. + if (bytesread == 0) { priv->bReadEnable = TRUE; priv->error = EWOULDBLOCK; return -1; } - read = min((guint32) len, priv->rlen); - memcpy(buffer, priv->rbuf, read); - priv->rlen -= read; - - /* !?! until we create a circular buffer, we need to move all of the rest - of the buffer up! */ - memmove(priv->rbuf, priv->rbuf + read, sizeof(priv->rbuf) - read); + available_space = pseudo_tcp_fifo_get_write_remaining (&priv->rbuf); - if ((sizeof(priv->rbuf) - priv->rlen - priv->rcv_wnd) - >= min(sizeof(priv->rbuf) / 2, priv->mss)) { + if (available_space - priv->rcv_wnd >= + min (priv->rbuf_len / 2, priv->mss)) { // !?! Not sure about this was closed business gboolean bWasClosed = (priv->rcv_wnd == 0); - priv->rcv_wnd = sizeof(priv->rbuf) - priv->rlen; + priv->rcv_wnd = available_space; if (bWasClosed) { attempt_send(self, sfImmediateAck); } } - return read; + return bytesread; } gint @@ -717,13 +1022,16 @@ { PseudoTcpSocketPrivate *priv = self->priv; gint written; + gsize available_space; if (priv->state != TCP_ESTABLISHED) { priv->error = ENOTCONN; return -1; } - if (priv->slen == sizeof(priv->sbuf)) { + available_space = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf); + + if (!available_space) { priv->bWriteEnable = TRUE; priv->error = EWOULDBLOCK; return -1; @@ -743,7 +1051,8 @@ pseudo_tcp_socket_close(PseudoTcpSocket *self, gboolean force) { PseudoTcpSocketPrivate *priv = self->priv; - //nice_agent ("Closing socket %p : %d", sock, force?"true":"false"); + DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "Closing socket %p : %s", self, + force ? "forcefully" : "gracefully"); priv->shutdown = force ? SD_FORCEFUL : SD_GRACEFUL; } @@ -762,70 +1071,90 @@ queue(PseudoTcpSocket *self, const gchar * data, guint32 len, gboolean bCtrl) { PseudoTcpSocketPrivate *priv = self->priv; + gsize available_space; - if (len > sizeof(priv->sbuf) - priv->slen) { + available_space = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf); + if (len > available_space) { g_assert(!bCtrl); - len = sizeof(priv->sbuf) - priv->slen; + len = available_space; } // We can concatenate data if the last segment is the same type // (control v. regular data), and has not been transmitted yet - if (g_list_length (priv->slist) > 0 && - (((SSegment *)g_list_last (priv->slist)->data)->bCtrl == bCtrl) && - (((SSegment *)g_list_last (priv->slist)->data)->xmit == 0)) { - ((SSegment *)g_list_last (priv->slist)->data)->len += len; + if (g_queue_get_length (&priv->slist) && + (((SSegment *)g_queue_peek_tail (&priv->slist))->bCtrl == bCtrl) && + (((SSegment *)g_queue_peek_tail (&priv->slist))->xmit == 0)) { + ((SSegment *)g_queue_peek_tail (&priv->slist))->len += len; } else { SSegment *sseg = g_slice_new0 (SSegment); - sseg->seq = priv->snd_una + priv->slen; + gsize snd_buffered = pseudo_tcp_fifo_get_buffered (&priv->sbuf); + + sseg->seq = priv->snd_una + snd_buffered; sseg->len = len; sseg->bCtrl = bCtrl; - priv->slist = g_list_append (priv->slist, sseg); + g_queue_push_tail (&priv->slist, sseg); + g_queue_push_tail (&priv->unsent_slist, sseg); } - memcpy(priv->sbuf + priv->slen, data, len); - priv->slen += len; //LOG(LS_INFO) << "PseudoTcp::queue - priv->slen = " << priv->slen; - return len; + return pseudo_tcp_fifo_write (&priv->sbuf, (guint8*) data, len);; } +// Creates a packet and submits it to the network. This method can either +// send payload or just an ACK packet. +// +// |seq| is the sequence number of this packet. +// |flags| is the flags for sending this packet. +// |offset| is the offset to read from |m_sbuf|. +// |len| is the number of bytes to read from |m_sbuf| as payload. If this +// value is 0 then this is an ACK packet, otherwise this packet has payload. + static PseudoTcpWriteResult packet(PseudoTcpSocket *self, guint32 seq, guint8 flags, - const gchar * data, guint32 len) + guint32 offset, guint32 len, guint32 now) { PseudoTcpSocketPrivate *priv = self->priv; - guint32 now = get_current_time(); - guint8 buffer[MAX_PACKET]; + union { + guint8 u8[MAX_PACKET]; + guint16 u16[MAX_PACKET / 2]; + guint32 u32[MAX_PACKET / 4]; + } buffer; PseudoTcpWriteResult wres = WR_SUCCESS; g_assert(HEADER_SIZE + len <= MAX_PACKET); - *((guint32 *) buffer) = htonl(priv->conv); - *((guint32 *) (buffer + 4)) = htonl(seq); - *((guint32 *) (buffer + 8)) = htonl(priv->rcv_nxt); - buffer[12] = 0; - buffer[13] = flags; - *((guint16 *) (buffer + 14)) = htons((guint16)priv->rcv_wnd); + *buffer.u32 = htonl(priv->conv); + *(buffer.u32 + 1) = htonl(seq); + *(buffer.u32 + 2) = htonl(priv->rcv_nxt); + buffer.u8[12] = 0; + buffer.u8[13] = flags; + *(buffer.u16 + 7) = htons((guint16)(priv->rcv_wnd >> priv->rwnd_scale)); // Timestamp computations - *((guint32 *) (buffer + 16)) = htonl(now); - *((guint32 *) (buffer + 20)) = htonl(priv->ts_recent); + *(buffer.u32 + 4) = htonl(now); + *(buffer.u32 + 5) = htonl(priv->ts_recent); priv->ts_lastack = priv->rcv_nxt; - if (data != NULL) - memcpy(buffer + HEADER_SIZE, data, len); + if (len) { + gsize bytes_read; + + bytes_read = pseudo_tcp_fifo_read_offset (&priv->sbuf, buffer.u8 + HEADER_SIZE, + len, offset); + g_assert (bytes_read == len); + } DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "<-- " "", priv->conv, (unsigned)flags, seq, seq + len, priv->rcv_nxt, priv->rcv_wnd, now % 10000, priv->ts_recent % 10000, len); - wres = priv->callbacks.WritePacket(self, (gchar *) buffer, len + HEADER_SIZE, + wres = priv->callbacks.WritePacket(self, (gchar *) buffer.u8, len + HEADER_SIZE, priv->callbacks.user_data); - /* Note: When data is NULL, this is an ACK packet. We don't read the + /* Note: When len is 0, this is an ACK packet. We don't read the return value for those, and thus we won't retry. So go ahead and treat the packet as a success (basically simulate as if it were dropped), which will prevent our timers from being messed up. */ - if ((wres != WR_SUCCESS) && (NULL != data)) + if ((wres != WR_SUCCESS) && (0 != len)) return wres; priv->t_ack = 0; @@ -839,24 +1168,33 @@ } static gboolean -parse(PseudoTcpSocket *self, const guint8 * buffer, guint32 size) +parse (PseudoTcpSocket *self, const guint8 *_header_buf, gsize header_buf_len, + const guint8 *data_buf, gsize data_buf_len) { Segment seg; - if (size < 12) + union { + const guint8 *u8; + const guint16 *u16; + const guint32 *u32; + } header_buf; + + header_buf.u8 = _header_buf; + + if (header_buf_len != 24) return FALSE; - seg.conv = ntohl(*(guint32 *)buffer); - seg.seq = ntohl(*(guint32 *)(buffer + 4)); - seg.ack = ntohl(*(guint32 *)(buffer + 8)); - seg.flags = buffer[13]; - seg.wnd = ntohs(*(guint16 *)(buffer + 14)); + seg.conv = ntohl(*header_buf.u32); + seg.seq = ntohl(*(header_buf.u32 + 1)); + seg.ack = ntohl(*(header_buf.u32 + 2)); + seg.flags = header_buf.u8[13]; + seg.wnd = ntohs(*(header_buf.u16 + 7)); - seg.tsval = ntohl(*(guint32 *)(buffer + 16)); - seg.tsecr = ntohl(*(guint32 *)(buffer + 20)); + seg.tsval = ntohl(*(header_buf.u32 + 4)); + seg.tsecr = ntohl(*(header_buf.u32 + 5)); - seg.data = ((gchar *)buffer) + HEADER_SIZE; - seg.len = size - HEADER_SIZE; + seg.data = (const gchar *) data_buf; + seg.len = data_buf_len; DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "--> " "", @@ -876,6 +1214,9 @@ gboolean bIgnoreData; gboolean bNewData; gboolean bConnect = FALSE; + gsize snd_buffered; + gsize available_space; + guint32 kIdealRefillSize; /* If this is the wrong conversation, send a reset!?! (with the correct conversation?) */ @@ -911,11 +1252,12 @@ return FALSE; } else if (seg->data[0] == CTL_CONNECT) { bConnect = TRUE; + + parse_options (self, (guint8 *) &seg->data[1], seg->len - 1); + if (priv->state == TCP_LISTEN) { - char buffer[1]; priv->state = TCP_SYN_RECEIVED; - buffer[0] = CTL_CONNECT; - queue(self, buffer, 1, TRUE); + queue_connect_message (self); } else if (priv->state == TCP_SYN_SENT) { priv->state = TCP_ESTABLISHED; DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "State: TCP_ESTABLISHED"); @@ -931,16 +1273,16 @@ } // Update timestamp - if ((seg->seq <= priv->ts_lastack) && - (priv->ts_lastack < seg->seq + seg->len)) { + if (SMALLER_OR_EQUAL (seg->seq, priv->ts_lastack) && + SMALLER (priv->ts_lastack, seg->seq + seg->len)) { priv->ts_recent = seg->tsval; } // Check if this is a valuable ack - if ((seg->ack > priv->snd_una) && (seg->ack <= priv->snd_nxt)) { + if (LARGER(seg->ack, priv->snd_una) && + SMALLER_OR_EQUAL(seg->ack, priv->snd_nxt)) { guint32 nAcked; guint32 nFree; - guint32 kIdealRefillSize; // Calculate round-trip time if (seg->tsecr) { @@ -960,42 +1302,42 @@ DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "rtt: %ld srtt: %d rto: %d", rtt, priv->rx_srtt, priv->rx_rto); } else { - g_assert_not_reached (); + DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "Invalid RTT: %ld", rtt); + return FALSE; } } - priv->snd_wnd = seg->wnd; + priv->snd_wnd = seg->wnd << priv->swnd_scale; nAcked = seg->ack - priv->snd_una; priv->snd_una = seg->ack; priv->rto_base = (priv->snd_una == priv->snd_nxt) ? 0 : now; - priv->slen -= nAcked; - memmove(priv->sbuf, priv->sbuf + nAcked, priv->slen); - //LOG(LS_INFO) << "PseudoTcp::process - priv->slen = " << priv->slen; + pseudo_tcp_fifo_consume_read_data (&priv->sbuf, nAcked); for (nFree = nAcked; nFree > 0; ) { SSegment *data; - g_assert(priv->slist != NULL); - data = (SSegment *) (priv->slist->data); + g_assert(g_queue_get_length (&priv->slist) != 0); + data = (SSegment *) g_queue_peek_head (&priv->slist); if (nFree < data->len) { data->len -= nFree; + data->seq += nFree; nFree = 0; } else { if (data->len > priv->largest) { priv->largest = data->len; } nFree -= data->len; - g_slice_free (SSegment, priv->slist->data); - priv->slist = g_list_delete_link (priv->slist, priv->slist); + g_slice_free (SSegment, data); + g_queue_pop_head (&priv->slist); } } if (priv->dup_acks >= 3) { - if (priv->snd_una >= priv->recover) { // NewReno + if (LARGER_OR_EQUAL (priv->snd_una, priv->recover)) { // NewReno guint32 nInFlight = priv->snd_nxt - priv->snd_una; // (Fast Retransmit) priv->cwnd = min(priv->ssthresh, nInFlight + priv->mss); @@ -1003,7 +1345,7 @@ priv->dup_acks = 0; } else { DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "recovery retransmit"); - if (!transmit(self, priv->slist, now)) { + if (!transmit(self, g_queue_peek_head (&priv->slist), now)) { closedown(self, ECONNABORTED); return FALSE; } @@ -1018,29 +1360,10 @@ priv->cwnd += max(1LU, priv->mss * priv->mss / priv->cwnd); } } - - // !?! A bit hacky - if ((priv->state == TCP_SYN_RECEIVED) && !bConnect) { - priv->state = TCP_ESTABLISHED; - DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "State: TCP_ESTABLISHED"); - adjustMTU(self); - if (priv->callbacks.PseudoTcpOpened) - priv->callbacks.PseudoTcpOpened(self, priv->callbacks.user_data); - } - - // If we make room in the send queue, notify the user - // The goal it to make sure we always have at least enough data to fill the - // window. We'd like to notify the app when we are halfway to that point. - kIdealRefillSize = (sizeof(priv->sbuf) + sizeof(priv->rbuf)) / 2; - if (priv->bWriteEnable && (priv->slen < kIdealRefillSize)) { - priv->bWriteEnable = FALSE; - if (priv->callbacks.PseudoTcpWritable) - priv->callbacks.PseudoTcpWritable(self, priv->callbacks.user_data); - } } else if (seg->ack == priv->snd_una) { /* !?! Note, tcp says don't do this... but otherwise how does a closed window become open? */ - priv->snd_wnd = seg->wnd; + priv->snd_wnd = seg->wnd << priv->swnd_scale; // Check duplicate acks if (seg->len > 0) { @@ -1052,7 +1375,7 @@ if (priv->dup_acks == 3) { // (Fast Retransmit) DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "enter recovery"); DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "recovery retransmit"); - if (!transmit(self, priv->slist, now)) { + if (!transmit(self, g_queue_peek_head (&priv->slist), now)) { closedown(self, ECONNABORTED); return FALSE; } @@ -1069,6 +1392,27 @@ } } + // !?! A bit hacky + if ((priv->state == TCP_SYN_RECEIVED) && !bConnect) { + priv->state = TCP_ESTABLISHED; + DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "State: TCP_ESTABLISHED"); + adjustMTU(self); + if (priv->callbacks.PseudoTcpOpened) + priv->callbacks.PseudoTcpOpened(self, priv->callbacks.user_data); + } + + // If we make room in the send queue, notify the user + // The goal it to make sure we always have at least enough data to fill the + // window. We'd like to notify the app when we are halfway to that point. + kIdealRefillSize = (priv->sbuf_len + priv->rbuf_len) / 2; + + snd_buffered = pseudo_tcp_fifo_get_buffered (&priv->sbuf); + if (priv->bWriteEnable && snd_buffered < kIdealRefillSize) { + priv->bWriteEnable = FALSE; + if (priv->callbacks.PseudoTcpWritable) + priv->callbacks.PseudoTcpWritable(self, priv->callbacks.user_data); + } + /* Conditions where acks must be sent: * 1) Segment is too old (they missed an ACK) (immediately) * 2) Segment is too new (we missed a segment) (immediately) @@ -1080,18 +1424,22 @@ if (seg->seq != priv->rcv_nxt) { sflags = sfImmediateAck; // (Fast Recovery) } else if (seg->len != 0) { - sflags = sfDelayedAck; + if (priv->ack_delay == 0) { + sflags = sfImmediateAck; + } else { + sflags = sfDelayedAck; + } } if (sflags == sfImmediateAck) { if (seg->seq > priv->rcv_nxt) { DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "too new"); - } else if (seg->seq + seg->len <= priv->rcv_nxt) { + } else if (SMALLER_OR_EQUAL(seg->seq + seg->len, priv->rcv_nxt)) { DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "too old"); } } // Adjust the incoming segment to fit our receive buffer - if (seg->seq < priv->rcv_nxt) { + if (SMALLER(seg->seq, priv->rcv_nxt)) { guint32 nAdjust = priv->rcv_nxt - seg->seq; if (nAdjust < seg->len) { seg->seq += nAdjust; @@ -1101,10 +1449,11 @@ seg->len = 0; } } - if ((seg->seq + seg->len - priv->rcv_nxt) > - (sizeof(priv->rbuf) - priv->rlen)) { - guint32 nAdjust = seg->seq + seg->len - priv->rcv_nxt - - (sizeof(priv->rbuf) - priv->rlen); + + available_space = pseudo_tcp_fifo_get_write_remaining (&priv->rbuf); + + if ((seg->seq + seg->len - priv->rcv_nxt) > available_space) { + guint32 nAdjust = seg->seq + seg->len - priv->rcv_nxt - available_space; if (nAdjust < seg->len) { seg->len -= nAdjust; } else { @@ -1122,24 +1471,30 @@ } } else { guint32 nOffset = seg->seq - priv->rcv_nxt; - memcpy(priv->rbuf + priv->rlen + nOffset, seg->data, seg->len); + gsize res; + + res = pseudo_tcp_fifo_write_offset (&priv->rbuf, (guint8 *) seg->data, + seg->len, nOffset); + g_assert (res == seg->len); + if (seg->seq == priv->rcv_nxt) { GList *iter = NULL; - priv->rlen += seg->len; + pseudo_tcp_fifo_consume_write_buffer (&priv->rbuf, seg->len); priv->rcv_nxt += seg->len; priv->rcv_wnd -= seg->len; bNewData = TRUE; iter = priv->rlist; - while (iter && (((RSegment *)iter->data)->seq <= priv->rcv_nxt)) { + while (iter && + SMALLER_OR_EQUAL(((RSegment *)iter->data)->seq, priv->rcv_nxt)) { RSegment *data = (RSegment *)(iter->data); - if (data->seq + data->len > priv->rcv_nxt) { + if (LARGER (data->seq + data->len, priv->rcv_nxt)) { guint32 nAdjust = (data->seq + data->len) - priv->rcv_nxt; sflags = sfImmediateAck; // (Fast Recovery) DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "Recovered %d bytes (%d -> %d)", nAdjust, priv->rcv_nxt, priv->rcv_nxt + nAdjust); - priv->rlen += nAdjust; + pseudo_tcp_fifo_consume_write_buffer (&priv->rbuf, nAdjust); priv->rcv_nxt += nAdjust; priv->rcv_wnd -= nAdjust; } @@ -1156,7 +1511,7 @@ rseg->seq = seg->seq; rseg->len = seg->len; iter = priv->rlist; - while (iter && (((RSegment*)iter->data)->seq < rseg->seq)) { + while (iter && SMALLER (((RSegment*)iter->data)->seq, rseg->seq)) { iter = g_list_next (iter); } priv->rlist = g_list_insert_before(priv->rlist, iter, rseg); @@ -1168,7 +1523,10 @@ // If we have new data, notify the user if (bNewData && priv->bReadEnable) { - priv->bReadEnable = FALSE; + /* priv->bReadEnable = FALSE; — removed so that we’re always notified of + * incoming pseudo-TCP data, rather than having to read the entire buffer + * on each readable() callback before the next callback is enabled. + * (When client-provided buffers are small, this is not possible.) */ if (priv->callbacks.PseudoTcpReadable) priv->callbacks.PseudoTcpReadable(self, priv->callbacks.user_data); } @@ -1177,10 +1535,9 @@ } static gboolean -transmit(PseudoTcpSocket *self, const GList *seg, guint32 now) +transmit(PseudoTcpSocket *self, SSegment *segment, guint32 now) { PseudoTcpSocketPrivate *priv = self->priv; - SSegment *segment = (SSegment*)(seg->data); guint32 nTransmit = min(segment->len, priv->mss); if (segment->xmit >= ((priv->state == TCP_ESTABLISHED) ? 15 : 30)) { @@ -1191,8 +1548,14 @@ while (TRUE) { guint32 seq = segment->seq; guint8 flags = (segment->bCtrl ? FLAG_CTL : 0); - const gchar * buffer = priv->sbuf + (segment->seq - priv->snd_una); - PseudoTcpWriteResult wres = packet(self, seq, flags, buffer, nTransmit); + PseudoTcpWriteResult wres; + + /* The packet must not have already been acknowledged. */ + g_assert_cmpuint (segment->seq, >=, priv->snd_una); + + /* Write out the packet. */ + wres = packet(self, seq, flags, + segment->seq - priv->snd_una, nTransmit, now); if (wres == WR_SUCCESS) break; @@ -1234,10 +1597,16 @@ DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "mss reduced to %d", priv->mss); segment->len = nTransmit; - priv->slist = g_list_insert_before(priv->slist, seg->next, subseg); + g_queue_insert_after (&priv->slist, + g_queue_find (&priv->slist, segment), subseg); + if (subseg->xmit == 0) + g_queue_insert_after (&priv->unsent_slist, + g_queue_find (&priv->unsent_slist, segment), subseg); } if (segment->xmit == 0) { + g_assert (g_queue_peek_head (&priv->unsent_slist) == segment); + g_queue_pop_head (&priv->unsent_slist); priv->snd_nxt += segment->len; } segment->xmit += 1; @@ -1267,7 +1636,9 @@ guint32 nInFlight; guint32 nUseable; guint32 nAvailable; + gsize snd_buffered; GList *iter; + SSegment *sseg; cwnd = priv->cwnd; if ((priv->dup_acks == 1) || (priv->dup_acks == 2)) { // Limited Transmit @@ -1276,7 +1647,8 @@ nWindow = min(priv->snd_wnd, cwnd); nInFlight = priv->snd_nxt - priv->snd_una; nUseable = (nInFlight < nWindow) ? (nWindow - nInFlight) : 0; - nAvailable = min(priv->slen - nInFlight, priv->mss); + snd_buffered = pseudo_tcp_fifo_get_buffered (&priv->sbuf); + nAvailable = min(snd_buffered - nInFlight, priv->mss); if (nAvailable > nUseable) { if (nUseable * 4 < nWindow) { @@ -1288,12 +1660,13 @@ } if (bFirst) { + gsize available_space = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf); bFirst = FALSE; DEBUG (PSEUDO_TCP_DEBUG_VERBOSE, "[cwnd: %d nWindow: %d nInFlight: %d " - "nAvailable: %d nQueued: %d nEmpty: %" G_GSIZE_FORMAT + "nAvailable: %d nQueued: %" G_GSIZE_FORMAT " nEmpty: %" G_GSIZE_FORMAT " ssthresh: %d]", - priv->cwnd, nWindow, nInFlight, nAvailable, priv->slen - nInFlight, - sizeof(priv->sbuf) - priv->slen, priv->ssthresh); + priv->cwnd, nWindow, nInFlight, nAvailable, snd_buffered, + available_space, priv->ssthresh); } if (nAvailable == 0) { @@ -1302,37 +1675,40 @@ // If this is an immediate ack, or the second delayed ack if ((sflags == sfImmediateAck) || priv->t_ack) { - packet(self, priv->snd_nxt, 0, 0, 0); + packet(self, priv->snd_nxt, 0, 0, 0, now); } else { - priv->t_ack = get_current_time(); + priv->t_ack = now; } return; } // Nagle algorithm - if ((priv->snd_nxt > priv->snd_una) && (nAvailable < priv->mss)) { + // If there is data already in-flight, and we haven't a full segment of + // data ready to send then hold off until we get more to send, or the + // in-flight data is acknowledged. + if (priv->use_nagling && (priv->snd_nxt > priv->snd_una) && + (nAvailable < priv->mss)) { return; } // Find the next segment to transmit - iter = priv->slist; - while (((SSegment*)iter->data)->xmit > 0) { - iter = g_list_next (iter); - g_assert(iter); - } + iter = g_queue_peek_head_link (&priv->unsent_slist); + sseg = iter->data; // If the segment is too large, break it into two - if (((SSegment*)iter->data)->len > nAvailable) { + if (sseg->len > nAvailable) { SSegment *subseg = g_slice_new0 (SSegment); - subseg->seq = ((SSegment*)iter->data)->seq + nAvailable; - subseg->len = ((SSegment*)iter->data)->len - nAvailable; - subseg->bCtrl = ((SSegment*)iter->data)->bCtrl; + subseg->seq = sseg->seq + nAvailable; + subseg->len = sseg->len - nAvailable; + subseg->bCtrl = sseg->bCtrl; - ((SSegment*)iter->data)->len = nAvailable; - priv->slist = g_list_insert_before(priv->slist, iter->next, subseg); + sseg->len = nAvailable; + g_queue_insert_after (&priv->unsent_slist, iter, subseg); + g_queue_insert_after (&priv->slist, g_queue_find (&priv->slist, sseg), + subseg); } - if (!transmit(self, iter, now)) { + if (!transmit(self, sseg, now)) { DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "transmit failed"); // TODO: consider closing socket return; @@ -1346,7 +1722,6 @@ closedown(PseudoTcpSocket *self, guint32 err) { PseudoTcpSocketPrivate *priv = self->priv; - priv->slen = 0; DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "State: TCP_CLOSED"); priv->state = TCP_CLOSED; @@ -1374,3 +1749,172 @@ priv->ssthresh = max(priv->ssthresh, 2 * priv->mss); priv->cwnd = max(priv->cwnd, priv->mss); } + +static void +apply_window_scale_option (PseudoTcpSocket *self, guint8 scale_factor) +{ + PseudoTcpSocketPrivate *priv = self->priv; + + priv->swnd_scale = scale_factor; +} + +static void +apply_option(PseudoTcpSocket *self, char kind, const guint8* data, guint32 len) +{ + if (kind == TCP_OPT_MSS) { + DEBUG (PSEUDO_TCP_DEBUG_NORMAL, + "Peer specified MSS option which is not supported."); + // TODO: Implement. + } else if (kind == TCP_OPT_WND_SCALE) { + // Window scale factor. + // http://www.ietf.org/rfc/rfc1323.txt + if (len != 1) { + DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "Invalid window scale option received."); + return; + } + apply_window_scale_option(self, data[0]); + } +} + + +static void +parse_options (PseudoTcpSocket *self, const guint8 *data, guint32 len) +{ + PseudoTcpSocketPrivate *priv = self->priv; + gboolean has_window_scaling_option = FALSE; + guint32 pos = 0; + + // See http://www.freesoft.org/CIE/Course/Section4/8.htm for + // parsing the options list. + while (pos < len) { + guint8 kind = TCP_OPT_EOL; + guint8 opt_len; + + if (len < pos + 1) + return; + + kind = data[pos]; + pos++; + + if (kind == TCP_OPT_EOL) { + // End of option list. + break; + } else if (kind == TCP_OPT_NOOP) { + // No op. + continue; + } + + if (len < pos + 1) + return; + + // Length of this option. + opt_len = data[pos]; + pos++; + + if (len < pos + opt_len) + return; + + // Content of this option. + if (opt_len <= len - pos) { + apply_option (self, kind, data + pos, opt_len); + pos += opt_len; + } else { + DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "Invalid option length received."); + return; + } + + if (kind == TCP_OPT_WND_SCALE) + has_window_scaling_option = TRUE; + } + + if (!has_window_scaling_option) { + DEBUG (PSEUDO_TCP_DEBUG_NORMAL, "Peer doesn't support window scaling"); + if (priv->rwnd_scale > 0) { + // Peer doesn't support TCP options and window scaling. + // Revert receive buffer size to default value. + resize_receive_buffer (self, DEFAULT_RCV_BUF_SIZE); + priv->swnd_scale = 0; + } + } +} + +static void +resize_send_buffer (PseudoTcpSocket *self, guint32 new_size) +{ + PseudoTcpSocketPrivate *priv = self->priv; + + priv->sbuf_len = new_size; + pseudo_tcp_fifo_set_capacity (&priv->sbuf, new_size); +} + + +static void +resize_receive_buffer (PseudoTcpSocket *self, guint32 new_size) +{ + PseudoTcpSocketPrivate *priv = self->priv; + guint8 scale_factor = 0; + gboolean result; + gsize available_space; + + if (priv->rbuf_len == new_size) + return; + + // Determine the scale factor such that the scaled window size can fit + // in a 16-bit unsigned integer. + while (new_size > 0xFFFF) { + ++scale_factor; + new_size >>= 1; + } + + // Determine the proper size of the buffer. + new_size <<= scale_factor; + result = pseudo_tcp_fifo_set_capacity (&priv->rbuf, new_size); + + // Make sure the new buffer is large enough to contain data in the old + // buffer. This should always be true because this method is called either + // before connection is established or when peers are exchanging connect + // messages. + g_assert(result); + priv->rbuf_len = new_size; + priv->rwnd_scale = scale_factor; + priv->ssthresh = new_size; + + available_space = pseudo_tcp_fifo_get_write_remaining (&priv->rbuf); + priv->rcv_wnd = available_space; +} + +gint +pseudo_tcp_socket_get_available_bytes (PseudoTcpSocket *self) +{ + PseudoTcpSocketPrivate *priv = self->priv; + + if (priv->state != TCP_ESTABLISHED) { + return -1; + } + + return pseudo_tcp_fifo_get_buffered (&priv->rbuf); +} + +gboolean +pseudo_tcp_socket_can_send (PseudoTcpSocket *self) +{ + return (pseudo_tcp_socket_get_available_send_space (self) > 0); +} + +gsize +pseudo_tcp_socket_get_available_send_space (PseudoTcpSocket *self) +{ + PseudoTcpSocketPrivate *priv = self->priv; + gsize ret; + + + if (priv->state == TCP_ESTABLISHED) + ret = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf); + else + ret = 0; + + if (ret == 0) + priv->bWriteEnable = TRUE; + + return ret; +} diff -Nru libnice-0.1.4/agent/pseudotcp.h libnice-0.1.7/agent/pseudotcp.h --- libnice-0.1.4/agent/pseudotcp.h 2012-02-15 20:58:39.000000000 +0000 +++ libnice-0.1.7/agent/pseudotcp.h 2014-03-31 21:07:05.000000000 +0000 @@ -66,6 +66,8 @@ # define ECONNRESET WSAECONNRESET #endif +#include "agent.h" + G_BEGIN_DECLS /** @@ -355,7 +357,8 @@ * * Since: 0.0.11 */ -gboolean pseudo_tcp_socket_get_next_clock(PseudoTcpSocket *self, long *timeout); +gboolean pseudo_tcp_socket_get_next_clock(PseudoTcpSocket *self, + guint64 *timeout); /** @@ -403,6 +406,22 @@ /** + * pseudo_tcp_socket_notify_message: + * @self: The #PseudoTcpSocket object. + * @message: A #NiceInputMessage containing the received data. + * + * Notify the #PseudoTcpSocket that a new message has arrived, and enqueue the + * data in its buffers to the #PseudoTcpSocket’s receive buffer. + * + * Returns: %TRUE if the packet was processed successfully, %FALSE otherwise + * + * Since: 0.1.5 + */ +gboolean pseudo_tcp_socket_notify_message (PseudoTcpSocket *self, + NiceInputMessage *message); + + +/** * pseudo_tcp_set_debug_level: * @level: The level of debug to set * @@ -412,6 +431,46 @@ */ void pseudo_tcp_set_debug_level (PseudoTcpDebugLevel level); + +/** + * pseudo_tcp_socket_get_available_bytes: + * @self: The #PseudoTcpSocket object. + * + * Gets the number of bytes of data in the buffer that can be read without + * receiving more packets from the network. + * + * Returns: The number of bytes or -1 if the connection is not established + * + * Since: 0.1.5 + */ + +gint pseudo_tcp_socket_get_available_bytes (PseudoTcpSocket *self); + +/** + * pseudo_tcp_socket_can_send: + * @self: The #PseudoTcpSocket object. + * + * Returns if there is space in the send buffer to send any data. + * + * Returns: %TRUE if data can be sent, %FALSE otherwise + * + * Since: 0.1.5 + */ + +gboolean pseudo_tcp_socket_can_send (PseudoTcpSocket *self); + +/** + * pseudo_tcp_socket_get_available_send_space: + * @self: The #PseudoTcpSocket object. + * + * Gets the number of bytes of space available in the transmission buffer. + * + * Returns: The numbero f bytes, or 0 if the connection is not established. + * + * Since: 0.1.5 + */ +gsize pseudo_tcp_socket_get_available_send_space (PseudoTcpSocket *self); + G_END_DECLS #endif /* _PSEUDOTCP_H */ diff -Nru libnice-0.1.4/agent/stream.c libnice-0.1.7/agent/stream.c --- libnice-0.1.4/agent/stream.c 2013-02-05 02:47:35.000000000 +0000 +++ libnice-0.1.7/agent/stream.c 2014-04-25 01:09:45.000000000 +0000 @@ -48,7 +48,7 @@ * @brief ICE stream functionality */ Stream * -stream_new (guint n_components) +stream_new (guint n_components, NiceAgent *agent) { Stream *stream; guint n; @@ -56,7 +56,7 @@ stream = g_slice_new0 (Stream); for (n = 0; n < n_components; n++) { - component = component_new (n + 1); + component = component_new (n + 1, agent, stream); stream->components = g_slist_append (stream->components, component); } @@ -132,22 +132,22 @@ * Resets the stream state to that of a ICE restarted * session. */ -gboolean -stream_restart (Stream *stream, NiceRNG *rng) +void +stream_restart (NiceAgent *agent, Stream *stream) { GSList *i; - gboolean res = TRUE; + + /* step: clean up all connectivity checks */ + conn_check_prune_stream (agent, stream); stream->initial_binding_request_received = FALSE; - stream_initialize_credentials (stream, rng); + stream_initialize_credentials (stream, agent->rng); - for (i = stream->components; i && res; i = i->next) { + for (i = stream->components; i; i = i->next) { Component *component = i->data; - - res = component_restart (component); + + component_restart (component); } - - return res; } diff -Nru libnice-0.1.4/agent/stream.h libnice-0.1.7/agent/stream.h --- libnice-0.1.4/agent/stream.h 2013-02-05 02:35:26.000000000 +0000 +++ libnice-0.1.7/agent/stream.h 2014-04-25 01:09:45.000000000 +0000 @@ -72,12 +72,13 @@ gchar remote_ufrag[NICE_STREAM_MAX_UFRAG]; gchar remote_password[NICE_STREAM_MAX_PWD]; gboolean gathering; + gboolean gathering_started; gint tos; }; Stream * -stream_new (guint n_components); +stream_new (guint n_components, NiceAgent *agent); void stream_free (Stream *stream); @@ -91,8 +92,8 @@ void stream_initialize_credentials (Stream *stream, NiceRNG *rng); -gboolean -stream_restart (Stream *stream, NiceRNG *rng); +void +stream_restart (NiceAgent *agent, Stream *stream); G_END_DECLS diff -Nru libnice-0.1.4/ar-lib libnice-0.1.7/ar-lib --- libnice-0.1.4/ar-lib 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/ar-lib 2013-08-05 10:10:38.000000000 +0000 @@ -0,0 +1,270 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2012-03-01.08; # UTC + +# Copyright (C) 2010-2013 Free Software Foundation, Inc. +# Written by Peter Rosin . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try '$0 --help' for more information." + ;; + -h | --h*) + cat </dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -220,21 +244,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -336,6 +364,14 @@ } # 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 @@ -457,6 +493,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -491,16 +531,16 @@ # ... 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 @@ -512,28 +552,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -567,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='libnice' PACKAGE_TARNAME='libnice' -PACKAGE_VERSION='0.1.4' -PACKAGE_STRING='libnice 0.1.4' +PACKAGE_VERSION='0.1.7' +PACKAGE_STRING='libnice 0.1.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -659,8 +679,6 @@ DSYMUTIL MANIFEST_TOOL RANLIB -ac_ct_AR -AR DLLTOOL OBJDUMP LN_S @@ -671,6 +689,8 @@ FGREP SED LIBTOOL +ac_ct_AR +AR EGREP GREP CPP @@ -691,11 +711,11 @@ LDFLAGS CFLAGS CC +LIBNICE_LT_LDFLAGS AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V -LIBNICE_LT_LDFLAGS am__untar am__tar AMTAR @@ -782,6 +802,7 @@ with_sysroot enable_libtool_lock enable_assert +enable_compile_warnings with_gstreamer with_gstreamer_0_10 enable_gupnp @@ -1268,8 +1289,6 @@ 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 @@ -1355,7 +1374,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libnice 0.1.4 to adapt to many kinds of systems. +\`configure' configures libnice 0.1.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1426,7 +1445,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libnice 0.1.4:";; + short | recursive ) echo "Configuration of libnice 0.1.7:";; esac cat <<\_ACEOF @@ -1434,16 +1453,20 @@ --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: `make V=1') - --disable-silent-rules verbose build output (undo: `make V=0') - --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 --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-assert turn off assertions + --enable-compile-warnings=[no/minimum/yes/maximum/error] + Enable different levels of compiler warnings --disable-gupnp Disable GUPnP IGD support --enable-coverage build for test coverage (default disabled) --enable-gtk-doc use gtk-doc to build documentation [[default=no]] @@ -1557,10 +1580,10 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libnice configure 0.1.4 -generated by GNU Autoconf 2.68 +libnice configure 0.1.7 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1833,7 +1856,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1976,8 +1999,8 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libnice $as_me 0.1.4, which was -generated by GNU Autoconf 2.68. Invocation command line was +It was created by libnice $as_me 0.1.7, which was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2467,10 +2490,9 @@ program_prefix=${target_alias}- - ac_config_headers="$ac_config_headers config.h" -am__api_version='1.11' +am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2509,7 +2531,7 @@ # 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. @@ -2567,9 +2589,6 @@ { $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=' @@ -2580,32 +2599,40 @@ esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; + 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_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - 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 @@ -2617,6 +2644,16 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -2639,12 +2676,12 @@ 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:${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;} + { $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 @@ -2656,10 +2693,10 @@ 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. @@ -2678,7 +2715,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2718,7 +2755,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2769,7 +2806,7 @@ test -z "$as_dir" && as_dir=. 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) '* | \ @@ -2798,12 +2835,6 @@ { $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. @@ -2822,7 +2853,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2886,6 +2917,45 @@ 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." @@ -2908,7 +2978,7 @@ # Define the identity of the package. PACKAGE='libnice' - VERSION='0.1.4' + VERSION='0.1.7' cat >>confdefs.h <<_ACEOF @@ -2936,12 +3006,22 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + # We need awk for the "check" target. 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 -' @@ -2949,6 +3029,7 @@ + ac_config_files="$ac_config_files Makefile agent/Makefile stun/Makefile stun/tests/Makefile stun/tools/Makefile socket/Makefile nice/Makefile nice/nice.pc random/Makefile gst/Makefile docs/Makefile docs/reference/Makefile docs/reference/libnice/Makefile tests/Makefile examples/Makefile" @@ -2959,9 +3040,9 @@ # Increment CURRENT and AGE. Set REVISION to 0 # If there was an incompatible interface change: # Increment CURRENT. Set AGE and REVISION to 0 -LIBNICE_CURRENT=12 -LIBNICE_REVISION=0 -LIBNICE_AGE=2 +LIBNICE_CURRENT=14 +LIBNICE_REVISION=1 +LIBNICE_AGE=4 LIBNICE_LIBVERSION=${LIBNICE_CURRENT}:${LIBNICE_REVISION}:${LIBNICE_AGE} LIBNICE_LT_LDFLAGS="-version-info ${LIBNICE_LIBVERSION} -no-undefined" @@ -2972,10 +3053,10 @@ enableval=$enable_silent_rules; fi -case $enable_silent_rules in -yes) AM_DEFAULT_VERBOSITY=0;; -no) AM_DEFAULT_VERBOSITY=1;; -*) AM_DEFAULT_VERBOSITY=0;; +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 @@ -3010,6 +3091,69 @@ # Checks for programs. +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3032,7 +3176,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3072,7 +3216,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3125,7 +3269,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3166,7 +3310,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3224,7 +3368,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3268,7 +3412,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3714,8 +3858,7 @@ /* 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); @@ -3799,69 +3942,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - depcc="$CC" am_compiler_list= @@ -3874,8 +3954,8 @@ # 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 @@ -3910,16 +3990,16 @@ : > 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 @@ -3928,8 +4008,8 @@ 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 @@ -3937,7 +4017,7 @@ fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has + # 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} @@ -4146,7 +4226,7 @@ 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 @@ -4212,7 +4292,7 @@ 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 @@ -4419,8 +4499,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# define __EXTENSIONS__ 1 - $ac_includes_default +# define __EXTENSIONS__ 1 + $ac_includes_default int main () { @@ -4450,450 +4530,213 @@ $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4.2' -macro_revision='1.3337' - - - - - - - - - - - +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -ltmain="$ac_aux_dir/ltmain.sh" -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - ac_cv_path_SED=$SED + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done done IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + fi fi -if ${lt_cv_path_LD+:} false; then : +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi fi fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -4901,8 +4744,8 @@ 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 - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4912,32 +4755,32 @@ fi fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$DUMPBIN" && break + test -n "$CC" && break done fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -4945,8 +4788,8 @@ 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 - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -4956,21 +4799,21 @@ fi fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$ac_ct_DUMPBIN" && break + test -n "$ac_ct_CC" && break done - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" + if test "x$ac_ct_CC" = x; then + CC="" else case $cross_compiling:$ac_tool_warned in yes:) @@ -4978,390 +4821,394 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - DUMPBIN=$ac_ct_DUMPBIN + CC=$ac_ct_CC fi fi - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi fi -test -z "$NM" && NM=nm +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ +#ifndef __GNUC__ + choke me +#endif -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* + ac_compiler_gnu=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } + GCC= fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; +int +main () +{ - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; +int +main () +{ - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi else - lt_unset=false + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +depcc="$CC" am_compiler_list= - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; esac - ;; -esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none fi -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' else - lt_cv_ld_reload_flag='-r' + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 + 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_OBJDUMP+:} false; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5369,8 +5216,8 @@ 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 - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + 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 @@ -5380,28 +5227,32 @@ fi fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + test -n "$AR" && break + done fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 +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_OBJDUMP+:} false; then : +if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. + 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 @@ -5409,8 +5260,8 @@ 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 - ac_cv_prog_ac_ct_OBJDUMP="objdump" + 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 @@ -5420,17 +5271,21 @@ fi fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5438,252 +5293,150 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - OBJDUMP=$ac_ct_OBJDUMP + AR=$ac_ct_AR fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 else - OBJDUMP="$ac_cv_prog_OBJDUMP" + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -test -z "$OBJDUMP" && OBJDUMP=objdump +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 +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac +macro_version='2.4.2' +macro_revision='1.3337' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; -beos*) - lt_cv_deplibs_check_method=pass_all - ;; -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; +ltmain="$ac_aux_dir/ltmain.sh" -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' fi -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac @@ -5698,100 +5451,156 @@ -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break done -IFS=$as_save_IFS + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_path_SED=$SED fi - fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break done -IFS=$as_save_IFS + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_path_FGREP=$FGREP fi - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" -test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$GREP" && GREP=grep @@ -5801,37 +5610,8 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO @@ -5839,110 +5619,109 @@ -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + with_gnu_ld=no fi - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$ac_ct_AR" >&6; } + +LD="$lt_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld @@ -5952,74 +5731,76 @@ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac fi - rm -f conftest.* libconftest.a - + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6027,8 +5808,8 @@ 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 - ac_cv_prog_STRIP="${ac_tool_prefix}strip" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6038,28 +5819,32 @@ fi fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + test -n "$DUMPBIN" && break + done fi -if test -z "$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 +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6067,8 +5852,8 @@ 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 - ac_cv_prog_ac_ct_STRIP="strip" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6078,17 +5863,21 @@ fi fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_STRIP" = x; then - STRIP=":" + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -6096,168 +5885,259 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - STRIP=$ac_ct_STRIP + DUMPBIN=$ac_ct_DUMPBIN fi -else - STRIP="$ac_cv_prog_STRIP" fi -test -z "$STRIP" && STRIP=: + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" fi -done - done -IFS=$as_save_IFS - -fi + rm -f conftest* fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } fi - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi + i=0 + teststring="ABCD" - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; -test -z "$RANLIB" && RANLIB=: + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +fi +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac @@ -6267,268 +6147,211 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +fi +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} -# Allow CC to be a program name with arguments. -compiler=$CC -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] +fi -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -# Define system-specific variables. + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; esac -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi done + done +IFS=$as_save_IFS fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" fi +test -z "$OBJDUMP" && OBJDUMP=objdump @@ -6538,276 +6361,260 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; +beos*) + lt_cv_deplibs_check_method=pass_all + ;; +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* +tpf*) + lt_cv_deplibs_check_method=pass_all ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi - fi - rm -rf conftest* - ;; + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac -need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : +if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6815,8 +6622,8 @@ 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 - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6826,10 +6633,10 @@ fi fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -6837,17 +6644,17 @@ fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6855,8 +6662,8 @@ 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 - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6866,17 +6673,17 @@ fi fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -6884,50 +6691,73 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + DLLTOOL=$ac_ct_DLLTOOL fi else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" + DLLTOOL="$ac_cv_prog_DLLTOOL" fi -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -6935,8 +6765,8 @@ 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 - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + 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 @@ -6946,28 +6776,32 @@ fi fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + test -n "$AR" && break + done fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : +if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. + 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 @@ -6975,8 +6809,8 @@ 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 - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + 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 @@ -6986,17 +6820,21 @@ fi fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" else case $cross_compiling:$ac_tool_warned in yes:) @@ -7004,22 +6842,91 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - DSYMUTIL=$ac_ct_DSYMUTIL + AR=$ac_ct_AR fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -7027,8 +6934,8 @@ 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 - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -7038,10 +6945,10 @@ fi fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -7049,17 +6956,17 @@ fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -7067,8 +6974,8 @@ 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 - ac_cv_prog_ac_ct_NMEDIT="nmedit" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -7078,17 +6985,17 @@ fi fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" + if test "x$ac_ct_STRIP" = x; then + STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -7096,22 +7003,29 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - NMEDIT=$ac_ct_NMEDIT + STRIP=$ac_ct_STRIP fi else - NMEDIT="$ac_cv_prog_NMEDIT" + STRIP="$ac_cv_prog_STRIP" fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -7119,8 +7033,8 @@ 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 - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -7130,10 +7044,10 @@ fi fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -7141,17 +7055,17 @@ fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -7159,8 +7073,8 @@ 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 - ac_cv_prog_ac_ct_LIPO="lipo" + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -7170,17 +7084,17 @@ fi fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_LIPO" = x; then - LIPO=":" + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -7188,195 +7102,48 @@ $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - LIPO=$ac_ct_LIPO + RANLIB=$ac_ct_RANLIB fi else - LIPO="$ac_cv_prog_LIPO" + RANLIB="$ac_cv_prog_RANLIB" fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +test -z "$RANLIB" && RANLIB=: -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi @@ -7404,320 +7171,270 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&5 - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&5 - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] -fi +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' -done +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" -# Set options +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" - enable_dlopen=no + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + # Check to see that the pipe works correctly. + pipe_works=no - enable_win32_dll=no + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif +#ifdef __cplusplus +extern "C" { +#endif +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + cat <<_LT_EOF >> conftest.$ac_ext +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - pic_mode=default fi - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } else - enable_fast_install=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } fi - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi @@ -7731,7 +7448,6 @@ -test -z "$LN_S" && LN_S="ln -s" @@ -7746,718 +7462,3443 @@ -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null + with_sysroot=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac fi + rm -rf conftest* ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + fi + rm -rf conftest* ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org -_LT_EOF - fi ;; +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac fi + rm -rf conftest* ;; -esac - -# Use C for the default configuration in the libtool script -lt_save_CC="$CC" -ac_ext=c +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC +int +main () +{ -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac +need_locks="$enable_libtool_lock" -if test -n "$compiler"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -lt_prog_compiler_no_builtin_flag= +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else - : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - if test -n "$lt_prog_compiler_pic"; then - lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" - fi - ;; - esac + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ F* | *Sun*Fortran*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Intel*\ [CF]*Compiler*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - *Portland\ Group*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - esac - ;; - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi -fi @@ -8469,46 +10910,8 @@ -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi @@ -8516,630 +10919,545 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - ld_shlibs=yes - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. -_LT_EOF - fi - ;; - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : else - ld_shlibs=no + can_build_shared=no fi ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else - ld_shlibs=no + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` else - # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9151,664 +11469,272 @@ } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir fi - aix_libpath=$lt_cv_aix_libpath_ -fi + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes -int -main () -{ + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" fi -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no ;; *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes + shlibpath_overrides_runpath=yes ;; esac - ;; + else + shlibpath_overrides_runpath=yes + fi + ;; - darwin* | rhapsody*) +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' +rdos*) + dynamic_linker=no + ;; - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; - else - ld_shlibs=no +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no fi + need_version=yes + ;; +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no + siemens) + need_lib_prefix=no ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; + esac + ;; - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - *nto* | *qnx*) - ;; - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - *) - ld_shlibs=no - ;; - esac - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no -with_gnu_ld=$with_gnu_ld @@ -9824,74 +11750,9 @@ -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac @@ -9940,42 +11801,552 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi +fi +fi +fi + ;; + esac + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" +#if HAVE_DLFCN_H +#include +#endif +#include +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" +#if HAVE_DLFCN_H +#include +#endif +#include +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi @@ -9993,6 +12364,35 @@ +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi @@ -10005,15 +12405,54 @@ + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +CC="$lt_save_CC" @@ -10029,522 +12468,314 @@ + ac_config_commands="$ac_config_commands libtool" +# Only expand once: +# Check Operating System +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking operating system" >&5 +$as_echo_n "checking operating system... " >&6; } +case "$host" in + *-*-*mingw*|*-*-*cygwin*) + platform=win32 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform" >&5 +$as_echo "$platform" >&6; } + ;; + *) + platform=linux/other + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform" >&5 +$as_echo "$platform" >&6; } + ;; +esac + if test "$platform" = "win32"; then + WINDOWS_TRUE= + WINDOWS_FALSE='#' +else + WINDOWS_TRUE='#' + WINDOWS_FALSE= +fi +# Checks for compiler features +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 +$as_echo_n "checking for C/C++ restrict keyword... " >&6; } +if ${ac_cv_c_restrict+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_restrict=no + # The order here caters to the fact that C++ does not require restrict. + for ac_kw in __restrict __restrict__ _Restrict restrict; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int * int_ptr; + int foo (int_ptr $ac_kw ip) { + return ip[0]; + } +int +main () +{ +int s[1]; + int * $ac_kw t = s; + t[0] = 0; + return foo(t) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_restrict=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 +$as_echo "$ac_cv_c_restrict" >&6; } + case $ac_cv_c_restrict in + restrict) ;; + no) $as_echo "#define restrict /**/" >>confdefs.h + ;; + *) cat >>confdefs.h <<_ACEOF +#define restrict $ac_cv_c_restrict +_ACEOF + ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for variable-length arrays" >&5 +$as_echo_n "checking for variable-length arrays... " >&6; } +if ${ac_cv_c_vararrays+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +int +main () +{ +static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0]; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_vararrays=yes else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + ac_cv_c_vararrays=no fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_vararrays" >&5 +$as_echo "$ac_cv_c_vararrays" >&6; } + if test $ac_cv_c_vararrays = yes; then - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; +$as_echo "#define HAVE_C_VARARRAYS 1" >>confdefs.h -aix[4-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; -bsdi[45]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5 +$as_echo_n "checking whether to enable assertions... " >&6; } + # Check whether --enable-assert was given. +if test "${enable_assert+set}" = set; then : + enableval=$enable_assert; ac_enable_assert=$enableval + if test "x$enableval" = xno; then : -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no +$as_echo "#define NDEBUG 1" >>confdefs.h - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes +elif test "x$enableval" != xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-assert" >&5 +$as_echo "$as_me: WARNING: invalid argument supplied to --enable-assert" >&2;} + ac_enable_assert=yes +fi +else + ac_enable_assert=yes +fi - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_assert" >&5 +$as_echo "$ac_enable_assert" >&6; } - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if ${ac_cv_header_stdbool_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' + #include + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac +int +main () +{ - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; + bool e = &s; + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes; then : -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; +fi -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[23].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; +if test $ac_cv_header_stdbool_h = yes; then -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; +fi + + + +$as_echo "#define NICEAPI_EXPORT " >>confdefs.h + +for ac_header in arpa/inet.h net/in.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF -interix[3-9]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; +fi -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; +done -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; +for ac_header in ifaddrs.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "$ac_includes_default" +if test "x$ac_cv_header_ifaddrs_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_IFADDRS_H 1 +_ACEOF + \ -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no +$as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 +fi + +done + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIZE_T 1 +_ACEOF + + +fi +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSIZE_T 1 +_ACEOF + + +fi + + +# Also put matching version in LIBNICE_CFLAGS +GLIB_REQ=2.30 + +LIBNICE_CFLAGS="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_30 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36" + +# Check whether --enable-compile-warnings was given. +if test "${enable_compile_warnings+set}" = set; then : + enableval=$enable_compile_warnings; else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$LIBNICE_RELEASE" = "yes"; then : + enable_compile_warnings="yes" +else + enable_compile_warnings="error" +fi +fi + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -fno-strict-aliasing" >&5 +$as_echo_n "checking to see if compiler understands -fno-strict-aliasing... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-strict-aliasing" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -10555,1271 +12786,1434 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -fno-strict-aliasing" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + + + +if test "$enable_compile_warnings" != "no"; then : + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wall" >&5 +$as_echo_n "checking to see if compiler understands -Wall... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wall" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wall" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + + fi +if test "x$enable_compile_warnings" != "xno" -a \ + "x$enable_compile_warnings" != "xminimum"; then : - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wextra" >&5 +$as_echo_n "checking to see if compiler understands -Wextra... " >&6; } - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wextra" - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - fi +int +main () +{ - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wextra" + true else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' + + true fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wundef" >&5 +$as_echo_n "checking to see if compiler understands -Wundef... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wundef" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wundef" + true else - shlibpath_overrides_runpath=yes + + true fi - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; -rdos*) - dynamic_linker=no - ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wnested-externs" >&5 +$as_echo_n "checking to see if compiler understands -Wnested-externs... " >&6; } -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wnested-externs" -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; +int +main () +{ -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wnested-externs" + true else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wwrite-strings" >&5 +$as_echo_n "checking to see if compiler understands -Wwrite-strings... " >&6; } -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wwrite-strings" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wwrite-strings" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wpointer-arith" >&5 +$as_echo_n "checking to see if compiler understands -Wpointer-arith... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wpointer-arith" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wpointer-arith" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wmissing-declarations" >&5 +$as_echo_n "checking to see if compiler understands -Wmissing-declarations... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wmissing-declarations" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wmissing-declarations" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wmissing-prototypes" >&5 +$as_echo_n "checking to see if compiler understands -Wmissing-prototypes... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wmissing-prototypes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wmissing-prototypes" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wstrict-prototypes" >&5 +$as_echo_n "checking to see if compiler understands -Wstrict-prototypes... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wstrict-prototypes" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wstrict-prototypes" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wredundant-decls" >&5 +$as_echo_n "checking to see if compiler understands -Wredundant-decls... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wredundant-decls" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wredundant-decls" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wno-unused-parameter" >&5 +$as_echo_n "checking to see if compiler understands -Wno-unused-parameter... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wno-unused-parameter" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wno-unused-parameter" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wno-missing-field-initializers" >&5 +$as_echo_n "checking to see if compiler understands -Wno-missing-field-initializers... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wno-missing-field-initializers" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wno-missing-field-initializers" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wdeclaration-after-statement" >&5 +$as_echo_n "checking to see if compiler understands -Wdeclaration-after-statement... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wdeclaration-after-statement" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wdeclaration-after-statement" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wformat=2" >&5 +$as_echo_n "checking to see if compiler understands -Wformat=2... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wformat=2" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wformat=2" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wold-style-definition" >&5 +$as_echo_n "checking to see if compiler understands -Wold-style-definition... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wold-style-definition" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then +int +main () +{ - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless + flag_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wold-style-definition" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wcast-align" >&5 +$as_echo_n "checking to see if compiler understands -Wcast-align... " >&6; } - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wcast-align" - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); int main () { -return dlopen (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + flag_ok=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wcast-align" + true + else -fi + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } - ;; - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wformat-nonliteral" >&5 +$as_echo_n "checking to see if compiler understands -Wformat-nonliteral... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wformat-nonliteral" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); int main () { -return shl_load (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - ac_cv_lib_dld_shl_load=no + flag_ok=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wformat-nonliteral" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wformat-security" >&5 +$as_echo_n "checking to see if compiler understands -Wformat-security... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wformat-security" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); int main () { -return dlopen (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - ac_cv_lib_dl_dlopen=no + flag_ok=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wformat-security" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + + + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test "$enable_compile_warnings" = "yes" -o \ + "$enable_compile_warnings" = "maximum" -o \ + "$enable_compile_warnings" = "error"; then : + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wsign-compare" >&5 +$as_echo_n "checking to see if compiler understands -Wsign-compare... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wsign-compare" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); int main () { -return dlopen (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + flag_ok=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wsign-compare" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wstrict-aliasing" >&5 +$as_echo_n "checking to see if compiler understands -Wstrict-aliasing... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wstrict-aliasing" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); int main () { -return dld_link (); + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" + flag_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wstrict-aliasing" + true + else -fi - + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -fi -fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wshadow" >&5 +$as_echo_n "checking to see if compiler understands -Wshadow... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wshadow" -fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wshadow" + true else - enable_dlopen=no + + true fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Winline" >&5 +$as_echo_n "checking to see if compiler understands -Winline... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Winline" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" -#if HAVE_DLFCN_H -#include -#endif + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Winline" + true + else -#include + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wpacked" >&5 +$as_echo_n "checking to see if compiler understands -Wpacked... " >&6; } -int fnord () { return 42; } -int main () + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wpacked" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () { - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wpacked" + true else - puts (dlerror ()); - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no + true fi -fi -rm -fr conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wmissing-format-attribute" >&5 +$as_echo_n "checking to see if compiler understands -Wmissing-format-attribute... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wmissing-format-attribute" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" -#if HAVE_DLFCN_H -#include -#endif + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wmissing-format-attribute" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -#include -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wmissing-noreturn" >&5 +$as_echo_n "checking to see if compiler understands -Wmissing-noreturn... " >&6; } -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wmissing-noreturn" -int fnord () { return 42; } -int main () + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () { - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wmissing-noreturn" + true else - puts (dlerror ()); - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no + true fi -fi -rm -fr conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Winit-self" >&5 +$as_echo_n "checking to see if compiler understands -Winit-self... " >&6; } - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Winit-self" - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Winit-self" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wredundant-decls" >&5 +$as_echo_n "checking to see if compiler understands -Wredundant-decls... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wredundant-decls" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wredundant-decls" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wmissing-include-dirs" >&5 +$as_echo_n "checking to see if compiler understands -Wmissing-include-dirs... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wmissing-include-dirs" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac + flag_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wmissing-include-dirs" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wunused-but-set-variable" >&5 +$as_echo_n "checking to see if compiler understands -Wunused-but-set-variable... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wunused-but-set-variable" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wunused-but-set-variable" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Warray-bounds" >&5 +$as_echo_n "checking to see if compiler understands -Warray-bounds... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Warray-bounds" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no 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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" -CC="$lt_save_CC" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Warray-bounds" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } +fi +if test "$enable_compile_warnings" = "maximum" -o \ + "$enable_compile_warnings" = "error"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wswitch-enum" >&5 +$as_echo_n "checking to see if compiler understands -Wswitch-enum... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wswitch-enum" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wswitch-enum" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } - ac_config_commands="$ac_config_commands libtool" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wswitch-default" >&5 +$as_echo_n "checking to see if compiler understands -Wswitch-default... " >&6; } + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wswitch-default" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main () +{ -# Only expand once: + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + flag_ok=yes +else + flag_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Wswitch-default" + true + else + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } -# Check Operating System -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking operating system" >&5 -$as_echo_n "checking operating system... " >&6; } -case "$host" in - *-*-*mingw*|*-*-*cygwin*) - platform=win32 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform" >&5 -$as_echo "$platform" >&6; } - ;; - *) - platform=linux/other - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform" >&5 -$as_echo "$platform" >&6; } - ;; -esac - if test "$platform" = "win32"; then - WINDOWS_TRUE= - WINDOWS_FALSE='#' -else - WINDOWS_TRUE='#' - WINDOWS_FALSE= -fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Waggregate-return" >&5 +$as_echo_n "checking to see if compiler understands -Waggregate-return... " >&6; } -# Checks for compiler features + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Waggregate-return" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 -$as_echo_n "checking for C/C++ restrict keyword... " >&6; } -if ${ac_cv_c_restrict+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_restrict=no - # The order here caters to the fact that C++ does not require restrict. - for ac_kw in __restrict __restrict__ _Restrict restrict; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - } + int main () { -int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t) + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_restrict=$ac_kw + flag_ok=yes +else + flag_ok=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_restrict" != no && break - done + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Waggregate-return" + true + else + + true + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } + + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 -$as_echo "$ac_cv_c_restrict" >&6; } +if test "x$enable_compile_warnings" = "xerror"; then : - case $ac_cv_c_restrict in - restrict) ;; - no) $as_echo "#define restrict /**/" >>confdefs.h - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $ac_cv_c_restrict -_ACEOF - ;; - esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Werror" >&5 +$as_echo_n "checking to see if compiler understands -Werror... " >&6; } + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for variable-length arrays" >&5 -$as_echo_n "checking for variable-length arrays... " >&6; } -if ${ac_cv_c_vararrays+:} false; then : - $as_echo_n "(cached) " >&6 -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0]; + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_vararrays=yes + flag_ok=yes else - ac_cv_c_vararrays=no + flag_ok=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_vararrays" >&5 -$as_echo "$ac_cv_c_vararrays" >&6; } - if test $ac_cv_c_vararrays = yes; then + CFLAGS="$save_CFLAGS" -$as_echo "#define HAVE_C_VARARRAYS 1" >>confdefs.h + if test "X$flag_ok" = Xyes ; then + LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror" + true + else + true fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5 +$as_echo "$flag_ok" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5 -$as_echo_n "checking whether to enable assertions... " >&6; } - # Check whether --enable-assert was given. -if test "${enable_assert+set}" = set; then : - enableval=$enable_assert; ac_enable_assert=$enableval - if test "x$enableval" = xno; then : - -$as_echo "#define NDEBUG 1" >>confdefs.h -elif test "x$enableval" != xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-assert" >&5 -$as_echo "$as_me: WARNING: invalid argument supplied to --enable-assert" >&2;} - ac_enable_assert=yes -fi -else - ac_enable_assert=yes fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_assert" >&5 -$as_echo "$ac_enable_assert" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 -$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } -if ${ac_cv_header_stdbool_h+:} false; then : +# +# Fixes for Solaris +# +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 +$as_echo_n "checking for library containing inet_pton... " >&6; } +if ${ac_cv_search_inet_pton+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#ifndef bool - "error: bool is not defined" -#endif -#ifndef false - "error: false is not defined" -#endif -#if false - "error: false is not 0" -#endif -#ifndef true - "error: true is not defined" -#endif -#if true != 1 - "error: true is not 1" -#endif -#ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" +/* 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 - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - /* See body of main program for 'e'. */ - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - /* The following fails for - HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - +char inet_pton (); int main () { - - bool e = &s; - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - +return inet_pton (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdbool_h=yes -else - ac_cv_header_stdbool_h=no +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_pton=$ac_res fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_inet_pton+:} false; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 -$as_echo "$ac_cv_header_stdbool_h" >&6; } -ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" -if test "x$ac_cv_type__Bool" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF - +done +if ${ac_cv_search_inet_pton+:} false; then : +else + ac_cv_search_inet_pton=no fi - -if test $ac_cv_header_stdbool_h = yes; then - -$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h - +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 +$as_echo "$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define NICEAPI_EXPORT " >>confdefs.h - -for ac_header in arpa/inet.h net/in.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +/* 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 socket (); +int +main () +{ +return socket (); + ; + return 0; +} _ACEOF - +for ac_lib in '' socket inet; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break fi - done +if ${ac_cv_search_socket+:} false; then : -for ac_header in ifaddrs.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "$ac_includes_default" -if test "x$ac_cv_header_ifaddrs_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_IFADDRS_H 1 -_ACEOF - \ - -$as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -done +case $host in + *-*-solaris* ) +$as_echo "#define _XOPEN_SOURCE 600" >>confdefs.h -LIBNICE_CFLAGS="-Wall" -if test "x$LIBNICE_RELEASE" != "xyes"; then - LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror" -fi + +$as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + ;; +esac { $as_echo "$as_me:${as_lineno-$LINENO}: set LIBNICE_CFLAGS to $LIBNICE_CFLAGS" >&5 @@ -11887,6 +14281,7 @@ + if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. @@ -11907,7 +14302,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -11950,7 +14345,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -12009,12 +14404,13 @@ pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 \""; } >&5 - ($PKG_CONFIG --exists --print-errors " glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 ") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" glib-2.0 >= \$GLIB_REQ gobject-2.0 >= \$GLIB_REQ gthread-2.0 >= \$GLIB_REQ gio-2.0 >= \$GLIB_REQ \""; } >&5 + ($PKG_CONFIG --exists --print-errors " glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags " glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 " 2>/dev/null` + pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags " glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12025,12 +14421,13 @@ pkg_cv_GLIB_LIBS="$GLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 \""; } >&5 - ($PKG_CONFIG --exists --print-errors " glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 ") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" glib-2.0 >= \$GLIB_REQ gobject-2.0 >= \$GLIB_REQ gthread-2.0 >= \$GLIB_REQ gio-2.0 >= \$GLIB_REQ \""; } >&5 + ($PKG_CONFIG --exists --print-errors " glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs " glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 " 2>/dev/null` + pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs " glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12050,14 +14447,14 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors " glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 " 2>&1` + GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ " 2>&1` else - GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors " glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 " 2>&1` + GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ " 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GLIB_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements ( glib-2.0 >= 2.13 gobject-2.0 >= 2.13 gthread-2.0 >= 2.13 gio-2.0 >= 2.13 ) were not met: + as_fn_error $? "Package requirements ( glib-2.0 >= $GLIB_REQ gobject-2.0 >= $GLIB_REQ gthread-2.0 >= $GLIB_REQ gio-2.0 >= $GLIB_REQ ) were not met: $GLIB_PKG_ERRORS @@ -12067,7 +14464,6 @@ Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 - elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -12083,7 +14479,6 @@ To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } - else GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS GLIB_LIBS=$pkg_cv_GLIB_LIBS @@ -12137,6 +14532,7 @@ gstreamer-1.0 >= 0.11.91 gstreamer-base-1.0 >= 0.11.91 " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12162,6 +14558,7 @@ gstreamer-1.0 >= 0.11.91 gstreamer-base-1.0 >= 0.11.91 " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12181,12 +14578,12 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GST_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors " + GST_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " gstreamer-1.0 >= 0.11.91 gstreamer-base-1.0 >= 0.11.91 " 2>&1` else - GST_PKG_ERRORS=`$PKG_CONFIG --print-errors " + GST_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " gstreamer-1.0 >= 0.11.91 gstreamer-base-1.0 >= 0.11.91 " 2>&1` @@ -12256,6 +14653,7 @@ gstreamer-0.10 >= 0.10.10 gstreamer-base-0.10 >= 0.10.10 " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12281,6 +14679,7 @@ gstreamer-0.10 >= 0.10.10 gstreamer-base-0.10 >= 0.10.10 " 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12300,12 +14699,12 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GST010_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors " + GST010_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " gstreamer-0.10 >= 0.10.10 gstreamer-base-0.10 >= 0.10.10 " 2>&1` else - GST010_PKG_ERRORS=`$PKG_CONFIG --print-errors " + GST010_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " gstreamer-0.10 >= 0.10.10 gstreamer-base-0.10 >= 0.10.10 " 2>&1` @@ -12399,6 +14798,7 @@ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GUPNP_CFLAGS=`$PKG_CONFIG --cflags "gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12415,6 +14815,7 @@ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GUPNP_LIBS=`$PKG_CONFIG --libs "gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12434,9 +14835,9 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GUPNP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" 2>&1` + GUPNP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" 2>&1` else - GUPNP_PKG_ERRORS=`$PKG_CONFIG --print-errors "gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" 2>&1` + GUPNP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gupnp-igd-1.0 >= $GUPNP_IGD_REQUIRED" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GUPNP_PKG_ERRORS" >&5 @@ -12455,7 +14856,7 @@ fi fi if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then - as_fn_error $? "Requested GUPnP IGD, but it is not available" "$LINENO" 5 + as_fn_error but it is not available "Requested GUPnP IGD" "$LINENO" 5 fi if test "x$HAVE_GUPNP" = "xyes"; then @@ -12513,7 +14914,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTKDOC_CHECK="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -12555,7 +14956,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTKDOC_REBASE="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -12599,7 +15000,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GTKDOC_MKPDF="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -12668,6 +15069,7 @@ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTKDOC_DEPS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12684,6 +15086,7 @@ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTKDOC_DEPS_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -12703,40 +15106,18 @@ _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` else - GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` + GTKDOC_DEPS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GTKDOC_DEPS_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0) were not met: - -$GTKDOC_DEPS_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables GTKDOC_DEPS_CFLAGS -and GTKDOC_DEPS_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 - + : elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables GTKDOC_DEPS_CFLAGS -and GTKDOC_DEPS_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } - + : else GTKDOC_DEPS_CFLAGS=$pkg_cv_GTKDOC_DEPS_CFLAGS GTKDOC_DEPS_LIBS=$pkg_cv_GTKDOC_DEPS_LIBS @@ -12771,6 +15152,10 @@ enable_gtk_doc_pdf=no fi + if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 + fi + if test x$enable_gtk_doc = xyes; then ENABLE_GTK_DOC_TRUE= @@ -12925,6 +15310,14 @@ 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='#' @@ -12941,6 +15334,10 @@ as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${WINDOWS_TRUE}" && test -z "${WINDOWS_FALSE}"; then as_fn_error $? "conditional \"WINDOWS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -13271,16 +15668,16 @@ # ... 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 @@ -13340,28 +15737,16 @@ 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'" @@ -13382,8 +15767,8 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libnice $as_me 0.1.4, which was -generated by GNU Autoconf 2.68. Invocation command line was +This file was extended by libnice $as_me 0.1.7, which was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -13448,11 +15833,11 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libnice config.status 0.1.4 -configured by $0, generated by GNU Autoconf 2.68, +libnice config.status 0.1.7 +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -13543,7 +15928,7 @@ _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' @@ -14468,7 +16853,7 @@ 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 @@ -14481,7 +16866,7 @@ # 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. @@ -14515,21 +16900,19 @@ 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" || diff -Nru libnice-0.1.4/configure.ac libnice-0.1.7/configure.ac --- libnice-0.1.4/configure.ac 2013-02-23 00:19:11.000000000 +0000 +++ libnice-0.1.7/configure.ac 2014-05-05 18:57:58.000000000 +0000 @@ -1,15 +1,17 @@ AC_PREREQ(2.59c) -dnl releases only do -Wall, cvs and prerelease does -Werror too +dnl Always compile with -Wall; if --enable-compile-warnings=error is passed, +dnl also use -Werror. git and pre-releases default to -Werror + dnl use a three digit version number for releases, and four for cvs/prerelease -AC_INIT(libnice, 0.1.4) +AC_INIT([libnice],[0.1.7]) LIBNICE_RELEASE="yes" -AC_CANONICAL_SYSTEM +AC_CANONICAL_TARGET AC_CONFIG_SRCDIR([agent/agent.c]) -AC_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([-Wall]) AC_CONFIG_FILES([ @@ -37,9 +39,9 @@ # Increment CURRENT and AGE. Set REVISION to 0 # If there was an incompatible interface change: # Increment CURRENT. Set AGE and REVISION to 0 -LIBNICE_CURRENT=12 -LIBNICE_REVISION=0 -LIBNICE_AGE=2 +LIBNICE_CURRENT=14 +LIBNICE_REVISION=1 +LIBNICE_AGE=4 LIBNICE_LIBVERSION=${LIBNICE_CURRENT}:${LIBNICE_REVISION}:${LIBNICE_AGE} LIBNICE_LT_LDFLAGS="-version-info ${LIBNICE_LIBVERSION} -no-undefined" AC_SUBST(LIBNICE_LT_LDFLAGS) @@ -53,9 +55,10 @@ # Checks for programs. -AC_PROG_CC AC_USE_SYSTEM_EXTENSIONS -AC_PROG_LIBTOOL +AC_PROG_CC +AM_PROG_AR +LT_INIT # Check Operating System AC_MSG_CHECKING([operating system]) @@ -89,12 +92,89 @@ AC_CHECK_HEADERS([ifaddrs.h], \ [AC_DEFINE(HAVE_GETIFADDRS, [1], \ [Whether getifaddrs() is available on the system])]) +AC_CHECK_TYPES([size_t, ssize_t]) -LIBNICE_CFLAGS="-Wall" -dnl if asked for, add -Werror if supported -if test "x$LIBNICE_RELEASE" != "xyes"; then - LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror" -fi +# Also put matching version in LIBNICE_CFLAGS +GLIB_REQ=2.30 + +LIBNICE_CFLAGS="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_30 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36" + +dnl Support different levels of compiler error reporting. +dnl This configure flag is designed to mimic one from gnome-common, +dnl Defaults to "error" except for releases where it defaults to "yes" +AC_ARG_ENABLE(compile-warnings, + AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@], + [Enable different levels of compiler warnings]),, + [AS_IF([test "$LIBNICE_RELEASE" = "yes"], + [enable_compile_warnings="yes"], + [enable_compile_warnings="error"])]) + +AC_DEFUN([NICE_ADD_FLAG], + AS_COMPILER_FLAG([$1], LIBNICE_CFLAGS="$LIBNICE_CFLAGS $1", []) +) + +NICE_ADD_FLAG([-fno-strict-aliasing]) + +AS_IF([test "$enable_compile_warnings" != "no"],[ + NICE_ADD_FLAG([-Wall]) +]) +AS_IF([test "x$enable_compile_warnings" != "xno" -a \ + "x$enable_compile_warnings" != "xminimum"],[ + NICE_ADD_FLAG([-Wextra]) + NICE_ADD_FLAG([-Wundef]) + NICE_ADD_FLAG([-Wnested-externs]) + NICE_ADD_FLAG([-Wwrite-strings]) + NICE_ADD_FLAG([-Wpointer-arith]) + NICE_ADD_FLAG([-Wmissing-declarations]) + NICE_ADD_FLAG([-Wmissing-prototypes]) + NICE_ADD_FLAG([-Wstrict-prototypes]) + NICE_ADD_FLAG([-Wredundant-decls]) + NICE_ADD_FLAG([-Wno-unused-parameter]) + NICE_ADD_FLAG([-Wno-missing-field-initializers]) + NICE_ADD_FLAG([-Wdeclaration-after-statement]) + NICE_ADD_FLAG([-Wformat=2]) + NICE_ADD_FLAG([-Wold-style-definition]) + NICE_ADD_FLAG([-Wcast-align]) + NICE_ADD_FLAG([-Wformat-nonliteral]) + NICE_ADD_FLAG([-Wformat-security]) +]) +AS_IF([test "$enable_compile_warnings" = "yes" -o \ + "$enable_compile_warnings" = "maximum" -o \ + "$enable_compile_warnings" = "error"],[ + NICE_ADD_FLAG([-Wsign-compare]) + NICE_ADD_FLAG([-Wstrict-aliasing]) + NICE_ADD_FLAG([-Wshadow]) + NICE_ADD_FLAG([-Winline]) + NICE_ADD_FLAG([-Wpacked]) + NICE_ADD_FLAG([-Wmissing-format-attribute]) + NICE_ADD_FLAG([-Wmissing-noreturn]) + NICE_ADD_FLAG([-Winit-self]) + NICE_ADD_FLAG([-Wredundant-decls]) + NICE_ADD_FLAG([-Wmissing-include-dirs]) + NICE_ADD_FLAG([-Wunused-but-set-variable]) + NICE_ADD_FLAG([-Warray-bounds]) +]) +AS_IF([test "$enable_compile_warnings" = "maximum" -o \ + "$enable_compile_warnings" = "error"],[ + NICE_ADD_FLAG([-Wswitch-enum]) + NICE_ADD_FLAG([-Wswitch-default]) + NICE_ADD_FLAG([-Waggregate-return]) +]) +AS_IF([test "x$enable_compile_warnings" = "xerror"],[ + NICE_ADD_FLAG([-Werror]) +]) + +# +# Fixes for Solaris +# +AC_SEARCH_LIBS([inet_pton],[nsl]) +AC_SEARCH_LIBS([socket],[socket inet]) +case $host in + *-*-solaris* ) + AC_DEFINE(_XOPEN_SOURCE, 600, Needed to get declarations for msg_control and msg_controllen on Solaris) + AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris) + ;; +esac AC_SUBST(LIBNICE_CFLAGS) AC_MSG_NOTICE([set LIBNICE_CFLAGS to $LIBNICE_CFLAGS]) @@ -105,19 +185,19 @@ AC_SUBST(LIBRT) PKG_CHECK_MODULES(GLIB, [dnl - glib-2.0 >= 2.13 dnl - gobject-2.0 >= 2.13 dnl - gthread-2.0 >= 2.13 dnl - gio-2.0 >= 2.13 dnl + glib-2.0 >= $GLIB_REQ dnl + gobject-2.0 >= $GLIB_REQ dnl + gthread-2.0 >= $GLIB_REQ dnl + gio-2.0 >= $GLIB_REQ dnl ]) AC_ARG_WITH(gstreamer, - AC_HELP_STRING([--with-gstreamer], [build GStreamer plugin]), + AS_HELP_STRING([--with-gstreamer],[build GStreamer plugin]), [with_gstreamer=${withval}], [with_gstreamer=auto]) AC_ARG_WITH(gstreamer-0.10, - AC_HELP_STRING([--with-gstreamer-0.10], [build GStreamer 0.10 plugin]), + AS_HELP_STRING([--with-gstreamer-0.10],[build GStreamer 0.10 plugin]), [with_gstreamer010=${withval}], [with_gstreamer010=auto]) @@ -170,7 +250,7 @@ GUPNP_IGD_REQUIRED=0.1.2 AC_ARG_ENABLE([gupnp], - AC_HELP_STRING([--disable-gupnp], [Disable GUPnP IGD support]), + AS_HELP_STRING([--disable-gupnp],[Disable GUPnP IGD support]), [case "${enableval}" in yes) WANT_GUPNP=yes ;; no) WANT_GUPNP=no ;; @@ -185,7 +265,7 @@ [ HAVE_GUPNP=no ]) fi if test "x$WANT_GUPNP" = "xyes" && test "x$HAVE_GUPNP" = "xno"; then - AC_ERROR([Requested GUPnP IGD, but it is not available]) + AC_MSG_ERROR(Requested GUPnP IGD, but it is not available) fi if test "x$HAVE_GUPNP" = "xyes"; then diff -Nru libnice-0.1.4/debian/changelog libnice-0.1.7/debian/changelog --- libnice-0.1.4/debian/changelog 2013-06-06 09:42:10.000000000 +0000 +++ libnice-0.1.7/debian/changelog 2014-05-14 11:00:27.000000000 +0000 @@ -1,3 +1,25 @@ +libnice (0.1.7-1) unstable; urgency=low + + * New upstream release 0.1.6, 0.1.7 + - fixes various compiler warnings that were mistakenly fatal in 0.1.5 + (Closes: #743232, #743233) + - update symbols file for new API + * Explicitly disable -Werror, even if we package a non-release in future + * Don't run tests during the build. We were ignoring failures already, + and they sometimes hang until the buildd terminates them. + Upstream (Olivier Crête) says they are stable enough to be useful + for developers, but not for integration testing. + + -- Simon McVittie Wed, 14 May 2014 12:00:13 +0100 + +libnice (0.1.5-1) unstable; urgency=low + + * New upstream release + - update symbols + * Standards-Version: 3.9.5 (no changes required) + + -- Simon McVittie Wed, 26 Mar 2014 15:15:33 +0000 + libnice (0.1.4-1) unstable; urgency=low * New upstream release (Closes: #705101) diff -Nru libnice-0.1.4/debian/control libnice-0.1.7/debian/control --- libnice-0.1.4/debian/control 2013-06-06 09:42:10.000000000 +0000 +++ libnice-0.1.7/debian/control 2014-05-14 11:00:27.000000000 +0000 @@ -17,7 +17,7 @@ libgstreamer1.0-dev, libgupnp-igd-1.0-dev (>= 0.1.2), gtk-doc-tools -Standards-Version: 3.9.4 +Standards-Version: 3.9.5 Homepage: http://nice.freedesktop.org/ Vcs-Git: git://anonscm.debian.org/pkg-telepathy/libnice.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-telepathy/libnice.git diff -Nru libnice-0.1.4/debian/libnice10.symbols libnice-0.1.7/debian/libnice10.symbols --- libnice-0.1.4/debian/libnice10.symbols 2013-06-06 09:42:10.000000000 +0000 +++ libnice-0.1.7/debian/libnice10.symbols 2014-05-14 11:00:27.000000000 +0000 @@ -18,15 +18,18 @@ nice_agent_add_local_address@Base 0.1.0 nice_agent_add_stream@Base 0.1.0 nice_agent_attach_recv@Base 0.1.0 + nice_agent_forget_relays@Base 0.1.7 nice_agent_gather_candidates@Base 0.1.0 nice_agent_generate_local_candidate_sdp@Base 0.1.4 nice_agent_generate_local_sdp@Base 0.1.4 nice_agent_generate_local_stream_sdp@Base 0.1.4 nice_agent_get_default_local_candidate@Base 0.1.4 + nice_agent_get_io_stream@Base 0.1.5 nice_agent_get_local_candidates@Base 0.1.0 nice_agent_get_local_credentials@Base 0.1.0 nice_agent_get_remote_candidates@Base 0.1.0 nice_agent_get_selected_pair@Base 0.1.4 + nice_agent_get_selected_socket@Base 0.1.5 nice_agent_get_stream_name@Base 0.1.4 nice_agent_get_type@Base 0.1.0 nice_agent_new@Base 0.1.0 @@ -34,9 +37,15 @@ nice_agent_parse_remote_candidate_sdp@Base 0.1.4 nice_agent_parse_remote_sdp@Base 0.1.4 nice_agent_parse_remote_stream_sdp@Base 0.1.4 + nice_agent_recv@Base 0.1.5 + nice_agent_recv_messages@Base 0.1.5 + nice_agent_recv_messages_nonblocking@Base 0.1.5 + nice_agent_recv_nonblocking@Base 0.1.5 nice_agent_remove_stream@Base 0.1.0 nice_agent_restart@Base 0.1.0 + nice_agent_restart_stream@Base 0.1.7 nice_agent_send@Base 0.1.0 + nice_agent_send_messages_nonblocking@Base 0.1.5 nice_agent_set_port_range@Base 0.1.4 nice_agent_set_relay_info@Base 0.1.0 nice_agent_set_remote_candidates@Base 0.1.0 @@ -49,11 +58,15 @@ nice_candidate_copy@Base 0.1.0 nice_candidate_free@Base 0.1.0 nice_candidate_new@Base 0.1.0 + nice_component_state_to_string@Base 0.1.7 nice_debug_disable@Base 0.1.0 nice_debug_enable@Base 0.1.0 + nice_input_stream_new@Base 0.1.5 nice_interfaces_get_ip_for_interface@Base 0.1.0 nice_interfaces_get_local_interfaces@Base 0.1.0 nice_interfaces_get_local_ips@Base 0.1.0 + nice_io_stream_new@Base 0.1.5 + nice_output_stream_new@Base 0.1.5 pseudo_tcp_set_debug_level@Base 0.1.0 pseudo_tcp_socket_close@Base 0.1.0 pseudo_tcp_socket_connect@Base 0.1.0 diff -Nru libnice-0.1.4/debian/rules libnice-0.1.7/debian/rules --- libnice-0.1.4/debian/rules 2013-06-06 09:42:10.000000000 +0000 +++ libnice-0.1.7/debian/rules 2014-05-14 11:00:27.000000000 +0000 @@ -8,11 +8,13 @@ include /usr/share/cdbs/1/rules/utils.mk common-binary-post-install-arch:: list-missing -DEB_MAKE_CHECK_TARGET := check VERBOSE=1 G_MESSAGES_DEBUG=all || true - DEB_DBG_PACKAGE_libnice10 := libnice-dbg DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ - --enable-gupnp --with-gstreamer-0.10 --with-gstreamer + --enable-compile-warnings=yes \ + --enable-gupnp \ + --with-gstreamer-0.10 \ + --with-gstreamer \ + $(NULL) include $(CURDIR)/debian/update-patches.mk diff -Nru libnice-0.1.4/docs/Makefile.in libnice-0.1.7/docs/Makefile.in --- libnice-0.1.4/docs/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/docs/Makefile.in 2014-05-05 18:58:19.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ esac; \ - test $$am__dry = yes; \ - } + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -52,30 +79,38 @@ host_triplet = @host@ target_triplet = @target@ subdir = docs -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -83,9 +118,29 @@ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -300,22 +355,25 @@ -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -330,57 +388,12 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -396,12 +409,7 @@ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -413,15 +421,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -430,6 +434,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -590,22 +609,20 @@ uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive +.MAKE: $(am__recursive_targets) install-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -Nru libnice-0.1.4/docs/reference/libnice/html/annotation-glossary.html libnice-0.1.7/docs/reference/libnice/html/annotation-glossary.html --- libnice-0.1.4/docs/reference/libnice/html/annotation-glossary.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/annotation-glossary.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,63 @@ + + + + +Annotation Glossary + + + + + + + + + + + + + + + + + + +
+

+Annotation Glossary

+

A

+
allow-none
+

NULL is ok, both for passing and for returning.

+
array
+

Parameter points to an array of items.

+

E

+
element-type
+

Generics and defining elements of containers and arrays.

+

I

+
in
+

Parameter for input. Default is transfer none.

+

O

+
out callee-allocates
+

Out parameter, where caller must allocate storage.

+
out caller-allocates
+

Out parameter, where caller must allocate storage.

+

T

+
transfer full
+

Free data after the code is done.

+
transfer none
+

Don't free data after the code is done.

+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/api-index-deprecated.html libnice-0.1.7/docs/reference/libnice/html/api-index-deprecated.html --- libnice-0.1.4/docs/reference/libnice/html/api-index-deprecated.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/api-index-deprecated.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,31 @@ + + + + +Index of deprecated symbols + + + + + + + + + + + + + + + + +
+

+Index of deprecated symbols

+ +
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/api-index-full.html libnice-0.1.7/docs/reference/libnice/html/api-index-full.html --- libnice-0.1.4/docs/reference/libnice/html/api-index-full.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/api-index-full.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,1040 @@ + + + + +API Index + + + + + + + + + + + + + + + + + + + +
+

+API Index

+

A

+
+StunAgent, typedef in StunAgent +
+
+
+StunAgentUsageFlags, enum in StunAgent +
+
+
+stun_agent_build_unknown_attributes_error, function in StunAgent +
+
+
+stun_agent_default_validater, function in StunAgent +
+
+
+stun_agent_finish_message, function in StunAgent +
+
+
+stun_agent_forget_transaction, function in StunAgent +
+
+
+stun_agent_init, function in StunAgent +
+
+
+stun_agent_init_error, function in StunAgent +
+
+
+stun_agent_init_indication, function in StunAgent +
+
+
+stun_agent_init_request, function in StunAgent +
+
+
+stun_agent_init_response, function in StunAgent +
+
+
+STUN_AGENT_MAX_SAVED_IDS, macro in STUN Constants +
+
+
+STUN_AGENT_MAX_UNKNOWN_ATTRIBUTES, macro in STUN Constants +
+
+
+stun_agent_set_software, function in StunAgent +
+
+
+stun_agent_validate, function in StunAgent +
+
+
+StunAttribute, enum in StunMessage +
+
+
+STUN_ATTRIBUTE_HEADER_LENGTH, macro in STUN Constants +
+
+
+STUN_ATTRIBUTE_LENGTH_LEN, macro in STUN Constants +
+
+
+STUN_ATTRIBUTE_LENGTH_POS, macro in STUN Constants +
+
+
+STUN_ATTRIBUTE_TYPE_LEN, macro in STUN Constants +
+
+
+STUN_ATTRIBUTE_TYPE_POS, macro in STUN Constants +
+
+
+STUN_ATTRIBUTE_VALUE_POS, macro in STUN Constants +
+
+

C

+
+StunClass, enum in StunMessage +
+
+
+StunCompatibility, enum in StunAgent +
+
+

D

+
+stun_debug_disable, function in StunAgent +
+
+
+stun_debug_enable, function in StunAgent +
+
+
+StunDefaultValidaterData, struct in StunAgent +
+
+

E

+
+StunError, enum in StunMessage +
+
+

I

+
+STUN_ID_LEN, macro in STUN Constants +
+
+
+StunInputVector, struct in StunMessage +
+
+

M

+
+STUN_MAGIC_COOKIE, macro in STUN Constants +
+
+
+STUN_MAX_MESSAGE_SIZE, macro in STUN Constants +
+
+
+STUN_MAX_MESSAGE_SIZE_IPV4, macro in STUN Constants +
+
+
+STUN_MAX_MESSAGE_SIZE_IPV6, macro in STUN Constants +
+
+
+StunMessage, struct in StunMessage +
+
+
+StunMessageIntegrityValidate, user_function in StunAgent +
+
+
+StunMessageReturn, enum in StunMessage +
+
+
+stun_message_append, function in StunMessage +
+
+
+stun_message_append32, function in StunMessage +
+
+
+stun_message_append64, function in StunMessage +
+
+
+stun_message_append_addr, function in StunMessage +
+
+
+stun_message_append_bytes, function in StunMessage +
+
+
+stun_message_append_error, function in StunMessage +
+
+
+stun_message_append_flag, function in StunMessage +
+
+
+stun_message_append_string, function in StunMessage +
+
+
+stun_message_append_xor_addr, function in StunMessage +
+
+
+stun_message_append_xor_addr_full, function in StunMessage +
+
+
+STUN_MESSAGE_ATTRIBUTES_POS, macro in STUN Constants +
+
+
+STUN_MESSAGE_BUFFER_INCOMPLETE, macro in StunMessage +
+
+
+STUN_MESSAGE_BUFFER_INVALID, macro in StunMessage +
+
+
+stun_message_find, function in StunMessage +
+
+
+stun_message_find32, function in StunMessage +
+
+
+stun_message_find64, function in StunMessage +
+
+
+stun_message_find_addr, function in StunMessage +
+
+
+stun_message_find_error, function in StunMessage +
+
+
+stun_message_find_flag, function in StunMessage +
+
+
+stun_message_find_string, function in StunMessage +
+
+
+stun_message_find_xor_addr, function in StunMessage +
+
+
+stun_message_find_xor_addr_full, function in StunMessage +
+
+
+stun_message_get_class, function in StunMessage +
+
+
+stun_message_get_method, function in StunMessage +
+
+
+stun_message_has_attribute, function in StunMessage +
+
+
+stun_message_has_cookie, function in StunMessage +
+
+
+STUN_MESSAGE_HEADER_LENGTH, macro in STUN Constants +
+
+
+stun_message_id, function in StunMessage +
+
+
+stun_message_init, function in StunMessage +
+
+
+stun_message_length, function in StunMessage +
+
+
+STUN_MESSAGE_LENGTH_LEN, macro in STUN Constants +
+
+
+STUN_MESSAGE_LENGTH_POS, macro in STUN Constants +
+
+
+STUN_MESSAGE_TRANS_ID_LEN, macro in STUN Constants +
+
+
+STUN_MESSAGE_TRANS_ID_POS, macro in STUN Constants +
+
+
+STUN_MESSAGE_TYPE_LEN, macro in STUN Constants +
+
+
+STUN_MESSAGE_TYPE_POS, macro in STUN Constants +
+
+
+stun_message_validate_buffer_length, function in StunMessage +
+
+
+stun_message_validate_buffer_length_fast, function in StunMessage +
+
+
+StunMethod, enum in StunMessage +
+
+

N

+
+NiceAddress, struct in NiceAddress +
+
+
+NiceAgent, struct in NiceAgent +
+
+
+NiceAgent::candidate-gathering-done, object signal in NiceAgent +
+
+
+NiceAgent::component-state-changed, object signal in NiceAgent +
+
+
+NiceAgent::initial-binding-request-received, object signal in NiceAgent +
+
+
+NiceAgent::new-candidate, object signal in NiceAgent +
+
+
+NiceAgent::new-remote-candidate, object signal in NiceAgent +
+
+
+NiceAgent::new-selected-pair, object signal in NiceAgent +
+
+
+NiceAgent::reliable-transport-writable, object signal in NiceAgent +
+
+
+NiceAgent::streams-removed, object signal in NiceAgent +
+
+
+NiceAgent:compatibility, object property in NiceAgent +
+
+
+NiceAgent:controlling-mode, object property in NiceAgent +
+
+
+NiceAgent:full-mode, object property in NiceAgent +
+
+
+NiceAgent:main-context, object property in NiceAgent +
+
+
+NiceAgent:max-connectivity-checks, object property in NiceAgent +
+
+
+NiceAgent:proxy-ip, object property in NiceAgent +
+
+
+NiceAgent:proxy-password, object property in NiceAgent +
+
+
+NiceAgent:proxy-port, object property in NiceAgent +
+
+
+NiceAgent:proxy-type, object property in NiceAgent +
+
+
+NiceAgent:proxy-username, object property in NiceAgent +
+
+
+NiceAgent:reliable, object property in NiceAgent +
+
+
+NiceAgent:stun-pacing-timer, object property in NiceAgent +
+
+
+NiceAgent:stun-server, object property in NiceAgent +
+
+
+NiceAgent:stun-server-port, object property in NiceAgent +
+
+
+NiceAgent:upnp, object property in NiceAgent +
+
+
+NiceAgent:upnp-timeout, object property in NiceAgent +
+
+
+NiceAgentRecvFunc, user_function in NiceAgent +
+
+
+NiceCandidate, struct in NiceCandidate +
+
+
+NiceCandidateTransport, enum in NiceCandidate +
+
+
+NiceCandidateType, enum in NiceCandidate +
+
+
+NiceCompatibility, enum in NiceAgent +
+
+
+NiceComponentState, enum in NiceAgent +
+
+
+NiceComponentType, enum in NiceAgent +
+
+
+NiceInputMessage, struct in NiceAgent +
+
+
+NiceOutputMessage, struct in NiceAgent +
+
+
+NiceProxyType, enum in NiceAgent +
+
+
+NiceRelayType, enum in NiceCandidate +
+
+
+nice_address_copy_to_sockaddr, function in NiceAddress +
+
+
+nice_address_dup, function in NiceAddress +
+
+
+nice_address_equal, function in NiceAddress +
+
+
+nice_address_free, function in NiceAddress +
+
+
+nice_address_get_port, function in NiceAddress +
+
+
+nice_address_init, function in NiceAddress +
+
+
+nice_address_ip_version, function in NiceAddress +
+
+
+nice_address_is_private, function in NiceAddress +
+
+
+nice_address_is_valid, function in NiceAddress +
+
+
+nice_address_new, function in NiceAddress +
+
+
+nice_address_set_from_sockaddr, function in NiceAddress +
+
+
+nice_address_set_from_string, function in NiceAddress +
+
+
+nice_address_set_ipv4, function in NiceAddress +
+
+
+nice_address_set_ipv6, function in NiceAddress +
+
+
+nice_address_set_port, function in NiceAddress +
+
+
+NICE_ADDRESS_STRING_LEN, macro in NiceAddress +
+
+
+nice_address_to_string, function in NiceAddress +
+
+
+nice_agent_add_local_address, function in NiceAgent +
+
+
+nice_agent_add_stream, function in NiceAgent +
+
+
+nice_agent_attach_recv, function in NiceAgent +
+
+
+nice_agent_forget_relays, function in NiceAgent +
+
+
+nice_agent_gather_candidates, function in NiceAgent +
+
+
+nice_agent_generate_local_candidate_sdp, function in NiceAgent +
+
+
+nice_agent_generate_local_sdp, function in NiceAgent +
+
+
+nice_agent_generate_local_stream_sdp, function in NiceAgent +
+
+
+nice_agent_get_default_local_candidate, function in NiceAgent +
+
+
+nice_agent_get_io_stream, function in NiceAgent +
+
+
+nice_agent_get_local_candidates, function in NiceAgent +
+
+
+nice_agent_get_local_credentials, function in NiceAgent +
+
+
+nice_agent_get_remote_candidates, function in NiceAgent +
+
+
+nice_agent_get_selected_pair, function in NiceAgent +
+
+
+nice_agent_get_selected_socket, function in NiceAgent +
+
+
+nice_agent_get_stream_name, function in NiceAgent +
+
+
+NICE_AGENT_MAX_REMOTE_CANDIDATES, macro in NiceAgent +
+
+
+nice_agent_new, function in NiceAgent +
+
+
+nice_agent_new_reliable, function in NiceAgent +
+
+
+nice_agent_parse_remote_candidate_sdp, function in NiceAgent +
+
+
+nice_agent_parse_remote_sdp, function in NiceAgent +
+
+
+nice_agent_parse_remote_stream_sdp, function in NiceAgent +
+
+
+nice_agent_recv, function in NiceAgent +
+
+
+nice_agent_recv_messages, function in NiceAgent +
+
+
+nice_agent_recv_messages_nonblocking, function in NiceAgent +
+
+
+nice_agent_recv_nonblocking, function in NiceAgent +
+
+
+nice_agent_remove_stream, function in NiceAgent +
+
+
+nice_agent_restart, function in NiceAgent +
+
+
+nice_agent_restart_stream, function in NiceAgent +
+
+
+nice_agent_send, function in NiceAgent +
+
+
+nice_agent_send_messages_nonblocking, function in NiceAgent +
+
+
+nice_agent_set_port_range, function in NiceAgent +
+
+
+nice_agent_set_relay_info, function in NiceAgent +
+
+
+nice_agent_set_remote_candidates, function in NiceAgent +
+
+
+nice_agent_set_remote_credentials, function in NiceAgent +
+
+
+nice_agent_set_selected_pair, function in NiceAgent +
+
+
+nice_agent_set_selected_remote_candidate, function in NiceAgent +
+
+
+nice_agent_set_software, function in NiceAgent +
+
+
+nice_agent_set_stream_name, function in NiceAgent +
+
+
+nice_agent_set_stream_tos, function in NiceAgent +
+
+
+nice_candidate_copy, function in NiceCandidate +
+
+
+nice_candidate_free, function in NiceCandidate +
+
+
+NICE_CANDIDATE_MAX_FOUNDATION, macro in NiceCandidate +
+
+
+nice_candidate_new, function in NiceCandidate +
+
+
+nice_component_state_to_string, function in NiceAgent +
+
+
+nice_debug_disable, function in Debug messages +
+
+
+nice_debug_enable, function in Debug messages +
+
+
+nice_interfaces_get_ip_for_interface, function in Network interfaces discovery +
+
+
+nice_interfaces_get_local_interfaces, function in Network interfaces discovery +
+
+
+nice_interfaces_get_local_ips, function in Network interfaces discovery +
+
+

O

+
+stun_optional, function in StunMessage +
+
+

P

+
+PseudoTcpCallbacks, struct in Pseudo TCP Socket +
+
+
+PseudoTcpDebugLevel, enum in Pseudo TCP Socket +
+
+
+PseudoTcpSocket, struct in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:ack-delay, object property in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:callbacks, object property in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:conversation, object property in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:no-delay, object property in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:rcv-buf, object property in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:snd-buf, object property in Pseudo TCP Socket +
+
+
+PseudoTcpSocket:state, object property in Pseudo TCP Socket +
+
+
+PseudoTcpState, enum in Pseudo TCP Socket +
+
+
+PseudoTcpWriteResult, enum in Pseudo TCP Socket +
+
+
+pseudo_tcp_set_debug_level, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_can_send, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_close, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_connect, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_get_available_bytes, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_get_available_send_space, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_get_error, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_get_next_clock, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_new, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_notify_clock, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_notify_message, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_notify_mtu, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_notify_packet, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_recv, function in Pseudo TCP Socket +
+
+
+pseudo_tcp_socket_send, function in Pseudo TCP Socket +
+
+

S

+
+stun_strerror, function in StunMessage +
+
+

T

+
+StunTimer, typedef in Timer +
+
+
+STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS, macro in Timer +
+
+
+STUN_TIMER_DEFAULT_RELIABLE_TIMEOUT, macro in Timer +
+
+
+STUN_TIMER_DEFAULT_TIMEOUT, macro in Timer +
+
+
+stun_timer_refresh, function in Timer +
+
+
+stun_timer_remainder, function in Timer +
+
+
+stun_timer_start, function in Timer +
+
+
+stun_timer_start_reliable, function in Timer +
+
+
+StunTransactionId, typedef in StunMessage +
+
+
+TurnServer, struct in NiceCandidate +
+
+
+TURN_MAGIC_COOKIE, macro in STUN Constants +
+
+

U

+
+StunUsageBindReturn, enum in Bind +
+
+
+StunUsageIceCompatibility, enum in ICE +
+
+
+StunUsageIceReturn, enum in ICE +
+
+
+StunUsageTimerReturn, enum in Timer +
+
+
+StunUsageTurnCompatibility, enum in TURN +
+
+
+StunUsageTurnRequestPorts, enum in TURN +
+
+
+StunUsageTurnReturn, enum in TURN +
+
+
+stun_usage_bind_create, function in Bind +
+
+
+stun_usage_bind_keepalive, function in Bind +
+
+
+stun_usage_bind_process, function in Bind +
+
+
+stun_usage_bind_run, function in Bind +
+
+
+stun_usage_ice_conncheck_create, function in ICE +
+
+
+stun_usage_ice_conncheck_create_reply, function in ICE +
+
+
+stun_usage_ice_conncheck_priority, function in ICE +
+
+
+stun_usage_ice_conncheck_process, function in ICE +
+
+
+stun_usage_ice_conncheck_use_candidate, function in ICE +
+
+
+stun_usage_turn_create, function in TURN +
+
+
+stun_usage_turn_create_permission, function in TURN +
+
+
+stun_usage_turn_create_refresh, function in TURN +
+
+
+stun_usage_turn_process, function in TURN +
+
+
+stun_usage_turn_refresh_process, function in TURN +
+
+

V

+
+StunValidationStatus, enum in StunAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ch01.html libnice-0.1.7/docs/reference/libnice/html/ch01.html --- libnice-0.1.4/docs/reference/libnice/html/ch01.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ch01.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ - + - + @@ -21,7 +21,7 @@
-
+
NiceAgent — ICE agent API implementation
@@ -35,6 +35,6 @@
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ch02.html libnice-0.1.7/docs/reference/libnice/html/ch02.html --- libnice-0.1.4/docs/reference/libnice/html/ch02.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ch02.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Libnice helper functions - + - + @@ -21,8 +21,8 @@

-Libnice helper functions

-
+Libnice helper functions
+
Debug messages — Debug messages utility functions
@@ -33,6 +33,6 @@
+ Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ch03.html libnice-0.1.7/docs/reference/libnice/html/ch03.html --- libnice-0.1.4/docs/reference/libnice/html/ch03.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ch03.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ - + - + @@ -21,17 +21,20 @@
-
+
StunAgent — STUN agent for building and validating STUN messages
StunMessage — STUN messages parsing and formatting functions
+
+STUN Constants +
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ch04.html libnice-0.1.7/docs/reference/libnice/html/ch04.html --- libnice-0.1.4/docs/reference/libnice/html/ch04.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ch04.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,17 +3,17 @@ STUN usages - + - + - + - + @@ -21,8 +21,8 @@

-STUN usages

-
+STUN usages
+
Bind — STUN Binding Usage
@@ -39,6 +39,6 @@
+ Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ch05.html libnice-0.1.7/docs/reference/libnice/html/ch05.html --- libnice-0.1.4/docs/reference/libnice/html/ch05.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ch05.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ - + - + @@ -21,12 +21,12 @@
-
+
Pseudo TCP Socket — Pseudo TCP implementation
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/index.html libnice-0.1.7/docs/reference/libnice/html/index.html --- libnice-0.1.4/docs/reference/libnice/html/index.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/index.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,10 +3,10 @@ libnice Reference Manual - + - + @@ -21,7 +21,7 @@
-

The libnice library contains the ICE library and the STUN library as well as a Pseudo TCP socket implementation. @@ -87,6 +105,6 @@

+ Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/index.sgml libnice-0.1.7/docs/reference/libnice/html/index.sgml --- libnice-0.1.4/docs/reference/libnice/html/index.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/index.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -34,6 +34,8 @@ + + @@ -42,6 +44,7 @@ + @@ -50,12 +53,18 @@ + + + + + + @@ -65,6 +74,9 @@ + + + @@ -90,6 +102,7 @@ + @@ -325,6 +338,8 @@ + + @@ -333,6 +348,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -399,6 +440,7 @@ + @@ -451,7 +493,23 @@ + + + + + + + + + + + + + + + + diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix03.html libnice-0.1.7/docs/reference/libnice/html/ix03.html --- libnice-0.1.4/docs/reference/libnice/html/ix03.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix03.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,58 @@ + + + + +Index of new symbols in 0.0.4 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.0.4

+

N

+
+NiceAgent:proxy-ip, object property in NiceAgent +
+
+
+NiceAgent:proxy-password, object property in NiceAgent +
+
+
+NiceAgent:proxy-port, object property in NiceAgent +
+
+
+NiceAgent:proxy-type, object property in NiceAgent +
+
+
+NiceAgent:proxy-username, object property in NiceAgent +
+
+
+NiceProxyType, enum in NiceAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix04.html libnice-0.1.7/docs/reference/libnice/html/ix04.html --- libnice-0.1.4/docs/reference/libnice/html/ix04.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix04.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,38 @@ + + + + +Index of new symbols in 0.0.6 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.0.6

+

A

+
+stun_agent_forget_transaction, function in StunAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix05.html libnice-0.1.7/docs/reference/libnice/html/ix05.html --- libnice-0.1.4/docs/reference/libnice/html/ix05.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix05.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,42 @@ + + + + +Index of new symbols in 0.0.7 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.0.7

+

N

+
+NiceAgent:upnp, object property in NiceAgent +
+
+
+NiceAgent:upnp-timeout, object property in NiceAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix06.html libnice-0.1.7/docs/reference/libnice/html/ix06.html --- libnice-0.1.4/docs/reference/libnice/html/ix06.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix06.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,38 @@ + + + + +Index of new symbols in 0.0.9 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.0.9

+

N

+
+nice_agent_set_stream_tos, function in NiceAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix07.html libnice-0.1.7/docs/reference/libnice/html/ix07.html --- libnice-0.1.4/docs/reference/libnice/html/ix07.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix07.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,47 @@ + + + + +Index of new symbols in 0.0.10 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.0.10

+

A

+
+stun_agent_set_software, function in StunAgent +
+
+

N

+
+nice_agent_set_software, function in NiceAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix08.html libnice-0.1.7/docs/reference/libnice/html/ix08.html --- libnice-0.1.4/docs/reference/libnice/html/ix08.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix08.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,115 @@ + + + + +Index of new symbols in 0.0.11 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix09.html libnice-0.1.7/docs/reference/libnice/html/ix09.html --- libnice-0.1.4/docs/reference/libnice/html/ix09.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix09.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,66 @@ + + + + +Index of new symbols in 0.1.4 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix10.html libnice-0.1.7/docs/reference/libnice/html/ix10.html --- libnice-0.1.4/docs/reference/libnice/html/ix10.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix10.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,109 @@ + + + + +Index of new symbols in 0.1.5 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/ix11.html libnice-0.1.7/docs/reference/libnice/html/ix11.html --- libnice-0.1.4/docs/reference/libnice/html/ix11.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/ix11.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,46 @@ + + + + +Index of new symbols in 0.1.6 + + + + + + + + + + + + + + + + + + + +
+

+Index of new symbols in 0.1.6

+

N

+
+nice_agent_forget_relays, function in NiceAgent +
+
+
+nice_agent_restart_stream, function in NiceAgent +
+
+
+nice_component_state_to_string, function in NiceAgent +
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-Bind.html libnice-0.1.7/docs/reference/libnice/html/libnice-Bind.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-Bind.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-Bind.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Bind - + - + @@ -60,7 +60,7 @@ size_t len); StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv, socklen_t srvlen, - struct sockaddr *addr, + struct sockaddr_storage *addr, socklen_t *addrlen); @@ -88,8 +88,11 @@ Return value of stun_usage_bind_process() and stun_usage_bind_run() which allows you to see what status the function call returned.

-
+
+++ @@ -131,8 +134,11 @@

Create a new STUN binding request to use with a STUN server.

-

STUN_USAGE_BIND_RETURN_SUCCESS

+
+++ @@ -171,8 +177,11 @@ Process a STUN binding response and extracts the mapped address from the STUN message. Also checks for the ALTERNATE-SERVER attribute.

-

agent :

+
+++ @@ -223,8 +232,11 @@ Since this is an indication message, no STUN response will be generated and it can only be used as a keepalive message.

-

msg :

+
+++ @@ -256,15 +268,18 @@

stun_usage_bind_run ()

StunUsageBindReturn stun_usage_bind_run                 (const struct sockaddr *srv,
                                                          socklen_t srvlen,
-                                                         struct sockaddr *addr,
+                                                         struct sockaddr_storage *addr,
                                                          socklen_t *addrlen);

This is a convenience function that will do a synchronous Binding request to a server and wait for its answer. It will create the socket transports and use the StunTimer usage to send the request and handle the response.

-

agent :

+
+++ @@ -300,6 +315,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-Debug-messages.html libnice-0.1.7/docs/reference/libnice/html/libnice-Debug-messages.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-Debug-messages.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-Debug-messages.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Debug messages - + - + @@ -41,8 +41,8 @@

Synopsis

-
void                nice_debug_enable                   (gboolean with_stun);
-void                nice_debug_disable                  (gboolean with_stun);
+
void                nice_debug_enable                   (gboolean with_stun);
+void                nice_debug_disable                  (gboolean with_stun);
 
@@ -91,12 +91,15 @@

Details

nice_debug_enable ()

-
void                nice_debug_enable                   (gboolean with_stun);
+
void                nice_debug_enable                   (gboolean with_stun);

Enables libnice debug output to the terminal

-

srv :

+
+++ @@ -106,12 +109,15 @@

nice_debug_disable ()

-
void                nice_debug_disable                  (gboolean with_stun);
+
void                nice_debug_disable                  (gboolean with_stun);

Disables libnice debug output to the terminal

-

with_stun :

Also enable stun debugging messages
+
+++ @@ -122,6 +128,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice.devhelp2 libnice-0.1.7/docs/reference/libnice/html/libnice.devhelp2 --- libnice-0.1.4/docs/reference/libnice/html/libnice.devhelp2 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice.devhelp2 2014-05-05 18:59:30.000000000 +0000 @@ -8,7 +8,7 @@ - + @@ -17,6 +17,7 @@ + @@ -30,6 +31,20 @@ + + + + + + + + + + + + + + @@ -38,6 +53,8 @@ + + @@ -46,6 +63,7 @@ + @@ -54,12 +72,18 @@ + + + + + + @@ -69,6 +93,9 @@ + + + @@ -92,6 +119,7 @@ + @@ -174,6 +202,8 @@ + + @@ -181,6 +211,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -200,6 +252,7 @@ + @@ -225,8 +278,16 @@ + + + + + + + + diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-ICE.html libnice-0.1.7/docs/reference/libnice/html/libnice-ICE.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-ICE.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-ICE.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ ICE - + - + @@ -61,7 +61,7 @@ const char *candidate_identifier, StunUsageIceCompatibility compatibility); StunUsageIceReturn stun_usage_ice_conncheck_process (StunMessage *msg, - struct sockaddr *addr, + struct sockaddr_storage *addr, socklen_t *addrlen, StunUsageIceCompatibility compatibility); StunUsageIceReturn stun_usage_ice_conncheck_create_reply @@ -70,7 +70,7 @@ StunMessage *msg, uint8_t *buf, size_t *plen, - const struct sockaddr *src, + const struct sockaddr_storage *src, socklen_t srclen, bool *control, uint64_t tie, @@ -114,8 +114,11 @@

-

with_stun :

Also disable stun debugging messages
+
+++ @@ -168,8 +171,11 @@ stun_usage_ice_conncheck_create_reply() which allows you to see what status the function call returned.

-

STUN_USAGE_ICE_COMPATIBILITY_RFC5245

+
+++ @@ -246,8 +252,11 @@ If the compatibility is not STUN_USAGE_ICE_COMPATIBILITY_WLM2009, the candidate_identifier argument is not used.

-

STUN_USAGE_ICE_RETURN_SUCCESS

+
+++ @@ -287,12 +296,12 @@ - + - + @@ -324,7 +333,7 @@

stun_usage_ice_conncheck_process ()

StunUsageIceReturn  stun_usage_ice_conncheck_process    (StunMessage *msg,
-                                                         struct sockaddr *addr,
+                                                         struct sockaddr_storage *addr,
                                                          socklen_t *addrlen,
                                                          StunUsageIceCompatibility compatibility);

@@ -335,8 +344,11 @@ stun_usage_ice_conncheck_use_candidate()

-

agent :

cand_use :

Set to TRUE to append the USE-CANDIDATE flag to the requestSet to TRUE to append the USE-CANDIDATE flag to the request

controlling :

Set to TRUE if you are the controlling agent or set to -FALSE if you are the controlled agent.Set to TRUE if you are the controlling agent or set to +FALSE if you are the controlled agent.

priority :

+
+++ @@ -373,7 +385,7 @@ StunMessage *msg, uint8_t *buf, size_t *plen, - const struct sockaddr *src, + const struct sockaddr_storage *src, socklen_t srclen, bool *control, uint64_t tie, @@ -392,8 +404,11 @@

-

msg :

+
+++ @@ -430,8 +445,8 @@ - + @@ -457,8 +472,11 @@

Extracts the priority from a STUN message.

-

agent :

control :

Set to TRUE if you are the controlling agent or set to -FALSE if you are the controlled agent.Set to TRUE if you are the controlling agent or set to +FALSE if you are the controlled agent.

tie :

+
+++ @@ -479,8 +497,11 @@

Extracts the USE-CANDIDATE attribute flag from a STUN message.

-

msg :

+
+++ @@ -489,7 +510,7 @@ +TRUE if the flag is set, FALSE if not.

msg :

Returns :

-TRUE if the flag is set, FALSE if not.
@@ -498,6 +519,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-Network-interfaces-discovery.html libnice-0.1.7/docs/reference/libnice/html/libnice-Network-interfaces-discovery.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-Network-interfaces-discovery.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-Network-interfaces-discovery.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Network interfaces discovery - + - + @@ -44,11 +44,11 @@
 #include <interfaces.h>
 
-gchar *             nice_interfaces_get_ip_for_interface
-                                                        (gchar *interface_name);
-GList *             nice_interfaces_get_local_interfaces
+gchar *             nice_interfaces_get_ip_for_interface
+                                                        (gchar *interface_name);
+GList *             nice_interfaces_get_local_interfaces
                                                         (void);
-GList *             nice_interfaces_get_local_ips       (gboolean include_loopback);
+GList *             nice_interfaces_get_local_ips       (gboolean include_loopback);
 
@@ -63,13 +63,16 @@

Details

nice_interfaces_get_ip_for_interface ()

-
gchar *             nice_interfaces_get_ip_for_interface
-                                                        (gchar *interface_name);
+
gchar *             nice_interfaces_get_ip_for_interface
+                                                        (gchar *interface_name);

Retreives the IPv4 address of an interface by its name

-
+
+++ @@ -85,28 +88,34 @@

nice_interfaces_get_local_interfaces ()

-
GList *             nice_interfaces_get_local_interfaces
+
GList *             nice_interfaces_get_local_interfaces
                                                         (void);

Get the list of local interfaces

-

interface_name :

+
+++ - +

Returns :

a newly-allocated GList of strings. The caller must free it.a newly-allocated GList of strings. The caller must free it.

nice_interfaces_get_local_ips ()

-
GList *             nice_interfaces_get_local_ips       (gboolean include_loopback);
+
GList *             nice_interfaces_get_local_ips       (gboolean include_loopback);

Get a list of local ipv4 interface addresses

-
+
+++ @@ -114,7 +123,7 @@ - +

include_loopback :

Returns :

a newly-allocated GList of strings. The caller must free it.a newly-allocated GList of strings. The caller must free it.
@@ -123,6 +132,6 @@
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-NiceAddress.html libnice-0.1.7/docs/reference/libnice/html/libnice-NiceAddress.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-NiceAddress.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-NiceAddress.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ NiceAddress - + - + @@ -48,24 +48,24 @@ void nice_address_free (NiceAddress *addr); NiceAddress * nice_address_dup (const NiceAddress *addr); void nice_address_set_ipv4 (NiceAddress *addr, - guint32 addr_ipv4); + guint32 addr_ipv4); void nice_address_set_ipv6 (NiceAddress *addr, - const guchar *addr_ipv6); + const guchar *addr_ipv6); void nice_address_set_port (NiceAddress *addr, - guint port); -guint nice_address_get_port (const NiceAddress *addr); -gboolean nice_address_set_from_string (NiceAddress *addr, - const gchar *str); + guint port); +guint nice_address_get_port (const NiceAddress *addr); +gboolean nice_address_set_from_string (NiceAddress *addr, + const gchar *str); void nice_address_set_from_sockaddr (NiceAddress *addr, const struct sockaddr *sin); void nice_address_copy_to_sockaddr (const NiceAddress *addr, struct sockaddr *sin); -gboolean nice_address_equal (const NiceAddress *a, +gboolean nice_address_equal (const NiceAddress *a, const NiceAddress *b); void nice_address_to_string (const NiceAddress *addr, - gchar *dst); -gboolean nice_address_is_private (const NiceAddress *addr); -gboolean nice_address_is_valid (const NiceAddress *addr); + gchar *dst); +gboolean nice_address_is_private (const NiceAddress *addr); +gboolean nice_address_is_valid (const NiceAddress *addr); int nice_address_ip_version (const NiceAddress *addr); @@ -92,8 +92,11 @@

The NiceAddress structure that represents an IPv4 or IPv6 address.

-
+
+++
@@ -115,8 +118,11 @@

Initialize a NiceAddress into an undefined address

-
+
+++ @@ -131,8 +137,11 @@ Create a new NiceAddress with undefined address You must free it with nice_address_free()

-

addr :

The NiceAddress to init
+
+++

Returns :

The new NiceAddress @@ -147,8 +156,11 @@

Frees a NiceAddress created with nice_address_new() or nice_address_dup()

-
+
+++ @@ -162,8 +174,11 @@

Creates a new NiceAddress with the same address as addr

-

addr :

The NiceAddress to free
+
+++ @@ -181,7 +196,7 @@

nice_address_set_ipv4 ()

void                nice_address_set_ipv4               (NiceAddress *addr,
-                                                         guint32 addr_ipv4);
+ guint32 addr_ipv4);

Set addr to an IPv4 address using the data from addr_ipv4

@@ -196,8 +211,11 @@

-

addr :

+
+++ @@ -214,7 +232,7 @@

nice_address_set_ipv6 ()

void                nice_address_set_ipv6               (NiceAddress *addr,
-                                                         const guchar *addr_ipv6);
+ const guchar *addr_ipv6);

Set addr to an IPv6 address using the data from addr_ipv6

@@ -229,8 +247,11 @@

-

addr :

+
+++ @@ -247,12 +268,15 @@

nice_address_set_port ()

void                nice_address_set_port               (NiceAddress *addr,
-                                                         guint port);
+ guint port);

Set the port of addr to port

-

addr :

+
+++ @@ -268,12 +292,15 @@

nice_address_get_port ()

-
guint               nice_address_get_port               (const NiceAddress *addr);
+
guint               nice_address_get_port               (const NiceAddress *addr);

Retreive the port of addr

-

addr :

+
+++ @@ -290,13 +317,16 @@

nice_address_set_from_string ()

-
gboolean            nice_address_set_from_string        (NiceAddress *addr,
-                                                         const gchar *str);
+
gboolean            nice_address_set_from_string        (NiceAddress *addr,
+                                                         const gchar *str);

Sets an IPv4 or IPv6 address from the string str

-

addr :

+
+++ @@ -309,7 +339,7 @@ +TRUE if success, FALSE on error

addr :

Returns :

-TRUE if success, FALSE on error
@@ -322,8 +352,11 @@

Sets an IPv4 or IPv6 address from the sockaddr structure sin

-
+
+++ @@ -344,8 +377,11 @@

Fills the sockaddr structure sin with the address contained in addr

-

addr :

+
+++ @@ -361,13 +397,16 @@

nice_address_equal ()

-
gboolean            nice_address_equal                  (const NiceAddress *a,
+
gboolean            nice_address_equal                  (const NiceAddress *a,
                                                          const NiceAddress *b);

Compares two NiceAddress structures to see if they contain the same address

-

addr :

+
+++ @@ -380,7 +419,7 @@ +TRUE if a and b are the same address, FALSE if they are different

a :

Returns :

-TRUE if a and b are the same address, FALSE if they are different
@@ -389,12 +428,15 @@

nice_address_to_string ()

void                nice_address_to_string              (const NiceAddress *addr,
-                                                         gchar *dst);
+ gchar *dst);

Transforms the address addr into a human readable string

-
+
+++ @@ -410,12 +452,15 @@

nice_address_is_private ()

-
gboolean            nice_address_is_private             (const NiceAddress *addr);
+
gboolean            nice_address_is_private             (const NiceAddress *addr);

Verifies if the address in addr is a private address or not

-

addr :

+
+++ @@ -424,7 +469,7 @@ +TRUE if addr is a private address, FALSE otherwise

addr :

Returns :

-TRUE if addr is a private address, FALSE otherwise
@@ -432,12 +477,15 @@

nice_address_is_valid ()

-
gboolean            nice_address_is_valid               (const NiceAddress *addr);
+
gboolean            nice_address_is_valid               (const NiceAddress *addr);

Validate whether the NiceAddress addr is a valid IPv4 or IPv6 address

-
+
+++ @@ -446,7 +494,7 @@ +TRUE if addr is valid, FALSE otherwise

addr :

Returns :

-TRUE if addr is valid, FALSE otherwise
@@ -458,8 +506,11 @@

Returns the IP version of the address

-
+
+++ @@ -476,6 +527,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-NiceCandidate.html libnice-0.1.7/docs/reference/libnice/html/libnice-NiceCandidate.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-NiceCandidate.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-NiceCandidate.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ NiceCandidate - + - + @@ -95,8 +95,11 @@

-

addr :

+
+++ @@ -115,29 +118,29 @@ - + - + - + - + - + - + @@ -148,7 +151,7 @@ - + @@ -167,8 +170,11 @@

An enum represneting the type of a candidate

-

NiceCandidateType type;

The NiceAddress of the base address used by the candidate

guint32 priority;

guint32 priority;

The priority of the candidate see note

guint stream_id;

guint stream_id;

The ID of the stream to which belongs the candidate

guint component_id;

guint component_id;

The ID of the component to which belongs the candidate

gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION];

gchar foundation[NICE_CANDIDATE_MAX_FOUNDATION];

The foundation of the candidate

gchar *username;

gchar *username;

The candidate-specific username to use (overrides the one set by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())

gchar *password;

gchar *password;

The candidate-specific password to use (overrides the one set by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())

gpointer sockptr;

gpointer sockptr;

The underlying socket
+
+++ @@ -203,8 +209,11 @@

An enum representing the type of transport to use

-

NICE_CANDIDATE_TYPE_HOST

+
+++

NICE_CANDIDATE_TRANSPORT_UDP

UDP transport @@ -216,6 +225,8 @@

struct TurnServer

struct TurnServer {
+  gint ref_count;
+
   NiceAddress server;       /**< TURN server address */
   gchar *username;           /**< TURN username */
   gchar *password;           /**< TURN password */
@@ -225,19 +236,26 @@
 

A structure to store the TURN relay settings

-
+
+++ + + + + - + - + @@ -259,8 +277,11 @@

An enum representing the type of relay to use

-

gint ref_count;

NiceAddress server;

The NiceAddress of the TURN server

gchar *username;

gchar *username;

The TURN username

gchar *password;

gchar *password;

The TURN password
+
+++ @@ -296,8 +317,11 @@

Creates a new candidate. Must be freed with nice_candidate_free()

-

NICE_RELAY_TYPE_TURN_UDP

+
+++ @@ -318,8 +342,11 @@

Frees a NiceCandidate

-

type :

+
+++ @@ -333,8 +360,11 @@

Makes a copy of a NiceCandidate

-

candidate :

The candidate to free
+
+++ @@ -356,6 +386,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-Pseudo-TCP-Socket.html libnice-0.1.7/docs/reference/libnice/html/libnice-Pseudo-TCP-Socket.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-Pseudo-TCP-Socket.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-Pseudo-TCP-Socket.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,11 +3,12 @@ Pseudo TCP Socket - + - + + @@ -17,7 +18,7 @@ - + - +

candidate :

Up Home libnice Reference Manual Next
Top @@ -52,42 +53,53 @@ enum PseudoTcpWriteResult; PseudoTcpCallbacks; enum PseudoTcpDebugLevel; -PseudoTcpSocket * pseudo_tcp_socket_new (guint32 conversation, +PseudoTcpSocket * pseudo_tcp_socket_new (guint32 conversation, PseudoTcpCallbacks *callbacks); -gboolean pseudo_tcp_socket_connect (PseudoTcpSocket *self); -gint pseudo_tcp_socket_recv (PseudoTcpSocket *self, +gboolean pseudo_tcp_socket_connect (PseudoTcpSocket *self); +gint pseudo_tcp_socket_recv (PseudoTcpSocket *self, char *buffer, size_t len); -gint pseudo_tcp_socket_send (PseudoTcpSocket *self, +gint pseudo_tcp_socket_send (PseudoTcpSocket *self, const char *buffer, - guint32 len); + guint32 len); void pseudo_tcp_socket_close (PseudoTcpSocket *self, - gboolean force); + gboolean force); int pseudo_tcp_socket_get_error (PseudoTcpSocket *self); -gboolean pseudo_tcp_socket_get_next_clock (PseudoTcpSocket *self, - long *timeout); +gboolean pseudo_tcp_socket_get_next_clock (PseudoTcpSocket *self, + guint64 *timeout); void pseudo_tcp_socket_notify_clock (PseudoTcpSocket *self); void pseudo_tcp_socket_notify_mtu (PseudoTcpSocket *self, - guint16 mtu); -gboolean pseudo_tcp_socket_notify_packet (PseudoTcpSocket *self, - const gchar *buffer, - guint32 len); + guint16 mtu); +gboolean pseudo_tcp_socket_notify_packet (PseudoTcpSocket *self, + const gchar *buffer, + guint32 len); void pseudo_tcp_set_debug_level (PseudoTcpDebugLevel level); +gint pseudo_tcp_socket_get_available_bytes + (PseudoTcpSocket *self); +gboolean pseudo_tcp_socket_can_send (PseudoTcpSocket *self); +gsize pseudo_tcp_socket_get_available_send_space + (PseudoTcpSocket *self); +gboolean pseudo_tcp_socket_notify_message (PseudoTcpSocket *self, + NiceInputMessage *message);

Object Hierarchy

-  GObject
+  GObject
    +----PseudoTcpSocket
 

Properties

-  "callbacks"                gpointer              : Read / Write
-  "conversation"             guint                 : Read / Write / Construct Only
-  "state"                    guint                 : Read
+  "ack-delay"                guint                 : Read / Write
+  "callbacks"                gpointer              : Read / Write
+  "conversation"             guint                 : Read / Write / Construct Only
+  "no-delay"                 gboolean              : Read / Write
+  "rcv-buf"                  guint                 : Read / Write
+  "snd-buf"                  guint                 : Read / Write
+  "state"                    guint                 : Read
 
@@ -130,8 +142,11 @@

See also: "state"

-
+
+++ @@ -180,8 +195,11 @@

See also: PseudoTcpCallbacks:WritePacket

-

TCP_LISTEN

+
+++ @@ -223,11 +241,14 @@

See also: PseudoTcpWriteResult

-

WR_SUCCESS

+
+++ - + @@ -266,8 +287,11 @@

Valid values of debug levels to be set.

-

gpointer user_data;

gpointer user_data;

A user defined pointer to be passed to the callbacks
+
+++ @@ -291,7 +315,7 @@

pseudo_tcp_socket_new ()

-
PseudoTcpSocket *   pseudo_tcp_socket_new               (guint32 conversation,
+
PseudoTcpSocket *   pseudo_tcp_socket_new               (guint32 conversation,
                                                          PseudoTcpCallbacks *callbacks);

Creates a new PseudoTcpSocket for the specified conversation @@ -311,8 +335,11 @@

-

PSEUDO_TCP_DEBUG_NONE

+
+++ @@ -325,7 +352,7 @@ - +

conversation :

Returns :

The new PseudoTcpSocket object, NULL on errorThe new PseudoTcpSocket object, NULL on error
@@ -334,14 +361,17 @@

pseudo_tcp_socket_connect ()

-
gboolean            pseudo_tcp_socket_connect           (PseudoTcpSocket *self);
+
gboolean            pseudo_tcp_socket_connect           (PseudoTcpSocket *self);

Connects the PseudoTcpSocket to the peer with the same conversation id. The connection will only be successful after the PseudoTcpCallbacks:PseudoTcpOpened callback is called

-
+
+++ @@ -350,7 +380,7 @@ @@ -361,7 +391,7 @@

pseudo_tcp_socket_recv ()

-
gint                pseudo_tcp_socket_recv              (PseudoTcpSocket *self,
+
gint                pseudo_tcp_socket_recv              (PseudoTcpSocket *self,
                                                          char *buffer,
                                                          size_t len);

@@ -382,8 +412,11 @@

-

self :

Returns :

-TRUE on success, FALSE on failure (not in TCP_LISTEN state) +TRUE on success, FALSE on failure (not in TCP_LISTEN state)

See also: pseudo_tcp_socket_get_error()

+
+++ @@ -411,9 +444,9 @@

pseudo_tcp_socket_send ()

-
gint                pseudo_tcp_socket_send              (PseudoTcpSocket *self,
+
gint                pseudo_tcp_socket_send              (PseudoTcpSocket *self,
                                                          const char *buffer,
-                                                         guint32 len);
+ guint32 len);

Send data on the socket.

@@ -429,8 +462,11 @@

-

self :

+
+++ @@ -459,9 +495,9 @@

pseudo_tcp_socket_close ()

void                pseudo_tcp_socket_close             (PseudoTcpSocket *self,
-                                                         gboolean force);
+ gboolean force);

-Close the socket. IF force is set to FALSE, the socket will finish sending +Close the socket. IF force is set to FALSE, the socket will finish sending pending data before closing.

@@ -482,8 +518,11 @@

See also: pseudo_tcp_socket_get_next_clock()

-

self :

+
+++ @@ -492,7 +531,7 @@ +TRUE to close the socket forcefully, FALSE to close it gracefully

self :

force :

-TRUE to close the socket forcefully, FALSE to close it gracefully
@@ -526,8 +565,11 @@

-
+
+++ @@ -548,14 +590,17 @@

pseudo_tcp_socket_get_next_clock ()

-
gboolean            pseudo_tcp_socket_get_next_clock    (PseudoTcpSocket *self,
-                                                         long *timeout);
+
gboolean            pseudo_tcp_socket_get_next_clock    (PseudoTcpSocket *self,
+                                                         guint64 *timeout);

Call this to determine the timeout needed before the next time call to pseudo_tcp_socket_notify_clock() should be made.

-

self :

+
+++ @@ -568,7 +613,7 @@ @@ -592,8 +637,11 @@

See also: pseudo_tcp_socket_get_next_clock()

-

self :

Returns :

-TRUE if timeout was filled, FALSE if the socket is closed and +TRUE if timeout was filled, FALSE if the socket is closed and ready to be destroyed.

See also: pseudo_tcp_socket_notify_clock()

+
+++ @@ -605,12 +653,15 @@

pseudo_tcp_socket_notify_mtu ()

void                pseudo_tcp_socket_notify_mtu        (PseudoTcpSocket *self,
-                                                         guint16 mtu);
+ guint16 mtu);

Set the MTU of the socket

-

self :

The PseudoTcpSocket object.
+
+++ @@ -627,14 +678,17 @@

pseudo_tcp_socket_notify_packet ()

-
gboolean            pseudo_tcp_socket_notify_packet     (PseudoTcpSocket *self,
-                                                         const gchar *buffer,
-                                                         guint32 len);
+
gboolean            pseudo_tcp_socket_notify_packet     (PseudoTcpSocket *self,
+                                                         const gchar *buffer,
+                                                         guint32 len);

Notify the PseudoTcpSocket when a new packet arrives

-

self :

+
+++ @@ -652,7 +706,7 @@ +TRUE if the packet was processed successfully, FALSE otherwise

self :

Returns :

-TRUE if the packet was processed successfully, FALSE otherwise
@@ -665,8 +719,11 @@

Sets the debug level to enable/disable normal/verbose debug messages.

-
+
+++ @@ -674,25 +731,166 @@

level :

The level of debug to set

Since 0.0.11

+
+
+

pseudo_tcp_socket_get_available_bytes ()

+
gint                pseudo_tcp_socket_get_available_bytes
+                                                        (PseudoTcpSocket *self);
+

+Gets the number of bytes of data in the buffer that can be read without +receiving more packets from the network. +

+
++++ + + + + + + + + + + +

self :

The PseudoTcpSocket object.

Returns :

The number of bytes or -1 if the connection is not established
+

Since 0.1.5

+
+
+
+

pseudo_tcp_socket_can_send ()

+
gboolean            pseudo_tcp_socket_can_send          (PseudoTcpSocket *self);
+

+Returns if there is space in the send buffer to send any data. +

+
++++ + + + + + + + + + + +

self :

The PseudoTcpSocket object.

Returns :

+TRUE if data can be sent, FALSE otherwise
+

Since 0.1.5

+
+
+
+

pseudo_tcp_socket_get_available_send_space ()

+
gsize               pseudo_tcp_socket_get_available_send_space
+                                                        (PseudoTcpSocket *self);
+

+Gets the number of bytes of space available in the transmission buffer. +

+
++++ + + + + + + + + + + +

self :

The PseudoTcpSocket object.

Returns :

The numbero f bytes, or 0 if the connection is not established.
+

Since 0.1.5

+
+
+
+

pseudo_tcp_socket_notify_message ()

+
gboolean            pseudo_tcp_socket_notify_message    (PseudoTcpSocket *self,
+                                                         NiceInputMessage *message);
+

+Notify the PseudoTcpSocket that a new message has arrived, and enqueue the +data in its buffers to the PseudoTcpSocket’s receive buffer. +

+
++++ + + + + + + + + + + + + + + +

self :

The PseudoTcpSocket object.

message :

A NiceInputMessage containing the received data.

Returns :

+TRUE if the packet was processed successfully, FALSE otherwise
+

Since 0.1.5

+

Property Details

+

The "ack-delay" property

+
  "ack-delay"                guint                 : Read / Write
+

Delayed ACK timeout (in milliseconds).

+

Default value: 100

+
+
+

The "callbacks" property

-
  "callbacks"                gpointer              : Read / Write
+
  "callbacks"                gpointer              : Read / Write

Structure with the callbacks to call when PseudoTcp events happen.


The "conversation" property

-
  "conversation"             guint                 : Read / Write / Construct Only
+
  "conversation"             guint                 : Read / Write / Construct Only

The TCP Conversation ID.

Default value: 0


+

The "no-delay" property

+
  "no-delay"                 gboolean              : Read / Write
+

Disable the Nagle algorithm (like the TCP_NODELAY option).

+

Default value: FALSE

+
+
+
+

The "rcv-buf" property

+
  "rcv-buf"                  guint                 : Read / Write
+

Receive Buffer size.

+

Allowed values: >= 1

+

Default value: 61440

+
+
+
+

The "snd-buf" property

+
  "snd-buf"                  guint                 : Read / Write
+

Send Buffer size.

+

Allowed values: >= 1

+

Default value: 92160

+
+
+

The "state" property

-
  "state"                    guint                 : Read
+
  "state"                    guint                 : Read

The current state (enum PseudoTcpState) of the PseudoTcp socket.

Allowed values: <= 4

Default value: 0

@@ -701,6 +899,6 @@
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-StunAgent.html libnice-0.1.7/docs/reference/libnice/html/libnice-StunAgent.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-StunAgent.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-StunAgent.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ StunAgent - + - + @@ -146,8 +146,11 @@

Enum that specifies the STUN compatibility mode of the StunAgent

-
+
+++ @@ -207,8 +210,11 @@

See also: stun_agent_validate()

-

STUN_COMPATIBILITY_RFC3489

+
+++ @@ -291,8 +297,11 @@ This enum is used as the return value of stun_agent_validate() and represents the status result of the validation of a STUN message.

-

STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS

+
+++ @@ -369,8 +378,11 @@

See also: stun_agent_validate()

-

STUN_VALIDATION_SUCCESS

+
+++ @@ -408,8 +420,8 @@ +TRUE if the authentication was successful, +FALSE if the authentication failed

agent :

Returns :

-TRUE if the authentication was successful, -FALSE if the authentication failed
@@ -432,8 +444,11 @@

See also: stun_agent_default_validater()

-
+
+++ @@ -486,8 +501,11 @@

-

uint8_t *username;

+
+++ @@ -533,8 +551,11 @@

See also: stun_agent_default_validater()

-

agent :

+
+++ @@ -613,8 +634,11 @@

See also: stun_agent_validate()

-

agent :

+
+++ @@ -653,8 +677,8 @@ +TRUE if the authentication was successful, +FALSE if the authentication failed

agent :

Returns :

-TRUE if the authentication was successful, -FALSE if the authentication failed
@@ -670,8 +694,11 @@

Creates a new STUN message of class STUN_REQUEST and with the method m

-
+
+++ @@ -698,7 +725,7 @@ +TRUE if the message was initialized correctly, FALSE otherwise

agent :

Returns :

-TRUE if the message was initialized correctly, FALSE otherwise
@@ -714,8 +741,11 @@

Creates a new STUN message of class STUN_INDICATION and with the method m

-
+
+++ @@ -742,7 +772,7 @@ +TRUE if the message was initialized correctly, FALSE otherwise

agent :

Returns :

-TRUE if the message was initialized correctly, FALSE otherwise
@@ -761,8 +791,11 @@ to the key that was used to authenticate the request, so you won't need to specify the key with stun_agent_finish_message()

-
+
+++ @@ -789,7 +822,7 @@ +TRUE if the message was initialized correctly, FALSE otherwise

agent :

Returns :

-TRUE if the message was initialized correctly, FALSE otherwise
@@ -811,8 +844,11 @@ It will then add the ERROR-CODE attribute with code err and the associated string.

-
+
+++ @@ -844,7 +880,7 @@ +TRUE if the message was initialized correctly, FALSE otherwise

agent :

Returns :

-TRUE if the message was initialized correctly, FALSE otherwise
@@ -866,8 +902,11 @@ STUN_ATTRIBUTE_UNKNOWN_ATTRIBUTES attribute, it will then finish the message by calling stun_agent_finish_message()

-
+
+++ @@ -914,8 +953,11 @@

See also: stun_agent_forget_transaction()

-

agent :

+
+++ @@ -978,8 +1020,11 @@

-

agent :

+
+++ @@ -993,7 +1038,7 @@ +TRUE if the transaction was found, FALSE otherwise

agent :

Returns :

-TRUE if the transaction was found, FALSE otherwise
@@ -1031,8 +1076,11 @@

-
+
+++ @@ -1071,6 +1119,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-STUN-Constants.html libnice-0.1.7/docs/reference/libnice/html/libnice-STUN-Constants.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-STUN-Constants.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-STUN-Constants.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,248 @@ + + + + +STUN Constants + + + + + + + + + +

agent :

+ + + + + + + + + +
+
+
+ + +
+

STUN Constants

+

STUN Constants

+
+ +
+

Description

+

+

+
+
+

Details

+
+

STUN_AGENT_MAX_SAVED_IDS

+
#define STUN_AGENT_MAX_SAVED_IDS 200
+
+

+

+
+
+
+

STUN_AGENT_MAX_UNKNOWN_ATTRIBUTES

+
#define STUN_AGENT_MAX_UNKNOWN_ATTRIBUTES 256
+
+

+

+
+
+
+

STUN_ATTRIBUTE_HEADER_LENGTH

+
#define STUN_ATTRIBUTE_HEADER_LENGTH STUN_ATTRIBUTE_VALUE_POS
+
+

+

+
+
+
+

STUN_ATTRIBUTE_LENGTH_LEN

+
#define STUN_ATTRIBUTE_LENGTH_LEN 2
+
+

+

+
+
+
+

STUN_ATTRIBUTE_LENGTH_POS

+
#define             STUN_ATTRIBUTE_LENGTH_POS
+

+

+
+
+
+

STUN_ATTRIBUTE_TYPE_LEN

+
#define STUN_ATTRIBUTE_TYPE_LEN 2
+
+

+

+
+
+
+

STUN_ATTRIBUTE_TYPE_POS

+
#define STUN_ATTRIBUTE_TYPE_POS 0
+
+

+

+
+
+
+

STUN_ATTRIBUTE_VALUE_POS

+
#define             STUN_ATTRIBUTE_VALUE_POS
+

+

+
+
+
+

STUN_ID_LEN

+
#define STUN_ID_LEN 16
+
+

+

+
+
+
+

STUN_MAGIC_COOKIE

+
#define STUN_MAGIC_COOKIE 0x2112A442
+
+

+

+
+
+
+

STUN_MAX_MESSAGE_SIZE

+
#define STUN_MAX_MESSAGE_SIZE 65552
+
+

+The Maximum size of a STUN message +

+
+
+
+

STUN_MAX_MESSAGE_SIZE_IPV4

+
#define STUN_MAX_MESSAGE_SIZE_IPV4 576
+
+

+

+
+
+
+

STUN_MAX_MESSAGE_SIZE_IPV6

+
#define STUN_MAX_MESSAGE_SIZE_IPV6 1280
+
+

+

+
+
+
+

STUN_MESSAGE_ATTRIBUTES_POS

+
#define             STUN_MESSAGE_ATTRIBUTES_POS
+

+

+
+
+
+

STUN_MESSAGE_HEADER_LENGTH

+
#define STUN_MESSAGE_HEADER_LENGTH STUN_MESSAGE_ATTRIBUTES_POS
+
+

+

+
+
+
+

STUN_MESSAGE_LENGTH_LEN

+
#define STUN_MESSAGE_LENGTH_LEN 2
+
+

+

+
+
+
+

STUN_MESSAGE_LENGTH_POS

+
#define             STUN_MESSAGE_LENGTH_POS
+

+

+
+
+
+

STUN_MESSAGE_TRANS_ID_LEN

+
#define STUN_MESSAGE_TRANS_ID_LEN 16
+
+

+

+
+
+
+

STUN_MESSAGE_TRANS_ID_POS

+
#define             STUN_MESSAGE_TRANS_ID_POS
+

+

+
+
+
+

STUN_MESSAGE_TYPE_LEN

+
#define STUN_MESSAGE_TYPE_LEN 2
+
+

+

+
+
+
+

STUN_MESSAGE_TYPE_POS

+
#define STUN_MESSAGE_TYPE_POS 0
+
+

+

+
+
+
+

TURN_MAGIC_COOKIE

+
#define TURN_MAGIC_COOKIE 0x72c64bc6
+
+

+

+
+
+
+ + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-StunMessage.html libnice-0.1.7/docs/reference/libnice/html/libnice-StunMessage.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-StunMessage.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-StunMessage.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ StunMessage - + - - + + @@ -18,7 +18,7 @@
Up Home libnice Reference ManualNextNext
Top @@ -75,15 +75,15 @@ size_t buflen); StunMessageReturn stun_message_find_addr (const StunMessage *msg, StunAttribute type, - struct sockaddr *addr, + struct sockaddr_storage *addr, socklen_t *addrlen); StunMessageReturn stun_message_find_xor_addr (const StunMessage *msg, StunAttribute type, - struct sockaddr *addr, + struct sockaddr_storage *addr, socklen_t *addrlen); StunMessageReturn stun_message_find_xor_addr_full (const StunMessage *msg, StunAttribute type, - struct sockaddr *addr, + struct sockaddr_storage *addr, socklen_t *addrlen, uint32_t magic_cookie); StunMessageReturn stun_message_find_error (const StunMessage *msg, @@ -112,11 +112,11 @@ socklen_t addrlen); StunMessageReturn stun_message_append_xor_addr (StunMessage *msg, StunAttribute type, - const struct sockaddr *addr, + const struct sockaddr_storage *addr, socklen_t addrlen); StunMessageReturn stun_message_append_xor_addr_full (StunMessage *msg, StunAttribute type, - const struct sockaddr *addr, + const struct sockaddr_storage *addr, socklen_t addrlen, uint32_t magic_cookie); StunMessageReturn stun_message_append_error (StunMessage *msg, @@ -124,6 +124,12 @@ int stun_message_validate_buffer_length (const uint8_t *msg, size_t length, bool has_padding); + StunInputVector; +ssize_t stun_message_validate_buffer_length_fast + (StunInputVector *buffers, + unsigned int n_buffers, + size_t total_length, + bool has_padding); void stun_message_id (const StunMessage *msg, StunTransactionId id); StunClass stun_message_get_class (const StunMessage *msg); @@ -159,8 +165,11 @@

This structure represents a STUN message

-
+
+++ @@ -210,8 +219,11 @@ This enum is used to represent the class of a STUN message, as defined in RFC5389

-

StunAgent *agent;

+
+++ @@ -259,8 +271,11 @@ This enum is used to represent the method of a STUN message, as defined by various RFCs

-

STUN_REQUEST

+
+++ @@ -417,8 +432,11 @@

Known STUN attribute types as defined by various RFCs and drafts

-

STUN_BINDING

+
+++ @@ -738,8 +756,11 @@

STUN error codes as defined by various RFCs and drafts

-

STUN_ATTRIBUTE_MAPPED_ADDRESS

+
+++ @@ -880,8 +901,11 @@ This enum will report on whether an operation was successful or not and what error occured if any.

-

STUN_ERROR_TRY_ALTERNATE

+
+++ @@ -944,8 +968,11 @@

Initializes a STUN message buffer, with no attributes.

-

STUN_MESSAGE_RETURN_SUCCESS

+
+++ @@ -966,7 +993,7 @@ +TRUE if the initialization was successful

msg :

Returns :

-TRUE if the initialization was successful
@@ -978,8 +1005,11 @@

Get the length of the message (including the header)

-
+
+++ @@ -1002,8 +1032,11 @@

Finds an attribute in a STUN message and fetches its content

-

msg :

+
+++ @@ -1034,8 +1067,11 @@

Looks for a flag attribute within a valid STUN message.

-

msg :

+
+++ @@ -1063,8 +1099,11 @@

Extracts a 32-bits attribute from a STUN message.

-

msg :

+
+++ @@ -1097,8 +1136,11 @@

Extracts a 64-bits attribute from a STUN message.

-

msg :

+
+++ @@ -1132,8 +1174,11 @@

Extracts an UTF-8 string from a valid STUN message.

-

msg :

+
+++ @@ -1175,13 +1220,16 @@

stun_message_find_addr ()

StunMessageReturn   stun_message_find_addr              (const StunMessage *msg,
                                                          StunAttribute type,
-                                                         struct sockaddr *addr,
+                                                         struct sockaddr_storage *addr,
                                                          socklen_t *addrlen);

Extracts a network address attribute from a STUN message.

-

msg :

+
+++ @@ -1217,13 +1265,16 @@

stun_message_find_xor_addr ()

StunMessageReturn   stun_message_find_xor_addr          (const StunMessage *msg,
                                                          StunAttribute type,
-                                                         struct sockaddr *addr,
+                                                         struct sockaddr_storage *addr,
                                                          socklen_t *addrlen);

Extracts an obfuscated network address attribute from a STUN message.

-

msg :

+
+++ @@ -1259,14 +1310,17 @@

stun_message_find_xor_addr_full ()

StunMessageReturn   stun_message_find_xor_addr_full     (const StunMessage *msg,
                                                          StunAttribute type,
-                                                         struct sockaddr *addr,
+                                                         struct sockaddr_storage *addr,
                                                          socklen_t *addrlen,
                                                          uint32_t magic_cookie);

Extracts an obfuscated network address attribute from a STUN message.

-

msg :

+
+++ @@ -1309,8 +1363,11 @@

Extract the error response code from a STUN message

-

msg :

+
+++ @@ -1338,8 +1395,11 @@

Reserves room for appending an attribute to an unfinished STUN message.

-

msg :

+
+++ @@ -1373,8 +1433,11 @@

Appends a binary value to a STUN message

-

msg :

+
+++ @@ -1408,8 +1471,11 @@

Appends an empty flag attribute to a STUN message

-

msg :

+
+++ @@ -1436,8 +1502,11 @@

Appends a 32-bits value attribute to a STUN message

-

msg :

+
+++ @@ -1468,8 +1537,11 @@

Appends a 64-bits value attribute to a STUN message

-

msg :

+
+++ @@ -1500,8 +1572,11 @@

Adds an attribute from a NULL-terminated string to a STUN message

-

msg :

+
+++ @@ -1533,8 +1608,11 @@

Append a network address attribute to a STUN message

-

msg :

+
+++ @@ -1567,13 +1645,16 @@

stun_message_append_xor_addr ()

StunMessageReturn   stun_message_append_xor_addr        (StunMessage *msg,
                                                          StunAttribute type,
-                                                         const struct sockaddr *addr,
+                                                         const struct sockaddr_storage *addr,
                                                          socklen_t addrlen);

Append an obfuscated network address attribute to a STUN message

-

msg :

+
+++ @@ -1606,14 +1687,17 @@

stun_message_append_xor_addr_full ()

StunMessageReturn   stun_message_append_xor_addr_full   (StunMessage *msg,
                                                          StunAttribute type,
-                                                         const struct sockaddr *addr,
+                                                         const struct sockaddr_storage *addr,
                                                          socklen_t addrlen,
                                                          uint32_t magic_cookie);

Append an obfuscated network address attribute from a STUN message.

-

msg :

+
+++ @@ -1654,8 +1738,11 @@ Appends the ERROR-CODE attribute to the STUN message and fills it according to code

-

msg :

+
+++ @@ -1684,8 +1771,11 @@ a STUN message or if it's not or if it's an incomplete STUN message and will provide us with the length of the STUN message.

-

msg :

+
+++ @@ -1711,14 +1801,111 @@
+

StunInputVector

+
typedef struct {
+  const uint8_t *buffer;
+  size_t size;
+} StunInputVector;
+
+

+Container for a single buffer which also stores its length. This is designed +for vectored I/O: typically an array of StunInputVectors is passed to +functions, providing multiple buffers which store logically contiguous +received data. +

+

+This is guaranteed to be layed out identically in memory to GInputVector. +

+

msg :

++++ + + + + + + + + + + +

const uint8_t *buffer;

a buffer containing already-received binary data

size_t size;

length of buffer, in bytes
+

Since 0.1.5

+ +
+
+

stun_message_validate_buffer_length_fast ()

+
ssize_t             stun_message_validate_buffer_length_fast
+                                                        (StunInputVector *buffers,
+                                                         unsigned int n_buffers,
+                                                         size_t total_length,
+                                                         bool has_padding);
+

+Quickly validate whether the message in the given buffers is potentially a +valid STUN message, an incomplete STUN message, or if it’s definitely not one +at all. +

+

+This is designed as a first-pass validation only, and does not check the +message’s attributes for validity. If this function returns success, the +buffers can be compacted and a more thorough validation can be performed +using stun_message_validate_buffer_length(). If it fails, the buffers +definitely do not contain a complete, valid STUN message. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + +

buffers :

array of contiguous +StunInputVectors containing already-received message data. [array length=n_buffers][in caller-allocated] +

n_buffers :

number of entries in buffers +

total_length :

total number of valid bytes stored consecutively in buffers +

has_padding :

+TRUE if attributes should be padded to 4-byte boundaries

Returns :

The length of the valid STUN message in the buffer, or zero or -1 on +failure +

See also: STUN_MESSAGE_BUFFER_INCOMPLETE

+

See also: STUN_MESSAGE_BUFFER_INVALID

+
+

Since 0.1.5

+
+
+

stun_message_id ()

void                stun_message_id                     (const StunMessage *msg,
                                                          StunTransactionId id);

Retreive the STUN transaction id from a STUN message

-
+
+++ @@ -1739,8 +1926,11 @@

Retreive the STUN class from a STUN message

-

msg :

+
+++ @@ -1762,8 +1952,11 @@

Retreive the STUN method from a STUN message

-

msg :

+
+++ @@ -1786,8 +1979,11 @@

Checks if an attribute is present within a STUN message.

-

msg :

+
+++ @@ -1801,7 +1997,7 @@ +TRUE if the attribute is found, FALSE otherwise

msg :

Returns :

-TRUE if the attribute is found, FALSE otherwise
@@ -1813,8 +2009,11 @@

Checks if the STUN message has a RFC5389 compatible cookie

-
+
+++ @@ -1824,7 +2023,7 @@ +TRUE if the cookie is present, FALSE otherwise

msg :

Returns :

-TRUE if the cookie is present, FALSE otherwise
@@ -1837,8 +2036,11 @@ Helper function that checks whether a STUN attribute is a mandatory or an optional attribute

-
+
+++ @@ -1847,7 +2049,7 @@ +TRUE if the attribute is an optional one

t :

Returns :

-TRUE if the attribute is an optional one
@@ -1859,8 +2061,11 @@

Transforms a STUN error-code into a human readable string

-
+
+++ @@ -1881,6 +2086,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-Timer.html libnice-0.1.7/docs/reference/libnice/html/libnice-Timer.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-Timer.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-Timer.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Timer - + - + @@ -68,7 +68,7 @@

-

Example 3. Simple example on how to use the timer usage

+

Example 3. Simple example on how to use the timer usage

code :

@@ -193,8 +193,11 @@ Return value of stun_usage_timer_refresh() which provides you with status information on the timer.

-
+
+++ @@ -274,8 +277,11 @@

See also: STUN_TIMER_DEFAULT_MAX_RETRANSMISSIONS

-

STUN_USAGE_TIMER_RETURN_SUCCESS

+
+++ @@ -303,8 +309,11 @@ This should be called as soon as you send the message for the first time on a TCP socket

-

timer :

+
+++ @@ -318,8 +327,11 @@

Updates a STUN transaction retransmission timer.

-

timer :

The StunTimer to start
+
+++ @@ -339,8 +351,11 @@

Query the timer on the time left before the next refresh should be done

-

timer :

+
+++ @@ -357,6 +372,6 @@ + Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/libnice-TURN.html libnice-0.1.7/docs/reference/libnice/html/libnice-TURN.html --- libnice-0.1.4/docs/reference/libnice/html/libnice-TURN.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/libnice-TURN.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ TURN - + - + @@ -72,11 +72,11 @@ size_t password_len, StunUsageTurnCompatibility compatibility); StunUsageTurnReturnstun_usage_turn_process (StunMessage *msg, - struct sockaddr *relay_addr, + struct sockaddr_storage *relay_addr, socklen_t *relay_addrlen, - struct sockaddr *addr, + struct sockaddr_storage *addr, socklen_t *addrlen, - struct sockaddr *alternate_server, + struct sockaddr_storage *alternate_server, socklen_t *alternate_server_len, uint32_t *bandwidth, uint32_t *lifetime, @@ -84,6 +84,20 @@ StunUsageTurnReturnstun_usage_turn_refresh_process (StunMessage *msg, uint32_t *lifetime, StunUsageTurnCompatibility compatibility); +size_tstun_usage_turn_create_permission (StunAgent *agent, + StunMessage *msg, + uint8_t *buffer, + size_t buffer_len, + uint8_t *username, + size_t username_len, + uint8_t *password, + size_t password_len, + uint8_t *realm, + size_t realm_len, + uint8_t *nonce, + size_t nonce_len, + struct sockaddr_storage *peer, + StunUsageTurnCompatibility compatibility);
@@ -110,8 +124,11 @@

Specifies which TURN specification compatibility to use

-

timer :

+
+++ @@ -157,8 +174,11 @@ This enum is used to specify which port configuration you want when creating a new Allocation

-

STUN_USAGE_TURN_COMPATIBILITY_DRAFT9

+
+++ @@ -195,8 +215,11 @@ stun_usage_turn_refresh_process() which allows you to see what status the function call returned.

-

STUN_USAGE_TURN_REQUEST_PORT_NORMAL

+
+++ @@ -248,8 +271,11 @@

Create a new TURN Allocation request

-

STUN_USAGE_TURN_RETURN_RELAY_SUCCESS

+
+++ @@ -349,8 +375,11 @@

Create a new TURN Refresh request

-

agent :

+
+++ @@ -419,11 +448,11 @@

stun_usage_turn_process ()

StunUsageTurnReturn stun_usage_turn_process             (StunMessage *msg,
-                                                         struct sockaddr *relay_addr,
+                                                         struct sockaddr_storage *relay_addr,
                                                          socklen_t *relay_addrlen,
-                                                         struct sockaddr *addr,
+                                                         struct sockaddr_storage *addr,
                                                          socklen_t *addrlen,
-                                                         struct sockaddr *alternate_server,
+                                                         struct sockaddr_storage *alternate_server,
                                                          socklen_t *alternate_server_len,
                                                          uint32_t *bandwidth,
                                                          uint32_t *lifetime,
@@ -432,8 +461,11 @@
 Process a TURN Allocate response and extract the necessary information from
 the message
 

-

agent :

+
+++ @@ -506,8 +538,11 @@ Process a TURN Refresh response and extract the necessary information from the message

-

msg :

+
+++ @@ -531,10 +566,30 @@

msg :

+
+
+

stun_usage_turn_create_permission ()

+
size_t              stun_usage_turn_create_permission   (StunAgent *agent,
+                                                         StunMessage *msg,
+                                                         uint8_t *buffer,
+                                                         size_t buffer_len,
+                                                         uint8_t *username,
+                                                         size_t username_len,
+                                                         uint8_t *password,
+                                                         size_t password_len,
+                                                         uint8_t *realm,
+                                                         size_t realm_len,
+                                                         uint8_t *nonce,
+                                                         size_t nonce_len,
+                                                         struct sockaddr_storage *peer,
+                                                         StunUsageTurnCompatibility compatibility);
+

+

+
+ Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/NiceAgent.html libnice-0.1.7/docs/reference/libnice/html/NiceAgent.html --- libnice-0.1.4/docs/reference/libnice/html/NiceAgent.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/NiceAgent.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ NiceAgent - + - + @@ -56,155 +56,207 @@ enum NiceProxyType; enum NiceCompatibility; void (*NiceAgentRecvFunc) (NiceAgent *agent, - guint stream_id, - guint component_id, - guint len, - gchar *buf, - gpointer user_data); + guint stream_id, + guint component_id, + guint len, + gchar *buf, + gpointer user_data); + NiceInputMessage; + NiceOutputMessage; #define NICE_AGENT_MAX_REMOTE_CANDIDATES -NiceAgent * nice_agent_new (GMainContext *ctx, +NiceAgent * nice_agent_new (GMainContext *ctx, NiceCompatibility compat); -NiceAgent * nice_agent_new_reliable (GMainContext *ctx, +NiceAgent * nice_agent_new_reliable (GMainContext *ctx, NiceCompatibility compat); -gboolean nice_agent_add_local_address (NiceAgent *agent, +gboolean nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr); void nice_agent_set_port_range (NiceAgent *agent, - guint stream_id, - guint component_id, - guint min_port, - guint max_port); -guint nice_agent_add_stream (NiceAgent *agent, - guint n_components); + guint stream_id, + guint component_id, + guint min_port, + guint max_port); +guint nice_agent_add_stream (NiceAgent *agent, + guint n_components); void nice_agent_remove_stream (NiceAgent *agent, - guint stream_id); -gboolean nice_agent_set_relay_info (NiceAgent *agent, - guint stream_id, - guint component_id, - const gchar *server_ip, - guint server_port, - const gchar *username, - const gchar *password, + guint stream_id); +gboolean nice_agent_set_relay_info (NiceAgent *agent, + guint stream_id, + guint component_id, + const gchar *server_ip, + guint server_port, + const gchar *username, + const gchar *password, NiceRelayType type); -gboolean nice_agent_gather_candidates (NiceAgent *agent, - guint stream_id); -gboolean nice_agent_set_remote_credentials (NiceAgent *agent, - guint stream_id, - const gchar *ufrag, - const gchar *pwd); -gboolean nice_agent_get_local_credentials (NiceAgent *agent, - guint stream_id, - gchar **ufrag, - gchar **pwd); +gboolean nice_agent_forget_relays (NiceAgent *agent, + guint stream_id, + guint component_id); +gboolean nice_agent_gather_candidates (NiceAgent *agent, + guint stream_id); +gboolean nice_agent_set_remote_credentials (NiceAgent *agent, + guint stream_id, + const gchar *ufrag, + const gchar *pwd); +gboolean nice_agent_get_local_credentials (NiceAgent *agent, + guint stream_id, + gchar **ufrag, + gchar **pwd); int nice_agent_set_remote_candidates (NiceAgent *agent, - guint stream_id, - guint component_id, - const GSList *candidates); -GSList * nice_agent_get_remote_candidates (NiceAgent *agent, - guint stream_id, - guint component_id); -GSList * nice_agent_get_local_candidates (NiceAgent *agent, - guint stream_id, - guint component_id); -gboolean nice_agent_get_selected_pair (NiceAgent *agent, - guint stream_id, - guint component_id, + guint stream_id, + guint component_id, + const GSList *candidates); +GSList * nice_agent_get_remote_candidates (NiceAgent *agent, + guint stream_id, + guint component_id); +GSList * nice_agent_get_local_candidates (NiceAgent *agent, + guint stream_id, + guint component_id); +gboolean nice_agent_get_selected_pair (NiceAgent *agent, + guint stream_id, + guint component_id, NiceCandidate **local, NiceCandidate **remote); -gint nice_agent_send (NiceAgent *agent, - guint stream_id, - guint component_id, - guint len, - const gchar *buf); -gboolean nice_agent_attach_recv (NiceAgent *agent, - guint stream_id, - guint component_id, - GMainContext *ctx, +gint nice_agent_send (NiceAgent *agent, + guint stream_id, + guint component_id, + guint len, + const gchar *buf); +gint nice_agent_send_messages_nonblocking + (NiceAgent *agent, + guint stream_id, + guint component_id, + const NiceOutputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error); +gssize nice_agent_recv (NiceAgent *agent, + guint stream_id, + guint component_id, + guint8 *buf, + gsize buf_len, + GCancellable *cancellable, + GError **error); +gint nice_agent_recv_messages (NiceAgent *agent, + guint stream_id, + guint component_id, + NiceInputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error); +gssize nice_agent_recv_nonblocking (NiceAgent *agent, + guint stream_id, + guint component_id, + guint8 *buf, + gsize buf_len, + GCancellable *cancellable, + GError **error); +gint nice_agent_recv_messages_nonblocking + (NiceAgent *agent, + guint stream_id, + guint component_id, + NiceInputMessage *messages, + guint n_messages, + GCancellable *cancellable, + GError **error); +gboolean nice_agent_attach_recv (NiceAgent *agent, + guint stream_id, + guint component_id, + GMainContext *ctx, NiceAgentRecvFunc func, - gpointer data); -gboolean nice_agent_set_selected_pair (NiceAgent *agent, - guint stream_id, - guint component_id, - const gchar *lfoundation, - const gchar *rfoundation); -gboolean nice_agent_set_selected_remote_candidate + gpointer data); +gboolean nice_agent_set_selected_pair (NiceAgent *agent, + guint stream_id, + guint component_id, + const gchar *lfoundation, + const gchar *rfoundation); +gboolean nice_agent_set_selected_remote_candidate (NiceAgent *agent, - guint stream_id, - guint component_id, + guint stream_id, + guint component_id, NiceCandidate *candidate); void nice_agent_set_stream_tos (NiceAgent *agent, - guint stream_id, - gint tos); + guint stream_id, + gint tos); void nice_agent_set_software (NiceAgent *agent, - const gchar *software); -gboolean nice_agent_restart (NiceAgent *agent); -gboolean nice_agent_set_stream_name (NiceAgent *agent, - guint stream_id, - const gchar *name); -const gchar * nice_agent_get_stream_name (NiceAgent *agent, - guint stream_id); + const gchar *software); +gboolean nice_agent_restart (NiceAgent *agent); +gboolean nice_agent_restart_stream (NiceAgent *agent, + guint stream_id); +gboolean nice_agent_set_stream_name (NiceAgent *agent, + guint stream_id, + const gchar *name); +const gchar * nice_agent_get_stream_name (NiceAgent *agent, + guint stream_id); NiceCandidate * nice_agent_get_default_local_candidate (NiceAgent *agent, - guint stream_id, - guint component_id); -gchar * nice_agent_generate_local_sdp (NiceAgent *agent); -gchar * nice_agent_generate_local_stream_sdp + guint stream_id, + guint component_id); +gchar * nice_agent_generate_local_sdp (NiceAgent *agent); +gchar * nice_agent_generate_local_stream_sdp (NiceAgent *agent, - guint stream_id, - gboolean include_non_ice); -gchar * nice_agent_generate_local_candidate_sdp + guint stream_id, + gboolean include_non_ice); +gchar * nice_agent_generate_local_candidate_sdp (NiceAgent *agent, NiceCandidate *candidate); int nice_agent_parse_remote_sdp (NiceAgent *agent, - const gchar *sdp); -GSList * nice_agent_parse_remote_stream_sdp (NiceAgent *agent, - guint stream_id, - const gchar *sdp, - gchar **ufrag, - gchar **pwd); + const gchar *sdp); +GSList * nice_agent_parse_remote_stream_sdp (NiceAgent *agent, + guint stream_id, + const gchar *sdp, + gchar **ufrag, + gchar **pwd); NiceCandidate * nice_agent_parse_remote_candidate_sdp (NiceAgent *agent, - guint stream_id, - const gchar *sdp); + guint stream_id, + const gchar *sdp); +GIOStream * nice_agent_get_io_stream (NiceAgent *agent, + guint stream_id, + guint component_id); +GSocket * nice_agent_get_selected_socket (NiceAgent *agent, + guint stream_id, + guint component_id); +const gchar * nice_component_state_to_string (NiceComponentState state);

Object Hierarchy

-  GObject
+  GObject
    +----NiceAgent
 

Properties

-  "compatibility"            guint                 : Read / Write / Construct Only
-  "controlling-mode"         gboolean              : Read / Write
-  "full-mode"                gboolean              : Read / Write / Construct Only
-  "main-context"             gpointer              : Read / Write / Construct Only
-  "max-connectivity-checks"  guint                 : Read / Write
-  "proxy-ip"                 gchar*                : Read / Write
-  "proxy-password"           gchar*                : Read / Write
-  "proxy-port"               guint                 : Read / Write
-  "proxy-type"               guint                 : Read / Write
-  "proxy-username"           gchar*                : Read / Write
-  "reliable"                 gboolean              : Read / Write / Construct Only
-  "stun-pacing-timer"        guint                 : Read / Write / Construct Only
-  "stun-server"              gchar*                : Read / Write
-  "stun-server-port"         guint                 : Read / Write
-  "upnp"                     gboolean              : Read / Write / Construct
-  "upnp-timeout"             guint                 : Read / Write / Construct
+  "compatibility"            guint                 : Read / Write / Construct Only
+  "controlling-mode"         gboolean              : Read / Write
+  "full-mode"                gboolean              : Read / Write / Construct Only
+  "main-context"             gpointer              : Read / Write / Construct Only
+  "max-connectivity-checks"  guint                 : Read / Write
+  "proxy-ip"                 gchar*                : Read / Write
+  "proxy-password"           gchar*                : Read / Write
+  "proxy-port"               guint                 : Read / Write
+  "proxy-type"               guint                 : Read / Write
+  "proxy-username"           gchar*                : Read / Write
+  "reliable"                 gboolean              : Read / Write / Construct Only
+  "stun-pacing-timer"        guint                 : Read / Write / Construct Only
+  "stun-server"              gchar*                : Read / Write
+  "stun-server-port"         guint                 : Read / Write
+  "upnp"                     gboolean              : Read / Write / Construct
+  "upnp-timeout"             guint                 : Read / Write / Construct
 
@@ -216,9 +268,27 @@ connectivity checks to create a stream of data between you and your peer.

+Streams and their components are referenced by integer IDs (with respect to a +given NiceAgent). These IDs are guaranteed to be positive (i.e. non-zero) +for valid streams/components. +

+

+Each stream can receive data in one of two ways: using +nice_agent_attach_recv() or nice_agent_recv_messages() (and the derived +NiceInputStream and NiceIOStream classes accessible using +nice_agent_get_io_stream()). nice_agent_attach_recv() is non-blocking: it +takes a user-provided callback function and attaches the stream’s socket to +the provided GMainContext, invoking the callback in that context for every +packet received. nice_agent_recv_messages() instead blocks on receiving a +packet, and writes it directly into a user-provided buffer. This reduces the +number of callback invokations and (potentially) buffer copies required to +receive packets. nice_agent_recv_messages() (or NiceInputStream) is designed +to be used in a blocking loop in a separate thread. +

+

-

Example 1. Simple example on how to use libnice

+

Example 1. Simple example on how to use libnice

@@ -262,26 +332,26 @@ 37 +g_object_unref(agent);
guint stream_id;
 gchar buffer[] = "hello world!";
-GSList *lcands = NULL;
+GSList *lcands = NULL;
 
 // Create a nice agent
-NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245);
+NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245);
 
 // Connect the signals
-g_signal_connect (G_OBJECT (agent), "candidate-gathering-done",
-                  G_CALLBACK (cb_candidate_gathering_done), NULL);
-g_signal_connect (G_OBJECT (agent), "component-state-changed",
-                  G_CALLBACK (cb_component_state_changed), NULL);
-g_signal_connect (G_OBJECT (agent), "new-selected-pair",
-                  G_CALLBACK (cb_new_selected_pair), NULL);
+g_signal_connect (G_OBJECT (agent), "candidate-gathering-done",
+                  G_CALLBACK (cb_candidate_gathering_done), NULL);
+g_signal_connect (G_OBJECT (agent), "component-state-changed",
+                  G_CALLBACK (cb_component_state_changed), NULL);
+g_signal_connect (G_OBJECT (agent), "new-selected-pair",
+                  G_CALLBACK (cb_new_selected_pair), NULL);
 
 // Create a new stream with one component and start gathering candidates
 stream_id = nice_agent_add_stream (agent, 1);
 nice_agent_gather_candidates (agent, stream_id);
 
 // Attach to the component to receive the data
-nice_agent_attach_recv (agent, stream_id, 1, NULL,
-                       cb_nice_recv, NULL);
+nice_agent_attach_recv (agent, stream_id, 1, NULL,
+                       cb_nice_recv, NULL);
 
 // ... Wait until the signal candidate-gathering-done is fired ...
 lcands = nice_agent_get_local_candidates(agent, stream_id, 1);
@@ -296,7 +366,7 @@
 // Anything received will be received through the cb_nice_recv callback
 
 // Destroy the object
-g_object_unref(agent);
@@ -339,8 +409,11 @@

See also: "component-state-changed"

-
+
+++ @@ -395,7 +468,7 @@ component_id for RTP/RTCP usages.

-

Example 2. Example of use.

+

Example 2. Example of use.

NICE_COMPONENT_STATE_DISCONNECTED

@@ -410,8 +483,11 @@


-
+
+++ @@ -443,8 +519,11 @@

See also: "proxy-type"

-

NICE_COMPONENT_TYPE_RTP

+
+++ @@ -498,8 +577,11 @@

-

NICE_PROXY_TYPE_NONE

+
+++ @@ -549,16 +631,19 @@

NiceAgentRecvFunc ()

void                (*NiceAgentRecvFunc)                (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         guint len,
-                                                         gchar *buf,
-                                                         gpointer user_data);
+ guint stream_id, + guint component_id, + guint len, + gchar *buf, + gpointer user_data);

Callback function when data is received on a component

-

NICE_COMPATIBILITY_RFC5245

+
+++ @@ -591,6 +676,111 @@
+

NiceInputMessage

+
typedef struct {
+  GInputVector *buffers;
+  gint n_buffers;  /* may be -1 to indicate @buffers is NULL-terminated */
+  NiceAddress *from;  /* return location for address of message sender */
+  gsize length;  /* sum of the lengths of @buffers */
+} NiceInputMessage;
+
+

+Represents a single message received off the network. For reliable +connections, this is essentially just an array of buffers (specifically, +from can be ignored). for non-reliable connections, it represents a single +packet as received from the OS. +

+

+n_buffers may be -1 to indicate that buffers is terminated by a +GInputVector with a NULL buffer pointer. +

+

+By providing arrays of NiceInputMessages to functions like +nice_agent_recv_messages(), multiple messages may be received with a single +call, which is more efficient than making multiple calls in a loop. In this +manner, nice_agent_recv_messages() is analogous to recvmmsg(); and +NiceInputMessage to struct mmsghdr. +

+

agent :

++++ + + + + + + + + + + + + + + + + + + +

GInputVector *buffers;

unowned array of GInputVector buffers to +store data in for this message. [array length=n_buffers] +

gint n_buffers;

number of GInputVectors in buffers, or -1 to indicate buffers +is NULL-terminated

NiceAddress *from;

return location to store the address of the peer who +transmitted the message, or NULL. [allow-none] +

gsize length;

total number of valid bytes contiguously stored in buffers +
+

Since 0.1.5

+
+
+
+

NiceOutputMessage

+
typedef struct {
+  GOutputVector *buffers;
+  gint n_buffers;
+} NiceOutputMessage;
+
+

+Represents a single message to transmit on the network. For +reliable connections, this is essentially just an array of +buffer. for non-reliable connections, it represents a single packet +to send to the OS. +

+

+n_buffers may be -1 to indicate that buffers is terminated by a +GOutputVector with a NULL buffer pointer. +

+

+By providing arrays of NiceOutputMessages to functions like +nice_agent_send_messages_nonblocking(), multiple messages may be transmitted +with a single call, which is more efficient than making multiple calls in a +loop. In this manner, nice_agent_send_messages_nonblocking() is analogous to +sendmmsg(); and NiceOutputMessage to struct mmsghdr. +

+
++++ + + + + + + + + + + +

GOutputVector *buffers;

unowned array of GOutputVector buffers +which contain data to transmit for this message. [array length=n_buffers] +

gint n_buffers;

number of GOutputVectors in buffers, or -1 to indicate buffers +is NULL-terminated
+

Since 0.1.5

+
+
+

NICE_AGENT_MAX_REMOTE_CANDIDATES

#define NICE_AGENT_MAX_REMOTE_CANDIDATES    25
 
@@ -603,14 +793,17 @@

nice_agent_new ()

-
NiceAgent *         nice_agent_new                      (GMainContext *ctx,
+
NiceAgent *         nice_agent_new                      (GMainContext *ctx,
                                                          NiceCompatibility compat);

Create a new NiceAgent. -The returned object must be freed with g_object_unref() +The returned object must be freed with g_object_unref()

-
+
+++ @@ -630,18 +823,21 @@

nice_agent_new_reliable ()

-
NiceAgent *         nice_agent_new_reliable             (GMainContext *ctx,
+
NiceAgent *         nice_agent_new_reliable             (GMainContext *ctx,
                                                          NiceCompatibility compat);

Create a new NiceAgent in reliable mode, which uses PseudoTcpSocket to assure reliability of the messages. -The returned object must be freed with g_object_unref() +The returned object must be freed with g_object_unref()

See also: "reliable-transport-writable"

-

ctx :

+
+++ @@ -662,7 +858,7 @@

nice_agent_add_local_address ()

-
gboolean            nice_agent_add_local_address        (NiceAgent *agent,
+
gboolean            nice_agent_add_local_address        (NiceAgent *agent,
                                                          NiceAddress *addr);

Add a local address from which to derive local host candidates for @@ -677,8 +873,11 @@

See also: nice_agent_gather_candidates()

-

ctx :

+
+++ @@ -692,7 +891,7 @@ +TRUE on success, FALSE on fatal (memory allocation) errors

agent :

Returns :

-TRUE on success, FALSE on fatal (memory allocation) errors
@@ -701,10 +900,10 @@

nice_agent_set_port_range ()

void                nice_agent_set_port_range           (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         guint min_port,
-                                                         guint max_port);
+ guint stream_id, + guint component_id, + guint min_port, + guint max_port);

Sets a preferred port range for allocating host candidates.

@@ -719,8 +918,11 @@

-
+
+++ @@ -748,13 +950,17 @@

nice_agent_add_stream ()

-
guint               nice_agent_add_stream               (NiceAgent *agent,
-                                                         guint n_components);
+
guint               nice_agent_add_stream               (NiceAgent *agent,
+                                                         guint n_components);

-Adds a data stream to agent containing n_components components. +Adds a data stream to agent containing n_components components. The +returned stream ID is guaranteed to be positive on success.

-

agent :

+
+++ @@ -775,12 +981,15 @@

nice_agent_remove_stream ()

void                nice_agent_remove_stream            (NiceAgent *agent,
-                                                         guint stream_id);
+ guint stream_id);

Remove and free a previously created data stream from agent

-

agent :

+
+++ @@ -796,19 +1005,24 @@

nice_agent_set_relay_info ()

-
gboolean            nice_agent_set_relay_info           (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         const gchar *server_ip,
-                                                         guint server_port,
-                                                         const gchar *username,
-                                                         const gchar *password,
+
gboolean            nice_agent_set_relay_info           (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         const gchar *server_ip,
+                                                         guint server_port,
+                                                         const gchar *username,
+                                                         const gchar *password,
                                                          NiceRelayType type);

Sets the settings for using a relay server during the candidate discovery. +This may be called multiple times to add multiple relay servers to the +discovery process; one TCP and one UDP, for example.

-

agent :

+
+++ @@ -845,20 +1059,66 @@ +TRUE if the TURN settings were accepted. +FALSE if the address was invalid. + + +

agent :

Returns :

-TRUE if the TURN settings were accepted. -FALSE if the address was invalid.
+
+
+
+

nice_agent_forget_relays ()

+
gboolean            nice_agent_forget_relays            (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id);
+

+Forget all the relay servers previously added using +nice_agent_set_relay_info(). Currently connected streams will keep +using the relay as long as they have not been restarted and haven't +succesfully negotiated a different path. +

+
++++ + + + + + + + + + + + + + + + +

agent :

The NiceAgent Object

stream_id :

The ID of the stream

component_id :

The ID of the component

Returns :

+FALSE if the component could not be found, TRUE otherwise
+

Since 0.1.6


nice_agent_gather_candidates ()

-
gboolean            nice_agent_gather_candidates        (NiceAgent *agent,
-                                                         guint stream_id);
+
gboolean            nice_agent_gather_candidates        (NiceAgent *agent,
+                                                         guint stream_id);
+

+Allocate and start listening on local candidate ports and start the remote +candidate gathering process. +Once done, "candidate-gathering-done" is called for the stream. +As soon as this function is called, "new-candidate" signals may be +emitted, even before this function returns. +

-Start the candidate gathering process. -Once done, "candidate-gathering-done" is called for the stream +nice_agent_get_local_candidates() will only return non-empty results after +calling this function.

@@ -868,22 +1128,25 @@

See also: nice_agent_set_port_range()

-
+
+++ - + - +

agent :

The NiceAgent ObjectThe NiceAgent object

stream_id :

The id of the stream to startThe ID of the stream to start

Returns :

-FALSE if the stream id is invalid or if a host candidate couldn't be allocated -on the requested interfaces/ports. +FALSE if the stream ID is invalid or if a host candidate couldn't +be allocated on the requested interfaces/ports; TRUE otherwise

Note

@@ -903,10 +1166,10 @@


nice_agent_set_remote_credentials ()

-
gboolean            nice_agent_set_remote_credentials   (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         const gchar *ufrag,
-                                                         const gchar *pwd);
+
gboolean            nice_agent_set_remote_credentials   (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         const gchar *ufrag,
+                                                         const gchar *pwd);

Sets the remote credentials for stream stream_id.

@@ -920,8 +1183,11 @@

-
+
+++ @@ -944,7 +1210,7 @@ +TRUE on success, FALSE on error.

agent :

Returns :

-TRUE on success, FALSE on error.
@@ -952,15 +1218,23 @@

nice_agent_get_local_credentials ()

-
gboolean            nice_agent_get_local_credentials    (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         gchar **ufrag,
-                                                         gchar **pwd);
+
gboolean            nice_agent_get_local_credentials    (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         gchar **ufrag,
+                                                         gchar **pwd);
+

+Gets the local credentials for stream stream_id. This may be called any time +after creating a stream using nice_agent_add_stream(). +

-Gets the local credentials for stream stream_id. +An error will be returned if this is called for a non-existent stream, or if +either of ufrag or pwd are NULL.

-
+
+++ @@ -972,22 +1246,20 @@ - - +TRUE on success, FALSE on error.

agent :

ufrag :

a pointer to a NULL-terminated string containing -an ICE username fragment [OUT]. -This string must be freed with g_free() +return location for a nul-terminated string +containing an ICE username fragment; must be freed with g_free(). [out callee-allocates]

pwd :

a pointer to a NULL-terminated string containing an ICE -password [OUT] -This string must be freed with g_free() +return location for a nul-terminated string +containing an ICE password; must be freed with g_free(). [out callee-allocates]

Returns :

-TRUE on success, FALSE on error.
@@ -996,9 +1268,9 @@

nice_agent_set_remote_candidates ()

int                 nice_agent_set_remote_candidates    (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         const GSList *candidates);
+ guint stream_id, + guint component_id, + const GSList *candidates);

Sets, adds or updates the remote candidates for a component of a stream.

@@ -1024,8 +1296,11 @@

-
+
+++ @@ -1041,7 +1316,7 @@ - + @@ -1054,9 +1329,9 @@

nice_agent_get_remote_candidates ()

-
GSList *            nice_agent_get_remote_candidates    (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id);
+
GSList *            nice_agent_get_remote_candidates    (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id);

Get a list of the remote candidates set on a stream's component

@@ -1065,8 +1340,8 @@

Note

- The caller owns the returned GSList but not the candidates - contained within it. + The caller owns the returned GSList as well as the candidates contained + within it.

The list of remote candidates can change during processing. @@ -1076,8 +1351,11 @@

-

agent :

candidates :

a GSList of NiceCandidate items describing each candidate to adda GSList of NiceCandidate items describing each candidate to add

Returns :

+
+++ @@ -1093,7 +1371,7 @@ - @@ -1103,9 +1381,9 @@

nice_agent_get_local_candidates ()

-
GSList *            nice_agent_get_local_candidates     (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id);
+
GSList *            nice_agent_get_local_candidates     (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id);

Retreive from the agent the list of all local candidates for a stream's component @@ -1123,8 +1401,11 @@

-

agent :

Returns :

a GSList of NiceCandidates objects representing +a GSList of NiceCandidates objects representing the remote candidates set on the agent
+
+++ @@ -1140,7 +1421,7 @@ - @@ -1150,17 +1431,20 @@

nice_agent_get_selected_pair ()

-
gboolean            nice_agent_get_selected_pair        (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
+
gboolean            nice_agent_get_selected_pair        (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
                                                          NiceCandidate **local,
                                                          NiceCandidate **remote);

Retreive the selected candidate pair for media transmission for a given stream's component.

-

agent :

Returns :

a GSList of NiceCandidate objects representing +a GSList of NiceCandidate objects representing the local candidates of agent
+
+++ @@ -1185,7 +1469,7 @@ +TRUE on success, FALSE if there is no selected candidate pair

agent :

Returns :

-TRUE on success, FALSE if there is no selected candidate pair
@@ -1193,11 +1477,11 @@

nice_agent_send ()

-
gint                nice_agent_send                     (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         guint len,
-                                                         const gchar *buf);
+
gint                nice_agent_send                     (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         guint len,
+                                                         const gchar *buf);

Sends a data payload over a stream's component.

@@ -1228,8 +1512,11 @@

-
+
+++ @@ -1260,19 +1547,434 @@
+

nice_agent_send_messages_nonblocking ()

+
gint                nice_agent_send_messages_nonblocking
+                                                        (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         const NiceOutputMessage *messages,
+                                                         guint n_messages,
+                                                         GCancellable *cancellable,
+                                                         GError **error);
+

+Sends multiple messages on the socket identified by the given +stream/component pair. Transmission is non-blocking, so a +G_IO_ERROR_WOULD_BLOCK error may be returned if the send buffer is full. +

+

+As with nice_agent_send(), the given component must be in +NICE_COMPONENT_STATE_READY or, as a special case, in any state if it was +previously ready and was then restarted. +

+

+On success, the number of messages written to the socket will be returned, +which may be less than n_messages if transmission would have blocked +part-way through. Zero will be returned if n_messages is zero, or if +transmission would have blocked on the first message. +

+

+In reliable mode, it is instead recommended to use +nice_agent_send(). The return value can be less than n_messages +or 0 even if it is still possible to send a partial message. In +this case, "nice-agent-writable" will never be triggered, so the +application would have to use nice_agent_sent() to fill the buffer or have +to retry sending at a later point. +

+

+On failure, -1 will be returned and error will be set. If the NiceAgent is +reliable and the socket is not yet connected, G_IO_ERROR_BROKEN_PIPE will be +returned; if the write buffer is full, G_IO_ERROR_WOULD_BLOCK will be +returned. In both cases, wait for the "reliable-transport-writable" +signal before trying again. If the given stream_id or component_id are +invalid or not yet connected, G_IO_ERROR_BROKEN_PIPE will be returned. +G_IO_ERROR_FAILED will be returned for other errors. +

+

agent :

++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

agent :

a NiceAgent +

stream_id :

the ID of the stream to send to

component_id :

the ID of the component to send to

messages :

array of messages to send, of at least +n_messages entries in length. [array length=n_messages] +

n_messages :

number of entries in messages +

cancellable :

a GCancellable to cancel the operation from +another thread, or NULL. [allow-none] +

error :

return location for a GError, or NULL. [allow-none] +

Returns :

the number of messages sent (may be zero), or -1 on error
+

Since 0.1.5

+
+
+
+

nice_agent_recv ()

+
gssize              nice_agent_recv                     (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         guint8 *buf,
+                                                         gsize buf_len,
+                                                         GCancellable *cancellable,
+                                                         GError **error);
+

+A single-message version of nice_agent_recv_messages(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

agent :

a NiceAgent +

stream_id :

the ID of the stream to receive on

component_id :

the ID of the component to receive on

buf :

caller-allocated buffer +to write the received data into, of length at least buf_len. [array length=buf_len][out caller-allocates] +

buf_len :

length of buf +

cancellable :

a GCancellable to allow the operation to be +cancelled from another thread, or NULL. [allow-none] +

error :

return location for a GError, or NULL. [allow-none] +

Returns :

the number of bytes written to buf on success (guaranteed to be +greater than 0 unless buf_len is 0), or -1 on error
+

Since 0.1.5

+
+
+
+

nice_agent_recv_messages ()

+
gint                nice_agent_recv_messages            (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         NiceInputMessage *messages,
+                                                         guint n_messages,
+                                                         GCancellable *cancellable,
+                                                         GError **error);
+

+Block on receiving data from the given stream/component combination on +agent, returning only once exactly n_messages messages have been received +and written into messages, the stream is closed by the other end or by +calling nice_agent_remove_stream(), or cancellable is cancelled. +

+

+In the non-error case, in reliable mode, this will block until all buffers in +all n_messages have been filled with received data (i.e. messages is +treated as a large, flat array of buffers). In non-reliable mode, it will +block until n_messages messages have been received, each of which does not +have to fill all the buffers in its NiceInputMessage. In the non-reliable +case, each NiceInputMessage must have enough buffers to contain an entire +message (65536 bytes), or any excess data may be silently dropped. +

+

+For each received message, "length" will be set to the +number of valid bytes stored in the message’s buffers. The bytes are stored +sequentially in the buffers; there are no gaps apart from at the end of the +buffer array (in non-reliable mode). If non-NULL on input, +"from" will have the address of the sending peer stored in +it. The base addresses, sizes, and number of buffers in each message will not +be modified in any case. +

+

+This must not be used in combination with nice_agent_attach_recv() on the +same stream/component pair. +

+

+If the stream/component pair doesn’t exist, or if a suitable candidate socket +hasn’t yet been selected for it, a G_IO_ERROR_BROKEN_PIPE error will be +returned. A G_IO_ERROR_CANCELLED error will be returned if the operation was +cancelled. G_IO_ERROR_FAILED will be returned for other errors. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

agent :

a NiceAgent +

stream_id :

the ID of the stream to receive on

component_id :

the ID of the component to receive on

messages :

caller-allocated +array of NiceInputMessages to write the received messages into, of length at +least n_messages. [array length=n_messages][out caller-allocates] +

n_messages :

number of entries in messages +

cancellable :

a GCancellable to allow the operation to be +cancelled from another thread, or NULL. [allow-none] +

error :

return location for a GError, or NULL. [allow-none] +

Returns :

the number of valid messages written to messages on success +(guaranteed to be greater than 0 unless n_messages is 0), or -1 on error
+

Since 0.1.5

+
+
+
+

nice_agent_recv_nonblocking ()

+
gssize              nice_agent_recv_nonblocking         (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         guint8 *buf,
+                                                         gsize buf_len,
+                                                         GCancellable *cancellable,
+                                                         GError **error);
+

+A single-message version of nice_agent_recv_messages_nonblocking(). +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

agent :

a NiceAgent +

stream_id :

the ID of the stream to receive on

component_id :

the ID of the component to receive on

buf :

caller-allocated buffer +to write the received data into, of length at least buf_len. [array length=buf_len][out caller-allocates] +

buf_len :

length of buf +

cancellable :

a GCancellable to allow the operation to be +cancelled from another thread, or NULL. [allow-none] +

error :

return location for a GError, or NULL. [allow-none] +

Returns :

the number of bytes received into buf on success (guaranteed to be +greater than 0 unless buf_len is 0), or -1 on error
+

Since 0.1.5

+
+
+
+

nice_agent_recv_messages_nonblocking ()

+
gint                nice_agent_recv_messages_nonblocking
+                                                        (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         NiceInputMessage *messages,
+                                                         guint n_messages,
+                                                         GCancellable *cancellable,
+                                                         GError **error);
+

+Try to receive data from the given stream/component combination on agent, +without blocking. If receiving data would block, -1 is returned and +G_IO_ERROR_WOULD_BLOCK is set in error. If any other error occurs, -1 is +returned and error is set accordingly. Otherwise, 0 is returned if (and only +if) n_messages is 0. In all other cases, the number of valid messages stored +in messages is returned, and will be greater than 0. +

+

+This function behaves similarly to nice_agent_recv_messages(), except that it +will not block on filling (in reliable mode) or receiving (in non-reliable +mode) exactly n_messages messages. In reliable mode, it will receive bytes +into messages until it would block; in non-reliable mode, it will receive +messages until it would block. +

+

+As this function is non-blocking, cancellable is included only for parity +with nice_agent_recv_messages(). If cancellable is cancelled before this +function is called, a G_IO_ERROR_CANCELLED error will be returned +immediately. +

+

+This must not be used in combination with nice_agent_attach_recv() on the +same stream/component pair. +

+
++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

agent :

a NiceAgent +

stream_id :

the ID of the stream to receive on

component_id :

the ID of the component to receive on

messages :

caller-allocated +array of NiceInputMessages to write the received messages into, of length at +least n_messages. [array length=n_messages][out caller-allocates] +

n_messages :

number of entries in messages +

cancellable :

a GCancellable to allow the operation to be +cancelled from another thread, or NULL. [allow-none] +

error :

return location for a GError, or NULL. [allow-none] +

Returns :

the number of valid messages written to messages on success +(guaranteed to be greater than 0 unless n_messages is 0), or -1 on error
+

Since 0.1.5

+
+
+

nice_agent_attach_recv ()

-
gboolean            nice_agent_attach_recv              (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         GMainContext *ctx,
+
gboolean            nice_agent_attach_recv              (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         GMainContext *ctx,
                                                          NiceAgentRecvFunc func,
-                                                         gpointer data);
+ gpointer data);

Attaches the stream's component's sockets to the Glib Mainloop Context in order to be notified whenever data becomes available for a component.

-
+

+This must not be used in combination with nice_agent_recv_messages() (or +NiceIOStream or NiceInputStream) on the same stream/component pair. +

+

+Calling nice_agent_attach_recv() with a NULL func will detach any existing +callback and cause reception to be paused for the given stream/component +pair. You must iterate the previously specified GMainContext sufficiently to +ensure all pending I/O callbacks have been received before calling this +function to unset func, otherwise data loss of received packets may occur. +

+
+++ @@ -1302,7 +2004,7 @@ +TRUE on success, FALSE if the stream or component IDs are invalid.

agent :

Returns :

-TRUE on success, FALSE if the stream or component IDs are invalid.
@@ -1310,11 +2012,11 @@

nice_agent_set_selected_pair ()

-
gboolean            nice_agent_set_selected_pair        (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
-                                                         const gchar *lfoundation,
-                                                         const gchar *rfoundation);
+
gboolean            nice_agent_set_selected_pair        (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id,
+                                                         const gchar *lfoundation,
+                                                         const gchar *rfoundation);

Sets the selected candidate pair for media transmission for a given stream's component. Calling this function will @@ -1322,8 +2024,11 @@ state machine updates, etc). Note that keepalives will continue to be sent.

-
+
+++ @@ -1348,7 +2053,7 @@ +TRUE on success, FALSE if the candidate pair cannot be found

agent :

Returns :

-TRUE on success, FALSE if the candidate pair cannot be found
@@ -1356,10 +2061,10 @@

nice_agent_set_selected_remote_candidate ()

-
gboolean            nice_agent_set_selected_remote_candidate
+
gboolean            nice_agent_set_selected_remote_candidate
                                                         (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id,
+                                                         guint stream_id,
+                                                         guint component_id,
                                                          NiceCandidate *candidate);

Sets the selected remote candidate for media transmission @@ -1370,8 +2075,11 @@ (connection check, state machine updates, etc). Note that keepalives will continue to be sent.

-
+
+++ @@ -1392,7 +2100,7 @@ +TRUE on success, FALSE on failure

agent :

Returns :

-TRUE on success, FALSE on failure
@@ -1401,13 +2109,16 @@

nice_agent_set_stream_tos ()

void                nice_agent_set_stream_tos           (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         gint tos);
+ guint stream_id, + gint tos);

Sets the IP_TOS and/or IPV6_TCLASS field on the stream's sockets' options

-
+
+++ @@ -1429,7 +2140,7 @@

nice_agent_set_software ()

void                nice_agent_set_software             (NiceAgent *agent,
-                                                         const gchar *software);
+ const gchar *software);

This function will set the value of the SOFTWARE attribute to be added to STUN requests, responses and error responses sent during connectivity checks. @@ -1457,8 +2168,11 @@

-

agent :

+
+++ @@ -1475,34 +2189,75 @@

nice_agent_restart ()

-
gboolean            nice_agent_restart                  (NiceAgent *agent);
+
gboolean            nice_agent_restart                  (NiceAgent *agent);

Restarts the session as defined in ICE draft 19. This function needs to be called both when initiating (ICE spec section 9.1.1.1. "ICE Restarts"), as well as when reacting (spec section 9.2.1.1. "Detecting ICE Restart") to a restart.

-

agent :

+
++++ + + + + + + + + + + +

agent :

The NiceAgent Object

Returns :

+TRUE on success FALSE on error
+
+
+
+

nice_agent_restart_stream ()

+
gboolean            nice_agent_restart_stream           (NiceAgent *agent,
+                                                         guint stream_id);
+

+Restarts a single stream as defined in RFC 5245. This function +needs to be called both when initiating (ICE spec section 9.1.1.1. +"ICE Restarts"), as well as when reacting (spec section 9.2.1.1. +"Detecting ICE Restart") to a restart. +

+

+Unlike nice_agent_restart(), this applies to a single stream. It also +does not generate a new tie breaker. +

+
+++ + + + + +TRUE on success FALSE on error

agent :

The NiceAgent Object

stream_id :

The ID of the stream

Returns :

-TRUE on success FALSE on error
+

Since 0.1.6


nice_agent_set_stream_name ()

-
gboolean            nice_agent_set_stream_name          (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         const gchar *name);
+
gboolean            nice_agent_set_stream_name          (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         const gchar *name);

This function will assign a unique name to a stream. This is only useful when parsing and generating an SDP of the candidates. @@ -1518,8 +2273,11 @@

See also: nice_agent_get_stream_name()

-
+
+++ @@ -1531,13 +2289,13 @@ - @@ -1547,8 +2305,8 @@

nice_agent_get_stream_name ()

-
const gchar *       nice_agent_get_stream_name          (NiceAgent *agent,
-                                                         guint stream_id);
+
const gchar *       nice_agent_get_stream_name          (NiceAgent *agent,
+                                                         guint stream_id);

This function will return the name assigned to a stream.

@@ -1557,8 +2315,11 @@

See also: nice_agent_set_stream_name()

-

agent :

name :

The new name of the stream or NULL +The new name of the stream or NULL

Returns :

-TRUE if the name has been set. FALSE in case of error +TRUE if the name has been set. FALSE in case of error (invalid stream or duplicate name).
+
+++ @@ -1582,8 +2343,8 @@

nice_agent_get_default_local_candidate ()

NiceCandidate *     nice_agent_get_default_local_candidate
                                                         (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         guint component_id);
+ guint stream_id, + guint component_id);

This helper function will return the recommended default candidate to be used for non-ICE compatible clients. This will usually be the candidate @@ -1599,8 +2360,11 @@

-

agent :

+
+++ @@ -1616,7 +2380,7 @@ - @@ -1625,7 +2389,7 @@

nice_agent_generate_local_sdp ()

-
gchar *             nice_agent_generate_local_sdp       (NiceAgent *agent);
+
gchar *             nice_agent_generate_local_sdp       (NiceAgent *agent);

Generate an SDP string containing the local candidates and credentials for all streams and components in the agent. @@ -1668,8 +2432,11 @@

See also: nice_agent_get_default_local_candidate()

-

agent :

Returns :

The candidate to be used as the default candidate, or NULL in case +The candidate to be used as the default candidate, or NULL in case of error. Must be freed with nice_candidate_free() once done.
+
+++ @@ -1677,7 +2444,7 @@ - @@ -1687,10 +2454,10 @@

nice_agent_generate_local_stream_sdp ()

-
gchar *             nice_agent_generate_local_stream_sdp
+
gchar *             nice_agent_generate_local_stream_sdp
                                                         (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         gboolean include_non_ice);
+ guint stream_id, + gboolean include_non_ice);

Generate an SDP string containing the local candidates and credentials for a stream. @@ -1731,8 +2498,11 @@

See also: nice_agent_get_default_local_candidate()

-

agent :

Returns :

A string representing the local SDP. Must be freed with g_free() +A string representing the local SDP. Must be freed with g_free() once done.
+
+++ @@ -1750,7 +2520,7 @@ +with g_free() once done.

agent :

Returns :

A string representing the local SDP for the stream. Must be freed -with g_free() once done.
@@ -1759,7 +2529,7 @@

nice_agent_generate_local_candidate_sdp ()

-
gchar *             nice_agent_generate_local_candidate_sdp
+
gchar *             nice_agent_generate_local_candidate_sdp
                                                         (NiceAgent *agent,
                                                          NiceCandidate *candidate);

@@ -1776,8 +2546,11 @@

See also: nice_agent_generate_local_stream_sdp()

-
+
+++ @@ -1790,7 +2563,7 @@ +with g_free() once done.

agent :

Returns :

A string representing the SDP for the candidate. Must be freed -with g_free() once done.
@@ -1800,7 +2573,7 @@

nice_agent_parse_remote_sdp ()

int                 nice_agent_parse_remote_sdp         (NiceAgent *agent,
-                                                         const gchar *sdp);
+ const gchar *sdp);

Parse an SDP string and extracts candidates and credentials from it and sets them on the agent. @@ -1831,8 +2604,11 @@

See also: nice_agent_parse_remote_candidate_sdp()

-
+
+++ @@ -1853,11 +2629,11 @@

nice_agent_parse_remote_stream_sdp ()

-
GSList *            nice_agent_parse_remote_stream_sdp  (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         const gchar *sdp,
-                                                         gchar **ufrag,
-                                                         gchar **pwd);
+
GSList *            nice_agent_parse_remote_stream_sdp  (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         const gchar *sdp,
+                                                         gchar **ufrag,
+                                                         gchar **pwd);

Parse an SDP string representing a single stream and extracts candidates and credentials from it. @@ -1873,8 +2649,11 @@

See also: nice_agent_parse_remote_candidate_sdp()

-

agent :

+
+++ @@ -1890,17 +2669,17 @@ - + - + - @@ -1912,8 +2691,8 @@

nice_agent_parse_remote_candidate_sdp ()

NiceCandidate *     nice_agent_parse_remote_candidate_sdp
                                                         (NiceAgent *agent,
-                                                         guint stream_id,
-                                                         const gchar *sdp);
+ guint stream_id, + const gchar *sdp);

Parse an SDP string and extracts the candidate from it.

@@ -1928,8 +2707,11 @@

See also: nice_agent_parse_remote_stream_sdp()

-

agent :

ufrag :

Pointer to store the ice ufrag if non NULL. Must be freed with -g_free() after usePointer to store the ice ufrag if non NULL. Must be freed with +g_free() after use

pwd :

Pointer to store the ice password if non NULL. Must be freed with -g_free() after usePointer to store the ice password if non NULL. Must be freed with +g_free() after use

Returns :

A GSList of candidates parsed from the SDP, or NULL in case of +A GSList of candidates parsed from the SDP, or NULL in case of errors
+
+++ @@ -1945,18 +2727,140 @@ - +

agent :

Returns :

The parsed candidate or NULL if there was an error.The parsed candidate or NULL if there was an error.

Since 0.1.4

+
+
+

nice_agent_get_io_stream ()

+
GIOStream *         nice_agent_get_io_stream            (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id);
+

+Gets a GIOStream wrapper around the given stream and component in +agent. The I/O stream will be valid for as long as stream_id is valid. +The GInputStream and GOutputStream implement GPollableInputStream and +GPollableOutputStream. +

+

+This function may only be called on reliable NiceAgents. It is a +programming error to try and create an I/O stream wrapper for an +unreliable stream. +

+
++++ + + + + + + + + + + + + + + + + + + +

agent :

A NiceAgent +

stream_id :

The ID of the stream to wrap

component_id :

The ID of the component to wrap

Returns :

A GIOStream. [transfer full] +
+

Since 0.1.5

+
+
+
+

nice_agent_get_selected_socket ()

+
GSocket *           nice_agent_get_selected_socket      (NiceAgent *agent,
+                                                         guint stream_id,
+                                                         guint component_id);
+

+Retreive the local socket associated with the selected candidate pair +for media transmission for a given stream's component. +

+

+This is useful for adding ICE support to legacy applications that already +have a protocol that maintains a connection. If the socket is duplicated +before unrefing the agent, the application can take over and continue to use +it. New applications are encouraged to use the built in libnice stream +handling instead and let libnice handle the connection maintenance. +

+

+Users of this method are encouraged to not use a TURN relay or any kind +of proxy, as in this case, the socket will not be available to the +application because the packets are encapsulated. +

+
++++ + + + + + + + + + + + + + + + + + + +

agent :

The NiceAgent Object

stream_id :

The ID of the stream

component_id :

The ID of the component

Returns :

(transfer full) pointer to the GSocket, or NULL if there is no +selected candidate or if the selected candidate is a relayed candidate.
+

Since 0.1.5

+
+
+
+

nice_component_state_to_string ()

+
const gchar *       nice_component_state_to_string      (NiceComponentState state);
+

+Returns a string representation of the state, generally to use in debug +messages. +

+
++++ + + + + + + + + + + +

state :

a NiceComponentState +

Returns :

a string representation of state. [transfer none] +
+

Since 0.1.6

+

Property Details

The "compatibility" property

-
  "compatibility"            guint                 : Read / Write / Construct Only
+
  "compatibility"            guint                 : Read / Write / Construct Only

The Nice agent can work in various compatibility modes depending on what the application/peer needs. @@ -1970,21 +2874,21 @@


The "controlling-mode" property

-
  "controlling-mode"         gboolean              : Read / Write
+
  "controlling-mode"         gboolean              : Read / Write

Whether the agent is in controlling mode.

Default value: FALSE


The "full-mode" property

-
  "full-mode"                gboolean              : Read / Write / Construct Only
+
  "full-mode"                gboolean              : Read / Write / Construct Only

Whether agent runs in ICE full mode.

Default value: TRUE


The "main-context" property

-
  "main-context"             gpointer              : Read / Write / Construct Only
+
  "main-context"             gpointer              : Read / Write / Construct Only

A GLib main context is needed for all timeouts used by libnice. This is a property being set by the nice_agent_new() call. @@ -1993,14 +2897,14 @@


The "max-connectivity-checks" property

-
  "max-connectivity-checks"  guint                 : Read / Write
+
  "max-connectivity-checks"  guint                 : Read / Write

Upper limit for the total number of connectivity checks performed.

Default value: 0


The "proxy-ip" property

-
  "proxy-ip"                 gchar*                : Read / Write
+
  "proxy-ip"                 gchar*                : Read / Write

The proxy server IP used to bypass a proxy firewall

@@ -2010,7 +2914,7 @@

The "proxy-password" property

-
  "proxy-password"           gchar*                : Read / Write
+
  "proxy-password"           gchar*                : Read / Write

The password used to authenticate with the proxy

@@ -2020,7 +2924,7 @@

The "proxy-port" property

-
  "proxy-port"               guint                 : Read / Write
+
  "proxy-port"               guint                 : Read / Write

The proxy server port used to bypass a proxy firewall

@@ -2031,7 +2935,7 @@

The "proxy-type" property

-
  "proxy-type"               guint                 : Read / Write
+
  "proxy-type"               guint                 : Read / Write

The type of proxy set in the proxy-ip property

@@ -2042,7 +2946,7 @@

The "proxy-username" property

-
  "proxy-username"           gchar*                : Read / Write
+
  "proxy-username"           gchar*                : Read / Write

The username used to authenticate with the proxy

@@ -2052,7 +2956,7 @@

The "reliable" property

-
  "reliable"                 gboolean              : Read / Write / Construct Only
+
  "reliable"                 gboolean              : Read / Write / Construct Only

Whether the agent should use PseudoTcp to ensure a reliable transport of messages @@ -2063,7 +2967,7 @@


The "stun-pacing-timer" property

-
  "stun-pacing-timer"        guint                 : Read / Write / Construct Only
+
  "stun-pacing-timer"        guint                 : Read / Write / Construct Only

Timer 'Ta' (msecs) used in the IETF ICE specification for pacing candidate gathering and sending of connectivity checks.

Allowed values: >= 1

Default value: 20

@@ -2071,14 +2975,14 @@

The "stun-server" property

-
  "stun-server"              gchar*                : Read / Write
+
  "stun-server"              gchar*                : Read / Write

The IP address (not the hostname) of the STUN server to use.

Default value: NULL


The "stun-server-port" property

-
  "stun-server-port"         guint                 : Read / Write
+
  "stun-server-port"         guint                 : Read / Write

Port of the STUN server used to gather server-reflexive candidates.

Allowed values: [1,65536]

Default value: 1

@@ -2086,7 +2990,7 @@

The "upnp" property

-
  "upnp"                     gboolean              : Read / Write / Construct
+
  "upnp"                     gboolean              : Read / Write / Construct

Whether the agent should use UPnP to open a port in the router and get the external IP @@ -2097,10 +3001,10 @@


The "upnp-timeout" property

-
  "upnp-timeout"             guint                 : Read / Write / Construct
+
  "upnp-timeout"             guint                 : Read / Write / Construct

-The maximum amount of time to wait for UPnP discovery to finish before -signaling the "candidate-gathering-done" signal +The maximum amount of time (in milliseconds) to wait for UPnP discovery to +finish before signaling the "candidate-gathering-done" signal

Allowed values: [100,60000]

Default value: 200

@@ -2112,14 +3016,17 @@

The "candidate-gathering-done" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        gpointer   user_data)      : Run Last
+ guint stream_id, + gpointer user_data) : Run Last

This signal is fired whenever a stream has finished gathering its candidates after a call to nice_agent_gather_candidates()

-
+
+++ @@ -2140,15 +3047,18 @@

The "component-state-changed" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        guint      component_id,
-                                                        guint      state,
-                                                        gpointer   user_data)         : Run Last
+ guint stream_id, + guint component_id, + guint state, + gpointer user_data) : Run Last

This signal is fired whenever a component's state changes

-

agent :

+
+++ @@ -2177,14 +3087,17 @@

The "initial-binding-request-received" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        gpointer   user_data)      : Run Last
+ guint stream_id, + gpointer user_data) : Run Last

This signal is fired when we received our first binding request from the peer.

-

agent :

+
+++ @@ -2205,18 +3118,21 @@

The "new-candidate" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        guint      component_id,
-                                                        gchar     *foundation,
-                                                        gpointer   user_data)         : Run Last
+ guint stream_id, + guint component_id, + gchar *foundation, + gpointer user_data) : Run Last

-This signal is fired when the agent discovers a new candidate +This signal is fired when the agent discovers a new local candidate.

See also: "candidate-gathering-done"

-

agent :

+
+++ @@ -2245,16 +3161,19 @@

The "new-remote-candidate" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        guint      component_id,
-                                                        gchar     *foundation,
-                                                        gpointer   user_data)         : Run Last
+ guint stream_id, + guint component_id, + gchar *foundation, + gpointer user_data) : Run Last

This signal is fired when the agent discovers a new remote candidate. This can happen with peer reflexive candidates.

-

agent :

+
+++ @@ -2283,17 +3202,20 @@

The "new-selected-pair" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        guint      component_id,
-                                                        gchar     *lfoundation,
-                                                        gchar     *rfoundation,
-                                                        gpointer   user_data)         : Run Last
+ guint stream_id, + guint component_id, + gchar *lfoundation, + gchar *rfoundation, + gpointer user_data) : Run Last

This signal is fired once a candidate pair is selected for data transfer for a stream's component

-

agent :

+
+++ @@ -2326,9 +3248,9 @@

The "reliable-transport-writable" signal

void                user_function                      (NiceAgent *agent,
-                                                        guint      stream_id,
-                                                        guint      component_id,
-                                                        gpointer   user_data)         : Run Last
+ guint stream_id, + guint component_id, + gpointer user_data) : Run Last

This signal is fired on the reliable NiceAgent when the underlying reliable transport becomes writable. @@ -2336,8 +3258,11 @@ bytes than requested to send (or -1) and once when the connection is established.

-

agent :

+
+++ @@ -2359,6 +3284,40 @@

agent :

Since 0.0.11

+
+
+

The "streams-removed" signal

+
void                user_function                      (NiceAgent           *agent,
+                                                        _NiceAgentStreamIds *stream_ids,
+                                                        gpointer             user_data)       : Run Last
+

+This signal is fired whenever one or more streams are removed from the +agent. +

+
++++ + + + + + + + + + + + + + + +

agent :

The NiceAgent object

stream_ids :

An array of +unsigned integer stream IDs, ending with a 0 ID. [array zero-terminated=1][element-type uint] +

user_data :

user data set when the signal handler was connected.
+

Since 0.1.5

+

See Also

@@ -2367,6 +3326,6 @@
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/pt01.html libnice-0.1.7/docs/reference/libnice/html/pt01.html --- libnice-0.1.4/docs/reference/libnice/html/pt01.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/pt01.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Part I. ICE Library - + - + @@ -21,10 +21,10 @@

-Part I. ICE Library

+Part I. ICE Library

Table of Contents

-
+
@@ -37,7 +37,7 @@ NiceCandidate — ICE candidate representation
-
Libnice helper functions
+
Libnice helper functions
Debug messages — Debug messages utility functions @@ -51,6 +51,6 @@
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/pt02.html libnice-0.1.7/docs/reference/libnice/html/pt02.html --- libnice-0.1.4/docs/reference/libnice/html/pt02.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/pt02.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Part II. STUN Library - + - + @@ -21,10 +21,10 @@

-Part II. STUN Library

+Part II. STUN Library

Table of Contents

-
+
@@ -33,6 +33,9 @@
StunMessage — STUN messages parsing and formatting functions
+
+STUN Constants +
STUN usages
@@ -54,6 +57,6 @@
+ Generated by GTK-Doc V1.19 \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/pt03.html libnice-0.1.7/docs/reference/libnice/html/pt03.html --- libnice-0.1.4/docs/reference/libnice/html/pt03.html 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/pt03.html 2014-05-05 18:59:30.000000000 +0000 @@ -3,12 +3,12 @@ Part III. Pseudo TCP Socket implementation - + - + @@ -21,10 +21,10 @@

-Part III. Pseudo TCP Socket implementation

+Part III. Pseudo TCP Socket implementation

Table of Contents

-
+
Pseudo TCP Socket — Pseudo TCP implementation @@ -34,6 +34,6 @@
+ Generated by GTK-Doc V1.19
\ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/html/pt04.html libnice-0.1.7/docs/reference/libnice/html/pt04.html --- libnice-0.1.4/docs/reference/libnice/html/pt04.html 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/html/pt04.html 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,47 @@ + + + + +Part IV. Appendices + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru libnice-0.1.4/docs/reference/libnice/libnice-docs.sgml libnice-0.1.7/docs/reference/libnice/libnice-docs.sgml --- libnice-0.1.4/docs/reference/libnice/libnice-docs.sgml 2012-05-02 23:07:29.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/libnice-docs.sgml 2014-04-29 01:09:49.000000000 +0000 @@ -19,7 +19,7 @@ - Libnice helper functions + Libnice helper functions @@ -29,7 +29,8 @@ - + + STUN usages @@ -49,4 +50,53 @@ The libnice library contains the ICE library and the STUN library as well as a Pseudo TCP socket implementation. + + + Appendices + + API Index + + + + Index of deprecated symbols + + + + Index of new symbols in 0.0.4 + + + + Index of new symbols in 0.0.6 + + + + Index of new symbols in 0.0.7 + + + + Index of new symbols in 0.0.9 + + + + Index of new symbols in 0.0.10 + + + + Index of new symbols in 0.0.11 + + + + Index of new symbols in 0.1.4 + + + + Index of new symbols in 0.1.5 + + + + Index of new symbols in 0.1.6 + + + + diff -Nru libnice-0.1.4/docs/reference/libnice/libnice-sections.txt libnice-0.1.7/docs/reference/libnice/libnice-sections.txt --- libnice-0.1.4/docs/reference/libnice/libnice-sections.txt 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/libnice-sections.txt 2014-05-05 18:59:30.000000000 +0000 @@ -7,6 +7,8 @@ NiceProxyType NiceCompatibility NiceAgentRecvFunc +NiceInputMessage +NiceOutputMessage NICE_AGENT_MAX_REMOTE_CANDIDATES nice_agent_new nice_agent_new_reliable @@ -15,6 +17,7 @@ nice_agent_add_stream nice_agent_remove_stream nice_agent_set_relay_info +nice_agent_forget_relays nice_agent_gather_candidates nice_agent_set_remote_credentials nice_agent_get_local_credentials @@ -23,12 +26,18 @@ nice_agent_get_local_candidates nice_agent_get_selected_pair nice_agent_send +nice_agent_send_messages_nonblocking +nice_agent_recv +nice_agent_recv_messages +nice_agent_recv_nonblocking +nice_agent_recv_messages_nonblocking nice_agent_attach_recv nice_agent_set_selected_pair nice_agent_set_selected_remote_candidate nice_agent_set_stream_tos nice_agent_set_software nice_agent_restart +nice_agent_restart_stream nice_agent_set_stream_name nice_agent_get_stream_name nice_agent_get_default_local_candidate @@ -38,6 +47,9 @@ nice_agent_parse_remote_sdp nice_agent_parse_remote_stream_sdp nice_agent_parse_remote_candidate_sdp +nice_agent_get_io_stream +nice_agent_get_selected_socket +nice_component_state_to_string NICE_AGENT NICE_IS_AGENT @@ -103,9 +115,6 @@ Debug messages nice_debug_enable nice_debug_disable - -nice_debug_init -nice_debug
@@ -177,6 +186,8 @@ stun_message_append_xor_addr_full stun_message_append_error stun_message_validate_buffer_length +StunInputVector +stun_message_validate_buffer_length_fast stun_message_id stun_message_get_class stun_message_get_method @@ -186,7 +197,32 @@ stun_strerror
- +
+stunconstants +STUN Constants +STUN_AGENT_MAX_SAVED_IDS +STUN_AGENT_MAX_UNKNOWN_ATTRIBUTES +STUN_ATTRIBUTE_HEADER_LENGTH +STUN_ATTRIBUTE_LENGTH_LEN +STUN_ATTRIBUTE_LENGTH_POS +STUN_ATTRIBUTE_TYPE_LEN +STUN_ATTRIBUTE_TYPE_POS +STUN_ATTRIBUTE_VALUE_POS +STUN_ID_LEN +STUN_MAGIC_COOKIE +STUN_MAX_MESSAGE_SIZE +STUN_MAX_MESSAGE_SIZE_IPV4 +STUN_MAX_MESSAGE_SIZE_IPV6 +STUN_MESSAGE_ATTRIBUTES_POS +STUN_MESSAGE_HEADER_LENGTH +STUN_MESSAGE_LENGTH_LEN +STUN_MESSAGE_LENGTH_POS +STUN_MESSAGE_TRANS_ID_LEN +STUN_MESSAGE_TRANS_ID_POS +STUN_MESSAGE_TYPE_LEN +STUN_MESSAGE_TYPE_POS +TURN_MAGIC_COOKIE +
turn @@ -198,6 +234,7 @@ stun_usage_turn_create_refresh stun_usage_turn_process stun_usage_turn_refresh_process +stun_usage_turn_create_permission
@@ -255,4 +292,19 @@ pseudo_tcp_socket_notify_mtu pseudo_tcp_socket_notify_packet pseudo_tcp_set_debug_level +pseudo_tcp_socket_get_available_bytes +pseudo_tcp_socket_can_send +pseudo_tcp_socket_get_available_send_space +pseudo_tcp_socket_notify_message + +pseudo_tcp_socket_get_type +PseudoTcpSocketClass +PSEUDOTCP_SOCKET_GET_CLASS +PSEUDO_TCP_SOCKET +PSEUDO_TCP_SOCKET_CLASS +PSEUDO_TCP_SOCKET_TYPE +IS_PSEUDO_TCP_SOCKET +IS_PSEUDO_TCP_SOCKET_CLASS + +PseudoTcpSocketPrivate
diff -Nru libnice-0.1.4/docs/reference/libnice/Makefile.am libnice-0.1.7/docs/reference/libnice/Makefile.am --- libnice-0.1.4/docs/reference/libnice/Makefile.am 2012-05-02 23:07:29.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/Makefile.am 2014-04-04 03:52:17.000000000 +0000 @@ -13,7 +13,7 @@ # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. # e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=$(top_srcdir) +DOC_SOURCE_DIR=$(top_srcdir)/agent $(top_srcdir)/stun # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS= @@ -37,22 +37,27 @@ # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(DOC_SOURCE_DIR)/agent/agent.h $(DOC_SOURCE_DIR)/agent/address.h \ - $(DOC_SOURCE_DIR)/agent/debug.h $(DOC_SOURCE_DIR)/agent/candidate.h \ - $(DOC_SOURCE_DIR)/agent/interfaces.h \ - $(DOC_SOURCE_DIR)/stun/stunagent.h \ - $(DOC_SOURCE_DIR)/stun/stunmessage.h - $(DOC_SOURCE_DIR)/stun/debug.h \ - $(DOC_SOURCE_DIR)/stun/usages/bind.h \ - $(DOC_SOURCE_DIR)/stun/usages/ice.h \ - $(DOC_SOURCE_DIR)/stun/usages/timer.h \ - $(DOC_SOURCE_DIR)/stun/usages/turn.h \ - $(DOC_SOURCE_DIR)/agent/pseudotcp.h \ -CFILE_GLOB=$(DOC_SOURCE_DIR)/agent/agent.c $(DOC_SOURCE_DIR)/agent/pseudotcp.c +HFILE_GLOB=$(top_srcdir)/agent/agent.h $(top_srcdir)/agent/address.h \ + $(top_srcdir)/agent/debug.h $(top_srcdir)/agent/candidate.h \ + $(top_srcdir)/agent/interfaces.h \ + $(top_srcdir)/agent/pseudotcp.h \ + $(top_srcdir)/stun/stunagent.h \ + $(top_srcdir)/stun/stunmessage.h \ + $(top_srcdir)/stun/debug.h \ + $(top_srcdir)/stun/usages/bind.h \ + $(top_srcdir)/stun/usages/ice.h \ + $(top_srcdir)/stun/usages/timer.h \ + $(top_srcdir)/stun/usages/turn.h + +CFILE_GLOB=$(top_srcdir)/agent/agent.c \ + $(top_srcdir)/agent/pseudotcp.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= conncheck.h discovery.h stream.h gstnice.h gstnicesrc.h gstnicesink.h +IGNORE_HFILES= conncheck.h discovery.h stream.h component.h agent-priv.h \ + iostream.h inputstream.h outputstream.h \ + gstnice.h gstnicesrc.h gstnicesink.h \ + md5.h sha1.h stunhmac.h utils.h rand.h stun5389.h stuncrc32.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png @@ -72,7 +77,7 @@ # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -AM_CFLAGS = $(ERROR_CFLAGS) \ +AM_CFLAGS = $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ -I $(top_srcdir) \ -I $(top_srcdir)/random \ diff -Nru libnice-0.1.4/docs/reference/libnice/Makefile.in libnice-0.1.7/docs/reference/libnice/Makefile.in --- libnice-0.1.4/docs/reference/libnice/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/Makefile.in 2014-05-05 18:58:19.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -21,23 +20,51 @@ # Everything below here is generic # #################################### VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -57,23 +84,30 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/gtk-doc.make +DIST_COMMON = $(top_srcdir)/gtk-doc.make $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am subdir = docs/reference/libnice ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -81,6 +115,7 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -238,7 +273,7 @@ # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. # e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR = $(top_srcdir) +DOC_SOURCE_DIR = $(top_srcdir)/agent $(top_srcdir)/stun # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS = @@ -262,16 +297,29 @@ # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB = $(DOC_SOURCE_DIR)/agent/agent.h $(DOC_SOURCE_DIR)/agent/address.h \ - $(DOC_SOURCE_DIR)/agent/debug.h $(DOC_SOURCE_DIR)/agent/candidate.h \ - $(DOC_SOURCE_DIR)/agent/interfaces.h \ - $(DOC_SOURCE_DIR)/stun/stunagent.h \ - $(DOC_SOURCE_DIR)/stun/stunmessage.h +HFILE_GLOB = $(top_srcdir)/agent/agent.h $(top_srcdir)/agent/address.h \ + $(top_srcdir)/agent/debug.h $(top_srcdir)/agent/candidate.h \ + $(top_srcdir)/agent/interfaces.h \ + $(top_srcdir)/agent/pseudotcp.h \ + $(top_srcdir)/stun/stunagent.h \ + $(top_srcdir)/stun/stunmessage.h \ + $(top_srcdir)/stun/debug.h \ + $(top_srcdir)/stun/usages/bind.h \ + $(top_srcdir)/stun/usages/ice.h \ + $(top_srcdir)/stun/usages/timer.h \ + $(top_srcdir)/stun/usages/turn.h + +CFILE_GLOB = $(top_srcdir)/agent/agent.c \ + $(top_srcdir)/agent/pseudotcp.c # Header files to ignore when scanning. # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES = conncheck.h discovery.h stream.h gstnice.h gstnicesrc.h gstnicesink.h +IGNORE_HFILES = conncheck.h discovery.h stream.h component.h agent-priv.h \ + iostream.h inputstream.h outputstream.h \ + gstnice.h gstnicesrc.h gstnicesink.h \ + md5.h sha1.h stunhmac.h utils.h rand.h stun5389.h stuncrc32.h + # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png @@ -291,7 +339,7 @@ # signals and properties. # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -AM_CFLAGS = $(ERROR_CFLAGS) \ +AM_CFLAGS = $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ -I $(top_srcdir) \ -I $(top_srcdir)/random \ @@ -386,11 +434,11 @@ clean-libtool: -rm -rf .libs _libs -tags: TAGS -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -531,26 +579,19 @@ .MAKE: install-am install-strip .PHONY: all all-am all-local check check-am clean clean-generic \ - clean-libtool clean-local dist-hook distclean \ - distclean-generic distclean-libtool distclean-local distdir \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-data-local install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am dist-hook \ + distclean distclean-generic distclean-libtool distclean-local \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-local + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am uninstall-local - $(DOC_SOURCE_DIR)/stun/debug.h \ - $(DOC_SOURCE_DIR)/stun/usages/bind.h \ - $(DOC_SOURCE_DIR)/stun/usages/ice.h \ - $(DOC_SOURCE_DIR)/stun/usages/timer.h \ - $(DOC_SOURCE_DIR)/stun/usages/turn.h \ - $(DOC_SOURCE_DIR)/agent/pseudotcp.h \ -CFILE_GLOB=$(DOC_SOURCE_DIR)/agent/agent.c $(DOC_SOURCE_DIR)/agent/pseudotcp.c @ENABLE_GTK_DOC_TRUE@all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) @ENABLE_GTK_DOC_FALSE@all-local: diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/agent.sgml libnice-0.1.7/docs/reference/libnice/tmpl/agent.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/agent.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/agent.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -92,6 +92,14 @@ @arg1: @arg2: + + + + + +@niceagent: the object which received the signal. +@arg1: + @@ -230,6 +238,24 @@ @user_data: + + + + + +@buffers: +@n_buffers: +@from: +@length: + + + + + + +@buffers: +@n_buffers: + @@ -314,6 +340,17 @@ @Returns: + + + + + +@agent: +@stream_id: +@component_id: +@Returns: + + @@ -408,6 +445,81 @@ @Returns: + + + + + +@agent: +@stream_id: +@component_id: +@messages: +@n_messages: +@cancellable: +@error: +@Returns: + + + + + + + +@agent: +@stream_id: +@component_id: +@buf: +@buf_len: +@cancellable: +@error: +@Returns: + + + + + + + +@agent: +@stream_id: +@component_id: +@messages: +@n_messages: +@cancellable: +@error: +@Returns: + + + + + + + +@agent: +@stream_id: +@component_id: +@buf: +@buf_len: +@cancellable: +@error: +@Returns: + + + + + + + +@agent: +@stream_id: +@component_id: +@messages: +@n_messages: +@cancellable: +@error: +@Returns: + + @@ -475,6 +587,16 @@ @Returns: + + + + + +@agent: +@stream_id: +@Returns: + + @@ -571,3 +693,34 @@ @Returns: + + + + + +@agent: +@stream_id: +@component_id: +@Returns: + + + + + + + +@agent: +@stream_id: +@component_id: +@Returns: + + + + + + + +@state: +@Returns: + + diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/candidate.sgml libnice-0.1.7/docs/reference/libnice/tmpl/candidate.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/candidate.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/candidate.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -60,6 +60,7 @@ +@ref_count: @server: @username: @password: diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/libnice-unused.sgml libnice-0.1.7/docs/reference/libnice/tmpl/libnice-unused.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/libnice-unused.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/libnice-unused.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +STUN Constants + + + + + + + +@msg: +@software: +@Returns: + diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/pseudotcp.sgml libnice-0.1.7/docs/reference/libnice/tmpl/pseudotcp.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/pseudotcp.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/pseudotcp.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -26,6 +26,11 @@ + + + + + @@ -36,6 +41,21 @@ + + + + + + + + + + + + + + + @@ -187,3 +207,40 @@ @level: + + + + + +@self: +@Returns: + + + + + + + +@self: +@Returns: + + + + + + + +@self: +@Returns: + + + + + + + +@self: +@message: +@Returns: + + diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/stun-constants.sgml libnice-0.1.7/docs/reference/libnice/tmpl/stun-constants.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/stun-constants.sgml 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/stun-constants.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,176 @@ + +STUN Constants + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/stunconstants.sgml libnice-0.1.7/docs/reference/libnice/tmpl/stunconstants.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/stunconstants.sgml 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/stunconstants.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -0,0 +1,176 @@ + +STUN Constants + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/stunmessage.sgml libnice-0.1.7/docs/reference/libnice/tmpl/stunmessage.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/stunmessage.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/stunmessage.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -420,6 +420,26 @@ @Returns: + + + + + +@buffer: +@size: + + + + + + +@buffers: +@n_buffers: +@total_length: +@has_padding: +@Returns: + + diff -Nru libnice-0.1.4/docs/reference/libnice/tmpl/turn.sgml libnice-0.1.7/docs/reference/libnice/tmpl/turn.sgml --- libnice-0.1.4/docs/reference/libnice/tmpl/turn.sgml 2013-02-23 00:46:46.000000000 +0000 +++ libnice-0.1.7/docs/reference/libnice/tmpl/turn.sgml 2014-05-05 18:59:30.000000000 +0000 @@ -120,3 +120,25 @@ @Returns: + + + + + +@agent: +@msg: +@buffer: +@buffer_len: +@username: +@username_len: +@password: +@password_len: +@realm: +@realm_len: +@nonce: +@nonce_len: +@peer: +@compatibility: +@Returns: + + diff -Nru libnice-0.1.4/docs/reference/Makefile.in libnice-0.1.7/docs/reference/Makefile.in --- libnice-0.1.4/docs/reference/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/docs/reference/Makefile.in 2014-05-05 18:58:19.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,23 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ esac; \ - test $$am__dry = yes; \ - } + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -52,30 +79,38 @@ host_triplet = @host@ target_triplet = @target@ subdir = docs/reference -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -83,9 +118,29 @@ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -299,22 +354,25 @@ -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -329,57 +387,12 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -395,12 +408,7 @@ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -412,15 +420,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -429,6 +433,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -589,22 +608,20 @@ uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive +.MAKE: $(am__recursive_targets) install-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -Nru libnice-0.1.4/examples/Makefile.am libnice-0.1.7/examples/Makefile.am --- libnice-0.1.4/examples/Makefile.am 2013-02-05 01:49:36.000000000 +0000 +++ libnice-0.1.7/examples/Makefile.am 2014-01-06 23:05:13.000000000 +0000 @@ -14,7 +14,7 @@ -I $(top_srcdir)/random \ -I $(top_srcdir)/socket \ -I $(top_srcdir)/stun \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) diff -Nru libnice-0.1.4/examples/Makefile.in libnice-0.1.7/examples/Makefile.in --- libnice-0.1.4/examples/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/examples/Makefile.in 2014-05-05 18:58:19.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -24,23 +23,51 @@ # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -59,13 +86,14 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/depcomp bin_PROGRAMS = simple-example$(EXEEXT) threaded-example$(EXEEXT) \ sdp-example$(EXEEXT) subdir = examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -82,6 +110,7 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = am_simple_example_OBJECTS = simple-example.$(OBJEXT) simple_example_OBJECTS = $(am_simple_example_OBJECTS) simple_example_DEPENDENCIES = $(top_builddir)/agent/libagent.la \ @@ -90,6 +119,18 @@ threaded_example_OBJECTS = $(am_threaded_example_OBJECTS) threaded_example_DEPENDENCIES = $(top_builddir)/agent/libagent.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -102,20 +143,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(sdp_example_SOURCES) $(simple_example_SOURCES) \ $(threaded_example_SOURCES) DIST_SOURCES = $(sdp_example_SOURCES) $(simple_example_SOURCES) \ @@ -125,6 +162,23 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -271,23 +325,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda AM_CFLAGS = \ -I $(top_srcdir) \ @@ -295,7 +332,7 @@ -I $(top_srcdir)/random \ -I $(top_srcdir)/socket \ -I $(top_srcdir)/stun \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) @@ -355,10 +392,12 @@ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -379,7 +418,8 @@ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ + -e 's/$$/$(EXEEXT)/' \ + `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files @@ -392,12 +432,15 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list + sdp-example$(EXEEXT): $(sdp_example_OBJECTS) $(sdp_example_DEPENDENCIES) $(EXTRA_sdp_example_DEPENDENCIES) @rm -f sdp-example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(sdp_example_OBJECTS) $(sdp_example_LDADD) $(LIBS) + simple-example$(EXEEXT): $(simple_example_OBJECTS) $(simple_example_DEPENDENCIES) $(EXTRA_simple_example_DEPENDENCIES) @rm -f simple-example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(simple_example_OBJECTS) $(simple_example_LDADD) $(LIBS) + threaded-example$(EXEEXT): $(threaded_example_OBJECTS) $(threaded_example_DEPENDENCIES) $(EXTRA_threaded_example_DEPENDENCIES) @rm -f threaded-example$(EXEEXT) $(AM_V_CCLD)$(LINK) $(threaded_example_OBJECTS) $(threaded_example_LDADD) $(LIBS) @@ -439,26 +482,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -470,15 +502,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -487,6 +515,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -631,19 +674,19 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS check-valgrind: diff -Nru libnice-0.1.4/examples/sdp-example.c libnice-0.1.7/examples/sdp-example.c --- libnice-0.1.4/examples/sdp-example.c 2013-02-22 22:32:50.000000000 +0000 +++ libnice-0.1.7/examples/sdp-example.c 2014-01-06 23:05:13.000000000 +0000 @@ -92,7 +92,9 @@ g_debug("Using stun server '[%s]:%u'\n", stun_addr, stun_port); } +#if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); +#endif gloop = g_main_loop_new(NULL, FALSE); diff -Nru libnice-0.1.4/examples/simple-example.c libnice-0.1.7/examples/simple-example.c --- libnice-0.1.4/examples/simple-example.c 2013-02-05 01:48:20.000000000 +0000 +++ libnice-0.1.7/examples/simple-example.c 2014-04-25 01:46:20.000000000 +0000 @@ -77,7 +77,7 @@ { NiceAgent *agent; gchar *stun_addr = NULL; - guint stun_port; + guint stun_port = 0; gboolean controlling; // Parse arguments @@ -101,7 +101,9 @@ g_debug("Using stun server '[%s]:%u'\n", stun_addr, stun_port); } +#if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); +#endif gloop = g_main_loop_new(NULL, FALSE); io_stdin = g_io_channel_unix_new(fileno(stdin)); @@ -155,7 +157,7 @@ } static void -cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, +cb_candidate_gathering_done(NiceAgent *agent, guint _stream_id, gpointer data) { @@ -164,7 +166,7 @@ // Candidate gathering is done. Send our local candidates on stdout printf("Copy this line to remote client:\n"); printf("\n "); - print_local_data(agent, stream_id, 1); + print_local_data(agent, _stream_id, 1); printf("\n"); // Listen on stdin for the remote candidate list @@ -206,19 +208,19 @@ } static void -cb_component_state_changed(NiceAgent *agent, guint stream_id, +cb_component_state_changed(NiceAgent *agent, guint _stream_id, guint component_id, guint state, gpointer data) { g_debug("SIGNAL: state changed %d %d %s[%d]\n", - stream_id, component_id, state_name[state], state); + _stream_id, component_id, state_name[state], state); if (state == NICE_COMPONENT_STATE_READY) { NiceCandidate *local, *remote; // Get current selected candidate pair and print IP address used - if (nice_agent_get_selected_pair (agent, stream_id, component_id, + if (nice_agent_get_selected_pair (agent, _stream_id, component_id, &local, &remote)) { gchar ipaddr[INET6_ADDRSTRLEN]; @@ -262,7 +264,7 @@ } static void -cb_new_selected_pair(NiceAgent *agent, guint stream_id, +cb_new_selected_pair(NiceAgent *agent, guint _stream_id, guint component_id, gchar *lfoundation, gchar *rfoundation, gpointer data) { @@ -270,7 +272,7 @@ } static void -cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id, +cb_nice_recv(NiceAgent *agent, guint _stream_id, guint component_id, guint len, gchar *buf, gpointer data) { if (len == 1 && buf[0] == '\0') @@ -280,7 +282,7 @@ } static NiceCandidate * -parse_candidate(char *scand, guint stream_id) +parse_candidate(char *scand, guint _stream_id) { NiceCandidate *cand = NULL; NiceCandidateType ntype; @@ -288,7 +290,7 @@ guint i; tokens = g_strsplit (scand, ",", 5); - for (i = 0; tokens && tokens[i]; i++); + for (i = 0; tokens[i]; i++); if (i != 5) goto end; @@ -303,9 +305,10 @@ cand = nice_candidate_new(ntype); cand->component_id = 1; - cand->stream_id = stream_id; + cand->stream_id = _stream_id; cand->transport = NICE_CANDIDATE_TRANSPORT_UDP; strncpy(cand->foundation, tokens[0], NICE_CANDIDATE_MAX_FOUNDATION); + cand->foundation[NICE_CANDIDATE_MAX_FOUNDATION - 1] = 0; cand->priority = atoi (tokens[1]); if (!nice_address_set_from_string(&cand->addr, tokens[2])) { @@ -325,7 +328,7 @@ static int -print_local_data (NiceAgent *agent, guint stream_id, guint component_id) +print_local_data (NiceAgent *agent, guint _stream_id, guint component_id) { int result = EXIT_FAILURE; gchar *local_ufrag = NULL; @@ -333,11 +336,11 @@ gchar ipaddr[INET6_ADDRSTRLEN]; GSList *cands = NULL, *item; - if (!nice_agent_get_local_credentials(agent, stream_id, + if (!nice_agent_get_local_credentials(agent, _stream_id, &local_ufrag, &local_password)) goto end; - cands = nice_agent_get_local_candidates(agent, stream_id, component_id); + cands = nice_agent_get_local_candidates(agent, _stream_id, component_id); if (cands == NULL) goto end; @@ -372,7 +375,7 @@ static int -parse_remote_data(NiceAgent *agent, guint stream_id, +parse_remote_data(NiceAgent *agent, guint _stream_id, guint component_id, char *line) { GSList *remote_candidates = NULL; @@ -394,7 +397,7 @@ passwd = line_argv[i]; } else { // Remaining args are serialized canidates (at least one is required) - NiceCandidate *c = parse_candidate(line_argv[i], stream_id); + NiceCandidate *c = parse_candidate(line_argv[i], _stream_id); if (c == NULL) { g_message("failed to parse candidate: %s", line_argv[i]); @@ -408,13 +411,13 @@ goto end; } - if (!nice_agent_set_remote_credentials(agent, stream_id, ufrag, passwd)) { + if (!nice_agent_set_remote_credentials(agent, _stream_id, ufrag, passwd)) { g_message("failed to set remote credentials"); goto end; } // Note: this will trigger the start of negotiation. - if (nice_agent_set_remote_candidates(agent, stream_id, component_id, + if (nice_agent_set_remote_candidates(agent, _stream_id, component_id, remote_candidates) < 1) { g_message("failed to set remote candidates"); goto end; diff -Nru libnice-0.1.4/examples/threaded-example.c libnice-0.1.7/examples/threaded-example.c --- libnice-0.1.4/examples/threaded-example.c 2013-02-07 01:23:52.000000000 +0000 +++ libnice-0.1.7/examples/threaded-example.c 2014-04-29 03:10:30.000000000 +0000 @@ -101,7 +101,9 @@ g_debug("Using stun server '[%s]:%u'\n", stun_addr, stun_port); } +#if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); +#endif gloop = g_main_loop_new(NULL, FALSE); @@ -311,7 +313,7 @@ guint i; tokens = g_strsplit (scand, ",", 5); - for (i = 0; tokens && tokens[i]; i++); + for (i = 0; tokens[i]; i++); if (i != 5) goto end; @@ -329,6 +331,7 @@ cand->stream_id = stream_id; cand->transport = NICE_CANDIDATE_TRANSPORT_UDP; strncpy(cand->foundation, tokens[0], NICE_CANDIDATE_MAX_FOUNDATION); + cand->foundation[NICE_CANDIDATE_MAX_FOUNDATION - 1] = 0; cand->priority = atoi (tokens[1]); if (!nice_address_set_from_string(&cand->addr, tokens[2])) { diff -Nru libnice-0.1.4/gst/gstnicesink.c libnice-0.1.7/gst/gstnicesink.c --- libnice-0.1.4/gst/gstnicesink.c 2012-09-14 19:35:06.000000000 +0000 +++ libnice-0.1.7/gst/gstnicesink.c 2014-03-07 01:21:05.000000000 +0000 @@ -270,6 +270,11 @@ return GST_STATE_CHANGE_FAILURE; } break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PAUSED_TO_READY: + case GST_STATE_CHANGE_READY_TO_NULL: default: break; } diff -Nru libnice-0.1.4/gst/gstnicesrc.c libnice-0.1.7/gst/gstnicesrc.c --- libnice-0.1.4/gst/gstnicesrc.c 2012-09-14 19:35:06.000000000 +0000 +++ libnice-0.1.7/gst/gstnicesrc.c 2014-03-07 01:21:05.000000000 +0000 @@ -417,6 +417,10 @@ nice_agent_attach_recv (src->agent, src->stream_id, src->component_id, src->mainctx, NULL, NULL); break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + case GST_STATE_CHANGE_PAUSED_TO_READY: default: break; } diff -Nru libnice-0.1.4/gst/Makefile.in libnice-0.1.7/gst/Makefile.in --- libnice-0.1.4/gst/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/gst/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -24,23 +23,51 @@ # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -61,9 +88,11 @@ host_triplet = @host@ target_triplet = @target@ subdir = gst -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -113,6 +142,7 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = libgstnice_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libgstnice_la_CFLAGS) \ $(CFLAGS) $(libgstnice_la_LDFLAGS) $(LDFLAGS) -o $@ @@ -132,6 +162,18 @@ $(libgstnice010_la_LDFLAGS) $(LDFLAGS) -o $@ @WITH_GSTREAMER010_TRUE@am_libgstnice010_la_rpath = -rpath \ @WITH_GSTREAMER010_TRUE@ $(gstplugin010dir) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -144,20 +186,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libgstnice_la_SOURCES) $(libgstnice010_la_SOURCES) DIST_SOURCES = $(am__libgstnice_la_SOURCES_DIST) \ $(am__libgstnice010_la_SOURCES_DIST) @@ -166,6 +204,23 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -381,6 +436,7 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): + install-gstpluginLTLIBRARIES: $(gstplugin_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(gstplugin_LTLIBRARIES)'; test -n "$(gstplugindir)" || list=; \ @@ -407,12 +463,15 @@ clean-gstpluginLTLIBRARIES: -test -z "$(gstplugin_LTLIBRARIES)" || rm -f $(gstplugin_LTLIBRARIES) - @list='$(gstplugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(gstplugin_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + install-gstplugin010LTLIBRARIES: $(gstplugin010_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(gstplugin010_LTLIBRARIES)'; test -n "$(gstplugin010dir)" || list=; \ @@ -439,14 +498,18 @@ clean-gstplugin010LTLIBRARIES: -test -z "$(gstplugin010_LTLIBRARIES)" || rm -f $(gstplugin010_LTLIBRARIES) - @list='$(gstplugin010_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(gstplugin010_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libgstnice.la: $(libgstnice_la_OBJECTS) $(libgstnice_la_DEPENDENCIES) $(EXTRA_libgstnice_la_DEPENDENCIES) $(AM_V_CCLD)$(libgstnice_la_LINK) $(am_libgstnice_la_rpath) $(libgstnice_la_OBJECTS) $(libgstnice_la_LIBADD) $(LIBS) + libgstnice010.la: $(libgstnice010_la_OBJECTS) $(libgstnice010_la_DEPENDENCIES) $(EXTRA_libgstnice010_la_DEPENDENCIES) $(AM_V_CCLD)$(libgstnice010_la_LINK) $(am_libgstnice010_la_rpath) $(libgstnice010_la_OBJECTS) $(libgstnice010_la_LIBADD) $(LIBS) @@ -532,26 +595,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -563,15 +615,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -580,6 +628,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -726,20 +789,21 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-gstplugin010LTLIBRARIES clean-gstpluginLTLIBRARIES \ - clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-gstplugin010LTLIBRARIES \ - install-gstpluginLTLIBRARIES install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-gstplugin010LTLIBRARIES \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am \ + install-gstplugin010LTLIBRARIES install-gstpluginLTLIBRARIES \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-gstplugin010LTLIBRARIES \ uninstall-gstpluginLTLIBRARIES diff -Nru libnice-0.1.4/INSTALL libnice-0.1.7/INSTALL --- libnice-0.1.4/INSTALL 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/INSTALL 2013-08-05 10:10:38.000000000 +0000 @@ -1,7 +1,7 @@ Installation Instructions ************************* -Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, @@ -309,9 +309,10 @@ overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== @@ -367,4 +368,3 @@ `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. - diff -Nru libnice-0.1.4/m4/as-compiler-flag.m4 libnice-0.1.7/m4/as-compiler-flag.m4 --- libnice-0.1.4/m4/as-compiler-flag.m4 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/m4/as-compiler-flag.m4 2014-01-06 23:05:13.000000000 +0000 @@ -0,0 +1,64 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef +dnl Tim-Philipp Müller + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + +dnl AS_CXX_COMPILER_FLAG(CPPFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CPPFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_CXX_COMPILER_FLAG], +[ + AC_REQUIRE([AC_PROG_CXX]) + + AC_MSG_CHECKING([to see if c++ compiler understands $1]) + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $1" + + AC_LANG_PUSH(C++) + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CPPFLAGS="$save_CPPFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + + AC_LANG_POP(C++) + + AC_MSG_RESULT([$flag_ok]) +]) + diff -Nru libnice-0.1.4/Makefile.am libnice-0.1.7/Makefile.am --- libnice-0.1.4/Makefile.am 2013-02-02 00:23:12.000000000 +0000 +++ libnice-0.1.7/Makefile.am 2014-01-06 23:05:12.000000000 +0000 @@ -8,6 +8,8 @@ include common.mk +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + SUBDIRS = \ stun \ socket \ @@ -31,6 +33,8 @@ scripts/valgrind.sh \ win32 +MAINTAINERCLEANFILES = ar-lib + dist_check_SCRIPTS = \ scripts/check-symbols.sh \ scripts/make-symbol-list.sh diff -Nru libnice-0.1.4/Makefile.in libnice-0.1.7/Makefile.in --- libnice-0.1.4/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/Makefile.in 2014-05-05 18:58:19.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -23,23 +22,51 @@ # # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -58,15 +85,16 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = README $(am__configure_deps) $(dist_check_SCRIPTS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/common.mk $(srcdir)/config.h.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - TODO config.guess config.sub depcomp install-sh ltmain.sh \ - missing +DIST_COMMON = $(srcdir)/common.mk INSTALL NEWS README AUTHORS \ + ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config.h.in $(dist_check_SCRIPTS) COPYING TODO \ + ar-lib config.guess config.sub depcomp install-sh missing \ + ltmain.sh subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -75,21 +103,28 @@ CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -97,11 +132,33 @@ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) @@ -112,6 +169,7 @@ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi +am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -139,6 +197,7 @@ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best +DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -286,24 +345,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = \ stun \ socket \ @@ -326,6 +369,7 @@ scripts/valgrind.sh \ win32 +MAINTAINERCLEANFILES = ar-lib dist_check_SCRIPTS = \ scripts/check-symbols.sh \ scripts/make-symbol-list.sh @@ -395,22 +439,25 @@ -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -425,57 +472,12 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -491,12 +493,7 @@ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -508,15 +505,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -525,9 +518,31 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) @@ -595,40 +610,36 @@ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__remove_distdir) + $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) + $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) + $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) + $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) + $(am__post_remove_distdir) -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -639,8 +650,6 @@ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ @@ -652,9 +661,9 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ @@ -686,7 +695,7 @@ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__remove_distdir) + $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' @@ -753,6 +762,7 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am @@ -823,25 +833,24 @@ uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check-am \ - ctags-recursive install-am install-strip tags-recursive +.MAKE: $(am__recursive_targets) all check-am install-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool clean-local ctags ctags-recursive dist dist-all \ - dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ + dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am check-valgrind: diff -Nru libnice-0.1.4/NEWS libnice-0.1.7/NEWS --- libnice-0.1.4/NEWS 2013-02-23 00:28:03.000000000 +0000 +++ libnice-0.1.7/NEWS 2014-05-05 18:57:37.000000000 +0000 @@ -1,3 +1,32 @@ +libnice 0.1.7 (2014-05-05) +========================== +Fix undesired API change that broke Farstream unit testsx + +libnice 0.1.6 (2014-04-28) +========================== +API: nice_agent_restart_stream() to do a ICE restart on a single strema +API: nice_component_state_to_string() to get a printable name for a component + state +API: nice_agent_forget_relays() to forget the relays set for a + specific component, along with nice_agent_restart_stream(), it allows + changing the current relay without dropping the connection. +It is now possible to add relays after the initial candidate gathering. +Many bug fixes + +libnice 0.1.5 (2014-03-06) +========================== + +API: nice_agent_recv() and nice_agent_recv_nonblocking() as an alternative to + the nice_agent_attach_recv() +API: nice_agent_recv_messages() and nice_agent_recv_messages_nonblocking() to + receive multiple messages at the same time +API: nice_agent_get_io_stream() to get a GIOStream in reliable mode +API: nice_agent_get_selected_socket() to extract the selected GSocket +Import Google's newer PseudoTCP code including window scaling +Improve PseudoTCP performance +Improve performance +Build fixes + libnice 0.1.4 (2013-02-22) ========================== @@ -17,7 +46,6 @@ Add support for GStreamer 1.0, will compile plugins for both 1.0 and 0.10 by default Cache GSocketAddress in UdpBsdSocket, creating it is very slow - libnice 0.1.2 (2012-04-03) ========================== diff -Nru libnice-0.1.4/nice/libnice.sym libnice-0.1.7/nice/libnice.sym --- libnice-0.1.4/nice/libnice.sym 2013-02-05 21:14:19.000000000 +0000 +++ libnice-0.1.7/nice/libnice.sym 2014-04-25 01:09:45.000000000 +0000 @@ -16,16 +16,23 @@ nice_address_to_string nice_agent_add_local_address nice_agent_add_stream +nice_agent_recv +nice_agent_recv_messages +nice_agent_recv_nonblocking +nice_agent_recv_messages_nonblocking nice_agent_attach_recv +nice_agent_forget_relays nice_agent_gather_candidates nice_agent_generate_local_candidate_sdp nice_agent_generate_local_sdp nice_agent_generate_local_stream_sdp nice_agent_get_default_local_candidate +nice_agent_get_io_stream nice_agent_get_local_candidates nice_agent_get_local_credentials nice_agent_get_remote_candidates nice_agent_get_selected_pair +nice_agent_get_selected_socket nice_agent_get_stream_name nice_agent_get_type nice_agent_new @@ -35,7 +42,9 @@ nice_agent_parse_remote_stream_sdp nice_agent_remove_stream nice_agent_restart +nice_agent_restart_stream nice_agent_send +nice_agent_send_messages_nonblocking nice_agent_set_port_range nice_agent_set_relay_info nice_agent_set_remote_candidates @@ -48,11 +57,15 @@ nice_candidate_copy nice_candidate_free nice_candidate_new +nice_component_state_to_string nice_debug_disable nice_debug_enable nice_interfaces_get_ip_for_interface nice_interfaces_get_local_interfaces nice_interfaces_get_local_ips +nice_io_stream_new +nice_input_stream_new +nice_output_stream_new pseudo_tcp_set_debug_level pseudo_tcp_socket_close pseudo_tcp_socket_connect diff -Nru libnice-0.1.4/nice/Makefile.am libnice-0.1.7/nice/Makefile.am --- libnice-0.1.4/nice/Makefile.am 2011-10-13 21:35:43.000000000 +0000 +++ libnice-0.1.7/nice/Makefile.am 2014-01-06 23:05:13.000000000 +0000 @@ -26,7 +26,7 @@ AM_CFLAGS = \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ -I $(top_srcdir) \ -I $(top_srcdir)/agent \ diff -Nru libnice-0.1.4/nice/Makefile.in libnice-0.1.7/nice/Makefile.in --- libnice-0.1.4/nice/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/nice/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -26,23 +25,51 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -61,12 +88,13 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/nice.pc.in \ - $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(srcdir)/nice.pc.in \ + $(pkginclude_HEADERS) $(top_srcdir)/test-driver subdir = nice ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -109,9 +137,22 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = libnice_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libnice_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -121,20 +162,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libnice_la_SOURCES) DIST_SOURCES = $(libnice_la_SOURCES) am__can_run_installinfo = \ @@ -144,10 +181,202 @@ esac DATA = $(pkgconfig_DATA) HEADERS = $(pkginclude_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/nice ACLOCAL = @ACLOCAL@ @@ -292,23 +521,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda libnice.symbols libnice-symbols-test.c \ libnice-symbols-test.o lib_LTLIBRARIES = libnice.la @@ -327,7 +539,7 @@ $(LIBNICE_LT_LDFLAGS) AM_CFLAGS = \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ -I $(top_srcdir) \ -I $(top_srcdir)/agent \ @@ -345,6 +557,7 @@ all: all-am .SUFFIXES: +.SUFFIXES: .log .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -378,6 +591,7 @@ $(am__aclocal_m4_deps): nice.pc: $(top_builddir)/config.status $(srcdir)/nice.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ @@ -404,12 +618,15 @@ clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libnice.la: $(libnice_la_OBJECTS) $(libnice_la_DEPENDENCIES) $(EXTRA_libnice_la_DEPENDENCIES) $(AM_V_CCLD)$(libnice_la_LINK) -rpath $(libdir) $(libnice_la_OBJECTS) $(libnice_la_LIBADD) $(LIBS) @@ -467,26 +684,15 @@ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -498,15 +704,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -515,102 +717,187 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + else \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ else \ - skipped="($$skip tests were not run)"; \ + color_start= color_end=; \ fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_SCRIPTS) $(check_DATA) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-symbols.sh.log: test-symbols.sh + @p='test-symbols.sh'; \ + b='test-symbols.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -671,6 +958,9 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -754,9 +1044,9 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-generic clean-libLTLIBRARIES clean-libtool ctags \ - distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -767,8 +1057,9 @@ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-libLTLIBRARIES \ - uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS + recheck tags tags-am uninstall uninstall-am \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-pkgincludeHEADERS check-valgrind: diff -Nru libnice-0.1.4/nice/nice.pc.in libnice-0.1.7/nice/nice.pc.in --- libnice-0.1.4/nice/nice.pc.in 2009-08-14 22:46:12.000000000 +0000 +++ libnice-0.1.7/nice/nice.pc.in 2014-01-06 23:05:13.000000000 +0000 @@ -8,5 +8,6 @@ Requires: glib-2.0 >= 2.10.0 Version: @VERSION@ Libs: -L${libdir} -lnice @GLIB_LIBS@ +Libs.private: @GUPNP_LIBS@ Cflags: @GLIB_CFLAGS@ -I${includedir} -I${includedir}/nice diff -Nru libnice-0.1.4/random/Makefile.am libnice-0.1.7/random/Makefile.am --- libnice-0.1.4/random/Makefile.am 2011-09-08 01:01:53.000000000 +0000 +++ libnice-0.1.7/random/Makefile.am 2014-01-06 23:05:13.000000000 +0000 @@ -8,7 +8,7 @@ include $(top_srcdir)/common.mk -AM_CFLAGS = $(ERROR_CFLAGS) $(GLIB_CFLAGS) +AM_CFLAGS = $(LIBNICE_CFLAGS) $(GLIB_CFLAGS) noinst_LTLIBRARIES = libnice-random.la diff -Nru libnice-0.1.4/random/Makefile.in libnice-0.1.7/random/Makefile.in --- libnice-0.1.4/random/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/random/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -24,23 +23,51 @@ # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -59,12 +86,14 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ + $(top_srcdir)/test-driver check_PROGRAMS = test$(EXEEXT) subdir = random ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -78,10 +107,23 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = test_SOURCES = test.c test_OBJECTS = test.$(OBJEXT) am__DEPENDENCIES_1 = test_DEPENDENCIES = libnice-random.la $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -94,20 +136,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libnice_random_la_SOURCES) test.c DIST_SOURCES = $(libnice_random_la_SOURCES) test.c am__can_run_installinfo = \ @@ -115,10 +153,229 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/nice ACLOCAL = @ACLOCAL@ @@ -263,25 +520,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda -AM_CFLAGS = $(ERROR_CFLAGS) $(GLIB_CFLAGS) +AM_CFLAGS = $(LIBNICE_CFLAGS) $(GLIB_CFLAGS) noinst_LTLIBRARIES = libnice-random.la libnice_random_la_SOURCES = \ random.h \ @@ -294,7 +534,7 @@ all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -329,12 +569,15 @@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libnice-random.la: $(libnice_random_la_OBJECTS) $(libnice_random_la_DEPENDENCIES) $(EXTRA_libnice_random_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libnice_random_la_OBJECTS) $(libnice_random_la_LIBADD) $(LIBS) @@ -346,6 +589,7 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list + test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) @rm -f test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS) @@ -387,26 +631,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -418,15 +651,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -435,102 +664,187 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + else \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ else \ - skipped="($$skip tests were not run)"; \ + color_start= color_end=; \ fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test.log: test$(EXEEXT) + @p='test$(EXEEXT)'; \ + b='test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -588,6 +902,9 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -672,19 +989,20 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool \ - clean-noinstLTLIBRARIES ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am recheck tags tags-am uninstall \ + uninstall-am check-valgrind: diff -Nru libnice-0.1.4/socket/http.c libnice-0.1.7/socket/http.c --- libnice-0.1.4/socket/http.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/http.c 2014-04-09 02:44:13.000000000 +0000 @@ -43,6 +43,7 @@ #endif #include "http.h" +#include "agent-priv.h" #include #include @@ -70,9 +71,15 @@ gchar *username; gchar *password; GQueue send_queue; - gchar *recv_buf; - gint recv_len; - gint content_length; + + /* Ring buffer for receiving HTTP headers into before they’re parsed. */ + guint8 *recv_buf; + gsize recv_buf_length; /* allocation size of @recv_buf */ + gsize recv_buf_pos; /* offset from @recv_buf of the 0th byte in the buffer */ + gsize recv_buf_fill; /* number of bytes occupied in the buffer */ + + /* Parsed from the Content-Length header provided by the other endpoint. */ + gsize content_length; } HttpPriv; @@ -84,14 +91,14 @@ static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); static void add_to_be_sent (NiceSocket *sock, const NiceAddress *to, - const gchar *buf, guint len); + const NiceOutputMessage *messages, guint n_messages); static void free_to_be_sent (struct to_be_sent *tbs); @@ -111,14 +118,16 @@ priv->username = g_strdup (username); priv->password = g_strdup (password); priv->recv_buf = NULL; - priv->recv_len = 0; + priv->recv_buf_length = 0; + priv->recv_buf_pos = 0; + priv->recv_buf_fill = 0; priv->content_length = 0; sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; @@ -128,6 +137,9 @@ gchar *credential = NULL; gchar host[INET6_ADDRSTRLEN]; gint port = nice_address_get_port (&priv->addr); + GOutputVector local_bufs; + NiceOutputMessage local_messages; + nice_address_to_string (&priv->addr, host); if (username) { @@ -150,7 +162,12 @@ credential? credential : "" ); g_free (credential); - nice_socket_send (priv->base_socket, NULL, strlen (msg), msg); + local_bufs.buffer = msg; + local_bufs.size = strlen (msg); + local_messages.buffers = &local_bufs; + local_messages.n_buffers = 1; + + nice_socket_send_messages (priv->base_socket, NULL, &local_messages, 1); priv->state = HTTP_STATE_INIT; g_free (msg); } @@ -183,164 +200,360 @@ g_slice_free(HttpPriv, sock->priv); } +static void +assert_ring_buffer_valid (HttpPriv *priv) +{ + g_assert (priv->recv_buf_fill <= priv->recv_buf_length); + g_assert (priv->recv_buf_pos == 0 || + priv->recv_buf_pos < priv->recv_buf_length); + g_assert (priv->recv_buf_length == 0 || priv->recv_buf != NULL); +} + +/* Pops up to @buffer_length bytes off the ring buffer and copies them into + * @buffer. Returns the number of bytes copied. */ +static gsize +memcpy_ring_buffer_to_buffer (HttpPriv *priv, + guint8 *buffer, gsize buffer_length) +{ + gsize len, consumed = 0; + gboolean has_wrapped; + + has_wrapped = + (priv->recv_buf_pos + priv->recv_buf_fill) > priv->recv_buf_length; + + if (has_wrapped) { + len = MIN (priv->recv_buf_length - priv->recv_buf_pos, buffer_length); + memcpy (buffer, priv->recv_buf + priv->recv_buf_pos, len); + consumed += len; + + buffer += len; + buffer_length -= len; + + len = MIN (priv->recv_buf_fill - len, buffer_length); + memcpy (buffer, priv->recv_buf, len); + consumed += len; + } else { + len = MIN (priv->recv_buf_fill, buffer_length); + memcpy (buffer, priv->recv_buf + priv->recv_buf_pos, len); + consumed += len; + } + + priv->recv_buf_pos = + (priv->recv_buf_pos + consumed) % priv->recv_buf_length; + priv->recv_buf_fill -= consumed; + + return consumed; +} + +/* Returns the number of messages touched. Silently drops any data from @buffer + * which doesn’t fit in @messages. Updates the ring buffer to pop the copied + * data off it. Treats all #GInputVectors in @messages the same; there is no + * differentiation between different #NiceInputMessages. */ +static gint +memcpy_ring_buffer_to_input_messages (HttpPriv *priv, + NiceInputMessage *messages, guint n_messages) +{ + guint i, j; + + for (i = 0; priv->recv_buf_fill > 0 && i < n_messages; i++) { + NiceInputMessage *message = &messages[i]; + + for (j = 0; + priv->recv_buf_fill > 0 && + ((message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL)); + j++) { + message->buffers[j].size = + memcpy_ring_buffer_to_buffer (priv, + message->buffers[j].buffer, message->buffers[j].size); + } + } + + return i; +} +/* FIXME: The current implementation of socket_recv_message() is a fast + * pass-through to nice_socket_recv_message() if the HTTP socket is connected, + * but is a slow state machine otherwise, using multiple memcpy()s. Spruce it up + * to better to use the recv_messages to avoid the memcpy()s. */ static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { HttpPriv *priv = sock->priv; - gint read = -1; + gint ret = -1; - if (from) - *from = priv->addr; + if (priv->state == HTTP_STATE_CONNECTED) { + guint i; - if (priv->base_socket) - read = nice_socket_recv (priv->base_socket, NULL, len, buf); + /* Fast path: pass through to the base socket once we’re connected. */ + if (priv->base_socket) { + ret = nice_socket_recv_messages (priv->base_socket, + recv_messages, n_recv_messages); + } - if (read <= 0 || priv->state == HTTP_STATE_CONNECTED) { - return read; + if (ret <= 0) + return ret; + + /* After successfully receiving into at least one NiceInputMessage, + * update the from address in each valid NiceInputMessage. */ + for (i = 0; i < (guint) ret; i++) { + if (recv_messages[i].from != NULL) + *recv_messages[i].from = priv->addr; + } + + return ret; } else { - priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len + read); - memcpy (priv->recv_buf + priv->recv_len, buf, read); - priv->recv_len += read; + /* Slow path: read into a local ring buffer until we’re parsed enough of the + * headers. Double the buffer in size every time it fills up. */ + gboolean has_wrapped; + GInputVector local_recv_bufs[2]; + NiceInputMessage local_recv_message = { local_recv_bufs, 2, NULL, 0 }; + + /* Has the buffer filled up? Start with an initial buffer of 1KB, which + * should cover the average size of HTTP response headers. Source: + * http://dev.chromium.org/spdy/spdy-whitepaper */ + if (priv->recv_buf_fill == priv->recv_buf_length) { + priv->recv_buf_length = MAX (priv->recv_buf_length * 2, 1024); + priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_buf_length); + } + + assert_ring_buffer_valid (priv); + + /* Read some data into the buffer. Use two GInputVectors: one for the tail + * of the buffer and one for the head. */ + has_wrapped = + (priv->recv_buf_pos + priv->recv_buf_fill) > priv->recv_buf_length; + + if (has_wrapped) { + local_recv_bufs[0].buffer = + priv->recv_buf + (priv->recv_buf_pos + priv->recv_buf_fill) % + priv->recv_buf_length; + local_recv_bufs[0].size = priv->recv_buf_length - priv->recv_buf_fill; + local_recv_bufs[1].buffer = NULL; + local_recv_bufs[1].size = 0; + } else { + local_recv_bufs[0].buffer = + priv->recv_buf + priv->recv_buf_pos + priv->recv_buf_fill; + local_recv_bufs[0].size = + priv->recv_buf_length - (priv->recv_buf_pos + priv->recv_buf_fill); + local_recv_bufs[1].buffer = priv->recv_buf; + local_recv_bufs[1].size = priv->recv_buf_pos; + } + + if (priv->base_socket) { + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + } + + if (ret <= 0) + return ret; + + /* Update the buffer’s metadata. */ + priv->recv_buf_fill += local_recv_message.length; + assert_ring_buffer_valid (priv); + + /* Fall through and try parsing the newly received data. */ } - retry: - nice_debug ("Receiving from HTTP proxy (state %d) : %d \n'%s'", priv->state, priv->recv_len, priv->recv_buf); +#define GET_BYTE(pos) \ + priv->recv_buf[(pos + priv->recv_buf_pos) % priv->recv_buf_length] +#define EAT_WHITESPACE(pos) \ + while (pos < priv->recv_buf_fill && GET_BYTE(pos) == ' ') \ + pos++; \ + if (pos >= priv->recv_buf_fill) \ + goto not_enough_data; + +retry: + nice_debug ("Receiving from HTTP proxy (state %d) : %" G_GSSIZE_FORMAT " \n" + "'%s'", priv->state, priv->recv_buf_fill, + priv->recv_buf + priv->recv_buf_pos); + switch (priv->state) { case HTTP_STATE_INIT: { - gint pos = 0; - - /* Remove any leading spaces (could happen!) */ - while (pos < priv->recv_len && priv->recv_buf[pos] == ' ') - pos++; + /* This is a logical position in the recv_buf; add + * (priv->recv_buf + priv->recv_buf_pos) to get the actual byte in + * memory. */ + guint pos = 0; - /* Make sure we have enough data */ - if (pos >= priv->recv_len) - goto not_enough_data; + /* Eat leading whitespace and check we have enough data. */ + EAT_WHITESPACE (pos); - if (pos + 7 > priv->recv_len) + if (pos + 7 > priv->recv_buf_fill) goto not_enough_data; - if (strncmp (priv->recv_buf + pos, "HTTP/1.", 7) != 0) + if (GET_BYTE (pos + 0) != 'H' || + GET_BYTE (pos + 1) != 'T' || + GET_BYTE (pos + 2) != 'T' || + GET_BYTE (pos + 3) != 'P' || + GET_BYTE (pos + 4) != '/' || + GET_BYTE (pos + 5) != '1' || + GET_BYTE (pos + 6) != '.') goto error; pos += 7; - if (pos >= priv->recv_len) + if (pos >= priv->recv_buf_fill) goto not_enough_data; - if(priv->recv_buf[pos] != '0' && priv->recv_buf[pos] != '1') + if (GET_BYTE (pos) != '0' && GET_BYTE (pos) != '1') goto error; pos++; /* Make sure we have a space after the HTTP version */ - if (pos >= priv->recv_len) + if (pos >= priv->recv_buf_fill) goto not_enough_data; - if (priv->recv_buf[pos] != ' ') + if (GET_BYTE (pos) != ' ') goto error; - /* Skip all spaces (could be more than one!) */ - while (pos < priv->recv_len && priv->recv_buf[pos] == ' ') - pos++; - if (pos >= priv->recv_len) - goto not_enough_data; + EAT_WHITESPACE (pos); - /* Check for a successfull 2xx code */ - if (pos + 3 > priv->recv_len) + /* Check for a successful 2xx code */ + if (pos + 3 > priv->recv_buf_fill) goto not_enough_data; - if (priv->recv_buf[pos] != '2' || - priv->recv_buf[pos+1] < '0' || priv->recv_buf[pos+1] > '9' || - priv->recv_buf[pos+2] < '0' || priv->recv_buf[pos+2] > '9') + if (GET_BYTE (pos) != '2' || + GET_BYTE (pos + 1) < '0' || GET_BYTE (pos + 1) > '9' || + GET_BYTE (pos + 2) < '0' || GET_BYTE (pos + 2) > '9') goto error; /* Clear any trailing chars */ - while (pos + 1 < priv->recv_len && - priv->recv_buf[pos] != '\r' && priv->recv_buf[pos+1] != '\n') + while (pos + 1 < priv->recv_buf_fill && + GET_BYTE (pos) != '\r' && GET_BYTE (pos + 1) != '\n') pos++; - if (pos + 1 >= priv->recv_len) + if (pos + 1 >= priv->recv_buf_fill) goto not_enough_data; pos += 2; - /* consume the data we just parsed */ - priv->recv_len -= pos; - memmove (priv->recv_buf, priv->recv_buf + pos, priv->recv_len); - priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len); + /* Consume the data we just parsed. */ + priv->recv_buf_pos = (priv->recv_buf_pos + pos) % priv->recv_buf_length; + priv->recv_buf_fill -= pos; priv->content_length = 0; priv->state = HTTP_STATE_HEADERS; + goto retry; } break; case HTTP_STATE_HEADERS: { - gint pos = 0; + guint pos = 0; - if (pos + 15 < priv->recv_len && - g_ascii_strncasecmp (priv->recv_buf, "Content-Length:", 15) == 0) { - priv->content_length = atoi(priv->recv_buf + 15); + if (pos + 15 < priv->recv_buf_fill && + (GET_BYTE (pos + 0) == 'C' || GET_BYTE (pos + 0) == 'c') && + (GET_BYTE (pos + 1) == 'o' || GET_BYTE (pos + 1) == 'O') && + (GET_BYTE (pos + 2) == 'n' || GET_BYTE (pos + 2) == 'N') && + (GET_BYTE (pos + 3) == 't' || GET_BYTE (pos + 3) == 'T') && + (GET_BYTE (pos + 4) == 'e' || GET_BYTE (pos + 4) == 'E') && + (GET_BYTE (pos + 5) == 'n' || GET_BYTE (pos + 5) == 'N') && + (GET_BYTE (pos + 6) == 't' || GET_BYTE (pos + 6) == 'T') && + GET_BYTE (pos + 7) == '-' && + (GET_BYTE (pos + 8) == 'L' || GET_BYTE (pos + 8) == 'l') && + (GET_BYTE (pos + 9) == 'e' || GET_BYTE (pos + 9) == 'E') && + (GET_BYTE (pos + 10) == 'n' || GET_BYTE (pos + 10) == 'N') && + (GET_BYTE (pos + 11) == 'g' || GET_BYTE (pos + 11) == 'G') && + (GET_BYTE (pos + 12) == 't' || GET_BYTE (pos + 12) == 'T') && + (GET_BYTE (pos + 13) == 'h' || GET_BYTE (pos + 13) == 'H') && + GET_BYTE (pos + 14) == ':') { + /* Found a Content-Length header. Parse and store the value. Note that + * the HTTP standard allows for arbitrarily-big content lengths. We + * limit it to G_MAXSIZE for sanity’s sake. + * + * The code below is equivalent to strtoul(input, NULL, 10), but + * operates on a ring buffer. */ + pos += 15; + EAT_WHITESPACE (pos); + priv->content_length = 0; + + while (TRUE) { + guint8 byte = GET_BYTE (pos); + gint val = g_ascii_digit_value (byte); + + if (byte == '\r') { + /* Reached the end of the value; fall out to the code below which + * will grab the \n. */ + break; + } else if (val == -1) { + priv->content_length = 0; + goto error; + } + + /* Check for overflow. Don’t flag it as an error; just fall through + * to the code below which will skip to the \r\n. */ + if (priv->content_length > G_MAXSIZE / 10 || + priv->content_length * 10 > G_MAXSIZE - val) { + priv->content_length = 0; + break; + } + + priv->content_length = (priv->content_length * 10) + val; + + if (pos + 1 > priv->recv_buf_fill) + goto not_enough_data; + pos++; + } } - while (pos + 1 < priv->recv_len && - priv->recv_buf[pos] != '\r' && priv->recv_buf[pos+1] != '\n') + + /* Skip over the header. */ + while (pos + 1 < priv->recv_buf_fill && + GET_BYTE (pos) != '\r' && GET_BYTE (pos + 1) != '\n') pos++; - nice_debug ("pos = %d, len = %d", pos, priv->recv_len); - if (pos + 1 >= priv->recv_len) + + nice_debug ("pos = %u, fill = %" G_GSSIZE_FORMAT, + pos, priv->recv_buf_fill); + + if (pos + 1 >= priv->recv_buf_fill) goto not_enough_data; pos += 2; - /* consume the data we just parsed */ - priv->recv_len -= pos; - memmove (priv->recv_buf, priv->recv_buf + pos, priv->recv_len); - priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len); + /* Consume the data we just parsed. */ + priv->recv_buf_pos = (priv->recv_buf_pos + pos) % priv->recv_buf_length; + priv->recv_buf_fill -= pos; if (pos == 2) priv->state = HTTP_STATE_BODY; + goto retry; } break; case HTTP_STATE_BODY: { - gint consumed = priv->content_length; + gsize consumed; + if (priv->content_length == 0) { priv->state = HTTP_STATE_CONNECTED; goto retry; } - if (priv->recv_len == 0) + + if (priv->recv_buf_fill == 0) goto not_enough_data; - if (priv->content_length > priv->recv_len) - consumed = priv->recv_len; + consumed = MIN (priv->content_length, priv->recv_buf_fill); - priv->recv_len -= consumed; + priv->recv_buf_pos = + (priv->recv_buf_pos + consumed) % priv->recv_buf_length; + priv->recv_buf_fill -= consumed; priv->content_length -= consumed; - memmove (priv->recv_buf, priv->recv_buf + consumed, priv->recv_len); - priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len); + goto retry; } break; case HTTP_STATE_CONNECTED: { - guint read = priv->recv_len; + gsize len; struct to_be_sent *tbs = NULL; - if (read > len) - read = len; - - memcpy (buf, priv->recv_buf, read); - - /* consume the data we returned */ - priv->recv_len -= read; - memmove (priv->recv_buf, priv->recv_buf + read, priv->recv_len); - priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len); + len = memcpy_ring_buffer_to_input_messages (priv, + recv_messages, n_recv_messages); /* Send the pending data */ while ((tbs = g_queue_pop_head (&priv->send_queue))) { - nice_socket_send (priv->base_socket, &tbs->to, - tbs->length, tbs->buf); + nice_socket_send (priv->base_socket, &tbs->to, tbs->length, tbs->buf); g_free (tbs->buf); g_slice_free (struct to_be_sent, tbs); } - return read; + return len; } break; + case HTTP_STATE_ERROR: default: /* Unknown status */ goto error; @@ -359,23 +572,26 @@ return -1; } -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) { HttpPriv *priv = sock->priv; if (priv->state == HTTP_STATE_CONNECTED) { - if (priv->base_socket) - return nice_socket_send (priv->base_socket, to, len, buf); - else - return FALSE; + /* Fast path. */ + if (!priv->base_socket) + return -1; + + return nice_socket_send_messages (priv->base_socket, to, messages, + n_messages); } else if (priv->state == HTTP_STATE_ERROR) { - return FALSE; + return -1; } else { - add_to_be_sent (sock, to, buf, len); + add_to_be_sent (sock, to, messages, n_messages); } - return TRUE; + + return n_messages; } @@ -388,21 +604,45 @@ static void add_to_be_sent (NiceSocket *sock, const NiceAddress *to, - const gchar *buf, guint len) + const NiceOutputMessage *messages, guint n_messages) { HttpPriv *priv = sock->priv; - struct to_be_sent *tbs = NULL; + guint i; - if (len <= 0) + if (n_messages == 0) return; - tbs = g_slice_new0 (struct to_be_sent); - tbs->buf = g_memdup (buf, len); - tbs->length = len; - if (to) - tbs->to = *to; - g_queue_push_tail (&priv->send_queue, tbs); - + /* Compact the message’s buffers before queueing. */ + for (i = 0; i < n_messages; i++) { + const NiceOutputMessage *message = &messages[i]; + struct to_be_sent *tbs = NULL; + guint j; + gsize message_len_remaining = output_message_get_size (message); + gsize offset = 0; + + if (message_len_remaining == 0) + continue; + + tbs = g_slice_new0 (struct to_be_sent); + tbs->buf = g_malloc (message_len_remaining); + tbs->length = message_len_remaining; + if (to) + tbs->to = *to; + g_queue_push_tail (&priv->send_queue, tbs); + + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + const GOutputVector *buffer = &message->buffers[j]; + gsize len; + + len = MIN (buffer->size, message_len_remaining); + memcpy (tbs->buf + offset, buffer->buffer, len); + message_len_remaining -= len; + offset += len; + } + } } diff -Nru libnice-0.1.4/socket/Makefile.am libnice-0.1.7/socket/Makefile.am --- libnice-0.1.4/socket/Makefile.am 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/Makefile.am 2014-01-06 23:05:13.000000000 +0000 @@ -10,7 +10,7 @@ AM_CFLAGS = \ -DG_LOG_DOMAIN=\"libnice-socket\" \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) \ -I $(top_srcdir)/random \ diff -Nru libnice-0.1.4/socket/Makefile.in libnice-0.1.7/socket/Makefile.in --- libnice-0.1.4/socket/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/socket/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -24,23 +23,51 @@ # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ esac; \ - test $$am__dry = yes; \ - } + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -59,11 +86,12 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/depcomp subdir = socket ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -78,6 +106,19 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -90,20 +131,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libsocket_la_SOURCES) DIST_SOURCES = $(libsocket_la_SOURCES) am__can_run_installinfo = \ @@ -111,6 +148,23 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -257,27 +311,10 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda AM_CFLAGS = \ -DG_LOG_DOMAIN=\"libnice-socket\" \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) \ -I $(top_srcdir)/random \ @@ -341,12 +378,15 @@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libsocket.la: $(libsocket_la_OBJECTS) $(libsocket_la_DEPENDENCIES) $(EXTRA_libsocket_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libsocket_la_OBJECTS) $(libsocket_la_LIBADD) $(LIBS) @@ -392,26 +432,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -423,15 +452,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -440,6 +465,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -582,18 +622,19 @@ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am check-valgrind: diff -Nru libnice-0.1.4/socket/pseudossl.c libnice-0.1.7/socket/pseudossl.c --- libnice-0.1.4/socket/pseudossl.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/pseudossl.c 2014-04-09 02:44:13.000000000 +0000 @@ -43,6 +43,7 @@ #endif #include "pseudossl.h" +#include "agent-priv.h" #include @@ -58,8 +59,8 @@ struct to_be_sent { - guint length; - gchar *buf; + guint8 *buf; /* owned */ + gsize length; NiceAddress to; }; @@ -89,14 +90,14 @@ static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); static void add_to_be_sent (NiceSocket *sock, const NiceAddress *to, - const gchar *buf, guint len); + const NiceOutputMessage *messages, guint n_messages); static void free_to_be_sent (struct to_be_sent *tbs); @@ -112,8 +113,8 @@ sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; @@ -142,28 +143,39 @@ static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { PseudoSSLPriv *priv = sock->priv; if (priv->handshaken) { - if (priv->base_socket) - return nice_socket_recv (priv->base_socket, from, len, buf); + if (priv->base_socket) { + /* Fast path: once we’ve done the handshake, pass straight through to the + * base socket. */ + return nice_socket_recv_messages (priv->base_socket, + recv_messages, n_recv_messages); + } } else { - gchar data[sizeof(SSL_SERVER_HANDSHAKE)]; - gint ret = -1; - - if (priv->base_socket) - ret = nice_socket_recv (priv->base_socket, from, sizeof(data), data); + guint8 data[sizeof(SSL_SERVER_HANDSHAKE)]; + gint ret = -1; + GInputVector local_recv_buf = { data, sizeof (data) }; + NiceInputMessage local_recv_message = { &local_recv_buf, 1, NULL, 0 }; + + if (priv->base_socket) { + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + } if (ret <= 0) { return ret; - } else if ((guint) ret == sizeof(SSL_SERVER_HANDSHAKE) && + } else if (ret == 1 && + local_recv_buf.size == sizeof (SSL_SERVER_HANDSHAKE) && memcmp(SSL_SERVER_HANDSHAKE, data, sizeof(SSL_SERVER_HANDSHAKE)) == 0) { struct to_be_sent *tbs = NULL; priv->handshaken = TRUE; while ((tbs = g_queue_pop_head (&priv->send_queue))) { - nice_socket_send (priv->base_socket, &tbs->to, tbs->length, tbs->buf); + nice_socket_send (priv->base_socket, &tbs->to, tbs->length, + (const gchar *) tbs->buf); g_free (tbs->buf); g_slice_free (struct to_be_sent, tbs); } @@ -178,19 +190,22 @@ return 0; } -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) { PseudoSSLPriv *priv = sock->priv; if (priv->handshaken) { - if (priv->base_socket) - return nice_socket_send (priv->base_socket, to, len, buf); - else + /* Fast path: pass directly through to the base socket once the handshake is + * complete. */ + if (priv->base_socket == NULL) return FALSE; + + return nice_socket_send_messages (priv->base_socket, to, messages, + n_messages); } else { - add_to_be_sent (sock, to, buf, len); + add_to_be_sent (sock, to, messages, n_messages); } return TRUE; } @@ -205,21 +220,43 @@ static void add_to_be_sent (NiceSocket *sock, const NiceAddress *to, - const gchar *buf, guint len) + const NiceOutputMessage *messages, guint n_messages) { PseudoSSLPriv *priv = sock->priv; - struct to_be_sent *tbs = NULL; - - if (len <= 0) - return; + guint i; - tbs = g_slice_new0 (struct to_be_sent); - tbs->buf = g_memdup (buf, len); - tbs->length = len; - if (to) - tbs->to = *to; - g_queue_push_tail (&priv->send_queue, tbs); + for (i = 0; i < n_messages; i++) { + struct to_be_sent *tbs; + const NiceOutputMessage *message = &messages[i]; + guint j; + gsize offset = 0; + gsize message_len; + + tbs = g_slice_new0 (struct to_be_sent); + + message_len = output_message_get_size (message); + + /* Compact the buffer. */ + tbs->buf = g_malloc (message_len); + tbs->length = message_len; + if (to != NULL) + tbs->to = *to; + g_queue_push_tail (&priv->send_queue, tbs); + + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + const GOutputVector *buffer = &message->buffers[j]; + gsize len; + + len = MIN (message_len - offset, buffer->size); + memcpy (tbs->buf + offset, buffer->buffer, len); + offset += len; + } + g_assert (offset == message_len); + } } static void diff -Nru libnice-0.1.4/socket/socket.c libnice-0.1.7/socket/socket.c --- libnice-0.1.4/socket/socket.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/socket.c 2014-04-09 02:44:13.000000000 +0000 @@ -43,17 +43,116 @@ #include "socket.h" +/** + * nice_socket_recv_messages: + * @sock: a #NiceSocket + * @recv_messages: (array length=n_recv_messages) (out caller-allocates): + * array of #NiceInputMessages to return received messages in + * @n_recv_messages: number of elements in the @recv_messages array + * + * Receive up to @n_recv_messages message on the socket, in a non-reliable, + * non-blocking fashion. The total size of the buffers in each #NiceInputMessage + * must be big enough to contain an entire message (65536 bytes), or excess + * bytes will be silently dropped. + * + * On success, the number of messages received into @recv_messages is returned, + * which may be less than @n_recv_messages if the call would have blocked + * part-way through. If the socket would have blocked to begin with, or if + * @n_recv_messages is zero, zero is returned. On failure, a negative value is + * returned, but no further error information is available. Calling this + * function on a socket which has closed is an error, and a negative value is + * returned. + * + * If a positive N is returned, the first N messages in @recv_messages are + * valid. Each valid message is guaranteed to have a non-zero + * #NiceInputMessage::length, and its buffers are guaranteed to be filled + * sequentially up to that number of bytes If #NiceInputMessage::from was + * non-%NULL for a valid message, it may be set to the address of the sender of + * that received message. + * + * If the return value is zero or negative, the from return address and length + * in every #NiceInputMessage in @recv_messages are guaranteed to be unmodified. + * The buffers may have been modified. + * + * The base addresses and sizes of the buffers in a #NiceInputMessage are never + * modified. Neither is the base address of #NiceInputMessage::from, nor the + * base address and length of the #NiceInputMessage::buffers array. + * + * Returns: number of valid messages returned in @recv_messages, or a negative + * value on error + * + * Since: 0.1.5 + */ gint -nice_socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +nice_socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { - return sock->recv (sock, from, len, buf); + g_return_val_if_fail (sock != NULL, -1); + g_return_val_if_fail (n_recv_messages == 0 || recv_messages != NULL, -1); + + return sock->recv_messages (sock, recv_messages, n_recv_messages); } -gboolean -nice_socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +/** + * nice_socket_send_messages: + * @sock: a #NiceSocket + * @messages: (array length=n_messages) (in caller-allocates): + * array of #NiceOutputMessages containing the messages to send + * @n_messages: number of elements in the @messages array + * + * Send up to @n_messages on the socket, in a non-reliable, non-blocking + * fashion. The total size of the buffers in each #NiceOutputMessage + * must be at most the maximum UDP payload size (65535 bytes), or excess + * bytes will be silently dropped. + * + * On success, the number of messages transmitted from @messages is returned, + * which may be less than @n_messages if the call would have blocked + * part-way through. If the socket would have blocked to begin with, or if + * @n_messages is zero, zero is returned. On failure, a negative value is + * returned, but no further error information is available. Calling this + * function on a socket which has closed is an error, and a negative value is + * returned. + * + * If a positive N is returned, the first N messages in @messages have been + * sent in full, and the remaining messages have not been sent at all. + * + * If #NiceOutputMessage::to is specified for a message, that will be used as + * the destination address for the message. Otherwise, if %NULL, the default + * destination for @sock will be used. + * + * Every field of every #NiceOutputMessage is guaranteed to be unmodified when + * this function returns. + * + * Returns: number of messages successfully sent from @messages, or a negative + * value on error + * + * Since: 0.1.5 + */ +gint +nice_socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) +{ + g_return_val_if_fail (sock != NULL, -1); + g_return_val_if_fail (n_messages == 0 || messages != NULL, -1); + + return sock->send_messages (sock, to, messages, n_messages); +} + +/* Convenience wrapper around nice_socket_send_messages(). Returns the number of + * bytes sent on success (which will be @len), zero if sending would block, or + * -1 on error. */ +gssize +nice_socket_send (NiceSocket *sock, const NiceAddress *to, gsize len, + const gchar *buf) { - return sock->send (sock, to, len, buf); + GOutputVector local_buf = { buf, len }; + NiceOutputMessage local_message = { &local_buf, 1}; + gint ret; + + ret = sock->send_messages (sock, to, &local_message, 1); + if (ret == 1) + return len; + return ret; } gboolean @@ -70,4 +169,3 @@ g_slice_free (NiceSocket,sock); } } - diff -Nru libnice-0.1.4/socket/socket.h libnice-0.1.7/socket/socket.h --- libnice-0.1.4/socket/socket.h 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/socket.h 2014-04-09 02:44:13.000000000 +0000 @@ -37,6 +37,7 @@ #ifndef _SOCKET_H #define _SOCKET_H +#include "agent.h" #include "address.h" #include @@ -58,10 +59,13 @@ { NiceAddress addr; GSocket *fileno; - gint (*recv) (NiceSocket *sock, NiceAddress *from, guint len, - gchar *buf); - gboolean (*send) (NiceSocket *sock, const NiceAddress *to, guint len, - const gchar *buf); + /* Implementations must handle any value of n_recv_messages, including 0. Iff + * n_recv_messages is 0, recv_messages may be NULL. */ + gint (*recv_messages) (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); + /* As above, @n_messages may be zero. Iff so, @messages may be %NULL. */ + gint (*send_messages) (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); gboolean (*is_reliable) (NiceSocket *sock); void (*close) (NiceSocket *sock); void *priv; @@ -69,11 +73,15 @@ G_GNUC_WARN_UNUSED_RESULT gint -nice_socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf); +nice_socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); -gboolean -nice_socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +gint +nice_socket_send_messages (NiceSocket *sock, const NiceAddress *addr, + const NiceOutputMessage *messages, guint n_messages); +gssize +nice_socket_send (NiceSocket *sock, const NiceAddress *addr, gsize len, + const gchar *buf); gboolean nice_socket_is_reliable (NiceSocket *sock); diff -Nru libnice-0.1.4/socket/socks5.c libnice-0.1.7/socket/socks5.c --- libnice-0.1.4/socket/socks5.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/socks5.c 2014-04-09 02:44:13.000000000 +0000 @@ -43,6 +43,7 @@ #endif #include "socks5.h" +#include "agent-priv.h" #include @@ -69,21 +70,21 @@ struct to_be_sent { - guint length; - gchar *buf; + guint8 *buf; /* owned */ + gsize length; NiceAddress to; }; static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); static void add_to_be_sent (NiceSocket *sock, const NiceAddress *to, - const gchar *buf, guint len); + const NiceOutputMessage *messages, guint n_messages); static void free_to_be_sent (struct to_be_sent *tbs); @@ -105,8 +106,8 @@ sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; @@ -160,31 +161,50 @@ static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { Socks5Priv *priv = sock->priv; - - if (from) - *from = priv->addr; + guint i; + gint ret = -1; switch (priv->state) { case SOCKS_STATE_CONNECTED: - if (priv->base_socket) - return nice_socket_recv (priv->base_socket, NULL, len, buf); - break; + /* Common case: fast pass-through to the base socket once we’re + * connected. */ + if (priv->base_socket) { + ret = nice_socket_recv_messages (priv->base_socket, + recv_messages, n_recv_messages); + } + + if (ret <= 0) + return ret; + + /* After successfully receiving into at least one NiceInputMessage, + * update the from address in each valid NiceInputMessage. */ + for (i = 0; i < (guint) ret; i++) { + if (recv_messages[i].from != NULL) + *recv_messages[i].from = priv->addr; + } + + return ret; + case SOCKS_STATE_INIT: { - gchar data[2]; - gint ret = -1; + guint8 data[2]; + GInputVector local_recv_buf = { data, sizeof (data) }; + NiceInputMessage local_recv_message = { &local_recv_buf, 1, NULL, 0 }; nice_debug ("Socks5 state Init"); - if (priv->base_socket) - ret = nice_socket_recv (priv->base_socket, NULL, sizeof(data), data); + if (priv->base_socket) { + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + } if (ret <= 0) { return ret; - } else if(ret == sizeof(data)) { + } else if (ret == 1 && local_recv_buf.size == sizeof(data)) { if (data[0] == 0x05) { if (data[1] == 0x02) { gchar msg[515]; @@ -242,16 +262,19 @@ break; case SOCKS_STATE_AUTH: { - gchar data[2]; - gint ret = -1; + guint8 data[2]; + GInputVector local_recv_buf = { data, sizeof (data) }; + NiceInputMessage local_recv_message = { &local_recv_buf, 1, NULL, 0 }; nice_debug ("Socks5 state auth"); - if (priv->base_socket) - ret = nice_socket_recv (priv->base_socket, NULL, sizeof(data), data); + if (priv->base_socket) { + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + } if (ret <= 0) { return ret; - } else if(ret == sizeof(data)) { + } else if (ret == 1 && local_recv_buf.size == sizeof(data)) { if (data[0] == 0x01 && data[1] == 0x00) { /* Authenticated */ goto send_connect; @@ -264,16 +287,20 @@ break; case SOCKS_STATE_CONNECT: { - gchar data[22]; - gint ret = -1; + guint8 data[22]; + GInputVector local_recv_buf = { data, sizeof (data) }; + NiceInputMessage local_recv_message = { &local_recv_buf, 1, NULL, 0 }; nice_debug ("Socks5 state connect"); - if (priv->base_socket) - ret = nice_socket_recv (priv->base_socket, NULL, 4, data); + if (priv->base_socket) { + local_recv_buf.size = 4; + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + } if (ret <= 0) { return ret; - } else if(ret == 4) { + } else if (ret == 1 && local_recv_buf.size == 4) { if (data[0] == 0x05) { switch (data[1]) { case 0x00: @@ -281,15 +308,19 @@ struct to_be_sent *tbs = NULL; switch (data[3]) { case 0x01: /* IPV4 bound address */ - ret = nice_socket_recv (priv->base_socket, NULL, 6, data); - if (ret != 6) { + local_recv_buf.size = 6; + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + if (ret != 1 || local_recv_buf.size != 6) { /* Could not read server bound address */ goto error; } break; case 0x04: /* IPV6 bound address */ - ret = nice_socket_recv (priv->base_socket, NULL, 18, data); - if (ret != 18) { + local_recv_buf.size = 18; + ret = nice_socket_recv_messages (priv->base_socket, + &local_recv_message, 1); + if (ret != 1 || local_recv_buf.size != 18) { /* Could not read server bound address */ goto error; } @@ -300,7 +331,7 @@ } while ((tbs = g_queue_pop_head (&priv->send_queue))) { nice_socket_send (priv->base_socket, &tbs->to, - tbs->length, tbs->buf); + tbs->length, (const gchar *) tbs->buf); g_free (tbs->buf); g_slice_free (struct to_be_sent, tbs); } @@ -332,6 +363,7 @@ } } break; + case SOCKS_STATE_ERROR: default: /* Unknown status */ goto error; @@ -343,27 +375,32 @@ { gchar msg[22]; gint len = 0; - struct sockaddr_storage name; - nice_address_copy_to_sockaddr(&priv->addr, (struct sockaddr *)&name); + union { + struct sockaddr_storage storage; + struct sockaddr addr; + struct sockaddr_in in; + struct sockaddr_in6 in6; + } name; + nice_address_copy_to_sockaddr(&priv->addr, &name.addr); msg[len++] = 0x05; /* SOCKS version */ msg[len++] = 0x01; /* connect command */ msg[len++] = 0x00; /* reserved */ - if (name.ss_family == AF_INET) { + if (name.storage.ss_family == AF_INET) { msg[len++] = 0x01; /* IPV4 address type */ /* Address */ - memcpy (msg + len, &((struct sockaddr_in *) &name)->sin_addr, 4); + memcpy (msg + len, &(&name.in)->sin_addr, 4); len += 4; /* Port */ - memcpy (msg + len, &((struct sockaddr_in *) &name)->sin_port, 2); + memcpy (msg + len, &(&name.in)->sin_port, 2); len += 2; - } else if (name.ss_family == AF_INET6) { + } else if (name.storage.ss_family == AF_INET6) { msg[len++] = 0x04; /* IPV6 address type */ /* Address */ - memcpy (msg + len, &((struct sockaddr_in6 *) &name)->sin6_addr, 16); + memcpy (msg + len, &(&name.in6)->sin6_addr, 16); len += 16; /* Port */ - memcpy (msg + len, &((struct sockaddr_in6 *) &name)->sin6_port, 2); + memcpy (msg + len, &(&name.in6)->sin6_port, 2); len += 2; } @@ -382,21 +419,23 @@ return -1; } -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) { Socks5Priv *priv = sock->priv; if (priv->state == SOCKS_STATE_CONNECTED) { - if (priv->base_socket) - return nice_socket_send (priv->base_socket, to, len, buf); - else + /* Fast path: pass through to the base socket once connected. */ + if (priv->base_socket == NULL) return FALSE; + + return nice_socket_send_messages (priv->base_socket, to, messages, + n_messages); } else if (priv->state == SOCKS_STATE_ERROR) { return FALSE; } else { - add_to_be_sent (sock, to, buf, len); + add_to_be_sent (sock, to, messages, n_messages); } return TRUE; } @@ -411,21 +450,40 @@ static void add_to_be_sent (NiceSocket *sock, const NiceAddress *to, - const gchar *buf, guint len) + const NiceOutputMessage *messages, guint n_messages) { Socks5Priv *priv = sock->priv; - struct to_be_sent *tbs = NULL; - - if (len <= 0) - return; + guint i; - tbs = g_slice_new0 (struct to_be_sent); - tbs->buf = g_memdup (buf, len); - tbs->length = len; - if (to) - tbs->to = *to; - g_queue_push_tail (&priv->send_queue, tbs); + for (i = 0; i < n_messages; i++) { + struct to_be_sent *tbs; + const NiceOutputMessage *message = &messages[i]; + guint j; + gsize offset = 0; + + tbs = g_slice_new0 (struct to_be_sent); + + /* Compact the buffer. */ + tbs->length = output_message_get_size (message); + tbs->buf = g_malloc (tbs->length); + if (to != NULL) + tbs->to = *to; + g_queue_push_tail (&priv->send_queue, tbs); + + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + const GOutputVector *buffer = &message->buffers[j]; + gsize len; + + len = MIN (tbs->length - offset, buffer->size); + memcpy (tbs->buf + offset, buffer->buffer, len); + offset += len; + } + g_assert (offset == tbs->length); + } } diff -Nru libnice-0.1.4/socket/tcp-bsd.c libnice-0.1.7/socket/tcp-bsd.c --- libnice-0.1.4/socket/tcp-bsd.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/tcp-bsd.c 2014-04-09 03:14:47.000000000 +0000 @@ -62,23 +62,23 @@ } TcpPriv; struct to_be_sent { - guint length; - gchar *buf; + guint8 *buf; + gsize length; gboolean can_drop; }; #define MAX_QUEUE_LENGTH 20 static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); -static void add_to_be_sent (NiceSocket *sock, const gchar *buf, guint len, - gboolean head); +static void add_to_be_sent (NiceSocket *sock, const NiceOutputMessage *message, + gsize message_offset, gsize message_len, gboolean head); static void free_to_be_sent (struct to_be_sent *tbs); static gboolean socket_send_more (GSocket *gsocket, GIOCondition condition, gpointer data); @@ -86,7 +86,10 @@ NiceSocket * nice_tcp_bsd_socket_new (GMainContext *ctx, NiceAddress *addr) { - struct sockaddr_storage name; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } name; NiceSocket *sock; TcpPriv *priv; GSocket *gsock = NULL; @@ -101,25 +104,23 @@ sock = g_slice_new0 (NiceSocket); - nice_address_copy_to_sockaddr (addr, (struct sockaddr *)&name); + nice_address_copy_to_sockaddr (addr, &name.addr); - if (gsock == NULL) { - if (name.ss_family == AF_UNSPEC || name.ss_family == AF_INET) { - gsock = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, - G_SOCKET_PROTOCOL_TCP, NULL); + if (name.storage.ss_family == AF_UNSPEC || name.storage.ss_family == AF_INET) { + gsock = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, + G_SOCKET_PROTOCOL_TCP, NULL); - name.ss_family = AF_INET; + name.storage.ss_family = AF_INET; #ifdef HAVE_SA_LEN - name.ss_len = sizeof (struct sockaddr_in); + name.storage.ss_len = sizeof (struct sockaddr_in); #endif - } else if (name.ss_family == AF_INET6) { - gsock = g_socket_new (G_SOCKET_FAMILY_IPV6, G_SOCKET_TYPE_STREAM, - G_SOCKET_PROTOCOL_TCP, NULL); - name.ss_family = AF_INET6; + } else if (name.storage.ss_family == AF_INET6) { + gsock = g_socket_new (G_SOCKET_FAMILY_IPV6, G_SOCKET_TYPE_STREAM, + G_SOCKET_PROTOCOL_TCP, NULL); + name.storage.ss_family = AF_INET6; #ifdef HAVE_SA_LEN - name.ss_len = sizeof (struct sockaddr_in6); + name.storage.ss_len = sizeof (struct sockaddr_in6); #endif - } } if (gsock == NULL) { @@ -127,29 +128,33 @@ return NULL; } + gaddr = g_socket_address_new_from_native (&name.addr, sizeof (name)); + if (gaddr == NULL) { + g_object_unref (gsock); + g_slice_free (NiceSocket, sock); + return NULL; + } + /* GSocket: All socket file descriptors are set to be close-on-exec. */ g_socket_set_blocking (gsock, false); - gaddr = g_socket_address_new_from_native (&name, sizeof (name)); - - if (gaddr != NULL) { - gret = g_socket_connect (gsock, gaddr, NULL, &gerr); - g_object_unref (gaddr); - } + gret = g_socket_connect (gsock, gaddr, NULL, &gerr); + g_object_unref (gaddr); if (gret == FALSE) { if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_PENDING) == FALSE) { + g_error_free (gerr); g_socket_close (gsock, NULL); g_object_unref (gsock); g_slice_free (NiceSocket, sock); return NULL; } - g_error_free(gerr); + g_error_free (gerr); } gaddr = g_socket_get_local_address (gsock, NULL); if (gaddr == NULL || - !g_socket_address_to_native (gaddr, &name, sizeof (name), NULL)) { + !g_socket_address_to_native (gaddr, &name.addr, sizeof (name), NULL)) { g_slice_free (NiceSocket, sock); g_socket_close (gsock, NULL); g_object_unref (gsock); @@ -157,17 +162,19 @@ } g_object_unref (gaddr); - nice_address_set_from_sockaddr (&sock->addr, (struct sockaddr *)&name); + nice_address_set_from_sockaddr (&sock->addr, &name.addr); sock->priv = priv = g_slice_new0 (TcpPriv); + if (ctx == NULL) + ctx = g_main_context_default (); priv->context = g_main_context_ref (ctx); priv->server_addr = *addr; priv->error = FALSE; sock->fileno = gsock; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; @@ -199,91 +206,144 @@ } static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { TcpPriv *priv = sock->priv; - int ret; - GError *gerr = NULL; + guint i; /* Don't try to access the socket if it had an error */ if (priv->error) return -1; - ret = g_socket_receive (sock->fileno, buf, len, NULL, &gerr); + for (i = 0; i < n_recv_messages; i++) { + gint flags = G_SOCKET_MSG_NONE; + GError *gerr = NULL; + gssize len; + + len = g_socket_receive_message (sock->fileno, NULL, + recv_messages[i].buffers, recv_messages[i].n_buffers, + NULL, NULL, &flags, NULL, &gerr); + + recv_messages[i].length = MAX (len, 0); + + /* recv returns 0 when the peer performed a shutdown.. we must return -1 + * here so that the agent destroys the g_source */ + if (len == 0) { + priv->error = TRUE; + break; + } + + if (len < 0) { + if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) + len = 0; - /* recv returns 0 when the peer performed a shutdown.. we must return -1 here - * so that the agent destroys the g_source */ - if (ret == 0) { - priv->error = TRUE; - return -1; - } + g_error_free (gerr); + return len; + } - if (ret < 0) { - if(g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) - ret = 0; + if (recv_messages[i].from) + *recv_messages[i].from = priv->server_addr; - g_error_free (gerr); - return ret; + if (len <= 0) + break; } - if (from) - *from = priv->server_addr; - return ret; + /* Was there an error processing the first message? */ + if (priv->error && i == 0) + return -1; + + return i; } -/* Data sent to this function must be a single entity because buffers can be - * dropped if the bandwidth isn't fast enough. So do not send a message in - * multiple chunks. */ -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gssize +socket_send_message (NiceSocket *sock, const NiceOutputMessage *message) { TcpPriv *priv = sock->priv; - int ret; + gssize ret; GError *gerr = NULL; + gsize message_len; /* Don't try to access the socket if it had an error, otherwise we risk a - crash with SIGPIPE (Broken pipe) */ + * crash with SIGPIPE (Broken pipe) */ if (priv->error) return -1; + message_len = output_message_get_size (message); + /* First try to send the data, don't send it later if it can be sent now - this way we avoid allocating memory on every send */ + * this way we avoid allocating memory on every send */ if (g_queue_is_empty (&priv->send_queue)) { - ret = g_socket_send (sock->fileno, buf, len, NULL, &gerr); + ret = g_socket_send_message (sock->fileno, NULL, message->buffers, + message->n_buffers, NULL, 0, G_SOCKET_MSG_NONE, NULL, &gerr); + if (ret < 0) { - if(g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK) - || g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_FAILED)) { - add_to_be_sent (sock, buf, len, FALSE); - g_error_free (gerr); - return TRUE; - } else { - g_error_free (gerr); - return FALSE; + if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK) || + g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_FAILED)) { + /* Queue the message and send it later. */ + add_to_be_sent (sock, message, 0, message_len, FALSE); + ret = message_len; } - } else if ((guint)ret < len) { - add_to_be_sent (sock, buf + ret, len - ret, TRUE); - return TRUE; + + g_error_free (gerr); + } else if ((gsize) ret < message_len) { + /* Partial send. */ + add_to_be_sent (sock, message, ret, message_len, TRUE); + ret = message_len; } } else { - if (g_queue_get_length(&priv->send_queue) >= MAX_QUEUE_LENGTH) { - int peek_idx = 0; + /* FIXME: This dropping will break http/socks5/etc + * We probably need a way to the upper layer to control reliability + */ + /* If the queue is too long, drop whatever packets we can. */ + if (g_queue_get_length (&priv->send_queue) >= MAX_QUEUE_LENGTH) { + guint peek_idx = 0; struct to_be_sent *tbs = NULL; + while ((tbs = g_queue_peek_nth (&priv->send_queue, peek_idx)) != NULL) { if (tbs->can_drop) { tbs = g_queue_pop_nth (&priv->send_queue, peek_idx); - g_free (tbs->buf); - g_slice_free (struct to_be_sent, tbs); + free_to_be_sent (tbs); break; } else { peek_idx++; } } } - add_to_be_sent (sock, buf, len, FALSE); + + /* Queue the message and send it later. */ + add_to_be_sent (sock, message, 0, message_len, FALSE); + ret = message_len; } - return TRUE; + return ret; +} + +/* Data sent to this function must be a single entity because buffers can be + * dropped if the bandwidth isn't fast enough. So do not send a message in + * multiple chunks. */ +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) +{ + guint i; + + for (i = 0; i < n_messages; i++) { + const NiceOutputMessage *message = &messages[i]; + gssize len; + + len = socket_send_message (sock, message); + + if (len < 0) { + /* Error. */ + return len; + } else if (len == 0) { + /* EWOULDBLOCK. */ + break; + } + } + + return i; } static gboolean @@ -327,28 +387,32 @@ /* connection hangs up */ ret = -1; } else { - ret = g_socket_send (sock->fileno, tbs->buf, tbs->length, NULL, &gerr); + GOutputVector local_bufs = { tbs->buf, tbs->length }; + ret = g_socket_send_message (sock->fileno, NULL, &local_bufs, 1, NULL, 0, + G_SOCKET_MSG_NONE, NULL, &gerr); } if (ret < 0) { - if(gerr != NULL && - g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { - add_to_be_sent (sock, tbs->buf, tbs->length, TRUE); - g_free (tbs->buf); - g_slice_free (struct to_be_sent, tbs); + if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { + GOutputVector local_buf = { tbs->buf, tbs->length }; + NiceOutputMessage local_message = {&local_buf, 1}; + + add_to_be_sent (sock, &local_message, 0, local_buf.size, TRUE); + free_to_be_sent (tbs); g_error_free (gerr); break; } - g_error_free (gerr); + g_clear_error (&gerr); } else if (ret < (int) tbs->length) { - add_to_be_sent (sock, tbs->buf + ret, tbs->length - ret, TRUE); - g_free (tbs->buf); - g_slice_free (struct to_be_sent, tbs); + GOutputVector local_buf = { tbs->buf + ret, tbs->length - ret }; + NiceOutputMessage local_message = {&local_buf, 1}; + + add_to_be_sent (sock, &local_message, 0, local_buf.size, TRUE); + free_to_be_sent (tbs); break; } - g_free (tbs->buf); - g_slice_free (struct to_be_sent, tbs); + free_to_be_sent (tbs); } if (g_queue_is_empty (&priv->send_queue)) { @@ -365,19 +429,27 @@ } +/* Queue data starting at byte offset @message_offset from @message’s + * buffers. + * + * Returns the message's length */ static void -add_to_be_sent (NiceSocket *sock, const gchar *buf, guint len, gboolean head) +add_to_be_sent (NiceSocket *sock, const NiceOutputMessage *message, + gsize message_offset, gsize message_len, gboolean head) { TcpPriv *priv = sock->priv; - struct to_be_sent *tbs = NULL; + struct to_be_sent *tbs; + guint j; + gsize offset = 0; - if (len <= 0) + if (message_offset >= message_len) return; tbs = g_slice_new0 (struct to_be_sent); - tbs->buf = g_memdup (buf, len); - tbs->length = len; + tbs->length = message_len - message_offset; + tbs->buf = g_malloc (tbs->length); tbs->can_drop = !head; + if (head) g_queue_push_head (&priv->send_queue, tbs); else @@ -389,6 +461,26 @@ sock, NULL); g_source_attach (priv->io_source, priv->context); } + + /* Move the data into the buffer. */ + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + const GOutputVector *buffer = &message->buffers[j]; + gsize len; + + /* Skip this buffer if it’s within @message_offset. */ + if (buffer->size <= message_offset) { + message_offset -= buffer->size; + continue; + } + + len = MIN (tbs->length - offset, buffer->size - message_offset); + memcpy (tbs->buf + offset, (guint8 *) buffer->buffer + message_offset, len); + offset += len; + message_offset -= len; + } } diff -Nru libnice-0.1.4/socket/tcp-turn.c libnice-0.1.7/socket/tcp-turn.c --- libnice-0.1.4/socket/tcp-turn.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/tcp-turn.c 2014-04-09 02:44:13.000000000 +0000 @@ -43,6 +43,7 @@ #endif #include "tcp-turn.h" +#include "agent-priv.h" #include #include @@ -54,8 +55,11 @@ typedef struct { NiceTurnSocketCompatibility compatibility; - gchar recv_buf[65536]; - guint recv_buf_len; + union { + guint8 u8[65536]; + guint16 u16[32768]; + } recv_buf; + gsize recv_buf_len; /* in bytes */ guint expecting_len; NiceSocket *base_socket; } TurnTcpPriv; @@ -63,10 +67,10 @@ #define MAX_UDP_MESSAGE_SIZE 65535 static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); NiceSocket * @@ -82,8 +86,8 @@ sock->fileno = priv->base_socket->fileno; sock->addr = priv->base_socket->addr; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; @@ -102,13 +106,14 @@ g_slice_free(TurnTcpPriv, sock->priv); } - -static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +static gssize +socket_recv_message (NiceSocket *sock, NiceInputMessage *recv_message) { TurnTcpPriv *priv = sock->priv; - int ret; + gssize ret; guint padlen; + GInputVector local_recv_buf; + NiceInputMessage local_recv_message; if (priv->expecting_len == 0) { guint headerlen = 0; @@ -121,20 +126,26 @@ else return -1; - ret = nice_socket_recv (priv->base_socket, from, - headerlen - priv->recv_buf_len, priv->recv_buf + priv->recv_buf_len); + local_recv_buf.buffer = priv->recv_buf.u8 + priv->recv_buf_len; + local_recv_buf.size = headerlen - priv->recv_buf_len; + local_recv_message.buffers = &local_recv_buf; + local_recv_message.n_buffers = 1; + local_recv_message.from = recv_message->from; + local_recv_message.length = 0; + + ret = nice_socket_recv_messages (priv->base_socket, &local_recv_message, 1); if (ret < 0) return ret; - priv->recv_buf_len += ret; + priv->recv_buf_len += local_recv_message.length; if (priv->recv_buf_len < headerlen) return 0; if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { - guint16 magic = ntohs (*(guint16*)priv->recv_buf); - guint16 packetlen = ntohs (*(guint16*)(priv->recv_buf + 2)); + guint16 magic = ntohs (*priv->recv_buf.u16); + guint16 packetlen = ntohs (*(priv->recv_buf.u16 + 1)); if (magic < 0x4000) { /* Its STUN */ @@ -145,8 +156,8 @@ } } else if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) { - guint len = ntohs (*(guint16*)priv->recv_buf); - priv->expecting_len = len; + guint compat_len = ntohs (*priv->recv_buf.u16); + priv->expecting_len = compat_len; priv->recv_buf_len = 0; } } @@ -157,57 +168,145 @@ else padlen = 0; - ret = nice_socket_recv (priv->base_socket, from, - priv->expecting_len + padlen - priv->recv_buf_len, - priv->recv_buf + priv->recv_buf_len); + local_recv_buf.buffer = priv->recv_buf.u8 + priv->recv_buf_len; + local_recv_buf.size = priv->expecting_len + padlen - priv->recv_buf_len; + local_recv_message.buffers = &local_recv_buf; + local_recv_message.n_buffers = 1; + local_recv_message.from = recv_message->from; + local_recv_message.length = 0; + ret = nice_socket_recv_messages (priv->base_socket, &local_recv_message, 1); if (ret < 0) return ret; - priv->recv_buf_len += ret; + priv->recv_buf_len += local_recv_message.length; if (priv->recv_buf_len == priv->expecting_len + padlen) { - guint copy_len = MIN (len, priv->recv_buf_len); - memcpy (buf, priv->recv_buf, copy_len); + /* FIXME: Eliminate this memcpy(). */ + ret = memcpy_buffer_to_input_message (recv_message, + priv->recv_buf.u8, priv->recv_buf_len); + priv->expecting_len = 0; priv->recv_buf_len = 0; - return copy_len; + return ret; } return 0; } -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gint +socket_recv_messages (NiceSocket *nicesock, + NiceInputMessage *recv_messages, guint n_recv_messages) +{ + guint i; + gboolean error = FALSE; + + for (i = 0; i < n_recv_messages; i++) { + gssize len; + + len = socket_recv_message (nicesock, &recv_messages[i]); + recv_messages[i].length = MAX (len, 0); + + if (len < 0) + error = TRUE; + + if (len <= 0) + break; + } + + /* Was there an error processing the first message? */ + if (error && i == 0) + return -1; + + return i; +} + +static gssize +socket_send_message (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *message) { TurnTcpPriv *priv = sock->priv; - gchar padbuf[3] = {0, 0, 0}; - int padlen = (len%4) ? 4 - (len%4) : 0; - gchar buffer[MAX_UDP_MESSAGE_SIZE + sizeof(guint16) + sizeof(padbuf)]; - guint buffer_len = 0; + guint8 padbuf[3] = {0, 0, 0}; + GOutputVector *local_bufs; + NiceOutputMessage local_message; + guint j; + gint ret; + guint n_bufs; + guint16 header_buf; + guint offset = 0; + + /* Count the number of buffers. */ + if (message->n_buffers == -1) { + n_bufs = 0; + + for (j = 0; message->buffers[j].buffer != NULL; j++) + n_bufs++; + } else { + n_bufs = message->n_buffers; + } - if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 && - priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) - padlen = 0; + /* Allocate a new array of buffers, covering all the buffers in the input + * @message, but with an additional one for a header and one for a footer. */ + local_bufs = g_malloc_n (n_bufs + 1, sizeof (GOutputVector)); + local_message.buffers = local_bufs; + local_message.n_buffers = n_bufs + 1; if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) { - guint16 tmpbuf = htons (len); - memcpy (buffer + buffer_len, (gchar *)&tmpbuf, sizeof(guint16)); - buffer_len += sizeof(guint16); + header_buf = htons (output_message_get_size (message)); + local_bufs[0].buffer = &header_buf; + local_bufs[0].size = sizeof (header_buf); + offset = 1; + } else if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || + priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { + gsize message_len = output_message_get_size (message); + gsize padlen = (message_len % 4) ? 4 - (message_len % 4) : 0; + + local_bufs[n_bufs].buffer = &padbuf; + local_bufs[n_bufs].size = padlen; + } else { + local_message.n_buffers = n_bufs; + } + + /* Copy the existing buffers across. */ + for (j = 0; j < n_bufs; j++) { + local_bufs[j + offset].buffer = message->buffers[j].buffer; + local_bufs[j + offset].size = message->buffers[j].size; } - memcpy (buffer + buffer_len, buf, len); - buffer_len += len; - if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || - priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { - memcpy (buffer + buffer_len, padbuf, padlen); - buffer_len += padlen; + ret = nice_socket_send_messages (priv->base_socket, to, &local_message, 1); + + if (ret == 1) + ret = output_message_get_size (&local_message); + + g_free (local_bufs); + + return ret; +} + +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) +{ + guint i; + + for (i = 0; i < n_messages; i++) { + const NiceOutputMessage *message = &messages[i]; + gssize len; + + len = socket_send_message (sock, to, message); + + if (len < 0) { + /* Error. */ + return len; + } else if (len == 0) { + /* EWOULDBLOCK. */ + break; + } } - return nice_socket_send (priv->base_socket, to, buffer_len, buffer); + return i; } diff -Nru libnice-0.1.4/socket/turn.c libnice-0.1.7/socket/turn.c --- libnice-0.1.4/socket/turn.c 2012-11-19 23:06:12.000000000 +0000 +++ libnice-0.1.7/socket/turn.c 2014-05-02 21:47:09.000000000 +0000 @@ -67,7 +67,7 @@ NiceAddress peer; uint16_t channel; gboolean renew; - guint timeout_source; + GSource *timeout_source; } ChannelBinding; typedef struct { @@ -83,9 +83,9 @@ NiceSocket *base_socket; NiceAddress server_addr; uint8_t *username; - size_t username_len; + gsize username_len; uint8_t *password; - size_t password_len; + gsize password_len; NiceTurnSocketCompatibility compatibility; GQueue *send_requests; uint8_t ms_realm[STUN_MAX_MS_REALM_LEN + 1]; @@ -96,7 +96,7 @@ there is an installed permission */ GList *sent_permissions; /* ongoing permission installed */ GHashTable *send_data_queues; /* stores a send data queue for per peer */ - guint permission_timeout_source; /* timer used to invalidate + GSource *permission_timeout_source; /* timer used to invalidate permissions */ } TurnPriv; @@ -114,10 +114,10 @@ } SendData; static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); static void priv_process_pending_bindings (TurnPriv *priv); @@ -146,9 +146,9 @@ } static void -priv_send_data_queue_destroy (gpointer data) +priv_send_data_queue_destroy (gpointer user_data) { - GQueue *send_queue = (GQueue *) data; + GQueue *send_queue = (GQueue *) user_data; GList *i; for (i = g_queue_peek_head_link (send_queue); i; i = i->next) { @@ -193,7 +193,6 @@ } else if (compatibility == NICE_TURN_SOCKET_COMPATIBILITY_OC2007) { stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES, STUN_COMPATIBILITY_OC2007, - STUN_AGENT_USAGE_NO_INDICATION_AUTH | STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS | STUN_AGENT_USAGE_NO_ALIGNED_ATTRIBUTES); } @@ -210,13 +209,13 @@ priv->password = g_base64_decode (password, &priv->password_len); } else { priv->username = (uint8_t *)g_strdup (username); - priv->username_len = (size_t) strlen (username); + priv->username_len = (gsize) strlen (username); if (compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) { priv->password = NULL; priv->password_len = 0; } else { priv->password = (uint8_t *)g_strdup (password); - priv->password_len = (size_t) strlen (password); + priv->password_len = (gsize) strlen (password); } } priv->server_addr = *server_addr; @@ -230,8 +229,8 @@ priv_send_data_queue_destroy); sock->addr = *addr; sock->fileno = base_socket->fileno; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; sock->priv = (void *) priv; @@ -248,8 +247,10 @@ for (i = priv->channels; i; i = i->next) { ChannelBinding *b = i->data; - if (b->timeout_source) - g_source_remove (b->timeout_source); + if (b->timeout_source) { + g_source_destroy (b->timeout_source); + g_source_unref (b->timeout_source); + } g_free (b); } g_list_free (priv->channels); @@ -289,8 +290,11 @@ g_list_free (priv->sent_permissions); g_hash_table_destroy (priv->send_data_queues); - if (priv->permission_timeout_source) - g_source_remove (priv->permission_timeout_source); + if (priv->permission_timeout_source) { + g_source_destroy (priv->permission_timeout_source); + g_source_unref (priv->permission_timeout_source); + priv->permission_timeout_source = NULL; + } if (priv->ctx) g_main_context_unref (priv->ctx); @@ -305,36 +309,108 @@ } static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { TurnPriv *priv = (TurnPriv *) sock->priv; - uint8_t recv_buf[STUN_MAX_MESSAGE_SIZE]; - gint recv_len; - NiceAddress recv_from; - NiceSocket *dummy; + gint n_messages; + guint i; + gboolean error = FALSE; + guint n_valid_messages; nice_debug ("received message on TURN socket"); - recv_len = nice_socket_recv (priv->base_socket, &recv_from, - sizeof(recv_buf), (gchar *) recv_buf); + n_messages = nice_socket_recv_messages (priv->base_socket, + recv_messages, n_recv_messages); - if (recv_len > 0) - return nice_turn_socket_parse_recv (sock, &dummy, from, len, buf, - &recv_from, (gchar *) recv_buf, - (guint) recv_len); - else - return recv_len; + if (n_messages < 0) + return n_messages; + + /* Process all the messages. Those which fail parsing are re-used for the next + * message. + * + * FIXME: This needs a fast path which avoids allocations or memcpy()s. + * Implementing such a path means rewriting the TURN parser (and hence the + * STUN message code) to operate on vectors of buffers, rather than a + * monolithic buffer. */ + for (i = 0; i < (guint) n_messages; i += n_valid_messages) { + NiceInputMessage *message = &recv_messages[i]; + NiceSocket *dummy; + NiceAddress from; + guint8 *buffer; + gsize buffer_length; + gint parsed_buffer_length; + gboolean allocated_buffer = FALSE; + + n_valid_messages = 1; + + if (message->length == 0) + continue; + + /* Compact the message’s buffers into a single one for parsing. Avoid this + * in the (hopefully) common case of a single-element buffer vector. */ + if (message->n_buffers == 1 || + (message->n_buffers == -1 && + message->buffers[0].buffer != NULL && + message->buffers[1].buffer == NULL)) { + buffer = message->buffers[0].buffer; + buffer_length = message->length; + } else { + nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); + + buffer = compact_input_message (message, &buffer_length); + allocated_buffer = TRUE; + } + + /* Parse in-place. */ + parsed_buffer_length = nice_turn_socket_parse_recv (sock, &dummy, + &from, buffer_length, buffer, + message->from, buffer, buffer_length); + message->length = MAX (parsed_buffer_length, 0); + + if (parsed_buffer_length < 0) { + error = TRUE; + } else if (parsed_buffer_length == 0) { + /* A TURN control message which needs ignoring. Re-use this + * NiceInputMessage in the next loop iteration. */ + n_valid_messages = 0; + } else { + *message->from = from; + } + + /* Split up the monolithic buffer again into the caller-provided buffers. */ + if (parsed_buffer_length > 0 && allocated_buffer) { + parsed_buffer_length = + memcpy_buffer_to_input_message (message, buffer, + parsed_buffer_length); + } + + if (allocated_buffer) + g_free (buffer); + + if (error) + break; + } + + /* Was there an error processing the first message? */ + if (error && i == 0) + return -1; + + return i; } static GSource * priv_timeout_add_with_context (TurnPriv *priv, guint interval, - GSourceFunc function, gpointer data) + gboolean seconds, GSourceFunc function, gpointer data) { GSource *source; g_return_val_if_fail (function != NULL, NULL); - source = g_timeout_source_new (interval); + if (seconds) + source = g_timeout_source_new_seconds (interval); + else + source = g_timeout_source_new (interval); g_source_set_callback (source, function, data, NULL); g_source_attach (source, priv->ctx); @@ -419,8 +495,13 @@ NiceAddress *address = (NiceAddress *) iter->data; if (nice_address_equal (address, peer)) { + GList *prev = iter->prev; + nice_address_free (address); list = g_list_delete_link (list, iter); + iter = prev; + if (iter) + iter = list; } } @@ -471,7 +552,8 @@ (SendData *) g_queue_pop_head(send_queue); nice_debug ("dequeuing data"); - nice_socket_send (priv->base_socket, to, data->data_len, data->data); + nice_socket_send (priv->base_socket, &priv->server_addr, data->data_len, + data->data); g_free (data->data); g_slice_free (SendData, data); @@ -483,17 +565,21 @@ } -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gssize +socket_send_message (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *message) { TurnPriv *priv = (TurnPriv *) sock->priv; StunMessage msg; uint8_t buffer[STUN_MAX_MESSAGE_SIZE]; size_t msg_len; - struct sockaddr_storage sa; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; GList *i = priv->channels; ChannelBinding *binding = NULL; + gint ret; for (; i; i = i->next) { ChannelBinding *b = i->data; @@ -503,32 +589,62 @@ } } - nice_address_copy_to_sockaddr (to, (struct sockaddr *)&sa); + nice_address_copy_to_sockaddr (to, &sa.addr); if (binding) { if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { - if (len + sizeof(uint32_t) <= sizeof(buffer)) { - uint16_t len16 = htons ((uint16_t) len); - uint16_t channel16 = htons (binding->channel); + gsize message_len = output_message_get_size (message); + + if (message_len + sizeof(uint32_t) <= sizeof(buffer)) { + guint j; + uint16_t len16, channel16; + gsize message_offset = 0; + + len16 = htons ((uint16_t) message_len); + channel16 = htons (binding->channel); + memcpy (buffer, &channel16, sizeof(uint16_t)); - memcpy (buffer + sizeof(uint16_t), &len16,sizeof(uint16_t)); - memcpy (buffer + sizeof(uint32_t), buf, len); - msg_len = len + sizeof(uint32_t); + memcpy (buffer + sizeof(uint16_t), &len16, sizeof(uint16_t)); + + /* FIXME: Slow path! This should be replaced by code which manipulates + * the GOutputVector array, rather than the buffer contents + * themselves. */ + for (j = 0; + (message->n_buffers >= 0 && j < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[j].buffer != NULL); + j++) { + const GOutputVector *out_buf = &message->buffers[j]; + gsize out_len; + + out_len = MIN (message_len - message_offset, out_buf->size); + memcpy (buffer + sizeof (uint32_t) + message_offset, + out_buf->buffer, out_len); + message_offset += out_len; + } + + msg_len = message_len + sizeof(uint32_t); } else { return 0; } } else { - return nice_socket_send (priv->base_socket, &priv->server_addr, len, buf); + ret = nice_socket_send_messages (priv->base_socket, &priv->server_addr, + message, 1); + if (ret == 1) + return output_message_get_size (message); + return ret; } } else { + guint8 *compacted_buf; + gsize compacted_buf_len; + if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { if (!stun_agent_init_indication (&priv->agent, &msg, buffer, sizeof(buffer), STUN_IND_SEND)) goto send; if (stun_message_append_xor_addr (&msg, STUN_ATTRIBUTE_PEER_ADDRESS, - (struct sockaddr *)&sa, sizeof(sa)) != + &sa.storage, sizeof(sa)) != STUN_MESSAGE_RETURN_SUCCESS) goto send; } else { @@ -546,7 +662,7 @@ goto send; } if (stun_message_append_addr (&msg, STUN_ATTRIBUTE_DESTINATION_ADDRESS, - (struct sockaddr *)&sa, sizeof(sa)) != + &sa.addr, sizeof(sa)) != STUN_MESSAGE_RETURN_SUCCESS) goto send; @@ -567,10 +683,20 @@ stun_message_ensure_ms_realm(&msg, priv->ms_realm); } + /* Slow path! We have to compact the buffers to append them to the message. + * FIXME: This could be improved by adding vectored I/O support to + * stun_message_append_bytes(). */ + compacted_buf = compact_output_message (message, &compacted_buf_len); + if (stun_message_append_bytes (&msg, STUN_ATTRIBUTE_DATA, - buf, len) != STUN_MESSAGE_RETURN_SUCCESS) + compacted_buf, compacted_buf_len) != STUN_MESSAGE_RETURN_SUCCESS) { + g_free (compacted_buf); goto send; + } + + g_free (compacted_buf); + /* Finish the message. */ msg_len = stun_agent_finish_message (&priv->agent, &msg, priv->password, priv->password_len); if (msg_len > 0 && stun_message_get_class (&msg) == STUN_REQUEST) { @@ -579,7 +705,7 @@ req->priv = priv; stun_message_id (&msg, req->id); req->source = priv_timeout_add_with_context (priv, - STUN_END_TIMEOUT, priv_forget_send_request, req); + STUN_END_TIMEOUT, FALSE, priv_forget_send_request, req); g_queue_push_tail (priv->send_requests, req); } } @@ -594,14 +720,50 @@ /* enque data */ nice_debug ("enqueuing data"); socket_enqueue_data(priv, to, msg_len, (gchar *)buffer); - return TRUE; + + return msg_len; } else { - return nice_socket_send (priv->base_socket, &priv->server_addr, - msg_len, (gchar *)buffer); + GOutputVector local_buf = { buffer, msg_len }; + NiceOutputMessage local_message = {&local_buf, 1}; + + ret = nice_socket_send_messages (priv->base_socket, &priv->server_addr, + &local_message, 1); + if (ret == 1) + return msg_len; + return ret; } } - send: - return nice_socket_send (priv->base_socket, to, len, buf); + +send: + /* Error condition pass through to the base socket. */ + ret = nice_socket_send_messages (priv->base_socket, to, message, 1); + if (ret == 1) + return output_message_get_size (message); + return ret; +} + +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) +{ + guint i; + + for (i = 0; i < n_messages; i++) { + const NiceOutputMessage *message = &messages[i]; + gssize len; + + len = socket_send_message (sock, to, message); + + if (len < 0) { + /* Error. */ + return len; + } else if (len == 0) { + /* EWOULDBLOCK. */ + break; + } + } + + return i; } static gboolean @@ -678,20 +840,22 @@ /* find current binding and destroy it */ for (i = priv->channels ; i; i = i->next) { ChannelBinding *b = i->data; - if (b->timeout_source == g_source_get_id (source)) { + if (b->timeout_source == source) { priv->channels = g_list_remove (priv->channels, b); /* Make sure we don't free a currently being-refreshed binding */ if (priv->current_binding_msg && !priv->current_binding) { - struct sockaddr_storage sa; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; socklen_t sa_len = sizeof(sa); NiceAddress to; /* look up binding associated with peer */ stun_message_find_xor_addr ( &priv->current_binding_msg->message, - STUN_ATTRIBUTE_XOR_PEER_ADDRESS, (struct sockaddr *) &sa, - &sa_len); - nice_address_set_from_sockaddr (&to, (struct sockaddr *) &sa); + STUN_ATTRIBUTE_XOR_PEER_ADDRESS, &sa.storage, &sa_len); + nice_address_set_from_sockaddr (&to, &sa.addr); /* If the binding is being refreshed, then move it to priv->current_binding so it counts as a 'new' binding and @@ -736,11 +900,12 @@ /* find current binding and mark it for renewal */ for (i = priv->channels ; i; i = i->next) { ChannelBinding *b = i->data; - if (b->timeout_source == g_source_get_id (source)) { + if (b->timeout_source == source) { b->renew = TRUE; /* Install timer to expire the permission */ - b->timeout_source = g_timeout_add_seconds (STUN_EXPIRE_TIMEOUT, - priv_binding_expired_timeout, priv); + b->timeout_source = priv_timeout_add_with_context (priv, + STUN_EXPIRE_TIMEOUT, TRUE, priv_binding_expired_timeout, priv); + /* Send renewal */ if (!priv->current_binding_msg) priv_send_channel_bind (priv, NULL, b->channel, &b->peer); @@ -753,23 +918,65 @@ return FALSE; } -gint +guint +nice_turn_socket_parse_recv_message (NiceSocket *sock, NiceSocket **from_sock, + NiceInputMessage *message) +{ + /* TODO: Speed this up in the common reliable case of having a 24-byte header + * buffer to begin with, followed by one or more massive buffers. */ + guint8 *buf; + gsize buf_len, len; + + if (message->n_buffers == 1 || + (message->n_buffers == -1 && + message->buffers[0].buffer != NULL && + message->buffers[1].buffer == NULL)) { + /* Fast path. Single massive buffer. */ + len = nice_turn_socket_parse_recv (sock, from_sock, + message->from, message->length, message->buffers[0].buffer, + message->from, message->buffers[0].buffer, message->length); + + g_assert_cmpuint (len, <=, message->length); + + message->length = len; + + return (len > 0) ? 1 : 0; + } + + /* Slow path. */ + nice_debug ("%s: **WARNING: SLOW PATH**", G_STRFUNC); + + buf = compact_input_message (message, &buf_len); + len = nice_turn_socket_parse_recv (sock, from_sock, + message->from, buf_len, buf, + message->from, buf, buf_len); + len = memcpy_buffer_to_input_message (message, buf, len); + + return (len > 0) ? 1 : 0; +} + +gsize nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, - NiceAddress *from, guint len, gchar *buf, - NiceAddress *recv_from, gchar *recv_buf, guint recv_len) + NiceAddress *from, gsize len, guint8 *buf, + NiceAddress *recv_from, guint8 *_recv_buf, gsize recv_len) { TurnPriv *priv = (TurnPriv *) sock->priv; StunValidationStatus valid; StunMessage msg; - struct sockaddr_storage sa; - socklen_t from_len = sizeof (sa); - GList *i = priv->channels; + GList *l; ChannelBinding *binding = NULL; + union { + guint8 *u8; + guint16 *u16; + } recv_buf; + + recv_buf.u8 = (guint8 *) _recv_buf; + if (nice_address_equal (&priv->server_addr, recv_from)) { valid = stun_agent_validate (&priv->agent, &msg, - (uint8_t *) recv_buf, (size_t) recv_len, NULL, NULL); + recv_buf.u8, recv_len, NULL, NULL); if (valid == STUN_VALIDATION_SUCCESS) { if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 && @@ -856,16 +1063,18 @@ } else { /* Existing binding refresh */ GList *i; - struct sockaddr_storage sa; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; socklen_t sa_len = sizeof(sa); NiceAddress to; /* look up binding associated with peer */ stun_message_find_xor_addr ( &priv->current_binding_msg->message, - STUN_ATTRIBUTE_XOR_PEER_ADDRESS, (struct sockaddr *) &sa, - &sa_len); - nice_address_set_from_sockaddr (&to, (struct sockaddr *) &sa); + STUN_ATTRIBUTE_XOR_PEER_ADDRESS, &sa.storage, &sa_len); + nice_address_set_from_sockaddr (&to, &sa.addr); for (i = priv->channels; i; i = i->next) { ChannelBinding *b = i->data; @@ -928,12 +1137,14 @@ binding->renew = FALSE; /* Remove any existing timer */ - if (binding->timeout_source) - g_source_remove (binding->timeout_source); + if (binding->timeout_source) { + g_source_destroy (binding->timeout_source); + g_source_unref (binding->timeout_source); + } /* Install timer to schedule refresh of the permission */ binding->timeout_source = - g_timeout_add_seconds (STUN_BINDING_TIMEOUT, - priv_binding_timeout, priv); + priv_timeout_add_with_context (priv, STUN_BINDING_TIMEOUT, + TRUE, priv_binding_timeout, priv); } priv_process_pending_bindings (priv); } @@ -955,16 +1166,18 @@ if (memcmp (request_id, response_id, sizeof(StunTransactionId)) == 0) { - struct sockaddr_storage peer; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } peer; socklen_t peer_len = sizeof(peer); NiceAddress to; nice_debug ("got response for CreatePermission"); stun_message_find_xor_addr ( ¤t_create_permission_msg->message, - STUN_ATTRIBUTE_XOR_PEER_ADDRESS, (struct sockaddr *) &peer, - &peer_len); - nice_address_set_from_sockaddr (&to, (struct sockaddr *) &peer); + STUN_ATTRIBUTE_XOR_PEER_ADDRESS, &peer.storage, &peer_len); + nice_address_set_from_sockaddr (&to, &peer.addr); /* unathorized => resend with realm and nonce */ if (stun_message_get_class (&msg) == STUN_ERROR) { @@ -1014,8 +1227,8 @@ if (stun_message_get_class (&msg) == STUN_RESPONSE && !priv->permission_timeout_source) { priv->permission_timeout_source = - g_timeout_add_seconds (STUN_PERMISSION_TIMEOUT, - priv_permission_timeout, priv); + priv_timeout_add_with_context (priv, STUN_PERMISSION_TIMEOUT, + TRUE, priv_permission_timeout, priv); } /* send enqued data */ @@ -1035,16 +1248,21 @@ stun_message_get_method (&msg) == STUN_IND_DATA) { uint16_t data_len; uint8_t *data; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; + socklen_t from_len = sizeof (sa); if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { if (stun_message_find_xor_addr (&msg, STUN_ATTRIBUTE_REMOTE_ADDRESS, - (struct sockaddr *)&sa, &from_len) != + &sa.storage, &from_len) != STUN_MESSAGE_RETURN_SUCCESS) goto recv; } else { if (stun_message_find_addr (&msg, STUN_ATTRIBUTE_REMOTE_ADDRESS, - (struct sockaddr *)&sa, &from_len) != + &sa.storage, &from_len) != STUN_MESSAGE_RETURN_SUCCESS) goto recv; } @@ -1055,7 +1273,14 @@ if (data == NULL) goto recv; - nice_address_set_from_sockaddr (from, (struct sockaddr *) &sa); + nice_address_set_from_sockaddr (from, &sa.addr); + + if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766 && + !priv_has_permission_for_peer (priv, from)) { + if (!priv_has_sent_permission_for_peer (priv, from)) { + priv_send_create_permission (priv, NULL, from); + } + } *from_sock = sock; memmove (buf, data, len > data_len ? data_len : len); @@ -1067,13 +1292,13 @@ } recv: - for (i = priv->channels; i; i = i->next) { - ChannelBinding *b = i->data; + for (l = priv->channels; l; l = l->next) { + ChannelBinding *b = l->data; if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { - if (b->channel == ntohs(((uint16_t *)recv_buf)[0])) { - recv_len = ntohs (((uint16_t *)recv_buf)[1]); - recv_buf += sizeof(uint32_t); + if (b->channel == ntohs(recv_buf.u16[0])) { + recv_len = ntohs (recv_buf.u16[1]); + recv_buf.u8 += sizeof(uint32_t); binding = b; break; } @@ -1090,7 +1315,7 @@ *from = *recv_from; } - memmove (buf, recv_buf, len > recv_len ? recv_len : len); + memmove (buf, recv_buf.u8, len > recv_len ? recv_len : len); return len > recv_len ? recv_len : len; msn_google_lock: @@ -1181,6 +1406,9 @@ case STUN_USAGE_TIMER_RETURN_SUCCESS: ret = TRUE; break; + default: + /* Nothing to do. */ + break; } } @@ -1204,16 +1432,18 @@ /* Time out */ StunTransactionId id; NiceAddress to; - struct sockaddr_storage addr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } addr; socklen_t addr_len = sizeof(addr); stun_message_id (¤t_create_permission_msg->message, id); stun_agent_forget_transaction (&priv->agent, id); stun_message_find_xor_addr ( ¤t_create_permission_msg->message, - STUN_ATTRIBUTE_XOR_PEER_ADDRESS, (struct sockaddr *) &addr, - &addr_len); - nice_address_set_from_sockaddr (&to, (struct sockaddr *) &addr); + STUN_ATTRIBUTE_XOR_PEER_ADDRESS, &addr.storage, &addr_len); + nice_address_set_from_sockaddr (&to, &addr.addr); priv_remove_sent_permission_for_peer (priv, &to); priv->pending_permissions = g_list_delete_link ( @@ -1241,6 +1471,9 @@ case STUN_USAGE_TIMER_RETURN_SUCCESS: ret = TRUE; break; + default: + /* Nothing to do. */ + break; } } @@ -1320,7 +1553,7 @@ guint timeout = stun_timer_remainder (&priv->current_binding_msg->timer); if (timeout > 0) { priv->tick_source_channel_bind = - priv_timeout_add_with_context (priv, timeout, + priv_timeout_add_with_context (priv, timeout, FALSE, priv_retransmissions_tick, priv); } else { priv_retransmissions_tick_unlocked (priv); @@ -1336,8 +1569,12 @@ timeout = stun_timer_remainder (¤t_create_permission_msg->timer); if (timeout > 0) { + if (priv->tick_source_create_permission) { + g_source_destroy (priv->tick_source_create_permission); + g_source_unref (priv->tick_source_create_permission); + } priv->tick_source_create_permission = - priv_timeout_add_with_context (priv, + priv_timeout_add_with_context (priv, FALSE, timeout, priv_retransmissions_create_permission_tick, priv); @@ -1379,7 +1616,10 @@ guint msg_buf_len; gboolean res = FALSE; TURNMessage *msg = g_new0 (TURNMessage, 1); - struct sockaddr_storage addr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } addr; uint8_t *realm = NULL; uint16_t realm_len = 0; uint8_t *nonce = NULL; @@ -1397,7 +1637,7 @@ priv_add_sent_permission_for_peer (priv, peer); } - nice_address_copy_to_sockaddr (peer, (struct sockaddr *) &addr); + nice_address_copy_to_sockaddr (peer, &addr.addr); /* send CreatePermission */ msg_buf_len = stun_usage_turn_create_permission(&priv->agent, &msg->message, @@ -1409,7 +1649,7 @@ priv->password_len, realm, realm_len, nonce, nonce_len, - (struct sockaddr *) &addr, + &addr.storage, STUN_USAGE_TURN_COMPATIBILITY_RFC5766); if (msg_buf_len > 0) { @@ -1439,10 +1679,13 @@ { uint32_t channel_attr = channel << 16; size_t stun_len; - struct sockaddr_storage sa; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; TURNMessage *msg = g_new0 (TURNMessage, 1); - nice_address_copy_to_sockaddr (peer, (struct sockaddr *)&sa); + nice_address_copy_to_sockaddr (peer, &sa.addr); if (!stun_agent_init_request (&priv->agent, &msg->message, msg->buffer, sizeof(msg->buffer), @@ -1458,7 +1701,7 @@ } if (stun_message_append_xor_addr (&msg->message, STUN_ATTRIBUTE_PEER_ADDRESS, - (struct sockaddr *)&sa, + &sa.storage, sizeof(sa)) != STUN_MESSAGE_RETURN_SUCCESS) { g_free (msg); @@ -1515,9 +1758,12 @@ priv_add_channel_binding (TurnPriv *priv, const NiceAddress *peer) { size_t stun_len; - struct sockaddr_storage sa; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; - nice_address_copy_to_sockaddr (peer, (struct sockaddr *)&sa); + nice_address_copy_to_sockaddr (peer, &sa.addr); if (priv->current_binding) { NiceAddress * pending= nice_address_new (); @@ -1585,7 +1831,7 @@ if (stun_message_append_addr (&msg->message, STUN_ATTRIBUTE_DESTINATION_ADDRESS, - (struct sockaddr *)&sa, sizeof(sa)) + &sa.addr, sizeof(sa)) != STUN_MESSAGE_RETURN_SUCCESS) { g_free (msg); return FALSE; diff -Nru libnice-0.1.4/socket/turn.h libnice-0.1.7/socket/turn.h --- libnice-0.1.4/socket/turn.h 2012-02-09 03:44:45.000000000 +0000 +++ libnice-0.1.7/socket/turn.h 2014-03-07 01:21:05.000000000 +0000 @@ -52,10 +52,14 @@ G_BEGIN_DECLS -gint +guint +nice_turn_socket_parse_recv_message (NiceSocket *sock, NiceSocket **from_sock, + NiceInputMessage *message); + +gsize nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, - NiceAddress *from, guint len, gchar *buf, - NiceAddress *recv_from, gchar *recv_buf, guint recv_len); + NiceAddress *from, gsize len, guint8 *buf, + NiceAddress *recv_from, guint8 *recv_buf, gsize recv_len); gboolean nice_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer); diff -Nru libnice-0.1.4/socket/udp-bsd.c libnice-0.1.7/socket/udp-bsd.c --- libnice-0.1.4/socket/udp-bsd.c 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/socket/udp-bsd.c 2014-04-09 02:44:13.000000000 +0000 @@ -57,10 +57,10 @@ static void socket_close (NiceSocket *sock); -static gint socket_recv (NiceSocket *sock, NiceAddress *from, - guint len, gchar *buf); -static gboolean socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf); +static gint socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages); +static gint socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages); static gboolean socket_is_reliable (NiceSocket *sock); struct UdpBsdSocketPrivate @@ -72,7 +72,10 @@ NiceSocket * nice_udp_bsd_socket_new (NiceAddress *addr) { - struct sockaddr_storage name; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } name; NiceSocket *sock = g_slice_new0 (NiceSocket); GSocket *gsock = NULL; gboolean gret = FALSE; @@ -80,25 +83,25 @@ struct UdpBsdSocketPrivate *priv; if (addr != NULL) { - nice_address_copy_to_sockaddr(addr, (struct sockaddr *)&name); + nice_address_copy_to_sockaddr(addr, &name.addr); } else { memset (&name, 0, sizeof (name)); - name.ss_family = AF_UNSPEC; + name.storage.ss_family = AF_UNSPEC; } - if (name.ss_family == AF_UNSPEC || name.ss_family == AF_INET) { + if (name.storage.ss_family == AF_UNSPEC || name.storage.ss_family == AF_INET) { gsock = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, NULL); - name.ss_family = AF_INET; + name.storage.ss_family = AF_INET; #ifdef HAVE_SA_LEN - name.ss_len = sizeof (struct sockaddr_in); + name.storage.ss_len = sizeof (struct sockaddr_in); #endif - } else if (name.ss_family == AF_INET6) { + } else if (name.storage.ss_family == AF_INET6) { gsock = g_socket_new (G_SOCKET_FAMILY_IPV6, G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, NULL); - name.ss_family = AF_INET6; + name.storage.ss_family = AF_INET6; #ifdef HAVE_SA_LEN - name.ss_len = sizeof (struct sockaddr_in6); + name.storage.ss_len = sizeof (struct sockaddr_in6); #endif } @@ -109,7 +112,7 @@ /* GSocket: All socket file descriptors are set to be close-on-exec. */ g_socket_set_blocking (gsock, false); - gaddr = g_socket_address_new_from_native (&name, sizeof (name)); + gaddr = g_socket_address_new_from_native (&name.addr, sizeof (name)); if (gaddr != NULL) { gret = g_socket_bind (gsock, gaddr, FALSE, NULL); g_object_unref (gaddr); @@ -124,7 +127,7 @@ gaddr = g_socket_get_local_address (gsock, NULL); if (gaddr == NULL || - !g_socket_address_to_native (gaddr, &name, sizeof(name), NULL)) { + !g_socket_address_to_native (gaddr, &name.addr, sizeof(name), NULL)) { g_slice_free (NiceSocket, sock); g_socket_close (gsock, NULL); g_object_unref (gsock); @@ -133,14 +136,14 @@ g_object_unref (gaddr); - nice_address_set_from_sockaddr (&sock->addr, (struct sockaddr *)&name); + nice_address_set_from_sockaddr (&sock->addr, &name.addr); priv = sock->priv = g_slice_new0 (struct UdpBsdSocketPrivate); nice_address_init (&priv->niceaddr); sock->fileno = gsock; - sock->send = socket_send; - sock->recv = socket_recv; + sock->send_messages = socket_send_messages; + sock->recv_messages = socket_recv_messages; sock->is_reliable = socket_is_reliable; sock->close = socket_close; @@ -155,6 +158,7 @@ if (priv->gaddr) g_object_unref (priv->gaddr); g_slice_free (struct UdpBsdSocketPrivate, sock->priv); + sock->priv = NULL; if (sock->fileno) { g_socket_close (sock->fileno, NULL); @@ -164,60 +168,126 @@ } static gint -socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) +socket_recv_messages (NiceSocket *sock, + NiceInputMessage *recv_messages, guint n_recv_messages) { - GSocketAddress *gaddr = NULL; - GError *gerr = NULL; - gint recvd; + guint i; + gboolean error = FALSE; - recvd = g_socket_receive_from (sock->fileno, &gaddr, buf, len, NULL, &gerr); + /* Read messages into recv_messages until one fails or would block, or we + * reach the end. */ + for (i = 0; i < n_recv_messages; i++) { + NiceInputMessage *recv_message = &recv_messages[i]; + GSocketAddress *gaddr = NULL; + GError *gerr = NULL; + gssize recvd; + gint flags = G_SOCKET_MSG_NONE; + + recvd = g_socket_receive_message (sock->fileno, + (recv_message->from != NULL) ? &gaddr : NULL, + recv_message->buffers, recv_message->n_buffers, NULL, NULL, + &flags, NULL, &gerr); + + recv_message->length = MAX (recvd, 0); + + if (recvd < 0) { + if (g_error_matches (gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) + recvd = 0; + else + error = TRUE; + + g_error_free (gerr); + } + + if (recvd > 0 && recv_message->from != NULL && gaddr != NULL) { + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; + + g_socket_address_to_native (gaddr, &sa.addr, sizeof (sa), NULL); + nice_address_set_from_sockaddr (recv_message->from, &sa.addr); + } + + if (gaddr != NULL) + g_object_unref (gaddr); + + /* Return early on error or EWOULDBLOCK. */ + if (recvd <= 0) + break; + } + + /* Was there an error processing the first message? */ + if (error && i == 0) + return -1; - if (recvd < 0) { - if (g_error_matches(gerr, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK) - || g_error_matches(gerr, G_IO_ERROR, G_IO_ERROR_FAILED)) - recvd = 0; - - g_error_free (gerr); - } - - if (recvd > 0 && from != NULL && gaddr != NULL) { - struct sockaddr_storage sa; - - g_socket_address_to_native (gaddr, &sa, sizeof (sa), NULL); - nice_address_set_from_sockaddr (from, (struct sockaddr *)&sa); - } - - if (gaddr != NULL) - g_object_unref (gaddr); - - return recvd; + return i; } -static gboolean -socket_send (NiceSocket *sock, const NiceAddress *to, - guint len, const gchar *buf) +static gssize +socket_send_message (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *message) { struct UdpBsdSocketPrivate *priv = sock->priv; - ssize_t sent; + GError *child_error = NULL; + gssize len; if (!nice_address_is_valid (&priv->niceaddr) || !nice_address_equal (&priv->niceaddr, to)) { - struct sockaddr_storage sa; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } sa; GSocketAddress *gaddr; if (priv->gaddr) g_object_unref (priv->gaddr); - nice_address_copy_to_sockaddr (to, (struct sockaddr *)&sa); - gaddr = g_socket_address_new_from_native (&sa, sizeof(sa)); + + nice_address_copy_to_sockaddr (to, &sa.addr); + gaddr = g_socket_address_new_from_native (&sa.addr, sizeof(sa)); + priv->gaddr = gaddr; + if (gaddr == NULL) return -1; - priv->gaddr = gaddr; + priv->niceaddr = *to; } - sent = g_socket_send_to (sock->fileno, priv->gaddr, buf, len, NULL, NULL); + len = g_socket_send_message (sock->fileno, priv->gaddr, message->buffers, + message->n_buffers, NULL, 0, G_SOCKET_MSG_NONE, NULL, &child_error); + + if (len < 0) { + if (g_error_matches (child_error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) + len = 0; + + g_error_free (child_error); + } + + return len; +} + +static gint +socket_send_messages (NiceSocket *sock, const NiceAddress *to, + const NiceOutputMessage *messages, guint n_messages) +{ + guint i; + + for (i = 0; i < n_messages; i++) { + const NiceOutputMessage *message = &messages[i]; + gssize len; + + len = socket_send_message (sock, to, message); + + if (len < 0) { + /* Error. */ + return len; + } else if (len == 0) { + /* EWOULDBLOCK. */ + break; + } + } - return sent == (ssize_t)len; + return i; } static gboolean diff -Nru libnice-0.1.4/stun/debug.h libnice-0.1.7/stun/debug.h --- libnice-0.1.4/stun/debug.h 2011-02-02 04:49:42.000000000 +0000 +++ libnice-0.1.7/stun/debug.h 2014-01-06 23:05:13.000000000 +0000 @@ -37,6 +37,8 @@ #ifndef STUN_DEBUG_H #define STUN_DEBUG_H +#include + #ifdef __cplusplus extern "C" { #endif @@ -57,7 +59,12 @@ void stun_debug_disable (void); +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) +void stun_debug (const char *fmt, ...) + __attribute__((__format__ (__printf__, 1, 2))); +#else void stun_debug (const char *fmt, ...); +#endif void stun_debug_bytes (const void *data, size_t len); diff -Nru libnice-0.1.4/stun/Makefile.am libnice-0.1.7/stun/Makefile.am --- libnice-0.1.4/stun/Makefile.am 2011-11-30 01:57:42.000000000 +0000 +++ libnice-0.1.7/stun/Makefile.am 2014-01-06 23:05:13.000000000 +0000 @@ -10,7 +10,7 @@ include $(top_srcdir)/common.mk -AM_CFLAGS = -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" $(ERROR_CFLAGS) +AM_CFLAGS = -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" $(LIBNICE_CFLAGS) AM_CPPFLAGS = -I$(top_srcdir) if WINDOWS diff -Nru libnice-0.1.4/stun/Makefile.in libnice-0.1.7/stun/Makefile.in --- libnice-0.1.4/stun/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/stun/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -25,23 +24,51 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -60,13 +87,14 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(libstun_la_include_HEADERS) \ - $(libstun_usage_include_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/depcomp \ + $(libstun_la_include_HEADERS) $(libstun_usage_include_HEADERS) @WINDOWS_TRUE@am__append_1 = -DWINVER=0x0501 # _WIN32_WINNT_WINXP subdir = stun ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -83,6 +111,19 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -95,29 +136,26 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(libstun_la_SOURCES) DIST_SOURCES = $(libstun_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -156,9 +194,29 @@ $(libstun_usage_include_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) @@ -332,26 +390,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . tools tests -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda -AM_CFLAGS = -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" $(ERROR_CFLAGS) \ - $(am__append_1) +AM_CFLAGS = -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" \ + $(LIBNICE_CFLAGS) $(am__append_1) AM_CPPFLAGS = -I$(top_srcdir) noinst_LTLIBRARIES = libstun.la libstun_la_SOURCES = constants.h \ @@ -414,12 +455,15 @@ clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + libstun.la: $(libstun_la_OBJECTS) $(libstun_la_DEPENDENCIES) $(EXTRA_libstun_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libstun_la_OBJECTS) $(libstun_la_LIBADD) $(LIBS) @@ -542,22 +586,25 @@ dir='$(DESTDIR)$(libstun_usage_includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -572,57 +619,12 @@ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -638,12 +640,7 @@ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -655,15 +652,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -672,6 +665,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -843,12 +851,11 @@ uninstall-am: uninstall-libstun_la_includeHEADERS \ uninstall-libstun_usage_includeHEADERS -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive +.MAKE: $(am__recursive_targets) install-am install-strip -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ @@ -860,7 +867,7 @@ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-libstun_la_includeHEADERS \ uninstall-libstun_usage_includeHEADERS diff -Nru libnice-0.1.4/stun/md5.c libnice-0.1.7/stun/md5.c --- libnice-0.1.4/stun/md5.c 2012-02-14 18:02:48.000000000 +0000 +++ libnice-0.1.7/stun/md5.c 2014-03-07 01:21:05.000000000 +0000 @@ -92,7 +92,7 @@ /* Handle any leading odd-sized chunks */ if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; + unsigned char *p = (unsigned char *) ctx->in.u8 + t; t = 64 - t; if (len < t) { @@ -100,24 +100,24 @@ return; } memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse(ctx->in.u8, 16); + MD5Transform(ctx->buf, ctx->in.u32); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); + memcpy(ctx->in.u8, buf, 64); + byteReverse(ctx->in.u8, 16); + MD5Transform(ctx->buf, ctx->in.u32); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ - memcpy(ctx->in, buf, len); + memcpy(ctx->in.u8, buf, len); } /* @@ -134,7 +134,7 @@ /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ - p = ctx->in + count; + p = ctx->in.u8 + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ @@ -144,22 +144,22 @@ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse(ctx->in.u8, 16); + MD5Transform(ctx->buf, ctx->in.u32); /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); + memset(ctx->in.u8, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } - byteReverse(ctx->in, 14); + byteReverse(ctx->in.u8, 14); /* Append length in bits and transform */ - ((uint32_t *) ctx->in)[14] = ctx->bits[0]; - ((uint32_t *) ctx->in)[15] = ctx->bits[1]; + ctx->in.u32[14] = ctx->bits[0]; + ctx->in.u32[15] = ctx->bits[1]; - MD5Transform(ctx->buf, (uint32_t *) ctx->in); + MD5Transform(ctx->buf, ctx->in.u32); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(struct MD5Context)); /* In case it's sensitive */ diff -Nru libnice-0.1.4/stun/md5.h libnice-0.1.7/stun/md5.h --- libnice-0.1.4/stun/md5.h 2009-08-14 22:46:12.000000000 +0000 +++ libnice-0.1.7/stun/md5.h 2014-03-07 01:21:05.000000000 +0000 @@ -27,7 +27,10 @@ struct MD5Context { uint32_t buf[4]; uint32_t bits[2]; - uint8_t in[64]; + union { + uint8_t u8[64]; + uint32_t u32[16]; + } in; }; typedef struct MD5Context MD5_CTX; diff -Nru libnice-0.1.4/stun/sha1.c libnice-0.1.7/stun/sha1.c --- libnice-0.1.4/stun/sha1.c 2011-09-08 01:01:53.000000000 +0000 +++ libnice-0.1.7/stun/sha1.c 2014-03-07 01:21:05.000000000 +0000 @@ -270,7 +270,12 @@ /* if key is longer than 64 bytes reset it to key = SHA1(key) */ if (key_len > 64) { - sha1_vector(1, &key, &key_len, tk); + SHA1_CTX sha1_ctx; + + SHA1Init(&sha1_ctx); + SHA1Update(&sha1_ctx, key, key_len); + SHA1Final(tk, &sha1_ctx); + key = tk; key_len = 20; } @@ -301,9 +306,8 @@ unsigned char opad[64]; /* padding - key XORd with opad */ unsigned char sha1_digest[SHA1_MAC_LEN]; - const uint8_t *_addr[2]; - size_t _len[2]; size_t i; + SHA1_CTX outer_sha1_ctx; SHA1Final (sha1_digest, &context->context); @@ -315,11 +319,10 @@ opad[i] ^= 0x5c; /* perform outer SHA1 */ - _addr[0] = opad; - _len[0] = 64; - _addr[1] = sha1_digest; - _len[1] = SHA1_MAC_LEN; - sha1_vector(2, _addr, _len, digest); + SHA1Init(&outer_sha1_ctx); + SHA1Update(&outer_sha1_ctx, opad, 64); + SHA1Update(&outer_sha1_ctx, sha1_digest, SHA1_MAC_LEN); + SHA1Final(digest, &outer_sha1_ctx); } @@ -339,20 +342,15 @@ { unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */ unsigned char tk[20]; - const uint8_t *_addr[6]; - size_t _len[6], i; - - if (num_elem > 5) { - /* - * Fixed limit on the number of fragments to avoid having to - * allocate memory (which could fail). - */ - return; - } + size_t i; + SHA1_CTX sha1_ctx; /* if key is longer than 64 bytes reset it to key = SHA1(key) */ if (key_len > 64) { - sha1_vector(1, &key, &key_len, tk); + SHA1Init(&sha1_ctx); + SHA1Update(&sha1_ctx, key, key_len); + SHA1Final(tk, &sha1_ctx); + key = tk; key_len = 20; } @@ -374,13 +372,11 @@ k_pad[i] ^= 0x36; /* perform inner SHA1 */ - _addr[0] = k_pad; - _len[0] = 64; - for (i = 0; i < num_elem; i++) { - _addr[i + 1] = addr[i]; - _len[i + 1] = len[i]; - } - sha1_vector(1 + num_elem, _addr, _len, mac); + SHA1Init(&sha1_ctx); + SHA1Update(&sha1_ctx, k_pad, 64); + for (i = 0; i < num_elem; i++) + SHA1Update(&sha1_ctx, addr[i], len[i]); + SHA1Final(mac, &sha1_ctx); memset(k_pad, 0, sizeof(k_pad)); memcpy(k_pad, key, key_len); @@ -389,11 +385,10 @@ k_pad[i] ^= 0x5c; /* perform outer SHA1 */ - _addr[0] = k_pad; - _len[0] = 64; - _addr[1] = mac; - _len[1] = SHA1_MAC_LEN; - sha1_vector(2, _addr, _len, mac); + SHA1Init(&sha1_ctx); + SHA1Update(&sha1_ctx, k_pad, 64); + SHA1Update(&sha1_ctx, mac, SHA1_MAC_LEN); + SHA1Final(mac, &sha1_ctx); } @@ -460,25 +455,3 @@ counter++; } } - -/** - * sha1_vector: - * @num_elem: Number of elements in the data vector - * @addr: Pointers to the data areas - * @len: Lengths of the data blocks - * @mac: Buffer for the hash - * - * SHA-1 hash for data vector - */ -void sha1_vector(size_t num_elem, const uint8_t *addr[], const size_t *len, - uint8_t *mac) -{ - SHA1_CTX ctx; - size_t i; - - SHA1Init(&ctx); - for (i = 0; i < num_elem; i++) - SHA1Update(&ctx, addr[i], len[i]); - SHA1Final(mac, &ctx); -} - diff -Nru libnice-0.1.4/stun/stunagent.c libnice-0.1.7/stun/stunagent.c --- libnice-0.1.4/stun/stunagent.c 2011-02-02 04:50:08.000000000 +0000 +++ libnice-0.1.7/stun/stunagent.c 2014-04-25 01:46:20.000000000 +0000 @@ -46,6 +46,7 @@ #include #include +#include static bool stun_agent_is_unknown (StunAgent *agent, uint16_t type); @@ -80,7 +81,7 @@ stun_debug_bytes (username, username_len); stun_debug ("' (%d) with '", username_len); stun_debug_bytes (val[i].username, val[i].username_len); - stun_debug ("' (%d) : %d\n", + stun_debug ("' (%" PRIuPTR ") : %d\n", val[i].username_len, memcmp (username, val[i].username, username_len)); if (username_len == val[i].username_len && memcmp (username, val[i].username, username_len) == 0) { @@ -193,7 +194,8 @@ STUN_MESSAGE_RETURN_SUCCESS && (error_code == 400 || error_code == 401)) || (stun_message_get_class (msg) == STUN_INDICATION && - (agent->usage_flags & STUN_AGENT_USAGE_NO_INDICATION_AUTH)); + (agent->usage_flags & STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS || + agent->usage_flags & STUN_AGENT_USAGE_NO_INDICATION_AUTH)); if (key == NULL && ignore_credentials == 0 && @@ -236,9 +238,7 @@ because you might have a FINGERPRINT attribute after it... */ if (agent->usage_flags & STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS) { uint8_t *realm = NULL; - uint8_t *username = NULL; uint16_t realm_len; - uint16_t username_len; uint8_t md5[16]; if (long_term_key_valid) { @@ -554,9 +554,9 @@ stun_hash_creds (realm, realm_len, username, username_len, key, key_len, md5); + memcpy (msg->long_term_key, md5, sizeof(msg->long_term_key)); + msg->long_term_valid = TRUE; } - memcpy (msg->long_term_key, md5, sizeof(msg->long_term_key)); - msg->long_term_valid = TRUE; } /* If no realm/username and long term credentials, diff -Nru libnice-0.1.4/stun/stunmessage.c libnice-0.1.7/stun/stunmessage.c --- libnice-0.1.4/stun/stunmessage.c 2011-09-08 01:01:53.000000000 +0000 +++ libnice-0.1.7/stun/stunmessage.c 2014-05-02 21:45:09.000000000 +0000 @@ -124,6 +124,10 @@ case STUN_ATTRIBUTE_FINGERPRINT: /* Nothing may come after FPR */ return NULL; + + default: + /* Nothing misordered. */ + break; } if (!(msg->agent && @@ -219,7 +223,7 @@ StunMessageReturn stun_message_find_addr (const StunMessage *msg, StunAttribute type, - struct sockaddr *addr, socklen_t *addrlen) + struct sockaddr_storage *addr, socklen_t *addrlen) { const uint8_t *ptr; uint16_t len = 0; @@ -272,15 +276,15 @@ memcpy (&ip6->sin6_addr, ptr + 4, 16); return STUN_MESSAGE_RETURN_SUCCESS; } - } - return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; + default: + return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; + } } StunMessageReturn stun_message_find_xor_addr (const StunMessage *msg, StunAttribute type, - struct sockaddr *addr, - socklen_t *addrlen) + struct sockaddr_storage *addr, socklen_t *addrlen) { StunMessageReturn val = stun_message_find_addr (msg, type, addr, addrlen); if (val) @@ -291,8 +295,7 @@ StunMessageReturn stun_message_find_xor_addr_full (const StunMessage *msg, StunAttribute type, - struct sockaddr *addr, socklen_t *addrlen, - uint32_t magic_cookie) + struct sockaddr_storage *addr, socklen_t *addrlen, uint32_t magic_cookie) { StunMessageReturn val = stun_message_find_addr (msg, type, addr, addrlen); if (val) @@ -352,9 +355,11 @@ * to a multiple of 4 for compatibility with old RFC3489 */ a = stun_setw (a, stun_message_has_cookie (msg) ? length : stun_align (length)); - /* Add padding if needed */ - memset (a + length, ' ', stun_padding (length)); - mlen += stun_padding (length); + /* Add padding if needed. Avoid a zero-length memset() call. */ + if (stun_padding (length) > 0) { + memset (a + length, ' ', stun_padding (length)); + mlen += stun_padding (length); + } } mlen += 4 + length; @@ -372,7 +377,9 @@ if (ptr == NULL) return STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE; - memcpy (ptr, data, len); + if (len > 0) + memcpy (ptr, data, len); + return STUN_MESSAGE_RETURN_SUCCESS; } @@ -466,43 +473,43 @@ StunMessageReturn stun_message_append_xor_addr (StunMessage *msg, StunAttribute type, - const struct sockaddr *addr, socklen_t addrlen) + const struct sockaddr_storage *addr, socklen_t addrlen) { StunMessageReturn val; /* Must be big enough to hold any supported address: */ - struct sockaddr_storage xor; + struct sockaddr_storage tmpaddr; - if ((size_t) addrlen > sizeof (xor)) - addrlen = sizeof (xor); - memcpy (&xor, addr, addrlen); + if ((size_t) addrlen > sizeof (tmpaddr)) + addrlen = sizeof (tmpaddr); + memcpy (&tmpaddr, addr, addrlen); - val = stun_xor_address (msg, (struct sockaddr *)&xor, addrlen, + val = stun_xor_address (msg, &tmpaddr, addrlen, STUN_MAGIC_COOKIE); if (val) return val; - return stun_message_append_addr (msg, type, (struct sockaddr *)&xor, + return stun_message_append_addr (msg, type, (struct sockaddr *) &tmpaddr, addrlen); } StunMessageReturn stun_message_append_xor_addr_full (StunMessage *msg, StunAttribute type, - const struct sockaddr *addr, socklen_t addrlen, + const struct sockaddr_storage *addr, socklen_t addrlen, uint32_t magic_cookie) { StunMessageReturn val; /* Must be big enough to hold any supported address: */ - struct sockaddr_storage xor; + struct sockaddr_storage tmpaddr; - if ((size_t) addrlen > sizeof (xor)) - addrlen = sizeof (xor); - memcpy (&xor, addr, addrlen); + if ((size_t) addrlen > sizeof (tmpaddr)) + addrlen = sizeof (tmpaddr); + memcpy (&tmpaddr, addr, addrlen); - val = stun_xor_address (msg, (struct sockaddr *)&xor, addrlen, magic_cookie); + val = stun_xor_address (msg, &tmpaddr, addrlen, magic_cookie); if (val) return val; - return stun_message_append_addr (msg, type, (struct sockaddr *)&xor, + return stun_message_append_addr (msg, type, (struct sockaddr *) &tmpaddr, addrlen); } @@ -513,66 +520,121 @@ { const char *str = stun_strerror (code); size_t len = strlen (str); - div_t d = div (code, 100); uint8_t *ptr = stun_message_append (msg, STUN_ATTRIBUTE_ERROR_CODE, 4 + len); if (ptr == NULL) return STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE; memset (ptr, 0, 2); - ptr[2] = d.quot; - ptr[3] = d.rem; + ptr[2] = code / 100; + ptr[3] = code % 100; memcpy (ptr + 4, str, len); return STUN_MESSAGE_RETURN_SUCCESS; } -int stun_message_validate_buffer_length (const uint8_t *msg, size_t length, - bool has_padding) +/* Fast validity check for a potential STUN packet. Examines the type and + * length, but none of the attributes. Designed to allow vectored I/O on all + * incoming packets, filtering packets for closer inspection as to whether + * they’re STUN packets. If they look like they might be, their buffers are + * compacted to allow a more thorough check. */ +ssize_t stun_message_validate_buffer_length_fast (StunInputVector *buffers, + unsigned int n_buffers, size_t total_length, bool has_padding) { size_t mlen; - size_t len; - if (length < 1) + if (total_length < 1 || n_buffers < 1) { stun_debug ("STUN error: No data!\n"); return STUN_MESSAGE_BUFFER_INVALID; } - if (msg[0] >> 6) + if (buffers[0].buffer[0] >> 6) { stun_debug ("STUN error: RTP or other non-protocol packet!\n"); return STUN_MESSAGE_BUFFER_INVALID; // RTP or other non-STUN packet } - if (length < 4) + if (total_length < STUN_MESSAGE_LENGTH_POS + STUN_MESSAGE_LENGTH_LEN) { stun_debug ("STUN error: Incomplete STUN message header!\n"); return STUN_MESSAGE_BUFFER_INCOMPLETE; } - mlen = stun_getw (msg + STUN_MESSAGE_LENGTH_POS) + - STUN_MESSAGE_HEADER_LENGTH; + if (buffers[0].size >= STUN_MESSAGE_LENGTH_POS + STUN_MESSAGE_LENGTH_LEN) { + /* Fast path. */ + mlen = stun_getw (buffers[0].buffer + STUN_MESSAGE_LENGTH_POS); + } else { + /* Slow path. Tiny buffers abound. */ + size_t skip_remaining = STUN_MESSAGE_LENGTH_POS; + unsigned int i; + + /* Skip bytes. */ + for (i = 0; i < n_buffers; i++) { + if (buffers[i].size <= skip_remaining) + skip_remaining -= buffers[i].size; + else + break; + } - if (has_padding && stun_padding (mlen)) - { + /* Read bytes. May be split over two buffers. We’ve already checked that + * @total_length is long enough, so @n_buffers should be too. */ + if (buffers[i].size - skip_remaining > 1) { + mlen = stun_getw (buffers[i].buffer + skip_remaining); + } else { + mlen = (*(buffers[i].buffer + skip_remaining) << 8) | + (*(buffers[i + 1].buffer)); + } + } + + mlen += STUN_MESSAGE_HEADER_LENGTH; + + if (has_padding && stun_padding (mlen)) { stun_debug ("STUN error: Invalid message length: %u!\n", (unsigned)mlen); return STUN_MESSAGE_BUFFER_INVALID; // wrong padding } - if (length < mlen) - { + if (total_length < mlen) { stun_debug ("STUN error: Incomplete message: %u of %u bytes!\n", - (unsigned)length, (unsigned)mlen); + (unsigned) total_length, (unsigned) mlen); return STUN_MESSAGE_BUFFER_INCOMPLETE; // partial message } + return mlen; +} + +int stun_message_validate_buffer_length (const uint8_t *msg, size_t length, + bool has_padding) +{ + ssize_t fast_retval; + size_t mlen; + size_t len; + StunInputVector input_buffer = { msg, length }; + + /* Fast pre-check first. */ + fast_retval = stun_message_validate_buffer_length_fast (&input_buffer, 1, + length, has_padding); + if (fast_retval <= 0) + return fast_retval; + + mlen = fast_retval; + + /* Skip past the header (validated above). */ msg += 20; len = mlen - 20; /* from then on, we know we have the entire packet in buffer */ while (len > 0) { - size_t alen = stun_getw (msg + STUN_ATTRIBUTE_TYPE_LEN); + size_t alen; + + if (len < 4) + { + stun_debug ("STUN error: Incomplete STUN attribute header of length " + "%u bytes!\n", (unsigned)len); + return STUN_MESSAGE_BUFFER_INVALID; + } + + alen = stun_getw (msg + STUN_ATTRIBUTE_TYPE_LEN); if (has_padding) alen = stun_align (alen); diff -Nru libnice-0.1.4/stun/stunmessage.h libnice-0.1.7/stun/stunmessage.h --- libnice-0.1.4/stun/stunmessage.h 2011-02-02 04:50:08.000000000 +0000 +++ libnice-0.1.7/stun/stunmessage.h 2014-05-02 21:43:26.000000000 +0000 @@ -645,7 +645,7 @@ * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown. */ StunMessageReturn stun_message_find_addr (const StunMessage *msg, - StunAttribute type, struct sockaddr *addr, socklen_t *addrlen); + StunAttribute type, struct sockaddr_storage *addr, socklen_t *addrlen); /** * stun_message_find_xor_addr: @@ -664,7 +664,7 @@ * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown. */ StunMessageReturn stun_message_find_xor_addr (const StunMessage *msg, - StunAttribute type, struct sockaddr *addr, socklen_t *addrlen); + StunAttribute type, struct sockaddr_storage *addr, socklen_t *addrlen); /** * stun_message_find_xor_addr_full: @@ -684,7 +684,7 @@ * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown. */ StunMessageReturn stun_message_find_xor_addr_full (const StunMessage *msg, - StunAttribute type, struct sockaddr *addr, + StunAttribute type, struct sockaddr_storage *addr, socklen_t *addrlen, uint32_t magic_cookie); @@ -811,7 +811,7 @@ * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown. */ StunMessageReturn stun_message_append_xor_addr (StunMessage * msg, - StunAttribute type, const struct sockaddr *addr, socklen_t addrlen); + StunAttribute type, const struct sockaddr_storage *addr, socklen_t addrlen); /** * stun_message_append_xor_addr_full: @@ -828,7 +828,7 @@ * %STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS if the address family is unknown. */ StunMessageReturn stun_message_append_xor_addr_full (StunMessage * msg, - StunAttribute type, const struct sockaddr *addr, socklen_t addrlen, + StunAttribute type, const struct sockaddr_storage *addr, socklen_t addrlen, uint32_t magic_cookie); /** @@ -879,6 +879,53 @@ bool has_padding); /** + * StunInputVector: + * @buffer: a buffer containing already-received binary data + * @size: length of @buffer, in bytes + * + * Container for a single buffer which also stores its length. This is designed + * for vectored I/O: typically an array of #StunInputVectors is passed to + * functions, providing multiple buffers which store logically contiguous + * received data. + * + * This is guaranteed to be layed out identically in memory to #GInputVector. + * + * Since: 0.1.5 + */ +typedef struct { + const uint8_t *buffer; + size_t size; +} StunInputVector; + +/** + * stun_message_validate_buffer_length_fast: + * @buffers: (array length=n_buffers) (in caller-allocated): array of contiguous + * #StunInputVectors containing already-received message data + * @n_buffers: number of entries in @buffers + * @total_length: total number of valid bytes stored consecutively in @buffers + * @has_padding: %TRUE if attributes should be padded to 4-byte boundaries + * + * Quickly validate whether the message in the given @buffers is potentially a + * valid STUN message, an incomplete STUN message, or if it’s definitely not one + * at all. + * + * This is designed as a first-pass validation only, and does not check the + * message’s attributes for validity. If this function returns success, the + * buffers can be compacted and a more thorough validation can be performed + * using stun_message_validate_buffer_length(). If it fails, the buffers + * definitely do not contain a complete, valid STUN message. + * + * Returns: The length of the valid STUN message in the buffer, or zero or -1 on + * failure + * See also: #STUN_MESSAGE_BUFFER_INCOMPLETE + * See also: #STUN_MESSAGE_BUFFER_INVALID + * + * Since: 0.1.5 + */ +ssize_t stun_message_validate_buffer_length_fast (StunInputVector *buffers, + unsigned int n_buffers, size_t total_length, bool has_padding); + +/** * stun_message_id: * @msg: The #StunMessage * @id: The #StunTransactionId to fill diff -Nru libnice-0.1.4/stun/tests/Makefile.in libnice-0.1.7/stun/tests/Makefile.in --- libnice-0.1.4/stun/tests/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/stun/tests/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -22,23 +21,51 @@ # # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -57,15 +84,17 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(dist_check_SCRIPTS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(dist_check_SCRIPTS) \ + $(top_srcdir)/depcomp $(top_srcdir)/test-driver check_PROGRAMS = test-parse$(EXEEXT) test-format$(EXEEXT) \ test-bind$(EXEEXT) test-conncheck$(EXEEXT) test-hmac$(EXEEXT) @WINDOWS_TRUE@am__append_1 = -DWINVER=0x0501 # _WIN32_WINNT_WINXP @WINDOWS_TRUE@am__append_2 = -lws2_32 subdir = stun/tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -81,6 +110,7 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = test_conncheck_SOURCES = test-conncheck.c test_conncheck_OBJECTS = test-conncheck.$(OBJEXT) test_conncheck_LDADD = $(LDADD) @@ -101,6 +131,18 @@ test_parse_LDADD = $(LDADD) test_parse_DEPENDENCIES = $(top_builddir)/stun/libstun.la \ $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -113,20 +155,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = test-bind.c test-conncheck.c test-format.c test-hmac.c \ test-parse.c DIST_SOURCES = test-bind.c test-conncheck.c test-format.c test-hmac.c \ @@ -136,10 +174,229 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/nice ACLOCAL = @ACLOCAL@ @@ -284,23 +541,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda AM_CPPFLAGS = -I$(top_srcdir) AM_CFLAGS = -std=gnu99 $(am__append_1) @@ -310,7 +550,7 @@ all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -351,18 +591,23 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list + test-bind$(EXEEXT): $(test_bind_OBJECTS) $(test_bind_DEPENDENCIES) $(EXTRA_test_bind_DEPENDENCIES) @rm -f test-bind$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_bind_OBJECTS) $(test_bind_LDADD) $(LIBS) + test-conncheck$(EXEEXT): $(test_conncheck_OBJECTS) $(test_conncheck_DEPENDENCIES) $(EXTRA_test_conncheck_DEPENDENCIES) @rm -f test-conncheck$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_conncheck_OBJECTS) $(test_conncheck_LDADD) $(LIBS) + test-format$(EXEEXT): $(test_format_OBJECTS) $(test_format_DEPENDENCIES) $(EXTRA_test_format_DEPENDENCIES) @rm -f test-format$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_format_OBJECTS) $(test_format_LDADD) $(LIBS) + test-hmac$(EXEEXT): $(test_hmac_OBJECTS) $(test_hmac_DEPENDENCIES) $(EXTRA_test_hmac_DEPENDENCIES) @rm -f test-hmac$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_hmac_OBJECTS) $(test_hmac_LDADD) $(LIBS) + test-parse$(EXEEXT): $(test_parse_OBJECTS) $(test_parse_DEPENDENCIES) $(EXTRA_test_parse_DEPENDENCIES) @rm -f test-parse$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_parse_OBJECTS) $(test_parse_LDADD) $(LIBS) @@ -406,26 +651,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -437,15 +671,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -454,102 +684,215 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + else \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ else \ - skipped="($$skip tests were not run)"; \ + color_start= color_end=; \ fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) $(dist_check_SCRIPTS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-parse.log: test-parse$(EXEEXT) + @p='test-parse$(EXEEXT)'; \ + b='test-parse'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-format.log: test-format$(EXEEXT) + @p='test-format$(EXEEXT)'; \ + b='test-format'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-bind.log: test-bind$(EXEEXT) + @p='test-bind$(EXEEXT)'; \ + b='test-bind'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-conncheck.log: test-conncheck$(EXEEXT) + @p='test-conncheck$(EXEEXT)'; \ + b='test-conncheck'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-hmac.log: test-hmac$(EXEEXT) + @p='test-hmac$(EXEEXT)'; \ + b='test-hmac'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -608,6 +951,9 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -692,9 +1038,9 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -704,7 +1050,7 @@ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + recheck tags tags-am uninstall uninstall-am check-valgrind: diff -Nru libnice-0.1.4/stun/tests/test-bind.c libnice-0.1.7/stun/tests/test-bind.c --- libnice-0.1.4/stun/tests/test-bind.c 2012-03-06 01:59:42.000000000 +0000 +++ libnice-0.1.7/stun/tests/test-bind.c 2014-03-31 23:18:16.000000000 +0000 @@ -102,7 +102,8 @@ /** Incorrect socket family test */ static void bad_family (void) { - struct sockaddr addr, dummy; + struct sockaddr addr; + struct sockaddr_storage dummy; int val; socklen_t dummylen = sizeof(dummy); @@ -121,7 +122,8 @@ /** Too small socket address test */ static void small_srv_addr (void) { - struct sockaddr addr, dummy; + struct sockaddr addr; + struct sockaddr_storage dummy; int val; socklen_t dummylen = sizeof(dummy); @@ -141,7 +143,7 @@ static void big_srv_addr (void) { uint8_t buf[sizeof (struct sockaddr_storage) + 16]; - struct sockaddr dummy; + struct sockaddr_storage dummy; int val; socklen_t dummylen = sizeof(dummy); @@ -156,8 +158,7 @@ /** Timeout test */ static void timeout (void) { - struct sockaddr_storage srv; - struct sockaddr dummy; + struct sockaddr_storage srv, dummy; socklen_t srvlen = sizeof (srv); socklen_t dummylen = sizeof(dummy); int val; @@ -231,8 +232,7 @@ assert (stun_agent_validate (&agent, &msg, buf, len, NULL, NULL) == STUN_VALIDATION_SUCCESS); - val = stun_usage_bind_process (&msg, - (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen); + val = stun_usage_bind_process (&msg, &addr, &addrlen, &addr, &addrlen); assert (val == STUN_USAGE_BIND_RETURN_INVALID); /* Send response with wrong request type */ @@ -241,8 +241,7 @@ /* Send error response without ERROR-CODE */ buf[1] |= 0x10; - val = stun_usage_bind_process (&msg, - (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen); + val = stun_usage_bind_process (&msg, &addr, &addrlen, &addr, &addrlen); assert (val == STUN_USAGE_BIND_RETURN_INVALID); close (fd); @@ -311,8 +310,7 @@ val = getsockname (servfd, (struct sockaddr *)&addr, &addrlen); assert (val == 0); - val = stun_usage_bind_process (&msg, - (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen); + val = stun_usage_bind_process (&msg, &addr, &addrlen, &addr, &addrlen); assert (val == STUN_USAGE_BIND_RETURN_ERROR); /* Send response with a no mapped address at all */ @@ -342,8 +340,7 @@ val = getsockname (servfd, (struct sockaddr *)&addr, &addrlen); assert (val == 0); - val = stun_usage_bind_process (&msg, - (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen); + val = stun_usage_bind_process (&msg, &addr, &addrlen, &addr, &addrlen); assert (val == STUN_USAGE_BIND_RETURN_ERROR); /* Send old-style response */ @@ -365,7 +362,7 @@ stun_agent_init_response (&agent, &msg, buf, sizeof (buf), &msg); assert (stun_message_append_addr (&msg, STUN_ATTRIBUTE_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen) == STUN_MESSAGE_RETURN_SUCCESS); + &addr, addrlen) == STUN_MESSAGE_RETURN_SUCCESS); len = stun_agent_finish_message (&agent, &msg, NULL, 0); assert (len > 0); @@ -375,8 +372,7 @@ val = getsockname (servfd, (struct sockaddr *)&addr, &addrlen); assert (val == 0); - val = stun_usage_bind_process (&msg, - (struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen); + val = stun_usage_bind_process (&msg, &addr, &addrlen, &addr, &addrlen); assert (val == STUN_USAGE_BIND_RETURN_SUCCESS); /* End */ diff -Nru libnice-0.1.4/stun/tests/test-conncheck.c libnice-0.1.7/stun/tests/test-conncheck.c --- libnice-0.1.4/stun/tests/test-conncheck.c 2011-02-02 04:49:42.000000000 +0000 +++ libnice-0.1.7/stun/tests/test-conncheck.c 2014-03-31 22:41:13.000000000 +0000 @@ -67,24 +67,30 @@ int main (void) { - struct sockaddr_in ip4; + union { + struct sockaddr sa; + struct sockaddr_storage storage; + struct sockaddr_in ip4; + } addr; uint8_t req_buf[STUN_MAX_MESSAGE_SIZE]; uint8_t resp_buf[STUN_MAX_MESSAGE_SIZE]; - const uint64_t tie = 0x8000000000000000LL; + const const uint64_t tie = 0x8000000000000000LL; StunMessageReturn val; StunUsageIceReturn val2; size_t len; size_t rlen; - static char username[] = "L:R", ufrag[] = "L", pass[] = "secret"; + static char username[] = "L:R"; + static uint8_t ufrag[] = "L", pass[] = "secret"; + size_t ufrag_len = strlen ((char*) ufrag); + size_t pass_len = strlen ((char*) pass); int code; - uint16_t alen; bool control = false; StunAgent agent; StunMessage req; StunMessage resp; StunDefaultValidaterData validater_data[] = { - {ufrag, strlen (ufrag), pass, strlen (pass)}, - {username, strlen (username), pass, strlen (pass)}, + {ufrag, ufrag_len, pass, pass_len}, + {(uint8_t *) username, strlen (username), pass, pass_len}, {NULL, 0, NULL, 0}}; StunValidationStatus valid; @@ -93,13 +99,13 @@ STUN_AGENT_USAGE_USE_FINGERPRINT | STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS); - memset (&ip4, 0, sizeof (ip4)); - ip4.sin_family = AF_INET; + memset (&addr, 0, sizeof (addr)); + addr.ip4.sin_family = AF_INET; #ifdef HAVE_SA_LEN - ip4.sin_len = sizeof (addr); + addr.ip4.sin_len = sizeof (addr); #endif - ip4.sin_port = htons (12345); - ip4.sin_addr.s_addr = htonl (0x7f000001); + addr.ip4.sin_port = htons (12345); + addr.ip4.sin_addr.s_addr = htonl (0x7f000001); /* Incorrect message class */ assert (stun_agent_init_request (&agent, &req, req_buf, sizeof(req_buf), STUN_BINDING)); @@ -110,8 +116,8 @@ len = sizeof (resp_buf); val2 = stun_usage_ice_conncheck_create_reply (&agent, &req, - &resp, resp_buf, &len, (struct sockaddr *)&ip4, - sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); + &resp, resp_buf, &len, &addr.storage, + sizeof (addr.ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); assert (val2 == STUN_USAGE_ICE_RETURN_INVALID_REQUEST); assert (len == 0); @@ -119,13 +125,13 @@ assert (stun_agent_init_request (&agent, &req, req_buf, sizeof(req_buf), 0x666)); val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, username); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); len = sizeof (resp_buf); val2 = stun_usage_ice_conncheck_create_reply (&agent, &req, - &resp, resp_buf, &len, (struct sockaddr *)&ip4, - sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); + &resp, resp_buf, &len, &addr.storage, + sizeof (addr.ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); assert (val2 == STUN_USAGE_ICE_RETURN_INVALID_METHOD); assert (len > 0); @@ -135,7 +141,7 @@ assert (val == STUN_MESSAGE_RETURN_SUCCESS); val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, username); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); valid = stun_agent_validate (&agent, &req, req_buf, rlen, @@ -155,7 +161,7 @@ /* No username */ assert (stun_agent_init_request (&agent, &req, req_buf, sizeof(req_buf), STUN_BINDING)); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); valid = stun_agent_validate (&agent, &req, req_buf, rlen, @@ -171,16 +177,17 @@ assert (val == STUN_MESSAGE_RETURN_SUCCESS); val = stun_message_append_flag (&req, STUN_ATTRIBUTE_USE_CANDIDATE); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, ufrag); + val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, + (char*) ufrag); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); len = sizeof (resp_buf); val2 = stun_usage_ice_conncheck_create_reply (&agent, &req, - &resp, resp_buf, &len, (struct sockaddr *)&ip4, - sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); - assert (val == STUN_USAGE_ICE_RETURN_SUCCESS); + &resp, resp_buf, &len, &addr.storage, + sizeof (addr.ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); + assert (val2 == STUN_USAGE_ICE_RETURN_SUCCESS); assert (len > 0); assert (stun_agent_validate (&agent, &resp, resp_buf, len, stun_agent_default_validater, validater_data) == STUN_VALIDATION_SUCCESS); @@ -192,18 +199,18 @@ assert (stun_agent_init_request (&agent, &req, req_buf, sizeof(req_buf), STUN_BINDING)); val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, ufrag); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); - ip4.sin_family = AF_UNSPEC; + addr.ip4.sin_family = AF_UNSPEC; len = sizeof (resp_buf); val2 = stun_usage_ice_conncheck_create_reply (&agent, &req, - &resp, resp_buf, &len, (struct sockaddr *)&ip4, - sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); + &resp, resp_buf, &len, &addr.storage, + sizeof (addr.ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); assert (val2 == STUN_USAGE_ICE_RETURN_INVALID_ADDRESS); assert (len == 0); - ip4.sin_family = AF_INET; + addr.ip4.sin_family = AF_INET; /* Lost role conflict */ assert (stun_agent_init_request (&agent, &req, req_buf, sizeof(req_buf), STUN_BINDING)); @@ -211,15 +218,15 @@ assert (val == STUN_MESSAGE_RETURN_SUCCESS); val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, ufrag); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); len = sizeof (resp_buf); control = true; val2 = stun_usage_ice_conncheck_create_reply (&agent, &req, - &resp, resp_buf, &len, (struct sockaddr *)&ip4, - sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); + &resp, resp_buf, &len, &addr.storage, + sizeof (addr.ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); assert (val2 == STUN_USAGE_ICE_RETURN_ROLE_CONFLICT); assert (len > 0); assert (control == false); @@ -233,14 +240,14 @@ assert (val == STUN_MESSAGE_RETURN_SUCCESS); val = stun_message_append_string (&req, STUN_ATTRIBUTE_USERNAME, ufrag); assert (val == STUN_MESSAGE_RETURN_SUCCESS); - rlen = stun_agent_finish_message (&agent, &req, pass, strlen (pass)); + rlen = stun_agent_finish_message (&agent, &req, pass, pass_len); assert (rlen > 0); len = sizeof (resp_buf); control = false; val2 = stun_usage_ice_conncheck_create_reply (&agent, &req, - &resp, resp_buf, &len, (struct sockaddr *)&ip4, - sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); + &resp, resp_buf, &len, &addr.storage, + sizeof (addr.ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245); assert (val2 == STUN_USAGE_ICE_RETURN_SUCCESS); assert (len > 0); assert (control == false); diff -Nru libnice-0.1.4/stun/tests/test-format.c libnice-0.1.7/stun/tests/test-format.c --- libnice-0.1.4/stun/tests/test-format.c 2011-02-02 04:49:42.000000000 +0000 +++ libnice-0.1.7/stun/tests/test-format.c 2014-05-02 21:48:08.000000000 +0000 @@ -66,20 +66,20 @@ exit (1); } -static const char usr[] = "admin"; -static const char pwd[] = "s3kr3t"; +static const uint8_t usr[] = "admin"; +static const uint8_t pwd[] = "s3kr3t"; -bool dynamic_check_validater (StunAgent *agent, +static bool dynamic_check_validater (StunAgent *agent, StunMessage *message, uint8_t *username, uint16_t username_len, uint8_t **password, size_t *password_len, void *user_data) { - if (username_len != strlen (usr) || - memcmp (username, usr, strlen (usr)) != 0) + if (username_len != strlen ((char *) usr) || + memcmp (username, usr, strlen ((char *) usr)) != 0) fatal ("vector test : Validater received wrong username!"); *password = (uint8_t *) pwd; - *password_len = strlen (pwd); + *password_len = strlen ((char *) pwd); return true; @@ -117,9 +117,9 @@ if (stun_message_find (&msg2, STUN_ATTRIBUTE_MESSAGE_INTEGRITY, &plen) != NULL) fatal ("Missing HMAC test failed"); - stun_message_append_string (&msg2, STUN_ATTRIBUTE_USERNAME, usr); + stun_message_append_string (&msg2, STUN_ATTRIBUTE_USERNAME, (char *) usr); - len = stun_agent_finish_message (agent, &msg2, pwd, strlen (pwd)); + len = stun_agent_finish_message (agent, &msg2, pwd, strlen ((char *) pwd)); if (len <= 0) fatal ("Cannot finish message with short-term creds"); @@ -146,29 +146,30 @@ stun_agent_init_request (&agent, &msg, buf, sizeof(buf), STUN_BINDING); if (stun_message_append_addr (&msg, STUN_ATTRIBUTE_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen) != + (struct sockaddr *) &addr, addrlen) != STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS) fatal ("Unknown address family test failed"); if (stun_message_append_xor_addr (&msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen) != + &addr, addrlen) != STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS) fatal ("Unknown address family xor test failed"); addr.ss_family = family; if (stun_message_append_addr (&msg, STUN_ATTRIBUTE_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen - 1) != STUN_MESSAGE_RETURN_INVALID) + (struct sockaddr *) &addr, addrlen - 1) != + STUN_MESSAGE_RETURN_INVALID) fatal ("Too small %s sockaddr test failed", name); if (stun_message_append_xor_addr (&msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen - 1) != STUN_MESSAGE_RETURN_INVALID) + &addr, addrlen - 1) != STUN_MESSAGE_RETURN_INVALID) fatal ("Too small %s sockaddr xor test failed", name); if (stun_message_append_addr (&msg, STUN_ATTRIBUTE_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen) != STUN_MESSAGE_RETURN_SUCCESS) + (struct sockaddr *) &addr, addrlen) != STUN_MESSAGE_RETURN_SUCCESS) fatal ("%s sockaddr test failed", name); if (stun_message_append_xor_addr (&msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addrlen) != STUN_MESSAGE_RETURN_SUCCESS) + &addr, addrlen) != STUN_MESSAGE_RETURN_SUCCESS) fatal ("%s sockaddr xor test failed", name); } @@ -176,7 +177,10 @@ { uint8_t buf[100]; size_t len; - struct sockaddr addr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } addr; StunAgent agent; StunMessage msg; @@ -240,17 +244,17 @@ fatal ("String overflow test failed"); memset (&addr, 0, sizeof (addr)); - addr.sa_family = AF_INET; -#ifdef HAVE_SA_LEN - addr.sa_len = sizeof (addr); + addr.addr.sa_family = AF_INET; +#ifdef HAVE_SS_LEN + addr.addr.ss_len = sizeof (addr); #endif - if (stun_message_append_xor_addr (&msg, 0xffff, &addr, + if (stun_message_append_xor_addr (&msg, 0xffff, &addr.storage, sizeof (addr)) != STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE) fatal ("Address overflow test failed"); len = sizeof (msg); if (stun_agent_finish_message (&agent, &msg, NULL, 0) != 0) fatal ("Fingerprint overflow test failed"); - if (stun_agent_finish_message (&agent, &msg, pwd, strlen (pwd)) != 0) + if (stun_agent_finish_message (&agent, &msg, pwd, strlen ((char *) pwd)) != 0) fatal ("Message integrity overflow test failed"); /* Address attributes tests */ diff -Nru libnice-0.1.4/stun/tests/test-hmac.c libnice-0.1.7/stun/tests/test-hmac.c --- libnice-0.1.4/stun/tests/test-hmac.c 2009-08-14 22:46:12.000000000 +0000 +++ libnice-0.1.7/stun/tests/test-hmac.c 2014-03-31 21:39:58.000000000 +0000 @@ -45,7 +45,7 @@ #include #include -void print_bytes (uint8_t *bytes, int len) +static void print_bytes (const uint8_t *bytes, int len) { int i; @@ -55,12 +55,12 @@ printf ("\n"); } -void test_sha1 (uint8_t *str, uint8_t *expected) { +static void test_sha1 (const uint8_t *str, const uint8_t *expected) { SHA1_CTX ctx; uint8_t sha1[20]; SHA1Init(&ctx); - SHA1Update(&ctx, str, strlen (str)); + SHA1Update(&ctx, str, strlen ((char *) str)); SHA1Final(sha1, &ctx); printf ("SHA1 of '%s' : ", str); @@ -73,10 +73,11 @@ } -void test_hmac (uint8_t *key, uint8_t *str, uint8_t *expected) { +static void test_hmac (const uint8_t *key, const uint8_t *str, + const uint8_t *expected) { uint8_t hmac[20]; - hmac_sha1(key, strlen (key), str, strlen (str), hmac); + hmac_sha1(key, strlen ((char *) key), str, strlen ((char *) str), hmac); printf ("HMAC of '%s' with key '%s' is : ", str, key); print_bytes (hmac, SHA1_MAC_LEN); printf ("Expected : "); @@ -86,13 +87,12 @@ exit (1); } -void test_md5 (uint8_t *str, uint8_t *expected) { +static void test_md5 (const uint8_t *str, const uint8_t *expected) { MD5_CTX ctx; uint8_t md5[20]; - int i; MD5Init(&ctx); - MD5Update(&ctx, str, strlen (str)); + MD5Update(&ctx, str, strlen ((char *) str)); MD5Final(md5, &ctx); printf ("MD5 of '%s' : 0x", str); @@ -128,15 +128,16 @@ 0xaa, 0xe1, 0x16, 0xd3, 0x87, 0x6c, 0x66, 0x4a}; - test_hmac ("hello", "world", hello_world_hmac); + test_hmac ((const uint8_t *) "hello", (const uint8_t*) "world", + hello_world_hmac); - test_sha1 ("abc", abc_sha1); - test_md5 ("abc", abc_md5); + test_sha1 ((const uint8_t *) "abc", abc_sha1); + test_md5 ((const uint8_t *) "abc", abc_md5); - test_sha1 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - abcd_etc_sha1); - test_md5 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - abcd_etc_md5); + test_sha1 ((const uint8_t *) + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", abcd_etc_sha1); + test_md5 ((const uint8_t *) + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", abcd_etc_md5); return 0; } diff -Nru libnice-0.1.4/stun/tests/test-parse.c libnice-0.1.7/stun/tests/test-parse.c --- libnice-0.1.4/stun/tests/test-parse.c 2012-08-16 19:57:10.000000000 +0000 +++ libnice-0.1.7/stun/tests/test-parse.c 2014-03-31 22:41:13.000000000 +0000 @@ -285,18 +285,18 @@ } -bool test_attribute_validater (StunAgent *agent, +static bool test_attribute_validater (StunAgent *agent, StunMessage *message, uint8_t *username, uint16_t username_len, uint8_t **password, size_t *password_len, void *user_data) { - char *pwd = (char *) user_data; + uint8_t *pwd = user_data; if (username_len != 4 || memcmp (username, "ABCD", 4) != 0) return false; *password = pwd; - *password_len = strlen (pwd); + *password_len = strlen ((char *) pwd); return true; } @@ -356,7 +356,7 @@ union { - struct sockaddr sa; + struct sockaddr_storage st; struct sockaddr_in6 s6; } addr; socklen_t addrlen; @@ -368,7 +368,7 @@ StunMessage msg; uint16_t known_attributes[] = {STUN_ATTRIBUTE_MESSAGE_INTEGRITY, STUN_ATTRIBUTE_USERNAME, 0}; - printf ("Attribute test message length: %lu\n", sizeof (acme)); + printf ("Attribute test message length: %zd\n", sizeof (acme)); stun_agent_init (&agent, known_attributes, STUN_COMPATIBILITY_RFC5389, STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS); @@ -378,11 +378,11 @@ fatal ("Unauthorized validation failed"); if (stun_agent_validate (&agent, &msg, acme, sizeof(acme), - test_attribute_validater, "bad__guy") != STUN_VALIDATION_UNAUTHORIZED) + test_attribute_validater, (void *) "bad__guy") != STUN_VALIDATION_UNAUTHORIZED) fatal ("invalid password validation failed"); if (stun_agent_validate (&agent, &msg, acme, sizeof(acme), - test_attribute_validater, "good_guy") != STUN_VALIDATION_SUCCESS) + test_attribute_validater, (void *) "good_guy") != STUN_VALIDATION_SUCCESS) fatal ("good password validation failed"); if (stun_message_has_attribute (&msg, 0xff00)) @@ -422,27 +422,27 @@ fatal ("String test failed"); addrlen = sizeof (addr); - if (stun_message_find_addr (&msg, 0xff01, &addr.sa, &addrlen) != + if (stun_message_find_addr (&msg, 0xff01, &addr.st, &addrlen) != STUN_MESSAGE_RETURN_INVALID) fatal ("Too short addres test failed"); addrlen = sizeof (addr); - if (stun_message_find_addr (&msg, 0xff02, &addr.sa, &addrlen) != + if (stun_message_find_addr (&msg, 0xff02, &addr.st, &addrlen) != STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS) fatal ("Unknown address family test failed"); addrlen = sizeof (addr); - if (stun_message_find_addr (&msg, 0xff03, &addr.sa, &addrlen) != + if (stun_message_find_addr (&msg, 0xff03, &addr.st, &addrlen) != STUN_MESSAGE_RETURN_INVALID) fatal ("Too short IPv6 address test failed"); addrlen = sizeof (addr); - if (stun_message_find_addr (&msg, 0xff04, &addr.sa, &addrlen) != + if (stun_message_find_addr (&msg, 0xff04, &addr.st, &addrlen) != STUN_MESSAGE_RETURN_SUCCESS) fatal ("IPv4 address test failed"); addrlen = sizeof (addr); - if (stun_message_find_addr (&msg, 0xff05, &addr.sa, &addrlen) != + if (stun_message_find_addr (&msg, 0xff05, &addr.st, &addrlen) != STUN_MESSAGE_RETURN_INVALID) fatal ("Too big IPv4 address test failed"); addrlen = sizeof (addr); - if (stun_message_find_xor_addr (&msg, 0xff06, &addr.sa, &addrlen) != + if (stun_message_find_xor_addr (&msg, 0xff06, &addr.st, &addrlen) != STUN_MESSAGE_RETURN_SUCCESS || memcmp (&addr.s6.sin6_addr, "\x20\x01\x0d\xb8""\xde\xad\xbe\xef" "\xde\xfa\xce\xd0""\xfa\xce\xde\xed", 16)) @@ -451,9 +451,9 @@ } static const char vector_username[] = "evtj:h6vY"; -static const char vector_password[] = "VOkJxbRl1RmTxUk/WvJxBt"; +static uint8_t vector_password[] = "VOkJxbRl1RmTxUk/WvJxBt"; -bool test_vector_validater (StunAgent *agent, +static bool test_vector_validater (StunAgent *agent, StunMessage *message, uint8_t *username, uint16_t username_len, uint8_t **password, size_t *password_len, void *user_data) { @@ -466,8 +466,8 @@ memcmp (username, vector_username, strlen (vector_username)) != 0) fatal ("vector test : Validater received wrong username!"); - *password = (uint8_t *) vector_password; - *password_len = strlen (vector_password); + *password = vector_password; + *password_len = strlen ((char *) vector_password); return true; @@ -598,8 +598,11 @@ 0x80, 0x28, 0x00, 0x04, // FINGERPRINT 0xec, 0x27, 0xae, 0xb7}; - struct sockaddr_in ip4; - struct sockaddr_in6 ip6; + union { + struct sockaddr_storage st; + struct sockaddr_in ip4; + struct sockaddr_in6 ip6; + } addr; socklen_t addrlen; StunAgent agent; @@ -616,8 +619,7 @@ STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS | STUN_AGENT_USAGE_USE_FINGERPRINT); - memset (&ip4, 0, sizeof (ip4)); - memset (&ip6, 0, sizeof (ip6)); + memset (&addr, 0, sizeof (addr)); puts ("Checking test vectors..."); @@ -635,7 +637,8 @@ if (stun_message_length (&msg) != sizeof(req) - 32) fatal ("vector test: removing attributes failed"); - stun_agent_finish_message (&agent, &msg, vector_password, strlen (vector_password)); + stun_agent_finish_message (&agent, &msg, vector_password, + strlen ((char *) vector_password)); if (stun_message_length (&msg) != stun_message_length (&msg2) || memcmp (req, req2, sizeof(req)) != 0) @@ -649,15 +652,15 @@ test_vector_validater, (void *) 0) != STUN_VALIDATION_UNMATCHED_RESPONSE) fatal ("Response ipv4 test vector authentication failed"); - addrlen = sizeof (ip4); + addrlen = sizeof (addr.ip4); if (stun_message_find_xor_addr (&msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&ip4, &addrlen) != STUN_MESSAGE_RETURN_SUCCESS) + &addr.st, &addrlen) != STUN_MESSAGE_RETURN_SUCCESS) fatal ("Response test vector IPv4 extraction failed"); - if (ip4.sin_family != AF_INET) + if (addr.ip4.sin_family != AF_INET) fatal ("Response test vector IPv4 family failed"); - if (ntohl (ip4.sin_addr.s_addr) != 0xC0000201) + if (ntohl (addr.ip4.sin_addr.s_addr) != 0xC0000201) fatal ("Response test vector IPv4 address failed"); - if (ntohs (ip4.sin_port) != 32853) + if (ntohs (addr.ip4.sin_port) != 32853) fatal ("Response test vector IPv6 port failed"); if (stun_agent_validate (&agent, &msg, req, sizeof(req), @@ -682,16 +685,16 @@ test_vector_validater, (void *) 1) != STUN_VALIDATION_SUCCESS) fatal ("Response ipv6 test vector authentication failed"); - addrlen = sizeof (ip6); + addrlen = sizeof (addr.ip6); if (stun_message_find_xor_addr (&msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&ip6, &addrlen) != STUN_MESSAGE_RETURN_SUCCESS) + &addr.st, &addrlen) != STUN_MESSAGE_RETURN_SUCCESS) fatal ("Response test vector IPv6 extraction failed"); - if (ip6.sin6_family != AF_INET6) + if (addr.ip6.sin6_family != AF_INET6) fatal ("Response test vector IPv6 family failed"); - if (memcmp (ip6.sin6_addr.s6_addr, "\x20\x01\x0d\xb8\x12\x34\x56\x78" + if (memcmp (addr.ip6.sin6_addr.s6_addr, "\x20\x01\x0d\xb8\x12\x34\x56\x78" "\x00\x11\x22\x33\x44\x55\x66\x77", 16) != 0) fatal ("Response test vector IPv6 address failed"); - if (ntohs (ip6.sin6_port) != 32853) + if (ntohs (addr.ip6.sin6_port) != 32853) fatal ("Response test vector IPv6 port failed"); @@ -710,9 +713,9 @@ puts ("Testing long term credentials hash algorithm..."); - stun_hash_creds ("realm", strlen ("realm"), - "user", strlen ("user"), - "pass", strlen ("pass"), md5); + stun_hash_creds ((uint8_t *) "realm", strlen ("realm"), + (uint8_t *) "user", strlen ("user"), + (uint8_t *) "pass", strlen ("pass"), md5); stun_debug ("key for user:realm:pass is : "); stun_debug_bytes (md5, 16); diff -Nru libnice-0.1.4/stun/tools/Makefile.am libnice-0.1.7/stun/tools/Makefile.am --- libnice-0.1.4/stun/tools/Makefile.am 2011-11-30 01:57:42.000000000 +0000 +++ libnice-0.1.7/stun/tools/Makefile.am 2014-01-06 23:05:13.000000000 +0000 @@ -8,7 +8,7 @@ # include $(top_srcdir)/common.mk -AM_CFLAGS = -std=gnu99 $(ERROR_CFLAGS) +AM_CFLAGS = -std=gnu99 $(LIBNICE_CFLAGS) AM_CPPFLAGS = -I$(top_srcdir) bin_PROGRAMS = stunbdc stund diff -Nru libnice-0.1.4/stun/tools/Makefile.in libnice-0.1.7/stun/tools/Makefile.in --- libnice-0.1.4/stun/tools/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/stun/tools/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -25,23 +24,51 @@ # VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ esac; \ - test $$am__dry = yes; \ - } + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -60,15 +87,16 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/common.mk +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(top_srcdir)/depcomp bin_PROGRAMS = stunbdc$(EXEEXT) stund$(EXEEXT) check_PROGRAMS = stund$(EXEEXT) @WINDOWS_TRUE@am__append_1 = -DWINVER=0x0501 # _WIN32_WINNT_WINXP @WINDOWS_TRUE@am__append_2 = -lws2_32 subdir = stun/tools ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -85,9 +113,22 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = am_stund_OBJECTS = stund.$(OBJEXT) stund_OBJECTS = $(am_stund_OBJECTS) stund_DEPENDENCIES = $(top_builddir)/stun/libstun.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -100,20 +141,16 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = $(stunbdc_SOURCES) $(stund_SOURCES) DIST_SOURCES = $(stunbdc_SOURCES) $(stund_SOURCES) am__can_run_installinfo = \ @@ -121,6 +158,23 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -267,25 +321,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda -AM_CFLAGS = -std=gnu99 $(ERROR_CFLAGS) $(am__append_1) +AM_CFLAGS = -std=gnu99 $(LIBNICE_CFLAGS) $(am__append_1) AM_CPPFLAGS = -I$(top_srcdir) stund_SOURCES = stund.c stund.h stund_LDADD = $(top_builddir)/stun/libstun.la @@ -335,10 +372,12 @@ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -359,7 +398,8 @@ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ + -e 's/$$/$(EXEEXT)/' \ + `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files @@ -381,9 +421,11 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list + stunbdc$(EXEEXT): $(stunbdc_OBJECTS) $(stunbdc_DEPENDENCIES) $(EXTRA_stunbdc_DEPENDENCIES) @rm -f stunbdc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stunbdc_OBJECTS) $(stunbdc_LDADD) $(LIBS) + stund$(EXEEXT): $(stund_OBJECTS) $(stund_DEPENDENCIES) $(EXTRA_stund_DEPENDENCIES) @rm -f stund$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stund_OBJECTS) $(stund_LDADD) $(LIBS) @@ -424,26 +466,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -455,15 +486,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -472,6 +499,21 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -618,19 +660,20 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS check-valgrind: diff -Nru libnice-0.1.4/stun/tools/stunbdc.c libnice-0.1.7/stun/tools/stunbdc.c --- libnice-0.1.4/stun/tools/stunbdc.c 2011-11-30 01:57:42.000000000 +0000 +++ libnice-0.1.7/stun/tools/stunbdc.c 2014-03-31 22:41:13.000000000 +0000 @@ -99,19 +99,22 @@ for (ptr = res; ptr != NULL; ptr = ptr->ai_next) { - struct sockaddr_storage addr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } addr; socklen_t addrlen = sizeof (addr); StunUsageBindReturn val; printaddr ("Server address", ptr->ai_addr, ptr->ai_addrlen); - val = stun_usage_bind_run (ptr->ai_addr, ptr->ai_addrlen, - (struct sockaddr *)&addr, &addrlen); + val = stun_usage_bind_run (ptr->ai_addr, ptr->ai_addrlen, &addr.storage, + &addrlen); if (val) fprintf (stderr, "%d\n", val); else { - printaddr ("Mapped address", (struct sockaddr *)&addr, addrlen); + printaddr ("Mapped address", &addr.addr, addrlen); ret = 0; } } diff -Nru libnice-0.1.4/stun/tools/stund.c libnice-0.1.7/stun/tools/stund.c --- libnice-0.1.4/stun/tools/stund.c 2012-03-23 19:21:37.000000000 +0000 +++ libnice-0.1.7/stun/tools/stund.c 2014-05-02 21:46:00.000000000 +0000 @@ -46,6 +46,7 @@ #ifndef _WIN32 +#include #include #include #include @@ -125,9 +126,12 @@ #endif addr.in6.sin6_port = htons (port); break; + + default: + assert (0); /* should never be reached */ } - if (bind (fd, (struct sockaddr *)&addr, sizeof (struct sockaddr))) + if (bind (fd, &addr.addr, sizeof (struct sockaddr))) { perror ("Error opening IP port"); goto error; @@ -148,6 +152,9 @@ setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &yes, sizeof (yes)); #endif break; + + default: + assert (0); /* should never be reached */ } } else @@ -168,7 +175,10 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent) { - struct sockaddr_storage addr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } addr; socklen_t addr_len; uint8_t buf[STUN_MAX_MESSAGE_SIZE]; size_t buf_len = 0; @@ -179,8 +189,7 @@ StunAgent *agent = NULL; addr_len = sizeof (struct sockaddr_in); - len = recvfrom (sock, buf, sizeof(buf), 0, - (struct sockaddr *)&addr, &addr_len); + len = recvfrom (sock, buf, sizeof(buf), 0, &addr.addr, &addr_len); if (len == (size_t)-1) return -1; @@ -214,13 +223,20 @@ stun_agent_init_response (agent, &response, buf, sizeof (buf), &request); if (stun_message_has_cookie (&request)) stun_message_append_xor_addr (&response, - STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addr_len); + STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, &addr.storage, addr_len); else stun_message_append_addr (&response, STUN_ATTRIBUTE_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addr_len); + &addr.addr, addr_len); break; + case STUN_SHARED_SECRET: + case STUN_ALLOCATE: + case STUN_SEND: + case STUN_CONNECT: + case STUN_IND_SEND: + case STUN_IND_DATA: + case STUN_CREATEPERMISSION: + case STUN_CHANNELBIND: default: if (!stun_agent_init_error (agent, &response, buf, sizeof (buf), &request, STUN_ERROR_BAD_REQUEST)) @@ -229,8 +245,7 @@ buf_len = stun_agent_finish_message (agent, &response, NULL, 0); send_buf: - len = sendto (sock, buf, buf_len, 0, - (struct sockaddr *)&addr, addr_len); + len = sendto (sock, buf, buf_len, 0, &addr.addr, addr_len); return (len < buf_len) ? -1 : 0; } @@ -275,6 +290,7 @@ switch (c) { + default: case '4': family = AF_INET; break; diff -Nru libnice-0.1.4/stun/usages/bind.c libnice-0.1.7/stun/usages/bind.c --- libnice-0.1.4/stun/usages/bind.c 2012-02-24 01:06:05.000000000 +0000 +++ libnice-0.1.7/stun/usages/bind.c 2014-04-16 03:16:34.000000000 +0000 @@ -126,7 +126,7 @@ if ((code / 100) == 3) { if (alternate_server && alternate_server_len) { if (stun_message_find_addr (msg, STUN_ATTRIBUTE_ALTERNATE_SERVER, - alternate_server, + (struct sockaddr_storage *) alternate_server, alternate_server_len) != STUN_MESSAGE_RETURN_SUCCESS) { stun_debug (" Unexpectedly missing ALTERNATE-SERVER attribute\n"); return STUN_USAGE_BIND_RETURN_ERROR; @@ -143,17 +143,23 @@ } return STUN_USAGE_BIND_RETURN_ERROR; + + default: + /* Fall through. */ + break; } stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg)); val = stun_message_find_xor_addr (msg, - STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, addr, addrlen); + STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, (struct sockaddr_storage *)addr, + addrlen); if (val != STUN_MESSAGE_RETURN_SUCCESS) { stun_debug (" No XOR-MAPPED-ADDRESS: %d\n", val); val = stun_message_find_addr (msg, - STUN_ATTRIBUTE_MAPPED_ADDRESS, addr, addrlen); + STUN_ATTRIBUTE_MAPPED_ADDRESS, (struct sockaddr_storage *)addr, + addrlen); if (val != STUN_MESSAGE_RETURN_SUCCESS) { stun_debug (" No MAPPED-ADDRESS: %d\n", val); @@ -257,6 +263,9 @@ case AF_INET6: setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &yes, sizeof (yes)); break; + default: + /* Nothing to do. */ + break; } } #endif @@ -348,7 +357,7 @@ static ssize_t stun_trans_sendto (StunTransport *tr, const uint8_t *buf, size_t len, - const struct sockaddr *dst, socklen_t dstlen) + const struct sockaddr *dst, socklen_t dstlen) { static const int flags = MSG_DONTWAIT | MSG_NOSIGNAL; ssize_t val; @@ -368,14 +377,15 @@ static ssize_t stun_trans_recvfrom (StunTransport *tr, uint8_t *buf, size_t maxlen, - struct sockaddr * dst, + struct sockaddr_storage * dst, socklen_t * dstlen) { static const int flags = MSG_DONTWAIT | MSG_NOSIGNAL; ssize_t val; if (dstlen != NULL) - val = recvfrom (tr->fd, (void *)buf, maxlen, flags, dst, dstlen); + val = recvfrom (tr->fd, (void *)buf, maxlen, flags, (struct sockaddr *) dst, + dstlen); else val = recv (tr->fd, (void *)buf, maxlen, flags); @@ -389,8 +399,11 @@ static ssize_t stun_trans_send (StunTransport *tr, const uint8_t *buf, size_t len) { - return stun_trans_sendto (tr, buf, len, - (struct sockaddr *)&tr->dst, tr->dstlen); + struct sockaddr *conv; + + conv = (struct sockaddr *) &tr->dst; + + return stun_trans_sendto (tr, buf, len, conv, tr->dstlen); } static ssize_t @@ -441,7 +454,7 @@ /** Blocking mode STUN binding discovery */ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv, - socklen_t srvlen, struct sockaddr *addr, socklen_t *addrlen) + socklen_t srvlen, struct sockaddr_storage *addr, socklen_t *addrlen) { StunTimer timer; StunTransport trans; @@ -500,6 +513,8 @@ } continue; case STUN_USAGE_TIMER_RETURN_SUCCESS: + default: + /* Fall through. */ break; } } @@ -516,8 +531,8 @@ if (valid != STUN_VALIDATION_SUCCESS) { ret = STUN_USAGE_TRANS_RETURN_RETRY; } else { - bind_ret = stun_usage_bind_process (&msg, addr, addrlen, - (struct sockaddr *) &alternate_server, &alternate_server_len); + bind_ret = stun_usage_bind_process (&msg, (struct sockaddr *) addr, + addrlen, (struct sockaddr *) &alternate_server, &alternate_server_len); if (bind_ret == STUN_USAGE_BIND_RETURN_ALTERNATE_SERVER) { stun_trans_deinit (&trans); diff -Nru libnice-0.1.4/stun/usages/bind.h libnice-0.1.7/stun/usages/bind.h --- libnice-0.1.4/stun/usages/bind.h 2011-11-30 01:57:42.000000000 +0000 +++ libnice-0.1.7/stun/usages/bind.h 2014-04-16 03:14:38.000000000 +0000 @@ -156,7 +156,7 @@ * #STUN_USAGE_BIND_RETURN_ERROR and #STUN_USAGE_BIND_RETURN_TIMEOUT */ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv, - socklen_t srvlen, struct sockaddr *addr, socklen_t *addrlen); + socklen_t srvlen, struct sockaddr_storage *addr, socklen_t *addrlen); # ifdef __cplusplus } diff -Nru libnice-0.1.4/stun/usages/ice.c libnice-0.1.7/stun/usages/ice.c --- libnice-0.1.4/stun/usages/ice.c 2012-04-03 20:10:10.000000000 +0000 +++ libnice-0.1.7/stun/usages/ice.c 2014-05-02 21:45:34.000000000 +0000 @@ -130,7 +130,7 @@ StunUsageIceReturn stun_usage_ice_conncheck_process (StunMessage *msg, - struct sockaddr *addr, socklen_t *addrlen, + struct sockaddr_storage *addr, socklen_t *addrlen, StunUsageIceCompatibility compatibility) { int code = -1; @@ -149,6 +149,7 @@ break; case STUN_ERROR: + default: if (stun_message_find_error (msg, &code) != STUN_MESSAGE_RETURN_SUCCESS) { /* missing ERROR-CODE: ignore message */ return STUN_USAGE_ICE_RETURN_INVALID; @@ -167,10 +168,13 @@ stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg)); if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_MSN) { - StunTransactionId transid; + union { + StunTransactionId u8; + uint32_t u32[STUN_MESSAGE_TRANS_ID_LEN / 4]; + } transid; uint32_t magic_cookie; - stun_message_id (msg, transid); - magic_cookie = *((uint32_t *) transid); + stun_message_id (msg, transid.u8); + magic_cookie = *(transid.u32); val = stun_message_find_xor_addr_full (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, addr, addrlen, htonl (magic_cookie)); @@ -222,7 +226,7 @@ StunUsageIceReturn stun_usage_ice_conncheck_create_reply (StunAgent *agent, StunMessage *req, StunMessage *msg, uint8_t *buf, size_t *plen, - const struct sockaddr *src, socklen_t srclen, + const struct sockaddr_storage *src, socklen_t srclen, bool *control, uint64_t tie, StunUsageIceCompatibility compatibility) { @@ -286,20 +290,22 @@ goto failure; } if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_MSN) { - StunTransactionId transid; - uint32_t magic_cookie; - stun_message_id (msg, transid); - magic_cookie = *((uint32_t *) transid); + union { + StunTransactionId transid; + uint32_t magic_cookie; + } conv; + + stun_message_id (msg, conv.transid); val = stun_message_append_xor_addr_full (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - src, srclen, htonl (magic_cookie)); + src, srclen, htonl (conv.magic_cookie)); } else if (stun_message_has_cookie (msg) && compatibility != STUN_USAGE_ICE_COMPATIBILITY_GOOGLE) { val = stun_message_append_xor_addr (msg, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, src, srclen); } else { val = stun_message_append_addr (msg, STUN_ATTRIBUTE_MAPPED_ADDRESS, - src, srclen); + (struct sockaddr *) src, srclen); } if (val != STUN_MESSAGE_RETURN_SUCCESS) { @@ -341,6 +347,9 @@ case STUN_MESSAGE_RETURN_INVALID: case STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS: return STUN_USAGE_ICE_RETURN_INVALID_ADDRESS; + case STUN_MESSAGE_RETURN_SUCCESS: + assert (0); /* shouldn’t be reached */ + case STUN_MESSAGE_RETURN_NOT_FOUND: default: return STUN_USAGE_ICE_RETURN_ERROR; } diff -Nru libnice-0.1.4/stun/usages/ice.h libnice-0.1.7/stun/usages/ice.h --- libnice-0.1.4/stun/usages/ice.h 2011-02-02 04:50:08.000000000 +0000 +++ libnice-0.1.7/stun/usages/ice.h 2014-03-31 22:41:13.000000000 +0000 @@ -171,7 +171,7 @@ * Returns: A #StunUsageIceReturn value */ StunUsageIceReturn stun_usage_ice_conncheck_process (StunMessage *msg, - struct sockaddr *addr, socklen_t *addrlen, + struct sockaddr_storage *addr, socklen_t *addrlen, StunUsageIceCompatibility compatibility); /** @@ -207,7 +207,7 @@ StunUsageIceReturn stun_usage_ice_conncheck_create_reply (StunAgent *agent, StunMessage *req, StunMessage *msg, uint8_t *buf, size_t *plen, - const struct sockaddr *src, socklen_t srclen, + const struct sockaddr_storage *src, socklen_t srclen, bool *control, uint64_t tie, StunUsageIceCompatibility compatibility); diff -Nru libnice-0.1.4/stun/usages/timer.c libnice-0.1.7/stun/usages/timer.c --- libnice-0.1.4/stun/usages/timer.c 2012-02-17 23:46:37.000000000 +0000 +++ libnice-0.1.7/stun/usages/timer.c 2014-01-06 23:05:13.000000000 +0000 @@ -88,9 +88,9 @@ static void add_delay (struct timeval *ts, unsigned delay) { - div_t d = div (delay, 1000); - ts->tv_sec += d.quot; - ts->tv_usec += d.rem * 1000; + /* Delay is in ms. */ + ts->tv_sec += delay / 1000; + ts->tv_usec += (delay % 1000) * 1000; while (ts->tv_usec > 1000000) { diff -Nru libnice-0.1.4/stun/usages/turn.c libnice-0.1.7/stun/usages/turn.c --- libnice-0.1.4/stun/usages/turn.c 2011-02-02 04:50:08.000000000 +0000 +++ libnice-0.1.7/stun/usages/turn.c 2014-03-31 22:41:13.000000000 +0000 @@ -221,7 +221,7 @@ uint8_t *password, size_t password_len, uint8_t *realm, size_t realm_len, uint8_t *nonce, size_t nonce_len, - struct sockaddr *peer, + struct sockaddr_storage *peer, StunUsageTurnCompatibility compatibility) { if (!peer) @@ -262,9 +262,9 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg, - struct sockaddr *relay_addr, socklen_t *relay_addrlen, - struct sockaddr *addr, socklen_t *addrlen, - struct sockaddr *alternate_server, socklen_t *alternate_server_len, + struct sockaddr_storage *relay_addr, socklen_t *relay_addrlen, + struct sockaddr_storage *addr, socklen_t *addrlen, + struct sockaddr_storage *alternate_server, socklen_t *alternate_server_len, uint32_t *bandwidth, uint32_t *lifetime, StunUsageTurnCompatibility compatibility) { @@ -315,6 +315,10 @@ } return STUN_USAGE_TURN_RETURN_ERROR; + + default: + /* Fall through. */ + break; } stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg)); @@ -396,6 +400,10 @@ } return STUN_USAGE_TURN_RETURN_ERROR; + + default: + /* Fall through. */ + break; } stun_message_find32 (msg, STUN_ATTRIBUTE_LIFETIME, lifetime); diff -Nru libnice-0.1.4/stun/usages/turn.h libnice-0.1.7/stun/usages/turn.h --- libnice-0.1.4/stun/usages/turn.h 2011-11-30 01:57:42.000000000 +0000 +++ libnice-0.1.7/stun/usages/turn.h 2014-03-31 22:41:13.000000000 +0000 @@ -212,7 +212,7 @@ uint8_t *password, size_t password_len, uint8_t *realm, size_t realm_len, uint8_t *nonce, size_t nonce_len, - struct sockaddr *peer, + struct sockaddr_storage *peer, StunUsageTurnCompatibility compatibility); /** @@ -242,9 +242,9 @@ * Returns: A #StunUsageTurnReturn value */ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg, - struct sockaddr *relay_addr, socklen_t *relay_addrlen, - struct sockaddr *addr, socklen_t *addrlen, - struct sockaddr *alternate_server, socklen_t *alternate_server_len, + struct sockaddr_storage *relay_addr, socklen_t *relay_addrlen, + struct sockaddr_storage *addr, socklen_t *addrlen, + struct sockaddr_storage *alternate_server, socklen_t *alternate_server_len, uint32_t *bandwidth, uint32_t *lifetime, StunUsageTurnCompatibility compatibility); diff -Nru libnice-0.1.4/stun/utils.c libnice-0.1.7/stun/utils.c --- libnice-0.1.4/stun/utils.c 2011-02-02 04:49:42.000000000 +0000 +++ libnice-0.1.7/stun/utils.c 2014-03-31 22:41:13.000000000 +0000 @@ -88,14 +88,22 @@ StunMessageReturn stun_xor_address (const StunMessage *msg, - struct sockaddr *addr, socklen_t addrlen, + struct sockaddr_storage *addr, socklen_t addrlen, uint32_t magic_cookie) { - switch (addr->sa_family) + union { + struct sockaddr_storage *addr; + struct sockaddr_in *in; + struct sockaddr_in6 *in6; + } addr_ptr; + + addr_ptr.addr = addr; + + switch (addr->ss_family) { case AF_INET: { - struct sockaddr_in *ip4 = (struct sockaddr_in *)addr; + struct sockaddr_in *ip4 = addr_ptr.in; if ((size_t) addrlen < sizeof (*ip4)) return STUN_MESSAGE_RETURN_INVALID; @@ -106,7 +114,7 @@ case AF_INET6: { - struct sockaddr_in6 *ip6 = (struct sockaddr_in6 *)addr; + struct sockaddr_in6 *ip6 = addr_ptr.in6; unsigned short i; if ((size_t) addrlen < sizeof (*ip6)) @@ -117,6 +125,8 @@ ip6->sin6_addr.s6_addr[i] ^= msg->buffer[4 + i]; return STUN_MESSAGE_RETURN_SUCCESS; } + + default: + return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; } - return STUN_MESSAGE_RETURN_UNSUPPORTED_ADDRESS; } diff -Nru libnice-0.1.4/stun/utils.h libnice-0.1.7/stun/utils.h --- libnice-0.1.4/stun/utils.h 2011-02-02 04:49:42.000000000 +0000 +++ libnice-0.1.7/stun/utils.h 2014-03-31 22:41:13.000000000 +0000 @@ -68,7 +68,7 @@ void stun_set_type (uint8_t *h, StunClass c, StunMethod m); StunMessageReturn stun_xor_address (const StunMessage *msg, - struct sockaddr *addr, socklen_t addrlen, + struct sockaddr_storage *addr, socklen_t addrlen, uint32_t magic_cookie); diff -Nru libnice-0.1.4/stun/win32_common.h libnice-0.1.7/stun/win32_common.h --- libnice-0.1.4/stun/win32_common.h 2012-02-15 20:51:46.000000000 +0000 +++ libnice-0.1.7/stun/win32_common.h 2014-04-04 03:53:01.000000000 +0000 @@ -57,6 +57,7 @@ #ifndef _WIN32_COMMON_H #define _WIN32_COMMON_H +#include "config.h" #include /* 7.18.1.1 Exact-width integer types */ @@ -69,8 +70,10 @@ typedef long long int64_t; typedef unsigned long long uint64_t; -#ifndef _SSIZE_T_ +#ifndef HAVE_SIZE_T typedef unsigned int size_t; +#endif +#ifndef HAVE_SSIZE_T typedef unsigned long ssize_t; #endif diff -Nru libnice-0.1.4/test-driver libnice-0.1.7/test-driver --- libnice-0.1.4/test-driver 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/test-driver 2013-08-05 10:10:38.000000000 +0000 @@ -0,0 +1,127 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2012-06-27.10; # UTC + +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <$log_file 2>&1 +estatus=$? +if test $enable_hard_errors = no && test $estatus -eq 99; then + estatus=1 +fi + +case $estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libnice-0.1.4/tests/Makefile.am libnice-0.1.7/tests/Makefile.am --- libnice-0.1.4/tests/Makefile.am 2012-09-12 18:33:35.000000000 +0000 +++ libnice-0.1.7/tests/Makefile.am 2014-04-17 22:14:51.000000000 +0000 @@ -9,7 +9,7 @@ include $(top_srcdir)/common.mk AM_CFLAGS = \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) \ -I $(top_srcdir) \ @@ -22,10 +22,18 @@ check_PROGRAMS = \ test-pseudotcp \ + test-pseudotcp-fuzzy \ test-bsd \ test \ test-address \ test-add-remove-stream \ + test-build-io-stream \ + test-io-stream-thread \ + test-io-stream-closing-write \ + test-io-stream-closing-read \ + test-io-stream-cancelling \ + test-io-stream-pollable \ + test-send-recv \ test-priority \ test-mainloop \ test-fullmode \ @@ -41,8 +49,12 @@ TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS) +noinst_HEADERS = test-io-stream-common.h + test_pseudotcp_LDADD = $(COMMON_LDADD) +test_pseudotcp_fuzzy_LDADD = $(COMMON_LDADD) -lm + test_bsd_LDADD = $(COMMON_LDADD) test_LDADD = $(COMMON_LDADD) @@ -53,6 +65,26 @@ test_add_remove_stream_LDADD = $(COMMON_LDADD) +test_build_io_stream_LDADD = $(COMMON_LDADD) + +test_io_stream_thread_SOURCES = test-io-stream-thread.c test-io-stream-common.c +test_io_stream_thread_LDADD = $(COMMON_LDADD) + +test_io_stream_closing_write_SOURCES = test-io-stream-closing-write.c test-io-stream-common.c +test_io_stream_closing_write_LDADD = $(COMMON_LDADD) + +test_io_stream_closing_read_SOURCES = test-io-stream-closing-read.c test-io-stream-common.c +test_io_stream_closing_read_LDADD = $(COMMON_LDADD) + +test_io_stream_cancelling_SOURCES = test-io-stream-cancelling.c test-io-stream-common.c +test_io_stream_cancelling_LDADD = $(COMMON_LDADD) + +test_io_stream_pollable_SOURCES = test-io-stream-pollable.c test-io-stream-common.c +test_io_stream_pollable_LDADD = $(COMMON_LDADD) + +test_send_recv_SOURCES = test-send-recv.c test-io-stream-common.c +test_send_recv_LDADD = $(COMMON_LDADD) + test_priority_LDADD = $(COMMON_LDADD) test_mainloop_LDADD = $(COMMON_LDADD) diff -Nru libnice-0.1.4/tests/Makefile.in libnice-0.1.7/tests/Makefile.in --- libnice-0.1.4/tests/Makefile.in 2013-02-23 00:29:35.000000000 +0000 +++ libnice-0.1.7/tests/Makefile.in 2014-05-05 18:58:20.000000000 +0000 @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -22,24 +21,53 @@ # (C) 2006, 2007 Nokia Corporation. All rights reserved. # # Licensed under MPL 1.1/LGPL 2.1. See file COPYING. + VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ - test $$am__dry = yes; \ - } + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ @@ -58,18 +86,26 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(dist_check_SCRIPTS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/common.mk -check_PROGRAMS = test-pseudotcp$(EXEEXT) test-bsd$(EXEEXT) \ - test$(EXEEXT) test-address$(EXEEXT) \ - test-add-remove-stream$(EXEEXT) test-priority$(EXEEXT) \ - test-mainloop$(EXEEXT) test-fullmode$(EXEEXT) \ - test-restart$(EXEEXT) test-fallback$(EXEEXT) \ - test-thread$(EXEEXT) test-dribble$(EXEEXT) \ - test-new-dribble$(EXEEXT) +DIST_COMMON = $(top_srcdir)/common.mk $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am $(dist_check_SCRIPTS) \ + $(top_srcdir)/depcomp $(noinst_HEADERS) \ + $(top_srcdir)/test-driver +check_PROGRAMS = test-pseudotcp$(EXEEXT) test-pseudotcp-fuzzy$(EXEEXT) \ + test-bsd$(EXEEXT) test$(EXEEXT) test-address$(EXEEXT) \ + test-add-remove-stream$(EXEEXT) test-build-io-stream$(EXEEXT) \ + test-io-stream-thread$(EXEEXT) \ + test-io-stream-closing-write$(EXEEXT) \ + test-io-stream-closing-read$(EXEEXT) \ + test-io-stream-cancelling$(EXEEXT) \ + test-io-stream-pollable$(EXEEXT) test-send-recv$(EXEEXT) \ + test-priority$(EXEEXT) test-mainloop$(EXEEXT) \ + test-fullmode$(EXEEXT) test-restart$(EXEEXT) \ + test-fallback$(EXEEXT) test-thread$(EXEEXT) \ + test-dribble$(EXEEXT) test-new-dribble$(EXEEXT) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/as-compiler-flag.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -86,6 +122,7 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent +am__v_lt_1 = test_add_remove_stream_SOURCES = test-add-remove-stream.c test_add_remove_stream_OBJECTS = test-add-remove-stream.$(OBJEXT) test_add_remove_stream_DEPENDENCIES = $(am__DEPENDENCIES_2) @@ -95,6 +132,9 @@ test_bsd_SOURCES = test-bsd.c test_bsd_OBJECTS = test-bsd.$(OBJEXT) test_bsd_DEPENDENCIES = $(am__DEPENDENCIES_2) +test_build_io_stream_SOURCES = test-build-io-stream.c +test_build_io_stream_OBJECTS = test-build-io-stream.$(OBJEXT) +test_build_io_stream_DEPENDENCIES = $(am__DEPENDENCIES_2) test_dribble_SOURCES = test-dribble.c test_dribble_OBJECTS = test-dribble.$(OBJEXT) test_dribble_DEPENDENCIES = $(am__DEPENDENCIES_2) @@ -104,6 +144,34 @@ test_fullmode_SOURCES = test-fullmode.c test_fullmode_OBJECTS = test-fullmode.$(OBJEXT) test_fullmode_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_io_stream_cancelling_OBJECTS = \ + test-io-stream-cancelling.$(OBJEXT) \ + test-io-stream-common.$(OBJEXT) +test_io_stream_cancelling_OBJECTS = \ + $(am_test_io_stream_cancelling_OBJECTS) +test_io_stream_cancelling_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_io_stream_closing_read_OBJECTS = \ + test-io-stream-closing-read.$(OBJEXT) \ + test-io-stream-common.$(OBJEXT) +test_io_stream_closing_read_OBJECTS = \ + $(am_test_io_stream_closing_read_OBJECTS) +test_io_stream_closing_read_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_io_stream_closing_write_OBJECTS = \ + test-io-stream-closing-write.$(OBJEXT) \ + test-io-stream-common.$(OBJEXT) +test_io_stream_closing_write_OBJECTS = \ + $(am_test_io_stream_closing_write_OBJECTS) +test_io_stream_closing_write_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_io_stream_pollable_OBJECTS = \ + test-io-stream-pollable.$(OBJEXT) \ + test-io-stream-common.$(OBJEXT) +test_io_stream_pollable_OBJECTS = \ + $(am_test_io_stream_pollable_OBJECTS) +test_io_stream_pollable_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_io_stream_thread_OBJECTS = test-io-stream-thread.$(OBJEXT) \ + test-io-stream-common.$(OBJEXT) +test_io_stream_thread_OBJECTS = $(am_test_io_stream_thread_OBJECTS) +test_io_stream_thread_DEPENDENCIES = $(am__DEPENDENCIES_2) test_mainloop_SOURCES = test-mainloop.c test_mainloop_OBJECTS = test-mainloop.$(OBJEXT) test_mainloop_DEPENDENCIES = $(am__DEPENDENCIES_2) @@ -116,12 +184,31 @@ test_pseudotcp_SOURCES = test-pseudotcp.c test_pseudotcp_OBJECTS = test-pseudotcp.$(OBJEXT) test_pseudotcp_DEPENDENCIES = $(am__DEPENDENCIES_2) +test_pseudotcp_fuzzy_SOURCES = test-pseudotcp-fuzzy.c +test_pseudotcp_fuzzy_OBJECTS = test-pseudotcp-fuzzy.$(OBJEXT) +test_pseudotcp_fuzzy_DEPENDENCIES = $(am__DEPENDENCIES_2) test_restart_SOURCES = test-restart.c test_restart_OBJECTS = test-restart.$(OBJEXT) test_restart_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_test_send_recv_OBJECTS = test-send-recv.$(OBJEXT) \ + test-io-stream-common.$(OBJEXT) +test_send_recv_OBJECTS = $(am_test_send_recv_OBJECTS) +test_send_recv_DEPENDENCIES = $(am__DEPENDENCIES_2) test_thread_SOURCES = test-thread.c test_thread_OBJECTS = test-thread.$(OBJEXT) test_thread_DEPENDENCIES = $(am__DEPENDENCIES_2) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -134,37 +221,266 @@ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = SOURCES = test.c test-add-remove-stream.c test-address.c test-bsd.c \ - test-dribble.c test-fallback.c test-fullmode.c test-mainloop.c \ + test-build-io-stream.c test-dribble.c test-fallback.c \ + test-fullmode.c $(test_io_stream_cancelling_SOURCES) \ + $(test_io_stream_closing_read_SOURCES) \ + $(test_io_stream_closing_write_SOURCES) \ + $(test_io_stream_pollable_SOURCES) \ + $(test_io_stream_thread_SOURCES) test-mainloop.c \ test-new-dribble.c test-priority.c test-pseudotcp.c \ - test-restart.c test-thread.c + test-pseudotcp-fuzzy.c test-restart.c \ + $(test_send_recv_SOURCES) test-thread.c DIST_SOURCES = test.c test-add-remove-stream.c test-address.c \ - test-bsd.c test-dribble.c test-fallback.c test-fullmode.c \ - test-mainloop.c test-new-dribble.c test-priority.c \ - test-pseudotcp.c test-restart.c test-thread.c + test-bsd.c test-build-io-stream.c test-dribble.c \ + test-fallback.c test-fullmode.c \ + $(test_io_stream_cancelling_SOURCES) \ + $(test_io_stream_closing_read_SOURCES) \ + $(test_io_stream_closing_write_SOURCES) \ + $(test_io_stream_pollable_SOURCES) \ + $(test_io_stream_thread_SOURCES) test-mainloop.c \ + test-new-dribble.c test-priority.c test-pseudotcp.c \ + test-pseudotcp-fuzzy.c test-restart.c \ + $(test_send_recv_SOURCES) test-thread.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgincludedir = $(includedir)/nice ACLOCAL = @ACLOCAL@ @@ -309,26 +625,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ERROR_CFLAGS = \ - $(LIBNICE_CFLAGS) \ - -fno-strict-aliasing \ - -Wextra \ - -Wundef \ - -Wnested-externs \ - -Wwrite-strings \ - -Wpointer-arith \ - -Wbad-function-cast \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-prototypes \ - -Wredundant-decls \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers - -# -Wold-style-definition -Winline -Wunreachable-code CLEANFILES = *.gcno *.gcda AM_CFLAGS = \ - $(ERROR_CFLAGS) \ + $(LIBNICE_CFLAGS) \ $(GLIB_CFLAGS) \ $(GUPNP_CFLAGS) \ -I $(top_srcdir) \ @@ -343,12 +642,27 @@ test-pseudotcp-random.sh TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS) +noinst_HEADERS = test-io-stream-common.h test_pseudotcp_LDADD = $(COMMON_LDADD) +test_pseudotcp_fuzzy_LDADD = $(COMMON_LDADD) -lm test_bsd_LDADD = $(COMMON_LDADD) test_LDADD = $(COMMON_LDADD) test_thread_LDADD = $(COMMON_LDADD) test_address_LDADD = $(COMMON_LDADD) test_add_remove_stream_LDADD = $(COMMON_LDADD) +test_build_io_stream_LDADD = $(COMMON_LDADD) +test_io_stream_thread_SOURCES = test-io-stream-thread.c test-io-stream-common.c +test_io_stream_thread_LDADD = $(COMMON_LDADD) +test_io_stream_closing_write_SOURCES = test-io-stream-closing-write.c test-io-stream-common.c +test_io_stream_closing_write_LDADD = $(COMMON_LDADD) +test_io_stream_closing_read_SOURCES = test-io-stream-closing-read.c test-io-stream-common.c +test_io_stream_closing_read_LDADD = $(COMMON_LDADD) +test_io_stream_cancelling_SOURCES = test-io-stream-cancelling.c test-io-stream-common.c +test_io_stream_cancelling_LDADD = $(COMMON_LDADD) +test_io_stream_pollable_SOURCES = test-io-stream-pollable.c test-io-stream-common.c +test_io_stream_pollable_LDADD = $(COMMON_LDADD) +test_send_recv_SOURCES = test-send-recv.c test-io-stream-common.c +test_send_recv_LDADD = $(COMMON_LDADD) test_priority_LDADD = $(COMMON_LDADD) test_mainloop_LDADD = $(COMMON_LDADD) test_fullmode_LDADD = $(COMMON_LDADD) @@ -359,7 +673,7 @@ all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -400,42 +714,87 @@ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list + test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) $(EXTRA_test_DEPENDENCIES) @rm -f test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_OBJECTS) $(test_LDADD) $(LIBS) + test-add-remove-stream$(EXEEXT): $(test_add_remove_stream_OBJECTS) $(test_add_remove_stream_DEPENDENCIES) $(EXTRA_test_add_remove_stream_DEPENDENCIES) @rm -f test-add-remove-stream$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_add_remove_stream_OBJECTS) $(test_add_remove_stream_LDADD) $(LIBS) + test-address$(EXEEXT): $(test_address_OBJECTS) $(test_address_DEPENDENCIES) $(EXTRA_test_address_DEPENDENCIES) @rm -f test-address$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_address_OBJECTS) $(test_address_LDADD) $(LIBS) + test-bsd$(EXEEXT): $(test_bsd_OBJECTS) $(test_bsd_DEPENDENCIES) $(EXTRA_test_bsd_DEPENDENCIES) @rm -f test-bsd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_bsd_OBJECTS) $(test_bsd_LDADD) $(LIBS) + +test-build-io-stream$(EXEEXT): $(test_build_io_stream_OBJECTS) $(test_build_io_stream_DEPENDENCIES) $(EXTRA_test_build_io_stream_DEPENDENCIES) + @rm -f test-build-io-stream$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_build_io_stream_OBJECTS) $(test_build_io_stream_LDADD) $(LIBS) + test-dribble$(EXEEXT): $(test_dribble_OBJECTS) $(test_dribble_DEPENDENCIES) $(EXTRA_test_dribble_DEPENDENCIES) @rm -f test-dribble$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_dribble_OBJECTS) $(test_dribble_LDADD) $(LIBS) + test-fallback$(EXEEXT): $(test_fallback_OBJECTS) $(test_fallback_DEPENDENCIES) $(EXTRA_test_fallback_DEPENDENCIES) @rm -f test-fallback$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fallback_OBJECTS) $(test_fallback_LDADD) $(LIBS) + test-fullmode$(EXEEXT): $(test_fullmode_OBJECTS) $(test_fullmode_DEPENDENCIES) $(EXTRA_test_fullmode_DEPENDENCIES) @rm -f test-fullmode$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_fullmode_OBJECTS) $(test_fullmode_LDADD) $(LIBS) + +test-io-stream-cancelling$(EXEEXT): $(test_io_stream_cancelling_OBJECTS) $(test_io_stream_cancelling_DEPENDENCIES) $(EXTRA_test_io_stream_cancelling_DEPENDENCIES) + @rm -f test-io-stream-cancelling$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_io_stream_cancelling_OBJECTS) $(test_io_stream_cancelling_LDADD) $(LIBS) + +test-io-stream-closing-read$(EXEEXT): $(test_io_stream_closing_read_OBJECTS) $(test_io_stream_closing_read_DEPENDENCIES) $(EXTRA_test_io_stream_closing_read_DEPENDENCIES) + @rm -f test-io-stream-closing-read$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_io_stream_closing_read_OBJECTS) $(test_io_stream_closing_read_LDADD) $(LIBS) + +test-io-stream-closing-write$(EXEEXT): $(test_io_stream_closing_write_OBJECTS) $(test_io_stream_closing_write_DEPENDENCIES) $(EXTRA_test_io_stream_closing_write_DEPENDENCIES) + @rm -f test-io-stream-closing-write$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_io_stream_closing_write_OBJECTS) $(test_io_stream_closing_write_LDADD) $(LIBS) + +test-io-stream-pollable$(EXEEXT): $(test_io_stream_pollable_OBJECTS) $(test_io_stream_pollable_DEPENDENCIES) $(EXTRA_test_io_stream_pollable_DEPENDENCIES) + @rm -f test-io-stream-pollable$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_io_stream_pollable_OBJECTS) $(test_io_stream_pollable_LDADD) $(LIBS) + +test-io-stream-thread$(EXEEXT): $(test_io_stream_thread_OBJECTS) $(test_io_stream_thread_DEPENDENCIES) $(EXTRA_test_io_stream_thread_DEPENDENCIES) + @rm -f test-io-stream-thread$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_io_stream_thread_OBJECTS) $(test_io_stream_thread_LDADD) $(LIBS) + test-mainloop$(EXEEXT): $(test_mainloop_OBJECTS) $(test_mainloop_DEPENDENCIES) $(EXTRA_test_mainloop_DEPENDENCIES) @rm -f test-mainloop$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mainloop_OBJECTS) $(test_mainloop_LDADD) $(LIBS) + test-new-dribble$(EXEEXT): $(test_new_dribble_OBJECTS) $(test_new_dribble_DEPENDENCIES) $(EXTRA_test_new_dribble_DEPENDENCIES) @rm -f test-new-dribble$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_new_dribble_OBJECTS) $(test_new_dribble_LDADD) $(LIBS) + test-priority$(EXEEXT): $(test_priority_OBJECTS) $(test_priority_DEPENDENCIES) $(EXTRA_test_priority_DEPENDENCIES) @rm -f test-priority$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_priority_OBJECTS) $(test_priority_LDADD) $(LIBS) + test-pseudotcp$(EXEEXT): $(test_pseudotcp_OBJECTS) $(test_pseudotcp_DEPENDENCIES) $(EXTRA_test_pseudotcp_DEPENDENCIES) @rm -f test-pseudotcp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_pseudotcp_OBJECTS) $(test_pseudotcp_LDADD) $(LIBS) + +test-pseudotcp-fuzzy$(EXEEXT): $(test_pseudotcp_fuzzy_OBJECTS) $(test_pseudotcp_fuzzy_DEPENDENCIES) $(EXTRA_test_pseudotcp_fuzzy_DEPENDENCIES) + @rm -f test-pseudotcp-fuzzy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_pseudotcp_fuzzy_OBJECTS) $(test_pseudotcp_fuzzy_LDADD) $(LIBS) + test-restart$(EXEEXT): $(test_restart_OBJECTS) $(test_restart_DEPENDENCIES) $(EXTRA_test_restart_DEPENDENCIES) @rm -f test-restart$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_restart_OBJECTS) $(test_restart_LDADD) $(LIBS) + +test-send-recv$(EXEEXT): $(test_send_recv_OBJECTS) $(test_send_recv_DEPENDENCIES) $(EXTRA_test_send_recv_DEPENDENCIES) + @rm -f test-send-recv$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_send_recv_OBJECTS) $(test_send_recv_LDADD) $(LIBS) + test-thread$(EXEEXT): $(test_thread_OBJECTS) $(test_thread_DEPENDENCIES) $(EXTRA_test_thread_DEPENDENCIES) @rm -f test-thread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_thread_OBJECTS) $(test_thread_LDADD) $(LIBS) @@ -449,14 +808,23 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-add-remove-stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-address.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-bsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-build-io-stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-dribble.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fallback.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-fullmode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-io-stream-cancelling.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-io-stream-closing-read.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-io-stream-closing-write.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-io-stream-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-io-stream-pollable.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-io-stream-thread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-mainloop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-new-dribble.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-priority.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pseudotcp-fuzzy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-pseudotcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-restart.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-send-recv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-thread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ @@ -487,26 +855,15 @@ clean-libtool: -rm -rf .libs _libs -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -518,15 +875,11 @@ $$unique; \ fi; \ fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -535,102 +888,341 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + else \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ else \ - skipped="($$skip tests were not run)"; \ + color_start= color_end=; \ fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ - test "$$failed" -eq 0; \ - else :; fi + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all $(check_PROGRAMS) $(dist_check_SCRIPTS) + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-pseudotcp.log: test-pseudotcp$(EXEEXT) + @p='test-pseudotcp$(EXEEXT)'; \ + b='test-pseudotcp'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-pseudotcp-fuzzy.log: test-pseudotcp-fuzzy$(EXEEXT) + @p='test-pseudotcp-fuzzy$(EXEEXT)'; \ + b='test-pseudotcp-fuzzy'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-bsd.log: test-bsd$(EXEEXT) + @p='test-bsd$(EXEEXT)'; \ + b='test-bsd'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test.log: test$(EXEEXT) + @p='test$(EXEEXT)'; \ + b='test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-address.log: test-address$(EXEEXT) + @p='test-address$(EXEEXT)'; \ + b='test-address'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-add-remove-stream.log: test-add-remove-stream$(EXEEXT) + @p='test-add-remove-stream$(EXEEXT)'; \ + b='test-add-remove-stream'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-build-io-stream.log: test-build-io-stream$(EXEEXT) + @p='test-build-io-stream$(EXEEXT)'; \ + b='test-build-io-stream'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-io-stream-thread.log: test-io-stream-thread$(EXEEXT) + @p='test-io-stream-thread$(EXEEXT)'; \ + b='test-io-stream-thread'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-io-stream-closing-write.log: test-io-stream-closing-write$(EXEEXT) + @p='test-io-stream-closing-write$(EXEEXT)'; \ + b='test-io-stream-closing-write'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-io-stream-closing-read.log: test-io-stream-closing-read$(EXEEXT) + @p='test-io-stream-closing-read$(EXEEXT)'; \ + b='test-io-stream-closing-read'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-io-stream-cancelling.log: test-io-stream-cancelling$(EXEEXT) + @p='test-io-stream-cancelling$(EXEEXT)'; \ + b='test-io-stream-cancelling'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-io-stream-pollable.log: test-io-stream-pollable$(EXEEXT) + @p='test-io-stream-pollable$(EXEEXT)'; \ + b='test-io-stream-pollable'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-send-recv.log: test-send-recv$(EXEEXT) + @p='test-send-recv$(EXEEXT)'; \ + b='test-send-recv'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-priority.log: test-priority$(EXEEXT) + @p='test-priority$(EXEEXT)'; \ + b='test-priority'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-mainloop.log: test-mainloop$(EXEEXT) + @p='test-mainloop$(EXEEXT)'; \ + b='test-mainloop'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-fullmode.log: test-fullmode$(EXEEXT) + @p='test-fullmode$(EXEEXT)'; \ + b='test-fullmode'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-restart.log: test-restart$(EXEEXT) + @p='test-restart$(EXEEXT)'; \ + b='test-restart'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-fallback.log: test-fallback$(EXEEXT) + @p='test-fallback$(EXEEXT)'; \ + b='test-fallback'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-thread.log: test-thread$(EXEEXT) + @p='test-thread$(EXEEXT)'; \ + b='test-thread'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-dribble.log: test-dribble$(EXEEXT) + @p='test-dribble$(EXEEXT)'; \ + b='test-dribble'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-new-dribble.log: test-new-dribble$(EXEEXT) + @p='test-new-dribble$(EXEEXT)'; \ + b='test-new-dribble'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +check-test-fullmode-with-stun.sh.log: check-test-fullmode-with-stun.sh + @p='check-test-fullmode-with-stun.sh'; \ + b='check-test-fullmode-with-stun.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-pseudotcp-random.sh.log: test-pseudotcp-random.sh + @p='test-pseudotcp-random.sh'; \ + b='test-pseudotcp-random.sh'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -667,7 +1259,7 @@ $(dist_check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile all-local +all-am: Makefile $(HEADERS) all-local installdirs: install: install-am install-exec: install-exec-am @@ -689,6 +1281,9 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -773,19 +1368,19 @@ .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ - clean clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + recheck tags tags-am uninstall uninstall-am check-valgrind: diff -Nru libnice-0.1.4/tests/test-add-remove-stream.c libnice-0.1.7/tests/test-add-remove-stream.c --- libnice-0.1.4/tests/test-add-remove-stream.c 2012-03-06 02:00:31.000000000 +0000 +++ libnice-0.1.7/tests/test-add-remove-stream.c 2014-03-07 01:21:05.000000000 +0000 @@ -55,9 +55,7 @@ #endif nice_address_init (&addr); g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init (NULL); -#endif if (!nice_address_set_from_string (&addr, "127.0.0.1")) g_assert_not_reached (); diff -Nru libnice-0.1.4/tests/test-address.c libnice-0.1.7/tests/test-address.c --- libnice-0.1.4/tests/test-address.c 2009-08-14 22:46:12.000000000 +0000 +++ libnice-0.1.7/tests/test-address.c 2014-03-07 01:21:05.000000000 +0000 @@ -96,7 +96,10 @@ { NiceAddress addr, other, v4addr; gchar str[NICE_ADDRESS_STRING_LEN]; - struct sockaddr_in6 sin, sin2; + union { + struct sockaddr_in6 in6; + struct sockaddr addr; + } sin, sin2; g_assert (nice_address_set_from_string (&v4addr, "172.1.0.1") == TRUE); @@ -121,8 +124,8 @@ nice_address_set_from_string (&other, "11:2233:4455:6677:8899:aabb:ccdd:eeff"); nice_address_set_port (&other, 9876); /* in native byte order */ - nice_address_copy_to_sockaddr (&other, (struct sockaddr*)&sin2); - nice_address_copy_to_sockaddr (&addr, (struct sockaddr*)&sin); + nice_address_copy_to_sockaddr (&other, &sin2.addr); + nice_address_copy_to_sockaddr (&addr, &sin.addr); g_assert (nice_address_equal (&addr, &other) == TRUE); nice_address_to_string (&addr, str); nice_address_to_string (&other, str); diff -Nru libnice-0.1.4/tests/test-bsd.c libnice-0.1.7/tests/test-bsd.c --- libnice-0.1.4/tests/test-bsd.c 2012-03-02 01:13:24.000000000 +0000 +++ libnice-0.1.7/tests/test-bsd.c 2014-03-07 01:21:05.000000000 +0000 @@ -1,7 +1,7 @@ /* * This file is part of the Nice GLib ICE library. * - * (C) 2006, 2007 Collabora Ltd. + * (C) 2006, 2007, 2014 Collabora Ltd. * Contact: Dafydd Harries * (C) 2006, 2007 Nokia Corporation. All rights reserved. * Contact: Kai Vehmanen @@ -23,6 +23,7 @@ * * Contributors: * Dafydd Harries, Collabora Ltd. + * Philip Withnall, Collabora Ltd. * * Alternatively, the contents of this file may be used under the terms of the * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which @@ -42,51 +43,351 @@ #include "socket.h" -int -main (void) +static gssize +socket_recv (NiceSocket *sock, NiceAddress *addr, gsize buf_len, gchar *buf) +{ + GInputVector local_buf = { buf, buf_len }; + NiceInputMessage local_message = { &local_buf, 1, addr, 0 }; + gint ret; + + ret = nice_socket_recv_messages (sock, &local_message, 1); + if (ret <= 0) + return ret; + + return local_buf.size; +} + +static void +test_socket_initial_properties (void) +{ + NiceSocket *sock; + + sock = nice_udp_bsd_socket_new (NULL); + g_assert (sock != NULL); + + // not bound to a particular interface + g_assert_cmpint (sock->addr.s.ip4.sin_addr.s_addr, ==, 0); + // is bound to a particular port + g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0); +} + +static void +test_socket_address_properties (void) +{ + NiceSocket *sock; + NiceAddress tmp; + + sock = nice_udp_bsd_socket_new (NULL); + g_assert (sock != NULL); + + g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); + g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0); + nice_address_set_port (&tmp, nice_address_get_port (&sock->addr)); + g_assert_cmpuint (nice_address_get_port (&tmp), !=, 0); +} + +static void +test_simple_send_recv (void) { NiceSocket *server; NiceSocket *client; NiceAddress tmp; gchar buf[5]; - g_type_init (); server = nice_udp_bsd_socket_new (NULL); - if (!server) - g_assert_not_reached(); + g_assert (server != NULL); - // not bound to a particular interface - g_assert (server->addr.s.ip4.sin_addr.s_addr == 0); - // is bound to a particular port - g_assert (nice_address_get_port (&server->addr) != 0); + client = nice_udp_bsd_socket_new (NULL); + g_assert (client != NULL); - g_assert ((client = nice_udp_bsd_socket_new (NULL)) != NULL); - // not bound to a particular interface - g_assert (client->addr.s.ip4.sin_addr.s_addr == 0); - // is bound to a particular port - g_assert (nice_address_get_port (&client->addr) != 0); + g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); + nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); + + /* Send and receive stuff. */ + g_assert_cmpint (nice_socket_send (client, &tmp, 5, "hello"), ==, 5); + + g_assert_cmpint (socket_recv (server, &tmp, 5, buf), ==, 5); + g_assert_cmpint (strncmp (buf, "hello", 5), ==, 0); + + g_assert_cmpint (nice_socket_send (server, &tmp, 5, "uryyb"), ==, 5); + + g_assert_cmpint (socket_recv (client, &tmp, 5, buf), ==, 5); + g_assert_cmpint (strncmp (buf, "uryyb", 5), ==, 0); + + nice_socket_free (client); + nice_socket_free (server); +} + +/* Check that sending and receiving to/from zero-length buffers returns + * immediately. */ +static void +test_zero_send_recv (void) +{ + NiceSocket *sock; + NiceAddress tmp; + gchar buf[5]; + NiceOutputMessage local_out_message; + NiceInputMessage local_in_message; + + sock = nice_udp_bsd_socket_new (NULL); + g_assert (sock != NULL); + + g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); + g_assert_cmpuint (nice_address_get_port (&sock->addr), !=, 0); + nice_address_set_port (&tmp, nice_address_get_port (&sock->addr)); + g_assert_cmpuint (nice_address_get_port (&tmp), !=, 0); + + g_assert_cmpint (nice_socket_send (sock, &tmp, 0, "ignore-me"), ==, 0); + g_assert_cmpint (nice_socket_send (sock, &tmp, 0, NULL), ==, 0); - if (!nice_address_set_from_string (&tmp, "127.0.0.1")) - g_assert_not_reached(); - g_assert (nice_address_get_port (&server->addr) != 0); + g_assert_cmpint (socket_recv (sock, &tmp, 0, buf), ==, 0); + g_assert_cmpint (socket_recv (sock, &tmp, 0, NULL), ==, 0); + + /* And again with messages. */ + g_assert_cmpint (nice_socket_send_messages (sock, &tmp, + &local_out_message, 0), ==, 0); + g_assert_cmpint (nice_socket_send_messages (sock, &tmp, NULL, 0), ==, 0); + + g_assert_cmpint (nice_socket_recv_messages (sock, + &local_in_message, 0), ==, 0); + g_assert_cmpint (nice_socket_recv_messages (sock, NULL, 0), ==, 0); + + nice_socket_free (sock); +} + +/* Test receiving into multiple tiny buffers. */ +static void +test_multi_buffer_recv (void) +{ + NiceSocket *server; + NiceSocket *client; + NiceAddress tmp; + guint8 buf[20]; + guint8 dummy_buf[9]; + + server = nice_udp_bsd_socket_new (NULL); + g_assert (server != NULL); + + client = nice_udp_bsd_socket_new (NULL); + g_assert (client != NULL); + + g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); + nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); + + /* Send and receive stuff. */ + { + GInputVector bufs[7] = { + { &buf[0], 1 }, + { &buf[1], 4 }, + { &buf[1], 0 }, /* should be unused (zero-length) */ + { &buf[5], 1 }, + { &buf[6], 5 }, + { &buf[11], 9 }, /* should be unused (message fits in prior buffers) */ + { &buf[11], 0 }, /* should be unused (zero-length) */ + }; + NiceInputMessage message = { bufs, G_N_ELEMENTS (bufs), NULL, 0 }; + + /* Initialise the buffers so we can try and catch out-of-bounds accesses. */ + memset (buf, 0xaa, sizeof (buf)); + memset (dummy_buf, 0xaa, sizeof (dummy_buf)); + + /* Send and receive. */ + g_assert_cmpint (nice_socket_send (client, &tmp, 11, "hello-world"), ==, 11); + g_assert_cmpuint (nice_socket_recv_messages (server, &message, 1), ==, 1); + g_assert_cmpuint (message.length, ==, 11); + + /* Check all of the things. The sizes should not have been modified. */ + g_assert_cmpuint (bufs[0].size, ==, 1); + g_assert_cmpuint (bufs[1].size, ==, 4); + g_assert_cmpuint (bufs[2].size, ==, 0); + g_assert_cmpuint (bufs[3].size, ==, 1); + g_assert_cmpuint (bufs[4].size, ==, 5); + g_assert_cmpuint (bufs[5].size, ==, 9); + g_assert_cmpuint (bufs[6].size, ==, 0); + + g_assert_cmpint (strncmp ((gchar *) buf, "hello-world", 11), ==, 0); + g_assert_cmpint (memcmp (buf + 11, dummy_buf, 9), ==, 0); + } + + nice_socket_free (client); + nice_socket_free (server); +} + +/* Fill a buffer with deterministic but non-repeated data, so that transmission + * and reception corruption is more likely to be detected. */ +static void +fill_send_buf (guint8 *buf, gsize buf_len, guint seed) +{ + gsize i; + + for (i = 0; i < buf_len; i++) { + buf[i] = '0' + (seed % 10); + seed++; + } +} + +/* Test receiving multiple messages in a single call. */ +static void +test_multi_message_recv (guint n_sends, guint n_receives, + guint n_bufs_per_message, gsize send_buf_size, gsize recv_buf_size, + guint expected_n_received_messages, guint expected_n_sent_messages) +{ + NiceSocket *server; + NiceSocket *client; + NiceAddress tmp; + + server = nice_udp_bsd_socket_new (NULL); + g_assert (server != NULL); + + client = nice_udp_bsd_socket_new (NULL); + g_assert (client != NULL); + + g_assert (nice_address_set_from_string (&tmp, "127.0.0.1")); nice_address_set_port (&tmp, nice_address_get_port (&server->addr)); - g_assert (nice_address_get_port (&tmp) != 0); - nice_socket_send (client, &tmp, 5, "hello"); + /* Send and receive stuff. */ + { + GInputVector *recv_bufs; + NiceInputMessage *recv_messages; + GOutputVector *send_bufs; + NiceOutputMessage *send_messages; + guint i, j; + guint8 *_expected_recv_buf; + gsize expected_recv_buf_len; + + /* Set up the send buffers. */ + send_bufs = g_malloc0_n (n_sends * n_bufs_per_message, + sizeof (GOutputVector)); + send_messages = g_malloc0_n (n_sends, sizeof (NiceOutputMessage)); + + for (i = 0; i < n_sends; i++) { + for (j = 0; j < n_bufs_per_message; j++) { + guint8 *buf = g_slice_alloc (send_buf_size); + + send_bufs[i * n_bufs_per_message + j].buffer = buf; + send_bufs[i * n_bufs_per_message + j].size = send_buf_size; + + /* Set up the buffer data. */ + fill_send_buf (buf, send_buf_size, i); + } + + send_messages[i].buffers = send_bufs + i * n_bufs_per_message; + send_messages[i].n_buffers = n_bufs_per_message; + } + + /* Set up the receive buffers. Yay for dynamic tests! */ + recv_bufs = g_malloc0_n (n_receives * n_bufs_per_message, + sizeof (GInputVector)); + recv_messages = g_malloc0_n (n_receives, sizeof (NiceInputMessage)); + + for (i = 0; i < n_receives; i++) { + for (j = 0; j < n_bufs_per_message; j++) { + recv_bufs[i * n_bufs_per_message + j].buffer = + g_slice_alloc (recv_buf_size); + recv_bufs[i * n_bufs_per_message + j].size = recv_buf_size; + + /* Initialise the buffer to try to catch out-of-bounds accesses. */ + memset (recv_bufs[i * n_bufs_per_message + j].buffer, 0xaa, + recv_buf_size); + } + + recv_messages[i].buffers = recv_bufs + i * n_bufs_per_message; + recv_messages[i].n_buffers = n_bufs_per_message; + recv_messages[i].from = NULL; + recv_messages[i].length = 0; + } + + /* Send multiple packets. */ + g_assert_cmpint ( + nice_socket_send_messages (client, &tmp, send_messages, n_sends), ==, + expected_n_sent_messages); + + /* Receive things. */ + g_assert_cmpint ( + nice_socket_recv_messages (server, recv_messages, n_receives), ==, + expected_n_received_messages); + + /* Check all of the things. The sizes should not have been modified. */ + expected_recv_buf_len = recv_buf_size * n_bufs_per_message; + _expected_recv_buf = g_slice_alloc (expected_recv_buf_len); + + for (i = 0; i < expected_n_received_messages; i++) { + NiceInputMessage *message = &recv_messages[i]; + guint8 *expected_recv_buf = _expected_recv_buf; + gsize expected_len; + + expected_len = MIN (send_buf_size * n_bufs_per_message, + expected_recv_buf_len); + g_assert_cmpuint (message->length, ==, expected_len); + + /* Build the expected buffer as a concatenation of the expected values of + * all receive buffers in the message. */ + memset (expected_recv_buf, 0xaa, expected_recv_buf_len); + fill_send_buf (expected_recv_buf, expected_len, i); + + for (j = 0; j < n_bufs_per_message; j++) { + g_assert_cmpuint (message->buffers[j].size, ==, recv_buf_size); + g_assert_cmpint ( + memcmp (message->buffers[j].buffer, expected_recv_buf, + recv_buf_size), ==, 0); + + expected_recv_buf += recv_buf_size; + } + } - g_assert (5 == nice_socket_recv (server, &tmp, 5, buf)); - g_assert (0 == strncmp (buf, "hello", 5)); - g_assert (nice_address_get_port (&tmp) - == nice_address_get_port (&client->addr)); - - nice_socket_send (server, &tmp, 5, "uryyb"); - g_assert (5 == nice_socket_recv (client, &tmp, 5, buf)); - g_assert (0 == strncmp (buf, "uryyb", 5)); - g_assert (nice_address_get_port (&tmp) - == nice_address_get_port (&server->addr)); + g_slice_free1 (expected_recv_buf_len, _expected_recv_buf); + } nice_socket_free (client); nice_socket_free (server); +} + +int +main (void) +{ + g_type_init (); + + test_socket_initial_properties (); + test_socket_address_properties (); + test_simple_send_recv (); + test_zero_send_recv (); + test_multi_buffer_recv (); + + /* Multi-message testing. Serious business. */ + { + guint i; + struct { + guint n_sends; /* messages */ + guint expected_n_sent_messages; + + guint n_receives; /* messages */ + guint expected_n_received_messages; + + guint n_bufs_per_message; + gsize send_buf_size; + gsize recv_buf_size; + } test_cases[] = { + /* same number of sends and receives */ + { 2, 2, 2, 2, 1, 100, 100 }, /* send 200B, receive 200B */ + /* more sends than receives */ + { 4, 4, 2, 2, 2, 100, 77 }, /* send 800B, receive 308B */ + /* more receives than sends */ + { 1, 1, 4, 1, 4, 10, 100 }, /* send 40B, receive 1600B */ + /* small receive buffer (data loss) */ + { 100, 100, 100, 100, 1, 100, 64 }, /* send 10000B, receive 6400B */ + /* small receive buffers (data loss) */ + { 50, 50, 50, 50, 10, 100, 8 }, /* send 50000B, receive 4000B */ + }; + + for (i = 0; i < G_N_ELEMENTS (test_cases); i++) { + test_multi_message_recv (test_cases[i].n_sends, test_cases[i].n_receives, + test_cases[i].n_bufs_per_message, test_cases[i].send_buf_size, + test_cases[i].recv_buf_size, + test_cases[i].expected_n_received_messages, + test_cases[i].expected_n_sent_messages); + } + } + return 0; } diff -Nru libnice-0.1.4/tests/test-build-io-stream.c libnice-0.1.7/tests/test-build-io-stream.c --- libnice-0.1.4/tests/test-build-io-stream.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-build-io-stream.c 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,457 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2013 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "agent.h" + +#include "iostream.h" + +static void +test_invalid_stream (NiceAddress *addr) +{ + NiceAgent *agent; + GIOStream *io_stream; + + agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245); + nice_agent_add_local_address (agent, addr); + + /* Try building an I/O stream for an invalid stream. All its operations should + * return G_IO_ERROR_BROKEN_PIPE. */ + io_stream = nice_agent_get_io_stream (agent, 5, 5); + g_assert (io_stream == NULL); +} + +static void +test_io_stream_properties (NiceAddress *addr) +{ + NiceAgent *agent; + guint stream_id; + GIOStream *io_stream; + GInputStream *input_stream; + GOutputStream *output_stream; + + agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245); + nice_agent_add_local_address (agent, addr); + + stream_id = nice_agent_add_stream (agent, 1); + + /* Try building an I/O stream around it. */ + io_stream = nice_agent_get_io_stream (agent, stream_id, 1); + g_assert (G_IS_IO_STREAM (io_stream)); + g_assert (NICE_IS_IO_STREAM (io_stream)); + + /* Check various initial properties. */ + g_assert (!g_io_stream_is_closed (G_IO_STREAM (io_stream))); + g_assert (!g_io_stream_has_pending (G_IO_STREAM (io_stream))); + + /* Check the input stream’s properties. */ + input_stream = g_io_stream_get_input_stream (G_IO_STREAM (io_stream)); + g_assert (G_IS_INPUT_STREAM (input_stream)); + g_assert (NICE_IS_INPUT_STREAM (input_stream)); + + g_assert (!g_input_stream_is_closed (input_stream)); + g_assert (!g_input_stream_has_pending (input_stream)); + + /* Check the output stream’s properties. */ + output_stream = g_io_stream_get_output_stream (G_IO_STREAM (io_stream)); + g_assert (G_IS_OUTPUT_STREAM (output_stream)); + g_assert (NICE_IS_OUTPUT_STREAM (output_stream)); + + g_assert (!g_output_stream_is_closing (output_stream)); + g_assert (!g_output_stream_is_closed (output_stream)); + g_assert (!g_output_stream_has_pending (output_stream)); + + /* Remove the component and check that the I/O streams close. */ + nice_agent_remove_stream (agent, stream_id); + + g_assert (g_io_stream_is_closed (G_IO_STREAM (io_stream))); + g_assert (g_input_stream_is_closed (input_stream)); + g_assert (g_output_stream_is_closed (output_stream)); + + g_object_unref (io_stream); + g_object_unref (agent); +} + +static void +test_pollable_properties (NiceAddress *addr) +{ + NiceAgent *agent; + guint stream_id; + GIOStream *io_stream; + GInputStream *input_stream; + GOutputStream *output_stream; + GPollableInputStream *pollable_input_stream; + GPollableOutputStream *pollable_output_stream; + guint8 buf[65536]; + GError *error = NULL; + GSource *stream_source; + + agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245); + nice_agent_add_local_address (agent, addr); + + /* Add a stream. */ + stream_id = nice_agent_add_stream (agent, 1); + + /* Try building an I/O stream around it. */ + io_stream = nice_agent_get_io_stream (agent, stream_id, 1); + g_assert (G_IS_IO_STREAM (io_stream)); + g_assert (NICE_IS_IO_STREAM (io_stream)); + + /* Check the input stream’s properties. */ + input_stream = g_io_stream_get_input_stream (G_IO_STREAM (io_stream)); + g_assert (G_IS_POLLABLE_INPUT_STREAM (input_stream)); + pollable_input_stream = G_POLLABLE_INPUT_STREAM (input_stream); + + g_assert (g_pollable_input_stream_can_poll (pollable_input_stream)); + g_assert (!g_pollable_input_stream_is_readable (pollable_input_stream)); + + g_assert ( + g_pollable_input_stream_read_nonblocking (pollable_input_stream, + buf, sizeof (buf), NULL, &error) == -1); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + + stream_source = + g_pollable_input_stream_create_source (pollable_input_stream, NULL); + g_assert (stream_source != NULL); + g_source_unref (stream_source); + + /* Check the output stream’s properties. */ + output_stream = g_io_stream_get_output_stream (G_IO_STREAM (io_stream)); + g_assert (G_IS_POLLABLE_OUTPUT_STREAM (output_stream)); + pollable_output_stream = G_POLLABLE_OUTPUT_STREAM (output_stream); + + g_assert (g_pollable_output_stream_can_poll (pollable_output_stream)); + g_assert (!g_pollable_output_stream_is_writable (pollable_output_stream)); + + g_assert ( + g_pollable_output_stream_write_nonblocking (pollable_output_stream, + buf, sizeof (buf), NULL, &error) == -1); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_clear_error (&error); + + stream_source = + g_pollable_output_stream_create_source (pollable_output_stream, NULL); + g_assert (stream_source != NULL); + g_source_unref (stream_source); + + /* Remove the component and check that the I/O streams close. */ + nice_agent_remove_stream (agent, stream_id); + + g_assert (!g_pollable_input_stream_is_readable (pollable_input_stream)); + g_assert (!g_pollable_output_stream_is_writable (pollable_output_stream)); + + g_assert ( + g_pollable_input_stream_read_nonblocking (pollable_input_stream, + buf, sizeof (buf), NULL, &error) == -1); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED); + g_clear_error (&error); + + g_assert ( + g_pollable_output_stream_write_nonblocking (pollable_output_stream, + buf, sizeof (buf), NULL, &error) == -1); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED); + g_clear_error (&error); + + g_object_unref (io_stream); + g_object_unref (agent); +} + +static gboolean +source_cancel_cb (gpointer user_data) +{ + GCancellable *cancellable = user_data; + + g_cancellable_cancel (cancellable); + + return FALSE; +} + +static gboolean +source_cancelled_cb (GObject *pollable_stream, gpointer user_data) +{ + GMainLoop *main_loop = user_data; + + /* Try and check that the callback was invoked due to cancellation rather than + * a poll() event on the socket itself. */ + if (G_IS_POLLABLE_INPUT_STREAM (pollable_stream)) { + g_assert ( + !g_pollable_input_stream_is_readable ( + G_POLLABLE_INPUT_STREAM (pollable_stream))); + } else { + g_assert ( + !g_pollable_output_stream_is_writable ( + G_POLLABLE_OUTPUT_STREAM (pollable_stream))); + } + + g_main_loop_quit (main_loop); + + return FALSE; +} + +static gboolean +source_timeout_cb (gpointer user_data) +{ + g_error ("check_pollable_source_cancellation() took too long. Aborting."); + + return FALSE; +} + +/* Check that cancelling a GCancellable which is associated with a pollable + * stream’s GSource invokes a callback from that source in the main loop. This + * uses a main context with three sources: the pollable source, an idle source + * to trigger the cancellation, and a timeout source to fail the test if it + * takes too long. */ +static void +check_pollable_source_cancellation (GSource *pollable_source, + GCancellable *cancellable) +{ + GMainContext *main_context; + GMainLoop *main_loop; + GSource *idle_source, *timeout_source; + + main_context = g_main_context_new (); + main_loop = g_main_loop_new (main_context, FALSE); + + /* Set up the pollable source. */ + g_source_set_callback (pollable_source, (GSourceFunc) source_cancelled_cb, + main_loop, NULL); + g_source_attach (pollable_source, main_context); + + /* Idle source to cancel the cancellable. */ + idle_source = g_idle_source_new (); + g_source_set_callback (idle_source, (GSourceFunc) source_cancel_cb, + cancellable, NULL); + g_source_attach (idle_source, main_context); + g_source_unref (idle_source); + + /* Timeout. */ + timeout_source = g_timeout_source_new (30000); + g_source_set_callback (timeout_source, (GSourceFunc) source_timeout_cb, + NULL, NULL); + g_source_attach (timeout_source, main_context); + g_source_unref (timeout_source); + + /* Run the main loop and expect to quit it immediately as the pollable source + * is cancelled. */ + g_main_loop_run (main_loop); + + g_assert (g_cancellable_is_cancelled (cancellable)); + + g_main_loop_unref (main_loop); + g_main_context_unref (main_context); +} + +static void +test_pollable_cancellation (NiceAddress *addr) +{ + NiceAgent *agent; + guint stream_id; + GIOStream *io_stream; + GInputStream *input_stream; + GOutputStream *output_stream; + GPollableInputStream *pollable_input_stream; + GPollableOutputStream *pollable_output_stream; + guint8 buf[65536]; + GError *error = NULL; + GSource *stream_source; + GCancellable *cancellable; + + agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245); + nice_agent_add_local_address (agent, addr); + + /* Add a stream. */ + stream_id = nice_agent_add_stream (agent, 1); + + /* Try building an I/O stream around it. */ + io_stream = nice_agent_get_io_stream (agent, stream_id, 1); + g_assert (G_IS_IO_STREAM (io_stream)); + g_assert (NICE_IS_IO_STREAM (io_stream)); + + /* Grab the input and output streams. */ + input_stream = g_io_stream_get_input_stream (G_IO_STREAM (io_stream)); + g_assert (G_IS_POLLABLE_INPUT_STREAM (input_stream)); + pollable_input_stream = G_POLLABLE_INPUT_STREAM (input_stream); + + output_stream = g_io_stream_get_output_stream (G_IO_STREAM (io_stream)); + g_assert (G_IS_POLLABLE_OUTPUT_STREAM (output_stream)); + pollable_output_stream = G_POLLABLE_OUTPUT_STREAM (output_stream); + + /* Check the non-blocking read() and write() return immediately if called with + * a cancelled cancellable. */ + cancellable = g_cancellable_new (); + g_cancellable_cancel (cancellable); + + g_assert ( + g_pollable_input_stream_read_nonblocking (pollable_input_stream, + buf, sizeof (buf), cancellable, &error) == -1); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); + g_clear_error (&error); + + g_assert ( + g_pollable_output_stream_write_nonblocking (pollable_output_stream, + buf, sizeof (buf), cancellable, &error) == -1); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); + g_clear_error (&error); + + g_object_unref (cancellable); + + /* Check the GSources invoke a callback when run with the cancellable + * cancelled. */ + cancellable = g_cancellable_new (); + stream_source = + g_pollable_input_stream_create_source (pollable_input_stream, + cancellable); + + check_pollable_source_cancellation (stream_source, cancellable); + + g_source_unref (stream_source); + g_object_unref (cancellable); + + /* And for the output stream. */ + cancellable = g_cancellable_new (); + stream_source = + g_pollable_output_stream_create_source (pollable_output_stream, + cancellable); + + check_pollable_source_cancellation (stream_source, cancellable); + + g_source_unref (stream_source); + g_object_unref (cancellable); +} + +static void +test_zero_length_reads_writes (NiceAddress *addr) +{ + NiceAgent *agent; + guint stream_id; + GIOStream *io_stream; + GInputStream *input_stream; + GOutputStream *output_stream; + GPollableInputStream *pollable_input_stream; + GPollableOutputStream *pollable_output_stream; + GError *error = NULL; + guint8 buf[1]; /* should never be accessed */ + + agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245); + nice_agent_add_local_address (agent, addr); + + /* Add a stream. */ + stream_id = nice_agent_add_stream (agent, 1); + + /* Try building an I/O stream around it. */ + io_stream = nice_agent_get_io_stream (agent, stream_id, 1); + g_assert (G_IS_IO_STREAM (io_stream)); + g_assert (NICE_IS_IO_STREAM (io_stream)); + + input_stream = g_io_stream_get_input_stream (G_IO_STREAM (io_stream)); + output_stream = g_io_stream_get_output_stream (G_IO_STREAM (io_stream)); + pollable_input_stream = G_POLLABLE_INPUT_STREAM (input_stream); + pollable_output_stream = G_POLLABLE_OUTPUT_STREAM (output_stream); + + /* Check zero-length reads and writes complete immediately without error. */ + g_assert (g_input_stream_read (input_stream, buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_assert (g_output_stream_write (output_stream, buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_assert ( + g_pollable_input_stream_read_nonblocking (pollable_input_stream, + buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_assert ( + g_pollable_output_stream_write_nonblocking (pollable_output_stream, + buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + /* Remove the component and check that zero-length reads and writes still + * result in a 0 response, rather than any error. */ + nice_agent_remove_stream (agent, stream_id); + g_assert (g_io_stream_is_closed (G_IO_STREAM (io_stream))); + + g_assert (g_input_stream_read (input_stream, buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_assert (g_output_stream_write (output_stream, buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_assert ( + g_pollable_input_stream_read_nonblocking (pollable_input_stream, + buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_assert ( + g_pollable_output_stream_write_nonblocking (pollable_output_stream, + buf, 0, NULL, &error) == 0); + g_assert_no_error (error); + + g_object_unref (io_stream); + g_object_unref (agent); +} + +int +main (void) +{ + NiceAddress addr; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + nice_address_init (&addr); + g_type_init (); + g_thread_init (NULL); + + g_assert (nice_address_set_from_string (&addr, "127.0.0.1")); + + test_invalid_stream (&addr); + test_io_stream_properties (&addr); + test_pollable_properties (&addr); + test_pollable_cancellation (&addr); + test_zero_length_reads_writes (&addr); + +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + + return 0; +} + diff -Nru libnice-0.1.4/tests/test.c libnice-0.1.7/tests/test.c --- libnice-0.1.4/tests/test.c 2012-02-21 02:56:29.000000000 +0000 +++ libnice-0.1.7/tests/test.c 2014-03-07 01:21:05.000000000 +0000 @@ -62,9 +62,7 @@ nice_address_init (&addr_remote); g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init(NULL); -#endif g_assert (nice_address_set_from_string (&addr_local, "127.0.0.1")); g_assert (nice_address_set_from_string (&addr_remote, "127.0.0.1")); diff -Nru libnice-0.1.4/tests/test-dribble.c libnice-0.1.7/tests/test-dribble.c --- libnice-0.1.4/tests/test-dribble.c 2012-08-22 23:47:36.000000000 +0000 +++ libnice-0.1.7/tests/test-dribble.c 2014-04-24 00:30:32.000000000 +0000 @@ -128,15 +128,25 @@ static void cb_component_state_changed (NiceAgent *agent, guint stream_id, guint component_id, guint state, gpointer data) { + gboolean ready_to_connected = FALSE; g_debug ("test-dribble:%s: %p", G_STRFUNC, data); - if (GPOINTER_TO_UINT (data) == 1) + if (GPOINTER_TO_UINT (data) == 1) { + if (global_lagent_state == NICE_COMPONENT_STATE_READY && + state == NICE_COMPONENT_STATE_CONNECTED) + ready_to_connected = TRUE; global_lagent_state = state; - else if (GPOINTER_TO_UINT (data) == 2) + } else if (GPOINTER_TO_UINT (data) == 2) { + if (global_ragent_state == NICE_COMPONENT_STATE_READY && + state == NICE_COMPONENT_STATE_CONNECTED) + ready_to_connected = TRUE; global_ragent_state = state; - + } + if (state == NICE_COMPONENT_STATE_READY) global_components_ready++; + else if (state == NICE_COMPONENT_STATE_CONNECTED && ready_to_connected) + global_components_ready--; if (state == NICE_COMPONENT_STATE_FAILED) global_components_failed++; @@ -206,9 +216,7 @@ #endif g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init (NULL); -#endif global_mainloop = g_main_loop_new (NULL, FALSE); @@ -341,7 +349,7 @@ g_timeout_add (500, quit_loop_cb, NULL); g_main_loop_run (global_mainloop); - global_components_ready--; + //global_components_ready--; cands = nice_agent_get_local_candidates (ragent, rs_id, NICE_COMPONENT_TYPE_RTP); nice_address_set_port(&((NiceCandidate *) cands->data)->addr, 80); diff -Nru libnice-0.1.4/tests/test-fallback.c libnice-0.1.7/tests/test-fallback.c --- libnice-0.1.4/tests/test-fallback.c 2012-03-12 16:14:36.000000000 +0000 +++ libnice-0.1.7/tests/test-fallback.c 2014-03-31 23:20:03.000000000 +0000 @@ -492,9 +492,7 @@ WSAStartup(0x0202, &w); #endif g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init (NULL); -#endif global_mainloop = g_main_loop_new (NULL, FALSE); diff -Nru libnice-0.1.4/tests/test-fullmode.c libnice-0.1.7/tests/test-fullmode.c --- libnice-0.1.4/tests/test-fullmode.c 2012-11-19 22:48:39.000000000 +0000 +++ libnice-0.1.7/tests/test-fullmode.c 2014-03-31 23:20:03.000000000 +0000 @@ -155,10 +155,15 @@ return FALSE; } -static void cb_writable (NiceAgent*agent, guint stream_id, guint component_id) +static void cb_writable (NiceAgent*agent, guint stream_id, guint component_id, + gpointer user_data) { + guint *ls_id = user_data; + + if (stream_id == *ls_id && component_id == 1) { g_debug ("Transport is now writable, stopping mainloop"); - g_main_loop_quit (global_mainloop); + *ls_id = 0; + } } static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, guint len, gchar *buf, gpointer user_data) @@ -176,6 +181,9 @@ if (strncmp ("12345678", buf, 8)) return; + if (component_id == 2) + return; + if (GPOINTER_TO_UINT (user_data) == 2) { g_debug ("right agent received %d bytes, stopping mainloop", len); global_ragent_read = len; @@ -370,7 +378,7 @@ nice_agent_set_port_range (ragent, rs_id, 2, 10000, 10002); g_assert (nice_agent_gather_candidates (ragent, rs_id) == TRUE); -#ifdef USE_LOOPBACK +#if USE_LOOPBACK { GSList *cands = NULL, *i; NiceCandidate *cand = NULL; @@ -466,10 +474,13 @@ g_debug ("Sending data returned -1 in %s mode", reliable?"Reliable":"Non-reliable"); if (reliable) { gulong signal_handler; + guint ls_id_copy = ls_id; + signal_handler = g_signal_connect (G_OBJECT (lagent), - "reliable-transport-writable", G_CALLBACK (cb_writable), NULL); + "reliable-transport-writable", G_CALLBACK (cb_writable), &ls_id_copy); g_debug ("Running mainloop until transport is writable"); - g_main_loop_run (global_mainloop); + while (ls_id_copy == ls_id) + g_main_context_iteration (NULL, TRUE); g_signal_handler_disconnect(G_OBJECT (lagent), signal_handler); ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); @@ -477,7 +488,8 @@ } g_debug ("Sent %d bytes", ret); g_assert (ret == 16); - g_main_loop_run (global_mainloop); + while (global_ragent_read != 16) + g_main_context_iteration (NULL, TRUE); g_assert (global_ragent_read == 16); g_debug ("test-fullmode: Ran mainloop, removing streams..."); @@ -589,14 +601,18 @@ /* note: test payload send and receive */ global_ragent_read = 0; ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); - { + if (ret == -1) { gboolean reliable = FALSE; g_object_get (G_OBJECT (lagent), "reliable", &reliable, NULL); if (reliable) { gulong signal_handler; + guint ls_id_copy = ls_id; + signal_handler = g_signal_connect (G_OBJECT (lagent), - "reliable-transport-writable", G_CALLBACK (cb_writable), NULL); - g_main_loop_run (global_mainloop); + "reliable-transport-writable", G_CALLBACK (cb_writable), &ls_id_copy); + g_debug ("Running mainloop until transport is writable"); + while (ls_id_copy == ls_id) + g_main_context_iteration (NULL, TRUE); g_signal_handler_disconnect(G_OBJECT (lagent), signal_handler); ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); @@ -809,9 +825,7 @@ WSAStartup(0x0202, &w); #endif g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init(NULL); -#endif global_mainloop = g_main_loop_new (NULL, FALSE); diff -Nru libnice-0.1.4/tests/test-io-stream-cancelling.c libnice-0.1.7/tests/test-io-stream-cancelling.c --- libnice-0.1.4/tests/test-io-stream-cancelling.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-cancelling.c 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,146 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +typedef struct { + GCancellable *cancellable; /* owned */ + + GCond cond; + GMutex mutex; + gboolean blocking; /* protected by @mutex */ +} CancellationData; + +static gpointer +cancellation_thread_cb (gpointer user_data) +{ + CancellationData *data = user_data; + + /* Wait to be signalled from read_thread_cb(). */ + g_mutex_lock (&data->mutex); + while (!data->blocking) + g_cond_wait (&data->cond, &data->mutex); + g_mutex_unlock (&data->mutex); + + /* Try and ensure we cancel part-way through the read, rather than before the + * read function is called. */ + g_usleep (100000); + + g_cancellable_cancel (data->cancellable); + + return NULL; +} + +static void +read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + CancellationData *user_data = data->user_data; + GError *error = NULL; + guint8 buf[MESSAGE_SIZE]; + gssize len; + + /* Block on receiving some data or cancellation. */ + g_mutex_lock (&user_data->mutex); + user_data->blocking = TRUE; + g_cond_signal (&user_data->cond); + g_mutex_unlock (&user_data->mutex); + + len = g_input_stream_read (input_stream, buf, sizeof (buf), + user_data->cancellable, &error); + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); + g_assert (len == -1); + + g_main_loop_quit (data->error_loop); +} + +int main (void) +{ + GThread *l_cancellation_thread, *r_cancellation_thread; + CancellationData *l_data, *r_data; + + const TestIOStreamCallbacks callbacks = { + read_thread_cb, + NULL, + NULL, + NULL, + }; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + g_type_init (); + g_thread_init (NULL); + + l_data = g_malloc0 (sizeof (CancellationData)); + l_data->cancellable = g_cancellable_new (); + l_data->blocking = FALSE; + + r_data = g_malloc0 (sizeof (CancellationData)); + r_data->cancellable = g_cancellable_new (); + r_data->blocking = FALSE; + + l_cancellation_thread = spawn_thread ("libnice L cancel", + cancellation_thread_cb, l_data); + r_cancellation_thread = spawn_thread ("libnice R cancel", + cancellation_thread_cb, r_data); + + run_io_stream_test (30, TRUE, &callbacks, l_data, NULL, r_data, NULL); + + g_thread_join (l_cancellation_thread); + g_thread_join (r_cancellation_thread); + + /* Free things. */ + g_object_unref (r_data->cancellable); + g_free (r_data); + g_object_unref (l_data->cancellable); + g_free (l_data); + +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + + return 0; +} diff -Nru libnice-0.1.4/tests/test-io-stream-closing-read.c libnice-0.1.7/tests/test-io-stream-closing-read.c --- libnice-0.1.4/tests/test-io-stream-closing-read.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-closing-read.c 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,140 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +#define NUM_MESSAGES 10 + +guint count = 0; +GMutex count_lock; +GCond count_cond; + +static void +read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + GError *error = NULL; + gssize len; + guint8 buf[MESSAGE_SIZE]; + + + g_mutex_lock (&count_lock); + count++; + g_cond_broadcast (&count_cond); + g_mutex_unlock (&count_lock); + + /* Block on receiving some data. */ + do { + len = g_input_stream_read (input_stream, buf, sizeof (buf), NULL, &error); + if (!data->user_data) { + g_assert_cmpint (len, ==, sizeof(buf)); + return; + } + } while (len > 0); + g_assert_cmpint (len, ==, -1); + + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE); + g_clear_error (&error); + + stop_main_loop (data->error_loop); +} + +static void +write_thread_cb (GOutputStream *output_stream, TestIOStreamThreadData *data) +{ + gchar buf[MESSAGE_SIZE] = {0}; + gssize ret; + GError *error = NULL; + gpointer tmp; + guint stream_id; + + ret = g_output_stream_write (output_stream, buf, sizeof (buf), NULL, + &error); + + g_mutex_lock (&count_lock); + count++; + g_cond_broadcast (&count_cond); + if (data->user_data) { + g_assert_cmpint (ret, ==, sizeof(buf)); + g_mutex_unlock (&count_lock); + return; + } + + while (count != 4) + g_cond_wait (&count_cond, &count_lock); + g_mutex_unlock (&count_lock); + + + /* Now we remove the stream, lets see how the writer handles that */ + + tmp = g_object_get_data (G_OBJECT (data->other->agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + + nice_agent_remove_stream (data->other->agent, stream_id); +} + +int main (void) +{ + const TestIOStreamCallbacks callbacks = { + read_thread_cb, + write_thread_cb, + NULL, + NULL, + }; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + g_type_init (); + g_thread_init (NULL); + + run_io_stream_test (30, TRUE, &callbacks, (gpointer) TRUE, NULL, NULL, NULL); + +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + + return 0; +} diff -Nru libnice-0.1.4/tests/test-io-stream-closing-write.c libnice-0.1.7/tests/test-io-stream-closing-write.c --- libnice-0.1.4/tests/test-io-stream-closing-write.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-closing-write.c 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,140 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +#define NUM_MESSAGES 10 + +guint count = 0; +GMutex count_lock; +GCond count_cond; + +static void +read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + gpointer tmp; + guint stream_id; + GError *error = NULL; + gssize len; + guint8 buf[MESSAGE_SIZE]; + + /* Block on receiving some data. */ + len = g_input_stream_read (input_stream, buf, sizeof (buf), NULL, &error); + g_assert_cmpint (len, ==, sizeof(buf)); + + g_mutex_lock (&count_lock); + count++; + g_cond_broadcast (&count_cond); + if (data->user_data) { + g_mutex_unlock (&count_lock); + return; + } + + while (count != 4) + g_cond_wait (&count_cond, &count_lock); + g_mutex_unlock (&count_lock); + + /* Now we remove the stream, lets see how the writer handles that */ + + tmp = g_object_get_data (G_OBJECT (data->other->agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + + nice_agent_remove_stream (data->other->agent, stream_id); +} + +static void +write_thread_cb (GOutputStream *output_stream, TestIOStreamThreadData *data) +{ + gchar buf[MESSAGE_SIZE] = {0}; + gssize ret; + GError *error = NULL; + + g_mutex_lock (&count_lock); + count++; + g_cond_broadcast (&count_cond); + g_mutex_unlock (&count_lock); + + do { + g_assert_no_error (error); + ret = g_output_stream_write (output_stream, buf, sizeof (buf), NULL, + &error); + + if (!data->user_data) { + g_assert_cmpint (ret, ==, sizeof (buf)); + return; + } + } while (ret > 0); + g_assert_cmpint (ret, ==, -1); + + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED); + g_clear_error (&error); + + stop_main_loop (data->error_loop); +} + +int main (void) +{ + const TestIOStreamCallbacks callbacks = { + read_thread_cb, + write_thread_cb, + NULL, + NULL, + }; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + g_type_init (); + g_thread_init (NULL); + + run_io_stream_test (30, TRUE, &callbacks, (gpointer) TRUE, NULL, NULL, NULL); + +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + + return 0; +} diff -Nru libnice-0.1.4/tests/test-io-stream-common.c libnice-0.1.7/tests/test-io-stream-common.c --- libnice-0.1.4/tests/test-io-stream-common.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-common.c 2014-03-31 23:20:03.000000000 +0000 @@ -0,0 +1,532 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +GMutex start_mutex; +GCond start_cond; +gboolean started; + +static gboolean timer_cb (gpointer pointer) +{ + g_debug ("test-thread:%s: %p", G_STRFUNC, pointer); + + /* note: should not be reached, abort */ + g_debug ("ERROR: test has got stuck, aborting..."); + exit (-1); +} + +static void +wait_for_start (TestIOStreamThreadData *data) +{ + g_mutex_lock (data->start_mutex); + (*data->start_count)--; + g_cond_broadcast (data->start_cond); + while (*data->start_count > 0) + g_cond_wait (data->start_cond, data->start_mutex); + g_mutex_unlock (data->start_mutex); +} + +static gpointer +write_thread_cb (gpointer user_data) +{ + TestIOStreamThreadData *data = user_data; + GMainContext *main_context; + GOutputStream *output_stream = NULL; + + main_context = g_main_context_new (); + g_main_context_push_thread_default (main_context); + + /* Synchronise thread starting. */ + wait_for_start (data); + + /* Wait for the stream to be writeable. */ + g_mutex_lock (&data->write_mutex); + while (!(data->stream_open && data->stream_ready)) + g_cond_wait (&data->write_cond, &data->write_mutex); + g_mutex_unlock (&data->write_mutex); + + if (data->reliable) + output_stream = g_io_stream_get_output_stream (data->io_stream); + data->callbacks->write_thread (output_stream, data); + + g_main_context_pop_thread_default (main_context); + g_main_context_unref (main_context); + + return NULL; +} + +static gpointer +read_thread_cb (gpointer user_data) +{ + TestIOStreamThreadData *data = user_data; + GMainContext *main_context; + GInputStream *input_stream = NULL; + + main_context = g_main_context_new (); + g_main_context_push_thread_default (main_context); + + /* Synchronise thread starting. */ + wait_for_start (data); + + if (data->reliable) + input_stream = g_io_stream_get_input_stream (data->io_stream); + data->callbacks->read_thread (input_stream, data); + + g_main_context_pop_thread_default (main_context); + g_main_context_unref (main_context); + + return NULL; +} + +static gpointer +main_thread_cb (gpointer user_data) +{ + TestIOStreamThreadData *data = user_data; + + g_main_context_push_thread_default (data->main_context); + + /* Synchronise thread starting. */ + wait_for_start (data); + + /* Run the main context. */ + g_main_loop_run (data->main_loop); + + g_main_context_pop_thread_default (data->main_context); + + return NULL; +} + +static void +candidate_gathering_done_cb (NiceAgent *agent, guint stream_id, + gpointer user_data) +{ + NiceAgent *other = g_object_get_data (G_OBJECT (agent), "other-agent"); + gchar *ufrag = NULL, *password = NULL; + GSList *cands, *i; + guint id, other_id; + gpointer tmp; + + tmp = g_object_get_data (G_OBJECT (agent), "stream-id"); + id = GPOINTER_TO_UINT (tmp); + tmp = g_object_get_data (G_OBJECT (other), "stream-id"); + other_id = GPOINTER_TO_UINT (tmp); + + nice_agent_get_local_credentials (agent, id, &ufrag, &password); + nice_agent_set_remote_credentials (other, + other_id, ufrag, password); + g_free (ufrag); + g_free (password); + + cands = nice_agent_get_local_candidates (agent, id, 1); + g_assert (cands != NULL); + + nice_agent_set_remote_candidates (other, other_id, 1, cands); + + for (i = cands; i; i = i->next) + nice_candidate_free ((NiceCandidate *) i->data); + g_slist_free (cands); +} + +static void +reliable_transport_writable_cb (NiceAgent *agent, guint stream_id, + guint component_id, gpointer user_data) +{ + TestIOStreamThreadData *data = user_data; + + g_assert (data->reliable); + + /* Signal writeability. */ + g_mutex_lock (&data->write_mutex); + data->stream_open = TRUE; + g_cond_broadcast (&data->write_cond); + g_mutex_unlock (&data->write_mutex); + + if (data->callbacks->reliable_transport_writable != NULL) { + GIOStream *io_stream; + GOutputStream *output_stream; + + io_stream = g_object_get_data (G_OBJECT (agent), "io-stream"); + g_assert (io_stream != NULL); + output_stream = g_io_stream_get_output_stream (io_stream); + + data->callbacks->reliable_transport_writable (output_stream, agent, + stream_id, component_id, data); + } +} + +static void +component_state_changed_cb (NiceAgent *agent, guint stream_id, + guint component_id, guint state, gpointer user_data) +{ + TestIOStreamThreadData *data = user_data; + + if (state != NICE_COMPONENT_STATE_READY) + return; + + /* Signal stream state. */ + g_mutex_lock (&data->write_mutex); + data->stream_ready = TRUE; + g_cond_broadcast (&data->write_cond); + g_mutex_unlock (&data->write_mutex); +} + +static void +new_selected_pair_cb (NiceAgent *agent, guint stream_id, guint component_id, + gchar *lfoundation, gchar *rfoundation, gpointer user_data) +{ + TestIOStreamThreadData *data = user_data; + + if (data->callbacks->new_selected_pair != NULL) { + data->callbacks->new_selected_pair (agent, stream_id, component_id, + lfoundation, rfoundation, data); + } +} + +static NiceAgent * +create_agent (gboolean controlling_mode, TestIOStreamThreadData *data, + GMainContext **main_context, GMainLoop **main_loop) +{ + NiceAgent *agent; + NiceAddress base_addr; + const gchar *stun_server, *stun_server_port; + + /* Create main contexts. */ + *main_context = g_main_context_new (); + *main_loop = g_main_loop_new (*main_context, FALSE); + + /* Use Google compatibility to ignore credentials. */ + if (data->reliable) + agent = nice_agent_new_reliable (*main_context, NICE_COMPATIBILITY_GOOGLE); + else + agent = nice_agent_new (*main_context, NICE_COMPATIBILITY_GOOGLE); + + g_object_set (G_OBJECT (agent), + "controlling-mode", controlling_mode, + "upnp", FALSE, + NULL); + + /* Specify which local interface to use. */ + g_assert (nice_address_set_from_string (&base_addr, "127.0.0.1")); + nice_agent_add_local_address (agent, &base_addr); + + /* Hook up signals. */ + g_signal_connect (G_OBJECT (agent), "candidate-gathering-done", + (GCallback) candidate_gathering_done_cb, + GUINT_TO_POINTER (controlling_mode)); + g_signal_connect (G_OBJECT (agent), "new-selected-pair", + (GCallback) new_selected_pair_cb, data); + g_signal_connect (G_OBJECT (agent), "component-state-changed", + (GCallback) component_state_changed_cb, data); + + if (data->reliable) { + g_signal_connect (G_OBJECT (agent), "reliable-transport-writable", + (GCallback) reliable_transport_writable_cb, data); + } else { + data->stream_open = TRUE; + } + + /* Configure the STUN server. */ + stun_server = g_getenv ("NICE_STUN_SERVER"); + stun_server_port = g_getenv ("NICE_STUN_SERVER_PORT"); + + if (stun_server != NULL) { + g_object_set (G_OBJECT (agent), + "stun-server", stun_server, + "stun-server-port", atoi (stun_server_port), + NULL); + } + + return agent; +} + +static void +add_stream (NiceAgent *agent) +{ + guint stream_id; + + stream_id = nice_agent_add_stream (agent, 2); + g_assert (stream_id > 0); + + g_object_set_data (G_OBJECT (agent), "stream-id", + GUINT_TO_POINTER (stream_id)); +} + +static void +run_agent (TestIOStreamThreadData *data, NiceAgent *agent) +{ + guint stream_id; + gpointer tmp; + + tmp = g_object_get_data (G_OBJECT (agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + + nice_agent_gather_candidates (agent, stream_id); + + if (data->reliable) { + data->io_stream = + G_IO_STREAM (nice_agent_get_io_stream (agent, stream_id, 1)); + g_object_set_data (G_OBJECT (agent), "io-stream", data->io_stream); + } else { + data->io_stream = NULL; + } +} + +GThread * +spawn_thread (const gchar *thread_name, GThreadFunc thread_func, + gpointer user_data) +{ + GThread *thread; + +#if !GLIB_CHECK_VERSION(2, 31, 8) + thread = g_thread_create (thread_func, user_data, TRUE, NULL); +#else + thread = g_thread_new (thread_name, thread_func, user_data); +#endif + + g_assert (thread); + + return thread; +} + +void +run_io_stream_test (guint deadlock_timeout, gboolean reliable, + const TestIOStreamCallbacks *callbacks, + gpointer l_user_data, GDestroyNotify l_user_data_free, + gpointer r_user_data, GDestroyNotify r_user_data_free) +{ + GMainLoop *error_loop; + GThread *l_main_thread, *r_main_thread; + GThread *l_write_thread, *l_read_thread, *r_write_thread, *r_read_thread; + TestIOStreamThreadData l_data, r_data; + GMutex mutex; + GCond cond; + guint start_count = 6; + + g_mutex_init (&mutex); + g_cond_init (&cond); + + error_loop = g_main_loop_new (NULL, FALSE); + + /* Set up data structures. */ + l_data.reliable = reliable; + l_data.error_loop = error_loop; + l_data.callbacks = callbacks; + l_data.user_data = l_user_data; + l_data.user_data_free = l_user_data_free; + + g_cond_init (&l_data.write_cond); + g_mutex_init (&l_data.write_mutex); + l_data.stream_open = FALSE; + l_data.stream_ready = FALSE; + l_data.start_mutex = &mutex; + l_data.start_cond = &cond; + l_data.start_count = &start_count; + + r_data.reliable = reliable; + r_data.error_loop = error_loop; + r_data.callbacks = callbacks; + r_data.user_data = r_user_data; + r_data.user_data_free = r_user_data_free; + + g_cond_init (&r_data.write_cond); + g_mutex_init (&r_data.write_mutex); + r_data.stream_open = FALSE; + r_data.stream_ready = FALSE; + r_data.start_mutex = &mutex; + r_data.start_cond = &cond; + r_data.start_count = &start_count; + + l_data.other = &r_data; + r_data.other = &l_data; + + /* Create the L and R agents. */ + l_data.agent = create_agent (TRUE, &l_data, + &l_data.main_context, &l_data.main_loop); + r_data.agent = create_agent (FALSE, &r_data, + &r_data.main_context, &r_data.main_loop); + + g_object_set_data (G_OBJECT (l_data.agent), "other-agent", r_data.agent); + g_object_set_data (G_OBJECT (r_data.agent), "other-agent", l_data.agent); + + /* Add a timer to catch deadlocks. */ + g_timeout_add_seconds (deadlock_timeout, timer_cb, NULL); + + l_main_thread = spawn_thread ("libnice L main", main_thread_cb, &l_data); + r_main_thread = spawn_thread ("libnice R main", main_thread_cb, &r_data); + + add_stream (l_data.agent); + add_stream (r_data.agent); + run_agent (&l_data, l_data.agent); + run_agent (&r_data, r_data.agent); + + l_read_thread = spawn_thread ("libnice L read", read_thread_cb, &l_data); + r_read_thread = spawn_thread ("libnice R read", read_thread_cb, &r_data); + + if (callbacks->write_thread != NULL) { + l_write_thread = spawn_thread ("libnice L write", write_thread_cb, &l_data); + r_write_thread = spawn_thread ("libnice R write", write_thread_cb, &r_data); + } else { + g_mutex_lock (&mutex); + start_count -= 2; + g_cond_broadcast (&cond); + g_mutex_unlock (&mutex); + + l_write_thread = NULL; + r_write_thread = NULL; + } + + /* Run loop for error timer */ + g_main_loop_run (error_loop); + + /* Clean up the main loops and threads. */ + stop_main_loop (l_data.main_loop); + stop_main_loop (r_data.main_loop); + + g_thread_join (l_read_thread); + g_thread_join (r_read_thread); + if (l_write_thread != NULL) + g_thread_join (l_write_thread); + if (r_write_thread != NULL) + g_thread_join (r_write_thread); + g_thread_join (l_main_thread); + g_thread_join (r_main_thread); + + /* Free things. */ + if (r_data.user_data_free != NULL) + r_data.user_data_free (r_data.user_data); + + if (l_data.user_data_free != NULL) + l_data.user_data_free (l_data.user_data); + + g_cond_clear (&r_data.write_cond); + g_mutex_clear (&r_data.write_mutex); + g_cond_clear (&l_data.write_cond); + g_mutex_clear (&l_data.write_mutex); + + if (r_data.io_stream != NULL) + g_object_unref (r_data.io_stream); + if (l_data.io_stream != NULL) + g_object_unref (l_data.io_stream); + + g_object_unref (r_data.agent); + g_object_unref (l_data.agent); + + g_main_loop_unref (r_data.main_loop); + g_main_loop_unref (l_data.main_loop); + + g_main_context_unref (r_data.main_context); + g_main_context_unref (l_data.main_context); + + g_main_loop_unref (error_loop); + + g_mutex_clear (&mutex); + g_cond_clear (&cond); +} + +/* Once we’ve received all the expected bytes, wait to finish sending all bytes, + * then send and wait for the close message. Finally, remove the stream. + * + * This must only be called from the read thread implementation. */ +void +check_for_termination (TestIOStreamThreadData *data, gsize *recv_count, + gsize *other_recv_count, gsize *send_count, gsize expected_recv_count) +{ + guint stream_id; + gpointer tmp; + + /* Wait for transmission to complete. */ + while (*send_count < expected_recv_count); + + /* Send a close message. */ + tmp = g_object_get_data (G_OBJECT (data->agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + + /* Can't be certain enough to test for termination on non-reliable streams. + * There may be packet losses, etc + */ + if (data->reliable) { + guint8 buf[65536]; + gsize buf_len; + gssize len; + GError *error = NULL; + + g_assert_cmpuint (*recv_count, >=, expected_recv_count); + + buf_len = strlen ("Done"); + memcpy (buf, "Done", buf_len); + len = nice_agent_send (data->agent, stream_id, 1, buf_len, (gchar *) buf); + g_assert_cmpint (len, ==, buf_len); + + /* Wait for a done packet. */ + len = nice_agent_recv (data->agent, stream_id, 1, buf, buf_len, NULL, + &error); + g_assert_no_error (error); + + g_assert_cmpint (len, ==, strlen ("Done")); + g_assert_cmpint (memcmp (buf, "Done", strlen ("Done")), ==, 0); + + *recv_count = *recv_count + 1; + } + + /* Remove the stream and run away. */ + nice_agent_remove_stream (data->agent, stream_id); + + /* If both sides have finished, quit the test main loop. */ + if (*recv_count > expected_recv_count && + *other_recv_count > expected_recv_count) { + g_main_loop_quit (data->error_loop); + } +} + +void +stop_main_loop (GMainLoop *loop) +{ + GSource *src = g_idle_source_new (); + g_source_set_callback (src, (GSourceFunc) g_main_loop_quit, + g_main_loop_ref (loop), (GDestroyNotify) g_main_loop_unref); + g_source_attach (src, g_main_loop_get_context (loop)); + g_source_unref (src); +} diff -Nru libnice-0.1.4/tests/test-io-stream-common.h libnice-0.1.7/tests/test-io-stream-common.h --- libnice-0.1.4/tests/test-io-stream-common.h 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-common.h 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,107 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +/* Make the message sufficiently large to not hit Nagle’s algorithm in the + * pseudo-TCP implementation, and hence run really slowly. */ +#define MESSAGE_SIZE 1284 /* bytes */ + +typedef struct _TestIOStreamThreadData TestIOStreamThreadData; + +typedef struct { + void (*read_thread) (GInputStream *input_stream, + TestIOStreamThreadData *data); + void (*write_thread) (GOutputStream *output_stream, + TestIOStreamThreadData *data); + void (*reliable_transport_writable) (GOutputStream *output_stream, + NiceAgent *agent, guint stream_id, guint component_id, + TestIOStreamThreadData *data); + void (*new_selected_pair) (NiceAgent *agent, guint stream_id, + guint component_id, gchar *lfoundation, gchar *rfoundation, + TestIOStreamThreadData *data); +} TestIOStreamCallbacks; + +struct _TestIOStreamThreadData { + NiceAgent *agent; + GIOStream *io_stream; + + gboolean reliable; + + GMainLoop *main_loop; + GMainLoop *error_loop; + + GMainContext *main_context; + GMainContext *write_context; + GMainContext *read_context; + + gpointer user_data; + GDestroyNotify user_data_free; + + TestIOStreamThreadData *other; + + /*< private >*/ + const TestIOStreamCallbacks *callbacks; + + /* Condition signalling for the stream being open/writeable. */ + gboolean stream_open; + gboolean stream_ready; + GCond write_cond; + GMutex write_mutex; + + GMutex *start_mutex; + GCond *start_cond; + guint *start_count; +}; + +GThread *spawn_thread (const gchar *thread_name, GThreadFunc thread_func, + gpointer user_data); +void run_io_stream_test (guint deadlock_timeout, gboolean reliable, + const TestIOStreamCallbacks *callbacks, + gpointer l_user_data, GDestroyNotify l_user_data_free, + gpointer r_user_data, GDestroyNotify r_user_data_free); +void check_for_termination (TestIOStreamThreadData *data, gsize *recv_count, + gsize *other_recv_count, gsize *send_count, gsize expected_recv_count); + +void stop_main_loop (GMainLoop *loop); diff -Nru libnice-0.1.4/tests/test-io-stream-pollable.c libnice-0.1.7/tests/test-io-stream-pollable.c --- libnice-0.1.4/tests/test-io-stream-pollable.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-pollable.c 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,186 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +typedef struct { + GMainLoop *read_loop; /* unowned */ + + gsize recv_count; + gsize *other_recv_count; + + gsize send_count; + gsize *other_send_count; +} ThreadData; + +static gboolean +read_stream_cb (GObject *pollable_stream, gpointer _user_data) +{ + TestIOStreamThreadData *data = _user_data; + ThreadData *user_data = data->user_data; + gchar expected_data[MESSAGE_SIZE]; + GError *error = NULL; + guint8 buf[MESSAGE_SIZE]; + gssize len; + + /* Try to receive some data. */ + len = g_pollable_input_stream_read_nonblocking ( + G_POLLABLE_INPUT_STREAM (pollable_stream), buf, sizeof (buf), NULL, + &error); + + if (len == -1) { + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + return TRUE; + } + + g_assert_cmpint (len, ==, MESSAGE_SIZE); + + memset (expected_data, user_data->recv_count + '1', sizeof (expected_data)); + g_assert (memcmp (buf, expected_data, sizeof (expected_data)) == 0); + + user_data->recv_count++; + + if (user_data->recv_count == 10) { + g_main_loop_quit (user_data->read_loop); + return FALSE; + } + + return TRUE; +} + +static void +read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + GMainContext *main_context; + GMainLoop *main_loop; + GSource *stream_source; + ThreadData *user_data = data->user_data; + + main_context = g_main_context_new (); + main_loop = g_main_loop_new (main_context, FALSE); + g_main_context_push_thread_default (main_context); + + stream_source = + g_pollable_input_stream_create_source ( + G_POLLABLE_INPUT_STREAM (input_stream), NULL); + + g_source_set_callback (stream_source, (GSourceFunc) read_stream_cb, + data, NULL); + g_source_attach (stream_source, main_context); + g_source_unref (stream_source); + + /* Run the main loop. */ + user_data->read_loop = main_loop; + g_main_loop_run (main_loop); + + g_main_context_pop_thread_default (main_context); + g_main_loop_unref (main_loop); + g_main_context_unref (main_context); + + check_for_termination (data, &user_data->recv_count, + user_data->other_recv_count, &user_data->send_count, 10); +} + +static void +write_thread_cb (GOutputStream *output_stream, TestIOStreamThreadData *data) +{ + ThreadData *user_data = data->user_data; + guint8 buf[MESSAGE_SIZE]; + + for (user_data->send_count = 0; + user_data->send_count < 10; + user_data->send_count++) { + GError *error = NULL; + + memset (buf, user_data->send_count + '1', MESSAGE_SIZE); + + g_pollable_output_stream_write_nonblocking ( + G_POLLABLE_OUTPUT_STREAM (output_stream), buf, sizeof (buf), NULL, + &error); + g_assert_no_error (error); + } +} + +int main (void) +{ + ThreadData *l_data, *r_data; + + const TestIOStreamCallbacks callbacks = { + read_thread_cb, + write_thread_cb, + NULL, + NULL, + }; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + g_type_init (); + g_thread_init (NULL); + + l_data = g_malloc0 (sizeof (ThreadData)); + r_data = g_malloc0 (sizeof (ThreadData)); + + l_data->recv_count = 0; + l_data->send_count = 0; + l_data->other_recv_count = &r_data->recv_count; + l_data->other_send_count = &r_data->send_count; + + r_data->recv_count = 0; + r_data->send_count = 0; + r_data->other_recv_count = &l_data->recv_count; + r_data->other_send_count = &l_data->send_count; + + run_io_stream_test (30, TRUE, &callbacks, l_data, NULL, r_data, NULL); + + g_free (r_data); + g_free (l_data); + +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + return 0; +} diff -Nru libnice-0.1.4/tests/test-io-stream-thread.c libnice-0.1.7/tests/test-io-stream-thread.c --- libnice-0.1.4/tests/test-io-stream-thread.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-io-stream-thread.c 2014-03-07 01:21:05.000000000 +0000 @@ -0,0 +1,160 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2013 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +typedef struct { + guint cand_count; + guint *other_cand_count; + + gsize recv_count; + gsize *other_recv_count; + + gsize send_count; + gsize *other_send_count; +} ThreadData; + +static void +read_thread_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + ThreadData *user_data = data->user_data; + + for (user_data->recv_count = 0; + user_data->recv_count < 10; + user_data->recv_count++) { + guint8 expected_data[MESSAGE_SIZE]; + GError *error = NULL; + guint8 buf[MESSAGE_SIZE]; + gssize len; + + /* Block on receiving some data. */ + len = g_input_stream_read (input_stream, buf, sizeof (buf), NULL, &error); + g_assert_no_error (error); + g_assert_cmpint (len, ==, sizeof (buf)); + + memset (expected_data, user_data->recv_count + '1', sizeof (expected_data)); + g_assert (memcmp (buf, expected_data, sizeof (expected_data)) == 0); + } + + check_for_termination (data, &user_data->recv_count, + user_data->other_recv_count, &user_data->send_count, 10); +} + +static void +new_selected_pair_cb (NiceAgent *agent, guint stream_id, guint component_id, + gchar *lfoundation, gchar *rfoundation, TestIOStreamThreadData *data) +{ + ThreadData *user_data = data->user_data; + + g_atomic_int_inc (&user_data->cand_count); +} + +static void +write_thread_cb (GOutputStream *output_stream, TestIOStreamThreadData *data) +{ + ThreadData *user_data = data->user_data; + guint8 buf[MESSAGE_SIZE]; + + for (user_data->send_count = 0; + user_data->send_count < 10; + user_data->send_count++) { + GError *error = NULL; + + memset (buf, user_data->send_count + '1', MESSAGE_SIZE); + + g_output_stream_write (output_stream, buf, sizeof (buf), NULL, &error); + g_assert_no_error (error); + } +} + +int main (void) +{ + ThreadData *l_data, *r_data; + + const TestIOStreamCallbacks callbacks = { + read_thread_cb, + write_thread_cb, + NULL, + new_selected_pair_cb, + }; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + g_type_init (); + g_thread_init (NULL); + + l_data = g_malloc0 (sizeof (ThreadData)); + r_data = g_malloc0 (sizeof (ThreadData)); + + l_data->cand_count = 0; + l_data->other_cand_count = &r_data->cand_count; + l_data->recv_count = 0; + l_data->other_recv_count = &r_data->recv_count; + l_data->send_count = 0; + l_data->other_send_count = &r_data->send_count; + + r_data->cand_count = 0; + r_data->other_cand_count = &l_data->cand_count; + r_data->recv_count = 0; + r_data->other_recv_count = &l_data->recv_count; + r_data->send_count = 0; + r_data->other_send_count = &l_data->send_count; + + run_io_stream_test (30, TRUE, &callbacks, l_data, NULL, r_data, NULL); + + /* Verify that correct number of local candidates were reported. */ + g_assert (l_data->cand_count == 1); + g_assert (r_data->cand_count == 1); + + g_free (r_data); + g_free (l_data); + +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + return 0; +} diff -Nru libnice-0.1.4/tests/test-mainloop.c libnice-0.1.7/tests/test-mainloop.c --- libnice-0.1.4/tests/test-mainloop.c 2012-01-16 23:05:14.000000000 +0000 +++ libnice-0.1.7/tests/test-mainloop.c 2014-03-07 01:21:05.000000000 +0000 @@ -73,9 +73,7 @@ nice_address_init (&addr); g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init(NULL); -#endif loop = g_main_loop_new (NULL, FALSE); diff -Nru libnice-0.1.4/tests/test-new-dribble.c libnice-0.1.7/tests/test-new-dribble.c --- libnice-0.1.4/tests/test-new-dribble.c 2012-09-20 18:05:54.000000000 +0000 +++ libnice-0.1.7/tests/test-new-dribble.c 2014-05-02 21:49:50.000000000 +0000 @@ -52,7 +52,6 @@ #include "agent-priv.h" #include "agent.h" -#define IPPORT_STUN 3456 #define USE_UPNP 0 #define LEFT_AGENT GINT_TO_POINTER(1) #define RIGHT_AGENT GINT_TO_POINTER(2) @@ -73,15 +72,18 @@ static GCond *stun_thread_signal_ptr = &stun_thread_signal; #endif -static GMainLoop *global_mainloop; static NiceComponentState global_lagent_state = NICE_COMPONENT_STATE_LAST; static NiceComponentState global_ragent_state = NICE_COMPONENT_STATE_LAST; +static GCancellable *global_cancellable; static gboolean exit_stun_thread = FALSE; static gboolean lagent_candidate_gathering_done = FALSE; static gboolean ragent_candidate_gathering_done = FALSE; static guint global_ls_id, global_rs_id; static gboolean data_received = FALSE; static gboolean drop_stun_packets = FALSE; +static gboolean got_stun_packet = FALSE; +static gboolean send_stun = FALSE; +static guint stun_port; static const uint16_t known_attributes[] = { 0 @@ -90,9 +92,12 @@ /* * Creates a listening socket */ -static int listen_socket (unsigned int port) +static int listen_socket (unsigned int *port) { - struct sockaddr_in addr; + union { + struct sockaddr_in in; + struct sockaddr addr; + } addr; int fd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd == -1) { @@ -101,15 +106,26 @@ } memset (&addr, 0, sizeof (addr)); - addr.sin_family = AF_INET; - inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr); - addr.sin_port = htons(port); + addr.in.sin_family = AF_INET; + inet_pton(AF_INET, "127.0.0.1", &addr.in.sin_addr); + addr.in.sin_port = 0; - if (bind (fd, (struct sockaddr *)&addr, sizeof (struct sockaddr_in))) { + if (bind (fd, &addr.addr, sizeof (struct sockaddr_in))) { perror ("Error opening IP port"); goto error; } + if (port) { + socklen_t socklen = sizeof(addr); + + if (getsockname (fd, &addr.addr, &socklen) < 0) + g_error ("getsockname failed: %s", strerror (errno)); + + g_assert (socklen == sizeof(struct sockaddr_in)); + *port = ntohs (addr.in.sin_port); + g_assert (*port != 0); + } + return fd; error: @@ -119,7 +135,10 @@ static int dgram_process (int sock, StunAgent *oldagent, StunAgent *newagent) { - struct sockaddr_storage addr; + union { + struct sockaddr_storage storage; + struct sockaddr addr; + } addr; socklen_t addr_len; uint8_t buf[STUN_MAX_MESSAGE_SIZE]; size_t buf_len = 0; @@ -134,7 +153,7 @@ recv_packet: len = recvfrom (sock, buf, sizeof(buf), 0, - (struct sockaddr *)&addr, &addr_len); + &addr.addr, &addr_len); if (drop_stun_packets) { g_debug ("Dropping STUN packet as requested"); @@ -173,12 +192,20 @@ if (stun_message_has_cookie (&request)) stun_message_append_xor_addr (&response, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addr_len); + &addr.storage, addr_len); else stun_message_append_addr (&response, STUN_ATTRIBUTE_MAPPED_ADDRESS, - (struct sockaddr *)&addr, addr_len); + &addr.addr, addr_len); break; + case STUN_SHARED_SECRET: + case STUN_ALLOCATE: + case STUN_SET_ACTIVE_DST: + case STUN_CONNECT: + case STUN_OLD_SET_ACTIVE_DST: + case STUN_IND_DATA: + case STUN_IND_CONNECT_STATUS: + case STUN_CHANNELBIND: default: if (!stun_agent_init_error (agent, &response, buf, sizeof (buf), &request, STUN_ERROR_BAD_REQUEST)) { @@ -190,16 +217,17 @@ buf_len = stun_agent_finish_message (agent, &response, NULL, 0); send_buf: - g_main_loop_quit (global_mainloop); + g_cancellable_cancel (global_cancellable); g_debug ("Ready to send a STUN response"); g_assert (g_mutex_trylock (stun_mutex_ptr)); - while (global_lagent_state < NICE_COMPONENT_STATE_CONNECTING) { + got_stun_packet = TRUE; + while (send_stun) { g_debug ("Waiting for signal. State is %d", global_lagent_state); g_cond_wait (stun_signal_ptr, stun_mutex_ptr); } g_mutex_unlock (stun_mutex_ptr); len = sendto (sock, buf, buf_len, 0, - (struct sockaddr *)&addr, addr_len); + &addr.addr, addr_len); g_debug ("STUN response sent"); drop_stun_packets = TRUE; ret = (len < buf_len) ? -1 : 0; @@ -211,15 +239,9 @@ { StunAgent oldagent; StunAgent newagent; - int sock; + int sock = GPOINTER_TO_INT (user_data); int exit_code = -1; - sock = listen_socket (IPPORT_STUN); - - if (sock == -1) { - g_assert_not_reached (); - } - g_mutex_lock (stun_thread_mutex_ptr); g_cond_signal (stun_thread_signal_ptr); g_mutex_unlock (stun_thread_mutex_ptr); @@ -268,7 +290,7 @@ g_debug ("ragent finished gathering candidates"); ragent_candidate_gathering_done = TRUE; } - g_main_loop_quit(global_mainloop); + g_cancellable_cancel (global_cancellable); } static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, guint len, gchar *buf, gpointer user_data) @@ -285,7 +307,7 @@ g_debug ("test-dribblemode:%s: ragent recieved %d bytes : quit mainloop", G_STRFUNC, len); data_received = TRUE; - g_main_loop_quit (global_mainloop); + g_cancellable_cancel (global_cancellable); } } @@ -306,9 +328,10 @@ if (GPOINTER_TO_UINT(data) == 1 && state == NICE_COMPONENT_STATE_FAILED) { g_debug ("Signalling STUN response since connchecks failed"); g_mutex_lock (stun_mutex_ptr); + send_stun = TRUE; g_cond_signal (stun_signal_ptr); g_mutex_unlock (stun_mutex_ptr); - g_main_loop_quit (global_mainloop); + g_cancellable_cancel (global_cancellable); } if(GPOINTER_TO_UINT(data) == 1 && state == NICE_COMPONENT_STATE_READY) { @@ -332,6 +355,7 @@ if (signal_stun_reply) { g_mutex_lock (stun_mutex_ptr); + send_stun = TRUE; g_cond_signal (stun_signal_ptr); g_mutex_unlock (stun_mutex_ptr); } @@ -430,12 +454,14 @@ } data_received = FALSE; + got_stun_packet = FALSE; + send_stun = FALSE; nice_agent_attach_recv (lagent, global_ls_id, NICE_COMPONENT_TYPE_RTP, - g_main_loop_get_context(global_mainloop), + g_main_context_default (), cb_nice_recv, LEFT_AGENT); nice_agent_attach_recv (ragent, global_rs_id, NICE_COMPONENT_TYPE_RTP, - g_main_loop_get_context(global_mainloop), + g_main_context_default (), cb_nice_recv, RIGHT_AGENT); } @@ -451,18 +477,20 @@ { g_debug ("test-dribblemode:%s", G_STRFUNC); + got_stun_packet = FALSE; init_test (lagent, ragent, FALSE); nice_agent_gather_candidates (lagent, global_ls_id); - g_main_loop_run (global_mainloop); + while (!got_stun_packet) + g_main_context_iteration (NULL, TRUE); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); - if (!ragent_candidate_gathering_done) { - g_main_loop_run (global_mainloop); - g_assert (ragent_candidate_gathering_done); - } + while (!ragent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); + g_assert (ragent_candidate_gathering_done); set_credentials (lagent, global_ls_id, ragent, global_rs_id); @@ -471,7 +499,9 @@ lagent, global_ls_id, TRUE); - g_main_loop_run (global_mainloop); + while (!data_received) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (global_lagent_state >= NICE_COMPONENT_STATE_CONNECTED && data_received); @@ -479,7 +509,9 @@ swap_candidates (lagent, global_ls_id, ragent, global_rs_id, FALSE); - g_main_loop_run (global_mainloop); + while (!lagent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (lagent_candidate_gathering_done); @@ -501,21 +533,24 @@ "wrong2", "wrong2"); nice_agent_gather_candidates (lagent, global_ls_id); - g_main_loop_run (global_mainloop); + while (!got_stun_packet) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); - if (!ragent_candidate_gathering_done) { - g_main_loop_run (global_mainloop); - g_assert (ragent_candidate_gathering_done); - } + while (!ragent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); + g_assert (ragent_candidate_gathering_done); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); - g_main_loop_run (global_mainloop); - g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED); + while (global_lagent_state != NICE_COMPONENT_STATE_FAILED) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); // Set the correct credentials and swap candidates set_credentials (lagent, global_ls_id, ragent, global_rs_id); @@ -527,14 +562,19 @@ ragent, global_rs_id, FALSE); - g_main_loop_run (global_mainloop); + while (!data_received) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (data_received); g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); // Wait for lagent to finish gathering candidates - g_main_loop_run (global_mainloop); + while (!lagent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); + g_assert (lagent_candidate_gathering_done); cleanup (lagent, ragent); @@ -549,23 +589,30 @@ init_test (lagent, ragent, FALSE); nice_agent_gather_candidates (lagent, global_ls_id); - g_main_loop_run (global_mainloop); + while (!got_stun_packet) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); - if (!ragent_candidate_gathering_done) { - g_main_loop_run (global_mainloop); - g_assert (ragent_candidate_gathering_done); - } + while (!ragent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); + + g_assert (ragent_candidate_gathering_done); add_bad_candidate (lagent, global_ls_id, cand); // lagent will finish candidate gathering causing this mainloop to quit - g_main_loop_run (global_mainloop); + while (!lagent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); // connchecks will fail causing this mainloop to quit - g_main_loop_run (global_mainloop); + while (global_lagent_state != NICE_COMPONENT_STATE_FAILED) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED && !data_received); @@ -579,11 +626,13 @@ ragent, global_rs_id, FALSE); - g_main_loop_run (global_mainloop); + while (!data_received) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (lagent_candidate_gathering_done); - g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY); + g_assert (global_lagent_state >= NICE_COMPONENT_STATE_CONNECTED); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); cleanup (lagent, ragent); @@ -597,26 +646,34 @@ set_credentials (lagent, global_ls_id, ragent, global_rs_id); nice_agent_gather_candidates (lagent, global_ls_id); - g_main_loop_run (global_mainloop); + while (!got_stun_packet) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); - if (!ragent_candidate_gathering_done) { - g_main_loop_run (global_mainloop); - } + while (!ragent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); // Wait for data - g_main_loop_run (global_mainloop); + while (!data_received) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (data_received); // Data arrived, signal STUN thread to send STUN response g_mutex_lock (stun_mutex_ptr); + send_stun = TRUE; g_cond_signal (stun_signal_ptr); g_mutex_unlock (stun_mutex_ptr); // Wait for lagent to finish gathering candidates - g_main_loop_run (global_mainloop); + while (!lagent_candidate_gathering_done || + !lagent_candidate_gathering_done) + g_main_context_iteration (NULL, TRUE); + g_cancellable_reset (global_cancellable); g_assert (lagent_candidate_gathering_done); g_assert (ragent_candidate_gathering_done); @@ -629,17 +686,20 @@ static void send_dummy_data(void) { - int sockfd = listen_socket (4567); - struct sockaddr_in addr; + int sockfd = listen_socket (NULL); + union { + struct sockaddr_in in; + struct sockaddr addr; + } addr; memset (&addr, 0, sizeof (addr)); - addr.sin_family = AF_INET; - inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr); - addr.sin_port = htons (IPPORT_STUN); + addr.in.sin_family = AF_INET; + inet_pton(AF_INET, "127.0.0.1", &addr.in.sin_addr); + addr.in.sin_port = htons (stun_port); g_debug ("Sending dummy data to close STUN thread"); sendto (sockfd, "close socket", 12, 0, - (struct sockaddr *)&addr, sizeof (addr)); + &addr.addr, sizeof (addr)); } int main(void) @@ -647,21 +707,33 @@ NiceAgent *lagent = NULL, *ragent = NULL; GThread *stun_thread = NULL; NiceAddress baseaddr; + GSource *src; + int sock; g_type_init(); - global_mainloop = g_main_loop_new (NULL, FALSE); + global_cancellable = g_cancellable_new (); + src = g_cancellable_source_new (global_cancellable); + g_source_set_dummy_callback (src); + g_source_attach (src, NULL); + g_source_unref (src); + + sock = listen_socket (&stun_port); + + if (sock == -1) { + g_assert_not_reached (); + } + #if !GLIB_CHECK_VERSION(2,31,8) g_thread_init (NULL); - stun_thread = g_thread_create (stun_thread_func, - global_mainloop, - TRUE, NULL); + stun_thread = g_thread_create (stun_thread_func, GINT_TO_POINTER (sock), + TRUE, NULL); stun_mutex_ptr = g_mutex_new (); stun_signal_ptr = g_cond_new (); #else stun_thread = g_thread_new ("listen for STUN requests", - stun_thread_func, NULL); + stun_thread_func, GINT_TO_POINTER (sock)); #endif // Once the the thread is forked, we want to listen for a signal @@ -669,10 +741,8 @@ g_mutex_lock (stun_thread_mutex_ptr); g_cond_wait (stun_thread_signal_ptr, stun_thread_mutex_ptr); - lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), - NICE_COMPATIBILITY_RFC5245); - ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), - NICE_COMPATIBILITY_RFC5245); + lagent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245); + ragent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245); g_object_set (G_OBJECT (lagent), "controlling-mode", TRUE, NULL); g_object_set (G_OBJECT (ragent), "controlling-mode", FALSE, NULL); @@ -681,7 +751,7 @@ g_object_set (G_OBJECT (ragent), "upnp", USE_UPNP, NULL); g_object_set (G_OBJECT (lagent), "stun-server", "127.0.0.1", NULL); - g_object_set (G_OBJECT (lagent), "stun-server-port", IPPORT_STUN, NULL); + g_object_set (G_OBJECT (lagent), "stun-server-port", stun_port, NULL); g_object_set_data (G_OBJECT (lagent), "other-agent", ragent); g_object_set_data (G_OBJECT (ragent), "other-agent", lagent); @@ -717,7 +787,7 @@ g_mutex_free (stun_mutex_ptr); g_cond_free (stun_signal_ptr); #endif - g_main_loop_unref (global_mainloop); + g_object_unref (global_cancellable); return 0; } diff -Nru libnice-0.1.4/tests/test-pseudotcp.c libnice-0.1.7/tests/test-pseudotcp.c --- libnice-0.1.4/tests/test-pseudotcp.c 2011-09-08 01:01:53.000000000 +0000 +++ libnice-0.1.7/tests/test-pseudotcp.c 2014-03-31 23:20:03.000000000 +0000 @@ -52,29 +52,37 @@ int total_wrote = 0; guint left_clock = 0; guint right_clock = 0; +gboolean left_closed; +gboolean right_closed; + +gboolean reading_done = FALSE; static void adjust_clock (PseudoTcpSocket *sock); static void write_to_sock (PseudoTcpSocket *sock) { gchar buf[1024]; - guint len; - guint wlen; + gsize len; + gint wlen; guint total = 0; while (TRUE) { len = fread (buf, 1, sizeof(buf), in); if (len == 0) { g_debug ("Done reading data from file"); + g_assert (feof (in)); + reading_done = TRUE; pseudo_tcp_socket_close (sock, FALSE); break; } else { wlen = pseudo_tcp_socket_send (sock, buf, len); - g_debug ("Sending %d bytes : %d", len, wlen); + g_debug ("Sending %" G_GSIZE_FORMAT " bytes : %d", len, wlen); total += wlen; total_read += wlen; - if (wlen < len) { + if (wlen < (gint) len) { + g_debug ("seeking %ld from %lu", wlen - len, ftell (in)); fseek (in, wlen - len, SEEK_CUR); + g_assert (!feof (in)); g_debug ("Socket queue full after %d bytes written", total); break; } @@ -91,6 +99,7 @@ write_to_sock (sock); else { pseudo_tcp_socket_send (sock, "abcdefghijklmnopqrstuvwxyz", 26); + reading_done = TRUE; pseudo_tcp_socket_close (sock, FALSE); } } @@ -113,16 +122,16 @@ else { total_wrote += len; + g_assert (total_wrote <= total_read); g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read); - if (total_wrote >= total_read && feof (in)) { - pseudo_tcp_socket_close (left, FALSE); - pseudo_tcp_socket_close (right, FALSE); + if (total_wrote == total_read && feof (in)) { + g_assert (reading_done); + pseudo_tcp_socket_close (sock, FALSE); } } } else { if (len == 26 && strncmp (buf, "abcdefghijklmnopqrstuvwxyz", len) == 0) { - pseudo_tcp_socket_close (left, FALSE); - pseudo_tcp_socket_close (right, FALSE); + pseudo_tcp_socket_close (sock, FALSE); } else { g_debug ("Error reading data.. read %d bytes : %s", len, buf); exit (-1); @@ -137,41 +146,38 @@ pseudo_tcp_socket_get_error (sock)); exit (-1); } - - adjust_clock (sock); } static void writable (PseudoTcpSocket *sock, gpointer data) { g_debug ("Socket %p Writable", sock); - if (in) + if (in && sock == left) write_to_sock (sock); } static void closed (PseudoTcpSocket *sock, guint32 err, gpointer data) { - g_debug ("Socket %p Closed : %d", sock, err); + g_error ("Socket %p Closed : %d", sock, err); } struct notify_data { PseudoTcpSocket *sock; - gchar *buffer; guint32 len; + gchar buffer[]; }; static gboolean notify_packet (gpointer user_data) { struct notify_data *data = (struct notify_data*) user_data; - if (!data->sock || (data->sock != left && data->sock != right)) - return FALSE; + pseudo_tcp_socket_notify_packet (data->sock, data->buffer, data->len); adjust_clock (data->sock); - g_free (data->buffer); + g_free (data); return FALSE; } -static PseudoTcpWriteResult write (PseudoTcpSocket *sock, +static PseudoTcpWriteResult write_packet (PseudoTcpSocket *sock, const gchar *buffer, guint32 len, gpointer user_data) { struct notify_data *data; @@ -180,23 +186,22 @@ g_object_get (sock, "state", &state, NULL); if (drop_rate < 5) { - g_debug ("*********************Dropping packet (%d)", drop_rate); + g_debug ("*********************Dropping packet (%d) from %p", drop_rate, + sock); return WR_SUCCESS; } - data = g_new0 (struct notify_data,1); + data = g_malloc (sizeof(struct notify_data) + len); g_debug ("Socket %p(%d) Writing : %d bytes", sock, state, len); - data->buffer = g_malloc (len); memcpy (data->buffer, buffer, len); data->len = len; - if (sock == left) { + if (sock == left) data->sock = right; - } else { + else data->sock = left; - } g_idle_add (notify_packet, data); @@ -207,8 +212,6 @@ static gboolean notify_clock (gpointer data) { PseudoTcpSocket *sock = (PseudoTcpSocket *)data; - if (sock != left && sock != right) - return FALSE; //g_debug ("Socket %p: Notifying clock", sock); pseudo_tcp_socket_notify_clock (sock); adjust_clock (sock); @@ -217,9 +220,11 @@ static void adjust_clock (PseudoTcpSocket *sock) { - long timeout = 0; + guint64 timeout = 0; + if (pseudo_tcp_socket_get_next_clock (sock, &timeout)) { - //g_debug ("Socket %p: Adjuting clock to %ld ms", sock, timeout); + timeout -= g_get_monotonic_time () / 1000; + g_debug ("Socket %p: Adjuting clock to %ld ms", sock, timeout); if (sock == left) { if (left_clock != 0) g_source_remove (left_clock); @@ -230,13 +235,12 @@ right_clock = g_timeout_add (timeout, notify_clock, sock); } } else { - g_debug ("Socket %p should be destroyed", sock); - g_object_unref (sock); + g_debug ("Socket %p should be destroyed, it's done", sock); if (sock == left) - left = NULL; + left_closed = TRUE; else - right = NULL; - if (left == right) + right_closed = TRUE; + if (left_closed && right_closed) g_main_loop_quit (mainloop); } } @@ -244,7 +248,9 @@ int main (int argc, char *argv[]) { - PseudoTcpCallbacks cbs = {NULL, opened, readable, writable, closed, write}; + PseudoTcpCallbacks cbs = { + NULL, opened, readable, writable, closed, write_packet + }; mainloop = g_main_loop_new (NULL, FALSE); @@ -252,6 +258,8 @@ pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE); + left_closed = right_closed = FALSE; + left = pseudo_tcp_socket_new (0, &cbs); right = pseudo_tcp_socket_new (0, &cbs); g_debug ("Left: %p. Right: %p", left, right); @@ -270,6 +278,9 @@ g_main_loop_run (mainloop); + g_object_unref (left); + g_object_unref (right); + if (in) fclose (in); if (out) diff -Nru libnice-0.1.4/tests/test-pseudotcp-fuzzy.c libnice-0.1.7/tests/test-pseudotcp-fuzzy.c --- libnice-0.1.4/tests/test-pseudotcp-fuzzy.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-pseudotcp-fuzzy.c 2014-04-17 22:14:51.000000000 +0000 @@ -0,0 +1,467 @@ +/* vim: et ts=2 sw=2 tw=80: */ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2010, 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * Youness Alaoui, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "pseudotcp.h" + + +/** + * A fuzzing test for the pseudotcp socket. This connects two sockets in a + * loopback arrangement, with the packet output from one being fed to the other, + * and vice-versa. Fuzzing happens on the packet interface between the two, + * mutating the packets slightly and seeing what happens. + * + * The input data to the left-most socket is read from a file. The output data + * from the loopback is written to another file, although this probably isn’t + * very useful. If no files are provided, a small amount of dummy data is sent + * through the sockets instead. This almost certainly won’t catch any bugs, and + * is just present to allow this test to be run as part of `make check` so it + * doesn’t bit rot. + * + * A good command to generate an input file is: + * dd if=/dev/urandom of=rand count=10000 ibs=1024 + * + * None of the data is validated, and the test results are effectively the 1-bit + * value of ‘did it crash?’. In particular, the output file is not validated, + * and the TCP packets emitted by both sockets are not checked for validity. + * + * It is suggested that this test is run under GDB and Valgrind. Any crashes or + * errors which are detected can be reproduced by providing the same input file + * and seed (using the --seed option). The seed is printed out at the beginning + * of each test run. + */ + + +PseudoTcpSocket *left; +PseudoTcpSocket *right; +GMainLoop *main_loop = NULL; +GRand *prng = NULL; +gint retval = 0; +FILE *in = NULL; +FILE *out = NULL; +int total_read = 0; +int total_wrote = 0; +guint left_clock = 0; +guint right_clock = 0; +gboolean left_closed = FALSE; +gboolean right_closed = FALSE; +gboolean reading_done = FALSE; + +/* Number of bytes of payload each socket has received so far. */ +guint32 left_stream_pos = 0; +guint32 right_stream_pos = 0; + +/* Configuration options. */ +gint64 seed = 0; +guint32 fuzz_start_pos = 1; /* bytes into stream payload; after the SYN-ACKs */ +guint n_changes_lambda = 2; /* lambda parameter for a Poisson distribution + * controlling the number of mutations made to each + * packet */ + + +static void +adjust_clock (PseudoTcpSocket *sock); + + +static void +write_to_sock (PseudoTcpSocket *sock) +{ + gchar buf[1024]; + gsize len; + gint wlen; + guint total = 0; + + while (TRUE) { + len = fread (buf, 1, sizeof(buf), in); + if (len == 0) { + g_debug ("Done reading data from file"); + g_assert (feof (in)); + reading_done = TRUE; + pseudo_tcp_socket_close (sock, FALSE); + break; + } else { + wlen = pseudo_tcp_socket_send (sock, buf, len); + g_debug ("Sending %" G_GSIZE_FORMAT " bytes : %d", len, wlen); + total += wlen; + total_read += wlen; + if (wlen < (gint) len) { + g_debug ("seeking %ld from %lu", wlen - len, ftell (in)); + fseek (in, wlen - len, SEEK_CUR); + g_assert (!feof (in)); + g_debug ("Socket queue full after %d bytes written", total); + break; + } + } + } + adjust_clock (sock); +} + +static void +opened (PseudoTcpSocket *sock, gpointer data) +{ + g_debug ("Socket %p Opened", sock); + if (sock == left) { + if (in) + write_to_sock (sock); + else { + pseudo_tcp_socket_send (sock, "abcdefghijklmnopqrstuvwxyz", 26); + reading_done = TRUE; + pseudo_tcp_socket_close (sock, FALSE); + } + } +} + +static void +readable (PseudoTcpSocket *sock, gpointer data) +{ + gchar buf[1024]; + gint len; + g_debug ("Socket %p Readable", sock); + + do { + len = pseudo_tcp_socket_recv (sock, buf, sizeof(buf)); + + if (len > 0) { + g_debug ("Read %d bytes", len); + if (out) { + if (fwrite (buf, len, 1, out) == 0) + g_debug ("Error writing to output file"); + else { + total_wrote += len; + + g_assert (total_wrote <= total_read); + g_debug ("Written %d bytes, need %d bytes", total_wrote, total_read); + if (total_wrote == total_read && feof (in)) { + g_assert (reading_done); + pseudo_tcp_socket_close (sock, FALSE); + } + } + } else { + pseudo_tcp_socket_close (sock, FALSE); + } + } + } while (len > 0); + + if (len == -1 && + pseudo_tcp_socket_get_error (sock) != EWOULDBLOCK) { + g_printerr ("Error reading from socket: error code %d.\n", + pseudo_tcp_socket_get_error (sock)); + + retval = -1; + g_main_loop_quit (main_loop); + return; + } +} + +static void +writable (PseudoTcpSocket *sock, gpointer data) +{ + g_debug ("Socket %p Writable", sock); + if (in && sock == left) + write_to_sock (sock); +} + +static void +closed (PseudoTcpSocket *sock, guint32 err, gpointer data) +{ + /* Don’t treat this as an error, since we’re throwing rubbish into the + * socket and can hardly expect it to complete successfully. */ + g_debug ("Socket %p Closed : %d", sock, err); + retval = 0; + g_main_loop_quit (main_loop); +} + +struct notify_data { + PseudoTcpSocket *sock; + guint32 len; + guint32 stream_pos; + guint8 buffer[]; +}; + +/** + * random_int_poisson: + * @lambda: Lambda parameter for the distribution function, which must be + * non-zero + * + * Generate a random variable from a Poisson distribution with parameter + * @lambda. This consumes one %gdouble’s worth of randomness from the global + * @prng. + * + * This is implemented using the inverse transform of the Poisson CDF, and is + * guaranteed to return in time linearly proportional to @lambda. + * + * Returns: Poisson-distributed pseudo-random variable + */ +static guint32 +random_int_poisson (guint lambda) +{ + gdouble U; + guint32 i; + gdouble p, F; + + g_return_val_if_fail (lambda > 0, 0); + + /* + * Reference: http://www.cs.bgu.ac.il/~mps042/invtransnote.htm, + * §Simulating a Poisson random variable. + */ + U = g_rand_double (prng); /* step 1 */ + i = 0; + p = exp (0.0 - (gdouble) lambda); + F = p; /* step 2 */ + + while (U >= F) { /* step 3 */ + p = (lambda * p) / (i + 1); + F += p; + i += 1; /* step 4 and 5 */ + } + + return i; +} + +static guint32 +fuzz_packet (guint8 *buf, guint32 len, guint32 stream_pos) +{ + guint32 i; + guint n_changes; +#define TCP_HEADER_LENGTH 32 /* bytes; or thereabouts (include some options) */ + + /* Do we want to fuzz this packet? */ + if (stream_pos < fuzz_start_pos) { + return len; + } + + /* Get fuzzing. Only bother fuzzing the header; fuzzing the payload is + * pointless. Weight the number of changes towards having only a few changes, + * since that makes them less likely to be summarily rejected. */ + n_changes = random_int_poisson (n_changes_lambda); + g_debug ("Making %u changes for bytes at stream position %u:", + n_changes, stream_pos); + + for (i = 0; i < n_changes; i++) { + guint32 pos = g_rand_int_range (prng, 0, MIN (len, TCP_HEADER_LENGTH)); + g_debug (" • Changing byte %u.", stream_pos + pos); + buf[pos] = g_rand_int_range (prng, 0, G_MAXUINT8 + 1); + } + + return len; +} + +static gboolean +notify_packet (gpointer user_data) +{ + struct notify_data *data = (struct notify_data*) user_data; + + /* Fuzz the packet. */ + data->len = fuzz_packet (data->buffer, data->len, data->stream_pos); + + pseudo_tcp_socket_notify_packet (data->sock, + (gchar *) data->buffer, data->len); + adjust_clock (data->sock); + + g_free (data); + return FALSE; +} + +static PseudoTcpWriteResult +write_packet (PseudoTcpSocket *sock, const gchar *buffer, guint32 len, + gpointer user_data) +{ + struct notify_data *data; + PseudoTcpState state; + g_object_get (sock, "state", &state, NULL); + + data = g_malloc (sizeof(struct notify_data) + len); + + g_debug ("Socket %p(%d) Writing : %d bytes", sock, state, len); + + memcpy (data->buffer, buffer, len); + data->len = len; + + if (sock == left) { + data->stream_pos = left_stream_pos; + left_stream_pos += len; + data->sock = right; + } else { + data->stream_pos = right_stream_pos; + right_stream_pos += len; + data->sock = left; + } + + g_idle_add (notify_packet, data); + + return WR_SUCCESS; +} + + +static gboolean notify_clock (gpointer data) +{ + PseudoTcpSocket *sock = (PseudoTcpSocket *)data; + //g_debug ("Socket %p: Notifying clock", sock); + pseudo_tcp_socket_notify_clock (sock); + adjust_clock (sock); + return FALSE; +} + +static void adjust_clock (PseudoTcpSocket *sock) +{ + guint64 timeout = 0; + + if (pseudo_tcp_socket_get_next_clock (sock, &timeout)) { + timeout -= g_get_monotonic_time () / 1000; + g_debug ("Socket %p: Adjusting clock to %ld ms", sock, timeout); + if (sock == left) { + if (left_clock != 0) + g_source_remove (left_clock); + left_clock = g_timeout_add (timeout, notify_clock, sock); + } else { + if (right_clock != 0) + g_source_remove (right_clock); + right_clock = g_timeout_add (timeout, notify_clock, sock); + } + } else { + g_debug ("Socket %p should be destroyed, it's done", sock); + if (sock == left) + left_closed = TRUE; + else + right_closed = TRUE; + if (left_closed && right_closed) + g_main_loop_quit (main_loop); + } +} + +static GOptionEntry entries[] = { + { "seed", 's', 0, G_OPTION_ARG_INT64, &seed, "PRNG seed", "N" }, + { "fuzz-start-position", 'p', 0, G_OPTION_ARG_INT, &fuzz_start_pos, + "Number of bytes into the stream to start fuzzing after", "B" }, + { "fuzz-n-changes-lambda", 'l', 0, G_OPTION_ARG_INT, &n_changes_lambda, + "Lambda value for the Poisson distribution controlling the number of " + "changes made to each packet", "λ" }, + { NULL } +}; + +int main (int argc, char *argv[]) +{ + PseudoTcpCallbacks cbs = { + NULL, opened, readable, writable, closed, write_packet + }; + GOptionContext *context; + GError *error = NULL; + + setlocale (LC_ALL, ""); + g_type_init (); + + /* Configuration. */ + context = g_option_context_new ("— fuzz-test the pseudotcp socket"); + g_option_context_add_main_entries (context, entries, NULL); + + if (!g_option_context_parse (context, &argc, &argv, &error)) { + g_printerr ("Option parsing failed: %s\n", error->message); + goto context_error; + } + + if (n_changes_lambda == 0) { + g_printerr ("Option parsing failed: %s\n", + "Lambda values must be positive."); + goto context_error; + } + + g_option_context_free (context); + + /* Tweak the configuration. */ + if (seed == 0) { + seed = g_get_real_time (); + } + + /* Open the input and output files */ + if (argc >= 3) { + in = fopen (argv[1], "r"); + out = fopen (argv[2], "w"); + } + + /* Set up the main loop and sockets. */ + main_loop = g_main_loop_new (NULL, FALSE); + + g_print ("Using seed: %" G_GINT64_FORMAT ", start position: %u, λ: %u\n", + seed, fuzz_start_pos, n_changes_lambda); + prng = g_rand_new_with_seed (seed); + + pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE); + + left = pseudo_tcp_socket_new (0, &cbs); + right = pseudo_tcp_socket_new (0, &cbs); + g_debug ("Left: %p. Right: %p", left, right); + + pseudo_tcp_socket_notify_mtu (left, 1496); + pseudo_tcp_socket_notify_mtu (right, 1496); + + pseudo_tcp_socket_connect (left); + adjust_clock (left); + adjust_clock (right); + + /* Run the main loop. */ + g_main_loop_run (main_loop); + g_main_loop_unref (main_loop); + + g_object_unref (left); + g_object_unref (right); + + g_rand_free (prng); + + if (in != NULL) + fclose (in); + if (out != NULL) + fclose (out); + + return retval; + +context_error: + g_printerr ("\n%s\n", g_option_context_get_help (context, TRUE, NULL)); + g_option_context_free (context); + + return 1; +} diff -Nru libnice-0.1.4/tests/test-restart.c libnice-0.1.7/tests/test-restart.c --- libnice-0.1.4/tests/test-restart.c 2012-03-12 16:14:36.000000000 +0000 +++ libnice-0.1.7/tests/test-restart.c 2014-03-31 23:20:03.000000000 +0000 @@ -355,7 +355,6 @@ global_lagent_ibr_received = FALSE; global_ragent_ibr_received = FALSE; global_components_ready = 0; - global_ragent_read_exit = 32; /* step: exchange remote candidates */ cdes.component_id = NICE_COMPONENT_TYPE_RTP; @@ -402,9 +401,7 @@ WSAStartup(0x0202, &w); #endif g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init(NULL); -#endif global_mainloop = g_main_loop_new (NULL, FALSE); diff -Nru libnice-0.1.4/tests/test-send-recv.c libnice-0.1.7/tests/test-send-recv.c --- libnice-0.1.4/tests/test-send-recv.c 1970-01-01 00:00:00.000000000 +0000 +++ libnice-0.1.7/tests/test-send-recv.c 2014-03-31 23:18:17.000000000 +0000 @@ -0,0 +1,1315 @@ +/* + * This file is part of the Nice GLib ICE library. + * + * (C) 2014 Collabora Ltd. + * Contact: Philip Withnall + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Nice GLib ICE library. + * + * The Initial Developers of the Original Code are Collabora Ltd and Nokia + * Corporation. All Rights Reserved. + * + * Contributors: + * Philip Withnall, Collabora Ltd. + * + * Alternatively, the contents of this file may be used under the terms of the + * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which + * case the provisions of LGPL are applicable instead of those above. If you + * wish to allow use of your version of this file only under the terms of the + * LGPL and not to allow others to use your version of this file under the + * MPL, indicate your decision by deleting the provisions above and replace + * them with the notice and other provisions required by the LGPL. If you do + * not delete the provisions above, a recipient may use your version of this + * file under either the MPL or the LGPL. + */ + +/** + * This is a comprehensive unit test for send() and recv() behaviour in libnice, + * covering all APIs except the old nice_agent_attach_recv() one. It aims to + * test the correctness of reliable and non-reliable I/O through libnice, using + * a variety of data and a variety of buffer sizes. + * + * Abnormal features like error handling, zero-length buffer handling, stream + * closure and cancellation are not tested. + * + * This is *not* a performance test, and would require significant work to be + * useful as one. It allocates all of its buffers dynamically, and walks over + * them frequently to set and check data. + * + * Several of the strategies in the test make use of random numbers. The seed + * values for these are deterministically set (in main()), but may be specified + * on the command line to allow fuzzing. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "agent.h" +#include "test-io-stream-common.h" + +#include +#include +#ifndef G_OS_WIN32 +#include +#endif + +/* Maximum IP payload ((1 << 16) - 1), minus IP header, minus UDP header. */ +#define MAX_MESSAGE_SIZE (65535 - 20 - 8) /* bytes */ + +typedef enum { + STREAM_AGENT, /* nice_agent_[send|recv]() */ + STREAM_AGENT_NONBLOCKING, /* nice_agent_[send|recv]_nonblocking() */ + STREAM_GIO, /* Nice[Input|Output]Stream */ + STREAM_GSOURCE, /* GPollable[Input|Output]Stream */ +} StreamApi; +#define STREAM_API_N_ELEMENTS (STREAM_GSOURCE + 1) + +typedef enum { + BUFFER_SIZE_CONSTANT_LARGE, /* always 65535 bytes */ + BUFFER_SIZE_CONSTANT_SMALL, /* always 4096 bytes */ + BUFFER_SIZE_CONSTANT_TINY, /* always 1 byte */ + BUFFER_SIZE_ASCENDING, /* ascending powers of 2 */ + BUFFER_SIZE_RANDOM, /* random every time */ +} BufferSizeStrategy; +#define BUFFER_SIZE_STRATEGY_N_ELEMENTS (BUFFER_SIZE_RANDOM + 1) + +typedef enum { + BUFFER_COUNT_CONSTANT_ONE, /* always a single buffer */ + BUFFER_COUNT_CONSTANT_TWO, /* always two buffers */ + BUFFER_COUNT_RANDOM, /* random every time */ +} BufferCountStrategy; +#define BUFFER_COUNT_STRATEGY_N_ELEMENTS (BUFFER_COUNT_RANDOM + 1) + +typedef enum { + MESSAGE_COUNT_CONSTANT_ONE, /* always a single message */ + MESSAGE_COUNT_CONSTANT_TWO, /* always two messages */ + MESSAGE_COUNT_RANDOM, /* random every time */ +} MessageCountStrategy; +#define MESSAGE_COUNT_STRATEGY_N_ELEMENTS (MESSAGE_COUNT_RANDOM + 1) + +typedef enum { + BUFFER_DATA_CONSTANT, /* fill with 0xfe */ + BUFFER_DATA_ASCENDING, /* ascending values for each byte */ + BUFFER_DATA_PSEUDO_RANDOM, /* every byte is pseudo-random */ +} BufferDataStrategy; +#define BUFFER_DATA_STRATEGY_N_ELEMENTS (BUFFER_DATA_PSEUDO_RANDOM + 1) + +typedef struct { + /* Test configuration (immutable per test run). */ + gboolean reliable; + StreamApi stream_api; + struct { + BufferSizeStrategy buffer_size_strategy; + BufferCountStrategy buffer_count_strategy; + MessageCountStrategy message_count_strategy; + } transmit; + struct { + BufferSizeStrategy buffer_size_strategy; + BufferCountStrategy buffer_count_strategy; + MessageCountStrategy message_count_strategy; + } receive; + BufferDataStrategy buffer_data_strategy; + gsize n_bytes; + guint n_messages; + + /* Test state. */ + GRand *transmit_size_rand; + GRand *receive_size_rand; + gsize transmitted_bytes; + gsize received_bytes; + gsize *other_received_bytes; + guint transmitted_messages; + guint received_messages; + guint *other_received_messages; +} TestData; + +/* Whether @stream_api is blocking (vs. non-blocking). */ +static gboolean +stream_api_is_blocking (StreamApi stream_api) +{ + switch (stream_api) { + case STREAM_AGENT: + case STREAM_GIO: + return TRUE; + case STREAM_AGENT_NONBLOCKING: + case STREAM_GSOURCE: + return FALSE; + default: + g_assert_not_reached (); + } +} + +/* Whether @stream_api only works for reliable NiceAgents. */ +static gboolean +stream_api_is_reliable_only (StreamApi stream_api) +{ + switch (stream_api) { + case STREAM_GSOURCE: + case STREAM_GIO: + return TRUE; + case STREAM_AGENT: + case STREAM_AGENT_NONBLOCKING: + return FALSE; + default: + g_assert_not_reached (); + } +} + +/* Whether @stream_api supports vectored I/O (multiple buffers or messages). */ +static gboolean +stream_api_supports_vectored_io (StreamApi stream_api) +{ + switch (stream_api) { + case STREAM_AGENT: + case STREAM_AGENT_NONBLOCKING: + return TRUE; + case STREAM_GSOURCE: + case STREAM_GIO: + return FALSE; + default: + g_assert_not_reached (); + } +} + +/* Generate a size for the buffer containing the @buffer_offset-th byte. + * Guaranteed to be in the interval [1, 1 << 16). ((1 << 16) is the maximum + * message size.) */ +static gsize +generate_buffer_size (BufferSizeStrategy strategy, GRand *grand, + gsize buffer_offset) +{ + switch (strategy) { + case BUFFER_SIZE_CONSTANT_LARGE: + return (1 << 16) - 1; + + case BUFFER_SIZE_CONSTANT_SMALL: + return 4096; + + case BUFFER_SIZE_CONSTANT_TINY: + return 1; + + case BUFFER_SIZE_ASCENDING: + return CLAMP (1L << buffer_offset, 1, (1 << 16) - 1); + + case BUFFER_SIZE_RANDOM: + return g_rand_int_range (grand, 1, 1 << 16); + + default: + g_assert_not_reached (); + } +} + +/* Generate a number of buffers to allocate when receiving the @buffer_offset-th + * byte. Guaranteed to be in the interval [1, 100], where 100 was chosen + * arbitrarily.*/ +static guint +generate_buffer_count (BufferCountStrategy strategy, GRand *grand, + gsize buffer_offset) +{ + switch (strategy) { + case BUFFER_COUNT_CONSTANT_ONE: + return 1; + + case BUFFER_COUNT_CONSTANT_TWO: + return 2; + + case BUFFER_COUNT_RANDOM: + return g_rand_int_range (grand, 1, 100 + 1); + + default: + g_assert_not_reached (); + } +} + +/* Generate a number of messages to allocate and receive into when receiving the + * @buffer_offset-th byte. Guaranteed to be in the interval [1, 100], where 100 + * was chosen arbitrarily.*/ +static guint +generate_message_count (MessageCountStrategy strategy, GRand *grand, + guint buffer_index) +{ + switch (strategy) { + case MESSAGE_COUNT_CONSTANT_ONE: + return 1; + + case MESSAGE_COUNT_CONSTANT_TWO: + return 2; + + case MESSAGE_COUNT_RANDOM: + return g_rand_int_range (grand, 1, 100 + 1); + + default: + g_assert_not_reached (); + } +} + +/* Fill the given @buf with @buf_len bytes of generated data. The data is + * deterministically generated, so that: + * generate_buffer_data(_, I, buf, 2) + * and + * generate_buffer_data(_, I+1, buf+1, 1) + * generate the same buf[I+1] byte, for all I. + * + * The generation strategies are generally chosen to produce data which makes + * send/receive errors (insertions, swaps, elisions) obvious. */ +static void +generate_buffer_data (BufferDataStrategy strategy, gsize buffer_offset, + guint8 *buf, gsize buf_len) +{ + switch (strategy) { + case BUFFER_DATA_CONSTANT: + memset (buf, 0xfe, buf_len); + break; + + case BUFFER_DATA_ASCENDING: { + gsize i; + + for (i = 0; i < buf_len; i++) { + buf[i] = (i + buffer_offset) & 0xff; + } + + break; + } + + case BUFFER_DATA_PSEUDO_RANDOM: { + gsize i; + + /* This can’t use GRand, because then the number of calls to g_rand_*() + * methods would affect its output, and the bytes generated here have to be + * entirely deterministic on @buffer_offset. + * + * Instead, use something akin to a LCG, except without any feedback + * (because that would make it non-deterministic). The objective is to + * generate numbers which are sufficiently pseudo-random that it’s likely + * transpositions, elisions and insertions will be detected. + * + * The constants come from ‘ANSI C’ in: + * http://en.wikipedia.org/wiki/Linear_congruential_generator + */ + for (i = 0; i < buf_len; i++) { + buf[i] = (1103515245 * (buffer_offset + i) + 12345) & 0xff; + } + + break; + } + + default: + g_assert_not_reached (); + } +} + +/* Choose a size and allocate a receive buffer in @buf, ready to receive bytes + * starting at @buffer_offset into the stream. Fill the buffer with poison + * values to hopefully make incorrect writes/reads more obvious. + * + * @buf must be freed with g_free(). */ +static void +generate_buffer_to_receive (TestIOStreamThreadData *data, gsize buffer_offset, + guint8 **buf, gsize *buf_len) +{ + TestData *test_data = data->user_data; + + /* Allocate the buffer. */ + *buf_len = generate_buffer_size (test_data->receive.buffer_size_strategy, + test_data->receive_size_rand, buffer_offset); + *buf = g_malloc (*buf_len); + + /* Fill it with poison to try and detect incorrect writes. */ + memset (*buf, 0xaa, *buf_len); +} + +/* Similar to generate_buffer_to_receive(), but generate an entire message array + * with multiple buffers instead. + * + * @max_buffer_size may be used to limit the total size of all the buffers in + * all the messages, for example to avoid blocking on receiving data which will + * never be sent. This only applies for blocking, reliable stream APIs. + * + * @max_n_messages may be used to limit the number of messages generated, to + * avoid blocking on receiving messages which will never be sent. This only + * applies for blocking, non-reliable stream APIs. + * + * @messages must be freed with g_free(), as must all of the buffer arrays and + * the buffers themselves. */ +static void +generate_messages_to_receive (TestIOStreamThreadData *data, gsize buffer_offset, + NiceInputMessage **messages, guint *n_messages, gsize max_buffer_size, + guint max_n_messages) +{ + TestData *test_data = data->user_data; + guint i; + + /* Allocate the messages. */ + *n_messages = + generate_message_count (test_data->receive.message_count_strategy, + test_data->receive_size_rand, buffer_offset); + + if (!data->reliable) + *n_messages = MIN (*n_messages, max_n_messages); + + *messages = g_malloc_n (*n_messages, sizeof (NiceInputMessage)); + + for (i = 0; i < *n_messages; i++) { + NiceInputMessage *message = &((*messages)[i]); + guint j; + + message->n_buffers = + generate_buffer_count (test_data->receive.buffer_count_strategy, + test_data->receive_size_rand, buffer_offset); + message->buffers = g_malloc_n (message->n_buffers, sizeof (GInputVector)); + message->from = NULL; + message->length = 0; + + for (j = 0; j < (guint) message->n_buffers; j++) { + GInputVector *buffer = &message->buffers[j]; + gsize buf_len; + + buf_len = + generate_buffer_size (test_data->receive.buffer_size_strategy, + test_data->receive_size_rand, buffer_offset); + + /* Trim the buffer length if it would otherwise cause the API to block. */ + if (data->reliable) { + buf_len = MIN (buf_len, max_buffer_size); + max_buffer_size -= buf_len; + } + + buffer->size = buf_len; + buffer->buffer = g_malloc (buffer->size); + + /* Fill it with poison to try and detect incorrect writes. */ + memset (buffer->buffer, 0xaa, buffer->size); + + /* If we’ve hit the max_buffer_size, adjust the buffer and message counts + * and run away. */ + if (data->reliable && max_buffer_size == 0) { + message->n_buffers = j + 1; + *n_messages = i + 1; + return; + } + } + } +} + +/* Validate the length and data of a received buffer of length @buf_len, filled + * with @len valid bytes. Updates the internal state machine to mark the bytes + * as received. This consumes @buf. */ +static void +validate_received_buffer (TestIOStreamThreadData *data, gsize buffer_offset, + guint8 **buf, gsize buf_len, gssize len) +{ + TestData *test_data = data->user_data; + guint8 *expected_buf; + + g_assert_cmpint (len, <=, buf_len); + g_assert_cmpint (len, >=, 0); + + if (stream_api_is_blocking (test_data->stream_api) && data->reliable) + g_assert_cmpint (len, ==, buf_len); + + /* Validate the buffer contents. + * + * Note: Buffers can only be validated up to valid_len. The buffer may + * have been re-used internally (e.g. by receiving a STUN message, then + * overwriting it with a data packet), so we can’t guarantee that the + * bytes beyond valid_len have been untouched. */ + expected_buf = g_malloc (buf_len); + memset (expected_buf, 0xaa, buf_len); + generate_buffer_data (test_data->buffer_data_strategy, buffer_offset, + expected_buf, len); + g_assert (memcmp (*buf, expected_buf, len) == 0); + g_free (expected_buf); + + test_data->received_bytes += len; + + g_free (*buf); +} + +/* Similar to validate_received_buffer(), except it validates a message array + * instead of a single buffer. This consumes @messages. */ +static void +validate_received_messages (TestIOStreamThreadData *data, gsize buffer_offset, + NiceInputMessage *messages, guint n_messages, gint n_valid_messages) +{ + TestData *test_data = data->user_data; + guint i; + gsize prev_message_len = G_MAXSIZE; + + g_assert_cmpint (n_valid_messages, <=, n_messages); + g_assert_cmpint (n_valid_messages, >=, 0); + + if (stream_api_is_blocking (test_data->stream_api)) + g_assert_cmpint (n_valid_messages, ==, n_messages); + + test_data->received_messages += n_valid_messages; + + /* Validate the message contents. */ + for (i = 0; i < (guint) n_valid_messages; i++) { + NiceInputMessage *message = &messages[i]; + guint j; + gsize total_buf_len = 0; + gsize message_len_remaining = message->length; + + g_assert_cmpint (message->n_buffers, >, 0); + + for (j = 0; j < (guint) message->n_buffers; j++) { + GInputVector *buffer = &message->buffers[j]; + gsize valid_len; + + /* See note above about valid_len. */ + total_buf_len += buffer->size; + valid_len = MIN (message_len_remaining, buffer->size); + + /* Only validate buffer content for reliable mode, anything could + * be received in UDP mode + */ + if (test_data->reliable) { + guint8 *expected_buf; + + expected_buf = g_malloc (buffer->size); + memset (expected_buf, 0xaa, buffer->size); + generate_buffer_data (test_data->buffer_data_strategy, buffer_offset, + expected_buf, valid_len); + g_assert_cmpint (memcmp (buffer->buffer, expected_buf, valid_len), ==, + 0); + g_free (expected_buf); + buffer_offset += valid_len; + message_len_remaining -= valid_len; + } + test_data->received_bytes += valid_len; + + g_free (buffer->buffer); + } + + g_assert_cmpuint (message->length, <=, total_buf_len); + g_assert_cmpuint (message->length, >=, 0); + + /* No non-empty messages can follow an empty message. */ + if (prev_message_len == 0) + g_assert_cmpuint (message->length, ==, 0); + prev_message_len = message->length; + + /* If the API was blocking, it should have completely filled the message. */ + if (stream_api_is_blocking (test_data->stream_api) && data->reliable) + g_assert_cmpuint (message->length, ==, total_buf_len); + + g_assert (message->from == NULL); + + g_free (message->buffers); + } + + g_free (messages); +} + +/* Determine a size for the next transmit buffer, allocate it, and fill it with + * data to be transmitted. */ +static void +generate_buffer_to_transmit (TestIOStreamThreadData *data, gsize buffer_offset, + guint8 **buf, gsize *buf_len) +{ + TestData *test_data = data->user_data; + + /* Allocate the buffer. */ + *buf_len = generate_buffer_size (test_data->transmit.buffer_size_strategy, + test_data->transmit_size_rand, buffer_offset); + *buf_len = MIN (*buf_len, test_data->n_bytes - test_data->transmitted_bytes); + *buf = g_malloc (*buf_len); + + /* Fill it with data. */ + generate_buffer_data (test_data->buffer_data_strategy, buffer_offset, + *buf, *buf_len); +} + +/* Similar to generate_buffer_to_transmit(), except that it generates an array + * of NiceOutputMessages rather than a single buffer. */ +static void +generate_messages_to_transmit (TestIOStreamThreadData *data, + gsize buffer_offset, NiceOutputMessage **messages, guint *n_messages) +{ + TestData *test_data = data->user_data; + guint i; + gsize total_buf_len = 0; + + /* Determine the number of messages to send. */ + *n_messages = + generate_message_count (test_data->transmit.message_count_strategy, + test_data->transmit_size_rand, buffer_offset); + *n_messages = + MIN (*n_messages, + test_data->n_messages - test_data->transmitted_messages); + + *messages = g_malloc_n (*n_messages, sizeof (NiceOutputMessage)); + + for (i = 0; i < *n_messages; i++) { + NiceOutputMessage *message = &((*messages)[i]); + guint j; + gsize max_message_size; + gsize message_len = 0; + + message->n_buffers = + generate_buffer_count (test_data->transmit.buffer_count_strategy, + test_data->transmit_size_rand, buffer_offset); + message->buffers = g_malloc_n (message->n_buffers, sizeof (GOutputVector)); + + /* Limit the overall message size to the smaller of (n_bytes / n_messages) + * and MAX_MESSAGE_SIZE, to ensure each message is non-empty. */ + max_message_size = + MIN ((test_data->n_bytes / test_data->n_messages), MAX_MESSAGE_SIZE); + + for (j = 0; j < (guint) message->n_buffers; j++) { + GOutputVector *buffer = &message->buffers[j]; + gsize buf_len; + guint8 *buf; + + buf_len = + generate_buffer_size (test_data->transmit.buffer_size_strategy, + test_data->transmit_size_rand, buffer_offset); + buf_len = + MIN (buf_len, + test_data->n_bytes - test_data->transmitted_bytes - total_buf_len); + buf_len = MIN (buf_len, max_message_size - message_len); + + buffer->size = buf_len; + buf = g_malloc (buffer->size); + buffer->buffer = buf; + message_len += buf_len; + total_buf_len += buf_len; + + /* Fill it with data. */ + generate_buffer_data (test_data->buffer_data_strategy, buffer_offset, + buf, buf_len); + + buffer_offset += buf_len; + + /* Reached the maximum UDP payload size? */ + if (message_len >= max_message_size) { + message->n_buffers = j + 1; + break; + } + } + + g_assert_cmpuint (message_len, <=, max_message_size); + } +} + +/* Validate the number of bytes transmitted, and update the test’s internal + * state machine. Consumes @buf. */ +static void +notify_transmitted_buffer (TestIOStreamThreadData *data, gsize buffer_offset, + guint8 **buf, gsize buf_len, gssize len) +{ + TestData *test_data = data->user_data; + + g_assert_cmpint (len, <=, buf_len); + g_assert_cmpint (len, >=, 0); + + test_data->transmitted_bytes += len; + + g_free (*buf); +} + +static gsize +output_message_get_size (const NiceOutputMessage *message) +{ + guint i; + gsize message_len = 0; + + /* Find the total size of the message */ + for (i = 0; + (message->n_buffers >= 0 && i < (guint) message->n_buffers) || + (message->n_buffers < 0 && message->buffers[i].buffer != NULL); + i++) + message_len += message->buffers[i].size; + + return message_len; +} + +/* Similar to notify_transmitted_buffer(), except it operates on an array of + * messages from generate_messages_to_transmit(). */ +static void +notify_transmitted_messages (TestIOStreamThreadData *data, gsize buffer_offset, + NiceOutputMessage **messages, guint n_messages, gint n_sent_messages) +{ + TestData *test_data = data->user_data; + guint i; + + g_assert_cmpint (n_sent_messages, <=, n_messages); + g_assert_cmpint (n_sent_messages, >=, 0); + + test_data->transmitted_messages += n_sent_messages; + + for (i = 0; i < n_messages; i++) { + NiceOutputMessage *message = &((*messages)[i]); + guint j; + + if (i < (guint) n_sent_messages) + test_data->transmitted_bytes += output_message_get_size (message); + + for (j = 0; j < (guint) message->n_buffers; j++) { + GOutputVector *buffer = &message->buffers[j]; + + g_free ((guint8 *) buffer->buffer); + } + + g_free (message->buffers); + } + + g_free (*messages); +} + +/* + * Implementation using nice_agent_recv_messages() and nice_agent_send(). + */ +static void +read_thread_agent_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + TestData *test_data = data->user_data; + guint stream_id, component_id; + gpointer tmp; + + tmp = g_object_get_data (G_OBJECT (data->agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + component_id = 1; + + while (test_data->received_bytes < test_data->n_bytes) { + GError *error = NULL; + NiceInputMessage *messages; + guint n_messages; + gint n_valid_messages; + + /* Initialise an array of messages to receive into. */ + generate_messages_to_receive (data, test_data->received_bytes, &messages, + &n_messages, test_data->n_bytes - test_data->received_bytes, + test_data->n_messages - test_data->received_messages); + + /* Block on receiving some data. */ + n_valid_messages = nice_agent_recv_messages (data->agent, stream_id, + component_id, messages, n_messages, NULL, &error); + g_assert_no_error (error); + + /* Check the messages and update the test’s state machine. */ + validate_received_messages (data, test_data->received_bytes, messages, + n_messages, n_valid_messages); + } + + check_for_termination (data, &test_data->received_bytes, + test_data->other_received_bytes, &test_data->transmitted_bytes, + test_data->n_bytes); +} + +static void +write_thread_agent_cb (GOutputStream *output_stream, + TestIOStreamThreadData *data) +{ + TestData *test_data = data->user_data; + guint stream_id, component_id; + gpointer tmp; + + tmp = g_object_get_data (G_OBJECT (data->agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + component_id = 1; + + while (test_data->transmitted_bytes < test_data->n_bytes) { + GError *error = NULL; + NiceOutputMessage *messages; + guint n_messages; + gint n_sent_messages; + + /* Generate a buffer to transmit. */ + generate_messages_to_transmit (data, test_data->transmitted_bytes, + &messages, &n_messages); + + /* Busy loop on receiving some data. */ + do { + g_clear_error (&error); + n_sent_messages = nice_agent_send_messages_nonblocking (data->agent, + stream_id, component_id, messages, n_messages, NULL, &error); + } while (n_sent_messages == -1 && + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)); + g_assert_no_error (error); + + /* Update the test’s buffer generation state machine. */ + notify_transmitted_messages (data, test_data->transmitted_bytes, &messages, + n_messages, n_sent_messages); + } +} + +/* + * Implementation using nice_agent_recv_nonblocking() and + * nice_agent_send_nonblocking(). + */ +static void +read_thread_agent_nonblocking_cb (GInputStream *input_stream, + TestIOStreamThreadData *data) +{ + TestData *test_data = data->user_data; + guint stream_id, component_id; + gpointer tmp; + + tmp = g_object_get_data (G_OBJECT (data->agent), "stream-id"); + stream_id = GPOINTER_TO_UINT (tmp); + component_id = 1; + + while (test_data->received_bytes < test_data->n_bytes) { + GError *error = NULL; + NiceInputMessage *messages; + guint n_messages; + gint n_valid_messages; + + /* Initialise an array of messages to receive into. */ + generate_messages_to_receive (data, test_data->received_bytes, &messages, + &n_messages, test_data->n_bytes - test_data->received_bytes, + test_data->n_messages - test_data->received_messages); + + /* Trim n_messages to avoid consuming the ‘done’ message. */ + n_messages = + MIN (n_messages, test_data->n_messages - test_data->received_messages); + + /* Busy loop on receiving some data. */ + do { + g_clear_error (&error); + n_valid_messages = nice_agent_recv_messages_nonblocking (data->agent, + stream_id, component_id, messages, n_messages, NULL, &error); + } while (n_valid_messages == -1 && + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)); + g_assert_no_error (error); + + /* Check the messages and update the test’s state machine. */ + validate_received_messages (data, test_data->received_bytes, messages, + n_messages, n_valid_messages); + } + + check_for_termination (data, &test_data->received_bytes, + test_data->other_received_bytes, &test_data->transmitted_bytes, + test_data->n_bytes); +} + +static void +write_thread_agent_nonblocking_cb (GOutputStream *output_stream, + TestIOStreamThreadData *data) +{ + /* FIXME: There is no nice_agent_send_nonblocking(); nice_agent_send() is + * non-blocking by default. */ + write_thread_agent_cb (output_stream, data); +} + +/* + * Implementation using NiceInputStream and NiceOutputStream. + */ +static void +read_thread_gio_cb (GInputStream *input_stream, TestIOStreamThreadData *data) +{ + TestData *test_data = data->user_data; + + while (test_data->received_bytes < test_data->n_bytes) { + GError *error = NULL; + guint8 *buf = NULL; + gsize buf_len = 0; + gssize len; + + /* Initialise a receive buffer. */ + generate_buffer_to_receive (data, test_data->received_bytes, &buf, + &buf_len); + + /* Trim the receive buffer to avoid blocking on bytes which will never + * appear. */ + buf_len = MIN (buf_len, test_data->n_bytes - test_data->received_bytes); + + /* Block on receiving some data. */ + len = g_input_stream_read (input_stream, buf, buf_len, NULL, &error); + g_assert_no_error (error); + + /* Check the buffer and update the test’s state machine. */ + validate_received_buffer (data, test_data->received_bytes, &buf, buf_len, + len); + } + + check_for_termination (data, &test_data->received_bytes, + test_data->other_received_bytes, &test_data->transmitted_bytes, + test_data->n_bytes); +} + +static void +write_thread_gio_cb (GOutputStream *output_stream, TestIOStreamThreadData *data) +{ + TestData *test_data = data->user_data; + + while (test_data->transmitted_bytes < test_data->n_bytes) { + GError *error = NULL; + guint8 *buf = NULL; + gsize buf_len = 0; + gssize len; + gsize total_len = 0; + + /* Generate a buffer to transmit. */ + generate_buffer_to_transmit (data, test_data->transmitted_bytes, &buf, + &buf_len); + + /* Transmit it. */ + do { + len = g_output_stream_write (output_stream, buf + total_len, + buf_len - total_len, NULL, &error); + g_assert_no_error (error); + total_len += len; + } while (total_len < buf_len); + + /* Update the test’s buffer generation state machine. */ + notify_transmitted_buffer (data, test_data->transmitted_bytes, &buf, + buf_len, total_len); + } +} + +/* + * Implementation using GPollableInputStream and GPollableOutputStream. + * + * GSourceData is effectively the closure for the ‘for’ loop in other stream API + * implementations. + */ +typedef struct { + TestIOStreamThreadData *data; + GMainLoop *main_loop; +} GSourceData; + +static gboolean +read_stream_cb (GObject *pollable_stream, gpointer _user_data) +{ + GSourceData *gsource_data = _user_data; + TestIOStreamThreadData *data = gsource_data->data; + TestData *test_data = data->user_data; + GError *error = NULL; + guint8 *buf = NULL; + gsize buf_len = 0; + gssize len; + + /* Initialise a receive buffer. */ + generate_buffer_to_receive (data, test_data->received_bytes, &buf, &buf_len); + + /* Trim the receive buffer to avoid consuming the ‘done’ message. */ + buf_len = MIN (buf_len, test_data->n_bytes - test_data->received_bytes); + + /* Try to receive some data. */ + len = g_pollable_input_stream_read_nonblocking ( + G_POLLABLE_INPUT_STREAM (pollable_stream), buf, buf_len, NULL, &error); + + if (len == -1) { + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_free (buf); + return TRUE; + } + + g_assert_no_error (error); + + /* Check the buffer and update the test’s state machine. */ + validate_received_buffer (data, test_data->received_bytes, &buf, buf_len, + len); + + /* Termination time? */ + if (test_data->received_bytes == test_data->n_bytes) { + g_main_loop_quit (gsource_data->main_loop); + return FALSE; + } + + return TRUE; +} + +static void +read_thread_gsource_cb (GInputStream *input_stream, + TestIOStreamThreadData *data) +{ + TestData *test_data = data->user_data; + GSourceData gsource_data; + GMainContext *main_context; + GMainLoop *main_loop; + GSource *stream_source; + + main_context = g_main_context_ref_thread_default (); + main_loop = g_main_loop_new (main_context, FALSE); + + gsource_data.data = data; + gsource_data.main_loop = main_loop; + + stream_source = + g_pollable_input_stream_create_source ( + G_POLLABLE_INPUT_STREAM (input_stream), NULL); + + g_source_set_callback (stream_source, (GSourceFunc) read_stream_cb, + &gsource_data, NULL); + g_source_attach (stream_source, main_context); + + /* Run the main loop. */ + g_main_loop_run (main_loop); + + g_source_destroy (stream_source); + g_source_unref (stream_source); + g_main_loop_unref (main_loop); + g_main_context_unref (main_context); + + /* Termination? */ + check_for_termination (data, &test_data->received_bytes, + test_data->other_received_bytes, &test_data->transmitted_bytes, + test_data->n_bytes); +} + +static gboolean +write_stream_cb (GObject *pollable_stream, gpointer _user_data) +{ + GSourceData *gsource_data = _user_data; + TestIOStreamThreadData *data = gsource_data->data; + TestData *test_data = data->user_data; + GError *error = NULL; + guint8 *buf = NULL; + gsize buf_len = 0; + gssize len; + + /* Initialise a receive buffer. */ + generate_buffer_to_transmit (data, test_data->transmitted_bytes, &buf, + &buf_len); + + /* Try to transmit some data. */ + len = g_pollable_output_stream_write_nonblocking ( + G_POLLABLE_OUTPUT_STREAM (pollable_stream), buf, buf_len, NULL, &error); + + if (len == -1) { + g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK); + g_free (buf); + return TRUE; + } + + g_assert_no_error (error); + + /* Update the test’s buffer generation state machine. */ + notify_transmitted_buffer (data, test_data->transmitted_bytes, &buf, buf_len, + len); + + /* Termination time? */ + if (test_data->transmitted_bytes == test_data->n_bytes) { + g_main_loop_quit (gsource_data->main_loop); + return FALSE; + } + + return TRUE; +} + +static void +write_thread_gsource_cb (GOutputStream *output_stream, + TestIOStreamThreadData *data) +{ + GSourceData gsource_data; + GMainContext *main_context; + GMainLoop *main_loop; + GSource *stream_source; + + main_context = g_main_context_ref_thread_default (); + main_loop = g_main_loop_new (main_context, FALSE); + + gsource_data.data = data; + gsource_data.main_loop = main_loop; + + stream_source = + g_pollable_output_stream_create_source ( + G_POLLABLE_OUTPUT_STREAM (output_stream), NULL); + + g_source_set_callback (stream_source, (GSourceFunc) write_stream_cb, + &gsource_data, NULL); + g_source_attach (stream_source, main_context); + + /* Run the main loop. */ + g_main_loop_run (main_loop); + + g_source_destroy (stream_source); + g_source_unref (stream_source); + g_main_loop_unref (main_loop); + g_main_context_unref (main_context); +} + +static void +test_data_init (TestData *data, gboolean reliable, StreamApi stream_api, + gsize n_bytes, guint n_messages, + BufferSizeStrategy transmit_buffer_size_strategy, + BufferCountStrategy transmit_buffer_count_strategy, + MessageCountStrategy transmit_message_count_strategy, + BufferSizeStrategy receive_buffer_size_strategy, + BufferCountStrategy receive_buffer_count_strategy, + MessageCountStrategy receive_message_count_strategy, + BufferDataStrategy buffer_data_strategy, guint32 transmit_seed, + guint32 receive_seed, gsize *other_received_bytes, + guint *other_received_messages) +{ + data->reliable = reliable; + data->stream_api = stream_api; + data->n_bytes = n_bytes; + data->n_messages = n_messages; + data->transmit.buffer_size_strategy = transmit_buffer_size_strategy; + data->transmit.buffer_count_strategy = transmit_buffer_count_strategy; + data->transmit.message_count_strategy = transmit_message_count_strategy; + data->receive.buffer_size_strategy = receive_buffer_size_strategy; + data->receive.buffer_count_strategy = receive_buffer_count_strategy; + data->receive.message_count_strategy = receive_message_count_strategy; + data->buffer_data_strategy = buffer_data_strategy; + data->transmit_size_rand = g_rand_new_with_seed (transmit_seed); + data->receive_size_rand = g_rand_new_with_seed (receive_seed); + data->transmitted_bytes = 0; + data->received_bytes = 0; + data->other_received_bytes = other_received_bytes; + data->transmitted_messages = 0; + data->received_messages = 0; + data->other_received_messages = other_received_messages; +} + +/* + * Test closures. + */ +static void +test_data_clear (TestData *data) +{ + g_rand_free (data->receive_size_rand); + g_rand_free (data->transmit_size_rand); +} + +static void +test (gboolean reliable, StreamApi stream_api, gsize n_bytes, guint n_messages, + BufferSizeStrategy transmit_buffer_size_strategy, + BufferCountStrategy transmit_buffer_count_strategy, + MessageCountStrategy transmit_message_count_strategy, + BufferSizeStrategy receive_buffer_size_strategy, + BufferCountStrategy receive_buffer_count_strategy, + MessageCountStrategy receive_message_count_strategy, + BufferDataStrategy buffer_data_strategy, + guint32 transmit_seed, guint32 receive_seed, + guint deadlock_timeout) +{ + TestData l_data, r_data; + + /* Indexed by StreamApi. */ + const TestIOStreamCallbacks callbacks[] = { + { read_thread_agent_cb, + write_thread_agent_cb, NULL, NULL, }, /* STREAM_AGENT */ + { read_thread_agent_nonblocking_cb, write_thread_agent_nonblocking_cb, + NULL, NULL, }, /* STREAM_AGENT_NONBLOCKING */ + { read_thread_gio_cb, write_thread_gio_cb, NULL, NULL, }, /* STREAM_GIO */ + { read_thread_gsource_cb, write_thread_gsource_cb, + NULL, NULL }, /* STREAM_GSOURCE */ + }; + + test_data_init (&l_data, reliable, stream_api, n_bytes, n_messages, + transmit_buffer_size_strategy, transmit_buffer_count_strategy, + transmit_message_count_strategy, receive_buffer_size_strategy, + receive_buffer_count_strategy, receive_message_count_strategy, + buffer_data_strategy, transmit_seed, receive_seed, + &r_data.received_bytes, &r_data.received_messages); + test_data_init (&r_data, reliable, stream_api, n_bytes, n_messages, + transmit_buffer_size_strategy, transmit_buffer_count_strategy, + transmit_message_count_strategy, receive_buffer_size_strategy, + receive_buffer_count_strategy, receive_message_count_strategy, + buffer_data_strategy, transmit_seed, receive_seed, + &l_data.received_bytes, &l_data.received_messages); + + run_io_stream_test (deadlock_timeout, reliable, &callbacks[stream_api], + &l_data, NULL, &r_data, NULL); + + test_data_clear (&r_data); + test_data_clear (&l_data); +} + +/* Options with default values. */ +guint32 option_transmit_seed = 0; +guint32 option_receive_seed = 0; +gsize option_n_bytes = 10000; +guint option_n_messages = 50; +guint option_timeout = 1200; /* seconds */ +gboolean option_long_mode = FALSE; + +static GOptionEntry entries[] = { + { "transmit-seed", 0, 0, G_OPTION_ARG_INT, &option_transmit_seed, + "Seed for transmission RNG", "S" }, + { "receive-seed", 0, 0, G_OPTION_ARG_INT, &option_receive_seed, + "Seed for reception RNG", "S" }, + { "n-bytes", 'n', 0, G_OPTION_ARG_INT64, &option_n_bytes, + "Number of bytes to send in each test (default 10000)", "N" }, + { "n-messages", 'm', 0, G_OPTION_ARG_INT64, &option_n_messages, + "Number of messages to send in each test (default 50)", "M" }, + { "timeout", 't', 0, G_OPTION_ARG_INT, &option_timeout, + "Deadlock detection timeout length, in seconds (default: 1200)", "S" }, + { "long-mode", 'l', 0, G_OPTION_ARG_NONE, &option_long_mode, + "Enable all tests, rather than a fast subset", NULL }, + { NULL }, +}; + +int +main (int argc, char *argv[]) +{ + gboolean reliable; + StreamApi stream_api; + BufferSizeStrategy transmit_buffer_size_strategy; + BufferCountStrategy transmit_buffer_count_strategy; + MessageCountStrategy transmit_message_count_strategy; + BufferSizeStrategy receive_buffer_size_strategy; + BufferCountStrategy receive_buffer_count_strategy; + MessageCountStrategy receive_message_count_strategy; + BufferDataStrategy buffer_data_strategy; + guint32 transmit_seed; + guint32 receive_seed; + gsize n_bytes; + guint n_messages; + guint deadlock_timeout; + gboolean long_mode; + GOptionContext *context; + GError *error = NULL; + + /* Argument parsing. Allow some of the test parameters to be specified on the + * command line. */ + context = g_option_context_new ("— test send()/recv() correctness"); + g_option_context_add_main_entries (context, entries, NULL); + + if (!g_option_context_parse (context, &argc, &argv, &error)) { + g_printerr ("Option parsing failed: %s\n", error->message); + g_error_free (error); + exit (1); + } + + /* Set up the defaults. */ + transmit_seed = option_transmit_seed; + receive_seed = option_receive_seed; + n_bytes = option_n_bytes; + n_messages = option_n_messages; + deadlock_timeout = option_timeout; + long_mode = option_long_mode; + +#ifdef G_OS_WIN32 + WSADATA w; + WSAStartup (0x0202, &w); +#endif + g_type_init (); + g_thread_init (NULL); + + if (!long_mode) { + /* Quick mode. Just test each of the stream APIs in reliable and + * non-reliable mode, with a single pair of buffer strategies, and a single + * data strategy. */ + + /* Reliability. */ + for (reliable = 0; reliable < 2; reliable++) { + /* Stream API. */ + for (stream_api = 0; + (guint) stream_api < STREAM_API_N_ELEMENTS; + stream_api++) { + /* GIO streams must always be reliable. */ + if (!reliable && stream_api_is_reliable_only (stream_api)) + continue; + + /* Non-reliable socket receives require large buffers. */ + if (reliable) { + receive_buffer_size_strategy = BUFFER_SIZE_RANDOM; + } else { + receive_buffer_size_strategy = BUFFER_SIZE_CONSTANT_LARGE; + } + + transmit_buffer_size_strategy = BUFFER_SIZE_RANDOM; + buffer_data_strategy = BUFFER_DATA_PSEUDO_RANDOM; + + if (stream_api_supports_vectored_io (stream_api)) { + transmit_buffer_count_strategy = BUFFER_COUNT_RANDOM; + transmit_message_count_strategy = MESSAGE_COUNT_RANDOM; + receive_buffer_count_strategy = BUFFER_COUNT_RANDOM; + receive_message_count_strategy = MESSAGE_COUNT_RANDOM; + } else { + transmit_buffer_count_strategy = BUFFER_COUNT_CONSTANT_ONE; + transmit_message_count_strategy = MESSAGE_COUNT_CONSTANT_ONE; + receive_buffer_count_strategy = BUFFER_COUNT_CONSTANT_ONE; + receive_message_count_strategy = MESSAGE_COUNT_CONSTANT_ONE; + } + + g_debug ("Running test (%u, %u, %" G_GSIZE_FORMAT ", %u, %u, " + "%u, %u, %u, %u)…", + reliable, stream_api, n_bytes, n_messages, + transmit_buffer_size_strategy, + receive_buffer_size_strategy, buffer_data_strategy, + transmit_seed, receive_seed); + test (reliable, stream_api, n_bytes, n_messages, + transmit_buffer_size_strategy, + transmit_buffer_count_strategy, transmit_message_count_strategy, + receive_buffer_size_strategy, receive_buffer_count_strategy, + receive_message_count_strategy, buffer_data_strategy, + transmit_seed, receive_seed, + deadlock_timeout); + } + } + + goto done; + } + +#define STRATEGY_LOOP(V, L) for (V = 0; (guint) V < L##_N_ELEMENTS; V++) + STRATEGY_LOOP(transmit_buffer_size_strategy, BUFFER_SIZE_STRATEGY) + STRATEGY_LOOP(transmit_buffer_count_strategy, BUFFER_COUNT_STRATEGY) + STRATEGY_LOOP(transmit_message_count_strategy, MESSAGE_COUNT_STRATEGY) + STRATEGY_LOOP(receive_buffer_size_strategy, BUFFER_SIZE_STRATEGY) + STRATEGY_LOOP(receive_buffer_count_strategy, BUFFER_COUNT_STRATEGY) + STRATEGY_LOOP(receive_message_count_strategy, MESSAGE_COUNT_STRATEGY) + STRATEGY_LOOP(buffer_data_strategy, BUFFER_DATA_STRATEGY) + /* Reliability. */ + for (reliable = 0; reliable < 2; reliable++) { + /* Stream API. */ + for (stream_api = 0; + (guint) stream_api < STREAM_API_N_ELEMENTS; + stream_api++) { + /* GIO streams must always be reliable. */ + if (!reliable && stream_api_is_reliable_only (stream_api)) + continue; + + /* Non-reliable socket receives require large buffers. We don’t claim to + * support using them with small (< 65536B) buffers, so don’t test + * them. */ + if (!reliable && + receive_buffer_size_strategy != BUFFER_SIZE_CONSTANT_LARGE) + continue; + + /* Non-reliable socket transmits will always block with huge buffers. */ + if (!reliable && + transmit_buffer_size_strategy == BUFFER_SIZE_CONSTANT_LARGE) + continue; + + /* Stream APIs which don’t support vectored I/O must not be passed + * I/O vectors. */ + if (!stream_api_supports_vectored_io (stream_api) && + (transmit_buffer_count_strategy != BUFFER_COUNT_CONSTANT_ONE || + transmit_message_count_strategy != MESSAGE_COUNT_CONSTANT_ONE || + receive_buffer_count_strategy != BUFFER_COUNT_CONSTANT_ONE || + receive_message_count_strategy != MESSAGE_COUNT_CONSTANT_ONE)) + continue; + + g_debug ("Running test (%u, %u, %" G_GSIZE_FORMAT ", %u, %u, " + "%u, %u, %u, %u, %u, %u, %u, %u)…", + reliable, stream_api, n_bytes, n_messages, + transmit_buffer_size_strategy, + transmit_buffer_count_strategy, transmit_message_count_strategy, + receive_buffer_size_strategy, receive_buffer_count_strategy, + receive_message_count_strategy, buffer_data_strategy, + transmit_seed, receive_seed); + test (reliable, stream_api, n_bytes, n_messages, + transmit_buffer_size_strategy, + transmit_buffer_count_strategy, transmit_message_count_strategy, + receive_buffer_size_strategy, receive_buffer_count_strategy, + receive_message_count_strategy, buffer_data_strategy, + transmit_seed, receive_seed, + deadlock_timeout); + } + } + +done: +#ifdef G_OS_WIN32 + WSACleanup (); +#endif + + return 0; +} diff -Nru libnice-0.1.4/tests/test-thread.c libnice-0.1.7/tests/test-thread.c --- libnice-0.1.4/tests/test-thread.c 2012-03-06 02:01:23.000000000 +0000 +++ libnice-0.1.7/tests/test-thread.c 2014-03-31 23:20:03.000000000 +0000 @@ -69,7 +69,9 @@ { GMainLoop *loop = data; - g_usleep (100000); + /* Synchronise thread starting. */ + while (!g_main_loop_is_running (error_loop)); + g_main_loop_run (loop); return NULL; @@ -195,9 +197,7 @@ WSAStartup(0x0202, &w); #endif g_type_init (); -#if !GLIB_CHECK_VERSION(2,31,8) g_thread_init(NULL); -#endif lmainctx = g_main_context_new (); rmainctx = g_main_context_new (); diff -Nru libnice-0.1.4/win32/dogenmarshal.cmd libnice-0.1.7/win32/dogenmarshal.cmd --- libnice-0.1.4/win32/dogenmarshal.cmd 2012-02-21 02:57:03.000000000 +0000 +++ libnice-0.1.7/win32/dogenmarshal.cmd 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -..\glib\bin\glib-genmarshal.exe --header --prefix=agent_marshal ..\agent\agent-signals-marshal.list > ..\agent\agent-signals-marshal.h -echo #include "agent-signals-marshal.h" > ..\agent\agent-signals-marshal.c -..\glib\bin\glib-genmarshal.exe --body --prefix=agent_marshal ..\agent\agent-signals-marshal.list >> ..\agent\agent-signals-marshal.c diff -Nru libnice-0.1.4/win32/vs9/libnice.def libnice-0.1.7/win32/vs9/libnice.def --- libnice-0.1.4/win32/vs9/libnice.def 2012-03-08 21:20:20.000000000 +0000 +++ libnice-0.1.7/win32/vs9/libnice.def 2014-04-25 01:09:45.000000000 +0000 @@ -8,6 +8,7 @@ nice_address_free nice_address_get_port nice_address_init +nice_address_ip_version nice_address_is_private nice_address_is_valid nice_address_new @@ -20,13 +21,24 @@ nice_agent_add_local_address nice_agent_add_stream nice_agent_attach_recv +nice_agent_forget_relays nice_agent_gather_candidates +nice_agent_generate_local_candidate_sdp +nice_agent_generate_local_sdp +nice_agent_generate_local_stream_sdp +nice_agent_get_default_local_candidate nice_agent_get_local_candidates nice_agent_get_local_credentials nice_agent_get_remote_candidates +nice_agent_get_selected_pair +nice_agent_get_selected_socket +nice_agent_get_stream_name nice_agent_get_type nice_agent_new nice_agent_new_reliable +nice_agent_parse_remote_candidate_sdp +nice_agent_parse_remote_sdp +nice_agent_parse_remote_stream_sdp nice_agent_remove_stream nice_agent_restart nice_agent_send @@ -37,10 +49,12 @@ nice_agent_set_selected_pair nice_agent_set_selected_remote_candidate nice_agent_set_software +nice_agent_set_stream_name nice_agent_set_stream_tos nice_candidate_copy nice_candidate_free nice_candidate_new +nice_component_state_to_string nice_debug_disable nice_debug_enable nice_interfaces_get_ip_for_interface diff -Nru libnice-0.1.4/win32/vs9/libnice.vcproj libnice-0.1.7/win32/vs9/libnice.vcproj --- libnice-0.1.4/win32/vs9/libnice.vcproj 2012-03-08 21:20:20.000000000 +0000 +++ libnice-0.1.7/win32/vs9/libnice.vcproj 2014-04-04 03:52:17.000000000 +0000 @@ -191,14 +191,6 @@ > - - - -